Z 1 年之前
父节点
当前提交
7b18b0b8e4

+ 32 - 1
lib/vue-form-making/src/components/Container.vue

@@ -634,7 +634,7 @@ export default {
     },
     handleLoadJson (json) {
       try {
-        this.setJSON(json)
+        this.setLoadJSON(json)
       } catch (e) {
         Message.error(e.message)
       }
@@ -661,6 +661,35 @@ export default {
       return generateCode(JSON.stringify(this.widgetForm))
     },
     setJSON (json) {
+      if (typeof json === 'string') {
+        json = JSON.parse(json)
+      }
+      this.widgetForm = _.cloneDeep({
+        ...json,
+        list: json.list ? json.list.map(item => UpgradeData(item)) : []
+      })
+      if (this.widgetForm.config?.eventScript) {
+        this.widgetForm.config.eventScript.findIndex(item => item.key === 'onFormChange') < 0
+          && this.widgetForm.config.eventScript.unshift({key: 'onFormChange', name: 'onFormChange', type: 'rule'})
+
+        this.widgetForm.config.eventScript.findIndex(item => item.key === 'refresh') < 0
+          && this.widgetForm.config.eventScript.unshift({key: 'refresh', name: 'refresh', func: ''})
+
+        this.widgetForm.config.eventScript.findIndex(item => item.key === 'mounted') < 0
+          && this.widgetForm.config.eventScript.unshift({key: 'mounted', name: 'mounted', func: ''})
+      }
+
+      if (json.list.length> 0) {
+        this.widgetFormSelect = this.widgetForm.list[0]
+      } else {
+        this.widgetFormSelect = {}
+      }
+
+      this.initConfig()
+
+      this.$nextTick(() => {         EventBus.$emit('on-history-add-' + this.formKey)       })
+    },
+    setLoadJSON (json) {
       if (typeof json === 'string') {
         json = JSON.parse(json)
       }
@@ -668,6 +697,8 @@ export default {
         ...json,
         config: {
           ...this.widgetForm.config,
+          ...json.config,
+
           eventScript:[
             ...this.widgetForm.config.eventScript,
             ...json.config.eventScript,

+ 10 - 5
lib/vue-form-making/src/components/WidgetConfig.vue

@@ -154,11 +154,13 @@
         <el-form-item :label="$t('fm.config.widget.checkStrictly')" v-if="Object.keys(data.options).indexOf('checkStrictly')>=0">
           <el-switch v-model="data.options.checkStrictly"></el-switch>
         </el-form-item>
-        <el-form-item :label="$t('fm.config.widget.allowHalf')" v-if="Object.keys(data.options).indexOf('allowHalf')>=0">
+        <el-form-item v-if="(data.type=='deptCascader'||data.type=='userSelect')&&!data.options.multiple" :label="$t('fm.config.widget.isDefaultLoginUser')">
           <el-switch
-              v-model="data.options.allowHalf"
-            >
-            </el-switch>
+            v-model="data.options.isDefaultLoginUser">
+          </el-switch>
+        </el-form-item>
+        <el-form-item :label="$t('fm.config.widget.allowHalf')" v-if="Object.keys(data.options).indexOf('allowHalf')>=0">
+          <el-switch v-model="data.options.allowHalf"></el-switch>
         </el-form-item>
         <el-form-item :label="$t('fm.config.widget.showAlpha')" v-if="Object.keys(data.options).indexOf('showAlpha')>=0">
           <el-switch
@@ -338,6 +340,8 @@
                 </draggable>
               </el-checkbox-group>
             </template>
+
+
             <div style="margin-left: 22px;" v-if="data.type != 'cascader'&&data.type!='deptAndUserCascader'&&data.type!='deptCascader'">
               <el-button type="text" @click="handleAddOption">{{$t('fm.actions.addOption')}}</el-button>
               <el-button type="text" @click="handleClearSelect">{{$t('fm.actions.clearSelect')}}</el-button>
@@ -1479,8 +1483,9 @@ export default {
       }
     },
     handleSelectMuliple (value) {
-      if (this.data.type=='select'||this.data.type=='deptSelect'||this.data.type=='userSelect') {
+      if (this.data.type=='select'||this.data.type=='deptCascader'||this.data.type=='userSelect') {
         if (value) {
+          this.data.options.isDefaultLoginUser = false
           if (this.data.options.defaultValue) {
             this.data.options.defaultValue = [this.data.options.defaultValue]
           } else {

+ 2 - 0
lib/vue-form-making/src/components/componentsConfig.js

@@ -271,6 +271,7 @@ export const basicComponents = [
     icon: 'icon-select',
     options: {
       defaultValue: '',
+      isDefaultLoginUser: true,
       multiple: false,
       disabled: false,
       clearable: true,
@@ -887,6 +888,7 @@ export const basicComponents = [
       defaultValue: [],
       width: '100%',
       placeholder: '',
+      isDefaultLoginUser: true,
       disabled: false,
       clearable: true,
       options: [],

+ 2 - 1
lib/vue-form-making/src/lang/zh-CN.js

@@ -47,7 +47,7 @@ export default {
         transfer: '穿梭框',
         card: '卡片',
         group: '分组',
-        th: '表头'
+        th: '表头',
       },
       basic: {
         title: '基础字段',
@@ -317,6 +317,7 @@ export default {
         accept: '允许的文件类型',
         acceptPlaceholder: '为空表示不限制;多种格式以逗号分隔',
         selection: '多选',
+        isDefaultLoginUser: '是否默认当前登录人',
       }
     },
     upload: {

+ 16 - 12
src/BIZComponents/processSubmitDialog/processSubmitDialog.vue

@@ -223,12 +223,12 @@
       <!--      </el-button>-->
       <el-button type="primary" size="small" @click="submit">提交</el-button>
       <el-button size="small" @click="cancel">关闭</el-button>
-<!--      <visibility-range-dialog-->
-<!--        :visibilityRangeDialogFlag.sync="visibilityRangeDialogFlag"-->
-<!--        v-if="visibilityRangeDialogFlag"-->
-<!--        @getTreeList="getTreeList"-->
-<!--        ref="visibilityRangeDialogRef"-->
-<!--      ></visibility-range-dialog>-->
+      <!--      <visibility-range-dialog-->
+      <!--        :visibilityRangeDialogFlag.sync="visibilityRangeDialogFlag"-->
+      <!--        v-if="visibilityRangeDialogFlag"-->
+      <!--        @getTreeList="getTreeList"-->
+      <!--        ref="visibilityRangeDialogRef"-->
+      <!--      ></visibility-range-dialog>-->
       <staffSelection
         ref="staffSelection"
         @confirm="getTreeList"
@@ -257,10 +257,10 @@
   import { getProcessDefinitionList } from '@/api/bpm/definition';
   import { getToken } from '@/utils/token-util';
   import { mapGetters } from 'vuex';
-import staffSelection from '@/components/staffSelection/staffSelection.vue';
+  import staffSelection from '@/components/staffSelection/staffSelection.vue';
   export default {
     name: 'processSubmitDialog',
-    components: { visibilityRangeDialog,staffSelection },
+    components: { visibilityRangeDialog, staffSelection },
     mixins: [dictMixins],
     props: {
       processSubmitDialogFlag: {
@@ -383,10 +383,14 @@ this.postOptions.push(...response.data);
           if (item.type == 'deptAndUserCascader') {
           }
           if (item.type == 'deptCascader') {
-            this.form.valueJson[item.model] = this.user.info.groupId;
+            if (item.options.isDefaultLoginUser) {
+              this.form.valueJson[item.model] = this.user.info.groupId;
+            }
           }
           if (item.type == 'userSelect') {
-            this.form.valueJson[item.model] = this.user.info.userId;
+            if (item.options.isDefaultLoginUser) {
+              this.form.valueJson[item.model] = this.user.info.userId;
+            }
           }
           if (item.type == 'imgupload') {
             // this.form.valueJson[item.model].length &&
@@ -445,8 +449,8 @@ this.postOptions.push(...response.data);
       },
       getTreeList(list) {
         list.forEach((item) => {
-          item.type = 1
-        })
+          item.type = 1;
+        });
         this.form.noticeScope = list;
       },
       handleCloseTag(index) {

+ 7 - 3
src/views/bpm/formConfig/addOrEditDialog.vue

@@ -210,9 +210,13 @@ export default {
       this.categoryList = this.produceTree[0].children
     },
     handleFormReady(){
-      this.$refs.makingform.setJSON(
-        this.form.formJson?.makingJson
-      )
+      console.log(this.form.formJson?.makingJson);
+      this.$nextTick(()=>{
+        this.$refs.makingform.setJSON(
+          this.form.formJson?.makingJson
+        )
+      })
+
     },
     handleConfigForm() {
       this.configFormDialogFlag = true;

+ 5 - 4
src/views/bpm/formConfig/index.vue

@@ -162,10 +162,9 @@ export default {
           let findIndex = this.templateList[v.dictType].findIndex(i => i.id == v.id)
           this.templateList[v.dictType].splice(findIndex, 1)
           this.$message.success('操作成功')
-        })
-        .catch(() => {
-          console.log('取消');
-        });
+        }).catch(()=>{
+          this.$message.info('11111')
+      })
 
 
     },
@@ -183,6 +182,8 @@ export default {
        v.status = status
        await bpmCustomFormUpdate(v)
        this.$message(`${msg}成功`)
+     }).catch(e=>{
+       console.log(e);
      })
 
     }