Browse Source

优化

master
陈裕财 2 years ago
parent
commit
9ac1ba2c65
  1. 11
      src/views/mdp/form/formField/Field.vue
  2. 17
      src/views/mdp/form/formField/FieldCfg.vue
  3. 6
      src/views/mdp/form/formField/FieldQxSet.vue
  4. 7
      src/views/mdp/form/formField/Index.vue

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

@ -1,5 +1,5 @@
<template> <template>
<section @click.alt.stop="showPopover=(sample==true?false:!showPopover)" :class="{'form-field':true,'select':showPopover}">
<section @click.alt.stop="showPopover=(sample==true?false:!showPopover)" :class="{'form-field':true,'select':showPopover}" :style="parseFieldStyleObj()">
<el-row v-if="field.extType=='row'" :gutter="gutter"> <el-row v-if="field.extType=='row'" :gutter="gutter">
<template v-if="sample==true"> <template v-if="sample==true">
<el-col @click.ctrl.native.stop="doChildDelete(child,idx,field.children)" v-for="child,idx in field.children" :key="idx" :span="calcSpan(child,field)"> <el-col @click.ctrl.native.stop="doChildDelete(child,idx,field.children)" v-for="child,idx in field.children" :key="idx" :span="calcSpan(child,field)">
@ -8,7 +8,7 @@
</template> </template>
<draggable v-else-if="field.children && field.children.length>0" @add="onAdd" v-model="field.children" :options="{group:{ name:'g1', pull:'clone'}, animation:150}"> <draggable v-else-if="field.children && field.children.length>0" @add="onAdd" v-model="field.children" :options="{group:{ name:'g1', pull:'clone'}, animation:150}">
<el-col @click.ctrl.native.stop="doChildDelete(child,idx,field.children)" v-for="child,idx in field.children" :key="idx" :span="calcSpan(child,field)"> <el-col @click.ctrl.native.stop="doChildDelete(child,idx,field.children)" v-for="child,idx in field.children" :key="idx" :span="calcSpan(child,field)">
<mdp-field @bkey-change="onBkeyChange" :has-child="hasChild" :parent-field="field" :gutter="gutter" :span="span" v-if="child" :value="child" @change="(v)=>onChildChange(child,v)" @delete="onChildDelete"></mdp-field>
<mdp-field @bkey-change="onBkeyChange" :has-child="hasChild" :parent-field="field" :gutter="gutter" :span="span" v-if="child" :value="child" @change="(v)=>onChildChange(child,v)" @delete="onChildDelete"></mdp-field>
</el-col> </el-col>
</draggable> </draggable>
</el-row> </el-row>
@ -318,6 +318,13 @@
}, },
onBkeyChange(field){ onBkeyChange(field){
this.$emit('bkey-change',field) this.$emit('bkey-change',field)
},
parseFieldStyleObj(){
if(this.field.styleObj && this.field.styleObj.indexOf("{")>=0 && this.field.styleObj.indexOf("}")>0){
return JSON.parse(this.field.styleObj)
}else{
return {}
}
} }
},//end method },//end method

17
src/views/mdp/form/formField/FieldCfg.vue

@ -72,8 +72,10 @@
placement="top-start" placement="top-start"
width="400" width="400"
trigger="hover"> trigger="hover">
<el-input type="textarea" rows="10" v-model="field.styleObj" :label="field.idCamel" auto-complete="off" placeholder="请输入json 对象 如 {maxHeight:'100px',maxWidth:'100px'}" > </el-input>
<el-row>
<el-input type="textarea" rows="10" v-model="field.styleObj" auto-complete="off" placeholder='请输入json 对象 如 {"maxHeight":"100px","maxWidth":"100px"}' > </el-input>
</el-row>
<el-row>注意所有属性及值都要""如下 {"maxHeight":"100px","maxWidth":"100px"}</el-row>
<el-button slot="reference">css 样式</el-button> <el-button slot="reference">css 样式</el-button>
</el-popover> </el-popover>
@ -167,11 +169,12 @@
watch: { watch: {
value:{ value:{
deep:true, deep:true,
immediate:true,
handler:function(){
this.field=this.value
this.setExtInfos();
handler:function(){
this.field=this.value
} }
},
"value.extInfos":function(v){
this.setExtInfos();
} }
}, },
data() { data() {
@ -288,6 +291,8 @@
}, },
mounted() { mounted() {
this.field=this.value
this.setExtInfos();
}//end mounted }//end mounted
} }

6
src/views/mdp/form/formField/FieldQxSet.vue

@ -5,7 +5,7 @@
<el-card> <el-card>
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>字段{{ fieldTitle }}查询权限</span>
<span>字段{{ title }}查询权限</span>
<el-checkbox v-model="editForm.othQuery" true-label="1" false-label="0">可查询</el-checkbox> <el-checkbox v-model="editForm.othQuery" true-label="1" false-label="0">可查询</el-checkbox>
</div> </div>
<span v-if="editForm.othQuery=='1'"> <span v-if="editForm.othQuery=='1'">
@ -36,7 +36,7 @@
<el-card> <el-card>
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>字段{{ fieldTitle }}修改权限</span>
<span>字段{{ title }}修改权限</span>
<el-checkbox v-model="editForm.othEdit" true-label="1" false-label="0">可修改</el-checkbox> <el-checkbox v-model="editForm.othEdit" true-label="1" false-label="0">可修改</el-checkbox>
</div> </div>
<span v-if="editForm.othEdit=='1'"> <span v-if="editForm.othEdit=='1'">
@ -88,7 +88,7 @@ export default {
type:String, type:String,
default:'', default:'',
}, },
fieldTitle:{
title:{
type:String, type:String,
default:'', default:'',
} }

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

@ -332,7 +332,12 @@ export default {
}, },
setPrimaryKeys:function() { setPrimaryKeys:function() {
this.primaryKeys=this.formDef.pks.split(",")
if(!this.formDef.pks || this.formDef.pks.length==0){
this.primaryKeys=[]
}else{
this.primaryKeys=this.formDef.pks.split(",")
}
var allFields=this.getFieldList(); var allFields=this.getFieldList();
allFields.forEach(f=>{ allFields.forEach(f=>{
if(this.primaryKeys.some(k=>k==f.id)){ if(this.primaryKeys.some(k=>k==f.id)){

Loading…
Cancel
Save