Browse Source

fix: change custom-form enabled_mark

DESKTOP-USV654P\pc 1 month ago
parent
commit
0d6e47f99f

+ 1 - 1
Makefile

@@ -12,7 +12,7 @@ build:
 
 commit:
 	git add . && \
-	git commit --no-verify -m "fix: change MultipleSelect"
+	git commit --no-verify -m "fix: change custom-form enabled_mark"
 
 checkPre:
 	git checkout pre

+ 1 - 1
src/components/CreateCodeStep/src/ViewDesignStep.vue

@@ -508,7 +508,7 @@
               </template>
             </template>
           </a-table>
-          <a-button type="dashed" block @click="buttonAdd" v-if="!isCustomForm">
+          <a-button type="dashed" block @click="buttonAdd">
             <PlusOutlined />
             {{ t('新增') }}
           </a-button>

+ 12 - 10
src/views/form/release/components/ReleaseModal.vue

@@ -12,16 +12,18 @@
           <a-step :title="t('界面设计')" />
         </a-steps>
         <div class="btn-box">
-          <a-button type="primary" @click="handleStepPrev" v-show="current === 1">{{
-            t('上一步')
-          }}</a-button>
-          <a-button type="primary" @click="handleStepNext" v-show="current === 0">{{
-            t('下一步')
-          }}</a-button>
-          <a-button type="primary" @click="handleSave" v-show="current === 1">{{
-            t('完成')
-          }}</a-button>
-          <a-button type="primary" danger @click="handleClose">{{ t('关闭') }}</a-button>
+          <a-button type="primary" @click="handleStepPrev" v-show="current === 1">
+            {{ t('上一步') }}
+          </a-button>
+          <a-button type="primary" @click="handleStepNext" v-show="current === 0">
+            {{ t('下一步') }}
+          </a-button>
+          <a-button type="primary" @click="handleSave" v-show="current === 1">
+            {{ t('完成') }}
+          </a-button>
+          <a-button type="primary" danger @click="handleClose">
+            {{ t('关闭') }}
+          </a-button>
         </div>
       </div>
     </template>

+ 42 - 3
src/views/form/template/index.vue

@@ -146,7 +146,17 @@
   import LaunchProcess from '/@/views/workflow/task/components/LaunchProcess.vue';
   import ApprovalProcess from '/@/views/workflow/task/components/ApprovalProcess.vue';
   import { downloadByData } from '/@/utils/file/download';
-  import { onMounted, ref, unref, computed, createVNode, provide, reactive, UnwrapRef } from 'vue';
+  import {
+    onMounted,
+    ref,
+    unref,
+    computed,
+    createVNode,
+    provide,
+    reactive,
+    UnwrapRef,
+    Ref,
+  } from 'vue';
   import { useRouter } from 'vue-router';
   import { getFormTemplate } from '/@/api/form/design';
   import { getFormRelease } from '/@/api/form/release';
@@ -183,6 +193,7 @@
   import { PrintButton } from '/@/enums/printEnum';
   import { InputParamItem } from '/@/components/ApiConfig/src/interface';
   import { getDraftInfo } from '/@/api/workflow/process';
+  import { putLedgerLedgerCustom } from '/@/services/apis/LedgerCustomController';
   interface SearchDate {
     fieldName: string;
     format: string;
@@ -213,7 +224,8 @@
     formType = ref<string>(''), //弹窗类型:modal、drawer
     formWidth = ref<number>(800), // 弹窗、抽屉宽度
     menuId = ref<string>(''),
-    pkField = ref<string>(''); //主表主键
+    pkField = ref<string>(''), //主表主键
+    pkTable = ref<string>(''); //主表
   const subFormConfig = ref<any>([]);
   // 模板打印 入参参数
   let printData: {
@@ -228,7 +240,14 @@
     requestBodyConfigs: [],
   });
   //展示在列表内的按钮
-  const actionButtons = ref<string[]>(['view', 'edit', 'copyData', 'delete', 'startwork']);
+  const actionButtons = ref<string[]>([
+    'view',
+    'edit',
+    'copyData',
+    'delete',
+    'startwork',
+    'enabled',
+  ]);
   const { notification } = useMessage();
   const { t } = useI18n();
   defineEmits(['register']);
@@ -303,6 +322,7 @@
     export: handleExport,
     print: handlePrint,
     copyData: handleCopyData,
+    enabled: handleEnabled,
   };
 
   const fieldNames = computed(() => {
@@ -390,6 +410,11 @@
               };
             };
           }
+          if (column.dataIndex === 'enabled_mark') {
+            column.customRender = ({ text }) => {
+              return text === 1 ? '启用' : '停用';
+            };
+          }
         });
         setColumns(filterColumns.value);
       },
@@ -571,6 +596,17 @@
     deleteList([record[pkField.value]]);
   }
 
+  async function handleEnabled(record: Recordable) {
+    if (pkTable.value) {
+      await putLedgerLedgerCustom({
+        id: record[pkField.value],
+        tableName: pkTable.value,
+        enabledMark: record['enabled_mark'] === 1 ? 0 : 1,
+      });
+      reload();
+    }
+  }
+
   async function handlePrint() {
     const dataSource = Array.isArray(getRawDataSource())
       ? getRawDataSource()
@@ -766,6 +802,7 @@
 
     const mainTable = formJson.tableConfigs?.find((item) => item.isMain);
     pkField.value = mainTable?.pkField || 'id';
+    pkTable.value = mainTable?.tableName || '';
 
     //构建表单Props
     formProps = buildOption(formJson.formJson, false);
@@ -838,6 +875,7 @@
           onClick: handleView.bind(null, record),
         });
       }
+
       if (['edit', 'copyData', 'delete'].includes(button.code)) {
         editAndDelBtn.push({
           icon: button?.icon,
@@ -885,6 +923,7 @@
                 icon: button?.icon,
                 tooltip: button?.name,
                 color: button.code === 'delete' ? 'error' : undefined,
+                disabled: button.code === 'enabled' && record['enabled_mark'] === 0,
                 onClick: btnEvent[button.code].bind(null, record),
               };
             }) || [];