update 上料模块里的单位展示
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
import TableOperaionComponent from "@/components/noTemplateComponents/operationComponent";
|
||||
import switchBtn from "@/components/noTemplateComponents/switchBtn";
|
||||
import request from "@/utils/request";
|
||||
import { timeFilter } from '@/utils/filters'
|
||||
import { timeFilter, dictFilter } from '@/utils/filters'
|
||||
|
||||
export default function () {
|
||||
const tableProps = [
|
||||
{ type: 'index', label: '序号' },
|
||||
// { prop: "createTime", label: "添加时间", filter: timeFilter },
|
||||
{ prop: "updateTime", label: "上料时间", filter: timeFilter },
|
||||
{ prop: "createTime", label: "添加时间", filter: timeFilter },
|
||||
// { prop: "updateTime", label: "上料时间", filter: timeFilter },
|
||||
{ prop: "materialName", label: "原料" },
|
||||
// { prop: "material", label: "原料编码" },
|
||||
{ prop: "qty", label: "上料量" },
|
||||
@@ -29,6 +29,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: 'material',
|
||||
@@ -113,7 +139,7 @@ export default function () {
|
||||
elparams: { placeholder: "请输入上料量" },
|
||||
},
|
||||
{ select: true, label: "破碎作业", prop: "statusDictValue", options: [{ label: '正常停止', value: 0 }, { label: '废除', value: '1' }], elparams: { placeholder: "破碎作业", filterable: true } },
|
||||
|
||||
|
||||
],
|
||||
[
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user