|
|
@@ -118,6 +118,7 @@ import {reviewStatus} from "@/enum/dict";
|
|
|
import {getSubTwoLevelAPI, getVersionManagePageAPI, updateStatus, versionManageDeleteAPI} from "@/api/versionManage";
|
|
|
import indexSearch from "@/views/versionManage/components/index-search.vue";
|
|
|
import {getSubPage} from "@/api/classifyManage";
|
|
|
+import {getByCode} from "@/api/system/dictionary-data";
|
|
|
|
|
|
export default {
|
|
|
name: 'technologyProduction',
|
|
|
@@ -173,10 +174,8 @@ export default {
|
|
|
label: '分类',
|
|
|
showOverflowTooltip: true,
|
|
|
align: 'center',
|
|
|
- formatter: (_row, _column, cellValue) => {
|
|
|
- /* && this.typeList.find(item => item.id == cellValue)?.name*/
|
|
|
-
|
|
|
- return this.getTypeName(this.typeList, cellValue, (item) => item.id == cellValue)
|
|
|
+ formatter: (row, column) => {
|
|
|
+ return this.getDictV('version_rule_type',row.type) ;
|
|
|
},
|
|
|
minWidth: 110
|
|
|
},
|
|
|
@@ -211,6 +210,7 @@ export default {
|
|
|
],
|
|
|
// 表格选中数据
|
|
|
selection: [],
|
|
|
+ dictList: {},
|
|
|
// 当前编辑数据
|
|
|
current: null,
|
|
|
typeList: [],
|
|
|
@@ -223,21 +223,36 @@ export default {
|
|
|
},
|
|
|
computed: {},
|
|
|
methods: {
|
|
|
- getTypeName(list, val, callBack) {
|
|
|
- let find = list.find(item => callBack(item, val)) || {}
|
|
|
- if (find.name) {
|
|
|
- return find.name
|
|
|
- } else {
|
|
|
- for (let i = 0; i < list.length; i++) {
|
|
|
- let find = list[i].subList.find(item => callBack(item, val)) || {}
|
|
|
- if (find.name) {
|
|
|
- return find.name
|
|
|
- }
|
|
|
+ // getTypeName(list, val, callBack) {
|
|
|
+ // let find = list.find(item => callBack(item, val)) || {}
|
|
|
+ // if (find.name) {
|
|
|
+ // return find.name
|
|
|
+ // } else {
|
|
|
+ // for (let i = 0; i < list.length; i++) {
|
|
|
+ // let find = list[i].subList.find(item => callBack(item, val)) || {}
|
|
|
+ // if (find.name) {
|
|
|
+ // return find.name
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ getDictV(code, val) {
|
|
|
+ if (!this.dictList[code]) return '';
|
|
|
+ return this.dictList[code].find(item => item.value == val)?.label
|
|
|
+ },
|
|
|
+ async getDictList(code) {
|
|
|
+ let {data: res} = await getByCode(code)
|
|
|
+ this.dictList[code] = res.map(item => {
|
|
|
+ let values = Object.keys(item)
|
|
|
+ return {
|
|
|
+ value: values[0],
|
|
|
+ label: item[values[0]]
|
|
|
}
|
|
|
- }
|
|
|
+ })
|
|
|
},
|
|
|
/* 表格数据源 */
|
|
|
async datasource({page, limit, where, order}) {
|
|
|
+ await this.getDictList('version_rule_type')
|
|
|
return await getVersionManagePageAPI({
|
|
|
...where,
|
|
|
...order,
|