Browse Source

web端报修申请

master
ljlong_2630 10 months ago
parent
commit
222dbdb209
  1. 5
      src/api/eam/basic/rel/index.ts
  2. 6
      src/api/eam/device/deviceAccounts/index.ts
  3. 6
      src/api/eam/device/deviceRepair/index.ts
  4. 6
      src/api/system/dept/index.ts
  5. 6
      src/utils/dict.ts
  6. 14
      src/utils/disposition/defaultButtons.ts
  7. 22
      src/views/eam/basic/fixedAssets/fixedAssets.data.ts
  8. 17
      src/views/eam/basic/fixedAssets/index.vue
  9. 15
      src/views/eam/device/deviceAccounts/deviceAccounts.data.ts
  10. 66
      src/views/eam/device/deviceAccounts/index.vue
  11. 127
      src/views/eam/device/deviceRepair/deviceRepair.data.ts
  12. 44
      src/views/eam/device/deviceRepair/index.vue

5
src/api/eam/basic/rel/index.ts

@ -44,3 +44,8 @@ export const exportDeviceItem = async (params) => {
return await request.download({ url: `/rel/device-item/export-excel`, params }) return await request.download({ url: `/rel/device-item/export-excel`, params })
} }
// 新增设备备件关系
// 新增设备备件关系
export const createDeviceItemBatch = async (data: Array<DeviceItemVO>) => {
return await request.post({url: `/rel/device-item/createBatch`, data });
};

6
src/api/eam/device/deviceAccounts/index.ts

