Browse Source

修复测试bug

master
ljlong_2630 8 months ago
parent
commit
55c00ae585
  1. 6
      src/api/infra/file/index.ts
  2. 88
      src/components/Detail/src/DetailDeviceLedger.vue
  3. 35
      src/views/eam/device/deviceAccounts/deviceAccounts.data.ts
  4. 17
      src/views/eam/device/deviceAccounts/index.vue
  5. 3
      src/views/eam/device/devicemaintainjob/index.vue
  6. 41
      src/views/eam/device/devicemaintenancejob/deviceMaintenanceMain.data.ts
  7. 16
      src/views/eam/device/devicemaintenancejob/index.vue
  8. 960
      src/views/eam/mold/moldAccounts/index.vue
  9. 656
      src/views/eam/mold/moldAccounts/moldAccounts.data.ts
  10. 11
      src/views/eam/mold/moldmaintenancejob/index.vue
  11. 41
      src/views/eam/mold/moldmaintenancejob/moldMaintenanceMain.data.ts

6
src/api/infra/file/index.ts

@ -15,3 +15,9 @@ export const getFilePage = (params: FilePageReqVO) => {
export const deleteFile = (id: number) => {
return request.delete({ url: '/infra/file/delete?id=' + id })
}
// 删除文件
export const selectList = () => {
return request.get({ url: '/infra/file/selectList' })
}

88
src/components/Detail/src/DetailDeviceLedger.vue

@ -194,8 +194,9 @@
:width="600"
:maxHeight="900"
:style="{height:'600px'}"
:key="dialogFormKey"
>
<el-form ref="fileDialogUploadRef" :model="fileDialogUploadData" :key="dialogFormKey">
<el-form ref="fileDialogUploadRef" :model="fileDialogUploadData" >
<el-form-item label="文件选择">
<UploadFile v-model="fileDialogUploadData.filePathList" :limit="20" />
</el-form-item>
@ -220,6 +221,8 @@ import BasicForm from '@/components/BasicForm/src/BasicForm.vue'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import DetailTable from '@/components/DetailTable/src/DetailTable.vue'
import { useUserStoreWithOut } from '@/store/modules/user'
import * as fileApi from '@/api/infra/file'
import { el } from 'element-plus/es/locale'
defineOptions({ name: 'Detail' })
@ -242,6 +245,7 @@ const dialogUploadNumber = ref()
const dialogUploadBusiCode = ref()
const dialogFormKey = ref(0)
const milestoneUpdateKey = ref(0)
const fileDialogUploadRef = ref()
const props = defineProps({
//
tabs: {
@ -472,6 +476,9 @@ const change = (item, index) => {
subIndex.value = 'A'
formKey.value += 1
getImage()
} else if (item.prop == 'Milestone') {
imageParmas.value.funcCode = props.milestoneFuncCode
getImage()
} else {
imageParmas.value.funcCode = ''
imageParmas.value.fileBusiType = ''
@ -591,23 +598,61 @@ defineExpose({ openDetail }) // 提供 open 方法,用于打开弹窗
//
const formKey = ref(0)
const getImage = () => {
props
fileApi.selectList().then((response) => {
props
.getImageApi({
number: masterParmas.value.number,
funcCode: imageParmas.value.funcCode,
fileBusiType: imageParmas.value.fileBusiType
})
.then((res) => {
nextTick(() => {
if (imageParmas.value.funcCode == 'device_mould_picture') {
imageFormData.value.filePathList = res
} else {
console.log(444,res)
fileFormData.value.filePathList = res
formKey.value += 1
}
nextTick(() => {
if (imageParmas.value.funcCode == 'device_mould_picture') {
imageFormData.value.filePathList = res
} else {
console.log(444,res)
fileFormData.value.filePathList = res.map(item=>{
response.forEach(element=>{
if(item.url == element.url){
item.name = element.name
}
})
return item
})
formKey.value += 1
}
})
})
})
}
const getImageDialog = () => {
fileApi.selectList().then((response) => {
props
.getImageApi({
number: masterParmas.value.number,
funcCode: imageParmas.value.funcCode,
fileBusiType: imageParmas.value.fileBusiType
})
.then((res) => {
nextTick(() => {
if (imageParmas.value.funcCode == 'device_mould_picture') {
imageFormData.value.filePathList = res
} else {
console.log(444,res)
fileDialogUploadData.value.filePathList = res.map(item=>{
response.forEach(element=>{
if(item.url == element.url){
item.name = element.name
}
})
return item
})
formKey.value += 1
}
})
})
})
}
const tableObjectRef = ref()
@ -771,7 +816,6 @@ const uploadImage = async () => {
// if (!elForm) return
// const valid = await elForm.validate()
// if (!valid) return
imageFormData
let data = {
number: masterParmas.value.number,
filePathList: imageFormData.value.filePathList.map((item) => item.url),
@ -916,7 +960,7 @@ const submitDialogForm = async (type, row) => {
}
function openDialogUpload(row) {
dialogUploadVisible.value = true
// dialogUploadVisible.value = true
getDialogUpload(row)
}
@ -929,13 +973,27 @@ const openDialogForm = async (type: string, row?: number) => {
const getDialogUpload = (row) => {
dialogUploadNumber.value = row.number
dialogUploadBusiCode.value = row.milestoneStage
masterParmas.value.number = row.number,
imageParmas.value.fileBusiType = row.milestoneStage
props.getImageApi({
number: row.number,
funcCode: props.milestoneFuncCode
})
.then((res) => {
fileDialogUploadData.value.filePathList = res
dialogFormKey.value += 1
fileApi.selectList().then(response=>{
fileDialogUploadData.value.filePathList = res.map(item=>{
response.forEach(element=>{
if(item.url == element.url){
item.name = element.name
}
})
return item
})
dialogUploadVisible.value = true
dialogFormKey.value += 1
})
})
}
@ -949,7 +1007,7 @@ function dialogUploadFile() {
props.uploadImage(data).then((res) => {
message.success('修改成功')
getImage()
dialogUploadVisible.value = false
// dialogUploadVisible.value = false
})
}

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

@ -133,6 +133,7 @@ export const DeviceAccounts = useCrudSchemas(reactive<CrudSchema[]>([
field: 'factoryAreaNumber',
sort: 'custom',
isSearch: false,
isDetail: false,
table: {
width: '150',
},
@ -166,6 +167,16 @@ export const DeviceAccounts = useCrudSchemas(reactive<CrudSchema[]>([
},
}
},
{
label: '所属厂区',
field: 'factoryAreaNumberDetail',
sort: 'custom',
isDetail: true,
isForm: false,
isSearch: false,
isTable: false,
isTableForm: false,
},
{
label: '负责人',
field: 'principal',
@ -203,6 +214,16 @@ export const DeviceAccounts = useCrudSchemas(reactive<CrudSchema[]>([
},
},
},
{
label: '负责人',
field: 'principalDetail',
sort: 'custom',
isDetail: true,
isForm: false,
isSearch: false,
isTable: false,
isTableForm: false,
},
{
label: '采购时间',
field: 'purchaseTime',
@ -251,9 +272,13 @@ export const DeviceAccounts = useCrudSchemas(reactive<CrudSchema[]>([
label: '供应商',
field: 'supplierNumber',
sort: 'custom',
isDetail: false,
table: {
width: '150',
},
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return supplierList.find((account) => account.number == cellValue)?.name
},
form:{
component: 'Select',
componentProps: {
@ -267,6 +292,16 @@ export const DeviceAccounts = useCrudSchemas(reactive<CrudSchema[]>([
}
}
},
{
label: '供应商',
field: 'supplierNumberDetail',
sort: 'custom',
isDetail: true,
isForm: false,
isSearch: false,
isTable: false,
isTableForm: false,
},
{
label: '出厂日期',
field: 'productionDate',

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

@ -57,9 +57,7 @@
import * as DeviceAccountsApi from '@/api/eam/device/deviceAccounts'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import { DeviceLedgerTabsList } from '@/utils/disposition/tabsList'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import DetailDeviceLedger from '@/components/Detail/src/DetailDeviceLedger.vue'
import { selectAllFactoryArea,selectAllFactoryAreaDept } from '@/api/system/dept'
import { DeviceRepair } from '@/views/eam/device/deviceRepair/deviceRepair.data'
import { DeviceItem } from '@/views/eam/basic/deviceItem/deviceItem.data'
import * as deviceRepairApi from '@/api/eam/device/deviceRepair'
@ -69,7 +67,10 @@
import * as DeviceMaintenanceMainApi from '@/api/eam/device/deviceMaintenanceMain'
import * as deviceMaintenanceDetailApi from '@/api/eam/device/deviceMaintenanceDetail'
import { getAccessToken } from '@/utils/auth'
import { dateFormatter } from '@/utils/formatTime'
import * as SupplierApi from '@/api/eam/basic/supplier'
import * as UserApi from '@/api/system/user'
import { selecUserByType } from '@/api/system/dept'
import {
DeviceMaintainOrderMain,
DeviceMaintainOrderDetail,
@ -231,7 +232,13 @@
/** 详情操作 */
const detailRef = ref()
const openDetail = (row : any, titleName : any, titleValue : any) => {
const openDetail = async (row : any, titleName : any, titleValue : any) => {
const factoryDeptList = await selectAllFactoryAreaDept()
const userListAll = await UserApi.getSimpleUserList()
const supplierList = await SupplierApi.getSupplierNoPage({})
row.factoryAreaNumberDetail = factoryDeptList.find((account) => account.id == row.factoryAreaNumber)?.name
row.principalDetail = userListAll.find((account) => account.id == row.maintenance)?.nickname
row.supplierNumberDetail = supplierList.find((account) => account.number == row.supplierNumber)?.name
itemCodeRow.value = row.number
tabsExtend.value = 1
detailRef.value.openDetail(row, titleName, titleValue, 'basicDeviceAccounts')

3
src/views/eam/device/devicemaintainjob/index.vue

@ -280,7 +280,10 @@ const openForm = (type: string, row?: any) => {
/** 详情操作 */
const detailRef = ref()
const openDetail =async (row: any, titleName: any, titleValue: any) => {
const deviceListAll = await DeviceAccountsApi.getDeviceAccountsAllNoPage({})
const userListAll = await UserApi.getSimpleUserList()
row.factoryAreaNumber1 = factoryList.find((account) => account.id == row.factoryAreaNumber)?.name
row.maintenanceName = userListAll.find((account) => account.id == row.maintenance)?.nickname
detailRef.value.openDetail(row, titleName, titleValue,'DeviceMaintainOrderMain')
}

41
src/views/eam/device/devicemaintenancejob/deviceMaintenanceMain.data.ts

@ -61,6 +61,7 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
table: {
width: '150',
},
isDetail: false,
api: () => deviceList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return deviceListAll.find((account) => account.number == cellValue)?.name
@ -89,6 +90,16 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
},
}
},
{
label: '设备',
field: 'deviceNumberDetail',
sort: 'custom',
isDetail: true,
isForm: false,
isSearch: false,
isTable: false,
isTableForm: false,
},
{
label: '厂区',
field: 'factoryAreaNumber',
@ -129,12 +140,12 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
},
{
label: '厂区',
field: 'factoryAreaNumber1',
sort: 'custom',
isDetail: true,
isSearch: false,
field: 'factoryAreaNumberDetail',
sort: 'custom',etail: true,
isForm: false,
isSearch: false,
isTable: false,
isTableForm: false,
table: {
width: 150
}
@ -181,12 +192,13 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
},
{
label: '维修人',
field: 'maintenance1',
field: 'maintenanceDetail',
sort: 'custom',
isDetail: true,
isSearch: false,
isForm: false,
isSearch: false,
isTable: false,
isTableForm: false,
table: {
width: 150
}
@ -198,6 +210,7 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
table: {
width: '150',
},
isDetail: false,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return deviceMoldTypeList.find((account) => account.value == cellValue)?.label
},
@ -228,6 +241,16 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
}
},
},
{
label: '类型',
field: 'typeDetail',
sort: 'custom',
isDetail: true,
isForm: false,
isSearch: false,
isTable: false,
isTableForm: false,
},
{
label: '班次',
field: 'classes',
@ -235,6 +258,7 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
table: {
width: '150',
},
isDetail: false,
isSearch: true,
dictType: DICT_TYPE.MAINTENANCE_SHIFT,
dictClass: 'number',
@ -249,6 +273,7 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
table: {
width: '150',
},
isDetail: false,
isSearch: false,
dictType: DICT_TYPE.FAULT_TYPE,
dictClass: 'string',
@ -384,7 +409,7 @@ export const DeviceMaintenanceDetail = useCrudSchemas(reactive<CrudSchema[]>([
// .map(item => item.nickname)
// .join(',');
// },
isTable:false,
isTable:true,
tableForm: {
type: 'Select',
initOptions: userListAll,
@ -418,7 +443,7 @@ export const DeviceMaintenanceDetail = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
isForm:false,
isDetail:true,
isTable:true,
isTable:false,
isTableForm:false
},
{

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

@ -164,6 +164,9 @@ import { useUserStore } from '@/store/modules/user'
import { selecUserByType } from '@/api/system/dept'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
import * as UserApi from '@/api/system/user'
import { selectAllFactoryArea } from '@/api/system/dept'
import { ItemSearchTable } from '../../basic/item/item.data'
import * as ItemApi from '@/api/eam/basic/item'
import { emit } from 'process'
const deviceMoldTypeList = getStrDictOptions(DICT_TYPE.APP_DEVICE_MOLD_TYPE)
const deviceTypeList = getStrDictOptions(DICT_TYPE.APP_DEVICE_MOLD_TYPE).filter(item => item.value != 'MOLD')
@ -691,10 +694,15 @@ const openFormSec = async (type: string, row?: any) => {
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
const deviceMoldType = getStrDictOptions(DICT_TYPE.APP_DEVICE_MOLD_TYPE)
row.typeName = deviceMoldType.find((account) => account.value == row.type)?.label
const openDetail = async (row: any, titleName: any, titleValue: any) => {
const userListAll = await UserApi.getSimpleUserList()
const factoryList = await selectAllFactoryArea()
const moldAllList = await MoldAccountsApi.getMoldAccountsAllNoPage({})
const deviceMoldTypeList = getStrDictOptions(DICT_TYPE.APP_DEVICE_MOLD_TYPE)
row.typeDetail = deviceMoldTypeList.find((account) => account.value == row.type)?.label
row.deviceNumberDetail = moldAllList.find((account) => account.number == row.deviceNumber)?.name
row.factoryAreaNumberDetail = factoryList.find((account) => account.id == row.factoryAreaNumber)?.name
row.maintenanceDetail = userListAll.find((account) => account.id == row.maintenance)?.nickname
console.log(row)
operatRecord.value = row;
detailRef.value.openDetail(row, titleName, titleValue,'DeviceMaintenanceMain')

960
src/views/eam/mold/moldAccounts/index.vue

@ -1,483 +1,477 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search
:schema="MoldAccounts.allSchemas.searchSchema"
@search="setSearchParams"
@reset="setSearchParams"
/>
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="MoldAccounts.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 #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" @button-base-click="buttonTableClick($event, row)" />
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
@success="formsSuccess"
:rules="MoldAccountsRules"
:formAllSchemas="MoldAccounts.allSchemas"
:apiUpdate="MoldAccountsApi.updateMoldAccounts"
:apiCreate="MoldAccountsApi.createMoldAccounts"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<SearchTable ref="searchTableRef" @searchTableSuccess="submitItem" />
<!-- 详情 -->
<DetailDeviceLedger
ref="detailRef"
:tabs="MoldLedgerTabsList"
:subTabs="MoldLedgerSubTabsList"
:isBasic="true"
:allSchemas="allSchemas"
@changeTabs="changeTabs"
:detailAllSchemas="detailAllSchemas"
:apiPage="apiPage"
:tabsExtend="tabsExtend"
:tabName="tabName"
:tableObjectExtend="tableObjectExtend"
:getImageApi="uploadApi.getImage"
:uploadImage="uploadApi.uploadImage"
:defaultParams="defaultParams"
:dialogApiPage="dialogApiPage"
:dialogAllSchemas="dialogAllSchemas"
:dialogAllSchemasRules="dialogAllSchemasRules"
:diaLogApiUpdate="MoldMilestoneApi.updateMoldMilestone"
:diaLogApiCreate="MoldMilestoneApi.createMoldMilestone"
:dialogFormAllSchemasRules="MoldMilestoneRules"
:dialogFormAllSchemas="MoldMilestone.allSchemas"
:milestoneFuncCode="milestone"
/>
<!-- 导入 -->
<ImportForm
ref="importFormRef"
url="/eam/mold-accounts/import"
:importTemplateData="importTemplateData"
@success="importSuccess"
/>
</template>
<script setup lang="ts">
import download from '@/utils/download'
import {
MoldAccounts,
MoldAccountsRules,
MoldMilestone,
MoldMilestoneRules
} from './moldAccounts.data'
import { Item } from '@/views/eam/basic/item/item.data'
import * as ItemApi from '@/api/eam/basic/item'
import { createDeviceItemBatch, getDeviceItemPage } from '@/api/eam/basic/rel'
import * as MoldAccountsApi from '@/api/eam/mold/moldAccounts'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import { MoldLedgerTabsList } from '@/utils/disposition/tabsList'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import DetailDeviceLedger from '@/components/Detail/src/DetailDeviceLedger.vue'
import { MoldRepair } from '@/views/eam/mold/moldRepair/moldRepair.data'
import { DeviceItem } from '@/views/eam/basic/deviceItem/deviceItem.data'
import * as moldRepairApi from '@/api/eam/mold/moldRepair'
import * as uploadApi from '@/api/eam/upload'
import * as MoldMaintainOrderMainApi from '@/api/eam/mold/moldMaintainOrderMain'
// import * as MoldMaintainOrderDetailApi from '@/api/eam/mold/moldMaintainOrderDetail'
import * as MoldMaintenanceMainApi from '@/api/eam/mold/moldMaintenanceMain'
import * as moldMaintenanceDetailApi from '@/api/eam/mold/moldMaintenanceDetail'
import * as MoldMilestoneApi from '@/api/eam/basic/moldMilestone'
import { getAccessToken } from '@/utils/auth'
import {
MoldMaintainOrderMain,
MoldMaintainOrderDetail,
} from '../moldmaintainjob/moldMaintainOrderMain.data'
import {
MoldMaintenanceMain,
MoldMaintenanceDetail
} from '../moldmaintenancejob/moldMaintenanceMain.data'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
defineOptions({ name: 'MoldAccounts' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
const deviceNumber = ref()
routeName.value = route.name
const tableColumns = ref(MoldAccounts.allSchemas.tableColumns)
const allSchemas = ref(MoldAccounts.allSchemas)
const detailAllSchemas = ref()
const apiPage = ref()
const itemCodeRow = ref()
const tableObjectExtend = ref()
const defaultParams = ref({})
const dialogApiPage = ref()
const dialogAllSchemas = ref()
const dialogAllSchemasRules = ref()
const milestone = ref("milestone")
const BASE_URL = import.meta.env.VITE_JMREPORT_BASE_URL
const src = ref(BASE_URL + '/jmreport/view/924987924638945280?token=' + getAccessToken())
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
})
}
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
const { tableObject, tableMethods } = useTable({
getListApi: MoldAccountsApi.getMoldAccountsPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn(null), //
defaultButtons.selectQrCodeBatchBtn(null), //
// defaultButtons.defaultImportBtn(null), //
// defaultButtons.defaultExportBtn(null), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null) //
// {
// label: '',
// name: 'zdy',
// hide: false,
// type: 'primary',
// icon: 'Select',
// color: ''
// },
]
//
const buttonBaseClick = (val, item) => {
if (val == 'add') {
//
openForm('create')
} else if (val == 'qrCodeBatch') {
//
qrCodeBatch(val, item)
} else if (val == 'import') {
//
handleImport()
} else if (val == 'export') {
//
handleExport()
} else if (val == 'refresh') {
//
getList()
} else if (val == 'filtrate') {
//
} else {
//
console.log('其他按钮', item)
}
}
// -
const butttondata = [
defaultButtons.mainListEditBtn(null), //
// defaultButtons.mainListDeleteBtn(null), //
defaultButtons.selectQrCodeBtn(null), //
// defaultButtons.selectItemBtn(null) //
]
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') {
//
openForm('update', row)
} else if (val == 'qrCode') {
window.open(src.value + "&number='" + row.number + "'")
} else if (val == 'selectItem') {
openItem(row.number)
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
// form
const formsSuccess = async (formType, data) => {
var isHave = MoldAccounts.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') {
const param = {
number : data.number
}
//
let flag = false
await MoldAccountsApi.getMoldAccountsPage(param).then(res => {
if (res?.total > 0) {
flag = true
}
})
if (flag) {
message.error('模具编号已存在')
return
}
//
await MoldAccountsApi.createMoldAccounts(data)
message.success(t('common.createSuccess'))
} else {
await MoldAccountsApi.updateMoldAccounts(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
getList()
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
itemCodeRow.value = row.number
tabsExtend.value = 1
detailRef.value.openDetail(row, titleName, titleValue, 'basicMoldAccounts')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await MoldAccountsApi.deleteMoldAccounts(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await MoldAccountsApi.exportMoldAccounts(tableObject.params)
download.excel(data, '设备台账.xlsx')
} catch {
} finally {
exportLoading.value = false
}
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: '设备台账导入模版.xlsx'
})
//
const importSuccess = () => {
getList()
}
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
const MoldLedgerSubTabsList = getStrDictOptions(DICT_TYPE.MOLD_DOC_TYPE)
const tabsExtend = ref()
const tabName = ref()
const funcCode = ref('mold_mould_picture')
// tabs
const changeTabs = (item) => {
if (item.prop == 'Image') {
tabsExtend.value = 1
tabName.value = item.label
funcCode.value = 'mold_mould_picture'
// apiPage.value = CustomeritemApi.getCustomeritemPage
// detailAllSchemas.value = Customeritem.allSchemas
} else if (item.prop == 'Word') {
tabsExtend.value = 2
tabName.value = item.label
funcCode.value = 'mold_mould_attachment'
// apiPage.value = PurchaseDetailApi.getPurchaseDetailPage
// detailAllSchemas.value = PurchaseMain.allSchemas
} else if (item.prop == 'Part') {
tabsExtend.value = 4
tabName.value = item.label
defaultParams.value = {
deviceNumber: itemCodeRow
}
apiPage.value = getDeviceItemPage
detailAllSchemas.value = DeviceItem.allSchemas
} else if (item.prop == 'MoldReportRecord') {
tabsExtend.value = 4
tabName.value = item.label
defaultParams.value = {
deviceNumber: itemCodeRow
}
apiPage.value = moldRepairApi.getMoldRepairPage
detailAllSchemas.value = MoldRepair.allSchemas
} else if (item.prop == 'RepairRecord') {
tabsExtend.value = 3
tabName.value = item.label
defaultParams.value = {
deviceNumber: itemCodeRow
}
apiPage.value = MoldMaintenanceMainApi.getMoldMaintenanceMainPage
detailAllSchemas.value = MoldMaintenanceMain.allSchemas
dialogApiPage.value = moldMaintenanceDetailApi.getMoldMaintenanceDetailPage
dialogAllSchemas.value = MoldMaintenanceDetail.allSchemas
} else if (item.prop == 'MaintenanceRecord') {
tabsExtend.value = 3
tabName.value = item.label
defaultParams.value = {
deviceNumber: itemCodeRow
}
apiPage.value = MoldMaintainOrderMainApi.getMoldMaintainOrderMainPage
detailAllSchemas.value = MoldMaintainOrderMain.allSchemas
// dialogApiPage.value = MoldMaintainOrderDetailApi.getMoldMaintainOrderDetailPage
dialogAllSchemas.value = MoldMaintainOrderDetail.allSchemas
} else if (item.prop == 'Milestone') {
tabsExtend.value = 5
tabName.value = item.label
defaultParams.value = {
moldNumber: itemCodeRow
}
apiPage.value = MoldMilestoneApi.getMoldMilestonePage
detailAllSchemas.value = MoldMilestone.allSchemas
}
tableObjectExtend.value = [
{
key: 'itemCode',
value: itemCodeRow.value
}
]
}
/** 初始化 **/
onMounted(async () => {
getList()
importTemplateData.templateUrl = await MoldAccountsApi.importTemplate()
})
/** 二维码 */
const openQrCode = async (number: String) => {
// const data = await MoldAccountsApi.getQrCode(number)
// const url = window.URL.createObjectURL(new Blob([data]))
// const link = document.createElement('a')
// link.style.display = 'none'
// link.href = url
// link.setAttribute('download', '.png')
// document.body.appendChild(link)
// link.click()
// try {
// //
// await message.delConfirm()
// //
// await MoldAccountsApi.deleteMoldAccounts(id)
// message.success(t('common.delSuccess'))
// //
// await getList()
// } catch {}
}
const searchTableRef = ref()
/** 绑定备件操作 */
const openItem = async (number: String) => {
deviceNumber.value = number
searchTableRef.value.open(
'选择备件',
Item.allSchemas,
ItemApi.getItemPage,
null,
Item.allSchemas.searchSchema,
true,
null,
null,
null,
null
)
}
const submitItem = async (formFieldRef, searchFieldRef, selections, typeRef, rowRef) => {
const deviceItemRelList = selections.map((element) => ({
deviceNumber: deviceNumber.value,
itemNumber: element.number
}))
createDeviceItemBatch(deviceItemRelList).then((res) => {
console.log('res', res)
})
console.log('deviceItemRelList', deviceItemRelList)
}
const qrCodeBatch = async (val,item) => {
const qrCodeList = tableObject.tableList.map(item => `'${item?.number}'`).join(', ')
window.open(src.value + "&number=" + qrCodeList)
}
</script>
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search
:schema="MoldAccounts.allSchemas.searchSchema"
@search="setSearchParams"
@reset="setSearchParams"
/>
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="MoldAccounts.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 #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" @button-base-click="buttonTableClick($event, row)" />
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
@success="formsSuccess"
:rules="MoldAccountsRules"
:formAllSchemas="MoldAccounts.allSchemas"
:apiUpdate="MoldAccountsApi.updateMoldAccounts"
:apiCreate="MoldAccountsApi.createMoldAccounts"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<SearchTable ref="searchTableRef" @searchTableSuccess="submitItem" />
<!-- 详情 -->
<DetailDeviceLedger
ref="detailRef"
:tabs="MoldLedgerTabsList"
:subTabs="MoldLedgerSubTabsList"
:isBasic="true"
:allSchemas="allSchemas"
@changeTabs="changeTabs"
:detailAllSchemas="detailAllSchemas"
:apiPage="apiPage"
:tabsExtend="tabsExtend"
:tabName="tabName"
:tableObjectExtend="tableObjectExtend"
:getImageApi="uploadApi.getImage"
:uploadImage="uploadApi.uploadImage"
:defaultParams="defaultParams"
:dialogApiPage="dialogApiPage"
:dialogAllSchemas="dialogAllSchemas"
:dialogAllSchemasRules="dialogAllSchemasRules"
:diaLogApiUpdate="MoldMilestoneApi.updateMoldMilestone"
:diaLogApiCreate="MoldMilestoneApi.createMoldMilestone"
:dialogFormAllSchemasRules="MoldMilestoneRules"
:dialogFormAllSchemas="MoldMilestone.allSchemas"
:milestoneFuncCode="milestone"
/>
<!-- 导入 -->
<ImportForm
ref="importFormRef"
url="/eam/mold-accounts/import"
:importTemplateData="importTemplateData"
@success="importSuccess"
/>
</template>
<script setup lang="ts">
import download from '@/utils/download'
import {
MoldAccounts,
MoldAccountsRules,
MoldMilestone,
MoldMilestoneRules
} from './moldAccounts.data'
import { Item } from '@/views/eam/basic/item/item.data'
import * as ItemApi from '@/api/eam/basic/item'
import { createDeviceItemBatch, getDeviceItemPage } from '@/api/eam/basic/rel'
import * as MoldAccountsApi from '@/api/eam/mold/moldAccounts'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import { MoldLedgerTabsList } from '@/utils/disposition/tabsList'
import { MoldRepair } from '@/views/eam/mold/moldRepair/moldRepair.data'
import { DeviceItem } from '@/views/eam/basic/deviceItem/deviceItem.data'
import * as moldRepairApi from '@/api/eam/mold/moldRepair'
import * as uploadApi from '@/api/eam/upload'
import * as MoldMaintainOrderMainApi from '@/api/eam/mold/moldMaintainOrderMain'
// import * as MoldMaintainOrderDetailApi from '@/api/eam/mold/moldMaintainOrderDetail'
import * as MoldMaintenanceMainApi from '@/api/eam/mold/moldMaintenanceMain'
import * as moldMaintenanceDetailApi from '@/api/eam/mold/moldMaintenanceDetail'
import * as MoldMilestoneApi from '@/api/eam/basic/moldMilestone'
import { getAccessToken } from '@/utils/auth'
import { dateFormatter } from '@/utils/formatTime'
import * as SupplierApi from '@/api/eam/basic/supplier'
import { selectAllFactoryArea,selectAllFactoryAreaDept } from '@/api/system/dept'
import {
MoldMaintainOrderMain,
MoldMaintainOrderDetail,
} from '../moldmaintainjob/moldMaintainOrderMain.data'
import {
MoldMaintenanceMain,
MoldMaintenanceDetail
} from '../moldmaintenancejob/moldMaintenanceMain.data'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
defineOptions({ name: 'MoldAccounts' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
const deviceNumber = ref()
routeName.value = route.name
const tableColumns = ref(MoldAccounts.allSchemas.tableColumns)
const allSchemas = ref(MoldAccounts.allSchemas)
const detailAllSchemas = ref()
const apiPage = ref()
const itemCodeRow = ref()
const tableObjectExtend = ref()
const defaultParams = ref({})
const dialogApiPage = ref()
const dialogAllSchemas = ref()
const dialogAllSchemasRules = ref()
const milestone = ref("milestone")
const BASE_URL = import.meta.env.VITE_JMREPORT_BASE_URL
const src = ref(BASE_URL + '/jmreport/view/924987924638945280?token=' + getAccessToken())
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
})
}
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
const { tableObject, tableMethods } = useTable({
getListApi: MoldAccountsApi.getMoldAccountsPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn(null), //
defaultButtons.selectQrCodeBatchBtn(null), //
// defaultButtons.defaultImportBtn(null), //
// defaultButtons.defaultExportBtn(null), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null) //
// {
// label: '',
// name: 'zdy',
// hide: false,
// type: 'primary',
// icon: 'Select',
// color: ''
// },
]
//
const buttonBaseClick = (val, item) => {
if (val == 'add') {
//
openForm('create')
} else if (val == 'qrCodeBatch') {
//
qrCodeBatch(val, item)
} else if (val == 'import') {
//
handleImport()
} else if (val == 'export') {
//
handleExport()
} else if (val == 'refresh') {
//
getList()
} else if (val == 'filtrate') {
//
} else {
//
console.log('其他按钮', item)
}
}
// -
const butttondata = [
defaultButtons.mainListEditBtn(null), //
// defaultButtons.mainListDeleteBtn(null), //
defaultButtons.selectQrCodeBtn(null), //
// defaultButtons.selectItemBtn(null) //
]
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') {
//
openForm('update', row)
} else if (val == 'qrCode') {
window.open(src.value + "&number='" + row.number + "'")
} else if (val == 'selectItem') {
openItem(row.number)
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
// form
const formsSuccess = async (formType, data) => {
if (formType === 'create') {
const param = {
number : data.number
}
//
let flag = false
await MoldAccountsApi.getMoldAccountsPage(param).then(res => {
if (res?.total > 0) {
flag = true
}
})
if (flag) {
message.error('模具编号已存在')
return
}
//
await MoldAccountsApi.createMoldAccounts(data)
message.success(t('common.createSuccess'))
} else {
await MoldAccountsApi.updateMoldAccounts(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
getList()
}
/** 详情操作 */
const detailRef = ref()
const openDetail = async (row: any, titleName: any, titleValue: any) => {
const factoryDeptList = await selectAllFactoryAreaDept()
const supplierList = await SupplierApi.getSupplierNoPage({})
row.factoryAreaNumberDetail = factoryDeptList.find((account) => account.id == row.factoryAreaNumber)?.name
row.supplierNumberDetail = supplierList.find((account) => account.number == row.supplierNumber)?.name
itemCodeRow.value = row.number
tabsExtend.value = 1
detailRef.value.openDetail(row, titleName, titleValue, 'basicMoldAccounts')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await MoldAccountsApi.deleteMoldAccounts(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await MoldAccountsApi.exportMoldAccounts(tableObject.params)
download.excel(data, '设备台账.xlsx')
} catch {
} finally {
exportLoading.value = false
}
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: '设备台账导入模版.xlsx'
})
//
const importSuccess = () => {
getList()
}
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
const MoldLedgerSubTabsList = getStrDictOptions(DICT_TYPE.MOLD_DOC_TYPE)
const tabsExtend = ref()
const tabName = ref()
const funcCode = ref('mold_mould_picture')
// tabs
const changeTabs = (item) => {
if (item.prop == 'Image') {
tabsExtend.value = 1
tabName.value = item.label
funcCode.value = 'mold_mould_picture'
// apiPage.value = CustomeritemApi.getCustomeritemPage
// detailAllSchemas.value = Customeritem.allSchemas
} else if (item.prop == 'Word') {
tabsExtend.value = 2
tabName.value = item.label
funcCode.value = 'mold_mould_attachment'
// apiPage.value = PurchaseDetailApi.getPurchaseDetailPage
// detailAllSchemas.value = PurchaseMain.allSchemas
} else if (item.prop == 'Part') {
tabsExtend.value = 4
tabName.value = item.label
defaultParams.value = {
deviceNumber: itemCodeRow
}
apiPage.value = getDeviceItemPage
detailAllSchemas.value = DeviceItem.allSchemas
} else if (item.prop == 'MoldReportRecord') {
tabsExtend.value = 4
tabName.value = item.label
defaultParams.value = {
deviceNumber: itemCodeRow
}
apiPage.value = moldRepairApi.getMoldRepairPage
detailAllSchemas.value = MoldRepair.allSchemas
} else if (item.prop == 'RepairRecord') {
tabsExtend.value = 3
tabName.value = item.label
defaultParams.value = {
deviceNumber: itemCodeRow
}
apiPage.value = MoldMaintenanceMainApi.getMoldMaintenanceMainPage
detailAllSchemas.value = MoldMaintenanceMain.allSchemas
dialogApiPage.value = moldMaintenanceDetailApi.getMoldMaintenanceDetailPage
dialogAllSchemas.value = MoldMaintenanceDetail.allSchemas
} else if (item.prop == 'MaintenanceRecord') {
tabsExtend.value = 3
tabName.value = item.label
defaultParams.value = {
deviceNumber: itemCodeRow
}
apiPage.value = MoldMaintainOrderMainApi.getMoldMaintainOrderMainPage
detailAllSchemas.value = MoldMaintainOrderMain.allSchemas
// dialogApiPage.value = MoldMaintainOrderDetailApi.getMoldMaintainOrderDetailPage
dialogAllSchemas.value = MoldMaintainOrderDetail.allSchemas
} else if (item.prop == 'Milestone') {
tabsExtend.value = 5
tabName.value = item.label
defaultParams.value = {
moldNumber: itemCodeRow
}
apiPage.value = MoldMilestoneApi.getMoldMilestonePage
detailAllSchemas.value = MoldMilestone.allSchemas
}
tableObjectExtend.value = [
{
key: 'itemCode',
value: itemCodeRow.value
}
]
}
/** 初始化 **/
onMounted(async () => {
getList()
importTemplateData.templateUrl = await MoldAccountsApi.importTemplate()
})
/** 二维码 */
const openQrCode = async (number: String) => {
// const data = await MoldAccountsApi.getQrCode(number)
// const url = window.URL.createObjectURL(new Blob([data]))
// const link = document.createElement('a')
// link.style.display = 'none'
// link.href = url
// link.setAttribute('download', '.png')
// document.body.appendChild(link)
// link.click()
// try {
// //
// await message.delConfirm()
// //
// await MoldAccountsApi.deleteMoldAccounts(id)
// message.success(t('common.delSuccess'))
// //
// await getList()
// } catch {}
}
const searchTableRef = ref()
/** 绑定备件操作 */
const openItem = async (number: String) => {
deviceNumber.value = number
searchTableRef.value.open(
'选择备件',
Item.allSchemas,
ItemApi.getItemPage,
null,
Item.allSchemas.searchSchema,
true,
null,
null,
null,
null
)
}
const submitItem = async (formFieldRef, searchFieldRef, selections, typeRef, rowRef) => {
const deviceItemRelList = selections.map((element) => ({
deviceNumber: deviceNumber.value,
itemNumber: element.number
}))
createDeviceItemBatch(deviceItemRelList).then((res) => {
console.log('res', res)
})
console.log('deviceItemRelList', deviceItemRelList)
}
const qrCodeBatch = async (val,item) => {
const qrCodeList = tableObject.tableList.map(item => `'${item?.number}'`).join(', ')
window.open(src.value + "&number=" + qrCodeList)
}
</script>

656
src/views/eam/mold/moldAccounts/moldAccounts.data.ts

@ -1,314 +1,342 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import { selectAllFactoryArea,selectAllFactoryAreaDept } from '@/api/system/dept'
import * as SupplierApi from '@/api/eam/basic/supplier'
import { validateHanset,validateNumDot, validateEmail,validateNum } from '@/utils/validator'
const factoryList = await selectAllFactoryArea()
const factoryDeptList = await selectAllFactoryAreaDept()
const supplierList = await SupplierApi.getSupplierNoPage()
// 表单校验
export const MoldAccountsRules = reactive({
number: [
required,
{ max: 20, message: '不得超过20个字符', trigger: 'blur' },
],
name: [
required,
{ max: 50, message: '不得超过50个字符', trigger: 'blur' },
],
factoryAreaNumber: [required],
purchaseDept: [
{ max: 100, message: '不得超过100个字符', trigger: 'blur' },
],
purchaser: [
{ max: 60, message: '不得超过60个字符', trigger: 'blur' },
],
purchasePrice: [
{ max: 20, message: '不得超过20个字符', trigger: 'blur' },
{ validator:validateNumDot, message: '请输入数字格式', trigger: 'blur'}
],
beat:[
{ validator:validateNum, message: '请输入数字格式', trigger: 'blur'}
]
})
export const MoldAccounts = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '模具编号',
field: 'number',
sort: 'custom',
isSearch: true,
isForm: true,
table: {
width: '150',
fixed: 'left',
},
},
{
label: '名称',
field: 'name',
sort: 'custom',
isSearch: true
},
{
label: '规格型号',
field: 'specification',
sort: 'custom'
},
{
label: '模具类型',
field: 'type',
sort: 'custom',
isSearch: false,
isForm: true,
isTable: true,
dictType: DICT_TYPE.DEVICE_MOLD_TYPE,
dictClass: 'string',
form: {
value: 'MOLD',
component: 'Select',
componentProps: {
disabled: true,
}
},
search: {
value: 'MOLD'
}
},
{
label: '所属厂区',
field: 'factoryAreaNumber',
sort: 'custom',
isSearch: false,
table: {
width: '150',
},
api: () => factoryList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return factoryList.find((account) => account.id == cellValue)?.name
},
search: {
show: true,
component: 'Select',
api: () => factoryList,
componentProps: {
optionsAlias: {
labelField: 'name',
valueField: 'id'
},
filterable: true,
}
},
form: {
component: 'Select',
api: () => factoryList,
componentProps: {
disabled: false,
optionsAlias: {
labelField: 'name',
valueField: 'id'
},
filterable: true,
placeholder: "请选择设备"
},
}
},
{
label: '采购时间',
field: 'purchaseTime',
sort: 'custom',
formatter: dateFormatter,
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
valueFormat: 'x'
}
},
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
}
},
{
label: '采购部门',
field: 'purchaseDept',
sort: 'custom',
isSearch: false,
isForm: true,
isTable: true,
form: {
component: 'Input',
}
},
{
label: '采购人',
field: 'purchaser',
sort: 'custom',
form: {
component: 'Input',
}
},
{
label: '供应商',
field: 'supplierNumber',
sort: 'custom',
table:{
width:150
},
form:{
component: 'Select',
componentProps: {
options: supplierList,
optionsAlias: {
labelField: 'name',
valueField: 'number'
},
filterable: true,
placeholder: "请选择供应商"
}
}
},
{
label: '出厂日期',
field: 'productionDate',
sort: 'custom',
formatter: dateFormatter,
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
valueFormat: 'x'
}
}
},
{
label: '购买价格',
field: 'purchasePrice',
sort: 'custom'
},
{
label: '是否客户资产',
field: 'isClientAssets',
sort: 'custom',
form: {
component: 'Select',
},
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
},
{
label: '模次',
field: 'frequency',
sort: 'custom',
isForm: false,
isSearch: false,
form: {
component: 'Input',
}
},
{
label: '节拍',
field: 'beat',
sort: 'custom',
isForm: true,
form: {
component: 'Input',
}
},
{
label: '维修状态',
field: 'status',
sort: 'custom',
dictType: DICT_TYPE.BASIC_STATUS,
dictClass: 'string',
isSearch: true,
isForm: false,
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 200,
fixed: 'right'
},
isDetail: false,
}
]))
// 表单校验
export const UpImageRules = reactive({
filePath: [required],
})
export const UpImage = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '上传图片',
field: 'filePathList',
sort: 'custom',
isForm: true,
form:{
component:'UploadImgs',
}
},
]))
export const MoldMilestoneRules = reactive({
number: [required],
moldNumber: [required],
})
export const MoldMilestone = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '里程碑阶段',
field: 'milestoneStage',
sort: 'custom',
isSearch: true,
isForm: true,
form: {
component: 'Select',
componentProps: {
disabled: true,
}
},
},
{
label: '里程碑日期',
field: 'milestoneDate',
sort: 'custom',
formatter: dateFormatter,
isSearch: true,
isForm: true,
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD',
type: 'date',
}
},
form: {
component: 'DatePicker',
componentProps: {
type: 'date',
valueFormat: 'x'
}
}
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))
// // 表单校验
// export const UpFileRules = reactive({
// filePath: [required],
// })
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import { selectAllFactoryArea,selectAllFactoryAreaDept } from '@/api/system/dept'
import * as SupplierApi from '@/api/eam/basic/supplier'
import { validateHanset,validateNumDot, validateEmail,validateNum } from '@/utils/validator'
const factoryList = await selectAllFactoryArea()
const factoryDeptList = await selectAllFactoryAreaDept()
const supplierList = await SupplierApi.getSupplierNoPage({})
// 表单校验
export const MoldAccountsRules = reactive({
number: [
required,
{ max: 20, message: '不得超过20个字符', trigger: 'blur' },
],
name: [
required,
{ max: 50, message: '不得超过50个字符', trigger: 'blur' },
],
factoryAreaNumber: [required],
purchaseDept: [
{ max: 100, message: '不得超过100个字符', trigger: 'blur' },
],
purchaser: [
{ max: 60, message: '不得超过60个字符', trigger: 'blur' },
],
purchasePrice: [
{ validator:validateNumDot, message: '请输入数字格式', trigger: 'blur'},
{ max: 20, message: '不得超过20个字符', trigger:'blur'},
],
beat:[
{ validator:validateNum, message: '请输入数字格式', trigger: 'blur'}
]
})
export const MoldAccounts = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '模具编号',
field: 'number',
sort: 'custom',
isSearch: true,
isForm: true,
table: {
width: '150',
fixed: 'left',
},
},
{
label: '名称',
field: 'name',
sort: 'custom',
isSearch: true
},
{
label: '规格型号',
field: 'specification',
sort: 'custom'
},
{
label: '模具类型',
field: 'type',
sort: 'custom',
isSearch: false,
isForm: true,
isTable: true,
dictType: DICT_TYPE.DEVICE_MOLD_TYPE,
dictClass: 'string',
form: {
value: 'MOLD',
component: 'Select',
componentProps: {
disabled: true,
}
},
search: {
value: 'MOLD'
}
},
{
label: '所属厂区',
field: 'factoryAreaNumber',
sort: 'custom',
isSearch: false,
isDetail: false,
table: {
width: '150',
},
api: () => factoryList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return factoryList.find((account) => account.id == cellValue)?.name
},
search: {
show: true,
component: 'Select',
api: () => factoryList,
componentProps: {
optionsAlias: {
labelField: 'name',
valueField: 'id'
},
filterable: true,
}
},
form: {
component: 'Select',
api: () => factoryList,
componentProps: {
disabled: false,
optionsAlias: {
labelField: 'name',
valueField: 'id'
},
filterable: true,
placeholder: "请选择设备"
},
}
},
{
label: '所属厂区',
field: 'factoryAreaNumberDetail',
sort: 'custom',
isDetail: true,
isForm: false,
isSearch: false,
isTable: false,
isTableForm: false,
},
{
label: '采购时间',
field: 'purchaseTime',
sort: 'custom',
formatter: dateFormatter,
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
valueFormat: 'x'
}
},
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
}
},
{
label: '采购部门',
field: 'purchaseDept',
sort: 'custom',
isSearch: false,
isForm: true,
isTable: true,
form: {
component: 'Input',
}
},
{
label: '采购人',
field: 'purchaser',
sort: 'custom',
form: {
component: 'Input',
}
},
{
label: '供应商',
field: 'supplierNumber',
sort: 'custom',
table:{
width:150
},
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return supplierList.find((account) => account.number == cellValue)?.name
},
form:{
component: 'Select',
componentProps: {
options: supplierList,
optionsAlias: {
labelField: 'name',
valueField: 'number'
},
filterable: true,
placeholder: "请选择供应商"
}
}
},
{
label: '供应商',
field: 'supplierNumberDetail',
sort: 'custom',
isDetail: true,
isForm: false,
isSearch: false,
isTable: false,
isTableForm: false,
},
{
label: '出厂日期',
field: 'productionDate',
sort: 'custom',
formatter: dateFormatter,
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
valueFormat: 'x'
}
}
},
{
label: '购买价格',
field: 'purchasePrice',
sort: 'custom',
isForm: true,
form: {
component: 'Input',
}
},
{
label: '是否客户资产',
field: 'isClientAssets',
sort: 'custom',
form: {
component: 'Select',
},
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
},
{
label: '模次',
field: 'frequency',
sort: 'custom',
isForm: false,
isSearch: false,
form: {
component: 'Input',
}
},
{
label: '节拍',
field: 'beat',
sort: 'custom',
isForm: true,
form: {
component: 'Input',
}
},
{
label: '维修状态',
field: 'status',
sort: 'custom',
dictType: DICT_TYPE.BASIC_STATUS,
dictClass: 'string',
isSearch: true,
isForm: false,
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 200,
fixed: 'right'
},
isDetail: false,
}
]))
// 表单校验
export const UpImageRules = reactive({
filePath: [required],
})
export const UpImage = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '上传图片',
field: 'filePathList',
sort: 'custom',
isForm: true,
form:{
component:'UploadImgs',
}
},
]))
export const MoldMilestoneRules = reactive({
number: [required],
moldNumber: [required],
})
export const MoldMilestone = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '里程碑阶段',
field: 'milestoneStage',
sort: 'custom',
isSearch: true,
isForm: true,
form: {
component: 'Select',
componentProps: {
disabled: true,
}
},
},
{
label: '里程碑日期',
field: 'milestoneDate',
sort: 'custom',
formatter: dateFormatter,
isSearch: true,
isForm: true,
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD',
type: 'date',
}
},
form: {
component: 'DatePicker',
componentProps: {
type: 'date',
valueFormat: 'x'
}
}
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))
// // 表单校验
// export const UpFileRules = reactive({
// filePath: [required],
// })

