update 上料模块里的单位展示
This commit is contained in:
@@ -2,7 +2,7 @@ import TableOperaionComponent from "@/components/noTemplateComponents/operationC
|
||||
import switchBtn from "@/components/noTemplateComponents/switchBtn";
|
||||
import QuillRichInput from "@/components/noTemplateComponents/richInput";
|
||||
import request from "@/utils/request";
|
||||
import { timeFilter } from "@/utils/filters";
|
||||
import { timeFilter, dictFilter } from "@/utils/filters";
|
||||
|
||||
export default function () {
|
||||
const tableProps = [
|
||||
@@ -30,6 +30,32 @@ export default function () {
|
||||
},
|
||||
];
|
||||
|
||||
/**
|
||||
* 数据字典hack
|
||||
* @param {object} row 行数据
|
||||
* @param {string} dictId 从哪个数据字典映射数据
|
||||
* @param {string} dataProp 把字典值附加到哪个 prop 字段上
|
||||
* @param {string} dictProp 哪个prop是字典数据
|
||||
**/
|
||||
let dictList;
|
||||
tableProps.attachDictValue = (row, dictId, dataProp, dictProp, forceFlushDictList = false) => {
|
||||
/** 缓存一下 dictList **/
|
||||
if (!dictList || (dictList && forceFlushDictList)) dictList = dictFilter(dictId)
|
||||
|
||||
if (typeof row === 'object' && dictList) {
|
||||
const value = dictList(row[dictProp])
|
||||
const data = row[dataProp]
|
||||
row[dataProp] = data + ' ' + (value === '-' ? '' : value)
|
||||
} else {
|
||||
this.$message({
|
||||
message: 'tableProps.attachDictValue() 出错!',
|
||||
type: 'error',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const headFormFields = [
|
||||
{
|
||||
prop: "materialId",
|
||||
|
||||
Reference in New Issue
Block a user