@ -57,3 +57,9 @@ export const exportDeviceAccounts = async (params) => {
export const importTemplate = () => { export const importTemplate = () => {
return request.download({ url: '/eam/device-accounts/get-import-template' }) return request.download({ url: '/eam/device-accounts/get-import-template' })
} }
// 查询设备台账列表
export const getDeviceAccountsNoPage = async (params) => {
return await request.get({ url: `/eam/device-accounts/selectData`, params })
}

6
src/api/eam/device/deviceRepair/index.ts

@ -1,6 +1,7 @@
import request from '@/config/axios' import request from '@/config/axios'
export interface DeviceRepairVO { export interface DeviceRepairVO {
id: number
number: string number: string
describe: string describe: string
deviceNumber: string deviceNumber: string
@ -54,3 +55,8 @@ export const exportDeviceRepair = async (params) => {
export const importTemplate = () => { export const importTemplate = () => {
return request.download({ url: '/eam/device-repair/get-import-template' }) return request.download({ url: '/eam/device-repair/get-import-template' })
} }
// 撤销申请
export const rejected = (id: Number) => {
return request.delete({ url: '/eam/device-repair/rejected?id=' + id })
}

6
src/api/system/dept/index.ts

@ -41,3 +41,9 @@ export const updateDept = async (params: DeptVO) => {
export const deleteDept = async (id: number) => { export const deleteDept = async (id: number) => {
return await request.delete({ url: '/system/dept/delete?id=' + id }) return await request.delete({ url: '/system/dept/delete?id=' + id })
} }
// 查询厂区列表
export const selectAllFactoryArea = async () => {
return await request.get({ url: '/system/dept/selectAllFactoryArea'})
}

6
src/utils/dict.ts

@ -276,8 +276,10 @@ export enum DICT_TYPE {
DEVICEMOLDITEMS_STATUS = 'devicemolditems_status', // 项类型 DEVICEMOLDITEMS_STATUS = 'devicemolditems_status', // 项类型
DEVICE_MOLD_TYPE = 'device_mold_type', // 设备/模具类型 DEVICE_MOLD_TYPE = 'device_mold_type', // 设备/模具类型
TRANSACTION_TYPE = 'transaction_Type', // 事务类型 TRANSACTION_TYPE = 'transaction_Type', // 事务类型
RESULT = 'result', // 事务类型 RESULT = 'result', // 维修结果
REQUEST_APPLY = 'class_type', // 班组类型 REQUEST_APPLY = 'class_type', // 班组类型
FAULT_TYPE = 'fault_type',//故障类型
WEI_XIU_ORDER_STATUS = 'wei_xiu_order_status',//维修单状态
BASIC_STATUS = 'basic_status',//设备模具状态
} }

14
src/utils/disposition/defaultButtons.ts

@ -774,6 +774,20 @@ export function selectItemBtn(option:any) {
hasPermi: '' hasPermi: ''
}) })
} }
// 主列表-撤销
export function backoutBtn(option:any) {
return __defaultBtnOption(option,{
label: '撤销',
name: 'backout',
hide: false,
type: 'danger',
color: '',
link: true, // 文本展现按钮
hasPermi: ''
})
}
// 默认按钮规则 // 默认按钮规则
function __defaultBtnOption(option:any,specific:any){ function __defaultBtnOption(option:any,specific:any){
return { return {

22
src/views/eam/basic/fixedAssets/fixedAssets.data.ts

@ -17,7 +17,7 @@ export const FixedAssets = useCrudSchemas(reactive<CrudSchema[]>([
label: '编号唯一标识', label: '编号唯一标识',
field: 'number', field: 'number',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: false,
}, },
{ {
label: '资产名称', label: '资产名称',
@ -29,7 +29,7 @@ export const FixedAssets = useCrudSchemas(reactive<CrudSchema[]>([
label: '会计单位', label: '会计单位',
field: 'accountingUnit', field: 'accountingUnit',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: false,
}, },
{ {
label: '规格型号', label: '规格型号',
@ -114,26 +114,16 @@ export const FixedAssets = useCrudSchemas(reactive<CrudSchema[]>([
}, },
isForm: false, isForm: false,
}, },
{
label: '地点ID',
field: 'siteId',
sort: 'custom',
},
{ {
label: '是否可用', label: '是否可用',
field: 'available', field: 'available',
sort: 'custom', sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: true, isSearch: true,
}, },
{
label: '并发乐观锁',
field: 'concurrencyStamp',
sort: 'custom',
form: {
component: 'InputNumber',
value: 0
},
},
{ {
label: '操作', label: '操作',
field: 'action', field: 'action',

17
src/views/eam/basic/fixedAssets/index.vue

@ -60,7 +60,7 @@
<script setup lang="ts"> <script setup lang="ts">
import download from '@/utils/download' import download from '@/utils/download'
import { FixedAssets,FixedAssetsRules } from './fixedAssets.data' import { FixedAssets,FixedAssetsRules } from './fixedAssets.data'
import * as FixedAssetsApi from '@/api/eam/fixedAssets' import * as FixedAssetsApi from '@/api/eam/basic/fixedAssets'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
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'
@ -99,9 +99,12 @@ const { getList, setSearchParams } = tableMethods
// //
const HeadButttondata = [ const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'eam:fixedAssets:create'}), // // defaultButtons.defaultAddBtn({hasPermi:'eam:fixedAssets:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'eam:fixedAssets:import'}), // // defaultButtons.defaultImportBtn({hasPermi:'eam:fixedAssets:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'eam:fixedAssets:export'}), // // defaultButtons.defaultExportBtn({ hasPermi: 'eam:fixedAssets:export' }), //
defaultButtons.defaultAddBtn(null), //
defaultButtons.defaultImportBtn(null), //
defaultButtons.defaultExportBtn(null), //
defaultButtons.defaultFreshBtn(null), // defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), // defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), // defaultButtons.defaultSetBtn(null), //
@ -133,8 +136,10 @@ const buttonBaseClick = (val, item) => {
// - // -
const butttondata = [ const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'eam:fixedAssets:update'}), // defaultButtons.mainListEditBtn(null), //
defaultButtons.mainListDeleteBtn({hasPermi:'eam:fixedAssets:delete'}), // defaultButtons.mainListDeleteBtn(null), //
// defaultButtons.mainListEditBtn({hasPermi:'eam:fixedAssets:update'}), //
// defaultButtons.mainListDeleteBtn({hasPermi:'eam:fixedAssets:delete'}), //
] ]
// - // -

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

@ -109,7 +109,18 @@ export const DeviceAccounts = useCrudSchemas(reactive<CrudSchema[]>([
{ {
label: '是否可用', label: '是否可用',
field: 'available', field: 'available',
sort: 'custom' sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
},
{
label: '维修状态',
field: 'status',
sort: 'custom',
dictType: DICT_TYPE.BASIC_STATUS,
dictClass: 'string',
isSearch: true,
}, },
{ {
@ -117,7 +128,7 @@ export const DeviceAccounts = useCrudSchemas(reactive<CrudSchema[]>([
field: 'action', field: 'action',
isForm: false, isForm: false,
table: { table: {
width: 150, width: 200,
fixed: 'right' fixed: 'right'
} }
} }

66
src/views/eam/device/deviceAccounts/index.vue

@ -52,9 +52,8 @@
<SearchTable <SearchTable
ref="searchTableRef" ref="searchTableRef"
:searchFormConfig="DeviceAccounts.searchFormConfig" @searchTableSuccess="submitItem"
:searchTableAction="DeviceAccounts.searchTableAction"
@success="searchTableSuccess"
/> />
<!-- 详情 --> <!-- 详情 -->
@ -67,12 +66,14 @@
<script setup lang="ts"> <script setup lang="ts">
import download from '@/utils/download' import download from '@/utils/download'
import { DeviceAccounts, DeviceAccountsRules } from './deviceAccounts.data' import { DeviceAccounts, DeviceAccountsRules } from './deviceAccounts.data'
import { getItemAccountsPage } from '@/api/eam/item/itemAccounts' import { Item } from '@/views/eam/basic/item/item.data'
import { createDeviceItemBatch,getDeviceItemPage } from '@/api/eam/basic/rel'
import * as DeviceAccountsApi from '@/api/eam/device/deviceAccounts' import * as DeviceAccountsApi from '@/api/eam/device/deviceAccounts'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
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'
import * as ItemApi from '@/api/eam/basic/item'
defineOptions({ name: 'DeviceAccounts' }) defineOptions({ name: 'DeviceAccounts' })
@ -81,7 +82,7 @@ const { t } = useI18n() // 国际化
const route = useRoute() // const route = useRoute() //
const routeName = ref() const routeName = ref()
const itemList = ref([]) const deviceNumber = ref();
routeName.value = route.name routeName.value = route.name
const tableColumns = ref(DeviceAccounts.allSchemas.tableColumns) const tableColumns = ref(DeviceAccounts.allSchemas.tableColumns)
@ -277,13 +278,62 @@ const openQrCode = async (number: String) => {
// } catch {} // } catch {}
} }
const searchTableRef = ref()
/** 绑定备件操作 */ /** 绑定备件操作 */
const openItem = async (number: String) => { const openItem = async (number: String) => {
let param = { deviceNumber.value = number;
number: number searchTableRef.value.open("选择备件",Item.allSchemas,getDeviceItemList,null,Item.allSchemas.searchSchema,true,null, null, null, null);
}
const submitItem = async (formFieldRef, searchFieldRef, selections, typeRef, rowRef) => {
const deviceItemRelList = selections.map(element => ({
deviceNumber: deviceNumber.value,
itemNumber: element.number,
}));
createDeviceItemBatch(deviceItemRelList).then(res => {
console.log('res', res);
})
console.log('deviceItemRelList', deviceItemRelList);
};
const getItemWithOutBind = async () => {
try {
const res = await ItemApi.getItemPage({
...Item.allSchemas.searchSchema
});
if (res.list?.length > 0) {
const response = await getDeviceItemPage(DeviceAccounts.allSchemas.searchSchema);
const filteredList = res.list.filter(item => {
return !response.list?.some(element => {
return item.number === element.itemNumber
});
});
console.log('filteredList',filteredList);
return filteredList; //
} }
itemList.value = getItemAccountsPage(param); // return []; //
} catch (error) {
console.error(error);
throw error; //
}
};
// getListApi getItemWithOutBind
const getDeviceItemList = async () => {
tableObject.loading = true;
try {
const res = await getItemWithOutBind();
let result = {
list : res,
total : res.length,
}
return result;
} catch (error) {
console.error(error);
} finally {
tableObject.loading = false;
} }
};
</script> </script>

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

@ -1,5 +1,10 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
import { selectAllFactoryArea } from '@/api/system/dept'
import * as DeviceAccountsApi from '@/api/eam/device/deviceAccounts'
// 邮箱账号的列表
const factoryList = await selectAllFactoryArea()
const deviceList = ref([]);
// 表单校验 // 表单校验
export const DeviceRepairRules = reactive({ export const DeviceRepairRules = reactive({
@ -11,86 +16,134 @@ export const DeviceRepairRules = reactive({
type: [required], type: [required],
available: [required], available: [required],
concurrencyStamp: [required], concurrencyStamp: [required],
// result: [required],
}) })
export const DeviceRepair = useCrudSchemas(reactive<CrudSchema[]>([ export const DeviceRepair = useCrudSchemas(reactive<CrudSchema[]>([
{ {
label: '编号唯一标识', label: 'id',
field: 'number', field: 'id',
sort: 'custom',
isSearch: true,
},
{
label: '描述',
field: 'describe',
sort: 'custom', sort: 'custom',
isSearch: false,
isForm: false,
isTable: false
}, },
{ {
label: '设备模具编号', label: '编号唯一标识',
field: 'deviceNumber', field: 'number',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
isForm: false
}, },
{ {
label: '厂区编号', label: '厂区',
field: 'factoryAreaNumber', field: 'factoryAreaNumber',
sort: 'custom', 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',
api: () => factoryList,
componentProps: {
optionsAlias: {
labelField: 'name',
valueField: 'id'
},
onChange: (e) => {
DeviceAccountsApi.getDeviceAccountsPage({
isSearch: false,
factoryAreaNumber: e
}).then((res) => {
deviceList.value = res?.list
}).catch((e) => {
console.log(e)
})
}
},
}
}, },
{ {
label: '报修人', label: '设备',
field: 'declarer', field: 'deviceNumber',
sort: 'custom', sort: 'custom',
isSearch: true,
form: { form: {
component: 'InputNumber', component: 'Select',
value: 0 componentProps: {
options:deviceList,
optionsAlias: {
labelField: 'name',
valueField: 'number'
},
}, },
}
}, },
{ {
label: '报修人联系电话', label: '报修人电话',
field: 'declarerPhone', field: 'declarerPhone',
sort: 'custom', sort: 'custom',
}, },
{ {
label: '故障类型枚举EM、CM、 PM', label: '故障类型',
field: 'faultType', field: 'faultType',
sort: 'custom', sort: 'custom',
dictType: DICT_TYPE.FAULT_TYPE,
dictClass: 'string',
form: { form: {
component: 'Select' component: 'Select'
}, },
}, },
{ {
label: '类型', label: '描述',
field: 'type', field: 'describe',
sort: 'custom', sort: 'custom',
isSearch: true,
form: { form: {
component: 'Select' component: 'Input',
}, componentProps: {
}, type: 'textarea',
{ }
label: '创建时间',
field: 'createTime',
sort: 'custom',
formatter: dateFormatter,
isForm: false,
}, },
{
label: '地点ID',
field: 'siteId',
sort: 'custom',
}, },
{ {
label: '是否可用', label: '是否可用',
field: 'available', field: 'available',
sort: 'custom', sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
}, },
{ {
label: '并发乐观锁', label: '维修状态',
field: 'concurrencyStamp', field: 'result',
sort: 'custom', sort: 'custom',
dictType: DICT_TYPE.WEI_XIU_ORDER_STATUS,
dictClass: 'string',
isSearch: true,
isForm: false,
form: { form: {
component: 'InputNumber', component: 'Select',
value: 0
}, },
}, },
{ {

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

@ -33,7 +33,7 @@
</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>
@ -62,6 +62,8 @@ 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 { getRowIdentity } from 'element-plus/es/components/table/src/util'
// 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'
@ -73,6 +75,7 @@ const { t } = useI18n() // 国际化
const route = useRoute() // const route = useRoute() //
const routeName = ref() const routeName = ref()
const factoryAreaList = ref([])
routeName.value = route.name routeName.value = route.name
const tableColumns = ref(DeviceRepair.allSchemas.tableColumns) const tableColumns = ref(DeviceRepair.allSchemas.tableColumns)
@ -99,9 +102,12 @@ const { getList, setSearchParams } = tableMethods
// //
const HeadButttondata = [ const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'eam:deviceRepair:create'}), // // defaultButtons.defaultAddBtn({hasPermi:'eam:deviceRepair:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'eam:deviceRepair:import'}), // // defaultButtons.defaultImportBtn({hasPermi:'eam:deviceRepair:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'eam:deviceRepair:export'}), // // defaultButtons.defaultExportBtn({ hasPermi: 'eam:deviceRepair:export' }), //
defaultButtons.defaultAddBtn(null), //
// defaultButtons.defaultImportBtn(null), //
// defaultButtons.defaultExportBtn(null), //
defaultButtons.defaultFreshBtn(null), // defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), // defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), // defaultButtons.defaultSetBtn(null), //
@ -132,10 +138,13 @@ const buttonBaseClick = (val, item) => {
} }
// - // -
const butttondata = [ const butttondata = (row) => {
defaultButtons.mainListEditBtn({hasPermi:'eam:deviceRepair:update'}), // return [
defaultButtons.mainListDeleteBtn({hasPermi:'eam:deviceRepair:delete'}), // // defaultButtons.mainListEditBtn({hasPermi:'eam:deviceRepair:update'}), //
// defaultButtons.mainListDeleteBtn({ hasPermi: 'eam:deviceRepair:delete' }), //
defaultButtons.backoutBtn({ hide: row.result != 'PENDING' }), //
] ]
}
// - // -
const buttonTableClick = async (val, row) => { const buttonTableClick = async (val, row) => {
@ -143,6 +152,8 @@ const buttonTableClick = async (val, row) => {
openForm('update', row) openForm('update', row)
} else if (val == 'delete') { // } else if (val == 'delete') { //
handleDelete(row.id) handleDelete(row.id)
} else if (val == 'backout') { //
handleBackout(row)
} }
} }
@ -165,6 +176,8 @@ const formsSuccess = async (formType,data) => {
} }
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.result = 'PENDING';
if (formType === 'create') { if (formType === 'create') {
await DeviceRepairApi.createDeviceRepair(data) await DeviceRepairApi.createDeviceRepair(data)
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))
@ -235,6 +248,23 @@ const searchFormClick = (searchData) => {
getList() // getList() //
} }
// function getAllFactoryAreaList() {
// selectAllFactoryArea().then(res => {
// factoryAreaList.value = res.data
// })
// }
function handleBackout(row) {
if (row.result != 'PENDING') {
message.error('该报修单正在处理中,不能撤销!')
}
DeviceRepairApi.rejected(row.id).then(res => {
console.log("撤销成功!")
getList() //
})
}
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
getList() getList()

Loading…
Cancel
Save