Browse Source

维修工单

master
zhang_li 10 months ago
parent
commit
8e83c350a8
  1. 1
      .env.development
  2. 5
      src/api/eam/basic/item/index.ts
  3. 51
      src/api/eam/device/deviceMaintenanceDetail/index.ts
  4. 7
      src/components/BasicForm/src/BasicForm.vue
  5. 74
      src/components/Detail/src/Detail.vue
  6. 89
      src/components/SearchTable/src/SearchTable.vue
  7. 11
      src/components/TableForm/src/TableForm.vue
  8. 1
      src/utils/dict.ts
  9. 37
      src/utils/disposition/tabsList.ts
  10. 26
      src/views/eam/basic/item/item.data.ts
  11. 3
      src/views/eam/device/deviceAccounts/deviceAccounts.data.ts
  12. 20
      src/views/eam/device/deviceAccounts/index.vue
  13. 194
      src/views/eam/device/deviceMaintenanceMain/deviceMaintenanceMain.data.ts
  14. 392
      src/views/eam/device/deviceMaintenanceMain/index.vue

1
.env.development

@ -5,6 +5,7 @@ VITE_DEV=false
# 请求路径
VITE_BASE_URL='http://localhost:12080'
# VITE_BASE_URL='http://192.168.0.165:12080'
# 上传路径
VITE_UPLOAD_URL='http://localhost:12080/admin-api/infra/file/upload'

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

