Browse Source

维修工单主子表

master
zhang_li 10 months ago
parent
commit
9781baa8f0
  1. 4
      .env.development
  2. 36
      src/api/eam/device/deviceMaintenanceDetail/index.ts
  3. 15
      src/components/BasicForm/src/BasicForm.vue
  4. 181
      src/components/Detail/src/Detail.vue
  5. 557
      src/components/Detail/src/DetailDeviceLedger.vue
  6. 87
      src/components/SearchTable/src/SearchTable.vue
  7. 3
      src/components/SearchTableItem/index.ts
  8. 144
      src/components/SearchTableItem/src/SearchTableItem.vue
  9. 4
      src/utils/disposition/tabsList.ts
  10. 16
      src/views/eam/device/deviceAccounts/index.vue
  11. 90
      src/views/eam/device/deviceMaintenanceMain/deviceMaintenanceMain.data.ts
  12. 83
      src/views/eam/device/deviceMaintenanceMain/index.vue

4
.env.development

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

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

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

15
src/components/BasicForm/src/BasicForm.vue

@ -104,10 +104,12 @@
<ButtonBase :Butttondata="Butttondata" @button-base-click="buttonBaseClick" /> <ButtonBase :Butttondata="Butttondata" @button-base-click="buttonBaseClick" />
</template> </template>
</Dialog> </Dialog>
<SearchTable ref="searchTableRef" @searchTableSuccess="searchTableSuccess" /> <SearchTableItem ref="searchTableRef" v-if="isSearchTableItem" @searchTableSuccess="searchTableSuccess" />
<SearchTable ref="searchTableRef" v-else @searchTableSuccess="searchTableSuccess" />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { SearchTable } from '@/components/SearchTable' import { SearchTable } from '@/components/SearchTable'
import { SearchTableItem } from '@/components/SearchTableItem'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
import ButtonBase from '@/components/XButton/src/ButtonBase.vue' import ButtonBase from '@/components/XButton/src/ButtonBase.vue'
import TableForm from '@/components/TableForm/src/TableForm.vue' import TableForm from '@/components/TableForm/src/TableForm.vue'
@ -232,6 +234,12 @@ const props = defineProps({
required: false, required: false,
default: null default: null
}, },
//
isSearchTableItem: {
type: Boolean,
required: false,
default: false
},
}) })
const { t } = useI18n() // const { t } = useI18n() //
@ -360,12 +368,11 @@ const open = async (type: string, row?: any, masterParmas?: any) => {
if (masterParmas) { if (masterParmas) {
if (!row) { if (!row) {
row = { row = {
masterId: masterParmas.masterId, maintenanceNumber: masterParmas.maintenanceNumber,
number: masterParmas.number
} }
} }
} }
if (row?.id || row?.masterId) { if (row?.id || row?.maintenanceNumber) {
formLoading.value = true formLoading.value = true
try { try {
nextTick(() => { nextTick(() => {

181
src/components/Detail/src/Detail.vue

@ -33,7 +33,7 @@
<TableHead <TableHead
v-if="!isBasic" v-if="!isBasic"
:HeadButttondata="HeadButttondata" :HeadButttondata="HeadButttondata"
:masterId="masterParmas.masterId" :number="masterParmas.maintenanceNumber"
@button-base-click="buttonBaseClick" @button-base-click="buttonBaseClick"
:routeName="routeName" :routeName="routeName"
@searchFormClick="searchFormClick" @searchFormClick="searchFormClick"
@ -73,7 +73,13 @@
v-model:currentPage="tableObjectRef.currentPage" v-model:currentPage="tableObjectRef.currentPage"
> >
<template #photos="{ row }"> <template #photos="{ row }">
<div v-for="(item,index) in row.photos.split(',')" :key="index" style="color:#409eff ; cursor: pointer;" @click="openImage(item)">{{ item }}</div> <div
v-for="(item, index) in row.photos.split(',')"
:key="index"
style="color: #409eff; cursor: pointer"
@click="openImage(item)"
>{{ item }}</div
>
</template> </template>
<template #action="{ row }"> <template #action="{ row }">
<ButtonBase <ButtonBase
@ -117,21 +123,19 @@
@selectChangeDetail="selectChangeDetail" @selectChangeDetail="selectChangeDetail"
:formTypeDetail="formTypeDetail" :formTypeDetail="formTypeDetail"
:countPlanAllList="countPlanAllList" :countPlanAllList="countPlanAllList"
:isSearchTableItem="isSearchTableItem"
/> />
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
// import Annex from '@/components/Annex/src/Annex.vue'
// import Remarks from '@/components/Remarks/src/Remarks.vue'
// import ChangeRecord from '@/components/ChangeRecord/src/ChangeRecord.vue'
import Tabs from '@/components/Tabs/src/Tabs.vue' import Tabs from '@/components/Tabs/src/Tabs.vue'
// import * as RemarkApi from '@/api/wms/remark'
// import * as FileApi from '@/api/wms/file'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
import BasicForm from '@/components/BasicForm/src/BasicForm.vue' import BasicForm from '@/components/BasicForm/src/BasicForm.vue'
import TableHead from '@/components/TableHead/src/TableHead.vue' import TableHead from '@/components/TableHead/src/TableHead.vue'
import DetailTable from '@/components/DetailTable/src/DetailTable.vue' import DetailTable from '@/components/DetailTable/src/DetailTable.vue'
import { isString } from '@/utils/is'
import { Console } from 'console'
defineOptions({ name: 'Detail' }) defineOptions({ name: 'Detail' })
@ -239,7 +243,7 @@ const props = defineProps({
buttondataTable: { buttondataTable: {
type: Array, type: Array,
required: false, required: false,
default: ()=>{ default: () => {
return [] return []
} }
}, },
@ -256,11 +260,17 @@ const props = defineProps({
default: null default: null
}, },
// //
detailButtonIsShow:{ detailButtonIsShow: {
type: Boolean, type: Boolean,
required: false, required: false,
default: false default: false
} },
//
isSearchTableItem: {
type: Boolean,
required: false,
default: false
},
}) })
const isShowDrawer = ref(false) const isShowDrawer = ref(false)
const detailLoading = ref(false) const detailLoading = ref(false)
@ -287,8 +297,6 @@ if (props.isBasic == true) {
if (tabsList.value) { if (tabsList.value) {
} }
// Tabs // Tabs
const current = ref(0) const current = ref(0)
const change = (item, index) => { const change = (item, index) => {
@ -298,9 +306,9 @@ const change = (item, index) => {
// //
const masterParmas = ref({ const masterParmas = ref({
masterId: '', //id maintenanceNumber: '' //id
number: '', // // number: '', //
status: '' // // status: '' //
}) })
// //
@ -318,11 +326,11 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
// //
if (!props.isBasic) { if (!props.isBasic) {
// id // id
masterParmas.value.masterId = row.id masterParmas.value.maintenanceNumber = row.number
masterParmas.value.number = row.number // masterParmas.value.number = row.number
masterParmas.value.status = row.status // masterParmas.value.status = row.status
tableObjectRef.value.params = { tableObjectRef.value.params = {
masterId: row.id maintenanceNumber: row.number
} }
await getList() await getList()
} }
@ -331,66 +339,26 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
detailLoading.value = true detailLoading.value = true
try { try {
detailData.value = row detailData.value = row
getRemarkList() setBeiJian()
getFileList()
getChangeRecordList() let detailButtonAdd: any = []
// detailButtonAdd = [
if (routeName.value.indexOf('Job') > -1) {
HeadButttondata.value = [
defaultButtons.defaultFilterBtn(null) //
]
} else {
if(!props.detailButtonIsShow){
HeadButttondata.value = [
defaultButtons.defaultAddBtn({
hide: isShowMainButton(row, ['1'])
}), //
defaultButtons.defaultFilterBtn(null) //
]
}
//
if (props.fromeWhere == 'countPlan') {
HeadButttondata.value = [
defaultButtons.defaultAddBtn({ defaultButtons.defaultAddBtn({
hide: isShowMainButton(row, ['1']) hide: isShowMainButton(row, ['1'])
}) // })
]
}
//
if (props.fromeWhere == 'putawayRequest') {
HeadButttondata.value = [
defaultButtons.defaultFilterBtn(null) //
]
}
//
if (props.fromeWhere == 'countadjustRequest') {
HeadButttondata.value = [
defaultButtons.defaultFilterBtn(null) //
]
}
//
if (props.fromeWhere == 'purchasereceipt') {
HeadButttondata.value = [
defaultButtons.defaultFilterBtn(null) //
]
}
//
if (props.fromeWhere == 'customerreceipt') {
HeadButttondata.value = [
defaultButtons.defaultFilterBtn(null) //
] ]
} HeadButttondata.value = [...detailButtonAdd]
}
// //
if(!props.detailButtonIsShow){ if (!props.detailButtonIsShow) {
buttondata.value = [...[ buttondata.value = [
...[
defaultButtons.mainListEditBtn({ defaultButtons.mainListEditBtn({
hide: isShowMainButton(row, ['1']) hide: isShowMainButton(row, ['1'])
}), // }), //
defaultButtons.mainListDeleteBtn({ defaultButtons.mainListDeleteBtn({
hide: isShowMainButton(row, ['1']) hide: isShowMainButton(row, ['1'])
})], // })
], //
...props.buttondataTable ...props.buttondataTable
] ]
} }
@ -399,9 +367,23 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
} }
} }
} }
defineExpose({ openDetail }) // open //
const setBeiJian = () => {
let isItemNUmbersTrue = false
isItemNUmbersTrue = detailAllSchemasRef.value.tableColumns.some(
(item) => item.field == 'itemNumbers1'
)
if (!isItemNUmbersTrue) return
tableObjectRef.value.tableList.forEach((item) => {
if (item.itemNumbers?.length > 0) {
let str = ''
item.itemNumbers.forEach((element) => {
str += element.name + ':' + element.qty + ','
})
item.itemNumbers1 = str.substring(0, str.length - 1)
}
})
}
const tableObjectRef = ref() const tableObjectRef = ref()
const tableMethodsRef = ref() const tableMethodsRef = ref()
const detailAllSchemasRef = ref() const detailAllSchemasRef = ref()
@ -416,11 +398,7 @@ detailAllSchemasRef.value = props.detailAllSchemas
// //
const isShowMainButton = (row, val) => { const isShowMainButton = (row, val) => {
if (val.indexOf(row.status) > -1) {
return false return false
} else {
return true
}
} }
// //
@ -463,33 +441,36 @@ const buttonTableClick = async (val, row) => {
// //
handleDelete(row.id) handleDelete(row.id)
} else { } else {
emit('tableFormButton',val, row) emit('tableFormButton', val, row)
} }
} }
/** 添加/修改操作 */ /** 添加/修改操作 */
const formRef = ref() const formRef = ref()
const openForm = async (type: string, row?: number) => { const openForm = async (type: string, row?: number) => {
if (row) {
if (detailAllSchemasRef.value?.tableColumns?.length > 0) {
let isTrue = false
let isItemNUmbersTrue = false
isTrue = detailAllSchemasRef.value.tableColumns.some((item) => item.field == 'maintenances')
isItemNUmbersTrue = detailAllSchemasRef.value.tableColumns.some(
(item) => item.field == 'itemNumbers'
)
if (isTrue) {
if (row.maintenances && isString(row.maintenances)) {
row.maintenances = row.maintenances.split(',').map(Number)
}
}
}
}
formRef.value.open(type, row, masterParmas.value) formRef.value.open(type, row, masterParmas.value)
} }
// form // form
const submitForm = async (formType, data) => { const submitForm = async (formType, data) => {
try { try {
// detailValidate emit('detailSubmitForm', formType, data, getList, formRef.value)
const rs = (await props.detailValidate) ? props.detailValidate(data) : true
if (!rs) return
if (formType === 'create') {
await props.apiCreate(data)
message.success(t('common.createSuccess'))
} else {
await props.apiUpdate(data)
message.success(t('common.updateSuccess'))
}
formRef.value.dialogVisible = false
//
await getList()
updateKey.value += 1
} finally { } finally {
formRef.value.formLoading = false // formRef.value.formLoading = false
} }
} }
@ -504,7 +485,8 @@ const emit = defineEmits([
'selectChangeDetail', 'selectChangeDetail',
'detailOpenForm', 'detailOpenForm',
'tableFormButton', 'tableFormButton',
'openImage' 'openImage',
'detailSubmitForm'
]) ])
/** 删除按钮操作 */ /** 删除按钮操作 */
const handleDelete = async (id: number) => { const handleDelete = async (id: number) => {
@ -517,6 +499,7 @@ const handleDelete = async (id: number) => {
// //
await getList() await getList()
updateKey.value += 1 updateKey.value += 1
setBeiJian()
} catch {} } catch {}
} }
// //
@ -528,7 +511,7 @@ const searchFormClick = async (searchData) => {
isSearch: true, isSearch: true,
filters: searchData.filters filters: searchData.filters
? searchData.filters ? searchData.filters
: [{ column: 'masterId', action: '==', value: masterParmas.value.masterId }] : [{ column: 'number', action: '==', value: masterParmas.value.maintenanceNumber }]
} }
detailAllSchemasRef.value = props.detailAllSchemas detailAllSchemasRef.value = props.detailAllSchemas
tableObjectRef.value = tableObject tableObjectRef.value = tableObject
@ -550,9 +533,11 @@ const selectChangeDetail = (field, val) => {
emit('selectChangeDetail', field, val) emit('selectChangeDetail', field, val)
} }
// //
const openImage=(item)=>{ const openImage = (item) => {
emit('openImage', item) emit('openImage', item)
} }
defineExpose({ openDetail, tableObject }) // open
// //
watch( watch(
() => props.apiPage, () => props.apiPage,
@ -560,10 +545,10 @@ watch(
const { tableObject, tableMethods } = useTable({ const { tableObject, tableMethods } = useTable({
getListApi: props.apiPage // getListApi: props.apiPage //
}) })
tableObject.params.masterId = masterParmas.value.masterId tableObject.params.maintenanceNumber = masterParmas.value.maintenanceNumber
detailAllSchemasRef.value = props.detailAllSchemas detailAllSchemasRef.value = props.detailAllSchemas
if (props.tableObjectExtend) { if (props.tableObjectExtend) {
props.tableObjectExtend.forEach(item => { props.tableObjectExtend.forEach((item) => {
tableObject.params[item.key] = item.value tableObject.params[item.key] = item.value
}) })
} }

557
src/components/Detail/src/DetailDeviceLedger.vue

@ -0,0 +1,557 @@
<template>
<div>
<el-drawer
v-model="isShowDrawer"
title="详情"
direction="rtl"
size="80%"
v-loading="detailLoading"
>
<template #header>
<div class="font-size-18px">
{{ titleValueRef }} <span class="ml-20px font-size-16px">{{ titleNameRef }}</span>
</div>
</template>
<ContentWrap>
<Descriptions
:data="detailData"
labelClassName="label-class-name"
label-align="left"
direction="vertical"
:column="8"
:schema="allSchemas.detailSchema"
:columns="2"
width="200px"
/>
</ContentWrap>
<Tabs :tabsList="tabsList" :current="current" @change="change" />
<div class="flex">
<!-- 详情 -->
<ContentWrap class="w-[100%]">
<!-- 列表头部 -->
<TableHead
v-if="!isBasic"
:HeadButttondata="HeadButttondata"
:number="masterParmas.number"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@searchFormClick="searchFormClick"
:allSchemas="detailAllSchemas"
/>
<!-- 默认单表展现 -->
<Descriptions
v-if="isBasic && !tabsExtend"
:data="detailData"
:schema="allSchemas.detailSchema"
:columns="2"
/>
<!-- 单表切换tabs 展现table -->
<Table
v-if="isBasic && tabsExtend"
:columns="detailAllSchemasRef.tableColumns"
:data="tableObjectRef.tableList"
:loading="tableObjectRef.loading"
:pagination="{ total: tableObjectRef.total }"
v-model:pageSize="tableObjectRef.pageSize"
v-model:currentPage="tableObjectRef.currentPage"
>
<!-- <template #action="{ row }">
<ButtonBase
:Butttondata="buttondata"
@button-base-click="buttonTableClick($event, row)"
/>
</template> -->
</Table>
<Table
v-if="!isBasic && fromeWhere != 'countPlan'"
:columns="detailAllSchemasRef.tableColumns"
:data="tableObjectRef.tableList"
:loading="tableObjectRef.loading"
:pagination="{ total: tableObjectRef.total }"
v-model:pageSize="tableObjectRef.pageSize"
v-model:currentPage="tableObjectRef.currentPage"
>
<template #photos="{ row }">
<div v-for="(item,index) in row.photos.split(',')" :key="index" style="color:#409eff ; cursor: pointer;" @click="openImage(item)">{{ item }}</div>
</template>
<template #action="{ row }">
<ButtonBase
:Butttondata="buttondata"
@button-base-click="buttonTableClick($event, row)"
/>
</template>
</Table>
<DetailTable
v-if="!isBasic && fromeWhere == 'countPlan' && isShowDrawer"
:columns="detailAllSchemasRef.tableColumns"
:data="tableObjectRef.tableList"
:allList="allList"
:countScopeType="countScopeType"
:key="updateKey"
>
<template #action="{ row }">
<ButtonBase
:Butttondata="buttondata"
@button-base-click="buttonTableClick($event, row)"
/>
</template>
</DetailTable>
</ContentWrap>
</div>
</el-drawer>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="formRef"
@success="submitForm"
:rules="detailAllSchemasRules"
:formAllSchemas="detailAllSchemas"
:isBusiness="false"
:apiUpdate="apiUpdate"
:apiCreate="apiCreate"
:fromeWhere="fromeWhere"
:isDetail="true"
@searchTableSuccess="searchTableSuccess"
:detailData="detailData"
@submitForm="submitForm"
@selectChangeDetail="selectChangeDetail"
:formTypeDetail="formTypeDetail"
:countPlanAllList="countPlanAllList"
/>
</div>
</template>
<script lang="ts" setup>
import Tabs from '@/components/Tabs/src/Tabs.vue'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import BasicForm from '@/components/BasicForm/src/BasicForm.vue'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import DetailTable from '@/components/DetailTable/src/DetailTable.vue'
defineOptions({ name: 'Detail' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
routeName.value = routeName.value.substring(0, routeName.value.length - 4) + 'Detail'
const updateKey = ref(0)
const props = defineProps({
//
tabs: {
type: Object,
required: true,
default: null
},
//
isBasic: {
type: Boolean,
required: false,
default: false
},
//
allSchemas: {
type: Object,
required: true,
default: null
},
//
detailAllSchemas: {
type: Object,
required: true,
default: null
},
//
detailAllSchemasRules: {
type: Object,
required: true,
default: null
},
// API
apiCreate: {
type: Function,
required: false,
default: null
},
// API
apiUpdate: {
type: Function,
required: false,
default: null
},
// API
apiPage: {
type: Function,
required: false,
default: null
},
// API
apiDelete: {
type: Function,
required: false,
default: null
},
//
detailValidate: {
type: Function,
required: false,
default: null
},
// countPlan
fromeWhere: {
type: String,
required: false,
default: ''
},
//
allList: {
type: Object,
required: true,
default: null
},
//
countScopeType: {
type: Array,
required: false,
default: null
},
//
formTypeDetail: {
type: String,
required: false,
default: 'InputString'
},
//
countPlanAllList: {
type: Array,
required: false,
default: null
},
//
buttondataTable: {
type: Array,
required: false,
default: ()=>{
return []
}
},
// tabs table false
tabsExtend: {
type: Boolean,
required: false,
default: false
},
// tableObject
tableObjectExtend: {
type: Array,
required: false,
default: null
},
//
detailButtonIsShow:{
type: Boolean,
required: false,
default: false
}
})
const isShowDrawer = ref(false)
const detailLoading = ref(false)
const tabsList = ref(JSON.parse(JSON.stringify(props.tabs ? props.tabs : '')))
// Tabs
const current = ref(0)
const change = (item, index) => {
current.value = index
emit('changeTabs', item)
}
//
const masterParmas = ref({
number: '', //id
// number: '', //
// status: '' //
})
//
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
//
if (!props.isBasic) {
// id
masterParmas.value.number = row.number
// masterParmas.value.number = row.number
// masterParmas.value.status = row.status
tableObjectRef.value.params = {
number: row.number
}
await getList()
}
isShowDrawer.value = true
if (row) {
detailLoading.value = true
try {
detailData.value = row
//
if (routeName.value.indexOf('Job') > -1) {
HeadButttondata.value = [
defaultButtons.defaultFilterBtn(null) //
]
} else {
if(!props.detailButtonIsShow){
HeadButttondata.value = [
defaultButtons.defaultAddBtn({
hide: isShowMainButton(row, ['1'])
}), //
defaultButtons.defaultFilterBtn(null) //
]
}
//
if (props.fromeWhere == 'countPlan') {
HeadButttondata.value = [
defaultButtons.defaultAddBtn({
hide: isShowMainButton(row, ['1'])
}) //
]
}
//
if (props.fromeWhere == 'putawayRequest') {
HeadButttondata.value = [
defaultButtons.defaultFilterBtn(null) //
]
}
//
if (props.fromeWhere == 'countadjustRequest') {
HeadButttondata.value = [
defaultButtons.defaultFilterBtn(null) //
]
}
//
if (props.fromeWhere == 'purchasereceipt') {
HeadButttondata.value = [
defaultButtons.defaultFilterBtn(null) //
]
}
//
if (props.fromeWhere == 'customerreceipt') {
HeadButttondata.value = [
defaultButtons.defaultFilterBtn(null) //
]
}
}
//
if(!props.detailButtonIsShow){
buttondata.value = [...[
defaultButtons.mainListEditBtn({
hide: isShowMainButton(row, ['1'])
}), //
defaultButtons.mainListDeleteBtn({
hide: isShowMainButton(row, ['1'])
})], //
...props.buttondataTable
]
}
} finally {
detailLoading.value = false
}
}
}
defineExpose({ openDetail }) // open
const tableObjectRef = ref()
const tableMethodsRef = ref()
const detailAllSchemasRef = ref()
const { tableObject, tableMethods } = useTable({
getListApi: props.apiPage //
})
tableObjectRef.value = tableObject
tableMethodsRef.value = tableMethods
detailAllSchemasRef.value = props.detailAllSchemas
//
const isShowMainButton = (row, val) => {
if (val.indexOf(row.status) > -1) {
return false
} else {
return true
}
}
//
const { getList } = tableMethodsRef.value
//
const buttonBaseClick = (val, item) => {
if (val == 'add') {
//
openForm('create')
} else if (val == 'import') {
//
handleImport()
} else if (val == 'export') {
//
handleExport()
} else if (val == 'refresh') {
//
getList()
} else if (val == 'filtrate') {
//
} else {
//
console.log('其他按钮', item)
}
}
//
// const updataTableColumns = (val) => {
// detailAllSchemas.tableColumns.value = val
// }
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') {
//
openForm('update', row)
emit('detailOpenForm', row)
} else if (val == 'delete') {
//
handleDelete(row.id)
} else {
emit('tableFormButton',val, row)
}
}
/** 添加/修改操作 */
const formRef = ref()
const openForm = async (type: string, row?: number) => {
formRef.value.open(type, row, masterParmas.value)
}
// form
const submitForm = async (formType, data) => {
try {
// detailValidate
const rs = (await props.detailValidate) ? props.detailValidate(data) : true
if (!rs) return
if (formType === 'create') {
await props.apiCreate(data)
message.success(t('common.createSuccess'))
} else {
await props.apiUpdate(data)
message.success(t('common.updateSuccess'))
}
formRef.value.dialogVisible = false
//
await getList()
updateKey.value += 1
} finally {
formRef.value.formLoading = false
}
}
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
emit('searchTableSuccessDetail', formField, searchField, val, formRef)
}
//
const emit = defineEmits([
'searchTableSuccessDetail',
'changeTabs',
'selectChangeDetail',
'detailOpenForm',
'tableFormButton',
'openImage'
])
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await props.apiDelete(id)
message.success(t('common.delSuccess'))
//
await getList()
updateKey.value += 1
} catch {}
}
//
const searchFormClick = async (searchData) => {
const { tableObject, tableMethods } = useTable({
getListApi: props.apiPage //
})
tableObject.params = {
isSearch: true,
filters: searchData.filters
? searchData.filters
: [{ column: 'number', action: '==', value: masterParmas.value.number }]
}
detailAllSchemasRef.value = props.detailAllSchemas
tableObjectRef.value = tableObject
tableMethodsRef.value = tableMethods
tableObjectRef.value.tableList = []
const { getList } = tableMethods
await getList()
updateKey.value += 1
// tableObjectRef.value.params = {
// isSearch: true,
// filters: searchData.filters
// ? searchData.filters
// : [{ column: 'masterId', action: '==', value: masterParmas.value.masterId }]
// }
// getList() //
}
//
const selectChangeDetail = (field, val) => {
emit('selectChangeDetail', field, val)
}
//
const openImage=(item)=>{
emit('openImage', item)
}
//
watch(
() => props.apiPage,
() => {
const { tableObject, tableMethods } = useTable({
getListApi: props.apiPage //
})
tableObject.params.number = masterParmas.value.number
detailAllSchemasRef.value = props.detailAllSchemas
if (props.tableObjectExtend) {
props.tableObjectExtend.forEach(item => {
tableObject.params[item.key] = item.value
})
}
tableObjectRef.value = tableObject
tableMethodsRef.value = tableMethods
const { getList } = tableMethods
getList()
}
)
</script>
<style lang="scss">
.el-drawer__body {
background: #f5f5f5 !important;
}
::v-deep(.label-class-name) {
color: #dedede;
}
</style>
<style scoped lang="scss"></style>

87
src/components/SearchTable/src/SearchTable.vue

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

3
src/components/SearchTableItem/index.ts

@ -0,0 +1,3 @@
import SearchTableItem from './src/SearchTableItem.vue'
export { SearchTableItem }

144
src/components/SearchTableItem/src/SearchTableItem.vue

@ -0,0 +1,144 @@
<template>
<Dialog :title="dialogTitle" v-model="searchDialogVisible" :width="'80%'">
<ContentWrap>
<Table
ref="searchTableRef"
:columns="tableColumns"
:data="tableObjectRef.tableList"
:loading="tableObjectRef.loading"
:selection="true"
:reserveSelection="true"
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">
<el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button>
<el-button @click="searchDialogVisible = false"> </el-button>
</div>
</template>
</Dialog>
</template>
<script setup lang="ts">
import * as defaultButtons from '@/utils/disposition/defaultButtons'
// const { t } = useI18n() //
const message = useMessage() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const searchDialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
/** 打开弹窗 */
const getListRef = ref()
const setSearchParamsRef = ref()
const tableObjectRef = ref({
tableList: '',
loading: false,
params: {}
})
const getPage: any = ref()
const searchSchema = ref()
const tableColumns = ref()
const formFieldRef = ref()
const searchFieldRef = ref()
const typeRef = ref()
const rowRef = ref()
const allSchemasRef = ref()
const multipleBol = ref(false)
const searchConditionRef = ref()
const open = (
titleName: any,
allSchemas: any,
getApiPage: any,
formField: any,
searchField: any,
multiple: any,
type: any,
row: any,
searchCondition: any,
isCountRequestRe: any
) => {
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')
getPage.value = getApiPage
typeRef.value = type
rowRef.value = row
multipleBol.value = multiple
dialogTitle.value = titleName
const getList = async () => {
await getPage.value(searchCondition).then((res) => {
tableObjectRef.value.tableList = res
})
}
console.log(tableObjectRef.value)
getList()
}
defineExpose({ open }) // open
// Table ref
const searchTableRef = ref()
/** 提交表单 */
const emit = defineEmits(['searchTableSuccess']) // searchTableSuccess
const submitForm = async () => {
//
formLoading.value = true
const selections = searchTableRef.value.selections
//
if (!multipleBol.value) {
if (selections.length > 1 || selections.length == 0) {
message.warning('请选择一条数据!')
formLoading.value = false
return
}
//
} else {
if (selections.length == 0) {
message.warning('至少选择一条数据!')
formLoading.value = false
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 {
formLoading.value = false
}
}
</script>
<style scoped lang="scss">
</style>

4
src/utils/disposition/tabsList.ts

@ -1,5 +1,5 @@
// 页面tabs标签 // 设备台账tabs标签
export const ItemBasicTabsList = [{ export const DeviceLedgerTabsList = [{
label: "设备信息", label: "设备信息",
prop: 'info', prop: 'info',
}, },

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

@ -50,6 +50,7 @@
:isBusiness="false" :isBusiness="false"
/> />
<SearchTable <SearchTable
ref="searchTableRef" ref="searchTableRef"
@searchTableSuccess="submitItem" @searchTableSuccess="submitItem"
@ -57,12 +58,11 @@
/> />
<!-- 详情 --> <!-- 详情 -->
<!-- <Detail ref="detailRef" :isBasic="true" :allSchemas="DeviceAccounts.allSchemas" /> --> <DetailDeviceLedger
<Detail
ref="detailRef" ref="detailRef"
:tabs="ItemBasicTabsList" :tabs="DeviceLedgerTabsList"
:isBasic="true" :isBasic="true"
:allSchemas="DeviceAccounts.allSchemas" :allSchemas="allSchemas"
@changeTabs="changeTabs" @changeTabs="changeTabs"
:detailAllSchemas="detailAllSchemas" :detailAllSchemas="detailAllSchemas"
:apiPage="apiPage" :apiPage="apiPage"
@ -81,10 +81,10 @@ import { Item } from '@/views/eam/basic/item/item.data'
import { createDeviceItemBatch,getDeviceItemPage } from '@/api/eam/basic/rel' 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 { ItemBasicTabsList } from '@/utils/disposition/tabsList' import { DeviceLedgerTabsList } from '@/utils/disposition/tabsList'
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 DetailDeviceLedger from '@/components/Detail/src/DetailDeviceLedger.vue'
import * as ItemApi from '@/api/eam/basic/item' import * as ItemApi from '@/api/eam/basic/item'
defineOptions({ name: 'DeviceAccounts' }) defineOptions({ name: 'DeviceAccounts' })
@ -98,6 +98,10 @@ const deviceNumber = ref();
routeName.value = route.name routeName.value = route.name
const tableColumns = ref(DeviceAccounts.allSchemas.tableColumns) const tableColumns = ref(DeviceAccounts.allSchemas.tableColumns)
const allSchemas = ref(Item.allSchemas)
const detailAllSchemas = ref()
const apiPage = ref()
// //
const searchTableSuccess = (formField, searchField, val, formRef) => { const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => { nextTick(() => {

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

@ -40,10 +40,13 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
table: { table: {
width: '150', width: '150',
}, },
isForm: false,
isSearch: true,
isTable: true,
}, },
{ {
label: '设备', label: '设备模具编号',
field: 'deviceNumber', field: 'deviceNumber',
sort: 'custom', sort: 'custom',
table: { table: {
@ -202,59 +205,48 @@ export const DeviceMaintenanceDetail = useCrudSchemas(reactive<CrudSchema[]>([
field: 'describes', field: 'describes',
sort: 'custom', sort: 'custom',
table: { table: {
width: '150',
}, },
isForm: false,
isSearch: false, isSearch: false,
isTable: false,
}, },
{ {
label: '故障真因', label: '故障真因',
field: 'describes1', field: 'describes1',
sort: 'custom', sort: 'custom',
table: { table: {
width: '150',
}, },
isForm: false,
isSearch: false, isSearch: false,
isTable: false,
}, },
{ {
label: '解决措施', label: '解决措施',
field: 'workOut', field: 'workOut',
sort: 'custom', sort: 'custom',
table: { table: {
width: '150',
}, },
isForm: false,
isSearch: false, isSearch: false,
isTable: false,
}, },
{ {
label: '维修人', label: '维修人',
field: 'maintenances', field: 'maintenances',
sort: 'custom', sort: 'custom',
table: {
width: '150',
},
api: () => userList, api: () => userList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => { formatter: (_: Recordable, __: TableColumn, cellValue) => {
return userList.find((account) => account.id == cellValue)?.name return userList.filter(item=>cellValue.includes(item.id)).map(cur=>cur.name).join(',')
}, },
search: { tableForm: {
show: true, type: 'Select',
component: 'Select', initOptions: userList,
api: () => userList, multiple:true,
componentProps: { collapseTags:true,
collapseTagsTooltip:true,
optionsAlias: { optionsAlias: {
labelField: 'name', labelField: 'name',
valueField: 'id' valueField: 'id'
} }
}
}, },
tableForm: { form:{
type: 'Select', component: 'Select',
initOptions: userList, api: () => userList,
componentProps: {
multiple:true, multiple:true,
collapseTags:true, collapseTags:true,
collapseTagsTooltip:true, collapseTagsTooltip:true,
@ -263,18 +255,18 @@ export const DeviceMaintenanceDetail = useCrudSchemas(reactive<CrudSchema[]>([
valueField: 'id' valueField: 'id'
} }
} }
}
}, },
{ {
label: '备件', label: '备件',
field: 'itemNUmbers', field: 'itemNumbers1',
sort: 'custom', sort: 'custom',
table: { table: {
width: '150',
}, },
tableForm:{ tableForm:{
isInpuFocusShow: true, // 开启查询弹窗 isInpuFocusShow: true, // 开启查询弹窗
searchListPlaceholder: '请选择备件', searchListPlaceholder: '请选择备件',
searchField: 'itemNUmbers', searchField: 'itemNumbers1',
searchTitle: '备件', searchTitle: '备件',
multiple:true, multiple:true,
searchAllSchemas: ItemSearchTable.allSchemas, searchAllSchemas: ItemSearchTable.allSchemas,
@ -286,10 +278,48 @@ export const DeviceMaintenanceDetail = useCrudSchemas(reactive<CrudSchema[]>([
isMainValue: true isMainValue: true
}] }]
}, },
isForm: false, form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择备件', // 输入框占位文本
searchField: 'itemNumbers1', // 查询弹窗赋值字段
searchTitle: '备件', // 查询弹窗标题
multiple:true,
searchAllSchemas: ItemSearchTable.allSchemas, // 查询弹窗所需类
searchPage: ItemApi.getItemList, // 查询弹窗所需分页方法
searchCondition: [{
key: 'deviceNumber',
value: 'deviceNumber',
message: '请选择设备模具编号!',
isMainValue: true
}]
}
},
isSearch: false,
},
{
label: '备件1',
field: 'itemNumbers',
sort: 'custom',
table: {
},
isForm:false,
isDetail:false,
isTable:false,
isSearch: false, isSearch: false,
isTable: false, isTableForm: false,
}, },
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 300,
fixed: 'right'
},
isDetail:false
}
])) ]))
// 表单校验 // 表单校验
export const DeviceMaintenanceDetailRules = reactive({ export const DeviceMaintenanceDetailRules = reactive({
@ -297,5 +327,5 @@ export const DeviceMaintenanceDetailRules = reactive({
describes1: [required], describes1: [required],
workOut: [required], workOut: [required],
maintenance: [required], maintenance: [required],
itemNUmbers: [required], itemNumbers: [required],
}) })

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

@ -61,24 +61,27 @@
@handleDeleteTable="handleDeleteTable" @handleDeleteTable="handleDeleteTable"
@searchTableSuccess="searchTableSuccess" @searchTableSuccess="searchTableSuccess"
@submitForm="submitForm" @submitForm="submitForm"
:isSearchTableItem="true"
/> />
<!-- 详情 --> <!-- 详情 -->
<!-- <Detail ref="detailRef" :isBasic="true" :allSchemas="DeviceMaintenanceMain.allSchemas" /> --> <!-- <Detail ref="detailRef" :isBasic="true" :allSchemas="DeviceMaintenanceMain.allSchemas" /> -->
<Detail <Detail
ref="detailRef" ref="detailRef"
:isBasic="true" :isBasic="false"
:allSchemas="DeviceMaintenanceMain.allSchemas" :allSchemas="DeviceMaintenanceMain.allSchemas"
:detailAllSchemas="DeviceMaintenanceDetail.allSchemas" :detailAllSchemas="DeviceMaintenanceDetail.allSchemas"
:detailAllSchemasRules="DeviceMaintenanceDetailRules" :detailAllSchemasRules="DeviceMaintenanceDetailRules"
:apiCreate="DeviceMaintenanceDetailApi.createPurchasereturnRequestDetail" :apiCreate="DeviceMaintenanceDetailApi.createDeviceMaintenanceDetail"
:apiUpdate="DeviceMaintenanceDetailApi.updatePurchasereturnRequestDetail" :apiUpdate="DeviceMaintenanceDetailApi.updateDeviceMaintenanceDetail"
:apiPage="DeviceMaintenanceDetailApi.getPurchasereturnRequestDetailPage" :apiPage="DeviceMaintenanceDetailApi.getDeviceMaintenanceDetailPage"
:apiDelete="DeviceMaintenanceDetailApi.deletePurchasereturnRequestDetail" :apiDelete="DeviceMaintenanceDetailApi.deleteDeviceMaintenanceDetail"
:Echo="Echo" :Echo="Echo"
@searchTableSuccessDetail="searchTableSuccessDetail" @searchTableSuccessDetail="searchTableSuccessDetail"
@detailOpenForm="detailOpenForm" @detailOpenForm="detailOpenForm"
:detailValidate="detailValidate" :detailValidate="detailValidate"
@detailSubmitForm="detailSubmitForm"
:isSearchTableItem="true"
/> />
<!-- 导入 --> <!-- 导入 -->
@ -120,20 +123,19 @@ const tableData = ref([])
const updataTableColumns = (val) => { const updataTableColumns = (val) => {
tableColumns.value = val tableColumns.value = val
} }
const itemNUmbers = ref()
// //
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => { const searchTableSuccess = (formField, searchField, val, formRef, type, row) => {
nextTick(() => { nextTick(() => {
if (type == 'tableForm') { if (type == 'tableForm') {
// //
if (formField == 'itemNUmbers') { if (formField == 'itemNumbers') {
let str = '' let str = ''
val.forEach((element) => { val.forEach((element) => {
str += element.name + ':' + element.qty + ',' str += element.name + ':' + element.qty + ','
}) })
str = str.substring(0, str.length - 1) str = str.substring(0, str.length - 1)
row['itemNUmbers'] = str row['itemNumbers1'] = str
row['itemNUmbers1'] = val row['itemNumbers'] = val
} }
} else { } else {
// const setV = {} // const setV = {}
@ -149,11 +151,14 @@ const searchTableSuccessDetail = (formField, searchField, val, formRef) => {
nextTick(() => { nextTick(() => {
const setV = {} const setV = {}
setV[formField] = val[0][searchField] setV[formField] = val[0][searchField]
if (formField == 'itemCode') { if (formField == 'itemNumbers1') {
setV['itemCode'] = val[0]['code'] let str = ''
} else { val.forEach((element) => {
setV['poNumber'] = val[0]['number'] str += element.name + ':' + element.qty + ','
setV['poLine'] = val[0]['lineNumber'] })
str = str.substring(0, str.length - 1)
setV['itemNumbers'] = val
setV['itemNumbers1'] = str
} }
formRef.setValues(setV) formRef.setValues(setV)
}) })
@ -186,6 +191,7 @@ const buttonBaseClick = (val, item) => {
if (val == 'add') { if (val == 'add') {
// //
DeviceMaintenanceMain.allSchemas.formSchema[3].value = 'DEVICE' DeviceMaintenanceMain.allSchemas.formSchema[3].value = 'DEVICE'
DeviceMaintenanceMain.allSchemas.formSchema[0].componentProps.disabled = false
openForm('create') openForm('create')
} else if (val == 'import') { } else if (val == 'import') {
// //
@ -242,10 +248,11 @@ const onChange = (field, cur, item) => {
if (field == 'deviceNumber') { if (field == 'deviceNumber') {
// DeviceMaintenanceMain.allSchemas.formSchema[1].componentProps.disabled = true // DeviceMaintenanceMain.allSchemas.formSchema[1].componentProps.disabled = true
// DeviceMaintenanceMain.allSchemas.formSchema[2].componentProps.disabled = true // DeviceMaintenanceMain.allSchemas.formSchema[2].componentProps.disabled = true
formRef.value.formRef.formModel.factoryAreaNumber = Number( formRef.value.formRef.formModel.factoryAreaNumber =String(item.componentProps.options.find((item) => item.number == cur).factoryAreaNumber)
item.componentProps.options.find((item) => item.number == cur).factoryAreaNumber console.log(typeof formRef.value.formRef.formModel.factoryAreaNumber)
) // console.log(item)
formRef.value.formRef.formModel.maintenance = String(userStore?.getUser?.id) // console.log(item.componentProps.options)
formRef.value.formRef.formModel.maintenance = Number(userStore?.getUser?.id)
} }
} }
// - // -
@ -369,7 +376,7 @@ const submitForm = async (formType, data) => {
return { return {
describes: item.describes, describes: item.describes,
describes1: item.describes1, describes1: item.describes1,
itemNUmbers: item.itemNUmbers1, itemNumbers: item.itemNumbers1,
maintenances: item.maintenances.join(','), maintenances: item.maintenances.join(','),
workOut: item.workOut, workOut: item.workOut,
} }
@ -417,6 +424,7 @@ const detailOpenForm = (type, row) =>{
} }
// / // /
const detailValidate = (data) => { const detailValidate = (data) => {
return true;
let tag = false; let tag = false;
if(data.qty <= 0){ if(data.qty <= 0){
message.warning('数量必须大于0') message.warning('数量必须大于0')
@ -427,6 +435,43 @@ const detailValidate = (data) => {
return tag; return tag;
} }
} }
//
const detailSubmitForm= async (formType,data,getList,formRef,tableList) => {
try {
let data1 = {
id:data.id,
maintenanceNumber:data.maintenanceNumber,
describes:data.describes,
describes1:data.describes1,
itemNumbers:data.itemNumbers,
maintenances:data.maintenances.join(','),
workOut:data.workOut,
}
console.log(data1)
if (formType === 'create') {
await DeviceMaintenanceDetailApi.createDeviceMaintenanceDetail(data1)
message.success(t('common.createSuccess'))
} else {
await DeviceMaintenanceDetailApi.updateDeviceMaintenanceDetail(data1)
message.success(t('common.updateSuccess'))
}
formRef.dialogVisible = false
//
await getList()
detailRef.value.tableObject.tableList.forEach(item=>{
if (item.itemNumbers?.length>0) {
let str = ''
item.itemNumbers.forEach(element => {
str += element.name + ':' + element.qty + ','
})
item.itemNumbers1 = str.substring(0, str.length - 1)
}
})
} finally {
formRef.formLoading = false
}
}
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {

Loading…
Cancel
Save