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', // 班组类型
INVENTORY_ACTION = 'inventory_action', //库存动作
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,{
label: '完成',
name: 'finishOrder',
label: '维修',
name: 'repair',
hide: false,
type: 'success',
type: 'primary',
color: '',
link: true, // 文本展现按钮
hasPermi: ''
@ -840,11 +840,11 @@ export function verifyOrderBtn(option:any) {
})
}
//主列表-维
export function repairBtn(option:any) {
// 主列表-检
export function maintenanceOrderBtn(option:any) {
return __defaultBtnOption(option,{
label: '修',
name: 'repair',
label: '修',
name: 'maintenanceOrder',
hide: false,
type: 'primary',
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){
return {

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

@ -1,5 +1,12 @@
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({
@ -14,90 +21,187 @@ export const DeviceInspectionMainRules = reactive({
export const DeviceInspectionMain = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '编号唯一标识',
label: '检修编号',
field: 'number',
sort: 'custom',
table: {
width: '150',
},
isSearch: true,
isForm: false,
},
{
label: '维修工单号',
field: 'maintenanceNumber',
sort: 'custom',
isSearch: true,
table: {
width: '150',
},
},
{
label: '设备模具',
label: '设备',
field: 'deviceNumber',
sort: 'custom',
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: '厂区编号',
field: 'factoryAreaNumber',
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'
}
}
},
{
label: '描述',
field: 'describe',
sort: 'custom',
form: {
component: 'Select',
api: () => factoryList,
componentProps: {
disabled: true,
optionsAlias: {
labelField: 'name',
valueField: 'id'
},
placeholder: "请先选择设备"
},
}
},
{
label: '维修人',
field: 'maintenance',
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: {
component: 'InputNumber',
value: 0
component: 'Select',
api: () => userList,
componentProps: {
disabled: true,
optionsAlias: {
labelField: 'name',
valueField: 'id'
},
placeholder: "请先选择设备"
},
}
},
{
label: '维修人联系电话',
field: 'maintenancePhone',
label: '描述',
field: 'describe',
sort: 'custom',
isSearch: false,
table: {
width: '230',
},
form: {
component: 'Input',
componentProps: {
type: 'textarea',
}
},
},
// {
// label: '维修人联系电话',
// field: 'maintenancePhone',
// sort: 'custom',
// },
{
label: '状态',
field: 'status',
sort: 'custom',
isSearch: true,
form: {
component: 'Radio'
},
table: {
width: '150',
},
{
label: '类型',
field: 'type',
sort: 'custom',
isSearch: true,
dictType: DICT_TYPE.JX_STATUS,
dictClass: 'string',
form: {
component: 'Select'
},
},
{
label: '创建时间',
field: 'createTime',
sort: 'custom',
formatter: dateFormatter,
isForm: false,
},
{
label: '地点ID',
field: 'siteId',
sort: 'custom',
},
{
label: '是否可用',
field: 'available',
label: '类型',
field: 'type',
sort: 'custom',
table: {
width: '150',
},
{
label: '并发乐观锁',
field: 'concurrencyStamp',
sort: 'custom',
isSearch: false,
dictType: DICT_TYPE.DEVICE_MOLD_TYPE,
dictClass: 'string',
form: {
component: 'InputNumber',
value: 0
component: 'Select'
},
},
// {
// label: '创建时间',
// field: 'createTime',
// sort: 'custom',
// formatter: dateFormatter,
// isForm: false,
// },
{
label: '操作',
field: 'action',

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

@ -5,63 +5,47 @@
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="DeviceInspectionMain.allSchemas"
/>
<TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" :routeName="routeName"
@updataTableColumns="updataTableColumns" @searchFormClick="searchFormClick"
:allSchemas="DeviceInspectionMain.allSchemas" />
<!-- 列表 -->
<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}">
}" 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>
</el-button>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" />
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event, row)" />
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
@success="formsSuccess"
:rules="DeviceInspectionMainRules"
:formAllSchemas="DeviceInspectionMain.allSchemas"
:apiUpdate="DeviceInspectionMainApi.updateDeviceInspectionMain"
:apiCreate="DeviceInspectionMainApi.createDeviceInspectionMain"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<BasicForm ref="basicFormRef" @success="formsSuccess" :rules="DeviceInspectionMainRules"
:formAllSchemas="DeviceInspectionMain.allSchemas" :apiUpdate="DeviceInspectionMainApi.updateDeviceInspectionMain"
:apiCreate="DeviceInspectionMainApi.createDeviceInspectionMain" @searchTableSuccess="searchTableSuccess"
:isBusiness="false" />
<!-- 详情 -->
<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>
<script setup lang="ts">
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 defaultButtons from '@/utils/disposition/defaultButtons'
import { useUserStore } from '@/store/modules/user'
// import TableHead from '@/components/TableHead/src/TableHead.vue'
// import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
// import Detail from '@/components/Detail/src/Detail.vue'
@ -70,7 +54,7 @@ defineOptions({ name: 'DeviceInspectionMain' })
const message = useMessage() //
const { t } = useI18n() //
const userStore = useUserStore() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
@ -99,12 +83,14 @@ const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'eam:deviceInspectionMain:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'eam:deviceInspectionMain:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'eam:deviceInspectionMain:export'}), //
// defaultButtons.defaultAddBtn({hasPermi:'eam:deviceInspectionMain:create'}), //
// defaultButtons.defaultImportBtn({hasPermi:'eam:deviceInspectionMain:import'}), //
// 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.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
// {
// label: '',
// name: 'zdy',
@ -132,17 +118,24 @@ const buttonBaseClick = (val, item) => {
}
// -
const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'eam:deviceInspectionMain:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'eam:deviceInspectionMain:delete'}), //
]
const butttondata = (row) => {
return [
// 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) => {
if (val == 'edit') { //
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
} else if (val == 'maintenanceOrder') { //
handleMaintenanceOrder(row)
} else if (val == 'finishOrder') { //
handleFinishOrder(row)
}
}
@ -153,18 +146,18 @@ const openForm = (type: string, row?: any) => {
}
// form
const formsSuccess = async (formType,data) => {
var isHave =DeviceInspectionMain.allSchemas.formSchema.some(function (item) {
const formsSuccess = async (formType, data) => {
var isHave = DeviceInspectionMain.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime';
});
if(isHave){
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){
if (isHave) {
if (data.activeTime && data.expireTime && data.activeTime >= data.expireTime) {
message.error('失效时间要大于生效时间')
return;
}
}
if(data.activeTime==0)data.activeTime = null;
if(data.expireTime==0)data.expireTime = null;
if (data.activeTime == 0) data.activeTime = null;
if (data.expireTime == 0) data.expireTime = null;
if (formType === 'create') {
await DeviceInspectionMainApi.createDeviceInspectionMain(data)
message.success(t('common.createSuccess'))
@ -192,7 +185,7 @@ const handleDelete = async (id: number) => {
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
} catch { }
}
/** 导出按钮操作 */
@ -235,6 +228,14 @@ const searchFormClick = (searchData) => {
getList() //
}
function handleMaintenanceOrder(row) {
}
function handleFinishOrder(row) {
}
/** 初始化 **/
onMounted(async () => {
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 * as DeviceAccountsApi from '@/api/eam/device/deviceAccounts'
import { useUserStore } from '@/store/modules/user'
import {selecUserByType} from '@/api/system/dept'
import { selecUserByType } from '@/api/system/dept'
const userStore = useUserStore()
const factoryList = await selectAllFactoryArea()
const deviceList = await DeviceAccountsApi.getDeviceAccountsNoPage({})
@ -25,6 +25,9 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '维修工单编号',
field: 'number',
sort: 'custom',
table: {
width: '150',
},
isSearch: true,
isForm: false,
},
@ -32,6 +35,9 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '报修工单编号',
field: 'requestNumber',
sort: 'custom',
table: {
width: '150',
},
isForm: false,
isSearch: true,
isTable: true,
@ -41,9 +47,12 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '设备模具编号',
field: 'deviceNumber',
sort: 'custom',
table: {
width: '150',
},
api: () => deviceList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return factoryList.find((account) => account.number == cellValue)?.name
return deviceList.find((account) => account.number == cellValue)?.name
},
search: {
show: true,
@ -71,6 +80,9 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '厂区编号',
field: 'factoryAreaNumber',
sort: 'custom',
table: {
width: '150',
},
api: () => factoryList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return factoryList.find((account) => account.id == cellValue)?.name
@ -90,7 +102,7 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
component: 'Select',
api: () => factoryList,
componentProps: {
disabled:true,
disabled: true,
optionsAlias: {
labelField: 'name',
valueField: 'id'
@ -103,9 +115,12 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '维修人',
field: 'maintenance',
sort: 'custom',
table: {
width: '150',
},
api: () => userList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return factoryList.find((account) => account.id == cellValue)?.name
return userList.find((account) => account.id == cellValue)?.name
},
search: {
show: true,
@ -122,7 +137,7 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
component: 'Select',
api: () => userList,
componentProps: {
disabled:true,
disabled: true,
optionsAlias: {
labelField: 'name',
valueField: 'id'
@ -140,6 +155,9 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '状态',
field: 'status',
sort: 'custom',
table: {
width: '150',
},
isSearch: true,
isForm: false,
dictType: DICT_TYPE.WEI_XIU_ORDER_STATUS,
@ -152,6 +170,9 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '类型设备',
field: 'type',
sort: 'custom',
table: {
width: '150',
},
isSearch: true,
isForm: true,
dictType: DICT_TYPE.DEVICE_MOLD_TYPE,
@ -167,11 +188,12 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '描述',
field: 'describes',
sort: 'custom',
table: {
width: '150',
},
form: {
component: 'Input',
componentProps: {
type: 'textarea',
}
},
},
// {

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

@ -5,62 +5,44 @@
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="DeviceMaintenanceMain.allSchemas"
/>
<TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" :routeName="routeName"
@updataTableColumns="updataTableColumns" @searchFormClick="searchFormClick"
:allSchemas="DeviceMaintenanceMain.allSchemas" />
<!-- 列表 -->
<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}">
}" 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>
</el-button>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" />
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event, row)" />
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
@success="formsSuccess"
:rules="DeviceMaintenanceMainRules"
:formAllSchemas="DeviceMaintenanceMain.allSchemas"
:apiUpdate="DeviceMaintenanceMainApi.updateDeviceMaintenanceMain"
:apiCreate="DeviceMaintenanceMainApi.createDeviceMaintenanceMain"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
@onChange="onChange"
/>
<BasicForm ref="basicFormRef" @success="formsSuccess" :rules="DeviceMaintenanceMainRules"
:formAllSchemas="DeviceMaintenanceMain.allSchemas" :apiUpdate="DeviceMaintenanceMainApi.updateDeviceMaintenanceMain"
:apiCreate="DeviceMaintenanceMainApi.createDeviceMaintenanceMain" @searchTableSuccess="searchTableSuccess"
:isBusiness="false" @onChange="onChange" />
<!-- 详情 -->
<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>
<script setup lang="ts">
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 defaultButtons from '@/utils/disposition/defaultButtons'
import { useUserStore } from '@/store/modules/user'
@ -146,19 +128,19 @@ const butttondata = (row) => {
defaultButtons.mainListEditBtn(null), //
// defaultButtons.mainListDeleteBtn(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.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.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) => {
//
console.log(field)
console.log(cur)
if(field == 'deviceNumber'){
if (field == 'deviceNumber') {
DeviceMaintenanceMain.allSchemas.formSchema[1].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)
@ -179,7 +161,6 @@ const buttonTableClick = async (val, row) => {
DeviceMaintenanceMain.allSchemas.formSchema[2].componentProps.disabled = false;
DeviceMaintenanceMain.allSchemas.formSchema[1].componentProps.disabled = true;
DeviceMaintenanceMain.allSchemas.formSchema[0].componentProps.disabled = true;
debugger
openForm('turnOrder', row)
}
}
@ -191,18 +172,18 @@ const openForm = (type: string, row?: any) => {
}
// form
const formsSuccess = async (formType,data) => {
var isHave =DeviceMaintenanceMain.allSchemas.formSchema.some(function (item) {
const formsSuccess = async (formType, data) => {
var isHave = DeviceMaintenanceMain.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime';
});
if(isHave){
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){
if (isHave) {
if (data.activeTime && data.expireTime && data.activeTime >= data.expireTime) {
message.error('失效时间要大于生效时间')
return;
}
}
if(data.activeTime==0)data.activeTime = null;
if(data.expireTime==0)data.expireTime = null;
if (data.activeTime == 0) data.activeTime = null;
if (data.expireTime == 0) data.expireTime = null;
if (formType === 'create') {
data.status = 'PECEIVED'
@ -235,7 +216,7 @@ const handleDelete = async (id: number) => {
message.success(t('common.delSuccess'))
//
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',
field: 'id',
sort: 'custom',
table: {
width: '150',
},
isSearch: false,
isForm: false,
isTable: false
@ -32,6 +35,9 @@ export const DeviceRepair = useCrudSchemas(reactive<CrudSchema[]>([
label: '报修工单编号',
field: 'number',
sort: 'custom',
table: {
width: '150',
},
isSearch: true,
isForm: false
},
@ -39,6 +45,9 @@ export const DeviceRepair = useCrudSchemas(reactive<CrudSchema[]>([
label: '厂区',
field: 'factoryAreaNumber',
sort: 'custom',
table: {
width: '150',
},
api: () => factoryList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return factoryList.find((account) => account.id == cellValue)?.name
@ -79,11 +88,14 @@ export const DeviceRepair = useCrudSchemas(reactive<CrudSchema[]>([
label: '设备',
field: 'deviceNumber',
sort: 'custom',
table: {
width: '150',
},
isSearch: true,
form: {
component: 'Select',
componentProps: {
options:deviceList,
options: deviceList,
optionsAlias: {
labelField: 'name',
valueField: 'number'
@ -95,11 +107,17 @@ export const DeviceRepair = useCrudSchemas(reactive<CrudSchema[]>([
label: '报修人电话',
field: 'declarerPhone',
sort: 'custom',
table: {
width: '150',
},
},
{
label: '故障类型',
field: 'faultType',
sort: 'custom',
table: {
width: '150',
},
dictType: DICT_TYPE.FAULT_TYPE,
dictClass: 'string',
form: {
@ -110,6 +128,9 @@ export const DeviceRepair = useCrudSchemas(reactive<CrudSchema[]>([
label: '描述',
field: 'describe',
sort: 'custom',
table: {
width: '150',
},
form: {
component: 'Input',
componentProps: {
@ -122,6 +143,9 @@ export const DeviceRepair = useCrudSchemas(reactive<CrudSchema[]>([
label: '是否可用',
field: 'available',
sort: 'custom',
table: {
width: '150',
},
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
form: {
@ -137,6 +161,9 @@ export const DeviceRepair = useCrudSchemas(reactive<CrudSchema[]>([
label: '维修状态',
field: 'result',
sort: 'custom',
table: {
width: '150',
},
dictType: DICT_TYPE.WEI_XIU_ORDER_STATUS,
dictClass: 'string',
isSearch: true,

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

@ -5,61 +5,42 @@
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="DeviceRepair.allSchemas"
/>
<TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" :routeName="routeName"
@updataTableColumns="updataTableColumns" @searchFormClick="searchFormClick" :allSchemas="DeviceRepair.allSchemas" />
<!-- 列表 -->
<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}">
}" 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>
</el-button>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" />
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event, row)" />
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
@success="formsSuccess"
:rules="DeviceRepairRules"
:formAllSchemas="DeviceRepair.allSchemas"
:apiUpdate="DeviceRepairApi.updateDeviceRepair"
:apiCreate="DeviceRepairApi.createDeviceRepair"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<BasicForm ref="basicFormRef" @success="formsSuccess" :rules="DeviceRepairRules"
:formAllSchemas="DeviceRepair.allSchemas" :apiUpdate="DeviceRepairApi.updateDeviceRepair"
:apiCreate="DeviceRepairApi.createDeviceRepair" @searchTableSuccess="searchTableSuccess" :isBusiness="false" />
<!-- 详情 -->
<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>
<script setup lang="ts">
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 defaultButtons from '@/utils/disposition/defaultButtons'
import { selectAllFactoryArea } from '@/api/system/dept'
@ -164,17 +145,17 @@ const openForm = (type: string, row?: any) => {
}
// form
const formsSuccess = async (formType,data) => {
var isHave =DeviceRepair.allSchemas.formSchema.some(function (item) {
const formsSuccess = async (formType, data) => {
var isHave = DeviceRepair.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime';
});
if(isHave){
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){
if (isHave) {
if (data.activeTime && data.expireTime && data.activeTime >= data.expireTime) {
message.error('失效时间要大于生效时间')
return;
}
}
if(data.activeTime==0)data.activeTime = null;
if (data.activeTime == 0) data.activeTime = null;
if (data.expireTime == 0) data.expireTime = null;
data.type = 'DEVICE';
data.result = 'PENDING';
@ -205,7 +186,7 @@ const handleDelete = async (id: number) => {
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
} catch { }
}
/** 导出按钮操作 */

Loading…
Cancel
Save