smart_archives_web/src/views/filesTransfer/issue/index.vue

133 lines
4.4 KiB
Vue

<template>
<!-- 档案移交申请 -->
<div class="app-container">
<TableModel :formLabel="formLabel" :showOperation="true" :showRightTools="true" ref="issueTableRef"
:columnsList="columnsList" :request-api="getTransferApplyListApi">
<template slot="btn">
<el-button plain size="mini" type="primary" icon="el-icon-plus" v-hasPermi="['transfer:apply:add']"
@click="handleAdd">
新增
</el-button>
</template>
<template slot="handle" slot-scope="{ data }">
<el-button plain size="mini" type="primary" icon="el-icon-edit" v-hasPermi="['transfer:apply:edit']"
@click="handleUpdate(data)">
修改
</el-button>
<el-button plain size="mini" type="danger" icon="el-icon-delete" v-hasPermi="['transfer:apply:del']"
@click="handleDelete(data)">
删除
</el-button>
<el-button plain size="mini" type="success" icon="el-icon-warning-outline" v-hasPermi="['transfer:apply:query']"
@click="handleDetail(data)">
详情
</el-button>
</template>
</TableModel>
<!-- 新增/编辑 -->
<IssueForm v-if="isflag" :isAdd="isAdd" :rowData="row" @handleQuery="handleQuery" :title="title"
@closeDialog="closeDialog" @showColose="showColose" :dataForm="row" :disabled="loading" :width="600" />
</div>
</template>
<script>
import TableModel from '@/components/TableModel'
import { columnsList, formLabel } from './config'
import {
delTransferApplyApi,
getTransferApplyListApi,
} from '@/api/filesTransfer/apply.js'
import IssueForm from './prop/issueForm'
import { encryptWithSM4 } from '@/utils/sm'
export default {
name: 'Issue',
dicts: ['pro_type', 'voltage_level'],
components: {
TableModel,
IssueForm
},
data() {
return {
formLabel,
columnsList,
getTransferApplyListApi,
title: "",
isflag: false,
isAdd: '',
row: {},
loading: false,
}
},
created() {
// 将字典数据填充到表单配置的下拉选项中
if (Array.isArray(this.formLabel)) {
this.formLabel.forEach((item) => {
if (item.f_dict && this.dict && this.dict.type && this.dict.type[item.f_dict]) {
this.$set(item, 'f_selList', this.dict.type[item.f_dict])
}
})
}
},
methods: {
/** 新增按钮操作 */
handleAdd() {
this.title = "新增";
this.isAdd = 'add';
this.isflag = true;
},
closeDialog() {
this.isflag = false;
},
showColose() {
this.isflag = false;
},
/** 修改操作 */
handleUpdate(row) {
this.title = "修改";
this.isAdd = 'edit';
this.row = row;
this.isflag = true;
},
// 详情
handleDetail(row) {
this.title = "详情";
this.isAdd = 'detail';
this.row = row;
this.isflag = true;
},
/* 搜索操作 */
handleQuery() {
this.$refs.issueTableRef.getTableList()
},
/** 删除操作 */
handleDelete(row) {
this.$modal.confirm(`是否确认删除此数据项?`).then(() => {
// 显示加载遮罩
this.$modal.loading("正在删除,请稍候...");
delTransferApplyApi({ id: row.id }).then(res => {
this.$modal.closeLoading();
if (res.code === 200) {
this.$modal.msgSuccess("删除成功");
this.handleQuery();
} else {
this.$modal.msgError(res.msg);
}
}).catch(error => {
this.$modal.closeLoading();
this.$modal.msgError("删除失败,请重试");
console.error('删除失败:', error);
});
}).catch(() => {
// 用户取消删除,不需要处理
});
},
},
}
</script>