bug bug bug filters.js
This commit is contained in:
parent
508bc4e434
commit
7c8f844ace
@ -165,7 +165,11 @@ export default {
|
|||||||
this.$http("/sys/dict/type/all", { limit: 999, page: 1 }).then(({ data: res }) => {
|
this.$http("/sys/dict/type/all", { limit: 999, page: 1 }).then(({ data: res }) => {
|
||||||
// console.log("[dictData] loading...", res);
|
// console.log("[dictData] loading...", res);
|
||||||
if (res.code === 0 && res.data) {
|
if (res.code === 0 && res.data) {
|
||||||
localStorage.setItem("dictList", JSON.stringify(res.data));
|
let dictList = {}
|
||||||
|
res.data.map(item => {
|
||||||
|
Object.assign(dictList, { [item.dictType]: item.dataList })
|
||||||
|
})
|
||||||
|
localStorage.setItem("dictList", JSON.stringify(dictList));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// end
|
// end
|
||||||
|
@ -3,6 +3,7 @@ import moment from 'moment'
|
|||||||
|
|
||||||
export const dictFilter = dictTypeId => {
|
export const dictFilter = dictTypeId => {
|
||||||
return val => {
|
return val => {
|
||||||
|
console.log('ddd', (JSON.parse(localStorage.getItem('dictList')))[dictTypeId])
|
||||||
return JSON.parse(localStorage.getItem('dictList'))[dictTypeId].find(item => item.dictValue === val)?.dictLabel || '-'
|
return JSON.parse(localStorage.getItem('dictList'))[dictTypeId].find(item => item.dictValue === val)?.dictLabel || '-'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -22,7 +23,3 @@ export const pick = (obj, paths) => {
|
|||||||
})
|
})
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
export const dictFind = (which) => {
|
|
||||||
return () => 1
|
|
||||||
}
|
|
@ -1,13 +1,13 @@
|
|||||||
import TableOperaionComponent from "@/components/noTemplateComponents/operationComponent";
|
import TableOperaionComponent from "@/components/noTemplateComponents/operationComponent";
|
||||||
import StatusComponent from "@/components/noTemplateComponents/statusComponent";
|
import StatusComponent from "@/components/noTemplateComponents/statusComponent";
|
||||||
import request from "@/utils/request";
|
import request from "@/utils/request";
|
||||||
import { dictFind } from '@/utils/filters'
|
import { dictFilter } from '@/utils/filters'
|
||||||
|
|
||||||
export default function () {
|
export default function () {
|
||||||
const tableProps = [
|
const tableProps = [
|
||||||
{ prop: "name", label: "料仓名称" },
|
{ prop: "name", label: "料仓名称" },
|
||||||
{ prop: "code", label: "料仓编码" },
|
{ prop: "code", label: "料仓编码" },
|
||||||
{ prop: "typeDictValue", label: "料仓类型", filter: dictFind('料仓') },
|
{ prop: "typeDictValue", label: "料仓类型", filter: dictFilter('liangcang') },
|
||||||
{ prop: "status", label: "产线状态", subcomponent: StatusComponent }, // subcomponent
|
{ prop: "status", label: "产线状态", subcomponent: StatusComponent }, // subcomponent
|
||||||
{ prop: "description", label: "描述" },
|
{ prop: "description", label: "描述" },
|
||||||
{ prop: "remark", label: "备注" },
|
{ prop: "remark", label: "备注" },
|
||||||
|
@ -198,13 +198,17 @@ export default {
|
|||||||
return this.$message.error(res.msg);
|
return this.$message.error(res.msg);
|
||||||
}
|
}
|
||||||
Cookies.set("token", res.data.token);
|
Cookies.set("token", res.data.token);
|
||||||
// 获取数据字典数据
|
// 刷新数据字典数据
|
||||||
this.$http('/sys/dict/type/all', { limit: 999, page: 1 }).then(({data: res}) => {
|
this.$http("/sys/dict/type/all", { limit: 999, page: 1 }).then(({ data: res }) => {
|
||||||
// console.log('[dictData] loading...', res)
|
// console.log("[dictData] loading...", res);
|
||||||
if (res.code === 0 && res.data) {
|
if (res.code === 0 && res.data) {
|
||||||
localStorage.setItem('dictList', JSON.stringify(res.data))
|
let dictList = {};
|
||||||
|
res.data.map((item) => {
|
||||||
|
Object.assign(dictList, { [item.dictType]: item.dataList });
|
||||||
|
});
|
||||||
|
localStorage.setItem("dictList", JSON.stringify(dictList));
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
// end
|
// end
|
||||||
this.$router.replace({ name: "home" });
|
this.$router.replace({ name: "home" });
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user