Ver código fonte

feat: 新增表单编号管理功能

新增表单编号管理模块,包括新增、修改、变更、删除、启用、停用、详情查看、历史版本查询等功能,并支持单据编码选择和流程提交。同时更新印章管理API接口路径。
yusheng 3 meses atrás
pai
commit
acfcce35f6

+ 125 - 0
src/api/formCodeManagement/index.js

@@ -0,0 +1,125 @@
+import request from '@/utils/request';
+
+/**
+ * 表单编号管理API
+ */
+
+/**
+ * 新增表单编号
+ * @param {Object} data 表单编号数据
+ * @returns {Promise}
+ */
+export async function addFormCode(data) {
+  const res = await request.post('/main/form/number/config/add', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+/**
+ * 变更表单编号
+ * @param {Object} data 表单编号数据
+ * @returns {Promise}
+ */
+export async function changeFormCode(data) {
+  const res = await request.post('/main/form/number/config/change', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+/**
+ * 删除表单编号
+ * @param {string|number} id 表单编号ID
+ * @returns {Promise}
+ */
+export async function deleteFormCode(id) {
+  const res = await request.get(`/main/form/number/config/delete/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+/**
+ * 停用表单编号
+ * @param {string|number} id 表单编号ID
+ * @returns {Promise}
+ */
+export async function disableFormCode(id) {
+  const res = await request.get(`/main/form/number/config/disable/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+/**
+ * 启用表单编号
+ * @param {string|number} id 表单编号ID
+ * @returns {Promise}
+ */
+export async function enableFormCode(id) {
+  const res = await request.put(`/main/form/number/config/enable/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+/**
+ * 根据ID查询表单编号详情
+ * @param {string|number} id 表单编号ID
+ * @returns {Promise}
+ */
+export async function getFormCodeById(id) {
+  const res = await request.get(`/main/form/number/config/getById/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+/**
+ * 查询表单编号历史版本
+ * @param {string|number} formCodeId 表单编号ID
+ * @returns {Promise}
+ */
+export async function getFormCodeHistoryList(formCodeId) {
+  const res = await request.get(
+    `/main/form/number/config/getHistoryList/${formCodeId}`
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+/**
+ * 分页查询表单编号列表
+ * @param {Object} data 查询参数
+ * @returns {Promise}
+ */
+export async function getFormCodePage(data) {
+  const res = await request.post(`/main/form/number/config/page`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+/**
+ * 更新表单编号
+ * @param {Object} data 表单编号数据
+ * @returns {Promise}
+ */
+export async function updateFormCode(data) {
+  const res = await request.post('/main/form/number/config/update', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+

+ 11 - 11
src/api/sealManagement/index.js

@@ -6,7 +6,7 @@ import request from '@/utils/request';
  * @returns {Promise}
  */
 export async function addSeal(data) {
-  const res = await request.post('/seal/management/add', data);
+  const res = await request.post('/main/seal/management/add', data);
   if (res.data.code == 0) {
     return res.data.data;
   }
@@ -19,7 +19,7 @@ export async function addSeal(data) {
  * @returns {Promise}
  */
 export async function changeSeal(data) {
-  const res = await request.post('/seal/management/change', data);
+  const res = await request.post('/main/seal/management/change', data);
   if (res.data.code == 0) {
     return res.data.data;
   }
@@ -32,7 +32,7 @@ export async function changeSeal(data) {
  * @returns {Promise}
  */
 export async function deleteSeal(id) {
-  const res = await request.get(`/seal/management/delete/${id}`);
+  const res = await request.get(`/main/seal/management/delete/${id}`);
   if (res.data.code == 0) {
     return res.data.data;
   }
@@ -45,7 +45,7 @@ export async function deleteSeal(id) {
  * @returns {Promise}
  */
 export async function disableSeal(id) {
-  const res = await request.get(`/seal/management/disable/${id}`);
+  const res = await request.get(`/main/seal/management/disable/${id}`);
   if (res.data.code == 0) {
     return res.data.data;
   }
@@ -58,7 +58,7 @@ export async function disableSeal(id) {
  * @returns {Promise}
  */
 export async function enableSeal(id) {
-  const res = await request.put(`/seal/management/enable/${id}`);
+  const res = await request.put(`/main/seal/management/enable/${id}`);
   if (res.data.code == 0) {
     return res.data.data;
   }
@@ -71,7 +71,7 @@ export async function enableSeal(id) {
  * @returns {Promise}
  */
 export async function getSealById(id) {
-  const res = await request.get(`/seal/management/getById/${id}`);
+  const res = await request.get(`/main/seal/management/getById/${id}`);
   if (res.data.code == 0) {
     return res.data.data;
   }
@@ -84,7 +84,7 @@ export async function getSealById(id) {
  * @returns {Promise}
  */
 export async function getSealHistoryList(sealId) {
-  const res = await request.get(`/seal/management/getHistoryList/${sealId}`);
+  const res = await request.get(`/main/seal/management/getHistoryList/${sealId}`);
   if (res.data.code == 0) {
     return res.data.data;
   }
@@ -97,7 +97,7 @@ export async function getSealHistoryList(sealId) {
  * @returns {Promise}
  */
 export async function getSealPage(data) {
-  const res = await request.post(`/seal/management/page`, data);
+  const res = await request.post(`/main/seal/management/page`, data);
   if (res.data.code == 0) {
     return res.data.data;
   }
@@ -109,7 +109,7 @@ export async function getSealPage(data) {
  * @returns {Promise}
  */
 export async function getUsageRecordPage(data) {
-  const res = await request.post(`/seal/management/usageRecord/page`, data);
+  const res = await request.post(`/main/seal/management/usageRecord/page`, data);
   if (res.data.code == 0) {
     return res.data.data;
   }
@@ -121,7 +121,7 @@ export async function getUsageRecordPage(data) {
  * @returns {Promise}
  */
 export async function updateSeal(data) {
-  const res = await request.post('/seal/management/update', data);
+  const res = await request.post('/main/seal/management/update', data);
   if (res.data.code == 0) {
     return res.data.data;
   }
@@ -137,7 +137,7 @@ export async function updateSeal(data) {
 export async function getSealUsageRecordList(id, params) {
   let par = new URLSearchParams(params);
   const res = await request.get(
-    `/seal/management/usageRecord/listBySealId/${id}?` + par,
+    `/main/seal/management/usageRecord/listBySealId/${id}?` + par,
     {}
   );
   if (res.data.code == 0) {

+ 1 - 0
src/components/processSubmitDialog/processSubmitDialog.vue

@@ -498,6 +498,7 @@
       },
       cancel() {
         this.$emit('update:processSubmitDialogFlag', false);
+        this.$emit('reload');
       }
     }
   };

+ 212 - 0
src/views/codeManagement/components/code-select-dialog.vue

@@ -0,0 +1,212 @@
+<template>
+  <ele-modal
+    :visible="visible"
+    title="选择编码"
+    width="60%"
+    :destroy-on-close="true"
+    @update:visible="updateVisible"
+    :maxable="true"
+    append-to-body
+  >
+    <!-- 搜索区域 -->
+    <div class="search-area">
+      <el-form
+        size="small"
+        class="ele-form-search"
+        @keyup.enter.native="handleSearch"
+        @submit.native.prevent
+      >
+        <el-row :gutter="10">
+          <el-col :span="8">
+            <el-form-item>
+              <el-input
+                clearable
+                size="small"
+                v-model.trim="where.code"
+                placeholder="请输入编码"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item>
+              <el-input
+                clearable
+                size="small"
+                v-model.trim="where.name"
+                placeholder="请输入名称"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item>
+              <el-button
+                size="small"
+                type="primary"
+                icon="el-icon-search"
+                @click="handleSearch"
+              >
+                查询
+              </el-button>
+              <el-button
+                size="small"
+                type="primary"
+                icon="el-icon-refresh-left"
+                @click="handleReset"
+              >
+                重置
+              </el-button>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+    </div>
+
+    <!-- 数据表格 -->
+    <ele-pro-table
+      ref="table"
+      :columns="columns"
+      :datasource="datasource"
+      height="400px"
+      :cache-key="cacheKeyUrl"
+      @selection-change="handleSelectionChange"
+    >
+    </ele-pro-table>
+
+    <template slot="footer">
+      <el-button type="primary" size="small" @click="handleConfirm"
+        >确定</el-button
+      >
+      <el-button size="small" @click="handleCancel">取消</el-button>
+    </template>
+  </ele-modal>
+</template>
+
+<script>
+  import { getCodeList } from '@/api/codeManagement/index';
+
+  export default {
+    name: 'CodeSelectDialog',
+    data() {
+      return {
+        visible: false,
+        where: {
+          code: '',
+          name: ''
+        },
+        selectedRow: null,
+        cacheKeyUrl: 'code-select-dialog',
+        // 表格列配置
+        columns: [
+          {
+            columnKey: 'selection',
+            type: 'selection',
+            width: 55,
+            align: 'center'
+          },
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 60,
+            align: 'center'
+          },
+          {
+            prop: 'code',
+            label: '编码',
+            showOverflowTooltip: true,
+            minWidth: 180
+          },
+          {
+            prop: 'name',
+            label: '名称',
+            showOverflowTooltip: true,
+            minWidth: 150
+          },
+          {
+            prop: 'remark',
+            label: '描述',
+            align: 'left',
+            minWidth: 200,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'createTime',
+            label: '创建时间',
+            align: 'left',
+            width: 160,
+            showOverflowTooltip: true
+          }
+        ]
+      };
+    },
+    methods: {
+      open() {
+        this.visible = true;
+        this.where = { code: '', name: '' };
+        this.selectedRow = null;
+        this.$nextTick(() => {
+          this.$refs.table.reload();
+        });
+      },
+      updateVisible(val) {
+        this.visible = val;
+        if (!val) {
+          this.selectedRow = null;
+        }
+      },
+      /* 表格数据源 */
+      datasource({ page, limit, where, order }) {
+        return getCodeList({
+          ...where,
+          ...order,
+          pageNum: page,
+          size: limit
+        });
+      },
+      /* 搜索 */
+      handleSearch() {
+        this.$refs.table.reload({ page: 1, where: this.where });
+      },
+      /* 重置 */
+      handleReset() {
+        this.where = { code: '', name: '' };
+        this.handleSearch();
+      },
+      /* 单选处理 */
+      handleSelectionChange(selection) {
+        // 单选逻辑:只保留最后选中的项
+        if (selection.length > 1) {
+          const lastSelected = selection[selection.length - 1];
+          this.$refs.table.$refs.table.clearSelection();
+          this.$refs.table.$refs.table.toggleRowSelection(lastSelected, true);
+          this.selectedRow = lastSelected;
+        } else if (selection.length === 1) {
+          this.selectedRow = selection[0];
+        } else {
+          this.selectedRow = null;
+        }
+      },
+      /* 确定 */
+      handleConfirm() {
+        if (!this.selectedRow) {
+          this.$message.warning('请选择一条记录');
+          return;
+        }
+        this.$emit('confirm', this.selectedRow);
+        this.visible = false;
+      },
+      /* 取消 */
+      handleCancel() {
+        this.visible = false;
+      }
+    }
+  };
+</script>
+
+<style scoped>
+  .search-area {
+    margin-bottom: 15px;
+    padding-bottom: 15px;
+    border-bottom: 1px solid #ebeef5;
+  }
+</style>

+ 340 - 0
src/views/formCodeManagement/formCodeDialog.vue

@@ -0,0 +1,340 @@
+<template>
+  <ele-modal
+    :visible="visible"
+    :title="title"
+    width="65%"
+    :destroy-on-close="true"
+    @update:visible="updateVisible"
+    :maxable="true"
+    append-to-body
+  >
+    <div class="switch" v-if="title == '详情'">
+      <div class="switch_left">
+        <ul>
+          <li
+            v-for="item in tabOptions"
+            :key="item.key"
+            :class="{ active: activeComp == item.key }"
+            @click="activeComp = item.key"
+          >
+            {{ item.name }}
+          </li>
+        </ul>
+      </div>
+    </div>
+    <el-form
+      ref="formRef"
+      :model="form"
+      :rules="rules"
+      label-width="130px"
+      size="small"
+      v-show="activeComp == 'main'"
+      style="margin-top: 15px"
+    >
+      <!-- 第一行:表单编号编码 + 来源表单编号编码 -->
+      <el-row :gutter="20">
+        <el-col :span="12">
+          <el-form-item label="表单编号编码" prop="code">
+            <el-input
+              v-model="form.code"
+              placeholder="系统自动生成,唯一码"
+              disabled
+            />
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="来源表单编号编码" prop="sourceCode">
+            <el-input v-model="form.sourceCode" placeholder=" " disabled />
+          </el-form-item>
+        </el-col>
+      </el-row>
+
+      <!-- 第二行:表单编号名称 + 版本 -->
+      <el-row :gutter="20">
+        <el-col :span="12">
+          <el-form-item label="表单编号名称" prop="name" required>
+            <el-input
+              v-model="form.name"
+              placeholder="请输入"
+              :disabled="title == '详情' || title == '变更'"
+              clearable
+            />
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="版本" prop="formVersion" required>
+            <el-input
+              v-model="form.formVersion"
+              placeholder="请输入"
+              :disabled="title == '详情'"
+              clearable
+            />
+          </el-form-item>
+        </el-col>
+      </el-row>
+
+      <!-- 第三行:表单编号 -->
+      <el-row :gutter="20">
+        <el-col :span="12">
+          <el-form-item label="表单编号" prop="formNumber" required>
+            <el-input
+              v-model="form.formNumber"
+              placeholder="请输入"
+              :disabled="title == '详情' || title == '变更'"
+              clearable
+            />
+          </el-form-item>
+        </el-col>
+      </el-row>
+
+      <!-- 第四行:选择单据编码 + 单据编码名称 -->
+      <el-row :gutter="20">
+        <el-col :span="12">
+          <el-form-item label="选择单据编码" prop="documentCode" required>
+            <el-input
+              v-model="form.documentCode"
+              placeholder="请选择"
+              readonly
+              :disabled="title == '详情' || title == '变更'"
+              @click.native="$refs.codeSelectDialog.open()"
+            />
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="单据编码名称" prop="documentName">
+            <el-input
+              v-model="form.documentName"
+              placeholder="根据选择的单据编码,自动带出名称"
+              disabled
+            />
+          </el-form-item>
+        </el-col>
+      </el-row>
+
+      <!-- 第五行:生效日期 + 状态 -->
+      <el-row :gutter="20">
+        <el-col :span="12">
+          <el-form-item label="生效日期" prop="effectiveDate" required>
+            <el-date-picker
+              v-model="form.effectiveDate"
+              type="date"
+              placeholder="年/月/日"
+              value-format="yyyy-MM-dd"
+              :disabled="title == '详情'"
+              style="width: 100%"
+            />
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="状态" prop="status" required>
+            <el-switch
+              v-model="form.status"
+              disabled
+              :active-value="1"
+              :inactive-value="0"
+            />
+          </el-form-item>
+        </el-col>
+      </el-row>
+    </el-form>
+
+    <template slot="footer">
+      <el-button
+        type="primary"
+        size="small"
+        @click="handleSave"
+        v-if="title != '详情'"
+        >保存</el-button
+      >
+      <el-button
+        type="primary"
+        size="small"
+        @click="handleSave('sub')"
+        v-if="title != '详情'"
+        >保存并提交</el-button
+      >
+      <el-button size="small" @click="handleCancel">取消</el-button>
+    </template>
+    <bpmDetail
+      v-if="activeComp == 'bpm' && form.processInstanceId"
+      :id="form.processInstanceId"
+    ></bpmDetail>
+    <codeSelectDialog
+      ref="codeSelectDialog"
+      @confirm="handleDocCodeChange"
+    ></codeSelectDialog>
+    <process-submit-dialog
+      :isNotNeedProcess="false"
+      :processSubmitDialogFlag.sync="processSubmitDialogFlag"
+      v-if="processSubmitDialogFlag"
+      ref="processSubmitDialogRef"
+      @reload="reload"
+    ></process-submit-dialog>
+  </ele-modal>
+</template>
+
+<script>
+  import {
+    addFormCode,
+    changeFormCode,
+    updateFormCode,
+    getFormCodeById
+  } from '@/api/formCodeManagement';
+  import DictSelection from '@/components/Dict/DictSelection.vue';
+  import bpmDetail from '@/views/bpm/processInstance/businessDetail.vue';
+  import codeSelectDialog from '@/views/codeManagement/components/code-select-dialog.vue';
+  import processSubmitDialog from '@/components/processSubmitDialog/processSubmitDialog.vue';
+
+  const defaultForm = {
+    code: '',
+    documentCode: '',
+    documentId: '',
+    documentName: '',
+    effectiveDate: '',
+    formNumber: '',
+    formVersion: '',
+    name: '',
+    sourceCode: '',
+    sourceId: '',
+    status: 0
+  };
+
+  export default {
+    components: {
+      DictSelection,
+      bpmDetail,
+      codeSelectDialog,
+      processSubmitDialog
+    },
+    name: 'FormCodeDialog',
+    data() {
+      return {
+        activeComp: 'main',
+        tabOptions: [
+          { key: 'main', name: '详情' },
+          { key: 'bpm', name: '流程详情' }
+        ],
+        visible: false,
+        title: '新增',
+        processSubmitDialogFlag: '',
+        form: {
+          ...defaultForm
+        },
+        rules: {
+          name: [
+            { required: true, message: '请输入表单编号名称', trigger: 'blur' }
+          ],
+          formNumber: [
+            { required: true, message: '请输入表单编号', trigger: 'blur' }
+          ],
+          formVersion: [
+            { required: true, message: '请输入版本', trigger: 'blur' }
+          ],
+          documentName: [
+            { required: true, message: '请选择单据编码', trigger: 'change' }
+          ],
+          effectiveDate: [
+            { required: true, message: '请选择生效日期', trigger: 'change' }
+          ]
+        }
+      };
+    },
+
+    methods: {
+      open(row, type = 'add') {
+        this.activeComp = 'main';
+
+        if (row && (type == 'edit' || type == 'modify' || type == 'view')) {
+          getFormCodeById(row.id).then((res) => {
+            this.form = res;
+            if (type == 'modify') {
+              this.form.sourceId = row.id;
+              this.form.sourceCode = row.formCode;
+            }
+          });
+          this.title =
+            type == 'edit' ? '修改' : type == 'modify' ? '变更' : '详情';
+        } else {
+          this.title = '新增';
+          this.resetForm();
+        }
+        this.visible = true;
+      },
+      updateVisible(val) {
+        this.visible = val;
+        if (!val) {
+          this.resetForm();
+        }
+      },
+      resetForm() {
+        this.form = {
+          ...defaultForm
+        };
+        this.$nextTick(() => {
+          this.$refs.formRef && this.$refs.formRef.clearValidate();
+        });
+      },
+      // 单据编码变化时自动带出名称
+      handleDocCodeChange(data) {
+        this.form.documentCode = data.code;
+        this.form.documentId = data.id;
+        this.form.documentName = data.name;
+      },
+
+      // 保存
+      async handleSave(type) {
+        this.$refs.formRef.validate(async (valid) => {
+          if (valid) {
+            let api =
+              this.title === '新增'
+                ? addFormCode
+                : this.title === '变更'
+                ? changeFormCode
+                : updateFormCode;
+            try {
+              api(this.form).then((res) => {
+                if (type === 'sub') {
+                  this.sub(this.title == '修改' ? this.form.id : res);
+                  return;
+                }
+                this.$message.success('保存成功');
+                this.$emit('reload');
+                this.visible = false;
+              });
+            } catch (error) {
+              this.$message.error(error.message || '保存失败');
+            }
+          }
+        });
+      },
+      async sub(res) {
+        let data = await getFormCodeById(res);
+        this.processSubmitDialogFlag = true;
+        this.$nextTick(() => {
+          let params = {
+            businessId: data.id,
+            businessKey: 'main_form_number_config_approval',
+            formCreateUserId: data.createUserId,
+            variables: {
+              businessCode: data.code,
+              businessName: data.name,
+              businessType: '表单编号配置'
+            }
+          };
+
+          this.$refs.processSubmitDialogRef.init(params);
+        });
+      },
+      // 取消
+      handleCancel() {
+        this.visible = false;
+      },
+      reload() {
+        this.$emit('reload');
+        this.visible = false;
+      }
+    }
+  };
+</script>
+
+<style scoped></style>

+ 417 - 0
src/views/formCodeManagement/index.vue

@@ -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>

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

@@ -243,6 +243,18 @@
               return _row.status == 1 ? '启用' : '停用';
             }
           },
+          {
+            prop: 'createUserName',
+            label: '创建人',
+            align: 'center',
+            minWidth: 120
+          },
+          {
+            prop: 'createTime',
+            label: '创建时间',
+            align: 'center',
+            minWidth: 120
+          },
           {
             columnKey: 'action',
             label: '操作',

+ 58 - 63
src/views/sealManagement/sealDialog.vue

@@ -118,7 +118,7 @@
             </el-radio-group>
           </el-form-item>
         </el-col>
-        <el-col :span="12">
+        <!-- <el-col :span="12">
           <el-form-item label="状态" prop="status" required>
             <el-switch
               v-model="form.status"
@@ -127,7 +127,7 @@
               :inactive-value="0"
             />
           </el-form-item>
-        </el-col>
+        </el-col> -->
       </el-row>
 
       <!-- 非长期时显示有效期 -->
@@ -189,18 +189,25 @@
       <el-button
         type="primary"
         size="small"
-        @click="handleSaveAndSubmit"
+        @click="handleSave('sub')"
         v-if="title != '详情'"
         >保存并提交</el-button
       >
       <el-button size="small" @click="handleCancel">取消</el-button>
     </template>
-    <addUser ref="addREf" @success="userBk"></addUser>
+    <addUser ref="addREf" @changeParent="userBk"></addUser>
     <bpmDetail
       v-if="activeComp == 'bpm' && form.processInstanceId"
       :id="form.processInstanceId"
     ></bpmDetail>
     <list v-if="activeComp == 'list' && form.id" :sealId="form.id"></list>
+    <process-submit-dialog
+      :isNotNeedProcess="false"
+      :processSubmitDialogFlag.sync="processSubmitDialogFlag"
+      v-if="processSubmitDialogFlag"
+      ref="processSubmitDialogRef"
+      @reload="reload"
+    ></process-submit-dialog>
   </ele-modal>
 </template>
 
@@ -211,10 +218,11 @@
     updateSeal,
     getSealById
   } from '@/api/sealManagement';
-  import addUser from '@/views/system/user/components/add.vue';
+  import addUser from '@/views/rulesManagement/earlyWarningRules/components/user-select/user-select.vue';
   import WithView from '@/components/upload/WithViewNew.vue';
   import bpmDetail from '@/views/bpm/processInstance/businessDetail.vue';
   import list from './list.vue';
+  import processSubmitDialog from '@/components/processSubmitDialog/processSubmitDialog.vue';
 
   const defaultForm = {
     code: '',
@@ -227,7 +235,7 @@
     sealNumber: '',
     sealType: 'legal_effect',
     sealTypeName: '',
-    status: 1,
+    status: 0,
     processInstanceId: '',
     validEndDate: '',
     validStartDate: '',
@@ -235,7 +243,7 @@
   };
 
   export default {
-    components: { addUser, WithView, bpmDetail, list },
+    components: { addUser, WithView, bpmDetail, list, processSubmitDialog },
     name: 'SealDialog',
     data() {
       return {
@@ -245,6 +253,7 @@
           { key: 'bpm', name: '流程详情' },
           { key: 'list', name: '使用记录' }
         ],
+        processSubmitDialogFlag: false,
         visible: false,
         title: '新增',
         sealTypeList: [
@@ -282,6 +291,9 @@
           status: [
             { required: true, message: '请选择状态', trigger: 'change' }
           ],
+          sealHolderId: [
+            { required: true, message: '请选择', trigger: 'change' }
+          ],
           imgUrl: [
             { required: true, message: '请上传印章图片', trigger: 'change' }
           ],
@@ -324,8 +336,9 @@
         }
       },
       userBk(data) {
-        this.form.sealHolderId = data.id;
-        this.form.sealHolderName = data.name;
+        console.log(data, 'data');
+        this.form.sealHolderId = data.map((item) => item.id).toString();
+        this.form.sealHolderName = data.map((item) => item.name).toString();
       },
       resetForm() {
         this.form = {
@@ -354,73 +367,55 @@
         this.form.sealImage = file.raw;
         this.form.sealImageUrl = URL.createObjectURL(file.raw);
       },
-      // 删除图片
-      handleRemoveImage() {
-        this.form.sealImage = '';
-        this.form.sealImageUrl = '';
-      },
-      // 构建提交数据
-      buildSubmitData() {
-        const data = { ...this.form };
-        // 处理有效期
-        if (data.isLongTerm === '1') {
-          data.validityPeriod = '长期';
-        } else if (
-          data.validityDateRange &&
-          data.validityDateRange.length === 2
-        ) {
-          data.validityPeriod = `${data.validityDateRange[0]}至${data.validityDateRange[1]}`;
-        }
-        // 删除临时字段
-        delete data.validityDateRange;
-        delete data.sealImageUrl;
-        return data;
-      },
+
       // 保存
-      async handleSave() {
+      async handleSave(type) {
         this.$refs.formRef.validate(async (valid) => {
           if (valid) {
+            let api =
+              this.title === '新增'
+                ? addSeal
+                : this.title === '变更'
+                ? changeSeal
+                : updateSeal;
             try {
-              const data = this.buildSubmitData();
-              if (this.title === '新增') {
-                await addSeal(data);
-              } else if (this.title === '变更') {
-                await changeSeal(data);
-              } else {
-                await updateSeal(data);
-              }
-              this.$message.success('保存成功');
-              this.$emit('reload');
-              this.visible = false;
+              api(this.form).then((res) => {
+                if (type === 'sub') {
+                  this.sub(this.title == '修改' ? this.form.id : res);
+                  return;
+                }
+                this.$message.success('保存成功');
+                this.$emit('reload');
+                this.visible = false;
+              });
             } catch (error) {
               this.$message.error(error.message || '保存失败');
             }
           }
         });
       },
-      // 保存并提交
-      async handleSaveAndSubmit() {
-        this.$refs.formRef.validate(async (valid) => {
-          if (valid) {
-            try {
-              const data = this.buildSubmitData();
-              data.submitFlag = true; // 标记为提交
-              if (this.title === '新增') {
-                await addSeal(data);
-              } else if (this.title === '变更') {
-                await changeSeal(data);
-              } else {
-                await updateSeal(data);
-              }
-              this.$message.success('保存并提交成功');
-              this.$emit('reload');
-              this.visible = false;
-            } catch (error) {
-              this.$message.error(error.message || '保存并提交失败');
+      async sub(res) {
+        let data = await getSealById(res);
+        this.processSubmitDialogFlag = true;
+        this.$nextTick(() => {
+          let params = {
+            businessId: data.id,
+            businessKey: 'main_seal_management_approval',
+            formCreateUserId: data.createUserId,
+            variables: {
+              businessCode: data.code,
+              businessName: data.name,
+              businessType: '印章审核'
             }
-          }
+          };
+
+          this.$refs.processSubmitDialogRef.init(params);
         });
       },
+      reload() {
+        this.$emit('reload');
+        this.visible = false;
+      },
       // 取消
       handleCancel() {
         this.visible = false;