11
src/views/eam/mold/moldmaintenancejob/index.vue

@ -165,6 +165,7 @@ import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
import * as DeviceAccountsApi from '@/api/eam/device/deviceAccounts'
import * as MoldAccountsApi from '@/api/eam/mold/moldAccounts'
import * as UserApi from '@/api/system/user'
import { selectAllFactoryArea } from '@/api/system/dept'
const deviceMoldTypeList = getStrDictOptions(DICT_TYPE.APP_DEVICE_MOLD_TYPE)
const moldTypeList = getStrDictOptions(DICT_TYPE.APP_DEVICE_MOLD_TYPE).filter(item => item.value == 'MOLD')
defineOptions({ name: 'MoldMaintenanceMain' })
@ -443,7 +444,15 @@ const openForm = async (type: string, row?: any) => {
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
const openDetail = async (row: any, titleName: any, titleValue: any) => {
const factoryList = await selectAllFactoryArea()
const userListAll = await UserApi.getSimpleUserList()
const moldListAll = await MoldAccountsApi.getMoldAccountsAllNoPage({})
const deviceMoldType = getStrDictOptions(DICT_TYPE.APP_DEVICE_MOLD_TYPE)
row.typeDetail = deviceMoldType.find((account) => account.value == row.type)?.label
row.deviceNumberDetail = moldListAll.find((account) => account.number == row.deviceNumber)?.name
row.factoryAreaNumberDetail = factoryList.find((account) => account.id == row.factoryAreaNumber)?.name
row.maintenanceDetail = userListAll.find((account) => account.id == row.maintenance)?.nickname
operatRecord.value = row;
detailRef.value.openDetail(row, titleName, titleValue,'MoldMaintenanceMain')
}

41
src/views/eam/mold/moldmaintenancejob/moldMaintenanceMain.data.ts

@ -61,6 +61,7 @@ export const MoldMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
table: {
width: '150',
},
isDetail: false,
api: () => factoryList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return factoryList.find((account) => account.id == cellValue)?.name
@ -93,15 +94,16 @@ export const MoldMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
},
{
label: '厂区',
field: 'factoryAreaNumberMO',
field: 'factoryAreaNumberDetail',
sort: 'custom',
table: {
width: '150',
},
isDetail: true,
isForm: false,
isTable: false,
isSearch: false,
isTable: false,
isTableForm: false,
},
{
label: '类型',
@ -110,6 +112,7 @@ export const MoldMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
table: {
width: '150',
},
isDetail: false,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return deviceMoldTypeList.find((account) => account.value == cellValue)?.label
},
@ -139,6 +142,16 @@ export const MoldMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
}
},
},
{
label: '类型',
field: 'typeDetail',
sort: 'custom',
isDetail: true,
isForm: false,
isSearch: false,
isTable: false,
isTableForm: false,
},
{
label: '模具',
field: 'deviceNumber',
@ -147,6 +160,7 @@ export const MoldMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
width: '150',
},
isSearch: false,
isDetail: false,
api: () => moldAllList,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return moldAllList.find((account) => account.number == cellValue)?.name
@ -174,6 +188,16 @@ export const MoldMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
},
}
},
{
label: '模具',
field: 'deviceNumberDetail',
sort: 'custom',
isDetail: true,
isForm: false,
isSearch: false,
isTable: false,
isTableForm: false,
},
{
label: '维修人',
field: 'maintenance',
@ -181,6 +205,7 @@ export const MoldMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
table: {
width: '150',
},
isDetail: false,
api: () => userListAll,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return userListAll.find((account) => account.id == cellValue)?.nickname
@ -213,7 +238,16 @@ export const MoldMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
}
}
},
{
label: '维修人',
field: 'maintenanceDetail',
sort: 'custom',
isDetail: true,
isForm: false,
isSearch: false,
isTable: false,
isTableForm: false,
},
{
label: '班次',
field: 'classes',
@ -235,6 +269,7 @@ export const MoldMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
table: {
width: '150',
},
isDetail: false,
isSearch: true,
dictType: DICT_TYPE.FAULT_TYPE,
dictClass: 'string',

Loading…
Cancel
Save