ljlong_2630
6 months ago
7 changed files with 1423 additions and 0 deletions
@ -0,0 +1,79 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface ToolAccountsVO { |
||||
|
id: number |
||||
|
code: string |
||||
|
name: string |
||||
|
specification: string |
||||
|
type: string |
||||
|
equity: string |
||||
|
electricMachine: string |
||||
|
isCustomerAptitude: boolean |
||||
|
customerId: string |
||||
|
storageLocation: string |
||||
|
useDept: string |
||||
|
principal: string |
||||
|
principalTelephone: string |
||||
|
status: string |
||||
|
startDate: Date |
||||
|
supplierCode: string |
||||
|
purchaseTime: Date |
||||
|
purchaseDept: string |
||||
|
purchaser: string |
||||
|
productionDate: Date |
||||
|
manufactureCode: string |
||||
|
equipmentLife: string |
||||
|
acceptanceDate: Date |
||||
|
purchasePrice: number |
||||
|
factoryAreaCode: string |
||||
|
workshopCode: string |
||||
|
workshopSectionCode: string |
||||
|
departmentCode: string |
||||
|
remark: string |
||||
|
siteId: string |
||||
|
available: string |
||||
|
deletionTime: Date |
||||
|
deleterId: byte[] |
||||
|
concurrencyStamp: number |
||||
|
} |
||||
|
|
||||
|
// 查询工装台账列表
|
||||
|
export const getToolAccountsPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/eam/tool-accounts/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/eam/tool-accounts/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询工装台账详情
|
||||
|
export const getToolAccounts = async (id: number) => { |
||||
|
return await request.get({ url: `/eam/tool-accounts/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增工装台账
|
||||
|
export const createToolAccounts = async (data: ToolAccountsVO) => { |
||||
|
return await request.post({ url: `/eam/tool-accounts/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改工装台账
|
||||
|
export const updateToolAccounts = async (data: ToolAccountsVO) => { |
||||
|
return await request.put({ url: `/eam/tool-accounts/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除工装台账
|
||||
|
export const deleteToolAccounts = async (id: number) => { |
||||
|
return await request.delete({ url: `/eam/tool-accounts/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出工装台账 Excel
|
||||
|
export const exportToolAccounts = async (params) => { |
||||
|
return await request.download({ url: `/eam/tool-accounts/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/eam/tool-accounts/get-import-template' }) |
||||
|
} |
@ -0,0 +1,61 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface ToolModVO { |
||||
|
id: number |
||||
|
modCode: string |
||||
|
toolCode: string |
||||
|
type: string |
||||
|
departmentCode: string |
||||
|
remark: string |
||||
|
siteId: string |
||||
|
available: string |
||||
|
deletionTime: Date |
||||
|
deleterId: byte[] |
||||
|
concurrencyStamp: number |
||||
|
} |
||||
|
|
||||
|
// 查询工装物料关联列表
|
||||
|
export const getToolModPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/eam/basic/tool-mod/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/eam/basic/tool-mod/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询工装物料关联详情
|
||||
|
export const getToolMod = async (id: number) => { |
||||
|
return await request.get({ url: `/eam/basic/tool-mod/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增工装物料关联
|
||||
|
export const createToolMod = async (data: ToolModVO) => { |
||||
|
return await request.post({ url: `/eam/basic/tool-mod/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改工装物料关联
|
||||
|
export const updateToolMod = async (data: ToolModVO) => { |
||||
|
return await request.put({ url: `/eam/basic/tool-mod/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除工装物料关联
|
||||
|
export const deleteToolMod = async (id: number) => { |
||||
|
return await request.delete({ url: `/eam/basic/tool-mod/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出工装物料关联 Excel
|
||||
|
export const exportToolMod = async (params) => { |
||||
|
return await request.download({ url: `/eam/basic/tool-mod/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/eam/basic/tool-mod/get-import-template' }) |
||||
|
} |
||||
|
|
||||
|
// 新增工装物料关联
|
||||
|
export const createToolModBatch = async (data: ToolModVO) => { |
||||
|
return await request.post({ url: `/eam/basic/tool-mod/createBatch`, data }) |
||||
|
} |
@ -0,0 +1,244 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="ToolAccounts.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="ToolAccounts.allSchemas" |
||||
|
/> |
||||
|
|
||||
|
<!-- 列表 --> |
||||
|
<ContentWrap> |
||||
|
<Table |
||||
|
:columns="tableColumns" |
||||
|
:data="tableObject.tableList" |
||||
|
:loading="tableObject.loading" |
||||
|
:pagination="{ |
||||
|
total: tableObject.total |
||||
|
}" |
||||
|
v-model:pageSize="tableObject.pageSize" |
||||
|
v-model:currentPage="tableObject.currentPage" |
||||
|
v-model:sort="tableObject.sort" |
||||
|
> |
||||
|
<template #code="{row}"> |
||||
|
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> |
||||
|
<span>{{ row.code }}</span> |
||||
|
</el-button> |
||||
|
</template> |
||||
|
<template #action="{ row }"> |
||||
|
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
||||
|
</template> |
||||
|
</Table> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 表单弹窗:添加/修改 --> |
||||
|
<BasicForm |
||||
|
ref="basicFormRef" |
||||
|
@success="formsSuccess" |
||||
|
:rules="ToolAccountsRules" |
||||
|
:formAllSchemas="ToolAccounts.allSchemas" |
||||
|
:apiUpdate="ToolAccountsApi.updateToolAccounts" |
||||
|
:apiCreate="ToolAccountsApi.createToolAccounts" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
:isBusiness="false" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="ToolAccounts.allSchemas" /> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<ImportForm ref="importFormRef" url="/eam/tool-accounts/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { ToolAccounts,ToolAccountsRules } from './toolAccounts.data' |
||||
|
import * as ToolAccountsApi from '@/api/eam/toolAccounts' |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
||||
|
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
||||
|
import Detail from '@/components/Detail/src/Detail.vue' |
||||
|
|
||||
|
defineOptions({ name: 'ToolAccounts' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(ToolAccounts.allSchemas.tableColumns) |
||||
|
|
||||
|
// 查询页面返回 |
||||
|
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: ToolAccountsApi.getToolAccountsPage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultAddBtn({hasPermi:'eam:tool-accounts:create'}), // 新增 |
||||
|
defaultButtons.defaultImportBtn({hasPermi:'eam:tool-accounts:import'}), // 导入 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:'eam:tool-accounts:export'}), // 导出 |
||||
|
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 == 'import') { // 导入 |
||||
|
handleImport() |
||||
|
} else if (val == 'export') { // 导出 |
||||
|
handleExport() |
||||
|
} else if (val == 'refresh') { // 刷新 |
||||
|
getList() |
||||
|
} else if (val == 'filtrate') { // 筛选 |
||||
|
} else { // 其他按钮 |
||||
|
console.log('其他按钮', item) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮 |
||||
|
const butttondata = [ |
||||
|
defaultButtons.mainListEditBtn({hasPermi:'eam:tool-accounts:update'}), // 编辑 |
||||
|
defaultButtons.mainListDeleteBtn({hasPermi:'eam:tool-accounts:delete'}), // 删除 |
||||
|
] |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'edit') { // 编辑 |
||||
|
openForm('update', row) |
||||
|
} else if (val == 'delete') { // 删除 |
||||
|
handleDelete(row.id) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 添加/修改操作 */ |
||||
|
const basicFormRef = ref() |
||||
|
const openForm = (type: string, row?: any) => { |
||||
|
basicFormRef.value.open(type, row) |
||||
|
} |
||||
|
|
||||
|
// form表单提交 |
||||
|
const formsSuccess = async (formType,data) => { |
||||
|
var isHave =ToolAccounts.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') { |
||||
|
await ToolAccountsApi.createToolAccounts(data) |
||||
|
message.success(t('common.createSuccess')) |
||||
|
} else { |
||||
|
await ToolAccountsApi.updateToolAccounts(data) |
||||
|
message.success(t('common.updateSuccess')) |
||||
|
} |
||||
|
basicFormRef.value.dialogVisible = false |
||||
|
getList() |
||||
|
} |
||||
|
|
||||
|
/** 详情操作 */ |
||||
|
const detailRef = ref() |
||||
|
const openDetail = (row: any, titleName: any, titleValue: any) => { |
||||
|
detailRef.value.openDetail(row, titleName, titleValue, 'basicToolAccounts') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await ToolAccountsApi.deleteToolAccounts(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 ToolAccountsApi.exportToolAccounts(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() // 刷新当前列表 |
||||
|
} |
||||
|
|
||||
|
/** 初始化 **/ |
||||
|
onMounted(async () => { |
||||
|
getList() |
||||
|
importTemplateData.templateUrl = await ToolAccountsApi.importTemplate() |
||||
|
}) |
||||
|
|
||||
|
</script> |
@ -0,0 +1,279 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const ToolAccountsRules = reactive({ |
||||
|
code: [required], |
||||
|
name: [required], |
||||
|
concurrencyStamp: [required] |
||||
|
}) |
||||
|
|
||||
|
export const ToolAccounts = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '工装编号', |
||||
|
field: 'code', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
isForm: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '名称', |
||||
|
field: 'name', |
||||
|
sort: 'custom', |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '型号', |
||||
|
field: 'specification', |
||||
|
sort: 'custom', |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '类型', |
||||
|
field: 'type', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
form: { |
||||
|
component: 'Select' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '产权', |
||||
|
field: 'equity', |
||||
|
sort: 'custom', |
||||
|
isSearch: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '电机', |
||||
|
field: 'electricMachine', |
||||
|
sort: 'custom', |
||||
|
isSearch: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '是否客户资质', |
||||
|
field: 'isCustomerAptitude', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
form: { |
||||
|
component: 'Switch' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '客户id', |
||||
|
field: 'customerId', |
||||
|
sort: 'custom', |
||||
|
isSearch: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '存放位置', |
||||
|
field: 'storageLocation', |
||||
|
sort: 'custom', |
||||
|
isSearch: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '使用部门', |
||||
|
field: 'useDept', |
||||
|
sort: 'custom', |
||||
|
isSearch: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '负责人', |
||||
|
field: 'principal', |
||||
|
sort: 'custom', |
||||
|
isSearch: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '负责人联系方式', |
||||
|
field: 'principalTelephone', |
||||
|
sort: 'custom', |
||||
|
isSearch: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '设备状态', |
||||
|
field: 'status', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
form: { |
||||
|
component: 'Switch' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '启用日期', |
||||
|
field: 'startDate', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
isSearch: false, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'daterange', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
type: 'datetime', |
||||
|
valueFormat: 'x' |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '供应商编号', |
||||
|
field: 'supplierCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '采购时间', |
||||
|
field: 'purchaseTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
isSearch: false, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'daterange', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
type: 'datetime', |
||||
|
valueFormat: 'x' |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '采购部门', |
||||
|
field: 'purchaseDept', |
||||
|
sort: 'custom', |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '采购人', |
||||
|
field: 'purchaser', |
||||
|
sort: 'custom', |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '出厂日期', |
||||
|
field: 'productionDate', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
isSearch: false, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'daterange', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
type: 'datetime', |
||||
|
valueFormat: 'x' |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '生产厂商编码', |
||||
|
field: 'manufactureCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '设备使用寿命', |
||||
|
field: 'equipmentLife', |
||||
|
sort: 'custom', |
||||
|
isSearch: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '验收日期', |
||||
|
field: 'acceptanceDate', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
isSearch: false, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'daterange', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
type: 'datetime', |
||||
|
valueFormat: 'x' |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '价格', |
||||
|
field: 'purchasePrice', |
||||
|
sort: 'custom', |
||||
|
isSearch: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '所属厂区编号', |
||||
|
field: 'factoryAreaCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '车间编号', |
||||
|
field: 'workshopCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '工段编号', |
||||
|
field: 'workshopSectionCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '部门', |
||||
|
field: 'departmentCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
isSearch: false |
||||
|
}, |
||||
|
// {
|
||||
|
// label: '是否可用',
|
||||
|
// field: 'available',
|
||||
|
// sort: 'custom',
|
||||
|
// dictType: DICT_TYPE.TRUE_FALSE,
|
||||
|
// dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
||||
|
// isSearch: false,
|
||||
|
// form: {
|
||||
|
// component: 'Switch',
|
||||
|
// value: 'TRUE',
|
||||
|
// componentProps: {
|
||||
|
// inactiveValue: 'FALSE',
|
||||
|
// activeValue: 'TRUE'
|
||||
|
// }
|
||||
|
// }
|
||||
|
// },
|
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
@ -0,0 +1,285 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="ToolMod.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="ToolMod.allSchemas" |
||||
|
/> |
||||
|
|
||||
|
<!-- 列表 --> |
||||
|
<ContentWrap> |
||||
|
<Table |
||||
|
:columns="tableColumns" |
||||
|
:data="tableObject.tableList" |
||||
|
:loading="tableObject.loading" |
||||
|
:pagination="{ |
||||
|
total: tableObject.total |
||||
|
}" |
||||
|
v-model:pageSize="tableObject.pageSize" |
||||
|
v-model:currentPage="tableObject.currentPage" |
||||
|
v-model:sort="tableObject.sort" |
||||
|
> |
||||
|
<template #code="{row}"> |
||||
|
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> |
||||
|
<span>{{ row.code }}</span> |
||||
|
</el-button> |
||||
|
</template> |
||||
|
<template #action="{ row }"> |
||||
|
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" /> |
||||
|
</template> |
||||
|
</Table> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 表单弹窗:添加/修改 --> |
||||
|
<!-- <BasicForm |
||||
|
ref="basicFormRef" |
||||
|
@success="formsSuccess" |
||||
|
:rules="ToolModRules" |
||||
|
:formAllSchemas="ToolMod.allSchemas" |
||||
|
:apiUpdate="ToolModApi.updateToolMod" |
||||
|
:apiCreate="ToolModApi.createToolMod" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
:isBusiness="false" |
||||
|
/> --> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="ToolMod.allSchemas" /> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<ImportForm ref="importFormRef" url="/eam/basic/tool-mod/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
||||
|
|
||||
|
<!-- 表单弹窗:添加/修改 --> |
||||
|
<teamForm ref="basicFormRef" @success="formsSuccess" :formAllSchemas="ToolMod.allSchemas"/> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { ToolMod,ToolModRules } from './toolMod.data' |
||||
|
import * as ToolModApi from '@/api/eam/toolMod' |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
||||
|
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
||||
|
import Detail from '@/components/Detail/src/Detail.vue' |
||||
|
import TeamForm from "./operateForm.vue"; |
||||
|
defineOptions({ name: 'ToolMod' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(ToolMod.allSchemas.tableColumns) |
||||
|
|
||||
|
// 字段设置 更新主列表字段 |
||||
|
const updataTableColumns = (val) => { |
||||
|
tableColumns.value = val |
||||
|
} |
||||
|
|
||||
|
const { tableObject, tableMethods } = useTable({ |
||||
|
getListApi: ToolModApi.getToolModPage // 分页接口 |
||||
|
}) |
||||
|
const judgeStatus = (row) =>{ |
||||
|
if(row.available === 'TRUE'){ |
||||
|
return true |
||||
|
}else{ |
||||
|
return false |
||||
|
} |
||||
|
} |
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultAddBtn({hasPermi:'eam:tool-mod:create'}), // 新增 |
||||
|
defaultButtons.defaultImportBtn({hasPermi:'eam:tool-mod:import'}), // 导入 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:'eam:tool-mod:export'}), // 导出 |
||||
|
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 == 'import') { // 导入 |
||||
|
handleImport() |
||||
|
} else if (val == 'export') { // 导出 |
||||
|
handleExport() |
||||
|
} else if (val == 'refresh') { // 刷新 |
||||
|
getList() |
||||
|
} else if (val == 'filtrate') { // 筛选 |
||||
|
} else { // 其他按钮 |
||||
|
console.log('其他按钮', item) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮 |
||||
|
const butttondata = (row) => { |
||||
|
return [ |
||||
|
defaultButtons.mainListEditBtn({hasPermi:'eam:tool-mod:update'}), // 编辑 |
||||
|
defaultButtons.mainListEnableBtn({hasPermi:'eam:tool-mod:enable',hide: judgeStatus(row)}), // 启用 |
||||
|
defaultButtons.mainListDisableBtn({hasPermi:'eam:tool-mod:disable',hide: !judgeStatus(row)}), // 禁用 |
||||
|
// defaultButtons.mainListDeleteBtn({hasPermi:'eam:tool-mod:delete'}), // 删除 |
||||
|
]} |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'edit') { // 编辑 |
||||
|
openForm('update', row) |
||||
|
} else if (val == 'delete') { // 删除 |
||||
|
handleDelete(row.id) |
||||
|
} else if (val == 'enable') { // 启用 |
||||
|
handleEnable(row,'TRUE') |
||||
|
}else if (val == 'disable') {// 禁用 |
||||
|
handleEnable(row,'FALSE') |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 添加/修改操作 */ |
||||
|
const basicFormRef = ref() |
||||
|
const openForm = (type: string, row?: any) => { |
||||
|
basicFormRef.value.open(type, row) |
||||
|
} |
||||
|
|
||||
|
// form表单提交 |
||||
|
const formsSuccess = async (formType,data) => { |
||||
|
var isHave =ToolMod.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') { |
||||
|
await ToolModApi.createToolMod(data) |
||||
|
message.success(t('common.createSuccess')) |
||||
|
} else { |
||||
|
await ToolModApi.updateToolMod(data) |
||||
|
message.success(t('common.updateSuccess')) |
||||
|
} |
||||
|
basicFormRef.value.dialogVisible = false |
||||
|
getList() |
||||
|
} |
||||
|
|
||||
|
/** 详情操作 */ |
||||
|
const detailRef = ref() |
||||
|
const openDetail = (row: any, titleName: any, titleValue: any) => { |
||||
|
detailRef.value.openDetail(row, titleName, titleValue, 'basicToolMod') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await ToolModApi.deleteToolMod(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 ToolModApi.exportToolMod(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 searchTableSuccess = (formField, searchField, val, formRef) => { |
||||
|
nextTick(() => { |
||||
|
const setV = {} |
||||
|
if (formField == 'modCodeShow') { |
||||
|
let str = '' |
||||
|
let modCodeList = Array(String) |
||||
|
val.forEach((element) => { |
||||
|
str += element.name + ':' + element.code + ',' |
||||
|
modCodeList.push(element.code) |
||||
|
}) |
||||
|
str = str.substring(0, str.length - 1) |
||||
|
setV['modCodeShow'] = str |
||||
|
setV['modCodeList'] = modCodeList |
||||
|
formRef.setValues(setV); |
||||
|
}else if(formField == 'toolCodeShow'){ |
||||
|
let str = val[0].name + ':' + val[0].code |
||||
|
str = str.substring(0, str.length - 1) |
||||
|
setV['toolCodeShow'] = str |
||||
|
setV['toolCode'] = val[0].code |
||||
|
formRef.setValues(setV); |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
const handleEnable = (row,enable) =>{ |
||||
|
message.confirm(t('您确定'+(enable=='TRUE'?'启用':'禁用')+'该项吗, 是否继续?')).then(() => { |
||||
|
row.available = enable |
||||
|
ToolModApi.updateToolMod(row).then(res => { |
||||
|
message.success(t('common.updateSuccess')) |
||||
|
}) |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
/** 初始化 **/ |
||||
|
onMounted(async () => { |
||||
|
getList() |
||||
|
importTemplateData.templateUrl = await ToolModApi.importTemplate() |
||||
|
}) |
||||
|
|
||||
|
</script> |
@ -0,0 +1,320 @@ |
|||||
|
<template> |
||||
|
<Dialog v-model="dialogVisible" :title="dialogTitle"> |
||||
|
<el-form |
||||
|
ref="basicFormRef" |
||||
|
v-loading="formLoading" |
||||
|
:model="formData" |
||||
|
:rules="formRules" |
||||
|
label-width="80px" |
||||
|
> |
||||
|
<el-row> |
||||
|
<el-col :span="24"> |
||||
|
<el-form-item label="工装" prop="toolCode"> |
||||
|
<div class="tag-container flex gap-2"> |
||||
|
<el-tag v-for="ent in toolCodeList" :key="ent.code" closable :disable-transitions="false" |
||||
|
@close="handleToolClose(ent.code)"> |
||||
|
{{ ent.name}} |
||||
|
</el-tag> |
||||
|
<el-input |
||||
|
v-if="inputToolVisible" |
||||
|
ref="InputRef" |
||||
|
v-model="inputToolValue" |
||||
|
class="w-20" |
||||
|
size="small" |
||||
|
/> |
||||
|
<el-button v-else class="button-new-tag" size="small" @click="addTool"> |
||||
|
选定工装 + |
||||
|
</el-button> |
||||
|
</div> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="24"> |
||||
|
<el-form-item label="物料" prop="modCodeList"> |
||||
|
<div class="tag-container flex gap-2"> |
||||
|
<el-tag v-for="ent in tags" :key="ent.code" closable :disable-transitions="false" |
||||
|
@close="handleClose(ent.code)"> |
||||
|
{{ ent.name}} |
||||
|
</el-tag> |
||||
|
<el-input |
||||
|
v-if="inputVisible" |
||||
|
ref="InputRef" |
||||
|
v-model="inputValue" |
||||
|
class="w-20" |
||||
|
size="small" |
||||
|
/> |
||||
|
<el-button v-else class="button-new-tag" size="small" @click="addMod"> |
||||
|
添加物料 + |
||||
|
</el-button> |
||||
|
</div> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
<el-row> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="类型" prop="type"> |
||||
|
<el-select v-model="formData.type" placeholder="请选择类型"> |
||||
|
<el-option |
||||
|
v-for="dict in getStrDictOptions(DICT_TYPE.DEVICE_TYPE)" |
||||
|
:key="dict.value" |
||||
|
:label="dict.label" |
||||
|
:value="dict.value" |
||||
|
/> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="备注" prop="remark"> |
||||
|
<el-input v-model="formData.remark" placeholder="请输入内容" /> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
</el-form> |
||||
|
<template #footer> |
||||
|
<el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button> |
||||
|
<el-button @click="dialogVisible = false">取 消</el-button> |
||||
|
</template> |
||||
|
</Dialog> |
||||
|
|
||||
|
<!--添加班组人员弹窗--> |
||||
|
<SearchTable ref="searchTableRef" @searchTableSuccess="searchTableSuccess" /> |
||||
|
|
||||
|
</template> |
||||
|
<script lang="ts" setup> |
||||
|
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict' |
||||
|
import request from "@/config/axios"; |
||||
|
import download from '@/utils/download' |
||||
|
import { ToolMod,ToolModRules } from './toolMod.data' |
||||
|
import {Itembasic} from "@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data"; |
||||
|
import * as ItembasicApi from "@/api/wms/itembasic"; |
||||
|
import { ToolAccounts,ToolAccountsRules } from '../toolAccounts/toolAccounts.data' |
||||
|
import * as ToolAccountsApi from '@/api/eam/toolAccounts' |
||||
|
import * as ToolModApi from '@/api/eam/toolMod' |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
defineOptions({ name: 'OperateForm' }) |
||||
|
|
||||
|
const { t } = useI18n() // 国际化 |
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
|
||||
|
const dialogVisible = ref(false) // 弹窗的是否展示 |
||||
|
const dialogTitle = ref('') // 弹窗的标题 |
||||
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 |
||||
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改 |
||||
|
const tags=ref([]) |
||||
|
const toolCodeList = ref([]) |
||||
|
const inputValue = ref('') |
||||
|
const inputToolValue = ref('') |
||||
|
const inputVisible = ref(false) |
||||
|
const inputToolVisible = ref(false) |
||||
|
const isDisabled = ref(false) |
||||
|
const isToolDisabled = ref(false) |
||||
|
const InputRef = ref<InstanceType<typeof ElInput>>() |
||||
|
|
||||
|
const formData = ref({ |
||||
|
toolCode: '', |
||||
|
modCodeList: [], |
||||
|
type: null, |
||||
|
remark: '' |
||||
|
}) |
||||
|
const formRules = reactive({ |
||||
|
modCodeList: [required], |
||||
|
toolCode: [required], |
||||
|
type: [required], |
||||
|
concurrencyStamp: [required] |
||||
|
}) |
||||
|
const basicFormRef = ref() // 表单 Ref |
||||
|
const handleClose = (code) => { |
||||
|
tags.value = tags.value.filter(item=>{ |
||||
|
return item.code!=code |
||||
|
}) |
||||
|
} |
||||
|
const handleToolClose = (code) => { |
||||
|
toolCodeList.value = toolCodeList.value.filter(item=>{ |
||||
|
return item.code!=code |
||||
|
}) |
||||
|
} |
||||
|
/** 弹窗相关参数 */ |
||||
|
const searchTableRef = ref(); |
||||
|
const _searchTableTitle = ref(); |
||||
|
const _searchTableAllSchemas = ref(); |
||||
|
const _searchTablePage = ref(); |
||||
|
const _formField = ref(); |
||||
|
const _searchField = ref(); |
||||
|
const _multiple = ref(); |
||||
|
const _type = ref(); |
||||
|
const _row = ref(); |
||||
|
const _searchCondition = ref({}) |
||||
|
|
||||
|
const addTool = () =>{ |
||||
|
addToolCommon(true,'toolCodeList') |
||||
|
} |
||||
|
const addMod = () =>{ |
||||
|
addModCommon(true,'modCodeList') |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** 选择物料弹窗 */ |
||||
|
const addModCommon = (multiple,field) => { |
||||
|
_searchCondition.value = {} |
||||
|
const filters: any[] = [] |
||||
|
filters.push({ |
||||
|
action: "==", |
||||
|
column: 'available', |
||||
|
value: 'TRUE' |
||||
|
}) |
||||
|
// 参数整理 |
||||
|
_searchCondition.value.isSearch = true |
||||
|
_searchCondition.value.filters = filters |
||||
|
_searchTableTitle.value = '选择物料' |
||||
|
_multiple.value = multiple |
||||
|
_formField.value = field |
||||
|
_searchField.value = field |
||||
|
_searchTablePage.value = ItembasicApi.getItembasicPage, |
||||
|
_searchTableAllSchemas.value = Itembasic.allSchemas, |
||||
|
openCommon() |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** 选择物料弹窗 */ |
||||
|
const addToolCommon = (multiple,field) => { |
||||
|
_searchCondition.value = {} |
||||
|
const filters: any[] = [] |
||||
|
filters.push({ |
||||
|
action: "==", |
||||
|
column: 'available', |
||||
|
value: 'TRUE' |
||||
|
}) |
||||
|
// 参数整理 |
||||
|
_searchCondition.value.isSearch = true |
||||
|
_searchCondition.value.filters = filters |
||||
|
_searchTableTitle.value = '选定工装' |
||||
|
_multiple.value = multiple |
||||
|
_formField.value = field |
||||
|
_searchField.value = field |
||||
|
_searchTablePage.value = ToolAccountsApi.getToolAccountsPage, |
||||
|
_searchTableAllSchemas.value = ToolAccounts.allSchemas, |
||||
|
openCommon() |
||||
|
} |
||||
|
|
||||
|
/** 弹窗选择之后 回调函数 */ |
||||
|
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => { |
||||
|
if (formField === 'modCodeList') { |
||||
|
tags.value = []; |
||||
|
val.forEach(item => { |
||||
|
let newMod = {} |
||||
|
newMod['code'] = item.code; |
||||
|
newMod['name'] = item.name; |
||||
|
tags.value.push(newMod); |
||||
|
}); |
||||
|
}else if (formField === 'toolCodeList') { |
||||
|
toolCodeList.value = []; |
||||
|
val.forEach(item => { |
||||
|
let newTool = {} |
||||
|
newTool['code'] = item.code; |
||||
|
newTool['name'] = item.name; |
||||
|
toolCodeList.value.push(newTool); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
/*打开弹窗*/ |
||||
|
const openCommon = () => { |
||||
|
searchTableRef.value.open( |
||||
|
_searchTableTitle.value, |
||||
|
_searchTableAllSchemas.value, |
||||
|
_searchTablePage.value, |
||||
|
_formField.value, |
||||
|
_searchField.value, |
||||
|
_multiple.value, |
||||
|
_type.value, |
||||
|
_row.value, |
||||
|
_searchCondition.value |
||||
|
) |
||||
|
} |
||||
|
/** 初始化弹窗 */ |
||||
|
const open = async (type: string, row?: object) => { |
||||
|
dialogVisible.value = true |
||||
|
dialogTitle.value = t('action.' + type) |
||||
|
formType.value = type |
||||
|
resetForm() |
||||
|
// 修改时,设置数据 |
||||
|
if (row) { |
||||
|
isDisabled.value = true; |
||||
|
formLoading.value = true |
||||
|
try { |
||||
|
// formData.value = await request.get({ url: `/wms/itembasic/get?id=` + row.id }); |
||||
|
// tags.value=formData.value |
||||
|
} finally { |
||||
|
formLoading.value = false |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
isDisabled.value = false; |
||||
|
tags.value=[]; |
||||
|
} |
||||
|
} |
||||
|
defineExpose({ open }) // 提供 open 方法,用于打开弹窗 |
||||
|
|
||||
|
/** 提交表单 */ |
||||
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调 |
||||
|
const submitForm = async () => { |
||||
|
|
||||
|
formData.value.modCodeList = tags.value.map(item=>item.code) |
||||
|
formData.value.toolCode = toolCodeList.value[0].code |
||||
|
// 校验表单 |
||||
|
if (!basicFormRef) return |
||||
|
const valid = await basicFormRef.value.validate() |
||||
|
if (!valid) return |
||||
|
// 提交请求 |
||||
|
formLoading.value = true |
||||
|
try { |
||||
|
const data = formData.value as unknown as ToolModApi.ToolModVO |
||||
|
if (formType.value === 'create') { |
||||
|
await ToolModApi.createToolModBatch(data) |
||||
|
message.success(t('common.createSuccess')) |
||||
|
} else { |
||||
|
await ToolModApi.updateToolMod(data) |
||||
|
message.success(t('common.updateSuccess')) |
||||
|
} |
||||
|
dialogVisible.value = false |
||||
|
// 发送操作成功的事件 |
||||
|
emit('success') |
||||
|
} finally { |
||||
|
formLoading.value = false |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 重置表单 */ |
||||
|
const resetForm = () => { |
||||
|
formData.value = { |
||||
|
toolCode: '', |
||||
|
modCodeList: [], |
||||
|
type: null, |
||||
|
remark: '' |
||||
|
} |
||||
|
basicFormRef.value?.resetFields() |
||||
|
} |
||||
|
|
||||
|
</script> |
||||
|
|
||||
|
<style scoped> |
||||
|
.tag-container { |
||||
|
margin-top: 10px; /* 可根据需要调整标签容器与表单项之间的间距 */ |
||||
|
border: 1px solid #ccc; /* 添加边框样式 */ |
||||
|
padding: 10px; /* 可根据需要调整容器内边距 */ |
||||
|
width: 950px; /* 设置固定宽度为 950px */ |
||||
|
overflow-y: auto; /* 当内容溢出容器高度时显示滚动条 */ |
||||
|
word-wrap: break-word; /* 使用 word-wrap 属性实现超出范围换行 */ |
||||
|
overflow-wrap: break-word; /* 兼容性更好的写法 */ |
||||
|
flex-wrap: wrap; |
||||
|
} |
||||
|
.input-with-button { |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
width: 100%; |
||||
|
} |
||||
|
|
||||
|
.input-with-button > .el-input { |
||||
|
flex: 1; |
||||
|
/*margin-right: 10px;*/ |
||||
|
} |
||||
|
|
||||
|
</style> |
@ -0,0 +1,155 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
import {Itembasic} from "@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data"; |
||||
|
import * as ItembasicApi from "@/api/wms/itembasic"; |
||||
|
import { ToolAccounts,ToolAccountsRules } from '../toolAccounts/toolAccounts.data' |
||||
|
import * as ToolAccountsApi from '@/api/eam/toolAccounts' |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const ToolModRules = reactive({ |
||||
|
modCode: [required], |
||||
|
toolCode: [required], |
||||
|
type: [required], |
||||
|
concurrencyStamp: [required] |
||||
|
}) |
||||
|
|
||||
|
export const ToolMod = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '工装编码', |
||||
|
field: 'toolCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isDetail: false, |
||||
|
isForm: false, |
||||
|
isTable: true, |
||||
|
isTableForm: false, |
||||
|
}, |
||||
|
// {
|
||||
|
// label: '工装编码',
|
||||
|
// field: 'toolCodeShow',
|
||||
|
// sort: 'custom',
|
||||
|
// isSearch: true,
|
||||
|
// form: {
|
||||
|
// componentProps: {
|
||||
|
// isSearchList: true,
|
||||
|
// searchListPlaceholder: '请选择工装代码',
|
||||
|
// searchField: 'toolCodeShow',
|
||||
|
// searchTitle: '客户物料基础信息',
|
||||
|
// searchAllSchemas: ToolAccounts.allSchemas,
|
||||
|
// searchPage: ToolAccountsApi.getToolAccountsPage,
|
||||
|
// searchCondition: [{
|
||||
|
// key: 'available',
|
||||
|
// value: 'TRUE',
|
||||
|
// isMainValue: false
|
||||
|
// }]
|
||||
|
// }
|
||||
|
// },
|
||||
|
// search: {
|
||||
|
// componentProps: {
|
||||
|
// isSearchList: true,
|
||||
|
// searchListPlaceholder: '请选择工装代码',
|
||||
|
// searchField: 'toolCodeShow',
|
||||
|
// searchTitle: '客户物料基础信息',
|
||||
|
// searchAllSchemas: ToolAccounts.allSchemas,
|
||||
|
// searchPage: ToolAccountsApi.getToolAccountsPage,
|
||||
|
// searchCondition: [{
|
||||
|
// key: 'available',
|
||||
|
// value: 'TRUE',
|
||||
|
// isMainValue: false
|
||||
|
// }]
|
||||
|
// }
|
||||
|
// }
|
||||
|
// },
|
||||
|
{ |
||||
|
label: '物料编号', |
||||
|
field: 'modCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isDetail: false, |
||||
|
isForm: false, |
||||
|
isTable: true, |
||||
|
isTableForm: false, |
||||
|
}, |
||||
|
// {
|
||||
|
// label: '物料编号',
|
||||
|
// field: 'modCodeShow',
|
||||
|
// sort: 'custom',
|
||||
|
// isSearch: true,
|
||||
|
// form: {
|
||||
|
// componentProps: {
|
||||
|
// isSearchList: true,
|
||||
|
// searchListPlaceholder: '请选择物料代码',
|
||||
|
// searchField: 'modCodeShow',
|
||||
|
// searchTitle: '客户物料基础信息',
|
||||
|
// multiple:true,
|
||||
|
// searchAllSchemas: Itembasic.allSchemas,
|
||||
|
// searchPage: ItembasicApi.getItembasicPage,
|
||||
|
// searchCondition: [{
|
||||
|
// key: 'available',
|
||||
|
// value: 'TRUE',
|
||||
|
// isMainValue: false
|
||||
|
// }]
|
||||
|
// }
|
||||
|
// },
|
||||
|
// search: {
|
||||
|
// componentProps: {
|
||||
|
// isSearchList: true,
|
||||
|
// searchListPlaceholder: '请选择物料代码',
|
||||
|
// searchField: 'modCodeShow',
|
||||
|
// searchTitle: '客户物料基础信息',
|
||||
|
// multiple: true,
|
||||
|
// searchAllSchemas: Itembasic.allSchemas,
|
||||
|
// searchPage: ItembasicApi.getItembasicPage,
|
||||
|
// searchCondition: [{
|
||||
|
// key: 'available',
|
||||
|
// value: 'TRUE',
|
||||
|
// isMainValue: false
|
||||
|
// }]
|
||||
|
// }
|
||||
|
// }
|
||||
|
// },
|
||||
|
{ |
||||
|
label: '类型', |
||||
|
field: 'type', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.DEVICE_TYPE, |
||||
|
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'Select' |
||||
|
} |
||||
|
}, |
||||
|
// {
|
||||
|
// label: '部门',
|
||||
|
// field: 'departmentCode',
|
||||
|
// sort: 'custom',
|
||||
|
// isSearch: true
|
||||
|
// },
|
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '是否可用', |
||||
|
field: 'available', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
||||
|
isTable: true, |
||||
|
isDetail: false, |
||||
|
isSearch: false, |
||||
|
isTableForm: false, |
||||
|
isForm: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
Loading…
Reference in new issue