|
|
@@ -0,0 +1,417 @@
|
|
|
+<template>
|
|
|
+ <div class="form-code-management">
|
|
|
+ <el-card shadow="never" class="config-card">
|
|
|
+ <!-- 搜索区域 -->
|
|
|
+ <div class="search-area">
|
|
|
+ <seek-page
|
|
|
+ :seekList="seekList"
|
|
|
+ @search="handleSearch"
|
|
|
+ @reset="handleReset"
|
|
|
+ :formLength="3"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 列表视图 -->
|
|
|
+ <div class="list-view">
|
|
|
+ <ele-pro-table
|
|
|
+ ref="table"
|
|
|
+ row-key="id"
|
|
|
+ :columns="columns"
|
|
|
+ :datasource="datasource"
|
|
|
+ :cache-key="cacheKeyUrl"
|
|
|
+ height="calc(100vh - 350px)"
|
|
|
+ >
|
|
|
+ <template v-slot:toolbar>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ icon="el-icon-plus"
|
|
|
+ @click="handleAdd"
|
|
|
+ >新增</el-button
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ <template v-slot:formCode="{ row }">
|
|
|
+ <el-link
|
|
|
+ type="primary"
|
|
|
+ :underline="false"
|
|
|
+ @click="handleEdit(row, 'view')"
|
|
|
+ >{{ row.formCode }}</el-link
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template v-slot:approvalStatus="{ row }">
|
|
|
+ <el-tag
|
|
|
+ :type="getApproveStatusType(row.approvalStatus)"
|
|
|
+ size="small"
|
|
|
+ >{{ reviewStatus[row.approvalStatus] }}</el-tag
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ <template v-slot:publishStatus="{ row }">
|
|
|
+ <el-tag
|
|
|
+ :type="row.publishStatus == 1 ? 'success' : 'info'"
|
|
|
+ size="small"
|
|
|
+ >
|
|
|
+ {{
|
|
|
+ row.publishStatus == 1
|
|
|
+ ? '已发布'
|
|
|
+ : row.publishStatus == 2
|
|
|
+ ? '已撤销'
|
|
|
+ : '未发布'
|
|
|
+ }}
|
|
|
+ </el-tag>
|
|
|
+ </template>
|
|
|
+ <template v-slot:code="{ row }">
|
|
|
+ <el-link
|
|
|
+ type="primary"
|
|
|
+ :underline="false"
|
|
|
+ @click="handleEdit(row, 'view')"
|
|
|
+ >{{ row.code }}</el-link
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ <template v-slot:status="{ row }">
|
|
|
+ <el-tag :type="row.status == 1 ? 'success' : 'danger'" size="small">
|
|
|
+ {{ row.status == 1 ? '启用' : '停用' }}
|
|
|
+ </el-tag>
|
|
|
+ </template>
|
|
|
+ <template v-slot:action="{ row }">
|
|
|
+ <el-link
|
|
|
+ type="primary"
|
|
|
+ :underline="false"
|
|
|
+ @click="handleEdit(row)"
|
|
|
+ v-if="[0, 3].includes(row.approvalStatus) && row.isLatest == 1"
|
|
|
+ >修改</el-link
|
|
|
+ >
|
|
|
+ <el-link
|
|
|
+ type="primary"
|
|
|
+ :underline="false"
|
|
|
+ @click="handleSubmit(row)"
|
|
|
+ style="margin-left: 8px"
|
|
|
+ v-if="[0, 3].includes(row.approvalStatus) && row.isLatest == 1"
|
|
|
+ >提交</el-link
|
|
|
+ >
|
|
|
+ <el-link
|
|
|
+ type="danger"
|
|
|
+ :underline="false"
|
|
|
+ @click="handleDelete(row)"
|
|
|
+ style="margin-left: 8px"
|
|
|
+ v-if="[0, 3].includes(row.approvalStatus) && row.isLatest == 1"
|
|
|
+ >删除</el-link
|
|
|
+ >
|
|
|
+ <el-link
|
|
|
+ type="primary"
|
|
|
+ :underline="false"
|
|
|
+ @click="handleModify(row)"
|
|
|
+ v-if="[2].includes(row.approvalStatus) && row.isLatest == 1"
|
|
|
+ >变更</el-link
|
|
|
+ >
|
|
|
+ <el-link
|
|
|
+ type="danger"
|
|
|
+ :underline="false"
|
|
|
+ @click="handleStop(row)"
|
|
|
+ v-if="
|
|
|
+ [2].includes(row.approvalStatus) &&
|
|
|
+ row.status == 1 &&
|
|
|
+ row.isLatest == 1
|
|
|
+ "
|
|
|
+ style="margin-left: 8px"
|
|
|
+ >停用</el-link
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ </ele-pro-table>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 新增/编辑弹窗 -->
|
|
|
+ <form-code-dialog
|
|
|
+ ref="formCodeDialogRef"
|
|
|
+ @reload="$refs.table.reload()"
|
|
|
+ />
|
|
|
+ </el-card>
|
|
|
+ <process-submit-dialog
|
|
|
+ :isNotNeedProcess="false"
|
|
|
+ :processSubmitDialogFlag.sync="processSubmitDialogFlag"
|
|
|
+ v-if="processSubmitDialogFlag"
|
|
|
+ ref="processSubmitDialogRef"
|
|
|
+ @reload="handleSearch"
|
|
|
+ ></process-submit-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import FormCodeDialog from './formCodeDialog.vue';
|
|
|
+ import {
|
|
|
+ getFormCodePage,
|
|
|
+ deleteFormCode,
|
|
|
+ disableFormCode
|
|
|
+ } from '@/api/formCodeManagement';
|
|
|
+ import { reviewStatus } from '@/enum/dict';
|
|
|
+ import processSubmitDialog from '@/components/processSubmitDialog/processSubmitDialog.vue';
|
|
|
+
|
|
|
+ export default {
|
|
|
+ components: {
|
|
|
+ FormCodeDialog,
|
|
|
+ processSubmitDialog
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ processSubmitDialogFlag: false,
|
|
|
+ reviewStatus,
|
|
|
+ // 表格列配置
|
|
|
+ columns: [
|
|
|
+ {
|
|
|
+ columnKey: 'selection',
|
|
|
+ type: 'selection',
|
|
|
+ width: 55,
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ columnKey: 'index',
|
|
|
+ label: '序号',
|
|
|
+ type: 'index',
|
|
|
+ width: 55,
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'code',
|
|
|
+ label: '表单编号编码',
|
|
|
+ align: 'center',
|
|
|
+ slot: 'code',
|
|
|
+ minWidth: 150,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'name',
|
|
|
+ label: '表单编号名称',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 140,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'formNumber',
|
|
|
+ label: '表单编号',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 120,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'formVersion',
|
|
|
+ label: '表单版本',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 90
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'documentCode',
|
|
|
+ label: '关联单据编码',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 130,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'documentName',
|
|
|
+ label: '关联单据编码名称',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 150,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'effectiveDate',
|
|
|
+ label: '生效日期',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 110,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'approvalStatus',
|
|
|
+ label: '审批状态',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 100,
|
|
|
+ slot: 'approvalStatus'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'publishStatus',
|
|
|
+ label: '发布状态',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 100,
|
|
|
+ slot: 'publishStatus'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'status',
|
|
|
+ label: '状态',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 80,
|
|
|
+ slot: 'status'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'createUserName',
|
|
|
+ label: '创建人',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 120
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'createTime',
|
|
|
+ label: '创建时间',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 120
|
|
|
+ },
|
|
|
+ {
|
|
|
+ columnKey: 'action',
|
|
|
+ label: '操作',
|
|
|
+ width: 200,
|
|
|
+ align: 'center',
|
|
|
+ slot: 'action'
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ cacheKeyUrl: 'form-code-management-list'
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ seekList() {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ label: '关键词',
|
|
|
+ value: 'keyword',
|
|
|
+ type: 'input',
|
|
|
+ placeholder: '表单编码、名称'
|
|
|
+ },
|
|
|
+
|
|
|
+ {
|
|
|
+ label: '审批状态',
|
|
|
+ value: 'approvalStatus',
|
|
|
+ type: 'select',
|
|
|
+ placeholder: '请选择',
|
|
|
+ planList: [
|
|
|
+ { label: '草稿', value: 0 },
|
|
|
+ { label: '审核中', value: 1 },
|
|
|
+ { label: '已审核', value: 2 },
|
|
|
+ { label: '已驳回', value: 3 }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 获取审批状态类型
|
|
|
+ getApproveStatusType(status) {
|
|
|
+ const typeMap = {
|
|
|
+ 0: 'info',
|
|
|
+ 1: 'warning',
|
|
|
+ 2: 'success',
|
|
|
+ 3: 'danger'
|
|
|
+ };
|
|
|
+ return typeMap[status] || 'info';
|
|
|
+ },
|
|
|
+ // 新增
|
|
|
+ handleAdd() {
|
|
|
+ this.$refs.formCodeDialogRef.open();
|
|
|
+ },
|
|
|
+ // 编辑
|
|
|
+ handleEdit(row, type = 'edit') {
|
|
|
+ this.$refs.formCodeDialogRef.open(row, type);
|
|
|
+ },
|
|
|
+ // 提交
|
|
|
+ handleSubmit(res) {
|
|
|
+ this.processSubmitDialogFlag = true;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ let params = {
|
|
|
+ businessId: res.id,
|
|
|
+ businessKey: 'main_form_number_config_approval',
|
|
|
+ formCreateUserId: res.createUserId,
|
|
|
+ variables: {
|
|
|
+ businessCode: res.code,
|
|
|
+ businessName: res.name,
|
|
|
+ businessType: '表单编号配置'
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ this.$refs.processSubmitDialogRef.init(params);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 删除
|
|
|
+ handleDelete(row) {
|
|
|
+ this.$confirm('确认删除该表单编号吗?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ .then(async () => {
|
|
|
+ try {
|
|
|
+ await deleteFormCode(row.id);
|
|
|
+ this.$message.success('删除成功');
|
|
|
+ this.$refs.table.reload();
|
|
|
+ } catch (error) {
|
|
|
+ this.$message.error(error.message || '删除失败');
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ },
|
|
|
+ // 变更
|
|
|
+ handleModify(row) {
|
|
|
+ this.$refs.formCodeDialogRef.open(row, 'modify');
|
|
|
+ },
|
|
|
+ // 停用
|
|
|
+ handleStop(row) {
|
|
|
+ this.$confirm('确认停用该表单编号吗?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ .then(async () => {
|
|
|
+ try {
|
|
|
+ await disableFormCode(row.id);
|
|
|
+ this.$message.success('停用成功');
|
|
|
+ this.$refs.table.reload();
|
|
|
+ } catch (error) {
|
|
|
+ this.$message.error(error.message || '停用失败');
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ },
|
|
|
+ // 搜索
|
|
|
+ handleSearch(where) {
|
|
|
+ this.$refs.table.reload({ page: 1, where });
|
|
|
+ },
|
|
|
+ // 重置
|
|
|
+ handleReset() {
|
|
|
+ this.$refs.table.reload({ page: 1 });
|
|
|
+ },
|
|
|
+ // 表格数据源
|
|
|
+ async datasource({ page, limit, where }) {
|
|
|
+ return await getFormCodePage({ pageNum: page, size: limit, ...where });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+ .form-code-management {
|
|
|
+ .config-card {
|
|
|
+ height: calc(100vh - 100px);
|
|
|
+
|
|
|
+ ::v-deep .el-card__body {
|
|
|
+ height: 100%;
|
|
|
+ padding: 15px;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 搜索区域
|
|
|
+ .search-area {
|
|
|
+ margin-bottom: 15px;
|
|
|
+ padding-bottom: 15px;
|
|
|
+ border-bottom: 1px solid #ebeef5;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 列表视图
|
|
|
+ .list-view {
|
|
|
+ flex: 1;
|
|
|
+ overflow: hidden;
|
|
|
+
|
|
|
+ ::v-deep .ele-pro-table {
|
|
|
+ .el-table {
|
|
|
+ border: 1px solid #ebeef5;
|
|
|
+ border-radius: 4px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+</style>
|