Browse Source

feat: 新增表单和印章历史版本查询功能

yusheng 1 month ago
parent
commit
1b19d47a43

+ 5 - 4
src/views/formCodeManagement/formCodeDialog.vue

@@ -80,7 +80,7 @@
             <el-input
               v-model="form.formNumber"
               placeholder="请输入"
-              :disabled="title == '详情' || title == '变更'"
+              :disabled="title == '详情'"
               clearable
             />
           </el-form-item>
@@ -195,7 +195,7 @@
     formVersion: '',
     name: '',
     sourceCode: '',
-    sourceId: '',
+    parentId: '',
     status: 0
   };
 
@@ -248,8 +248,9 @@
           getFormCodeById(row.id).then((res) => {
             this.form = res;
             if (type == 'modify') {
-              this.form.sourceId = row.id;
-              this.form.sourceCode = row.formCode;
+              this.form.parentId = row.id;
+              this.form.sourceCode = row.code;
+              this.form.code = '';
             }
           });
           this.title =

+ 95 - 0
src/views/formCodeManagement/historyVersionDialog.vue

@@ -0,0 +1,95 @@
+<template>
+  <el-dialog
+    title="历史版本"
+    :visible.sync="visible"
+    width="900px"
+    :close-on-click-modal="false"
+    append-to-body
+  >
+    <ele-pro-table
+      ref="table"
+      row-key="id"
+      :columns="columns"
+      :datasource="datasource"
+      height="400px"
+      :need-page="false"
+    />
+  </el-dialog>
+</template>
+
+<script>
+  import { getFormCodeHistoryList } from '@/api/formCodeManagement';
+
+  export default {
+    name: 'HistoryVersionDialog',
+    data() {
+      return {
+        visible: false,
+        formCodeId: null,
+        // 表格列配置
+        columns: [
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 60,
+            align: 'center'
+          },
+          {
+            prop: 'formNumber',
+            label: '表单编号',
+            align: 'center',
+            minWidth: 130,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'formVersion',
+            label: '版本',
+            align: 'center',
+            width: 80
+          },
+          {
+            prop: 'effectiveDate',
+            label: '生效日期',
+            align: 'center',
+            width: 110
+          },
+          {
+            prop: 'changeTime',
+            label: '变更时间',
+            align: 'center',
+            width: 150
+          }
+        ]
+      };
+    },
+    methods: {
+      // 打开弹窗
+      open(formCodeId) {
+        this.formCodeId = formCodeId;
+        this.visible = true;
+        this.$nextTick(() => {
+          this.$refs.table.reload();
+        });
+      },
+      // 表格数据源
+      async datasource() {
+        if (!this.formCodeId) {
+          return { list: [], count: 0 };
+        }
+        const res = await getFormCodeHistoryList(this.formCodeId);
+        const list = res || [];
+        return {
+          list: list,
+          count: list.length
+        };
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  ::v-deep .el-dialog__body {
+    padding: 10px 20px 20px;
+  }
+</style>

+ 18 - 1
src/views/formCodeManagement/index.vue

@@ -73,6 +73,14 @@
               {{ row.status == 1 ? '启用' : '停用' }}
             </el-tag>
           </template>
+          <template v-slot:formVersion="{ row }">
+            <el-link
+              type="primary"
+              :underline="false"
+              @click="handleHistory(row)"
+              >{{ row.formVersion }}</el-link
+            >
+          </template>
           <template v-slot:action="{ row }">
             <el-link
               type="primary"
@@ -125,6 +133,8 @@
         ref="formCodeDialogRef"
         @reload="$refs.table.reload()"
       />
+      <!-- 历史版本弹窗 -->
+      <history-version-dialog ref="historyDialogRef" />
     </el-card>
     <process-submit-dialog
       :isNotNeedProcess="false"
@@ -138,6 +148,7 @@
 
 <script>
   import FormCodeDialog from './formCodeDialog.vue';
+  import HistoryVersionDialog from './historyVersionDialog.vue';
   import {
     getFormCodePage,
     deleteFormCode,
@@ -149,6 +160,7 @@
   export default {
     components: {
       FormCodeDialog,
+      HistoryVersionDialog,
       processSubmitDialog
     },
     data() {
@@ -196,7 +208,8 @@
             prop: 'formVersion',
             label: '表单版本',
             align: 'center',
-            minWidth: 90
+            minWidth: 90,
+            slot: 'formVersion'
           },
           {
             prop: 'documentCode',
@@ -373,6 +386,10 @@
       handleReset() {
         this.$refs.table.reload({ page: 1 });
       },
+      // 历史版本
+      handleHistory(row) {
+        this.$refs.historyDialogRef.open(row.id);
+      },
       // 表格数据源
       async datasource({ page, limit, where }) {
         return await getFormCodePage({ pageNum: page, size: limit, ...where });

+ 104 - 0
src/views/sealManagement/historyVersionDialog.vue

@@ -0,0 +1,104 @@
+<template>
+  <el-dialog
+    title="历史版本"
+    :visible.sync="visible"
+    width="900px"
+    :close-on-click-modal="false"
+    append-to-body
+  >
+    <ele-pro-table
+      ref="table"
+      row-key="id"
+      :columns="columns"
+      :datasource="datasource"
+      height="400px"
+      :need-page="false"
+    />
+  </el-dialog>
+</template>
+
+<script>
+  import { getSealHistoryList } from '@/api/sealManagement';
+
+  export default {
+    name: 'HistoryVersionDialog',
+    data() {
+      return {
+        visible: false,
+        sealId: null,
+        // 表格列配置
+        columns: [
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 60,
+            align: 'center'
+          },
+          {
+            prop: 'sealNumber',
+            label: '印章编号',
+            align: 'center',
+            minWidth: 150,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'version',
+            label: '版本',
+            align: 'center',
+            width: 80
+          },
+          {
+            prop: 'validPeriod',
+            label: '有效期',
+            align: 'center',
+            minWidth: 200,
+            formatter: (row) => {
+              if (row.isLongTerm == 1) {
+                return '长期有效';
+              }
+              if (row.validStartDate && row.validEndDate) {
+                return row.validStartDate + '至' + row.validEndDate;
+              }
+              return '-';
+            }
+          },
+          {
+            prop: 'changeTime',
+            label: '变更时间',
+            align: 'center',
+            width: 150
+          }
+        ]
+      };
+    },
+    methods: {
+      // 打开弹窗
+      open(sealId) {
+        this.sealId = sealId;
+        this.visible = true;
+        this.$nextTick(() => {
+          this.$refs.table.reload();
+        });
+      },
+      // 表格数据源
+      async datasource() {
+        if (!this.sealId) {
+          return { list: [], count: 0 };
+        }
+        const res = await getSealHistoryList(this.sealId);
+        const list = res || [];
+        return {
+          list: list,
+          count: list.length
+        };
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  ::v-deep .el-dialog__body {
+    padding: 10px 20px 20px;
+  }
+</style>

+ 17 - 0
src/views/sealManagement/index.vue

@@ -53,6 +53,14 @@
               >{{ row.code }}</el-link
             >
           </template>
+          <template v-slot:version="{ row }">
+            <el-link
+              type="primary"
+              :underline="false"
+              @click="handleHistory(row)"
+              >{{ row.version }}</el-link
+            >
+          </template>
           <template v-slot:action="{ row }">
             <el-link
               type="primary"
@@ -102,6 +110,8 @@
 
       <!-- 新增/编辑弹窗 -->
       <seal-dialog ref="sealDialogRef" @reload="$refs.table.reload()" />
+      <!-- 历史版本弹窗 -->
+      <history-version-dialog ref="historyDialogRef" />
     </el-card>
     <process-submit-dialog
       :isNotNeedProcess="false"
@@ -115,6 +125,7 @@
 
 <script>
   import SealDialog from './sealDialog.vue';
+  import HistoryVersionDialog from './historyVersionDialog.vue';
   import {
     getSealPage,
     deleteSeal,
@@ -128,6 +139,7 @@
   export default {
     components: {
       SealDialog,
+      HistoryVersionDialog,
       processSubmitDialog
     },
     data() {
@@ -183,6 +195,7 @@
             label: '版本',
             align: 'center',
             minWidth: 80,
+            slot: 'version',
             showOverflowTooltip: true
           },
           {
@@ -420,6 +433,10 @@
       handleReset() {
         this.$refs.table.reload({ page: 1 });
       },
+      // 历史版本
+      handleHistory(row) {
+        this.$refs.historyDialogRef.open(row.id);
+      },
       // 表格数据源
       async datasource({ page, limit, where }) {
         return await getSealPage({ pageNum: page, size: limit, ...where });