Просмотр исходного кода

数据模板的编制按钮及明细按钮调整以及表单子表删除按钮调整

cyy 1 месяц назад
Родитель
Сommit
e1972a404b

+ 1 - 0
src/business/platform/data/templatebuilder/right-aside/components/button.vue

@@ -248,6 +248,7 @@ export default {
       const buttons = this.buttons
       buttons.push({
         label: button.label,
+        style: button.type || 'primary',
         [this.buttonKey]: button[this.buttonKey]
       })
       this.handleInput(buttons)

+ 9 - 2
src/business/platform/data/templatebuilder/right-aside/editors/editor-button.vue

@@ -191,7 +191,9 @@
   </el-form>
 </template>
 <script>
-import { hasPermission } from '@/business/platform/data/constants/buttons'
+import ButtonsConstants, {
+  hasPermission
+} from '@/business/platform/data/constants/buttons'
 import BpmDefSelector from '@/business/platform/bpmn/definition/selector'
 import RightsSelector from '@/business/platform/rights/config/selector'
 import ExportColumn from '../components/export-column'
@@ -281,7 +283,12 @@ export default {
     data: {
       handler(val) {
         if (val) {
-          this.formData = { ...this.formData, ...val }
+          const defaultButton = ButtonsConstants[val.button_type] || {}
+          this.formData = {
+            ...this.formData,
+            ...val,
+            style: val.style || defaultButton.type || 'primary'
+          }
           const spicialType = ['custom', 'sefStartFlow', 'openTask']
           if (spicialType.includes(this.formData.button_type)) {
             this.rules['code'] = [

+ 1 - 1
src/business/platform/data/templatebuilder/template-main/templates/list.vue

@@ -99,7 +99,7 @@ export default {
               button.position === 'search' ||
               button.position === 'eidt',
             icon: button.icon ? 'ibps-icon-' + button.icon : defaultButton.icon,
-            type: button.style || defaultButton.style,
+            type: button.style || defaultButton.type,
             disabled: true
           })
         })

+ 2 - 2
src/business/platform/data/templatebuilder/utils/index.js

@@ -65,7 +65,7 @@ const helpers = {
         },
         {
           button_type: 'detail',
-          label: '明细'
+          label: '查阅'
         }
       ]
     }
@@ -120,7 +120,7 @@ const helpers = {
         },
         {
           button_type: 'detail',
-          label: '明细'
+          label: '查阅'
         }
       ]
     }

+ 2 - 2
src/business/platform/form/formbuilder/right-aside/editors/editor-field-table.vue

@@ -297,7 +297,7 @@ export default {
         const button = JSON.parse(JSON.stringify(BUTTON_TYPES[type]))
         button.scope = null
         button.type = type
-        button.position = 'all'
+        button.position = BUTTON_TYPES[type].position || 'all'
         this.buttons.push(button)
       }
     },
@@ -305,7 +305,7 @@ export default {
       const button = JSON.parse(JSON.stringify(BUTTON_TYPES[type]))
       button.scope = null
       button.type = type
-      button.position = 'all'
+      button.position = BUTTON_TYPES[type].position || 'all'
 
       const editButton = defaultsDeep(
         JSON.parse(JSON.stringify(button)),

+ 17 - 7
src/business/platform/form/formrender/dynamic-form/dynamic-form-table.vue

@@ -314,7 +314,9 @@ import ActionUtils from '@/utils/action'
 import FormUtils from '../../utils/formUtil'
 import FormFieldUtil from '../../utils/formFieldUtil'
 
-import { hasPermission } from '@/business/platform/form/constants/tableButtonTypes'
+import BUTTON_TYPES, {
+  hasPermission
+} from '@/business/platform/form/constants/tableButtonTypes'
 import {
   defaultPageSize,
   pageSizeOptions
@@ -822,11 +824,10 @@ export default {
       }
       const bs = []
       this.buttons.forEach((button) => {
+        const btnPosition = this.resolveButtonPosition(button)
         if (
           hasPermission(button.key, position) && // 有位置权限
-          (!button.position ||
-            button.position === 'all' ||
-            button.position === position) && // 有位置权限
+          (btnPosition === 'all' || btnPosition === position) && // 有位置权限
           (this.$utils.isEmpty(this.buttonsRights[button.key]) ||
             this.buttonsRights[button.key] !==
               FormOptions.t.PERMISSIONS.HIDE) && // 有按钮权限
@@ -842,11 +843,10 @@ export default {
     filterDetailButtons(position) {
       const bs = []
       this.buttons.forEach((button) => {
+        const btnPosition = this.resolveButtonPosition(button)
         if (
           hasPermission(button.key, position) && // 有位置权限
-          (!button.position ||
-            button.position === 'all' ||
-            button.position === position) && // 有位置权限
+          (btnPosition === 'all' || btnPosition === position) && // 有位置权限
           (this.$utils.isEmpty(this.buttonsRights[button.key]) ||
             this.buttonsRights[button.key] !==
               FormOptions.t.PERMISSIONS.HIDE) && // 有按钮权限
@@ -861,6 +861,16 @@ export default {
       })
       return bs
     },
+    /**
+     * 解析按钮实际位置:未配置时回退到按钮常量默认值(与设置面板一致)
+     */
+    resolveButtonPosition(button) {
+      if (button.position) {
+        return button.position
+      }
+      const defaultButton = BUTTON_TYPES[button.key]
+      return (defaultButton && defaultButton.position) || 'all'
+    },
     handleActionEvent(button, buttonIndex) {
       // 起始下标
       const index = (this.currentPage - 1) * this.pageSize + buttonIndex