Browse Source

维修工单

master
ljlong_2630 1 year ago
parent
commit
82bfff3874
  1. 52
      src/utils/disposition/defaultButtons.ts
  2. 6
      src/views/eam/device/deviceAccounts/deviceAccounts.data.ts
  3. 121
      src/views/eam/device/deviceMaintenanceMain/deviceMaintenanceMain.data.ts
  4. 29
      src/views/eam/device/deviceMaintenanceMain/index.vue
  5. 1
      src/views/eam/device/deviceRepair/deviceRepair.data.ts

52
src/utils/disposition/defaultButtons.ts

@ -788,6 +788,58 @@ export function backoutBtn(option:any) {
})
}
// 主列表-接单
export function acceptOrderBtn(option:any) {
return __defaultBtnOption(option,{
label: '接单',
name: 'acceptorder',
hide: false,
type: 'primary',
color: '',
link: true, // 文本展现按钮
hasPermi: ''
})
}
// 主列表-转办
export function turnOrderBtn(option:any) {
return __defaultBtnOption(option,{
label: '转办',
name: 'turnorder',
hide: false,
type: 'warning',
color: '',
link: true, // 文本展现按钮
hasPermi: ''
})
}
// 主列表-完成
export function finishOrderBtn(option:any) {
return __defaultBtnOption(option,{
label: '完成',
name: 'finishorder',
hide: false,
type: 'success',
color: '',
link: true, // 文本展现按钮
hasPermi: ''
})
}
// 主列表-验证
export function verifyOrderBtn(option:any) {
return __defaultBtnOption(option,{
label: '验证',
name: 'verifyorder',
hide: false,
type: 'primary',
color: '',
link: true, // 文本展现按钮
hasPermi: ''
})
}
// 默认按钮规则
function __defaultBtnOption(option:any,specific:any){
return {

6
src/views/eam/device/deviceAccounts/deviceAccounts.data.ts

@ -61,8 +61,11 @@ export const DeviceAccounts = useCrudSchemas(reactive<CrudSchema[]>([
},
{
label: '采购部门',
field: 'deptId',
field: 'purchaseDept',
sort: 'custom',
isSearch: false,
isForm: true,
isTable: true,
form: {
component: 'Input',
}
@ -121,6 +124,7 @@ export const DeviceAccounts = useCrudSchemas(reactive<CrudSchema[]>([
dictType: DICT_TYPE.BASIC_STATUS,
dictClass: 'string',
isSearch: true,
isForm: false,
},
{

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

@ -1,5 +1,11 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { selectAllFactoryArea } from '@/api/system/dept'
import * as DeviceAccountsApi from '@/api/eam/device/deviceAccounts'
import { dateFormatter } from '@/utils/formatTime'
const factoryList = await selectAllFactoryArea()
const deviceList = await DeviceAccountsApi.getDeviceAccountsNoPage({})
const showFactory = ref(false);
const factoryValue = ref<number | null>(null);
// 表单校验
export const DeviceMaintenanceMainRules = reactive({
@ -20,34 +26,91 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'number',
sort: 'custom',
isSearch: true,
isForm: false,
},
{
label: '报修工单申请号',
field: 'requestNumber',
sort: 'custom',
isForm: false,
isSearch: true,
isTable: true,
},
{
label: '描述',
field: 'describe',
sort: 'custom',
},
{
label: '设备模具编号',
field: 'deviceNumber',
sort: 'custom',
api: () => deviceList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return factoryList.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'
},
onChange: (val) => {
factoryValue.value = Number(deviceList.find((account) => account.number == val)?.factoryAreaNumber)
showFactory.value = true
console.log('factoryValue.value',factoryValue.value)
console.log('showFactory.value',showFactory.value)
}
},
}
},
{
label: '厂区编号',
field: 'factoryAreaNumber',
sort: 'custom',
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: {
component: 'Select',
show: showFactory.value,
value: factoryValue.value,
api: () => factoryList,
componentProps: {
optionsAlias: {
labelField: 'name',
valueField: 'id'
},
},
}
},
{
label: '维修人',
field: 'maintenance',
sort: 'custom',
form: {
component: 'InputNumber',
value: 0
component: 'Input',
},
},
{
@ -60,8 +123,11 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'status',
sort: 'custom',
isSearch: true,
isForm: false,
dictType: DICT_TYPE.WEI_XIU_ORDER_STATUS,
dictClass: 'string',
form: {
component: 'Radio'
component: 'Select'
},
},
{
@ -69,34 +135,41 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'type',
sort: 'custom',
isSearch: true,
dictType: DICT_TYPE.DEVICE_MOLD_TYPE,
dictClass: 'string',
form: {
component: 'Select'
},
},
{
label: '创建时间',
field: 'createTime',
label: '描述',
field: 'describe',
sort: 'custom',
formatter: dateFormatter,
isForm: false,
form: {
component: 'Input',
componentProps: {
type: 'textarea',
}
},
{
label: '地点ID',
field: 'siteId',
sort: 'custom',
},
// {
// label: '地点ID',
// field: 'siteId',
// sort: 'custom',
// },
{
label: '是否可用',
field: 'available',
sort: 'custom',
},
{
label: '并发乐观锁',
field: 'concurrencyStamp',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
form: {
component: 'InputNumber',
value: 0
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
},
{
@ -104,7 +177,7 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'action',
isForm: false,
table: {
width: 150,
width: 300,
fixed: 'right'
}
}

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

@ -33,7 +33,7 @@
</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>
@ -62,12 +62,13 @@ import download from '@/utils/download'
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'
// import TableHead from '@/components/TableHead/src/TableHead.vue'
// import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
// import Detail from '@/components/Detail/src/Detail.vue'
defineOptions({ name: 'DeviceMaintenanceMain' })
const userStore = useUserStore()
const message = useMessage() //
const { t } = useI18n() //
@ -99,9 +100,10 @@ const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'eam:deviceMaintenanceMain:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'eam:deviceMaintenanceMain:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'eam:deviceMaintenanceMain:export'}), //
// defaultButtons.defaultAddBtn({hasPermi:'eam:deviceMaintenanceMain:create'}), //
// defaultButtons.defaultImportBtn({hasPermi:'eam:deviceMaintenanceMain:import'}), //
// defaultButtons.defaultExportBtn({ hasPermi: 'eam:deviceMaintenanceMain:export' }), //
defaultButtons.defaultAddBtn(null), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
@ -132,10 +134,19 @@ const buttonBaseClick = (val, item) => {
}
// -
const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'eam:deviceMaintenanceMain:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'eam:deviceMaintenanceMain:delete'}), //
]
const butttondata = (row) => {
return [
// defaultButtons.mainListEditBtn({hasPermi:'eam:deviceMaintenanceMain:update'}), //
// defaultButtons.mainListDeleteBtn({hasPermi:'eam:deviceMaintenanceMain:delete'}), //
defaultButtons.mainListEditBtn(null), //
// defaultButtons.mainListDeleteBtn(null), //
// defaultButtons.backoutBtn(null), //
defaultButtons.acceptOrderBtn({ hide: !(row.status == 'PENDING') }), //
defaultButtons.turnOrderBtn({ hide: !(row.status == 'PECEIVED') }), //
defaultButtons.finishOrderBtn({ hide: !(row.status == 'PECEIVED' && row.maintenance == userStore.getUser.id)}), //
defaultButtons.verifyOrderBtn({ hide: !(row.status == 'COMPLETED')}), //
]
}
// -
const buttonTableClick = async (val, row) => {

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

@ -39,7 +39,6 @@ export const DeviceRepair = useCrudSchemas(reactive<CrudSchema[]>([
label: '厂区',
field: 'factoryAreaNumber',
sort: 'custom',
api: () => factoryList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return factoryList.find((account) => account.id == cellValue)?.name

Loading…
Cancel
Save