Browse Source

优化

master
陈裕财 2 years ago
parent
commit
6d9769f7ea
  1. 36
      src/components/mdp-ui-ext/mdp-expand/FormData.vue
  2. 4
      src/views/mdp/form/formField/Field.vue
  3. 8
      src/views/mdp/form/formField/Index.vue

36
src/components/mdp-ui-ext/mdp-expand/FormData.vue

@ -48,6 +48,8 @@
<script> <script>
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import MdpFormDataItem from './FormDataItem.vue' import MdpFormDataItem from './FormDataItem.vue'
import treeTool from '@/components/mdp-ui/js/treeTool.js'
/** /**
* 表单数据填单 * 表单数据填单
*/ */
@ -156,37 +158,7 @@
} }
if(!params.deptName){ if(!params.deptName){
params.deptName=this.userInfo.deptName params.deptName=this.userInfo.deptName
}
var bizKeys=[];
if(this.formFields!=null && this.formFields.length>0){
var isBizKey=this.formFields[0].isBizKey;
if(isBizKey && isBizKey.length==3){
if(isBizKey.charAt(0)=="1"){
bizKeys.push(params.cuserid);
}
if(isBizKey.charAt(1)=="1"){
bizKeys.push(params.deptid);
}
}
}
this.formFields.forEach(item=>{
if(item.isBizKey.charAt(2)=="1"){
bizKeys.push(params[item.fieldIdCamel]);
}
if(params[item.fieldIdCamel]!=this.editForm[item.fieldIdCamel]){
params.changeData=true;
}
});
if(bizKeys.length==0){
if(params.id){
bizKeys.push(params.id);
}
}
if(bizKeys.length>0){
params.bizKey=bizKeys.join(",");
}
}
this.$emit('input',params) this.$emit('input',params)
this.$emit('submit',params);// @submit="afterAddSubmit" this.$emit('submit',params);// @submit="afterAddSubmit"
} }
@ -214,7 +186,7 @@
} }
this.initFieldQx(item) this.initFieldQx(item)
}); });
this.fields=this.formFields
this.fields=treeTool.translateDataToTree(this.formFields,'pid','id')
this.$nextTick(()=>{ this.$nextTick(()=>{
this.$refs['editForm'].clearValidate(); this.$refs['editForm'].clearValidate();
}) })

4
src/views/mdp/form/formField/Field.vue

@ -14,7 +14,7 @@
</el-row> </el-row>
<el-card v-else-if="field.extType=='card'" :gutter="gutter"> <el-card v-else-if="field.extType=='card'" :gutter="gutter">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>{{ field.title }}</span>
<span>{{ field.title }}</span>
</div> </div>
<template v-if="sample==true"> <template v-if="sample==true">
<el-row :gutter="gutter"> <el-row :gutter="gutter">
@ -222,7 +222,7 @@
value:{ value:{
deep:true, deep:true,
immediate:true, immediate:true,
handler:function(){
handler:function(){
this.field=this.value this.field=this.value
if(this.field.extType=='tabs'){ if(this.field.extType=='tabs'){
if(this.field.gname){ if(this.field.gname){

8
src/views/mdp/form/formField/Index.vue

@ -30,7 +30,7 @@
</el-form-item> </el-form-item>
<el-row> <el-row>
<draggable id="sf" class="dragArea min-height" v-model="selectedFields" :options="{group:{ name:'g1'}, animation:150}" @add="onAdd" :no-transition-on-drag="true" @start="drag=true" @end="drag=false"> <draggable id="sf" class="dragArea min-height" v-model="selectedFields" :options="{group:{ name:'g1'}, animation:150}" @add="onAdd" :no-transition-on-drag="true" @start="drag=true" @end="drag=false">
<el-col v-for="(item,index) in selectedFields" @click.ctrl.native="doChildDelete(item,index,selectedFields)" :key="index" :span="calcSpan(item)"> <el-col v-for="(item,index) in selectedFields" @click.ctrl.native="doChildDelete(item,index,selectedFields)" :key="index" :span="calcSpan(item)">
<mdp-field @bkey-change="onBkeyChange" :find-not-in-child="findNotInChild" :has-child="hasChild" :gutter="0" :span="24" :value="item" @change="(v)=>Object.assign(item,v)"></mdp-field> <mdp-field @bkey-change="onBkeyChange" :find-not-in-child="findNotInChild" :has-child="hasChild" :gutter="0" :span="24" :value="item" @change="(v)=>Object.assign(item,v)"></mdp-field>
</el-col> </el-col>
@ -181,6 +181,7 @@ export default {
}, },
'visible':function(visible) { 'visible':function(visible) {
if(visible==true){ if(visible==true){
debugger
this.selectedFields=treeTool.translateDataToTree(this.formFields,'pid','id') this.selectedFields=treeTool.translateDataToTree(this.formFields,'pid','id')
this.setPrimaryKeys(); this.setPrimaryKeys();
this.$nextTick(()=>{ this.$nextTick(()=>{
@ -350,6 +351,7 @@ export default {
onTplStart(evt){ onTplStart(evt){
}, },
onAdd(evt){ onAdd(evt){
debugger
let item=this.selectedFields[evt.newIndex]; let item=this.selectedFields[evt.newIndex];
var item2=JSON.parse(JSON.stringify(item)) var item2=JSON.parse(JSON.stringify(item))
item.isNewAdd=true item.isNewAdd=true
@ -602,7 +604,7 @@ export default {
children.forEach(k=>{ children.forEach(k=>{
if(k.children && k.children.length>0){ if(k.children && k.children.length>0){
var childs=k.children var childs=k.children
delete k.children
childs.forEach(c=>c.pid=k.id)
list.push(k) list.push(k)
this.getMyFieldList(list,childs) this.getMyFieldList(list,childs)
}else{ }else{
@ -626,7 +628,7 @@ export default {
draggable, MdpField draggable, MdpField
}, },
mounted() { mounted() {
debugger;
this.myFormDef=this.formDef this.myFormDef=this.formDef
if(this.formFields){ if(this.formFields){
this.selectedFields=treeTool.translateDataToTree(this.formFields,'pid','id') this.selectedFields=treeTool.translateDataToTree(this.formFields,'pid','id')

Loading…
Cancel
Save