Browse Source

设备绑定备件接口

master
ljlong_2630 10 months ago
parent
commit
96d2080978
  1. 13
      src/api/eam/device/deviceMaintenanceMain/index.ts
  2. 7
      src/api/system/dept/index.ts
  3. 4
      src/components/BasicForm/src/BasicForm.vue
  4. 6
      src/components/Form/src/Form.vue
  5. 45
      src/utils/disposition/defaultButtons.ts
  6. 22
      src/views/eam/basic/fixedAssets/fixedAssets.data.ts
  7. 15
      src/views/eam/basic/fixedAssets/index.vue
  8. 15
      src/views/eam/device/deviceAccounts/index.vue
  9. 97
      src/views/eam/device/deviceMaintenanceMain/deviceMaintenanceMain.data.ts
  10. 75
      src/views/eam/device/deviceMaintenanceMain/index.vue
  11. 6
      src/views/eam/device/deviceRepair/deviceRepair.data.ts

13
src/api/eam/device/deviceMaintenanceMain/index.ts

@ -1,6 +1,7 @@
import request from '@/config/axios'
export interface DeviceMaintenanceMainVO {
id: number
number: string
requestNumber: string
describe: string
@ -54,4 +55,14 @@ export const exportDeviceMaintenanceMain = async (params) => {
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/eam/device-maintenance-main/get-import-template' })
}
}
// 修改维修工单主
export const orderStepChange = async (data: DeviceMaintenanceMainVO) => {
return await request.get({ url: `/eam/device-maintenance-main/orderClick?number=`+data.number+`&status=`+data.status+`&id=`+data.id+`&requestNumber=`+data.requestNumber })
}
// 修改维修工单主
export const orderTurnTo = async (data: DeviceMaintenanceMainVO) => {
return await request.get({ url: `/eam/device-maintenance-main/turnTo?deviceNumber=`+data.deviceNumber +`&id=`+data.id + `&receiverType=`+ data.type +`&receiverUserId=` + data.maintenance })
}

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

