Browse Source

保养工单调试

master
ljlong_2630 10 months ago
parent
commit
138cd9363e
  1. 2
      src/api/eam/device/deviceInspectionMain/index.ts
  2. 5
      src/api/eam/device/deviceMaintainOrderMain/index.ts
  3. 131
      src/components/Detail/src/Detail.vue
  4. 13
      src/views/eam/device/deviceInspectionMain/index.vue
  5. 9
      src/views/eam/device/deviceMaintainOrderMain/deviceMaintainOrderMain.data.ts
  6. 11
      src/views/eam/device/deviceMaintainOrderMain/index.vue

2
src/api/eam/device/deviceInspectionMain/index.ts

@ -54,4 +54,4 @@ export const exportDeviceInspectionMain = async (params) => {
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/eam/device-inspection-main/get-import-template' })
}
}

5
src/api/eam/device/deviceMaintainOrderMain/index.ts

@ -57,4 +57,9 @@ export const exportDeviceMaintainOrderMain = async (params) => {
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/eam/device-maintain-order-main/get-import-template' })
}
// 保养接单
export const orderClick = (id: number) => {
return request.get({ url: '/eam/device-maintain-order-main/orderClick?id=' + id })
}

131
src/components/Detail/src/Detail.vue

@ -1,14 +1,28 @@
<template>
<div>
<el-drawer v-model="isShowDrawer" title="详情" direction="rtl" size="80%" v-loading="detailLoading">
<el-drawer
v-model="isShowDrawer"
title="详情"
direction="rtl"
size="80%"
v-loading="detailLoading"
>
<template #header>
<div class="font-size-18px">
{{ titleValueRef }} <span class="ml-20px font-size-16px">{{ titleNameRef }}</span>
</div>
</template>
<ContentWrap v-if="!isBasic">
<Descriptions :data="detailData" labelClassName="label-class-name" label-align="left" direction="vertical"
:column="8" :schema="allSchemas.detailSchema" :columns="2" width="200px" />
<Descriptions
:data="detailData"
labelClassName="label-class-name"
label-align="left"
direction="vertical"
:column="8"
:schema="allSchemas.detailSchema"
:columns="2"
width="200px"
/>
</ContentWrap>
<Tabs :tabsList="tabsList" :current="current" @change="change" />
@ -16,15 +30,32 @@
<!-- 详情 -->
<ContentWrap class="w-[100%]">
<!-- 列表头部 -->
<TableHead v-if="!isBasic" :HeadButttondata="HeadButttondata" :number="masterParmas.maintenanceNumber"
@button-base-click="buttonBaseClick" :routeName="routeName" @searchFormClick="searchFormClick"
:allSchemas="detailAllSchemas" />
<TableHead
v-if="!isBasic"
:HeadButttondata="HeadButttondata"
:number="masterParmas.maintenanceNumber"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@searchFormClick="searchFormClick"
:allSchemas="detailAllSchemas"
/>
<!-- 默认单表展现 -->
<Descriptions v-if="isBasic && !tabsExtend" :data="detailData" :schema="allSchemas.detailSchema" :columns="2" />
<Descriptions
v-if="isBasic && !tabsExtend"
:data="detailData"
:schema="allSchemas.detailSchema"
:columns="2"
/>
<!-- 单表切换tabs 展现table -->
<Table v-if="isBasic && tabsExtend" :columns="detailAllSchemasRef.tableColumns" :data="tableObjectRef.tableList"
:loading="tableObjectRef.loading" :pagination="{ total: tableObjectRef.total }"
v-model:pageSize="tableObjectRef.pageSize" v-model:currentPage="tableObjectRef.currentPage">
<Table
v-if="isBasic && tabsExtend"
:columns="detailAllSchemasRef.tableColumns"
:data="tableObjectRef.tableList"
:loading="tableObjectRef.loading"
:pagination="{ total: tableObjectRef.total }"
v-model:pageSize="tableObjectRef.pageSize"
v-model:currentPage="tableObjectRef.currentPage"
>
<!-- <template #action="{ row }">
<ButtonBase
:Butttondata="buttondata"
@ -32,34 +63,68 @@
/>
</template> -->
</Table>
<Table v-if="!isBasic && fromeWhere != 'countPlan'" :columns="detailAllSchemasRef.tableColumns"
:data="tableObjectRef.tableList" :loading="tableObjectRef.loading"
:pagination="{ total: tableObjectRef.total }" v-model:pageSize="tableObjectRef.pageSize"
v-model:currentPage="tableObjectRef.currentPage">
<Table
v-if="!isBasic && fromeWhere != 'countPlan'"
:columns="detailAllSchemasRef.tableColumns"
:data="tableObjectRef.tableList"
:loading="tableObjectRef.loading"
:pagination="{ total: tableObjectRef.total }"
v-model:pageSize="tableObjectRef.pageSize"
v-model:currentPage="tableObjectRef.currentPage"
>
<template #photos="{ row }">
<div v-for="(item, index) in row.photos.split(',')" :key="index" style="color: #409eff; cursor: pointer"
@click="openImage(item)">{{ item }}</div>
<div
v-for="(item, index) in row.photos.split(',')"
:key="index"
style="color: #409eff; cursor: pointer"
@click="openImage(item)"
>{{ item }}</div
>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="buttondata" @button-base-click="buttonTableClick($event, row)" />
<ButtonBase
:Butttondata="buttondata"
@button-base-click="buttonTableClick($event, row)"
/>
</template>
</Table>
<DetailTable v-if="!isBasic && fromeWhere == 'countPlan' && isShowDrawer"
:columns="detailAllSchemasRef.tableColumns" :data="tableObjectRef.tableList" :allList="allList"
:countScopeType="countScopeType" :key="updateKey">
<DetailTable
v-if="!isBasic && fromeWhere == 'countPlan' && isShowDrawer"
:columns="detailAllSchemasRef.tableColumns"
:data="tableObjectRef.tableList"
:allList="allList"
:countScopeType="countScopeType"
:key="updateKey"
>
<template #action="{ row }">
<ButtonBase :Butttondata="buttondata" @button-base-click="buttonTableClick($event, row)" />
<ButtonBase
:Butttondata="buttondata"
@button-base-click="buttonTableClick($event, row)"
/>
</template>
</DetailTable>
</ContentWrap>
</div>
</el-drawer>
<!-- 表单弹窗添加/修改 -->
<BasicForm ref="formRef" @success="submitForm" :rules="detailAllSchemasRules" :formAllSchemas="detailAllSchemas"
:isBusiness="false" :apiUpdate="apiUpdate" :apiCreate="apiCreate" :fromeWhere="fromeWhere" :isDetail="true"
@searchTableSuccess="searchTableSuccess" :detailData="detailData" @submitForm="submitForm"
@selectChangeDetail="selectChangeDetail" :formTypeDetail="formTypeDetail" :countPlanAllList="countPlanAllList"
:isSearchTableItem="isSearchTableItem" />
<BasicForm
ref="formRef"
@success="submitForm"
:rules="detailAllSchemasRules"
:formAllSchemas="detailAllSchemas"
:isBusiness="false"
:apiUpdate="apiUpdate"
:apiCreate="apiCreate"
:fromeWhere="fromeWhere"
:isDetail="true"
@searchTableSuccess="searchTableSuccess"
:detailData="detailData"
@submitForm="submitForm"
@selectChangeDetail="selectChangeDetail"
:formTypeDetail="formTypeDetail"
:countPlanAllList="countPlanAllList"
:isSearchTableItem="isSearchTableItem"
/>
</div>
</template>
@ -283,11 +348,11 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
setBeiJian()
let detailButtonAdd: any = []
detailButtonAdd = props.isShowAddBtn ? [
detailButtonAdd = props.isShowAddBtn?[
defaultButtons.defaultAddBtn({
hide: isShowMainButton(row, ['1'])
})
] : []
]:[]
HeadButttondata.value = [...detailButtonAdd]
//
if (!props.detailButtonIsShow) {
@ -374,8 +439,8 @@ const buttonBaseClick = (val, item) => {
// -
const buttonTableClick = async (val, row) => {
console.log(val)
console.log(row)
console.log(val)
console.log(row)
if (val == 'edit') {
//
openForm('update', row)
@ -397,7 +462,7 @@ const openForm = async (type: string, row?: number) => {
let isChargePeoples = false
let isItemNUmbersTrue = false
isTrue = detailAllSchemasRef.value.tableColumns.some((item) => item.field == 'maintenances')
isChargePeoples = detailAllSchemasRef.value.tableColumns.some(
isChargePeoples = detailAllSchemasRef.value.tableColumns.some(
(item) => item.field == 'chargePeoples'
)
isItemNUmbersTrue = detailAllSchemasRef.value.tableColumns.some(
@ -408,7 +473,7 @@ const openForm = async (type: string, row?: number) => {
row.maintenances = row.maintenances.split(',').map(Number)
}
}
if (isChargePeoples) {
if(isChargePeoples) {
if (row.chargePeoples && isString(row.chargePeoples)) {
row.chargePeoples = row.chargePeoples.split(',').map(Number)
}
@ -453,7 +518,7 @@ const handleDelete = async (id: number) => {
await getList()
updateKey.value += 1
setBeiJian()
} catch { }
} catch {}
}
//
const searchFormClick = async (searchData) => {

13
src/views/eam/device/deviceInspectionMain/index.vue

@ -55,18 +55,22 @@
<!-- 详情 -->
<!-- <Detail ref="detailRef" :isBasic="true" :allSchemas="DeviceInspectionDetail.allSchemas" /> -->
<Detail ref="detailRef" :isBasic="false" :allSchemas="DeviceInspectionMain.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"
:apiDelete="DeviceInspectionDetailApi.deleteDeviceInspectionDetail"
:Echo="Echo"
@searchTableSuccessDetail="searchTableSuccessDetail"
@detailOpenForm="detailOpenForm"
:detailValidate="detailValidate"
@detailSubmitForm="detailSubmitForm"
:isSearchTableItem="true" />
:isSearchTableItem="true"
/>
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/eam/device-inspection-main/import" :importTemplateData="importTemplateData"
@ -308,7 +312,6 @@ const onChange = (field, cur, item) => {
//
const searchTableSuccessDetail = (formField, searchField, val, formRef) => {
debugger
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
@ -412,13 +415,11 @@ const handleDeleteTable = (item, index) => {
//
const submitForm = async (formType, data) => {
debugger
data.subList = tableData.value.map((item) => {
item.chargePeoples = item.chargePeoples.join(',');
return item;
}) //
console.log(data.subList)
debugger
try {
if (formType === 'create') {
await DeviceInspectionMainApi.createDeviceInspectionMain(data)

9
src/views/eam/device/deviceMaintainOrderMain/deviceMaintainOrderMain.data.ts

@ -10,9 +10,9 @@ import * as ItemApi from '@/api/eam/basic/item'
const userStore = useUserStore()
const factoryList = await selectAllFactoryArea()
const deviceList = await DeviceAccountsApi.getDeviceAccountsNoPage({})
const userList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: '', flag: 1 })
const dutyUserList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: '', flag: undefined })
const engineerList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: '', flag: 2})
const userList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: undefined, flag: 1 })
const dutyUserList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: undefined, flag: undefined })
const engineerList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: undefined, flag: 2})
const repairList = await DeviceMaintenanceMainApi.getDeviceMainTempList('DEVICE')
// 表单校验
@ -310,7 +310,8 @@ export const DeviceMaintainOrderDetail = useCrudSchemas(reactive<CrudSchema[]>([
},
api: () => dutyUserList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return userList.filter(item=>cellValue.includes(item.id)).map(cur=>cur.name).join(',')
return userList.filter(item=>cellValue?.includes(item.id)).map(cur=>cur.name).join(',')
},
form: {
component: 'Select',

11
src/views/eam/device/deviceMaintainOrderMain/index.vue

@ -82,7 +82,7 @@
@detailOpenForm="detailOpenForm"
:detailValidate="detailValidate"
@detailSubmitForm="detailSubmitForm"
:isSearchTableItem="true"
:isSearchTableItem="true"
/>
<!-- 导入 -->
@ -222,9 +222,11 @@ const butttondata = (row) => {
return [
// defaultButtons.mainListEditBtn(null), //
defaultButtons.acceptOrderBtn({
hide: !(
row.status == 'PENDING' &&
userStore?.userSelfInfo?.posts?.some((item) => item.code == 'worker')
(userStore?.userSelfInfo?.posts?.some((item) => item.code == 'engineer') ||
userStore?.userSelfInfo?.posts?.some((item) => item.code == 'worker'))
)
}), //
// defaultButtons.turnOrderBtn({
@ -340,7 +342,10 @@ const searchFormClick = (searchData) => {
//
function acceptOrder(row) {
DeviceMaintainOrderMainApi.orderStepChange(row)
DeviceMaintainOrderMainApi.orderClick(row.id).then(() => {
message.success('接单成功')
getList();
});
}
//
function turnOrder() {}

Loading…
Cancel
Save