Commit c02fcfc0 by 李少勇

修改ptap10组件

parent 8120248d
......@@ -4,11 +4,11 @@
<c-col :span="24" v-if="isRef">
<el-form-item
:label="label.labelRef"
:prop="`${argadr.grp}.${argadr.rol}.pts.extkey`"
:prop="`${formatExtCodesToStr}${argadr.grp}.${argadr.rol}.pts.extkey`"
style="width: 100%"
>
<c-input
v-model.trim="model[argadr.grp][argadr.rol].pts.extkey"
v-model.trim="modelExtkey"
placeholder=""
maxlength="16"
:disabled="disabledRef"
......@@ -19,11 +19,11 @@
<c-col :span="24" v-else>
<el-form-item
:label="label.labelRef"
:prop="`${argadr.grp}.rec.${refd}`"
:prop="`${formatExtCodesToStr}${argadr.grp}.rec.${refd}`"
style="width: 100%"
>
<c-input
v-model.trim="model[argadr.grp].rec[refd]"
v-model.trim="modelRefd"
placeholder=""
maxlength="16"
:disabled="disabledRef"
......@@ -34,7 +34,7 @@
<c-col :span="24">
<el-form-item
:label="label.labelNam"
:prop="`${argadr.grp}.${argadr.rol}.pts.nam`"
:prop="`${formatExtCodesToStr}${argadr.grp}.${argadr.rol}.pts.nam`"
style="width: 100%"
>
<c-mul-row-input
......@@ -42,7 +42,7 @@
:rows="rows"
:cols="cols"
:charmod="charmod"
v-model="model[argadr.grp][argadr.rol].pts.nam"
v-model="modelNam"
placeholder=""
:disabled="disabledNam"
>
......@@ -53,6 +53,7 @@
</div>
</template>
<script>
import _ from 'lodash'
export default {
inject: ["root"],
props: {
......@@ -65,7 +66,8 @@ export default {
default: function() {
return {
rol: "", //角色
grp: "" //所属模块
grp: "", //所属模块
extCodes: [], //model和grp中间模型字段支持0个或无数个
};
}
},
......@@ -113,6 +115,55 @@ export default {
default: 70
},
},
computed: {
// 额外字段处理成字符串
formatExtCodesToStr() {
if (this.argadr.extCodes && this.argadr.extCodes.length > 0) {
return this.argadr.extCodes.join('.') + '.'
} else {
return ''
}
},
// 简化字段写法
formatCodes () {
let extCodes = this.argadr.extCodes || []
return [...extCodes, this.argadr.grp, this.argadr.rol, 'pts']
},
// extkey的计算属性
modelExtkey: {
get() {
let codesList = [...this.formatCodes, 'extkey']
return _.get(this.model, codesList)
},
set(val) {
let codesList = [...this.formatCodes, 'extkey']
_.set(this.model, codesList, val)
}
},
// extkey的计算属性
modelRefd: {
get() {
let extCodes = this.argadr.extCodes || []
let codesList = [...extCodes, this.argadr.grp, 'rec', this.refd]
return _.get(this.model, codesList)
},
set(val) {
let extCodes = this.argadr.extCodes || []
let codesList = [...extCodes, this.argadr.grp, 'rec', this.refd]
_.set(this.model, codesList, val)
}
},
modelNam: {
get() {
let codesList = [...this.formatCodes, 'nam']
return _.get(this.model, codesList)
},
set(val) {
let codesList = [...this.formatCodes, 'nam']
_.set(this.model, codesList, val)
}
},
},
data() {
return {
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment