Commit 05d35cea by lianyang

动态码表:code="getValues('key', 'tableName')"

parent 29cb9cfa
......@@ -3,6 +3,7 @@ import Api from "~/service/Api"
import { display } from "~/service/business/file"
import { getTrnNameByInr } from "~/service/business/common"
import Utils from "../utils"
import CodeTable from "~/config/CodeTable";
export default {
data() {
......@@ -34,17 +35,30 @@ export default {
this.root.updateValueSet(values)
}
},
//获取后台setValues、setCodeValues传来的动态码,并自动转为码表值
getValues(key) {
/*
获取后台setValues、setCodeValues传来的动态码,并自动转为码表值。
key:为后端传来的CodeSet的字段path,如bddgrp.rec.docprbrol
tableName:src下的全局静态码表中的码表名称,如rolall
如后端传来的CodeSet下该字段值为"value+lable",则不用传参数tableName
如后端传来的CodeSet下该字段值仅有"value",则需传参数tableName,去全局静态码表中找到相应码表,根据value值找到lable值
*/
getValues(key, tableName) {
let arr = this.codes.codeSet[key]
if (!arr)
return undefined
return arr.map(item => {
let itemArr = item.split("\t")
if (itemArr.length > 1)
return { label: item, value: itemArr[0] }
else
return { label: itemArr[0], value: itemArr[0] }
if (itemArr.length > 1) {
return { label: item, value: itemArr[0] }
} else {
if (tableName && CodeTable[tableName]) {
const r = CodeTable[tableName].find(code => code.value === itemArr[0])
if (r) {
return { label: r.label, value: itemArr[0] }
}
}
return { label: itemArr[0], value: itemArr[0] }
}
})
},
showBackendErrors(fieldErrors) {
......
......@@ -295,6 +295,7 @@
<c-input-currency-min
v-model="model.btdgrp.be2amt2"
placeholder=""
disabled
></c-input-currency-min>
</el-form-item>
</c-col>
......@@ -521,9 +522,10 @@
v-model="model.btdgrp.rec.docprbrolbe1"
style="width: 100%"
placeholder="请选择收款人"
:code="codes.docprbrolbe1"
:code="getValues('btdgrp.rec.docprbrolbe1', 'rolall')"
@change="selectOrCheckboxRule('btdgrp.rec.docprbrolbe1')"
></c-select>
<!-- :code="codes.docprbrolbe1" -->
</el-form-item>
</c-col>
......
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