devicesmgt/sgzb-ui/src/views/scrapManage/forecastWaste/auditing/config.js

142 lines
5.2 KiB
JavaScript

import {
getUnitInfoSelectApi,
listPartTypeApi,
} from '@/api/repairTest/repair'
import { getProjectList } from '@/api/claimAndRefund/receive'
import { getTypeList } from '@/api/store/warehousing'
let unitList = []
let proList = []
let typeList = []
export const config = {
handleColShow: true, // 是否显示操作列
pageShow: true, // 是否显示分页组件
isSelShow: true,// 表格是否需要复选框
isFormShow: true, // 是否显示表单查询组件
handleWidth: '160px', // 操作列宽度
formLabel: [
{ f_label: '关键字', f_model: 'keyword', f_type: 'ipt' },
{ f_label: '单位名称', f_model: 'backUnit', f_type: 'sel', f_selList: [] },
{ f_label: '工程名称', f_model: 'backPro', f_type: 'sel', f_selList: [] },
{
f_label: '工机具类型', f_model: 'type', f_type: 'selCas', f_selList: [], optionProps: {
multiple: false,
value: 'id',
}
},
{
f_label: '报废来源', f_model: 'scrapSource', f_type: 'sel', f_selList: [
{ label: '退料', value: 1 },
{ label: '维修', value: 2 },
{ label: '盘点', value: 3 },
]
},
{
f_label: '审批状态', f_model: 'taskStatus', f_type: 'sel', f_selList: [
{ label: '待审核', value: 120 },
{ label: '审核中', value: 121 },
{ label: '已驳回', value: 123 },
{ label: '已通过', value: 122 },
]
},
{ f_label: '创建时间', f_model: 'time', f_type: 'date' },
],
columnsList: [
// { t_width: '55px', t_props: '', t_label: '序号' },
{ t_width: '', t_props: 'scrapNum', t_label: '预报废单号', },
{ t_width: '85px', t_props: '', t_label: '报废来源', t_slot: 'source', },
{ t_width: '', t_props: 'repairNum', t_label: '单号', t_slot: 'code', },
{ t_width: '', t_props: 'unitName', t_label: '退料单位名称', },
{ t_width: '', t_props: 'projectName', t_label: '退料工程名称', },
{ t_width: '', t_props: 'itemType', t_label: '设备类型', },
{ t_width: '', t_props: 'createBy', t_label: '任务创建人', },
{ t_width: '', t_props: 'createTime', t_label: '任务创建时间', },
{ t_width: '', t_props: 'taskStatus', t_label: '审核状态', t_slot: 'type', },
// { t_width: '', t_props: '', t_label: '不通过原因', },
],
handleBtn: [
{ btn_title: '查看', id: 1 },
{ btn_title: '审核', id: 2 },
],
}
export const dialogConfig = {
outerWidth: '70%',
outerTitle: '',
outerVisible: false,
innerWidth: '50%',
innerTitle: '',
innerVisible: false,
handleColShow: false, // 是否显示操作列
pageShow: true, // 是否显示分页组件
isSelShow: false,// 表格是否需要复选框
isFormShow: true, // 是否显示表单查询组件
formLabel: [
{ f_label: '类型名称', f_model: 'type', f_type: 'sel', f_selList: [], selLabel: 'typeName', selValue: 'typeId' },
],
columnsList: [
// { t_width: '55px', t_props: '', t_label: '序号' },
{ t_width: '', t_props: 'machineTypeName', t_label: '设备类型' },
{ t_width: '', t_props: 'specificationType', t_label: '规格型号' },
{ t_width: '', t_props: 'maCode', t_label: '设备编码' },
{ t_width: '', t_props: 'scrapNum', t_label: '设备数量' },
{ t_width: '', t_props: 'status', t_label: '审批状态', t_slot: 't_type' },
{ t_width: '', t_props: 'remark', t_label: '报废原因' },
{ t_width: '', t_props: 'auditRemark', t_label: '驳回原因' },
{ t_width: '', t_props: '', t_label: '损坏原因', t_slot: 't_damage' },
{ t_width: '', t_props: '', t_label: '报废图片', t_slot: 't_img' },
// { t_width: '', t_props: 'remark', t_label: '备注' },
],
}
export const getSelList = () => {
new Promise(async (resolve) => {
const { data: unitRes } = await getUnitInfoSelectApi()
unitList = unitRes.map((e) => {
e.value = e.unitId
e.label = e.unitName
return e
})
const { data: proRes } = await getProjectList()
proList = proRes.map((e) => {
e.value = e.projectId
e.label = e.projectName
return e
})
const { data: typeRes } = await listPartTypeApi()
typeList = typeRes
resolve()
}).then(() => {
config.formLabel.map((item) => {
if (item.f_model === 'backUnit') {
item.f_selList = unitList
return item
}
if (item.f_model === 'backPro') {
item.f_selList = proList
return item
}
if (item.f_model === 'type') {
item.f_selList = typeList
return item
}
})
}).catch(() => {
})
}
export const getTypeListSel = async () => {
const { data: res } = await getTypeList({ level: '3' })
dialogConfig.formLabel[0].f_selList = res.map((e) => {
e.value = e.typeId
e.label = e.typeName
return e
})
}