@ -61,4 +61,9 @@ export const deleteItem = async (id : number) => {
// 导出备件 Excel
export const exportItem = async (params) => {
return await request.download({ url: `/eam/item/export-excel`, params })
}
// 修改备件
export const getItemList = async (params) => {
return await request.get({ url: `/eam/item/getListByNumber`, params })
}

51
src/api/eam/device/deviceMaintenanceDetail/index.ts

@ -0,0 +1,51 @@
import request from '@/config/axios'
export interface DeviceMaintenanceDetailVO {
describes: string
describes1: string
workOut: string
maintenances: string
}
// 查询维修工单子列表
export const getDeviceMaintenanceDetailPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/wms/purchasereceipt-request-detail/senior', data })
} else {
return await request.get({ url: `/admin-api/eam/device-maintenance-detail/page`, params })
}
}
// 查询维修工单子详情
export const getPurchasereceiptRequestDetail = async (id: number) => {
return await request.get({ url: `/eam/device-maintenance-detail/get?id=` + id })
}
// 新增维修工单子
export const createDeviceMaintenanceDetail = async (data: DeviceMaintenanceDetailVO) => {
return await request.post({ url: `/eam/device-maintenance-detail/create`, data })
}
// 修改维修工单子
export const updateDeviceMaintenanceDetail = async (data: DeviceMaintenanceDetailVO) => {
return await request.put({ url: `/eam/device-maintenance-detail/update`, data })
}
// 删除维修工单子
export const deleteDeviceMaintenanceDetail = async (id: number) => {
return await request.delete({ url: `/eam/device-maintenance-detail/delete?id=` + id })
}
// 导出维修工单子 Excel
export const exportPurchasereceiptRequestDetail = async (params) => {
return await request.download({ url: `/wms/purchasereceipt-request-detail/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/wms/purchasereceipt-request-detail/get-import-template' })
}

7
src/components/BasicForm/src/BasicForm.vue

@ -281,6 +281,7 @@ const opensearchTable = (
) => {
const _searchCondition = {}
//
console.log('searchCondition',searchCondition)
if (searchCondition && searchCondition.length > 0) {
//
let filters: any[] = []
@ -288,6 +289,7 @@ const opensearchTable = (
// searchCondition.forEach((item) => {
// row
if (searchCondition[i].isMainValue) {
_searchCondition[searchCondition[i].key] = formRef.value.formModel[searchCondition[i].value]
? formRef.value.formModel[searchCondition[i].value]
: props.detailData
@ -296,6 +298,10 @@ const opensearchTable = (
? row[searchCondition[i].value]
: ''
//
console.log(11)
console.log(_searchCondition)
console.log(formRef.value.formModel)
console.log(11)
let isNull = false
if (_searchCondition[searchCondition[i].key] == '' || _searchCondition[searchCondition[i].key] == undefined) {
isNull = true
@ -510,6 +516,7 @@ const handleAddTable = () => {
}
//
const inpuFocus = (headerItem, row, index) => {
console.log('headerItem',headerItem)
opensearchTable(
headerItem.field,
headerItem.tableForm.searchField,

74
src/components/Detail/src/Detail.vue

@ -28,7 +28,7 @@
<Tabs :tabsList="tabsList" :current="current" @change="change" />
<div class="flex">
<!-- 详情 -->
<ContentWrap class="w-[73%]">
<ContentWrap class="w-[100%]">
<!-- 列表头部 -->
<TableHead
v-if="!isBasic"
@ -98,20 +98,6 @@
</template>
</DetailTable>
</ContentWrap>
<!-- <ContentWrap class="w-[27%] ml-16px">
<Annex
:annexData="annexData"
@handleAnnexSuccess="handleAnnexSuccess"
@deleteAnnexSuccess="deleteAnnexSuccess"
:upData="remarksData.data"
/>
<Remarks
:remarksData="remarksData"
class="mt-20px"
@remarksSubmitScuess="remarksSubmitScuess"
/>
<ChangeRecord :changeRecordData="changeRecordData" class="mt-20px" />
</ContentWrap> -->
</div>
</el-drawer>
<!-- 表单弹窗添加/修改 -->
@ -301,41 +287,7 @@ if (props.isBasic == true) {
if (tabsList.value) {
}
//
const annexData = reactive({
annexList: []
})
//
const remarksData = reactive({
remarksList: [],
data: {}
})
//
const changeRecordData = reactive({
changeRecordList: []
})
const detailData = ref({}) //
//
const getFileList = async () => {
detailLoading.value = true
try {
annexData.annexList = await FileApi.getFileList(remarksData.data)
} finally {
detailLoading.value = false
}
}
/** 添加附件 */
const handleAnnexSuccess = () => {
getFileList()
getChangeRecordList()
}
//
const deleteAnnexSuccess = async () => {
getFileList()
getChangeRecordList()
}
// Tabs
const current = ref(0)
@ -357,15 +309,12 @@ const HeadButttondata = ref()
const buttondata = ref()
/** 打开弹窗 */
const detailData = ref()
const titleNameRef = ref()
const titleValueRef = ref()
const openDetail = async (row: any, titleName: any, titleValue: any, tableName: any) => {
titleNameRef.value = titleName
titleValueRef.value = titleValue
remarksData.data = {
tableId: row.id,
tableName: tableName
}
//
if (!props.isBasic) {
// id
@ -452,25 +401,6 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
}
defineExpose({ openDetail }) // open
//
const getRemarkList = async () => {
detailLoading.value = true
try {
remarksData.remarksList = await RemarkApi.getRemarkPage(remarksData.data)
} finally {
detailLoading.value = false
}
}
//
const remarksSubmitScuess = async (remark) => {
detailLoading.value = false
getRemarkList()
getChangeRecordList()
}
//
const getChangeRecordList = async () => {
changeRecordData.changeRecordList = await RemarkApi.getChangeRecordPage(remarksData.data)
}
const tableObjectRef = ref()
const tableMethodsRef = ref()

89
src/components/SearchTable/src/SearchTable.vue

@ -1,31 +1,20 @@
<template>
<Dialog :title="dialogTitle" v-model="searchDialogVisible" :width="'80%'">
<!-- 搜索工作栏 -->
<!-- <Search :schema="searchSchema" @search="setSearchParamsRef" @reset="setSearchParamsRef" /> -->
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
:routeName="routeName"
@searchFormClick="searchFormClick"
:allSchemas="allSchemasRef"
/>
<ContentWrap>
<Table
ref="searchTableRef"
:columns="tableColumns"
:data="tableObjectRef.tableList"
:loading="tableObjectRef.loading"
:pagination="{
total: tableObjectRef.total
}"
v-model:pageSize="tableObjectRef.pageSize"
v-model:currentPage="tableObjectRef.currentPage"
v-model:sort="tableObjectRef.sort"
:selection="true"
:reserveSelection="true"
row-key="id"
/>
row-key="number"
>
<template #qty="{ row }">
<el-input v-model="row.qty" type="number" placeholder="请输入数量" />
</template>
</Table>
</ContentWrap>
<template #footer>
<div class="flex items-center">
@ -49,15 +38,15 @@ const searchDialogVisible = ref(false) // 弹窗的是否展示
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
//
const HeadButttondata = [
defaultButtons.defaultFilterBtn(null), //
]
/** 打开弹窗 */
const getListRef = ref()
const setSearchParamsRef = ref()
const tableObjectRef = ref()
const tableObjectRef = ref({
tableList:'',
loading:false,
params:{}
})
const getPage:any = ref()
const searchSchema = ref()
const tableColumns = ref()
@ -72,6 +61,7 @@ const open = (titleName: any, allSchemas: any,getApiPage: any, formField: any, s
searchDialogVisible.value = true
formFieldRef.value = formField
searchFieldRef.value = searchField
allSchemasRef.value = allSchemas
searchSchema.value = allSchemas.searchSchema
tableColumns.value = allSchemas.tableColumns.filter(item => (item.field !== 'action'))
@ -79,53 +69,20 @@ const open = (titleName: any, allSchemas: any,getApiPage: any, formField: any, s
typeRef.value = type
rowRef.value = row
multipleBol.value = multiple
// dialogTitle.value = t('action.' + type)
dialogTitle.value = titleName
const {tableObject, tableMethods } = useTable({
getListApi: getPage.value //
const getList = async () => {
await getPage.value().then((res)=>{
tableObjectRef.value.tableList = res
})
tableObjectRef.value = tableObject
searchConditionRef.value = searchCondition
if (searchCondition) tableObjectRef.value.params = searchCondition;
}
console.log(tableObjectRef.value)
//
const { getList } = tableMethods
// setSearchParamsRef.value = setSearchParams
setSearchParamsRef.value = tableObject.params
getListRef.value = getList
getList()
}
//
const searchFormClick = (searchData) => {
// console.log(99, rowRef.value)
// console.log(100, searchData)
// console.log(101, searchConditionRef.value)
// 20240104 searchData.filters
if (searchConditionRef.value) {
Object.keys(searchConditionRef.value).forEach(key => {
if (searchData.filters) {
searchData.filters.push({
action: "==",
column: key,
value: searchConditionRef.value[key]
})
// }
} else {
searchData.filters = [{
action: "==",
column: key,
value: searchConditionRef.value[key]
}]
}
});
}
tableObjectRef.value.params = {
isSearch: true,
filters: searchData.filters
}
getListRef.value() //
}
defineExpose({ open }) // open
@ -153,9 +110,15 @@ const submitForm = async () => {
return
}
}
let isQtyNone = selections.filter(item=>!item.qty)
if(isQtyNone&&isQtyNone.length>0){
message.warning('请填写数量')
formLoading.value = false
return
}
try {
searchDialogVisible.value = false
console.log(selections)
//
emit('searchTableSuccess', formFieldRef.value, searchFieldRef.value, selections, typeRef.value, rowRef.value)
} finally {

11
src/components/TableForm/src/TableForm.vue

@ -115,8 +115,8 @@
@change="formSelectChange(headerItem.field, $event,row)">
<el-option
v-for="op in initSelectOptions(headerItem)"
:label="op.label"
:value="op.value"
:label="headerItem?.tableForm?.optionsAlias?.labelField? op[headerItem?.tableForm?.optionsAlias?.labelField]:op.label"
:value="headerItem?.tableForm?.optionsAlias?.valueField? op[headerItem?.tableForm?.optionsAlias?.valueField]:op.value"
:key="op.value" />
</el-select>
</el-form-item>
@ -347,10 +347,17 @@ const emit = defineEmits([
])
// | type = radio | type = select
const initSelectOptions = (item) => {
// if(!item.dictType ){
// console.log( item.tableForm.initOptions)
// item.tableForm.initOptions.for
// }
return item.dictType ? getStrDictOptions(item.dictType) : item.tableForm.initOptions
}
//
const formSelectChange = (field, val,row) => {
console.log(field)
console.log(val)
console.log(row)
emit('formSelectChange', field, val,row)
}

1
src/utils/dict.ts

@ -276,6 +276,7 @@ export enum DICT_TYPE {
DEVICE_MOLD_TYPE = 'device_mold_type', // 设备/模具类型
TRANSACTION_TYPE = 'transaction_Type', // 事务类型
RESULT = 'result', // 维修结果
MAINTENANCE_SHIFT = 'maintenance_shift',//班次
FAULT_TYPE = 'fault_type',//故障类型
WEI_XIU_ORDER_STATUS = 'wei_xiu_order_status',//维修单状态
BASIC_STATUS = 'basic_status',//设备模具状态

37
src/utils/disposition/tabsList.ts

@ -1,40 +1,31 @@
// 页面tabs标签
export const ItemBasicTabsList = [{
label: "供应商物品",
prop: 'SupplierItems',
label: "设备信息",
prop: 'info',
},
{
label: "客户物品",
prop: 'CustomerItems',
label: "设备图片",
prop: 'Image',
},
{
label: "采购订单",
prop: 'PurchaseOrder',
label: "关联文档",
prop: 'Word',
},
{
label: "要货计划",
prop: 'PurchasingPlan',
label: "关联备件",
prop: 'Part',
},
{
label: "库存余额",
prop: 'InventoryBalance',
label: "报修记录",
prop: 'deviceReportRecord',
},
{
label: "预计入库存",
prop: 'ExpectedIn',
label: "维修记录",
prop: 'RepairRecord',
},{
label: "预计出库存",
prop: 'ExpectedOut',
label: "保养记录",
prop: 'MaintenanceRecord',
},
]
export const PurchasereceiptRequestTabsList = [{
label: "收货明细",
prop: 'receiptDetail',
},
{
label: "缺货明细",
prop: 'scarceGoodsDetail',
}
]

26
src/views/eam/basic/item/item.data.ts

@ -186,3 +186,29 @@ export const Item = useCrudSchemas(reactive<CrudSchema[]>([
}
}
]))
export const ItemSearchTable = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '备件编号',
field: 'number',
sort: 'custom',
isSearch: true,
isForm: false,
table: {
fixed: 'left'
},
},
{
label: '备件名称',
field: 'name',
sort: 'custom',
isSearch: true,
table: {
},
},
{
label: '数量',
field: 'qty',
sort: 'custom',
}
]))

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

@ -57,6 +57,9 @@ export const DeviceAccounts = useCrudSchemas(reactive<CrudSchema[]>([
type: 'datetime',
valueFormat: 'x'
}
},
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
}
},
{

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

@ -27,9 +27,9 @@
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>
<template #number="{row}">
<el-button type="primary" link @click="openDetail(row, '编号', row.number)">
<span>{{ row.number }}</span>
</el-button>
</template>
<template #action="{ row }">
@ -57,7 +57,18 @@
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="DeviceAccounts.allSchemas" />
<!-- <Detail ref="detailRef" :isBasic="true" :allSchemas="DeviceAccounts.allSchemas" /> -->
<Detail
ref="detailRef"
:tabs="ItemBasicTabsList"
:isBasic="true"
:allSchemas="DeviceAccounts.allSchemas"
@changeTabs="changeTabs"
:detailAllSchemas="detailAllSchemas"
:apiPage="apiPage"
:tabsExtend="tabsExtend"
:tableObjectExtend="tableObjectExtend"
/>
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/eam/device-accounts/import" :importTemplateData="importTemplateData" @success="importSuccess" />
@ -70,6 +81,7 @@ 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 { ItemBasicTabsList } from '@/utils/disposition/tabsList'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue'

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

@ -3,6 +3,8 @@ 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 { ItemSearchTable } from '../../basic/item/item.data'
import * as ItemApi from '@/api/eam/basic/item'
const userStore = useUserStore()
const factoryList = await selectAllFactoryArea()
const deviceList = await DeviceAccountsApi.getDeviceAccountsNoPage({})
@ -14,10 +16,10 @@ export const DeviceMaintenanceMainRules = reactive({
deviceNumber: [required],
factoryAreaNumber: [required],
maintenance: [required],
status: [required],
type: [required],
siteId: [required],
concurrencyStamp: [required],
classes: [required],
faultType: [required],
describes : [required],
})
export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
@ -84,9 +86,6 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
width: '150',
},
api: () => factoryList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return factoryList.find((account) => account.id == cellValue)?.name
},
search: {
show: true,
component: 'Select',
@ -118,21 +117,6 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
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: 'Select',
api: () => userList,
@ -146,42 +130,50 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
},
}
},
// {
// label: '报修人联系电话',
// field: 'maintenancePhone',
// sort: 'custom',
// },
{
label: '状态',
field: 'status',
label: '类型设备',
field: 'type',
sort: 'custom',
table: {
width: '150',
},
isSearch: true,
isForm: false,
dictType: DICT_TYPE.WEI_XIU_ORDER_STATUS,
isForm: true,
dictType: DICT_TYPE.DEVICE_MOLD_TYPE,
dictClass: 'string',
form: {
component: 'Select',
componentProps: {
disabled: true,
}
},
},
{
label: '班次',
field: 'classes',
sort: 'custom',
table: {
width: '150',
},
isSearch: true,
dictType: DICT_TYPE.MAINTENANCE_SHIFT,
dictClass: 'number',
form: {
component: 'Select'
},
},
{
label: '类型设备',
field: 'type',
label: '故障类型',
field: 'faultType',
sort: 'custom',
table: {
width: '150',
},
isSearch: true,
isForm: true,
dictType: DICT_TYPE.DEVICE_MOLD_TYPE,
dictType: DICT_TYPE.FAULT_TYPE,
dictClass: 'string',
form: {
component: 'Select',
componentProps: {
disabled: true,
}
component: 'Select'
},
},
{
@ -196,26 +188,6 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
},
},
// {
// label: '地点ID',
// 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: 'action',
@ -223,6 +195,110 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
table: {
width: 300,
fixed: 'right'
}
},
isDetail:false
}
]))
export const DeviceMaintenanceDetail = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '故障描述',
field: 'describes',
sort: 'custom',
table: {
width: '150',
},
isForm: false,
isSearch: false,
isTable: false,
},
{
label: '故障真因',
field: 'describes1',
sort: 'custom',
table: {
width: '150',
},
isForm: false,
isSearch: false,
isTable: false,
},
{
label: '解决措施',
field: 'workOut',
sort: 'custom',
table: {
width: '150',
},
isForm: false,
isSearch: false,
isTable: false,
},
{
label: '维修人',
field: 'maintenances',
sort: 'custom',
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'
}
}
},
tableForm: {
type: 'Select',
initOptions: userList,
multiple:true,
collapseTags:true,
collapseTagsTooltip:true,
optionsAlias: {
labelField: 'name',
valueField: 'id'
}
}
},
{
label: '备件',
field: 'itemNUmbers',
sort: 'custom',
table: {
width: '150',
},
tableForm:{
isInpuFocusShow: true, // 开启查询弹窗
searchListPlaceholder: '请选择备件',
searchField: 'itemNUmbers',
searchTitle: '备件',
multiple:true,
searchAllSchemas: ItemSearchTable.allSchemas,
searchPage: ItemApi.getItemList,
searchCondition: [{
key: 'deviceNumber',
value: 'deviceNumber',
message: '请选择设备模具编号!',
isMainValue: true
}]
},
isForm: false,
isSearch: false,
isTable: false,
},
]))
// 表单校验
export const DeviceMaintenanceDetailRules = reactive({
describes: [required],
describes1: [required],
workOut: [required],
maintenance: [required],
itemNUmbers: [required],
})

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

@ -1,78 +1,168 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="DeviceMaintenanceMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
<Search
:schema="DeviceMaintenanceMain.allSchemas.searchSchema"
@search="setSearchParams"
@reset="setSearchParams"
/>
</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="{
total: tableObject.total
}" 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>
<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 #number="{ row }">
<el-button type="primary" link @click="openDetail(row, '代码', row.number)">
<span>{{ row.number }}</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="formRef"
:rules="DeviceMaintenanceMainRules"
:formAllSchemas="DeviceMaintenanceMain.allSchemas"
:tableAllSchemas="DeviceMaintenanceDetail.allSchemas"
:tableFormRules="DeviceMaintenanceDetailRules"
:tableData="tableData"
:apiUpdate="DeviceMaintenanceMainApi.updateDeviceMaintenanceMain"
:apiCreate="DeviceMaintenanceMainApi.createDeviceMaintenanceMain"
:isBusiness="true"
@onChange="onChange"
@handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable"
@searchTableSuccess="searchTableSuccess"
@submitForm="submitForm"
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="DeviceMaintenanceMain.allSchemas" />
<!-- <Detail ref="detailRef" :isBasic="true" :allSchemas="DeviceMaintenanceMain.allSchemas" /> -->
<Detail
ref="detailRef"
:isBasic="true"
:allSchemas="DeviceMaintenanceMain.allSchemas"
:detailAllSchemas="DeviceMaintenanceDetail.allSchemas"
:detailAllSchemasRules="DeviceMaintenanceDetailRules"
:apiCreate="DeviceMaintenanceDetailApi.createPurchasereturnRequestDetail"
:apiUpdate="DeviceMaintenanceDetailApi.updatePurchasereturnRequestDetail"
:apiPage="DeviceMaintenanceDetailApi.getPurchasereturnRequestDetailPage"
:apiDelete="DeviceMaintenanceDetailApi.deletePurchasereturnRequestDetail"
:Echo="Echo"
@searchTableSuccessDetail="searchTableSuccessDetail"
@detailOpenForm="detailOpenForm"
:detailValidate="detailValidate"
/>
<!-- 导入 -->
<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,
DeviceMaintenanceDetail,
DeviceMaintenanceDetailRules
} from './deviceMaintenanceMain.data'
import * as DeviceMaintenanceMainApi from '@/api/eam/device/deviceMaintenanceMain'
import * as DeviceMaintenanceDetailApi from '@/api/eam/device/deviceMaintenanceDetail'
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 message = useMessage() //
const { t } = useI18n() //
const userStore = useUserStore() //
const route = useRoute() //
const routeName = ref()
const basicFormRef = ref()
const formRef = ref()
routeName.value = route.name
const tableColumns = ref(DeviceMaintenanceMain.allSchemas.tableColumns)
const apiPage = ref(DeviceMaintenanceDetailApi.getDeviceMaintenanceDetailPage)
const detailAllSchemas = ref(DeviceMaintenanceDetail.allSchemas)
const tableData = ref([])
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
const itemNUmbers = ref()
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => {
nextTick(() => {
if (type == 'tableForm') {
//
if (formField == 'itemNUmbers') {
let str = ''
val.forEach((element) => {
str += element.name + ':' + element.qty + ','
})
str = str.substring(0, str.length - 1)
row['itemNUmbers'] = str
row['itemNUmbers1'] = val
}
} else {
// const setV = {}
// setV[formField] = val[0][searchField]
// setV['supplierCode'] = val[0]['code']
// formRef.setValues(setV)
}
})
}
//
const searchTableSuccessDetail = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
if (formField == 'itemCode') {
setV['itemCode'] = val[0]['code']
} else {
setV['poNumber'] = val[0]['number']
setV['poLine'] = val[0]['lineNumber']
}
formRef.setValues(setV)
})
}
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
//
// const Echo = ['ppNumber','poLine', 'batch', 'altBatch', 'itemCode', 'itemName', 'itemDesc1', 'itemDesc2', 'projectCode', 'qty', 'uom']
const Echo = []
const { tableObject, tableMethods } = useTable({
getListApi: DeviceMaintenanceMainApi.getDeviceMaintenanceMainPage //
@ -83,84 +173,94 @@ 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({ hide: !(userStore?.userSelfInfo?.posts?.some((item) => item.code == 'worker')) }), //
defaultButtons.defaultAddBtn({
hide: !userStore?.userSelfInfo?.posts?.some((item) => item.code == 'worker')
}), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
// {
// label: '',
// name: 'zdy',
// hide: false,
// type: 'primary',
// icon: 'Select',
// color: ''
// },
defaultButtons.defaultSetBtn(null) //
]
//
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';
if (val == 'add') {
//
DeviceMaintenanceMain.allSchemas.formSchema[3].value = 'DEVICE'
openForm('create')
} else if (val == 'import') { //
} else if (val == 'import') {
//
handleImport()
} else if (val == 'export') { //
} else if (val == 'export') {
//
handleExport()
} else if (val == 'refresh') { //
} else if (val == 'refresh') {
//
getList()
} else if (val == 'filtrate') { //
} else { //
} else if (val == 'filtrate') {
//
} else {
//
console.log('其他按钮', item)
}
}
//
const isShowMainButton = (row, val) => {
if (val.indexOf(row.status) > -1) {
return false
} else {
return true
}
}
// -
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.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.repairBtn({ hide: !(row.status == 'PECEIVED' && row.maintenance == userStore.getUser.id) }), //
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) }), //
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.repairBtn({
hide: !(row.status == 'PECEIVED' && row.maintenance == userStore.getUser.id)
}), //
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') {
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)
// DeviceMaintenanceMain.allSchemas.formSchema[1].componentProps.disabled = true
// DeviceMaintenanceMain.allSchemas.formSchema[2].componentProps.disabled = true
formRef.value.formRef.formModel.factoryAreaNumber = Number(
item.componentProps.options.find((item) => item.number == cur).factoryAreaNumber
)
formRef.value.formRef.formModel.maintenance = String(userStore?.getUser?.id)
}
}
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
DeviceMaintenanceMain.allSchemas.formSchema[0].componentProps.disabled = false
if (val == 'edit') {
//
openForm('update', row)
DeviceMaintenanceMain.allSchemas.formSchema[0].componentProps.disabled = true;
} else if (val == 'delete') { //
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;
openForm('turnOrder', row)
}
}
@ -168,42 +268,14 @@ const buttonTableClick = async (val, row) => {
/** 添加/修改操作 */
const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
// form
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) {
message.error('失效时间要大于生效时间')
return;
}
}
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'))
}
basicFormRef.value.dialogVisible = false
getList()
tableData.value = [] //
formRef.value.open(type, row)
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicDeviceMaintenanceMain')
detailRef.value.openDetail(row, titleName, titleValue,'DeviceMaintenanceMain')
}
/** 删除按钮操作 */
@ -216,7 +288,7 @@ const handleDelete = async (id: number) => {
message.success(t('common.delSuccess'))
//
await getList()
} catch { }
} catch {}
}
/** 导出按钮操作 */
@ -261,28 +333,99 @@ const searchFormClick = (searchData) => {
//
function acceptOrder(row) {
DeviceMaintenanceMainApi.orderStepChange(row);
DeviceMaintenanceMainApi.orderStepChange(row)
}
//
function turnOrder() {
}
function turnOrder() {}
//
function finishOrder() {
}
function finishOrder() {}
//
function verifyOrder() {
}
function verifyOrder() {}
//
function repair() {
}
function repair() {}
//
function mainListDetail() {
function mainListDetail() {}
/**
* tableForm方法
*/
const tableFormKeys = {}
DeviceMaintenanceDetail.allSchemas.tableFormColumns.forEach((item) => {
tableFormKeys[item.field] = item.default ? item.default : ''
})
//
const handleAddTable = () => {
tableData.value.push(JSON.parse(JSON.stringify(tableFormKeys)))
}
//
const handleDeleteTable = (item, index) => {
tableData.value.splice(index, 1)
}
//
const submitForm = async (formType, data) => {
data.subList = tableData.value.map((item) => {
return {
describes: item.describes,
describes1: item.describes1,
itemNUmbers: item.itemNUmbers1,
maintenances: item.maintenances.join(','),
workOut: item.workOut,
}
}) //
console.log(data.subList)
try {
if (formType === 'create') {
await DeviceMaintenanceMainApi.createDeviceMaintenanceMain(data)
message.success(t('common.createSuccess'))
} else {
await DeviceMaintenanceMainApi.updateDeviceMaintenanceMain(data)
message.success(t('common.updateSuccess'))
}
formRef.value.dialogVisible = false
//
getList()
} finally {
formRef.value.formLoading = false
}
}
const detailOpenForm = (type, row) =>{
console.log("type",type);
console.log("row",row);
DeviceMaintenanceDetail.allSchemas.tableFormColumns.map((item) => {
// if(purchaseReceiptRecordNumberRef.value == ''){
// if (item.field == 'itemCode') {
// item.form.componentProps.disabled = true
// item.form.componentProps.isSearchList = true
// }
// if(item.field == 'poLine'){
// item.form.componentProps.disabled = true
// item.form.componentProps.isSearchList = false
// }
// }else{
// if (item.field == 'itemCode') {
// item.form.componentProps.disabled = true
// item.form.componentProps.isSearchList = false
// }
// if(item.field == 'poLine'){
// item.form.componentProps.disabled = true
// item.form.componentProps.isSearchList = true
// }
// }
})
}
// /
const detailValidate = (data) => {
let tag = false;
if(data.qty <= 0){
message.warning('数量必须大于0')
tag = false;
return tag;
}else {
tag = true;
return tag;
}
}
/** 初始化 **/
@ -290,5 +433,4 @@ onMounted(async () => {
getList()
importTemplateData.templateUrl = await DeviceMaintenanceMainApi.importTemplate()
})
</script>

Loading…
Cancel
Save