老商城
This commit is contained in:
parent
da18804cc2
commit
da8eefb2cd
|
|
@ -34,7 +34,7 @@ const batchAddVisible: any = ref(false) // 批量新增
|
||||||
const batchAddData: any = ref([]) // 批量新增
|
const batchAddData: any = ref([]) // 批量新增
|
||||||
const batchAddColumn: any = ref([
|
const batchAddColumn: any = ref([
|
||||||
{ label: '装备名称', prop: 'deviceName' },
|
{ label: '装备名称', prop: 'deviceName' },
|
||||||
{ label: '装备型号', prop: 'typeName' },
|
{ label: '装备型号', prop: 'itemTypeModel' },
|
||||||
{ label: '上传人', prop: 'uploadUser' },
|
{ label: '上传人', prop: 'uploadUser' },
|
||||||
{ label: '上传时间', prop: 'uploadTime' },
|
{ label: '上传时间', prop: 'uploadTime' },
|
||||||
])
|
])
|
||||||
|
|
@ -43,7 +43,8 @@ const uploadUrlTemp = window.location.origin + '/iws/mall-view/MaDevTemplate.xls
|
||||||
|
|
||||||
// 注册地址拼装
|
// 注册地址拼装
|
||||||
const AssemblyRegisterAddress: any = reactive([])
|
const AssemblyRegisterAddress: any = reactive([])
|
||||||
const deviceType: any = reactive([])
|
const manageType: any = reactive([])
|
||||||
|
const typeId: any = ref()
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// 获取装备树
|
// 获取装备树
|
||||||
|
|
@ -57,6 +58,7 @@ onMounted(() => {
|
||||||
})
|
})
|
||||||
// 设备类型树
|
// 设备类型树
|
||||||
const deviceTypeTree: any = ref([])
|
const deviceTypeTree: any = ref([])
|
||||||
|
const oldDeviceTypeTree: any = ref([])
|
||||||
const partTypeTreeProps: any = ref({
|
const partTypeTreeProps: any = ref({
|
||||||
children: 'children',
|
children: 'children',
|
||||||
label: 'name',
|
label: 'name',
|
||||||
|
|
@ -67,7 +69,21 @@ const partTypeTreeProps: any = ref({
|
||||||
const getTypeTreeData = async () => {
|
const getTypeTreeData = async () => {
|
||||||
const res: any = await getEquipmentTypeApi()
|
const res: any = await getEquipmentTypeApi()
|
||||||
console.log('treeData==========', res)
|
console.log('treeData==========', res)
|
||||||
deviceTypeTree.value = res.data
|
oldDeviceTypeTree.value = res.data
|
||||||
|
deviceTypeTree.value = trimTreeLevels(res.data, 3)
|
||||||
|
// deviceTypeTree.value = res.data
|
||||||
|
console.log('🚀 ~ getTypeTreeData ~ 树:', deviceTypeTree.value)
|
||||||
|
}
|
||||||
|
const trimTreeLevels = (tree: any, maxDepth: any, currentDepth = 1) => {
|
||||||
|
return tree.map((node: any) => {
|
||||||
|
const newNode = { ...node }
|
||||||
|
if (node.children && currentDepth < maxDepth) {
|
||||||
|
newNode.children = trimTreeLevels(node.children, maxDepth, currentDepth + 1)
|
||||||
|
} else {
|
||||||
|
delete newNode.children
|
||||||
|
}
|
||||||
|
return newNode
|
||||||
|
});
|
||||||
}
|
}
|
||||||
//装备类目-change
|
//装备类目-change
|
||||||
const deviceTypeChange = (val: any) => {
|
const deviceTypeChange = (val: any) => {
|
||||||
|
|
@ -170,7 +186,7 @@ const equipmentDeployment = (row: any) => {
|
||||||
deviceCount: 1,
|
deviceCount: 1,
|
||||||
originaValue: '',
|
originaValue: '',
|
||||||
itemTypeModel: '',
|
itemTypeModel: '',
|
||||||
deviceType: '',
|
manageType: '',
|
||||||
buyPrice: '',
|
buyPrice: '',
|
||||||
unitName: '',
|
unitName: '',
|
||||||
code: '',
|
code: '',
|
||||||
|
|
@ -189,6 +205,7 @@ const equipmentDeployment = (row: any) => {
|
||||||
detailsFileList.value = []
|
detailsFileList.value = []
|
||||||
insurancePdf.value = []
|
insurancePdf.value = []
|
||||||
examinationPdf.value = []
|
examinationPdf.value = []
|
||||||
|
addAndEditForm.deviceTypeList = []
|
||||||
|
|
||||||
//装备证书table
|
//装备证书table
|
||||||
equipTableList.value = []
|
equipTableList.value = []
|
||||||
|
|
@ -210,7 +227,7 @@ const equipmentDeployment = (row: any) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
addAndEditForm.deviceTypeList = getSelectId(deviceTypeTree.value, addAndEditForm.typeId)
|
addAndEditForm.deviceTypeList = getSelectId(deviceTypeTree.value, addAndEditForm.parentId)
|
||||||
}
|
}
|
||||||
// 打开入驻弹框
|
// 打开入驻弹框
|
||||||
dialogFormVisibleSettlein.value = true
|
dialogFormVisibleSettlein.value = true
|
||||||
|
|
@ -265,66 +282,11 @@ const deleteRowInfo = async (row: any) => {
|
||||||
const getDetailData = async (row: any) => {
|
const getDetailData = async (row: any) => {
|
||||||
await getTypeTreeData()
|
await getTypeTreeData()
|
||||||
const { data: res }: any = await getDetailApi(row.maId)
|
const { data: res }: any = await getDetailApi(row.maId)
|
||||||
const {
|
|
||||||
deviceName,
|
|
||||||
// deviceTypeList,
|
|
||||||
deviceCount,
|
|
||||||
originaValue,
|
|
||||||
itemTypeModel,
|
|
||||||
deviceType,
|
|
||||||
buyPrice,
|
|
||||||
unitName,
|
|
||||||
code,
|
|
||||||
brand,
|
|
||||||
typeId,
|
|
||||||
companyId,
|
|
||||||
productionDate,
|
|
||||||
dayLeasePrice,
|
|
||||||
person,
|
|
||||||
personPhone,
|
|
||||||
deviceWeight,
|
|
||||||
checkDate,
|
|
||||||
checkCycle,
|
|
||||||
mainFileList,
|
|
||||||
detailsFileList,
|
|
||||||
insurancePdf,
|
|
||||||
examinationPdf,
|
|
||||||
devInfoProperties,
|
|
||||||
tableList,
|
|
||||||
maintenanceAlarmDay,
|
|
||||||
isZone,
|
|
||||||
zoneId,
|
|
||||||
} = res
|
|
||||||
|
|
||||||
Object.assign(addAndEditForm, {
|
Object.assign(addAndEditForm, {
|
||||||
deviceName,
|
...res,
|
||||||
deviceCount,
|
|
||||||
originaValue,
|
|
||||||
itemTypeModel,
|
|
||||||
deviceType,
|
|
||||||
buyPrice,
|
|
||||||
unitName,
|
|
||||||
code,
|
|
||||||
brand,
|
|
||||||
typeId,
|
|
||||||
companyId,
|
|
||||||
productionDate,
|
|
||||||
dayLeasePrice,
|
|
||||||
person,
|
|
||||||
personPhone,
|
|
||||||
deviceWeight,
|
|
||||||
checkDate,
|
|
||||||
checkCycle,
|
|
||||||
mainFileList,
|
|
||||||
detailsFileList,
|
|
||||||
insurancePdf,
|
|
||||||
examinationPdf,
|
|
||||||
devInfoProperties,
|
|
||||||
tableList,
|
|
||||||
maintenanceAlarmDay,
|
|
||||||
isZone,
|
|
||||||
zoneId,
|
|
||||||
})
|
})
|
||||||
|
typeId.value = addAndEditForm.typeId
|
||||||
|
console.log('🚀 ~ getDetailData ~ typeId:', typeId.value)
|
||||||
|
|
||||||
if (settleinTitle.value == '装备编辑') {
|
if (settleinTitle.value == '装备编辑') {
|
||||||
Object.assign(addAndEditForm, {
|
Object.assign(addAndEditForm, {
|
||||||
|
|
@ -343,7 +305,7 @@ const getDetailData = async (row: any) => {
|
||||||
descriptionFormList.value[0].insurancePdfs = insurancePdf
|
descriptionFormList.value[0].insurancePdfs = insurancePdf
|
||||||
descriptionFormList.value[0].examinationPdfs = examinationPdf
|
descriptionFormList.value[0].examinationPdfs = examinationPdf
|
||||||
options.value = []
|
options.value = []
|
||||||
addAndEditForm.deviceTypeList = getSelectId(deviceTypeTree.value, addAndEditForm.typeId)
|
addAndEditForm.deviceTypeList = getSelectId(deviceTypeTree.value, addAndEditForm.parentId)
|
||||||
warningDays.value = addAndEditForm.maintenanceAlarmDay
|
warningDays.value = addAndEditForm.maintenanceAlarmDay
|
||||||
// warningDays.value = addAndEditForm.deviceTypeList[addAndEditForm.deviceTypeList.length-1].data.maintenanceAlarmDay
|
// warningDays.value = addAndEditForm.deviceTypeList[addAndEditForm.deviceTypeList.length-1].data.maintenanceAlarmDay
|
||||||
// warningDays.value = addAndEditForm.deviceTypeList.maintenanceAlarmDay
|
// warningDays.value = addAndEditForm.deviceTypeList.maintenanceAlarmDay
|
||||||
|
|
@ -524,7 +486,7 @@ const equipmentDeploymentParams: any = ref({
|
||||||
deviceCount: 1,
|
deviceCount: 1,
|
||||||
originaValue: '',
|
originaValue: '',
|
||||||
itemTypeModel: '',
|
itemTypeModel: '',
|
||||||
deviceType: '',
|
manageType: '',
|
||||||
buyPrice: '',
|
buyPrice: '',
|
||||||
unitName: '',
|
unitName: '',
|
||||||
code: '',
|
code: '',
|
||||||
|
|
@ -544,18 +506,21 @@ const countDisabled = ref(false)
|
||||||
//装备类目-change
|
//装备类目-change
|
||||||
const dialogTypeCascader = ref()
|
const dialogTypeCascader = ref()
|
||||||
//装备类目-change
|
//装备类目-change
|
||||||
const dialogTypeChange = async () => {
|
const dialogTypeChange = async (val: any) => {
|
||||||
|
const nodeId = val[val.length - 1]
|
||||||
|
const nodeList = findNextLevelIds(oldDeviceTypeTree.value, nodeId)
|
||||||
|
console.log('🚀 ~ dialogTypeChange ~ nodeList:', nodeList)
|
||||||
|
typeId.value = nodeList ? nodeList[0] : []
|
||||||
options.value = []
|
options.value = []
|
||||||
const deviceTypeList = dialogTypeCascader.value.getCheckedNodes()
|
const deviceTypeList = dialogTypeCascader.value.getCheckedNodes()
|
||||||
console.log('deviceTypeList', deviceTypeList[0].data)
|
|
||||||
warningDays.value = deviceTypeList[0].data.maintenanceAlarmDay
|
warningDays.value = deviceTypeList[0].data.maintenanceAlarmDay
|
||||||
if (deviceTypeList[0].data.deviceType == 0) {
|
// if (deviceTypeList[0].data.manageType == 0) {
|
||||||
addAndEditForm.deviceCount = 1
|
// addAndEditForm.deviceCount = 1
|
||||||
typeDisabled.value = true
|
// typeDisabled.value = true
|
||||||
} else {
|
// } else {
|
||||||
addAndEditForm.deviceCount = 1
|
// addAndEditForm.deviceCount = 1
|
||||||
typeDisabled.value = false
|
// typeDisabled.value = false
|
||||||
}
|
// }
|
||||||
if (deviceTypeList[0].data.maTypeProperties == null) {
|
if (deviceTypeList[0].data.maTypeProperties == null) {
|
||||||
propertyNames.value = []
|
propertyNames.value = []
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -585,6 +550,25 @@ const dialogTypeChange = async () => {
|
||||||
examinationPdf: [],
|
examinationPdf: [],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
const findNextLevelIds = (tree: any, targetId: any) => {
|
||||||
|
for (const node of tree) {
|
||||||
|
if (node.id === targetId) {
|
||||||
|
// 找到了目标节点,返回它 children 的 id 数组
|
||||||
|
return node.children ? node.children.map((child: any) => child.id) : [];
|
||||||
|
}
|
||||||
|
if (node.children) {
|
||||||
|
const result: any = findNextLevelIds(node.children, targetId);
|
||||||
|
if (result) return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null // 没找到
|
||||||
|
}
|
||||||
|
const changeDeviceType = async (val: any) => {
|
||||||
|
console.log('🚀 ~ changeDeviceType ~ val:', val)
|
||||||
|
if (val == 0) {
|
||||||
|
addAndEditForm.deviceCount = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//获取所属公司下拉数据
|
//获取所属公司下拉数据
|
||||||
const getCompanyList = async () => {
|
const getCompanyList = async () => {
|
||||||
|
|
@ -618,7 +602,7 @@ const equipRules = ref({
|
||||||
trigger: 'blur',
|
trigger: 'blur',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
deviceType: [
|
manageType: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请选择管理方式',
|
message: '请选择管理方式',
|
||||||
|
|
@ -833,9 +817,9 @@ const submitFun = (type: any) => {
|
||||||
)
|
)
|
||||||
|
|
||||||
addAndEditForm.devInfoProperties = propertyNames.value
|
addAndEditForm.devInfoProperties = propertyNames.value
|
||||||
addAndEditForm.typeId =
|
// addAndEditForm.typeId =
|
||||||
addAndEditForm.deviceTypeList[addAndEditForm.deviceTypeList.length - 1]
|
// addAndEditForm.deviceTypeList[addAndEditForm.deviceTypeList.length - 1]
|
||||||
|
addAndEditForm.typeId = typeId.value
|
||||||
let SEND_FUN_API: any = null
|
let SEND_FUN_API: any = null
|
||||||
if (type == 1) {
|
if (type == 1) {
|
||||||
SEND_FUN_API = equipmentAddApi
|
SEND_FUN_API = equipmentAddApi
|
||||||
|
|
@ -1067,7 +1051,7 @@ const addAndEditForm = reactive<any>({
|
||||||
deviceCount: 1,
|
deviceCount: 1,
|
||||||
originaValue: '',
|
originaValue: '',
|
||||||
itemTypeModel: '',
|
itemTypeModel: '',
|
||||||
deviceType: '',
|
manageType: '',
|
||||||
buyPrice: '',
|
buyPrice: '',
|
||||||
unitName: '',
|
unitName: '',
|
||||||
code: '',
|
code: '',
|
||||||
|
|
@ -1310,7 +1294,7 @@ const onDialogClose = () => {
|
||||||
deviceCount: 1,
|
deviceCount: 1,
|
||||||
originaValue: '',
|
originaValue: '',
|
||||||
itemTypeModel: '',
|
itemTypeModel: '',
|
||||||
deviceType: '',
|
manageType: '',
|
||||||
buyPrice: '',
|
buyPrice: '',
|
||||||
unitName: '',
|
unitName: '',
|
||||||
code: '',
|
code: '',
|
||||||
|
|
@ -1565,7 +1549,7 @@ const handleDel = (index: any) => {
|
||||||
>重置
|
>重置
|
||||||
</el-button
|
</el-button
|
||||||
>
|
>
|
||||||
<el-button class="primary-lease" type="primary" @click="equipmentDeployment"
|
<el-button class="primary-lease" type="primary" @click="equipmentDeployment('')"
|
||||||
>装备新增
|
>装备新增
|
||||||
</el-button
|
</el-button
|
||||||
>
|
>
|
||||||
|
|
@ -1633,7 +1617,11 @@ const handleDel = (index: any) => {
|
||||||
>
|
>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" prop="typeName" label="装备型号" />
|
<el-table-column align="center" prop="itemTypeModel" label="装备型号">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<span>{{ row.itemTypeModel || row.typeName || '-' }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column align="center" prop="nextCheckDate" label="下次检验日期">
|
<el-table-column align="center" prop="nextCheckDate" label="下次检验日期">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<span :style="{ backgroundColor: getUpdateTimeBgColor(row) }">{{
|
<span :style="{ backgroundColor: getUpdateTimeBgColor(row) }">{{
|
||||||
|
|
@ -1864,7 +1852,7 @@ const handleDel = (index: any) => {
|
||||||
type="number"
|
type="number"
|
||||||
clearable
|
clearable
|
||||||
maxlength="10"
|
maxlength="10"
|
||||||
:disabled="typeDisabled"
|
:disabled="addAndEditForm.manageType == 0"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
@ -1893,17 +1881,18 @@ const handleDel = (index: any) => {
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="规格型号:" prop="deviceType">
|
<el-form-item label="管理方式" prop="manageType">
|
||||||
<!-- 0 编码 1 数量 -->
|
<!-- 0 编码 1 数量 -->
|
||||||
<el-select
|
<el-select
|
||||||
v-model="addAndEditForm.deviceType"
|
v-model="addAndEditForm.manageType"
|
||||||
placeholder="请选择管理方式"
|
placeholder="请选择管理方式"
|
||||||
clearable
|
clearable
|
||||||
style="width: 100%;"
|
style="width: 100%;"
|
||||||
:disabled="!isAdd"
|
:disabled="!isAdd"
|
||||||
|
@change="changeDeviceType"
|
||||||
>
|
>
|
||||||
<el-option label="编码" :value="0" />
|
<el-option label="编码" value="0" />
|
||||||
<el-option label="数量" :value="1" />
|
<el-option label="数量" value="1" />
|
||||||
</el-select>
|
</el-select>
|
||||||
<span style="color: red">说明:编码管理按一台一台管理,一台设备一个唯一编码,数量管理支持同规格型号批量录入,一般小型工器具。</span>
|
<span style="color: red">说明:编码管理按一台一台管理,一台设备一个唯一编码,数量管理支持同规格型号批量录入,一般小型工器具。</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue