Browse Source

维修和检修部分代码

master
ljlong_2630 10 months ago
parent
commit
8c4a962208
  1. 1
      src/utils/dict.ts
  2. 35
      src/utils/disposition/defaultButtons.ts
  3. 180
      src/views/eam/device/deviceInspectionMain/deviceInspectionMain.data.ts
  4. 99
      src/views/eam/device/deviceInspectionMain/index.vue
  5. 38
      src/views/eam/device/deviceMaintenanceMain/deviceMaintenanceMain.data.ts
  6. 73
      src/views/eam/device/deviceMaintenanceMain/index.vue
  7. 29
      src/views/eam/device/deviceRepair/deviceRepair.data.ts
  8. 57
      src/views/eam/device/deviceRepair/index.vue

1
src/utils/dict.ts

@ -282,4 +282,5 @@ export enum DICT_TYPE {
CLASS_TYPE = 'class_type', // 班组类型 CLASS_TYPE = 'class_type', // 班组类型
INVENTORY_ACTION = 'inventory_action', //库存动作 INVENTORY_ACTION = 'inventory_action', //库存动作
MAINTENANCE_TYPE = 'maintenance_type', //保养类型 MAINTENANCE_TYPE = 'maintenance_type', //保养类型
JX_STATUS = 'JX_STATUS', //检修状态
} }

35
src/utils/disposition/defaultButtons.ts

