|
|
@ -11,13 +11,20 @@ |
|
|
|
|
|
|
|
<!-- 列表 --> |
|
|
|
<ContentWrap> |
|
|
|
<Table :columns="tableColumns" :data="tableObject.tableList" :loading="tableObject.loading" :pagination="{ |
|
|
|
<Table |
|
|
|
:columns="tableColumns" |
|
|
|
:data="tableObject.tableList" |
|
|
|
:loading="tableObject.loading" |
|
|
|
:pagination="{ |
|
|
|
total: tableObject.total |
|
|
|
}" v-model:pageSize="tableObject.pageSize" v-model:currentPage="tableObject.currentPage" |
|
|
|
v-model:sort="tableObject.sort"> |
|
|
|
<template #code="{ row }"> |
|
|
|
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> |
|
|
|
<span>{{ row.code }}</span> |
|
|
|
}" |
|
|
|
v-model:pageSize="tableObject.pageSize" |
|
|
|
v-model:currentPage="tableObject.currentPage" |
|
|
|
v-model:sort="tableObject.sort" |
|
|
|
> |
|
|
|
<template #number="{ row }"> |
|
|
|
<el-button type="primary" link @click="openDetail(row, '代码', row.number)"> |
|
|
|
<span>{{ row.number }}</span> |
|
|
|
</el-button> |
|
|
|
</template> |
|
|
|
<template #action="{ row }"> |
|
|
@ -30,10 +37,18 @@ |
|
|
|
<BasicForm ref="basicFormRef" @success="formsSuccess" :rules="DeviceInspectionMainRules" |
|
|
|
:formAllSchemas="DeviceInspectionMain.allSchemas" :apiUpdate="DeviceInspectionMainApi.updateDeviceInspectionMain" |
|
|
|
:apiCreate="DeviceInspectionMainApi.createDeviceInspectionMain" @searchTableSuccess="searchTableSuccess" |
|
|
|
:isBusiness="false" @onChange="onChange"/> |
|
|
|
:isBusiness="false" @onChange="onChange" /> |
|
|
|
|
|
|
|
<!-- 详情 --> |
|
|
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="DeviceInspectionMain.allSchemas" /> |
|
|
|
<!-- <Detail ref="detailRef" :isBasic="true" :allSchemas="DeviceInspectionDetail.allSchemas" /> --> |
|
|
|
<Detail ref="detailRef" :isBasic="false" :allSchemas="DeviceInspectionMain.allSchemas" |
|
|
|
:detailAllSchemas="DeviceInspectionDetail.allSchemas" :detailAllSchemasRules="DeviceInspectionDetailRules" |
|
|
|
:apiCreate="DeviceInspectionDetailApi.createDeviceInspectionDetail" |
|
|
|
:apiUpdate="DeviceInspectionDetailApi.updateDeviceInspectionDetail" |
|
|
|
:apiPage="DeviceInspectionDetailApi.getDeviceInspectionDetailPage" |
|
|
|
:apiDelete="DeviceInspectionDetailApi.deleteDeviceInspectionDetail" :Echo="Echo" |
|
|
|
@searchTableSuccessDetail="searchTableSuccessDetail" @detailOpenForm="detailOpenForm" :detailValidate="detailValidate" |
|
|
|
@detailSubmitForm="detailSubmitForm" :isSearchTableItem="true" /> |
|
|
|
|
|
|
|
<!-- 导入 --> |
|
|
|
<ImportForm ref="importFormRef" url="/eam/device-inspection-main/import" :importTemplateData="importTemplateData" |
|
|
@ -42,8 +57,9 @@ |
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
|
import download from '@/utils/download' |
|
|
|
import { DeviceInspectionMain, DeviceInspectionMainRules } from './deviceInspectionMain.data' |
|
|
|
import { DeviceInspectionDetail, DeviceInspectionDetailRules, DeviceInspectionMain, DeviceInspectionMainRules } from './deviceInspectionMain.data' |
|
|
|
import * as DeviceInspectionMainApi from '@/api/eam/device/deviceInspectionMain' |
|
|
|
import * as DeviceInspectionDetailApi from '@/api/eam/device/deviceInspectionDetail' |
|
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
|
import { useUserStore } from '@/store/modules/user' |
|
|
|
|
|
|
@ -60,7 +76,7 @@ const route = useRoute() // 路由信息 |
|
|
|
const routeName = ref() |
|
|
|
routeName.value = route.name |
|
|
|
const tableColumns = ref(DeviceInspectionMain.allSchemas.tableColumns) |
|
|
|
|
|
|
|
const Echo = [] |
|
|
|
// 查询页面返回 |
|
|
|
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|
|
|
nextTick(() => { |
|
|
@ -252,6 +268,92 @@ const onChange = (field, cur, item) => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 查询页面返回——详情 |
|
|
|
const searchTableSuccessDetail = (formField, searchField, val, formRef) => { |
|
|
|
nextTick(() => { |
|
|
|
const setV = {} |
|
|
|
setV[formField] = val[0][searchField] |
|
|
|
if (formField == 'itemNumbers1') { |
|
|
|
let str = '' |
|
|
|
val.forEach((element) => { |
|
|
|
str += element.name + ':' + element.qty + ',' |
|
|
|
}) |
|
|
|
str = str.substring(0, str.length - 1) |
|
|
|
setV['itemNumbers'] = val |
|
|
|
setV['itemNumbers1'] = str |
|
|
|
} |
|
|
|
formRef.setValues(setV) |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
const detailOpenForm = (type, row) => { |
|
|
|
console.log("type", type); |
|
|
|
console.log("row", row); |
|
|
|
DeviceInspectionDetail.allSchemas.tableFormColumns.map((item) => { |
|
|
|
|
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
// 子表新增/编辑校验 |
|
|
|
const detailValidate = (data) => { |
|
|
|
return true; |
|
|
|
let tag = false; |
|
|
|
if (data.qty <= 0) { |
|
|
|
message.warning('数量必须大于0') |
|
|
|
tag = false; |
|
|
|
return tag; |
|
|
|
} else { |
|
|
|
tag = true; |
|
|
|
return tag; |
|
|
|
} |
|
|
|
} |
|
|
|
// 子表提交 |
|
|
|
const detailSubmitForm = async (formType, data, getList, formRef, tableList) => { |
|
|
|
try { |
|
|
|
let data1 = { |
|
|
|
id: data.id, |
|
|
|
number: data.number, |
|
|
|
siteId: data.siteId, |
|
|
|
available: data.available, |
|
|
|
concurrencyStamp: data.concurrencyStamp, |
|
|
|
name: data.name, |
|
|
|
peoples: data.peoples.join(','), |
|
|
|
estimatedMinutes: data.estimatedMinutes, |
|
|
|
actualMinutes: data.actualMinutes, |
|
|
|
chargePeoples: data.chargePeoples.join(','), |
|
|
|
completionTime: data.completionTime, |
|
|
|
engineer: data.engineer.join(','), |
|
|
|
uncompleted: data.uncompleted |
|
|
|
} |
|
|
|
console.log(data1) |
|
|
|
if (formType === 'create') { |
|
|
|
await DeviceInspectionDetailApi.createDeviceInspectionDetail(data1) |
|
|
|
message.success(t('common.createSuccess')) |
|
|
|
} else { |
|
|
|
await DeviceInspectionDetailApi.updateDeviceInspectionDetail(data1) |
|
|
|
message.success(t('common.updateSuccess')) |
|
|
|
} |
|
|
|
formRef.dialogVisible = false |
|
|
|
// 刷新当前列表 |
|
|
|
await getList() |
|
|
|
detailRef.value.tableObject.tableList.forEach(item => { |
|
|
|
if (item.itemNumbers?.length > 0) { |
|
|
|
let str = '' |
|
|
|
item.itemNumbers.forEach(element => { |
|
|
|
str += element.name + ':' + element.qty + ',' |
|
|
|
}) |
|
|
|
item.itemNumbers1 = str.substring(0, str.length - 1) |
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
} finally { |
|
|
|
formRef.formLoading = false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** 初始化 **/ |
|
|
|
onMounted(async () => { |
|
|
|
getList() |
|
|
|