@ -47,3 +47,10 @@ export const deleteDept = async (id: number) => {
export const selectAllFactoryArea = async () => {
return await request.get({ url: '/system/dept/selectAllFactoryArea'})
}
// 查询厂区--班组下人员列表
export const selecUserByType = async (data) => {
return await request.get({ url: '/system/dept/selecUserByType?classType=' + data.classType + '&factoryAreaNumber=' + data.factoryAreaNumber + '&flag=' + data.flag})
}

4
src/components/BasicForm/src/BasicForm.vue

@ -527,8 +527,8 @@ const inpuFocus = (headerItem, row, index) => {
* @param field 当前操作字段
* @param cur 改变后值
*/
const onChange = (field, cur) => {
emit('onChange', field, cur)
const onChange = (field, cur, item) => {
emit('onChange', field, cur, item)
}
//

6
src/components/Form/src/Form.vue

@ -185,8 +185,8 @@ export default defineComponent({
* @param field 当前操作字段
* @param cur 改变后值
*/
const onChange = (field, cur) => {
emit('onChange', field, cur)
const onChange = (field, cur, item) => {
emit('onChange', field, cur, item)
}
// formItem
const renderFormItem = (item: FormSchema) => {
@ -290,7 +290,7 @@ export default defineComponent({
{...(autoSetPlaceholder && setTextPlaceholder(item))}
{...setComponentProps(item)}
style={item.componentProps?.style}
onChange={(e)=>{onChange(item.field, e)}}
onChange={(e)=>{onChange(item.field, e,item)}}
{...(notRenderOptions.includes(item?.component as string) &&
item?.componentProps?.options
? { options: item?.componentProps?.options || [] }

45
src/utils/disposition/defaultButtons.ts

@ -212,18 +212,18 @@ export function drawerDeleteBtn(option:any) {
})
}
// 主列表-详情按钮
// export function mainListDetailBtn(option:any) {
// return __defaultBtnOption(option,{
// label: '详情',
// name: 'detail',
// hide: false,
// type: 'primary',
// color: '',
// link: true, // 文本展现按钮
// hasPermi: ''
// })
// }
//主列表-详情按钮
export function mainListDetailBtn(option:any) {
return __defaultBtnOption(option,{
label: '详情',
name: 'detail',
hide: false,
type: 'primary',
color: '',
link: true, // 文本展现按钮
hasPermi: ''
})
}
// 主列表-编辑按钮
export function mainListEditBtn(option:any) {
@ -792,7 +792,7 @@ export function backoutBtn(option:any) {
export function acceptOrderBtn(option:any) {
return __defaultBtnOption(option,{
label: '接单',
name: 'acceptorder',
name: 'acceptOrder',
hide: false,
type: 'primary',
color: '',
@ -805,7 +805,7 @@ export function acceptOrderBtn(option:any) {
export function turnOrderBtn(option:any) {
return __defaultBtnOption(option,{
label: '转办',
name: 'turnorder',
name: 'turnOrder',
hide: false,
type: 'warning',
color: '',
@ -818,7 +818,7 @@ export function turnOrderBtn(option:any) {
export function finishOrderBtn(option:any) {
return __defaultBtnOption(option,{
label: '完成',
name: 'finishorder',
name: 'finishOrder',
hide: false,
type: 'success',
color: '',
@ -831,7 +831,20 @@ export function finishOrderBtn(option:any) {
export function verifyOrderBtn(option:any) {
return __defaultBtnOption(option,{
label: '验证',
name: 'verifyorder',
name: 'verifyOrder',
hide: false,
type: 'primary',
color: '',
link: true, // 文本展现按钮
hasPermi: ''
})
}
//主列表-维修
export function repairBtn(option:any) {
return __defaultBtnOption(option,{
label: '维修',
name: 'repair',
hide: false,
type: 'primary',
color: '',

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: false,
isSearch: true,
},
{
label: '资产名称',
@ -29,7 +29,7 @@ export const FixedAssets = useCrudSchemas(reactive<CrudSchema[]>([
label: '会计单位',
field: 'accountingUnit',
sort: 'custom',
isSearch: false,
isSearch: true,
},
{
label: '规格型号',
@ -114,16 +114,26 @@ 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',

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

@ -99,12 +99,9 @@ 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(null), //
defaultButtons.defaultImportBtn(null), //
defaultButtons.defaultExportBtn(null), //
defaultButtons.defaultAddBtn({hasPermi:'eam:fixedAssets:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'eam:fixedAssets:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'eam:fixedAssets:export'}), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
@ -136,10 +133,8 @@ const buttonBaseClick = (val, item) => {
// -
const butttondata = [
defaultButtons.mainListEditBtn(null), //
defaultButtons.mainListDeleteBtn(null), //
// defaultButtons.mainListEditBtn({hasPermi:'eam:fixedAssets:update'}), //
// defaultButtons.mainListDeleteBtn({hasPermi:'eam:fixedAssets:delete'}), //
defaultButtons.mainListEditBtn({hasPermi:'eam:fixedAssets:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'eam:fixedAssets:delete'}), //
]
// -

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

@ -302,13 +302,14 @@ const getItemWithOutBind = async () => {
...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);
// 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);
const filteredList = res.list;
return filteredList; //
}
return []; //

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

@ -1,12 +1,12 @@
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'
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 showFactory = ref(false);
const factoryValue = ref<number | null>(null);
const userList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: '', flag: 1 })
// 表单校验
export const DeviceMaintenanceMainRules = reactive({
number: [required],
@ -22,14 +22,14 @@ export const DeviceMaintenanceMainRules = reactive({
export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '编号唯一标识',
label: '维修工单编号',
field: 'number',
sort: 'custom',
isSearch: true,
isForm: false,
},
{
label: '报修工单申请号',
label: '报修工单号',
field: 'requestNumber',
sort: 'custom',
isForm: false,
@ -64,12 +64,6 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
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)
// }
},
}
},
@ -96,11 +90,12 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
component: 'Select',
api: () => factoryList,
componentProps: {
disabled:false,
disabled:true,
optionsAlias: {
labelField: 'name',
valueField: 'id'
},
placeholder: "请先选择设备"
},
}
},
@ -108,15 +103,39 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '维修人',
field: 'maintenance',
sort: 'custom',
form: {
component: 'Input',
api: () => userList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return factoryList.find((account) => account.id == cellValue)?.name
},
search: {
show: true,
component: 'Select',
api: () => userList,
componentProps: {
optionsAlias: {
labelField: 'name',
valueField: 'id'
}
}
},
form: {
component: 'Select',
api: () => userList,
componentProps: {
disabled:true,
optionsAlias: {
labelField: 'name',
valueField: 'id'
},
placeholder: "请先选择设备"
},
}
},
{
label: '报修人联系电话',
field: 'maintenancePhone',
sort: 'custom',
},
// {
// label: '报修人联系电话',
// field: 'maintenancePhone',
// sort: 'custom',
// },
{
label: '状态',
field: 'status',
@ -134,15 +153,19 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'type',
sort: 'custom',
isSearch: true,
isForm: true,
dictType: DICT_TYPE.DEVICE_MOLD_TYPE,
dictClass: 'string',
form: {
component: 'Select'
component: 'Select',
componentProps: {
disabled: true,
}
},
},
{
label: '描述',
field: 'describe',
field: 'describes',
sort: 'custom',
form: {
component: 'Input',
@ -156,21 +179,21 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
// field: 'siteId',
// sort: 'custom',
// },
{
label: '是否可用',
field: 'available',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
},
// {
// label: '是否可用',
// field: 'available',
// sort: 'custom',
// dictType: DICT_TYPE.TRUE_FALSE,
// dictClass: 'string',
// form: {
// component: 'Switch',
// value: 'TRUE',
// componentProps: {
// inactiveValue: 'FALSE',
// activeValue: 'TRUE'
// }
// },
// },
{
label: '操作',
field: 'action',

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

@ -64,20 +64,20 @@ import { DeviceMaintenanceMain,DeviceMaintenanceMainRules } from './deviceMainte
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() //
const userStore = useUserStore() //
const route = useRoute() //
const routeName = ref()
const basicFormRef = ref()
routeName.value = route.name
const tableColumns = ref(DeviceMaintenanceMain.allSchemas.tableColumns)
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
@ -104,7 +104,7 @@ const HeadButttondata = [
// defaultButtons.defaultAddBtn({hasPermi:'eam:deviceMaintenanceMain:create'}), //
// defaultButtons.defaultImportBtn({hasPermi:'eam:deviceMaintenanceMain:import'}), //
// defaultButtons.defaultExportBtn({ hasPermi: 'eam:deviceMaintenanceMain:export' }), //
defaultButtons.defaultAddBtn(null), //
defaultButtons.defaultAddBtn({ hide: !(userStore?.userSelfInfo?.posts?.some((item) => item.code == 'worker')) }), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
@ -121,6 +121,10 @@ const HeadButttondata = [
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
DeviceMaintenanceMain.allSchemas.formSchema[0].componentProps.disabled = false;
DeviceMaintenanceMain.allSchemas.formSchema[2].componentProps.disabled = true;
DeviceMaintenanceMain.allSchemas.formSchema[3].componentProps.disabled = true;
DeviceMaintenanceMain.allSchemas.formSchema[3].value = 'DEVICE';
openForm('create')
} else if (val == 'import') { //
handleImport()
@ -141,33 +145,47 @@ const butttondata = (row) => {
// 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')}), //
// defaultButtons.backoutBtn(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), //
]
}
const onChange = (field, cur) => {
const onChange = (field, cur, item) => {
//
console.log(field)
console.log(cur)
if(field == 'deviceNumber'){
// DeviceMaintenanceMain.allSchemas.formSchema[1].componentProps.disabled = true
basicFormRef.value.formRef.formModel.factoryAreaNumber=119
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)
basicFormRef.value.formRef.formModel.maintenance = String(userStore?.getUser?.id)
}
}
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
openForm('update', row)
DeviceMaintenanceMain.allSchemas.formSchema[0].componentProps.disabled = true;
} else if (val == 'delete') { //
handleDelete(row.id)
} else if (val == 'acceptOrder') {
acceptOrder(row)
} else if (val == 'turnOrder') {
DeviceMaintenanceMain.allSchemas.formSchema[3].componentProps.disabled = false;
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)
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
@ -186,8 +204,13 @@ const formsSuccess = async (formType,data) => {
if(data.activeTime==0)data.activeTime = null;
if(data.expireTime==0)data.expireTime = null;
if (formType === 'create') {
data.status = 'PECEIVED'
await DeviceMaintenanceMainApi.createDeviceMaintenanceMain(data)
message.success(t('common.createSuccess'))
} else if (formType === 'turnOrder') {
await DeviceMaintenanceMainApi.orderTurnTo(data)
message.success(t('common.updateSuccess'))
} else {
await DeviceMaintenanceMainApi.updateDeviceMaintenanceMain(data)
message.success(t('common.updateSuccess'))
@ -255,6 +278,32 @@ const searchFormClick = (searchData) => {
getList() //
}
//
function acceptOrder(row) {
DeviceMaintenanceMainApi.orderStepChange(row);
}
//
function turnOrder() {
}
//
function finishOrder() {
}
//
function verifyOrder() {
}
//
function repair() {
}
//
function mainListDetail() {
}
/** 初始化 **/
onMounted(async () => {
getList()

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

@ -29,7 +29,7 @@ export const DeviceRepair = useCrudSchemas(reactive<CrudSchema[]>([
isTable: false
},
{
label: '编号唯一标识',
label: '报修工单编号',
field: 'number',
sort: 'custom',
isSearch: true,
@ -62,10 +62,10 @@ export const DeviceRepair = useCrudSchemas(reactive<CrudSchema[]>([
labelField: 'name',
valueField: 'id'
},
onChange: (e) => {
onChange: (val) => {
DeviceAccountsApi.getDeviceAccountsPage({
isSearch: false,
factoryAreaNumber: e
factoryAreaNumber: val
}).then((res) => {
deviceList.value = res?.list
}).catch((e) => {

Loading…
Cancel
Save