@ -814,13 +814,13 @@ export function turnOrderBtn(option:any) {
}) })
} }
// 主列表-完成 //主列表-维修
export function finishOrderBtn(option:any) { export function repairBtn(option:any) {
return __defaultBtnOption(option,{ return __defaultBtnOption(option,{
label: '完成', label: '维修',
name: 'finishOrder', name: 'repair',
hide: false, hide: false,
type: 'success', type: 'primary',
color: '', color: '',
link: true, // 文本展现按钮 link: true, // 文本展现按钮
hasPermi: '' hasPermi: ''
@ -840,11 +840,11 @@ export function verifyOrderBtn(option:any) {
}) })
} }
//主列表-维 // 主列表-检
export function repairBtn(option:any) { export function maintenanceOrderBtn(option:any) {
return __defaultBtnOption(option,{ return __defaultBtnOption(option,{
label: '修', label: '修',
name: 'repair', name: 'maintenanceOrder',
hide: false, hide: false,
type: 'primary', type: 'primary',
color: '', color: '',
@ -853,6 +853,23 @@ export function repairBtn(option:any) {
}) })
} }
// 主列表-完成
export function finishOrderBtn(option:any) {
return __defaultBtnOption(option,{
label: '完成',
name: 'finishOrder',
hide: false,
type: 'success',
color: '',
link: true, // 文本展现按钮
hasPermi: ''
})
}
// 默认按钮规则 // 默认按钮规则
function __defaultBtnOption(option:any,specific:any){ function __defaultBtnOption(option:any,specific:any){
return { return {

180
src/views/eam/device/deviceInspectionMain/deviceInspectionMain.data.ts

@ -1,5 +1,12 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime' import { selectAllFactoryArea } from '@/api/system/dept'
import * as DeviceAccountsApi from '@/api/eam/device/deviceAccounts'
import { useUserStore } from '@/store/modules/user'
import { selecUserByType } from '@/api/system/dept'
const userStore = useUserStore()
const factoryList = await selectAllFactoryArea()
const deviceList = await DeviceAccountsApi.getDeviceAccountsNoPage({})
const userList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: '', flag: 1 })
// 表单校验 // 表单校验
export const DeviceInspectionMainRules = reactive({ export const DeviceInspectionMainRules = reactive({
@ -14,90 +21,187 @@ export const DeviceInspectionMainRules = reactive({
export const DeviceInspectionMain = useCrudSchemas(reactive<CrudSchema[]>([ export const DeviceInspectionMain = useCrudSchemas(reactive<CrudSchema[]>([
{ {
label: '编号唯一标识', label: '检修编号',
field: 'number', field: 'number',
sort: 'custom', sort: 'custom',
table: {
width: '150',
},
isSearch: true, isSearch: true,
isForm: false,
}, },
{ {
label: '维修工单号', label: '维修工单号',
field: 'maintenanceNumber', field: 'maintenanceNumber',
sort: 'custom', sort: 'custom',
isSearch: true,
table: {
width: '150',
},
}, },
{ {
label: '设备模具', label: '设备',
field: 'deviceNumber', field: 'deviceNumber',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
table: {
width: '150',
},
api: () => deviceList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return deviceList.find((account) => account.number == cellValue)?.name
},
search: {
show: true,
component: 'Select',
api: () => deviceList,
componentProps: {
optionsAlias: {
labelField: 'name',
valueField: 'number'
}
}
},
form: {
component: 'Select',
api: () => deviceList,
componentProps: {
optionsAlias: {
labelField: 'name',
valueField: 'number'
},
},
}
}, },
{ {
label: '厂区编号', label: '厂区编号',
field: 'factoryAreaNumber', field: 'factoryAreaNumber',
sort: 'custom', sort: 'custom',
isSearch: false,
table: {
width: '150',
},
api: () => factoryList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return factoryList.find((account) => account.id == cellValue)?.name
},
search: {
show: true,
component: 'Select',
api: () => factoryList,
componentProps: {
optionsAlias: {
labelField: 'name',
valueField: 'id'
}
}
}, },
{ form: {
label: '描述', component: 'Select',
field: 'describe', api: () => factoryList,
sort: 'custom', componentProps: {
disabled: true,
optionsAlias: {
labelField: 'name',
valueField: 'id'
},
placeholder: "请先选择设备"
},
}
}, },
{ {
label: '维修人', label: '维修人',
field: 'maintenance', field: 'maintenance',
sort: 'custom', sort: 'custom',
isSearch: false,
table: {
width: '150',
},
api: () => userList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return userList.find((account) => account.id == cellValue)?.name
},
search: {
show: true,
component: 'Select',
api: () => userList,
componentProps: {
optionsAlias: {
labelField: 'name',
valueField: 'id'
}
}
},
form: { form: {
component: 'InputNumber', component: 'Select',
value: 0 api: () => userList,
componentProps: {
disabled: true,
optionsAlias: {
labelField: 'name',
valueField: 'id'
}, },
placeholder: "请先选择设备"
},
}
}, },
{ {
label: '维修人联系电话', label: '描述',
field: 'maintenancePhone', field: 'describe',
sort: 'custom', sort: 'custom',
isSearch: false,
table: {
width: '230',
},
form: {
component: 'Input',
componentProps: {
type: 'textarea',
}
},
}, },
// {
// label: '维修人联系电话',
// field: 'maintenancePhone',
// sort: 'custom',
// },
{ {
label: '状态', label: '状态',
field: 'status', field: 'status',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
form: { table: {
component: 'Radio' width: '150',
},
}, },
{
label: '类型',
field: 'type',
sort: 'custom',
isSearch: true, isSearch: true,
dictType: DICT_TYPE.JX_STATUS,
dictClass: 'string',
form: { form: {
component: 'Select' component: 'Select'
}, },
}, },
{ {
label: '创建时间', label: '类型',
field: 'createTime', field: 'type',
sort: 'custom',
formatter: dateFormatter,
isForm: false,
},
{
label: '地点ID',
field: 'siteId',
sort: 'custom',
},
{
label: '是否可用',
field: 'available',
sort: 'custom', sort: 'custom',
table: {
width: '150',
}, },
{ isSearch: false,
label: '并发乐观锁', dictType: DICT_TYPE.DEVICE_MOLD_TYPE,
field: 'concurrencyStamp', dictClass: 'string',
sort: 'custom',
form: { form: {
component: 'InputNumber', component: 'Select'
value: 0
}, },
}, },
// {
// label: '创建时间',
// field: 'createTime',
// sort: 'custom',
// formatter: dateFormatter,
// isForm: false,
// },
{ {
label: '操作', label: '操作',
field: 'action', field: 'action',

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

@ -5,63 +5,47 @@
</ContentWrap> </ContentWrap>
<!-- 列表头部 --> <!-- 列表头部 -->
<TableHead <TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" :routeName="routeName"
:HeadButttondata="HeadButttondata" @updataTableColumns="updataTableColumns" @searchFormClick="searchFormClick"
@button-base-click="buttonBaseClick" :allSchemas="DeviceInspectionMain.allSchemas" />
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="DeviceInspectionMain.allSchemas"
/>
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
<Table <Table :columns="tableColumns" :data="tableObject.tableList" :loading="tableObject.loading" :pagination="{
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total total: tableObject.total
}" }" v-model:pageSize="tableObject.pageSize" v-model:currentPage="tableObject.currentPage"
v-model:pageSize="tableObject.pageSize" v-model:sort="tableObject.sort">
v-model:currentPage="tableObject.currentPage" <template #code="{ row }">
v-model:sort="tableObject.sort"
>
<template #code="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> <el-button type="primary" link @click="openDetail(row, '代码', row.code)">
<span>{{ row.code }}</span> <span>{{ row.code }}</span>
</el-button> </el-button>
</template> </template>
<template #action="{ row }"> <template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> <ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event, row)" />
</template> </template>
</Table> </Table>
</ContentWrap> </ContentWrap>
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<BasicForm <BasicForm ref="basicFormRef" @success="formsSuccess" :rules="DeviceInspectionMainRules"
ref="basicFormRef" :formAllSchemas="DeviceInspectionMain.allSchemas" :apiUpdate="DeviceInspectionMainApi.updateDeviceInspectionMain"
@success="formsSuccess" :apiCreate="DeviceInspectionMainApi.createDeviceInspectionMain" @searchTableSuccess="searchTableSuccess"
:rules="DeviceInspectionMainRules" :isBusiness="false" />
:formAllSchemas="DeviceInspectionMain.allSchemas"
:apiUpdate="DeviceInspectionMainApi.updateDeviceInspectionMain"
:apiCreate="DeviceInspectionMainApi.createDeviceInspectionMain"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<!-- 详情 --> <!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="DeviceInspectionMain.allSchemas" /> <Detail ref="detailRef" :isBasic="true" :allSchemas="DeviceInspectionMain.allSchemas" />
<!-- 导入 --> <!-- 导入 -->
<ImportForm ref="importFormRef" url="/eam/device-inspection-main/import" :importTemplateData="importTemplateData" @success="importSuccess" /> <ImportForm ref="importFormRef" url="/eam/device-inspection-main/import" :importTemplateData="importTemplateData"
@success="importSuccess" />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import download from '@/utils/download' import download from '@/utils/download'
import { DeviceInspectionMain,DeviceInspectionMainRules } from './deviceInspectionMain.data' import { DeviceInspectionMain, DeviceInspectionMainRules } from './deviceInspectionMain.data'
import * as DeviceInspectionMainApi from '@/api/eam/device/deviceInspectionMain' import * as DeviceInspectionMainApi from '@/api/eam/device/deviceInspectionMain'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
import { useUserStore } from '@/store/modules/user'
// import TableHead from '@/components/TableHead/src/TableHead.vue' // import TableHead from '@/components/TableHead/src/TableHead.vue'
// import ImportForm from '@/components/ImportForm/src/ImportForm.vue' // import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
// import Detail from '@/components/Detail/src/Detail.vue' // import Detail from '@/components/Detail/src/Detail.vue'
@ -70,7 +54,7 @@ defineOptions({ name: 'DeviceInspectionMain' })
const message = useMessage() // const message = useMessage() //
const { t } = useI18n() // const { t } = useI18n() //
const userStore = useUserStore() //
const route = useRoute() // const route = useRoute() //
const routeName = ref() const routeName = ref()
routeName.value = route.name routeName.value = route.name
@ -99,12 +83,14 @@ const { getList, setSearchParams } = tableMethods
// //
const HeadButttondata = [ const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'eam:deviceInspectionMain:create'}), // // defaultButtons.defaultAddBtn({hasPermi:'eam:deviceInspectionMain:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'eam:deviceInspectionMain:import'}), // // defaultButtons.defaultImportBtn({hasPermi:'eam:deviceInspectionMain:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'eam:deviceInspectionMain:export'}), // // defaultButtons.defaultExportBtn({ hasPermi: 'eam:deviceInspectionMain:export' }), //
defaultButtons.defaultAddBtn({ hide: !(userStore?.userSelfInfo?.posts?.some((item) => item.code == 'worker') || userStore?.userSelfInfo?.posts?.some((item) => item.code == 'engineer')) }), //
defaultButtons.defaultFreshBtn(null), // defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), // defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), // defaultButtons.defaultSetBtn(null), //
// { // {
// label: '', // label: '',
// name: 'zdy', // name: 'zdy',
@ -132,17 +118,24 @@ const buttonBaseClick = (val, item) => {
} }
// - // -
const butttondata = [ const butttondata = (row) => {
defaultButtons.mainListEditBtn({hasPermi:'eam:deviceInspectionMain:update'}), // return [
defaultButtons.mainListDeleteBtn({hasPermi:'eam:deviceInspectionMain:delete'}), // // defaultButtons.mainListEditBtn({hasPermi:'eam:deviceInspectionMain:update'}), //
] // defaultButtons.mainListDeleteBtn({hasPermi:'eam:deviceInspectionMain:delete'}), //
defaultButtons.mainListEditBtn(null), //
defaultButtons.maintenanceOrderBtn({ hide: !(row.status == 'PROCCED' && (userStore.getUser.id == row.maintenance)) }), //
defaultButtons.finishOrderBtn({ hide: !(row.status == 'PROCCED' && (userStore.getUser.id == row.maintenance)) }), //
]
}
// - // -
const buttonTableClick = async (val, row) => { const buttonTableClick = async (val, row) => {
if (val == 'edit') { // if (val == 'edit') { //
openForm('update', row) openForm('update', row)
} else if (val == 'delete') { // } else if (val == 'maintenanceOrder') { //
handleDelete(row.id) handleMaintenanceOrder(row)
} else if (val == 'finishOrder') { //
handleFinishOrder(row)
} }
} }
@ -153,18 +146,18 @@ const openForm = (type: string, row?: any) => {
} }
// form // form
const formsSuccess = async (formType,data) => { const formsSuccess = async (formType, data) => {
var isHave =DeviceInspectionMain.allSchemas.formSchema.some(function (item) { var isHave = DeviceInspectionMain.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime'; return item.field === 'activeTime' || item.field === 'expireTime';
}); });
if(isHave){ if (isHave) {
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){ if (data.activeTime && data.expireTime && data.activeTime >= data.expireTime) {
message.error('失效时间要大于生效时间') message.error('失效时间要大于生效时间')
return; return;
} }
} }
if(data.activeTime==0)data.activeTime = null; if (data.activeTime == 0) data.activeTime = null;
if(data.expireTime==0)data.expireTime = null; if (data.expireTime == 0) data.expireTime = null;
if (formType === 'create') { if (formType === 'create') {
await DeviceInspectionMainApi.createDeviceInspectionMain(data) await DeviceInspectionMainApi.createDeviceInspectionMain(data)
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))
@ -192,7 +185,7 @@ const handleDelete = async (id: number) => {
message.success(t('common.delSuccess')) message.success(t('common.delSuccess'))
// //
await getList() await getList()
} catch {} } catch { }
} }
/** 导出按钮操作 */ /** 导出按钮操作 */
@ -235,6 +228,14 @@ const searchFormClick = (searchData) => {
getList() // getList() //
} }
function handleMaintenanceOrder(row) {
}
function handleFinishOrder(row) {
}
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
getList() getList()

38
src/views/eam/device/deviceMaintenanceMain/deviceMaintenanceMain.data.ts

@ -2,7 +2,7 @@ import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { selectAllFactoryArea } from '@/api/system/dept' import { selectAllFactoryArea } from '@/api/system/dept'
import * as DeviceAccountsApi from '@/api/eam/device/deviceAccounts' import * as DeviceAccountsApi from '@/api/eam/device/deviceAccounts'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
import {selecUserByType} from '@/api/system/dept' import { selecUserByType } from '@/api/system/dept'
const userStore = useUserStore() const userStore = useUserStore()
const factoryList = await selectAllFactoryArea() const factoryList = await selectAllFactoryArea()
const deviceList = await DeviceAccountsApi.getDeviceAccountsNoPage({}) const deviceList = await DeviceAccountsApi.getDeviceAccountsNoPage({})
@ -25,6 +25,9 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '维修工单编号', label: '维修工单编号',
field: 'number', field: 'number',
sort: 'custom', sort: 'custom',
table: {
width: '150',
},
isSearch: true, isSearch: true,
isForm: false, isForm: false,
}, },
@ -32,6 +35,9 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '报修工单编号', label: '报修工单编号',
field: 'requestNumber', field: 'requestNumber',
sort: 'custom', sort: 'custom',
table: {
width: '150',
},
isForm: false, isForm: false,
isSearch: true, isSearch: true,
isTable: true, isTable: true,
@ -41,9 +47,12 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '设备模具编号', label: '设备模具编号',
field: 'deviceNumber', field: 'deviceNumber',
sort: 'custom', sort: 'custom',
table: {
width: '150',
},
api: () => deviceList, api: () => deviceList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => { formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return factoryList.find((account) => account.number == cellValue)?.name return deviceList.find((account) => account.number == cellValue)?.name
}, },
search: { search: {
show: true, show: true,
@ -71,6 +80,9 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '厂区编号', label: '厂区编号',
field: 'factoryAreaNumber', field: 'factoryAreaNumber',
sort: 'custom', sort: 'custom',
table: {
width: '150',
},
api: () => factoryList, api: () => factoryList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => { formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return factoryList.find((account) => account.id == cellValue)?.name return factoryList.find((account) => account.id == cellValue)?.name
@ -90,7 +102,7 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
component: 'Select', component: 'Select',
api: () => factoryList, api: () => factoryList,
componentProps: { componentProps: {
disabled:true, disabled: true,
optionsAlias: { optionsAlias: {
labelField: 'name', labelField: 'name',
valueField: 'id' valueField: 'id'
@ -103,9 +115,12 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '维修人', label: '维修人',
field: 'maintenance', field: 'maintenance',
sort: 'custom', sort: 'custom',
table: {
width: '150',
},
api: () => userList, api: () => userList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => { formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return factoryList.find((account) => account.id == cellValue)?.name return userList.find((account) => account.id == cellValue)?.name
}, },
search: { search: {
show: true, show: true,
@ -122,7 +137,7 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
component: 'Select', component: 'Select',
api: () => userList, api: () => userList,
componentProps: { componentProps: {
disabled:true, disabled: true,
optionsAlias: { optionsAlias: {
labelField: 'name', labelField: 'name',
valueField: 'id' valueField: 'id'
@ -140,6 +155,9 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '状态', label: '状态',
field: 'status', field: 'status',
sort: 'custom', sort: 'custom',
table: {
width: '150',
},
isSearch: true, isSearch: true,
isForm: false, isForm: false,
dictType: DICT_TYPE.WEI_XIU_ORDER_STATUS, dictType: DICT_TYPE.WEI_XIU_ORDER_STATUS,
@ -152,6 +170,9 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '类型设备', label: '类型设备',
field: 'type', field: 'type',
sort: 'custom', sort: 'custom',
table: {
width: '150',
},
isSearch: true, isSearch: true,
isForm: true, isForm: true,
dictType: DICT_TYPE.DEVICE_MOLD_TYPE, dictType: DICT_TYPE.DEVICE_MOLD_TYPE,
@ -167,11 +188,12 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '描述', label: '描述',
field: 'describes', field: 'describes',
sort: 'custom', sort: 'custom',
table: {
width: '150',
},
form: { form: {
component: 'Input', component: 'Input',
componentProps: {
type: 'textarea',
}
}, },
}, },
// { // {

73
src/views/eam/device/deviceMaintenanceMain/index.vue

@ -5,62 +5,44 @@
</ContentWrap> </ContentWrap>
<!-- 列表头部 --> <!-- 列表头部 -->
<TableHead <TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" :routeName="routeName"
:HeadButttondata="HeadButttondata" @updataTableColumns="updataTableColumns" @searchFormClick="searchFormClick"
@button-base-click="buttonBaseClick" :allSchemas="DeviceMaintenanceMain.allSchemas" />
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="DeviceMaintenanceMain.allSchemas"
/>
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
<Table <Table :columns="tableColumns" :data="tableObject.tableList" :loading="tableObject.loading" :pagination="{
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total total: tableObject.total
}" }" v-model:pageSize="tableObject.pageSize" v-model:currentPage="tableObject.currentPage"
v-model:pageSize="tableObject.pageSize" v-model:sort="tableObject.sort">
v-model:currentPage="tableObject.currentPage" <template #code="{ row }">
v-model:sort="tableObject.sort"
>
<template #code="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> <el-button type="primary" link @click="openDetail(row, '代码', row.code)">
<span>{{ row.code }}</span> <span>{{ row.code }}</span>
</el-button> </el-button>
</template> </template>
<template #action="{ row }"> <template #action="{ row }">
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" /> <ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event, row)" />
</template> </template>
</Table> </Table>
</ContentWrap> </ContentWrap>
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<BasicForm <BasicForm ref="basicFormRef" @success="formsSuccess" :rules="DeviceMaintenanceMainRules"
ref="basicFormRef" :formAllSchemas="DeviceMaintenanceMain.allSchemas" :apiUpdate="DeviceMaintenanceMainApi.updateDeviceMaintenanceMain"
@success="formsSuccess" :apiCreate="DeviceMaintenanceMainApi.createDeviceMaintenanceMain" @searchTableSuccess="searchTableSuccess"
:rules="DeviceMaintenanceMainRules" :isBusiness="false" @onChange="onChange" />
:formAllSchemas="DeviceMaintenanceMain.allSchemas"
:apiUpdate="DeviceMaintenanceMainApi.updateDeviceMaintenanceMain"
:apiCreate="DeviceMaintenanceMainApi.createDeviceMaintenanceMain"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
@onChange="onChange"
/>
<!-- 详情 --> <!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="DeviceMaintenanceMain.allSchemas" /> <Detail ref="detailRef" :isBasic="true" :allSchemas="DeviceMaintenanceMain.allSchemas" />
<!-- 导入 --> <!-- 导入 -->
<ImportForm ref="importFormRef" url="/eam/device-maintenance-main/import" :importTemplateData="importTemplateData" @success="importSuccess" /> <ImportForm ref="importFormRef" url="/eam/device-maintenance-main/import" :importTemplateData="importTemplateData"
@success="importSuccess" />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import download from '@/utils/download' import download from '@/utils/download'
import { DeviceMaintenanceMain,DeviceMaintenanceMainRules } from './deviceMaintenanceMain.data' import { DeviceMaintenanceMain, DeviceMaintenanceMainRules } from './deviceMaintenanceMain.data'
import * as DeviceMaintenanceMainApi from '@/api/eam/device/deviceMaintenanceMain' import * as DeviceMaintenanceMainApi from '@/api/eam/device/deviceMaintenanceMain'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
@ -146,19 +128,19 @@ const butttondata = (row) => {
defaultButtons.mainListEditBtn(null), // defaultButtons.mainListEditBtn(null), //
// defaultButtons.mainListDeleteBtn(null), // // defaultButtons.mainListDeleteBtn(null), //
// defaultButtons.backoutBtn(null), // // defaultButtons.backoutBtn(null), //
defaultButtons.acceptOrderBtn({ hide: !(row.status == 'PENDING' && userStore?.userSelfInfo?.posts?.some((item) => item.code == 'worker'))}), // defaultButtons.mainListDetailBtn(null), //
defaultButtons.acceptOrderBtn({ hide: !(row.status == 'PENDING' && userStore?.userSelfInfo?.posts?.some((item) => item.code == 'worker')) }), //
defaultButtons.turnOrderBtn({ hide: !(row.status == 'PECEIVED' && row.maintenance == userStore.getUser.id) }), // defaultButtons.turnOrderBtn({ hide: !(row.status == 'PECEIVED' && row.maintenance == userStore.getUser.id) }), //
defaultButtons.finishOrderBtn({ hide: !(row.status == 'PECEIVED' && row.maintenance == userStore.getUser.id)}), //
defaultButtons.verifyOrderBtn({ hide: !(row.status == 'COMPLETED' && userStore?.userSelfInfo?.posts?.some((item) => item.code == 'engineer')) }), //
defaultButtons.repairBtn({ hide: !(row.status == 'PECEIVED' && row.maintenance == userStore.getUser.id) }), // defaultButtons.repairBtn({ hide: !(row.status == 'PECEIVED' && row.maintenance == userStore.getUser.id) }), //
defaultButtons.mainListDetailBtn(null), // defaultButtons.verifyOrderBtn({ hide: !(row.status == 'COMPLETED' && userStore?.userSelfInfo?.posts?.some((item) => item.code == 'engineer')) }), //
defaultButtons.finishOrderBtn({ hide: !(row.status == 'PECEIVED' && row.maintenance == userStore.getUser.id) }), //
] ]
} }
const onChange = (field, cur, item) => { const onChange = (field, cur, item) => {
// //
console.log(field) console.log(field)
console.log(cur) console.log(cur)
if(field == 'deviceNumber'){ if (field == 'deviceNumber') {
DeviceMaintenanceMain.allSchemas.formSchema[1].componentProps.disabled = true; DeviceMaintenanceMain.allSchemas.formSchema[1].componentProps.disabled = true;
DeviceMaintenanceMain.allSchemas.formSchema[2].componentProps.disabled = true; DeviceMaintenanceMain.allSchemas.formSchema[2].componentProps.disabled = true;
basicFormRef.value.formRef.formModel.factoryAreaNumber = Number(item.componentProps.options.find(item => item.number == cur).factoryAreaNumber) basicFormRef.value.formRef.formModel.factoryAreaNumber = Number(item.componentProps.options.find(item => item.number == cur).factoryAreaNumber)
@ -179,7 +161,6 @@ const buttonTableClick = async (val, row) => {
DeviceMaintenanceMain.allSchemas.formSchema[2].componentProps.disabled = false; DeviceMaintenanceMain.allSchemas.formSchema[2].componentProps.disabled = false;
DeviceMaintenanceMain.allSchemas.formSchema[1].componentProps.disabled = true; DeviceMaintenanceMain.allSchemas.formSchema[1].componentProps.disabled = true;
DeviceMaintenanceMain.allSchemas.formSchema[0].componentProps.disabled = true; DeviceMaintenanceMain.allSchemas.formSchema[0].componentProps.disabled = true;
debugger
openForm('turnOrder', row) openForm('turnOrder', row)
} }
} }
@ -191,18 +172,18 @@ const openForm = (type: string, row?: any) => {
} }
// form // form
const formsSuccess = async (formType,data) => { const formsSuccess = async (formType, data) => {
var isHave =DeviceMaintenanceMain.allSchemas.formSchema.some(function (item) { var isHave = DeviceMaintenanceMain.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime'; return item.field === 'activeTime' || item.field === 'expireTime';
}); });
if(isHave){ if (isHave) {
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){ if (data.activeTime && data.expireTime && data.activeTime >= data.expireTime) {
message.error('失效时间要大于生效时间') message.error('失效时间要大于生效时间')
return; return;
} }
} }
if(data.activeTime==0)data.activeTime = null; if (data.activeTime == 0) data.activeTime = null;
if(data.expireTime==0)data.expireTime = null; if (data.expireTime == 0) data.expireTime = null;
if (formType === 'create') { if (formType === 'create') {
data.status = 'PECEIVED' data.status = 'PECEIVED'
@ -235,7 +216,7 @@ const handleDelete = async (id: number) => {
message.success(t('common.delSuccess')) message.success(t('common.delSuccess'))
// //
await getList() await getList()
} catch {} } catch { }
} }
/** 导出按钮操作 */ /** 导出按钮操作 */

29
src/views/eam/device/deviceRepair/deviceRepair.data.ts

@ -24,6 +24,9 @@ export const DeviceRepair = useCrudSchemas(reactive<CrudSchema[]>([
label: 'id', label: 'id',
field: 'id', field: 'id',
sort: 'custom', sort: 'custom',
table: {
width: '150',
},
isSearch: false, isSearch: false,
isForm: false, isForm: false,
isTable: false isTable: false
@ -32,6 +35,9 @@ export const DeviceRepair = useCrudSchemas(reactive<CrudSchema[]>([
label: '报修工单编号', label: '报修工单编号',
field: 'number', field: 'number',
sort: 'custom', sort: 'custom',
table: {
width: '150',
},
isSearch: true, isSearch: true,
isForm: false isForm: false
}, },
@ -39,6 +45,9 @@ export const DeviceRepair = useCrudSchemas(reactive<CrudSchema[]>([
label: '厂区', label: '厂区',
field: 'factoryAreaNumber', field: 'factoryAreaNumber',
sort: 'custom', sort: 'custom',
table: {
width: '150',
},
api: () => factoryList, api: () => factoryList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => { formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return factoryList.find((account) => account.id == cellValue)?.name return factoryList.find((account) => account.id == cellValue)?.name
@ -79,11 +88,14 @@ export const DeviceRepair = useCrudSchemas(reactive<CrudSchema[]>([
label: '设备', label: '设备',
field: 'deviceNumber', field: 'deviceNumber',
sort: 'custom', sort: 'custom',
table: {
width: '150',
},
isSearch: true, isSearch: true,
form: { form: {
component: 'Select', component: 'Select',
componentProps: { componentProps: {
options:deviceList, options: deviceList,
optionsAlias: { optionsAlias: {
labelField: 'name', labelField: 'name',
valueField: 'number' valueField: 'number'
@ -95,11 +107,17 @@ export const DeviceRepair = useCrudSchemas(reactive<CrudSchema[]>([
label: '报修人电话', label: '报修人电话',
field: 'declarerPhone', field: 'declarerPhone',
sort: 'custom', sort: 'custom',
table: {
width: '150',
},
}, },
{ {
label: '故障类型', label: '故障类型',
field: 'faultType', field: 'faultType',
sort: 'custom', sort: 'custom',
table: {
width: '150',
},
dictType: DICT_TYPE.FAULT_TYPE, dictType: DICT_TYPE.FAULT_TYPE,
dictClass: 'string', dictClass: 'string',
form: { form: {
@ -110,6 +128,9 @@ export const DeviceRepair = useCrudSchemas(reactive<CrudSchema[]>([
label: '描述', label: '描述',
field: 'describe', field: 'describe',
sort: 'custom', sort: 'custom',
table: {
width: '150',
},
form: { form: {
component: 'Input', component: 'Input',
componentProps: { componentProps: {
@ -122,6 +143,9 @@ export const DeviceRepair = useCrudSchemas(reactive<CrudSchema[]>([
label: '是否可用', label: '是否可用',
field: 'available', field: 'available',
sort: 'custom', sort: 'custom',
table: {
width: '150',
},
dictType: DICT_TYPE.TRUE_FALSE, dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', dictClass: 'string',
form: { form: {
@ -137,6 +161,9 @@ export const DeviceRepair = useCrudSchemas(reactive<CrudSchema[]>([
label: '维修状态', label: '维修状态',
field: 'result', field: 'result',
sort: 'custom', sort: 'custom',
table: {
width: '150',
},
dictType: DICT_TYPE.WEI_XIU_ORDER_STATUS, dictType: DICT_TYPE.WEI_XIU_ORDER_STATUS,
dictClass: 'string', dictClass: 'string',
isSearch: true, isSearch: true,

57
src/views/eam/device/deviceRepair/index.vue

@ -5,61 +5,42 @@
</ContentWrap> </ContentWrap>
<!-- 列表头部 --> <!-- 列表头部 -->
<TableHead <TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" :routeName="routeName"
:HeadButttondata="HeadButttondata" @updataTableColumns="updataTableColumns" @searchFormClick="searchFormClick" :allSchemas="DeviceRepair.allSchemas" />
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="DeviceRepair.allSchemas"
/>
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
<Table <Table :columns="tableColumns" :data="tableObject.tableList" :loading="tableObject.loading" :pagination="{
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total total: tableObject.total
}" }" v-model:pageSize="tableObject.pageSize" v-model:currentPage="tableObject.currentPage"
v-model:pageSize="tableObject.pageSize" v-model:sort="tableObject.sort">
v-model:currentPage="tableObject.currentPage" <template #code="{ row }">
v-model:sort="tableObject.sort"
>
<template #code="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> <el-button type="primary" link @click="openDetail(row, '代码', row.code)">
<span>{{ row.code }}</span> <span>{{ row.code }}</span>
</el-button> </el-button>
</template> </template>
<template #action="{ row }"> <template #action="{ row }">
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" /> <ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event, row)" />
</template> </template>
</Table> </Table>
</ContentWrap> </ContentWrap>
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<BasicForm <BasicForm ref="basicFormRef" @success="formsSuccess" :rules="DeviceRepairRules"
ref="basicFormRef" :formAllSchemas="DeviceRepair.allSchemas" :apiUpdate="DeviceRepairApi.updateDeviceRepair"
@success="formsSuccess" :apiCreate="DeviceRepairApi.createDeviceRepair" @searchTableSuccess="searchTableSuccess" :isBusiness="false" />
:rules="DeviceRepairRules"
:formAllSchemas="DeviceRepair.allSchemas"
:apiUpdate="DeviceRepairApi.updateDeviceRepair"
:apiCreate="DeviceRepairApi.createDeviceRepair"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<!-- 详情 --> <!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="DeviceRepair.allSchemas" /> <Detail ref="detailRef" :isBasic="true" :allSchemas="DeviceRepair.allSchemas" />
<!-- 导入 --> <!-- 导入 -->
<ImportForm ref="importFormRef" url="/eam/device-repair/import" :importTemplateData="importTemplateData" @success="importSuccess" /> <ImportForm ref="importFormRef" url="/eam/device-repair/import" :importTemplateData="importTemplateData"
@success="importSuccess" />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import download from '@/utils/download' import download from '@/utils/download'
import { DeviceRepair,DeviceRepairRules } from './deviceRepair.data' import { DeviceRepair, DeviceRepairRules } from './deviceRepair.data'
import * as DeviceRepairApi from '@/api/eam/device/deviceRepair' import * as DeviceRepairApi from '@/api/eam/device/deviceRepair'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
import { selectAllFactoryArea } from '@/api/system/dept' import { selectAllFactoryArea } from '@/api/system/dept'
@ -164,17 +145,17 @@ const openForm = (type: string, row?: any) => {
} }
// form // form
const formsSuccess = async (formType,data) => { const formsSuccess = async (formType, data) => {
var isHave =DeviceRepair.allSchemas.formSchema.some(function (item) { var isHave = DeviceRepair.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime'; return item.field === 'activeTime' || item.field === 'expireTime';
}); });
if(isHave){ if (isHave) {
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){ if (data.activeTime && data.expireTime && data.activeTime >= data.expireTime) {
message.error('失效时间要大于生效时间') message.error('失效时间要大于生效时间')
return; return;
} }
} }
if(data.activeTime==0)data.activeTime = null; if (data.activeTime == 0) data.activeTime = null;
if (data.expireTime == 0) data.expireTime = null; if (data.expireTime == 0) data.expireTime = null;
data.type = 'DEVICE'; data.type = 'DEVICE';
data.result = 'PENDING'; data.result = 'PENDING';
@ -205,7 +186,7 @@ const handleDelete = async (id: number) => {
message.success(t('common.delSuccess')) message.success(t('common.delSuccess'))
// //
await getList() await getList()
} catch {} } catch { }
} }
/** 导出按钮操作 */ /** 导出按钮操作 */

Loading…
Cancel
Save