ljlong_2630
8 months ago
11 changed files with 1041 additions and 833 deletions
@ -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> |
|||
|
@ -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],
|
|||
// })
|
|||
|
Loading…
Reference in new issue