devicesmgt/sgzb-ui/src/views/scrapManage/forecastWaste/index.js

130 lines
5.6 KiB
JavaScript
Raw Normal View History

2024-04-18 17:58:05 +08:00
import {
getUnitInfoSelectApi,
listPartTypeApi,
} from '@/api/repairTest/repair'
import { getProjectList } from '@/api/claimAndRefund/receive'
let unitList = [] //单位下拉数据
let proList = [] //工程下拉数据
let typeList = [] //类型下拉数据
const config = {
/* 预报废审核主页 列表参数 */
tableProps: [
{ t_width: '55px', t_props: '', t_label: '序号' },
{ t_width: '', t_props: 'demo', t_label: '预报废单号' },
{ t_width: '', t_props: '', t_label: '报废来源' },
{ t_width: '', t_props: '', t_label: '单号' },
{ t_width: '', t_props: '', t_label: '退料单位名称' },
{ t_width: '', t_props: '', t_label: '退料工程名称' },
{ t_width: '', t_props: '', t_label: '设备类型' },
{ t_width: '', t_props: '', t_label: '任务创建人' },
{ t_width: '', t_props: '', t_label: '任务创建时间' },
{ t_width: '', t_props: '', t_label: '审核状态' },
{ t_width: '', t_props: '', t_label: '不通过原因' },
],
/* 预报废审核主页表单 查询参数 */
formLabel: [
{ f_label: '关键字', f_model: 'keywords', 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: { value: 'id', } },
{ f_label: '报废来源', f_model: 'laiyuan', f_type: 'sel', f_selList: [] },
{ f_label: '审批状态', f_model: 'shentype', f_type: 'sel', f_selList: [] },
{ f_label: '创建时间', f_model: 'time', f_type: 'date' },
],
/* 预报废审核弹框内 列表参数 */
previewTableProps: [
{ t_width: '55px', t_props: '', t_label: '序号' },
{ t_width: '', t_props: 'demo', t_label: '设备类型' },
{ t_width: '', t_props: '', t_label: '设备编码' },
{ t_width: '', t_props: '', t_label: '设备数量' },
{ t_width: '', t_props: '', t_label: '审批状态' },
{ t_width: '', t_props: '', t_label: '报废原因' },
{ t_width: '', t_props: '', t_label: '报废图片' },
{ t_width: '', t_props: '', t_label: '备注' },
],
/* 预报废审核弹框表单 查询参数 */
previewFormLabel: [
{ f_label: '类型名称', f_model: 'keywords', f_type: 'ipt' },
],
/* 预报废列表主页 列表参数 */
listingTableProps: [
{ t_width: '55px', t_props: '', t_label: '序号' },
{ t_width: '', t_props: 'demo', t_label: '预报废单号' },
{ t_width: '', t_props: '', t_label: '报废类型' },
{ t_width: '', t_props: '', t_label: '预报废审核单号' },
{ t_width: '', t_props: '', t_label: '退料单位名称' },
{ t_width: '', t_props: '', t_label: '退料单位名称' },
{ t_width: '', t_props: '', t_label: '退料工程名称' },
{ t_width: '', t_props: '', t_label: '机具类型' },
{ t_width: '', t_props: '', t_label: '任务创建人' },
{ t_width: '', t_props: '', t_label: '任务创建时间' },
{ t_width: '', t_props: '', t_label: '审核状态' },
],
/* 预报废列表主页表单 查询参数 */
listingFormLabel: [
{ f_label: '关键字', f_model: 'keywords', 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: { value: 'id', } },
{ f_label: '报废单号', f_model: 'laiyuan', f_type: 'ipt', f_selList: [] },
{ f_label: '审批状态', f_model: 'shentype', f_type: 'sel', f_selList: [] },
{ f_label: '创建时间', f_model: 'time', f_type: 'date' },
{ f_label: '报废类型', f_model: 'shentype', f_type: 'sel', f_selList: [] },
],
/* 预报废列表查看弹框内 列表参数 */
previewTableProps: [
{ t_width: '55px', t_props: '', t_label: '序号' },
{ t_width: '', t_props: 'demo', t_label: '设备类型' },
{ t_width: '', t_props: '', t_label: '规格型号' },
{ t_width: '', t_props: '', t_label: '设备编码' },
{ t_width: '', t_props: '', t_label: '设备数量' },
{ t_width: '', t_props: '', t_label: '报废原因' },
{ t_width: '', t_props: '', t_label: '报废图片' },
{ t_width: '', t_props: '', 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 default config