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. 68
      src/views/eam/device/deviceAccounts/index.vue
  11. 139
      src/views/eam/device/deviceRepair/deviceRepair.data.ts
  12. 48
      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 })
}
// 新增设备备件关系
// 新增设备备件关系
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

@ -56,4 +56,10 @@ export const exportDeviceAccounts = async (params) => {
// 下载用户导入模板
export const importTemplate = () => {
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'
export interface DeviceRepairVO {
id: number
number: string
describe: string
deviceNumber: string
@ -53,4 +54,9 @@ export const exportDeviceRepair = async (params) => {
// 下载用户导入模板
export const importTemplate = () => {
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) => {
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', // 项类型
DEVICE_MOLD_TYPE = 'device_mold_type', // 设备/模具类型
TRANSACTION_TYPE = 'transaction_Type', // 事务类型
RESULT = 'result', // 事务类型
RESULT = 'result', // 维修结果
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: ''
})
}
// 主列表-撤销
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){
return {

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

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

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

@ -60,7 +60,7 @@
<script setup lang="ts">
import download from '@/utils/download'
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 TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
@ -99,9 +99,12 @@ const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'eam:fixedAssets:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'eam:fixedAssets:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'eam:fixedAssets:export'}), //
// defaultButtons.defaultAddBtn({hasPermi:'eam:fixedAssets:create'}), //
// defaultButtons.defaultImportBtn({hasPermi:'eam:fixedAssets:import'}), //
// defaultButtons.defaultExportBtn({ hasPermi: 'eam:fixedAssets:export' }), //
defaultButtons.defaultAddBtn(null), //
defaultButtons.defaultImportBtn(null), //
defaultButtons.defaultExportBtn(null), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
@ -133,8 +136,10 @@ const buttonBaseClick = (val, item) => {
// -
const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'eam:fixedAssets:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'eam:fixedAssets:delete'}), //
defaultButtons.mainListEditBtn(null), //
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: '是否可用',
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',
isForm: false,
table: {
width: 150,
width: 200,
fixed: 'right'
}
}

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

@ -52,9 +52,8 @@
<SearchTable
ref="searchTableRef"
:searchFormConfig="DeviceAccounts.searchFormConfig"
:searchTableAction="DeviceAccounts.searchTableAction"
@success="searchTableSuccess"
@searchTableSuccess="submitItem"
/>
<!-- 详情 -->
@ -67,12 +66,14 @@
<script setup lang="ts">
import download from '@/utils/download'
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 defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue'
import * as ItemApi from '@/api/eam/basic/item'
defineOptions({ name: 'DeviceAccounts' })
@ -81,7 +82,7 @@ const { t } = useI18n() // 国际化
const route = useRoute() //
const routeName = ref()
const itemList = ref([])
const deviceNumber = ref();
routeName.value = route.name
const tableColumns = ref(DeviceAccounts.allSchemas.tableColumns)
@ -277,13 +278,62 @@ const openQrCode = async (number: String) => {
// } catch {}
}
const searchTableRef = ref()
/** 绑定备件操作 */
const openItem = async (number: String) => {
let param = {
number: number
}
itemList.value = getItemAccountsPage(param); //
deviceNumber.value = 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; //
}
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>

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

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

48
src/views/eam/device/deviceRepair/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,6 +62,8 @@ import download from '@/utils/download'
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'
import { getRowIdentity } from 'element-plus/es/components/table/src/util'
// import TableHead from '@/components/TableHead/src/TableHead.vue'
// import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
// import Detail from '@/components/Detail/src/Detail.vue'
@ -73,6 +75,7 @@ const { t } = useI18n() // 国际化
const route = useRoute() //
const routeName = ref()
const factoryAreaList = ref([])
routeName.value = route.name
const tableColumns = ref(DeviceRepair.allSchemas.tableColumns)
@ -99,9 +102,12 @@ const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'eam:deviceRepair:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'eam:deviceRepair:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'eam:deviceRepair:export'}), //
// defaultButtons.defaultAddBtn({hasPermi:'eam:deviceRepair:create'}), //
// defaultButtons.defaultImportBtn({hasPermi:'eam:deviceRepair:import'}), //
// defaultButtons.defaultExportBtn({ hasPermi: 'eam:deviceRepair:export' }), //
defaultButtons.defaultAddBtn(null), //
// defaultButtons.defaultImportBtn(null), //
// defaultButtons.defaultExportBtn(null), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
@ -132,10 +138,13 @@ const buttonBaseClick = (val, item) => {
}
// -
const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'eam:deviceRepair:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'eam:deviceRepair:delete'}), //
]
const butttondata = (row) => {
return [
// defaultButtons.mainListEditBtn({hasPermi:'eam:deviceRepair:update'}), //
// defaultButtons.mainListDeleteBtn({ hasPermi: 'eam:deviceRepair:delete' }), //
defaultButtons.backoutBtn({ hide: row.result != 'PENDING' }), //
]
}
// -
const buttonTableClick = async (val, row) => {
@ -143,6 +152,8 @@ const buttonTableClick = async (val, row) => {
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
} else if (val == 'backout') { //
handleBackout(row)
}
}
@ -164,7 +175,9 @@ const formsSuccess = async (formType,data) => {
}
}
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') {
await DeviceRepairApi.createDeviceRepair(data)
message.success(t('common.createSuccess'))
@ -235,6 +248,23 @@ const searchFormClick = (searchData) => {
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 () => {
getList()

Loading…
Cancel
Save