ljlong_2630
6 months ago
124 changed files with 5385 additions and 155 deletions
@ -0,0 +1,61 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface BasicSpotCheckSelectSetVO { |
|||
id: number |
|||
name: string |
|||
describing: string |
|||
itemCode: string |
|||
departmentCode: string |
|||
remark: string |
|||
siteId: string |
|||
available: string |
|||
deletionTime: Date |
|||
deleterId: byte[] |
|||
concurrencyStamp: number |
|||
} |
|||
|
|||
// 查询点检选择集维护列表
|
|||
export const getBasicSpotCheckSelectSetPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/eam/basic-spot-check-select-set/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/eam/basic-spot-check-select-set/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询点检选择集维护详情
|
|||
export const getBasicSpotCheckSelectSet = async (id: number) => { |
|||
return await request.get({ url: `/eam/basic-spot-check-select-set/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增点检选择集维护
|
|||
export const createBasicSpotCheckSelectSet = async (data: BasicSpotCheckSelectSetVO) => { |
|||
return await request.post({ url: `/eam/basic-spot-check-select-set/create`, data }) |
|||
} |
|||
|
|||
// 修改点检选择集维护
|
|||
export const updateBasicSpotCheckSelectSet = async (data: BasicSpotCheckSelectSetVO) => { |
|||
return await request.put({ url: `/eam/basic-spot-check-select-set/update`, data }) |
|||
} |
|||
|
|||
// 删除点检选择集维护
|
|||
export const deleteBasicSpotCheckSelectSet = async (id: number) => { |
|||
return await request.delete({ url: `/eam/basic-spot-check-select-set/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出点检选择集维护 Excel
|
|||
export const exportBasicSpotCheckSelectSet = async (params) => { |
|||
return await request.download({ url: `/eam/basic-spot-check-select-set/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/eam/basic-spot-check-select-set/get-import-template' }) |
|||
} |
|||
|
|||
// 启用 / 禁用
|
|||
export const updateEnableCode = async (data: BasicSpotCheckSelectSetVO) => { |
|||
return await request.post({ url: `/eam/basic-spot-check-select-set/ables` , data }) |
|||
} |
@ -0,0 +1,61 @@ |
|||
import request from '@/config/axios' |
|||
import {BasicSpotCheckSelectSetVO} from "@/api/eam/basicSpotCheckSelectSet"; |
|||
|
|||
export interface DocumentTypeSelectSetVO { |
|||
id: number |
|||
name: string |
|||
itemCode: string |
|||
departmentCode: string |
|||
remark: string |
|||
siteId: string |
|||
available: string |
|||
deletionTime: Date |
|||
deleterId: byte[] |
|||
concurrencyStamp: number |
|||
} |
|||
|
|||
// 查询文档类型选择集列表
|
|||
export const getDocumentTypeSelectSetPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/eam/document-type-select-set/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/eam/document-type-select-set/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询文档类型选择集详情
|
|||
export const getDocumentTypeSelectSet = async (id: number) => { |
|||
return await request.get({ url: `/eam/document-type-select-set/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增文档类型选择集
|
|||
export const createDocumentTypeSelectSet = async (data: DocumentTypeSelectSetVO) => { |
|||
return await request.post({ url: `/eam/document-type-select-set/create`, data }) |
|||
} |
|||
|
|||
// 修改文档类型选择集
|
|||
export const updateDocumentTypeSelectSet = async (data: DocumentTypeSelectSetVO) => { |
|||
return await request.put({ url: `/eam/document-type-select-set/update`, data }) |
|||
} |
|||
|
|||
// 删除文档类型选择集
|
|||
export const deleteDocumentTypeSelectSet = async (id: number) => { |
|||
return await request.delete({ url: `/eam/document-type-select-set/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出文档类型选择集 Excel
|
|||
export const exportDocumentTypeSelectSet = async (params) => { |
|||
return await request.download({ url: `/eam/document-type-select-set/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/eam/document-type-select-set/get-import-template' }) |
|||
} |
|||
|
|||
// 启用 / 禁用
|
|||
export const updateEnableCode = async (data: DocumentTypeSelectSetVO) => { |
|||
return await request.post({ url: `/eam/document-type-select-set/ables` , data }) |
|||
} |
@ -0,0 +1,60 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface InspectionItemSelectSetVO { |
|||
id: number |
|||
name: string |
|||
itemCode: string |
|||
departmentCode: string |
|||
remark: string |
|||
siteId: string |
|||
available: string |
|||
deletionTime: Date |
|||
deleterId: byte[] |
|||
concurrencyStamp: number |
|||
} |
|||
|
|||
// 查询巡检项选择集列表
|
|||
export const getInspectionItemSelectSetPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/eam/inspection-item-select-set/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/eam/inspection-item-select-set/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询巡检项选择集详情
|
|||
export const getInspectionItemSelectSet = async (id: number) => { |
|||
return await request.get({ url: `/eam/inspection-item-select-set/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增巡检项选择集
|
|||
export const createInspectionItemSelectSet = async (data: InspectionItemSelectSetVO) => { |
|||
return await request.post({ url: `/eam/inspection-item-select-set/create`, data }) |
|||
} |
|||
|
|||
// 修改巡检项选择集
|
|||
export const updateInspectionItemSelectSet = async (data: InspectionItemSelectSetVO) => { |
|||
return await request.put({ url: `/eam/inspection-item-select-set/update`, data }) |
|||
} |
|||
|
|||
// 删除巡检项选择集
|
|||
export const deleteInspectionItemSelectSet = async (id: number) => { |
|||
return await request.delete({ url: `/eam/inspection-item-select-set/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出巡检项选择集 Excel
|
|||
export const exportInspectionItemSelectSet = async (params) => { |
|||
return await request.download({ url: `/eam/inspection-item-select-set/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/eam/inspection-item-select-set/get-import-template' }) |
|||
} |
|||
|
|||
// 启用 / 禁用
|
|||
export const updateEnableCode = async (data: InspectionItemSelectSetVO) => { |
|||
return await request.post({ url: `/eam/inspection-item-select-set/ables` , data }) |
|||
} |
@ -0,0 +1,74 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface RelegateRecordDetailVO { |
|||
id: number |
|||
masterId: number |
|||
itemCode: string |
|||
downItemCode: string |
|||
businessType: string |
|||
uom: string |
|||
qty: number |
|||
inventoryStatus: string |
|||
fromBatch: string |
|||
fromPackingNumber: string |
|||
fromLocationCode: string |
|||
fromAreaTypes: string |
|||
fromAreaCodes: string |
|||
toPackingNumber: string |
|||
toBatch: string |
|||
toLocationCode: string |
|||
toWarehouseCode: string |
|||
toAreaTypes: string |
|||
toAreaCodes: string |
|||
number: string |
|||
available: string |
|||
remark: string |
|||
departmentCode: string |
|||
siteId: number |
|||
extraProperties: string |
|||
status: string |
|||
concurrencyStamp: number |
|||
serialNumber: string |
|||
ruleUserId: number |
|||
} |
|||
|
|||
// 查询物料降级记录子列表
|
|||
export const getRelegateRecordDetailPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/wms/relegate-record-detail/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/wms/relegate-record-detail/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询物料降级记录子详情
|
|||
export const getRelegateRecordDetail = async (id: number) => { |
|||
return await request.get({ url: `/wms/relegate-record-detail/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增物料降级记录子
|
|||
export const createRelegateRecordDetail = async (data: RelegateRecordDetailVO) => { |
|||
return await request.post({ url: `/wms/relegate-record-detail/create`, data }) |
|||
} |
|||
|
|||
// 修改物料降级记录子
|
|||
export const updateRelegateRecordDetail = async (data: RelegateRecordDetailVO) => { |
|||
return await request.put({ url: `/wms/relegate-record-detail/update`, data }) |
|||
} |
|||
|
|||
// 删除物料降级记录子
|
|||
export const deleteRelegateRecordDetail = async (id: number) => { |
|||
return await request.delete({ url: `/wms/relegate-record-detail/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出物料降级记录子 Excel
|
|||
export const exportRelegateRecordDetail = async (params) => { |
|||
return await request.download({ url: `/wms/relegate-record-detail/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/wms/relegate-record-detail/get-import-template' }) |
|||
} |
@ -0,0 +1,61 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface RelegateRecordMainVO { |
|||
id: number |
|||
requestNumber: string |
|||
executeTime: Date |
|||
activeDate: Date |
|||
available: string |
|||
requestTime: Date |
|||
dueTime: Date |
|||
departmentCode: string |
|||
userGroupCode: string |
|||
interfaceType: string |
|||
code: string |
|||
number: string |
|||
businessType: string |
|||
remark: string |
|||
extraProperties: string |
|||
siteId: string |
|||
} |
|||
|
|||
// 查询物料降级记录主列表
|
|||
export const getRelegateRecordMainPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/wms/relegate-record-main/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/wms/relegate-record-main/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询物料降级记录主详情
|
|||
export const getRelegateRecordMain = async (id: number) => { |
|||
return await request.get({ url: `/wms/relegate-record-main/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增物料降级记录主
|
|||
export const createRelegateRecordMain = async (data: RelegateRecordMainVO) => { |
|||
return await request.post({ url: `/wms/relegate-record-main/create`, data }) |
|||
} |
|||
|
|||
// 修改物料降级记录主
|
|||
export const updateRelegateRecordMain = async (data: RelegateRecordMainVO) => { |
|||
return await request.put({ url: `/wms/relegate-record-main/update`, data }) |
|||
} |
|||
|
|||
// 删除物料降级记录主
|
|||
export const deleteRelegateRecordMain = async (id: number) => { |
|||
return await request.delete({ url: `/wms/relegate-record-main/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出物料降级记录主 Excel
|
|||
export const exportRelegateRecordMain = async (params) => { |
|||
return await request.download({ url: `/wms/relegate-record-main/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/wms/relegate-record-main/get-import-template' }) |
|||
} |
@ -0,0 +1,98 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface RelegateRequestMainVO { |
|||
id: number |
|||
fromWarehouseCode: string |
|||
number: string |
|||
businessType: string |
|||
remark: string |
|||
extraProperties: string |
|||
siteId: string |
|||
requestTime: Date |
|||
dueTime: Date |
|||
departmentCode: string |
|||
status: string |
|||
autoCommit: string |
|||
autoAgree: string |
|||
autoExecute: string |
|||
directCreateRecord: string |
|||
concurrencyStamp: number |
|||
ruleUserId: number |
|||
fromAreaTypes: string |
|||
fromAreaCodes: string |
|||
serialNumber: string |
|||
inInventoryStatuses: string |
|||
outInventoryStatuses: string |
|||
reason: string |
|||
} |
|||
|
|||
// 查询物料降级申请主列表
|
|||
export const getRelegateRequestMainPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/wms/relegate-request-main/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/wms/relegate-request-main/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询物料降级申请主详情
|
|||
export const getRelegateRequestMain = async (id: number) => { |
|||
return await request.get({ url: `/wms/relegate-request-main/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增物料降级申请主
|
|||
export const createRelegateRequestMain = async (data: RelegateRequestMainVO) => { |
|||
return await request.post({ url: `/wms/relegate-request-main/create`, data }) |
|||
} |
|||
|
|||
// 修改物料降级申请主
|
|||
export const updateRelegateRequestMain = async (data: RelegateRequestMainVO) => { |
|||
return await request.put({ url: `/wms/relegate-request-main/update`, data }) |
|||
} |
|||
|
|||
// 删除物料降级申请主
|
|||
export const deleteRelegateRequestMain = async (id: number) => { |
|||
return await request.delete({ url: `/wms/relegate-request-main/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出物料降级申请主 Excel
|
|||
export const exportRelegateRequestMain = async (params) => { |
|||
return await request.download({ url: `/wms/relegate-request-main/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/wms/relegate-request-main/get-import-template' }) |
|||
} |
|||
|
|||
// 关闭
|
|||
export const close = (id) => { |
|||
return request.put({ url: '/wms/relegate-request-main/close?id=' + id }) |
|||
} |
|||
|
|||
// 重新添加
|
|||
export const reAdd = (id) => { |
|||
return request.put({ url: '/wms/relegate-request-main/reAdd?id=' + id }) |
|||
} |
|||
|
|||
// 提交审批
|
|||
export const submit = (id) => { |
|||
return request.put({ url: '/wms/relegate-request-main/submit?id=' + id }) |
|||
} |
|||
|
|||
// 驳回
|
|||
export const refused = (id) => { |
|||
return request.put({ url: '/wms/relegate-request-main/refused?id=' + id }) |
|||
} |
|||
|
|||
// 审批通过
|
|||
export const agree = (id) => { |
|||
return request.put({ url: '/wms/relegate-request-main/agree?id=' + id }) |
|||
} |
|||
|
|||
// 处理
|
|||
export const handle = (id) => { |
|||
return request.put({ url: '/wms/relegate-request-main/handle?id=' + id }) |
|||
} |
@ -0,0 +1,147 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
|
|||
// 表单校验
|
|||
export const BasicSpotCheckSelectSetRules = reactive({ |
|||
name: [required], |
|||
describing: [required], |
|||
concurrencyStamp: [required], |
|||
}) |
|||
|
|||
export const BasicSpotCheckSelectSet = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: 'id', |
|||
field: 'id', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '选择集名称', |
|||
field: 'name', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '描述', |
|||
field: 'describing', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '项编号', |
|||
field: 'itemCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '创建时间', |
|||
field: 'createTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: true, |
|||
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')] |
|||
} |
|||
}, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '部门id', |
|||
field: 'departmentCode', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '备注', |
|||
field: 'remark', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '地点ID', |
|||
field: 'siteId', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '是否可用', |
|||
field: 'available', |
|||
sort: 'custom', |
|||
dictType: DICT_TYPE.TRUE_FALSE, |
|||
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
|||
isTable: true, |
|||
isDetail: false, |
|||
isSearch: true, |
|||
isTableForm: false, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '删除时间', |
|||
field: 'deletionTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail: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: '删除人id', |
|||
field: 'deleterId', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '并发乐观锁', |
|||
field: 'concurrencyStamp', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isForm: false, |
|||
table: { |
|||
width: 150, |
|||
fixed: 'right' |
|||
} |
|||
} |
|||
])) |
@ -0,0 +1,287 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="BasicSpotCheckSelectSet.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="BasicSpotCheckSelectSet.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 #name="{row}"> |
|||
<el-button type="primary" link @click="openDetail(row, '代码', row.name)"> |
|||
<span>{{ row.name }}</span> |
|||
</el-button> |
|||
</template> |
|||
<template #action="{ row }"> |
|||
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" /> |
|||
</template> |
|||
</Table> |
|||
</ContentWrap> |
|||
|
|||
<!-- 表单弹窗:添加/修改 --> |
|||
<ItemForm ref="basicFormRef" @success="getData"/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="BasicSpotCheckSelectSet.allSchemas" /> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/eam/basic-spot-check-select-set/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { BasicSpotCheckSelectSet,BasicSpotCheckSelectSetRules } from './basicSpotCheckSelectSet.data' |
|||
import * as BasicSpotCheckSelectSetApi from '@/api/eam/basicSpotCheckSelectSet' |
|||
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 ItemForm from "@/views/eam/basicSpotCheckSelectSet/itemSelectSetForm.vue"; |
|||
|
|||
defineOptions({ name: 'BasicSpotCheckSelectSet' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(BasicSpotCheckSelectSet.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: BasicSpotCheckSelectSetApi.getBasicSpotCheckSelectSetPage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn({hasPermi:'eam:basicSpotCheckSelectSet:create'}), // 新增 |
|||
//defaultButtons.defaultImportBtn({hasPermi:'eam:basicSpotCheckSelectSet:import'}), // 导入 |
|||
//defaultButtons.defaultExportBtn({hasPermi:'eam:basicSpotCheckSelectSet: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 isShowMainButton = (row,val) => { |
|||
if (val.indexOf(row.available) > -1) { |
|||
return false |
|||
} else { |
|||
return true |
|||
} |
|||
} |
|||
|
|||
// 列表-操作按钮 |
|||
const butttondata = (row) => { |
|||
return [ |
|||
defaultButtons.mainListEditBtn({hasPermi:'eam:basicSpotCheckSelectSet:update'}), // 编辑 |
|||
//defaultButtons.mainListDeleteBtn({hasPermi:'eam:equipmentMainPart:delete'}), // 删除 |
|||
defaultButtons.mainListEnableBtn({hide:isShowMainButton(row,['FALSE']),hasPermi:'eam:basicSpotCheckSelectSet:update'}), |
|||
defaultButtons.mainListDisableBtn({hide:isShowMainButton(row,['TRUE']),hasPermi:'eam:basicSpotCheckSelectSet:update'}), |
|||
] |
|||
} |
|||
|
|||
// 列表-操作按钮事件 |
|||
const buttonTableClick = async (val, row) => { |
|||
if (val == 'edit') { // 编辑 |
|||
openForm('update', row) |
|||
} else if (val == 'delete') { // 删除 |
|||
handleDelete(row.id) |
|||
} else if (val == 'enable') { |
|||
handleEnable(row.id) |
|||
} else if (val == 'disable') { |
|||
handleDisable(row.id) |
|||
} |
|||
} |
|||
|
|||
/** 添加/修改操作 */ |
|||
const basicFormRef = ref() |
|||
const openForm = (type: string, row?: any) => { |
|||
basicFormRef.value.open(type, row) |
|||
} |
|||
|
|||
// form表单提交 |
|||
const formsSuccess = async (formType,data) => { |
|||
var isHave =BasicSpotCheckSelectSet.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 BasicSpotCheckSelectSetApi.createBasicSpotCheckSelectSet(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await BasicSpotCheckSelectSetApi.updateBasicSpotCheckSelectSet(data) |
|||
message.success(t('common.updateSuccess')) |
|||
} |
|||
basicFormRef.value.dialogVisible = false |
|||
getList() |
|||
} |
|||
|
|||
//刷新页面 |
|||
const getData = async() => { |
|||
getList(); |
|||
} |
|||
|
|||
/** 详情操作 */ |
|||
const detailRef = ref() |
|||
const openDetail = (row: any, titleName: any, titleValue: any) => { |
|||
detailRef.value.openDetail(row, titleName, titleValue, 'basicBasicSpotCheckSelectSet') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await BasicSpotCheckSelectSetApi.deleteBasicSpotCheckSelectSet(id) |
|||
message.success(t('common.delSuccess')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch {} |
|||
} |
|||
|
|||
/** 启用 */ |
|||
const handleEnable = async (id: number) => { |
|||
try { |
|||
const params = ref({ |
|||
id: '', |
|||
available:'', |
|||
}) |
|||
params.value.id = id |
|||
params.value.available = 'TRUE' |
|||
await BasicSpotCheckSelectSetApi.updateEnableCode(params.value) |
|||
message.success(t('common.updateSuccess')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch {} |
|||
} |
|||
/** 禁用 */ |
|||
const handleDisable = async (id: number) => { |
|||
try { |
|||
const params = ref({ |
|||
id: '', |
|||
available:'', |
|||
}) |
|||
params.value.id = id |
|||
params.value.available = 'FALSE' |
|||
await BasicSpotCheckSelectSetApi.updateEnableCode(params.value) |
|||
message.success(t('common.updateSuccess')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch {} |
|||
} |
|||
|
|||
/** 导出按钮操作 */ |
|||
const exportLoading = ref(false) // 导出的加载中 |
|||
const handleExport = async () => { |
|||
try { |
|||
// 导出的二次确认 |
|||
await message.exportConfirm() |
|||
// 发起导出 |
|||
exportLoading.value = true |
|||
const data = await BasicSpotCheckSelectSetApi.exportBasicSpotCheckSelectSet(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() |
|||
}) |
|||
|
|||
</script> |
@ -0,0 +1,287 @@ |
|||
<template> |
|||
<Dialog v-model="dialogVisible" :title="dialogTitle"> |
|||
<el-form |
|||
ref="basicFormRef" |
|||
v-loading="formLoading" |
|||
:model="formData" |
|||
:rules="formRules" |
|||
label-width="100px" |
|||
> |
|||
<el-row> |
|||
<el-col :span="12"> |
|||
<el-form-item label="选择集名称" prop="name"> |
|||
<el-input v-model="formData.name" placeholder="选择集名称" :disabled="isDisabled"/> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<el-form-item label="描述" prop="describing"> |
|||
<el-input v-model="formData.describing" placeholder="描述" :disabled="isDisabled"/> |
|||
</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-row> |
|||
<el-col :span="24"> |
|||
<el-form-item label="点检项" prop="items"> |
|||
<div class="tag-container flex gap-2"> |
|||
<el-tag v-for="ent in tags" :key="ent.content" closable :disable-transitions="false" @close="handleClose(ent.id)"> |
|||
{{ ent.content}} |
|||
</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="addItem"> |
|||
添加点检项 + |
|||
</el-button> |
|||
</div> |
|||
</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 * as SelectSetApi from '@/api/eam/basicSpotCheckSelectSet' |
|||
import request from "@/config/axios"; |
|||
import { SearchTable } from '@/components/SearchTable' |
|||
import { InspectionItem} from "@/views/eam/inspectionItem/inspectionItem.data"; |
|||
import * as spotCheckItemApi from "@/api/eam/spotCheckItem"; |
|||
import {ElInput} from "element-plus"; |
|||
|
|||
defineOptions({ name: 'TeamForm' }) |
|||
|
|||
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 inputValue = ref('') |
|||
const inputVisible = ref(false) |
|||
const isDisabled = ref(false) |
|||
const InputRef = ref<InstanceType<typeof ElInput>>() |
|||
|
|||
const itemData = ref({ |
|||
id: '', |
|||
content: '' |
|||
}) |
|||
|
|||
const formData = ref({ |
|||
id: '', |
|||
name: '', |
|||
describing: '', |
|||
itemCode: '', |
|||
available: 'TRUE', |
|||
remark: '', |
|||
createTime: '' |
|||
}) |
|||
const formRules = reactive({ |
|||
name: [ |
|||
{ required: true, message: '选择集名称不能为空', trigger: 'blur' }, |
|||
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } |
|||
], |
|||
remark: [ |
|||
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } |
|||
], |
|||
}) |
|||
const basicFormRef = ref() // 表单 Ref |
|||
|
|||
/** 删除点检项 */ |
|||
const handleClose = (id: string) => { |
|||
const index = tags.value.findIndex(tag => tag.id === id); |
|||
if (index !== -1) { |
|||
tags.value.splice(index, 1); |
|||
} |
|||
} |
|||
|
|||
/** 弹窗相关参数 */ |
|||
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 addItem = () =>{ |
|||
addItemCommon(true,'dianJianItem') |
|||
} |
|||
|
|||
/** 选择点检项弹窗 */ |
|||
const addItemCommon = (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 = spotCheckItemApi.getSpotCheckItemPage |
|||
_searchTableAllSchemas.value = InspectionItem.allSchemas |
|||
openCommon() |
|||
} |
|||
|
|||
/** 弹窗选择之后 回调函数 添加选择集 */ |
|||
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => { |
|||
nextTick?.(() => { |
|||
if (formField === 'dianJianItem') { |
|||
val.forEach(item => { |
|||
const isExist = tags.value.some(tag => tag.content === item.content); |
|||
if (!isExist){ |
|||
const newItem = {}; |
|||
newItem['content'] = item.content; |
|||
newItem['id'] = item.id; |
|||
tags.value.push(newItem); |
|||
} |
|||
}); |
|||
} |
|||
}) |
|||
} |
|||
/*打开弹窗*/ |
|||
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 |
|||
// 修改时,设置数据 |
|||
if (row) { |
|||
tags.value=[]; |
|||
isDisabled.value = true; |
|||
formLoading.value = true |
|||
formData.value = row; |
|||
let item = (row.itemCode).split(",") |
|||
try { |
|||
for (var i = 0; i < item.length; i++) { |
|||
itemData.value = await request.get({ url: `/eam/basic/inspection-item/get?id=` + item[i] }); |
|||
tags.value.push(itemData.value); |
|||
} |
|||
} finally { |
|||
formLoading.value = false |
|||
} |
|||
} |
|||
// 新增时 |
|||
else { |
|||
resetForm() |
|||
isDisabled.value = false; |
|||
} |
|||
} |
|||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗 |
|||
|
|||
/** 提交表单 */ |
|||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调 |
|||
const submitForm = async () => { |
|||
// 校验表单 |
|||
if (!basicFormRef) return |
|||
const valid = await basicFormRef.value.validate() |
|||
if (!valid) return |
|||
if (tags.value.length > 10 ){ |
|||
message.warning('点检项最多10个'); |
|||
return |
|||
} |
|||
|
|||
let result = ''; |
|||
for (var i = 0; i < tags.value.length; i++) { |
|||
result += tags.value[i].id + ','; |
|||
} |
|||
if(result.endsWith(',')){ |
|||
result = result.substring(0,result.length -1) |
|||
} |
|||
formData.value.itemCode = result |
|||
// 提交请求 |
|||
formLoading.value = true |
|||
//formData.value.members = JSON.stringify(tags.value) |
|||
try { |
|||
const data = formData.value as unknown as SelectSetApi.BasicSpotCheckSelectSetVO |
|||
if (formType.value === 'create') { |
|||
await SelectSetApi.createBasicSpotCheckSelectSet(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await SelectSetApi.updateBasicSpotCheckSelectSet(data) |
|||
message.success(t('common.updateSuccess')) |
|||
} |
|||
dialogVisible.value = false |
|||
// 发送操作成功的事件 |
|||
emit('success') |
|||
} finally { |
|||
formLoading.value = false |
|||
} |
|||
} |
|||
|
|||
/** 重置表单 */ |
|||
const resetForm = () => { |
|||
formData.value = { |
|||
id: '', |
|||
name: '', |
|||
describing: '', |
|||
itemCode: '', |
|||
available: 'TRUE', |
|||
remark: '', |
|||
createTime: '' |
|||
} |
|||
tags.value=[]; |
|||
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,140 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
|
|||
// 表单校验
|
|||
export const DocumentTypeSelectSetRules = reactive({ |
|||
name: [required], |
|||
itemCode: [required], |
|||
}) |
|||
|
|||
export const DocumentTypeSelectSet = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: 'id', |
|||
field: 'id', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '选择集名称', |
|||
field: 'name', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '项编号', |
|||
field: 'itemCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '创建时间', |
|||
field: 'createTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: true, |
|||
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')] |
|||
} |
|||
}, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '部门id', |
|||
field: 'departmentCode', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '备注', |
|||
field: 'remark', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '地点ID', |
|||
field: 'siteId', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '是否可用', |
|||
field: 'available', |
|||
sort: 'custom', |
|||
dictType: DICT_TYPE.TRUE_FALSE, |
|||
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
|||
isTable: true, |
|||
isDetail: false, |
|||
isSearch: true, |
|||
isTableForm: false, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '删除时间', |
|||
field: 'deletionTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail: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: '删除人id', |
|||
field: 'deleterId', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '并发乐观锁', |
|||
field: 'concurrencyStamp', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isForm: false, |
|||
table: { |
|||
width: 150, |
|||
fixed: 'right' |
|||
} |
|||
} |
|||
])) |
@ -0,0 +1,300 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="DocumentTypeSelectSet.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="DocumentTypeSelectSet.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 #name="{row}"> |
|||
<el-button type="primary" link @click="openDetail(row, '代码', row.name)"> |
|||
<span>{{ row.name }}</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="DocumentTypeSelectSetRules" |
|||
:formAllSchemas="DocumentTypeSelectSet.allSchemas" |
|||
:apiUpdate="DocumentTypeSelectSetApi.updateDocumentTypeSelectSet" |
|||
:apiCreate="DocumentTypeSelectSetApi.createDocumentTypeSelectSet" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
:isBusiness="false" |
|||
/> |
|||
|
|||
<!-- 表单弹窗:添加/修改 --> |
|||
<ItemForm ref="basicFormRef" @success="getData"/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="DocumentTypeSelectSet.allSchemas" /> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/eam/document-type-select-set/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { DocumentTypeSelectSet,DocumentTypeSelectSetRules } from './documentTypeSelectSet.data' |
|||
import * as DocumentTypeSelectSetApi from '@/api/eam/documentTypeSelectSet' |
|||
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 ItemForm from "@/views/eam/documentTypeSelectSet/itemSelectSetForm.vue"; |
|||
|
|||
defineOptions({ name: 'DocumentTypeSelectSet' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(DocumentTypeSelectSet.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: DocumentTypeSelectSetApi.getDocumentTypeSelectSetPage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn({hasPermi:'eam:documentTypeSelectSet:create'}), // 新增 |
|||
//defaultButtons.defaultImportBtn({hasPermi:'eam:documentTypeSelectSet:import'}), // 导入 |
|||
//defaultButtons.defaultExportBtn({hasPermi:'eam:documentTypeSelectSet: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 isShowMainButton = (row,val) => { |
|||
if (val.indexOf(row.available) > -1) { |
|||
return false |
|||
} else { |
|||
return true |
|||
} |
|||
} |
|||
|
|||
// 列表-操作按钮 |
|||
const butttondata = (row) => { |
|||
return [ |
|||
defaultButtons.mainListEditBtn({hasPermi:'eam:documentTypeSelectSet:update'}), // 编辑 |
|||
defaultButtons.mainListEnableBtn({hide:isShowMainButton(row,['FALSE']),hasPermi:'eam:documentTypeSelectSet:update'}), |
|||
defaultButtons.mainListDisableBtn({hide:isShowMainButton(row,['TRUE']),hasPermi:'eam:documentTypeSelectSet:update'}), |
|||
] |
|||
} |
|||
|
|||
// 列表-操作按钮事件 |
|||
const buttonTableClick = async (val, row) => { |
|||
if (val == 'edit') { // 编辑 |
|||
openForm('update', row) |
|||
} else if (val == 'delete') { // 删除 |
|||
handleDelete(row.id) |
|||
} else if (val == 'enable') { |
|||
handleEnable(row.id) |
|||
} else if (val == 'disable') { |
|||
handleDisable(row.id) |
|||
} |
|||
} |
|||
|
|||
/** 添加/修改操作 */ |
|||
const basicFormRef = ref() |
|||
const openForm = (type: string, row?: any) => { |
|||
basicFormRef.value.open(type, row) |
|||
} |
|||
|
|||
// form表单提交 |
|||
const formsSuccess = async (formType,data) => { |
|||
var isHave =DocumentTypeSelectSet.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 DocumentTypeSelectSetApi.createDocumentTypeSelectSet(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await DocumentTypeSelectSetApi.updateDocumentTypeSelectSet(data) |
|||
message.success(t('common.updateSuccess')) |
|||
} |
|||
basicFormRef.value.dialogVisible = false |
|||
getList() |
|||
} |
|||
|
|||
//刷新页面 |
|||
const getData = async() => { |
|||
getList(); |
|||
} |
|||
|
|||
/** 详情操作 */ |
|||
const detailRef = ref() |
|||
const openDetail = (row: any, titleName: any, titleValue: any) => { |
|||
detailRef.value.openDetail(row, titleName, titleValue, 'basicDocumentTypeSelectSet') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await DocumentTypeSelectSetApi.deleteDocumentTypeSelectSet(id) |
|||
message.success(t('common.delSuccess')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch {} |
|||
} |
|||
|
|||
/** 启用 */ |
|||
const handleEnable = async (id: number) => { |
|||
try { |
|||
const params = ref({ |
|||
id: '', |
|||
available:'', |
|||
}) |
|||
params.value.id = id |
|||
params.value.available = 'TRUE' |
|||
await DocumentTypeSelectSetApi.updateEnableCode(params.value) |
|||
message.success(t('common.updateSuccess')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch {} |
|||
} |
|||
/** 禁用 */ |
|||
const handleDisable = async (id: number) => { |
|||
try { |
|||
const params = ref({ |
|||
id: '', |
|||
available:'', |
|||
}) |
|||
params.value.id = id |
|||
params.value.available = 'FALSE' |
|||
await DocumentTypeSelectSetApi.updateEnableCode(params.value) |
|||
message.success(t('common.updateSuccess')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch {} |
|||
} |
|||
|
|||
|
|||
/** 导出按钮操作 */ |
|||
const exportLoading = ref(false) // 导出的加载中 |
|||
const handleExport = async () => { |
|||
try { |
|||
// 导出的二次确认 |
|||
await message.exportConfirm() |
|||
// 发起导出 |
|||
exportLoading.value = true |
|||
const data = await DocumentTypeSelectSetApi.exportDocumentTypeSelectSet(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 DocumentTypeSelectSetApi.importTemplate() |
|||
}) |
|||
|
|||
</script> |
@ -0,0 +1,292 @@ |
|||
<template> |
|||
<Dialog v-model="dialogVisible" :title="dialogTitle"> |
|||
<el-form |
|||
ref="basicFormRef" |
|||
v-loading="formLoading" |
|||
:model="formData" |
|||
:rules="formRules" |
|||
label-width="100px" |
|||
> |
|||
<el-row> |
|||
<el-col :span="12"> |
|||
<el-form-item label="选择集名称" prop="name"> |
|||
<el-input v-model="formData.name" placeholder="选择集名称" :disabled="isDisabled"/> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<el-form-item label="描述" prop="describing"> |
|||
<el-input v-model="formData.describing" placeholder="描述" :disabled="isDisabled"/> |
|||
</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-row> |
|||
<el-col :span="24"> |
|||
<el-form-item label="文档类型项" prop="items"> |
|||
<div class="tag-container flex gap-2"> |
|||
<el-tag v-for="ent in tags" :key="ent.code" closable :disable-transitions="false" @close="handleClose(ent.id)"> |
|||
{{ ent.code}} |
|||
</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="addItem"> |
|||
添加文档类型项 + |
|||
</el-button> |
|||
</div> |
|||
</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 * as SelectSetApi from '@/api/eam/documentTypeSelectSet' |
|||
import request from "@/config/axios"; |
|||
import { SearchTable } from '@/components/SearchTable' |
|||
import { DocumentType} from "@/views/eam/documentType/documentType.data"; |
|||
import * as documentTypeItemApi from "@/api/eam/documentType"; |
|||
import {ElInput} from "element-plus"; |
|||
import { |
|||
createDocumentTypeSelectSet, |
|||
DocumentTypeSelectSetVO, updateDocumentTypeSelectSet |
|||
} from "@/api/eam/documentTypeSelectSet"; |
|||
|
|||
defineOptions({ name: 'TeamForm' }) |
|||
|
|||
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 inputValue = ref('') |
|||
const inputVisible = ref(false) |
|||
const isDisabled = ref(false) |
|||
const InputRef = ref<InstanceType<typeof ElInput>>() |
|||
|
|||
const itemData = ref({ |
|||
id: '', |
|||
code: '' |
|||
}) |
|||
|
|||
const formData = ref({ |
|||
id: '', |
|||
name: '', |
|||
describing: '', |
|||
itemCode: '', |
|||
available: 'TRUE', |
|||
remark: '', |
|||
createTime: '' |
|||
}) |
|||
const formRules = reactive({ |
|||
name: [ |
|||
{ required: true, message: '选择集名称不能为空', trigger: 'blur' }, |
|||
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } |
|||
], |
|||
remark: [ |
|||
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } |
|||
], |
|||
}) |
|||
const basicFormRef = ref() // 表单 Ref |
|||
|
|||
/** 删除文档类型项 */ |
|||
const handleClose = (id: string) => { |
|||
const index = tags.value.findIndex(tag => tag.id === id); |
|||
if (index !== -1) { |
|||
tags.value.splice(index, 1); |
|||
} |
|||
} |
|||
|
|||
/** 弹窗相关参数 */ |
|||
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 addItem = () =>{ |
|||
addItemCommon(true,'wenDangItem') |
|||
} |
|||
|
|||
/** 选择文档类型项弹窗 */ |
|||
const addItemCommon = (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 = documentTypeItemApi.getDocumentTypePage |
|||
_searchTableAllSchemas.value = DocumentType.allSchemas |
|||
openCommon() |
|||
} |
|||
|
|||
/** 弹窗选择之后 回调函数 添加选择集 */ |
|||
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => { |
|||
nextTick?.(() => { |
|||
if (formField === 'wenDangItem') { |
|||
console.log(val) |
|||
val.forEach(item => { |
|||
const isExist = tags.value.some(tag => tag.code === item.code); |
|||
if (!isExist){ |
|||
const newItem = {}; |
|||
newItem['code'] = item.code; |
|||
newItem['id'] = item.id; |
|||
tags.value.push(newItem); |
|||
} |
|||
}); |
|||
} |
|||
}) |
|||
} |
|||
/*打开弹窗*/ |
|||
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 |
|||
// 修改时,设置数据 |
|||
if (row) { |
|||
tags.value=[]; |
|||
isDisabled.value = true; |
|||
formLoading.value = true |
|||
formData.value = row; |
|||
let item = (row.itemCode).split(",") |
|||
try { |
|||
for (var i = 0; i < item.length; i++) { |
|||
itemData.value = await request.get({ url: `/eam/basic/document-type/get?id=` + item[i] }); |
|||
tags.value.push(itemData.value); |
|||
} |
|||
} finally { |
|||
formLoading.value = false |
|||
} |
|||
} |
|||
// 新增时 |
|||
else { |
|||
resetForm() |
|||
isDisabled.value = false; |
|||
} |
|||
} |
|||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗 |
|||
|
|||
/** 提交表单 */ |
|||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调 |
|||
const submitForm = async () => { |
|||
// 校验表单 |
|||
if (!basicFormRef) return |
|||
const valid = await basicFormRef.value.validate() |
|||
if (!valid) return |
|||
if (tags.value.length > 10 ){ |
|||
message.warning('文档类型项最多10个'); |
|||
return |
|||
} |
|||
|
|||
let result = ''; |
|||
for (var i = 0; i < tags.value.length; i++) { |
|||
result += tags.value[i].id + ','; |
|||
} |
|||
if(result.endsWith(',')){ |
|||
result = result.substring(0,result.length -1) |
|||
} |
|||
formData.value.itemCode = result |
|||
// 提交请求 |
|||
formLoading.value = true |
|||
//formData.value.members = JSON.stringify(tags.value) |
|||
try { |
|||
const data = formData.value as unknown as SelectSetApi.DocumentTypeSelectSetVO |
|||
if (formType.value === 'create') { |
|||
await SelectSetApi.createDocumentTypeSelectSet(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await SelectSetApi.updateDocumentTypeSelectSet(data) |
|||
message.success(t('common.updateSuccess')) |
|||
} |
|||
dialogVisible.value = false |
|||
// 发送操作成功的事件 |
|||
emit('success') |
|||
} finally { |
|||
formLoading.value = false |
|||
} |
|||
} |
|||
|
|||
/** 重置表单 */ |
|||
const resetForm = () => { |
|||
formData.value = { |
|||
id: '', |
|||
name: '', |
|||
describing: '', |
|||
itemCode: '', |
|||
available: 'TRUE', |
|||
remark: '', |
|||
createTime: '' |
|||
} |
|||
tags.value=[]; |
|||
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,287 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="InspectionItemSelectSet.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="InspectionItemSelectSet.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 #name="{row}"> |
|||
<el-button type="primary" link @click="openDetail(row, '代码', row.name)"> |
|||
<span>{{ row.name }}</span> |
|||
</el-button> |
|||
</template> |
|||
<template #action="{ row }"> |
|||
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" /> |
|||
</template> |
|||
</Table> |
|||
</ContentWrap> |
|||
|
|||
<!-- 表单弹窗:添加/修改 --> |
|||
<ItemForm ref="basicFormRef" @success="getData"/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="InspectionItemSelectSet.allSchemas" /> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/eam/inspection-item-select-set/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { InspectionItemSelectSet,InspectionItemSelectSetRules } from './inspectionItemSelectSet.data' |
|||
import * as InspectionItemSelectSetApi from '@/api/eam/inspectionItemSelectSet' |
|||
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 ItemForm from "@/views/eam/inspectionItemSelectSet/itemSelectSetForm.vue"; |
|||
|
|||
defineOptions({ name: 'InspectionItemSelectSet' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(InspectionItemSelectSet.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: InspectionItemSelectSetApi.getInspectionItemSelectSetPage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn({hasPermi:'eam:inspectionItemSelectSet:create'}), // 新增 |
|||
//defaultButtons.defaultImportBtn({hasPermi:'eam:inspectionItemSelectSet:import'}), // 导入 |
|||
//defaultButtons.defaultExportBtn({hasPermi:'eam:inspectionItemSelectSet: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 isShowMainButton = (row,val) => { |
|||
if (val.indexOf(row.available) > -1) { |
|||
return false |
|||
} else { |
|||
return true |
|||
} |
|||
} |
|||
|
|||
// 列表-操作按钮 |
|||
const butttondata = (row) => { |
|||
return [ |
|||
defaultButtons.mainListEditBtn({hasPermi:'eam:inspectionItemSelectSet:update'}), // 编辑 |
|||
//defaultButtons.mainListDeleteBtn({hasPermi:'eam:equipmentMainPart:delete'}), // 删除 |
|||
defaultButtons.mainListEnableBtn({hide:isShowMainButton(row,['FALSE']),hasPermi:'eam:inspectionItemSelectSet:update'}), |
|||
defaultButtons.mainListDisableBtn({hide:isShowMainButton(row,['TRUE']),hasPermi:'eam:inspectionItemSelectSet:update'}), |
|||
] |
|||
} |
|||
|
|||
// 列表-操作按钮事件 |
|||
const buttonTableClick = async (val, row) => { |
|||
if (val == 'edit') { // 编辑 |
|||
openForm('update', row) |
|||
} else if (val == 'delete') { // 删除 |
|||
handleDelete(row.id) |
|||
} else if (val == 'enable') { |
|||
handleEnable(row.id) |
|||
} else if (val == 'disable') { |
|||
handleDisable(row.id) |
|||
} |
|||
} |
|||
|
|||
/** 添加/修改操作 */ |
|||
const basicFormRef = ref() |
|||
const openForm = (type: string, row?: any) => { |
|||
basicFormRef.value.open(type, row) |
|||
} |
|||
|
|||
// form表单提交 |
|||
const formsSuccess = async (formType,data) => { |
|||
var isHave =InspectionItemSelectSet.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 InspectionItemSelectSetApi.createInspectionItemSelectSet(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await InspectionItemSelectSetApi.updateInspectionItemSelectSet(data) |
|||
message.success(t('common.updateSuccess')) |
|||
} |
|||
basicFormRef.value.dialogVisible = false |
|||
getList() |
|||
} |
|||
|
|||
//刷新页面 |
|||
const getData = async() => { |
|||
getList(); |
|||
} |
|||
|
|||
/** 详情操作 */ |
|||
const detailRef = ref() |
|||
const openDetail = (row: any, titleName: any, titleValue: any) => { |
|||
detailRef.value.openDetail(row, titleName, titleValue, 'basicInspectionItemSelectSet') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await InspectionItemSelectSetApi.deleteInspectionItemSelectSet(id) |
|||
message.success(t('common.delSuccess')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch {} |
|||
} |
|||
|
|||
/** 启用 */ |
|||
const handleEnable = async (id: number) => { |
|||
try { |
|||
const params = ref({ |
|||
id: '', |
|||
available:'', |
|||
}) |
|||
params.value.id = id |
|||
params.value.available = 'TRUE' |
|||
await InspectionItemSelectSetApi.updateEnableCode(params.value) |
|||
message.success(t('common.updateSuccess')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch {} |
|||
} |
|||
/** 禁用 */ |
|||
const handleDisable = async (id: number) => { |
|||
try { |
|||
const params = ref({ |
|||
id: '', |
|||
available:'', |
|||
}) |
|||
params.value.id = id |
|||
params.value.available = 'FALSE' |
|||
await InspectionItemSelectSetApi.updateEnableCode(params.value) |
|||
message.success(t('common.updateSuccess')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch {} |
|||
} |
|||
|
|||
/** 导出按钮操作 */ |
|||
const exportLoading = ref(false) // 导出的加载中 |
|||
const handleExport = async () => { |
|||
try { |
|||
// 导出的二次确认 |
|||
await message.exportConfirm() |
|||
// 发起导出 |
|||
exportLoading.value = true |
|||
const data = await InspectionItemSelectSetApi.exportInspectionItemSelectSet(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() |
|||
}) |
|||
|
|||
</script> |
@ -0,0 +1,141 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
|
|||
// 表单校验
|
|||
export const InspectionItemSelectSetRules = reactive({ |
|||
name: [required], |
|||
itemCode: [required], |
|||
concurrencyStamp: [required], |
|||
}) |
|||
|
|||
export const InspectionItemSelectSet = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: 'id', |
|||
field: 'id', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '选择集名称', |
|||
field: 'name', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '项编号', |
|||
field: 'itemCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '创建时间', |
|||
field: 'createTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: true, |
|||
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')] |
|||
} |
|||
}, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '部门id', |
|||
field: 'departmentCode', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '备注', |
|||
field: 'remark', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '地点ID', |
|||
field: 'siteId', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '是否可用', |
|||
field: 'available', |
|||
sort: 'custom', |
|||
dictType: DICT_TYPE.TRUE_FALSE, |
|||
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
|||
isTable: true, |
|||
isDetail: false, |
|||
isSearch: true, |
|||
isTableForm: false, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '删除时间', |
|||
field: 'deletionTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail: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: '删除人id', |
|||
field: 'deleterId', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
}, |
|||
{ |
|||
label: '并发乐观锁', |
|||
field: 'concurrencyStamp', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail:false, |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isForm: false, |
|||
table: { |
|||
width: 150, |
|||
fixed: 'right' |
|||
} |
|||
} |
|||
])) |
@ -0,0 +1,280 @@ |
|||
<template> |
|||
<Dialog v-model="dialogVisible" :title="dialogTitle"> |
|||
<el-form |
|||
ref="basicFormRef" |
|||
v-loading="formLoading" |
|||
:model="formData" |
|||
:rules="formRules" |
|||
label-width="100px" |
|||
> |
|||
<el-row> |
|||
<el-col :span="12"> |
|||
<el-form-item label="选择集名称" prop="name"> |
|||
<el-input v-model="formData.name" placeholder="选择集名称" :disabled="isDisabled"/> |
|||
</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-row> |
|||
<el-col :span="24"> |
|||
<el-form-item label="巡检项" prop="items"> |
|||
<div class="tag-container flex gap-2"> |
|||
<el-tag v-for="ent in tags" :key="ent.content" closable :disable-transitions="false" @close="handleClose(ent.id)"> |
|||
{{ ent.content}} |
|||
</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="addItem"> |
|||
添加巡检项 + |
|||
</el-button> |
|||
</div> |
|||
</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 * as SelectSetApi from '@/api/eam/inspectionItemSelectSet' |
|||
import request from "@/config/axios"; |
|||
import { SearchTable } from '@/components/SearchTable' |
|||
import { InspectionItem} from "@/views/eam/inspectionItem/inspectionItem.data"; |
|||
import * as inspectionItemApi from "@/api/eam/inspectionItem"; |
|||
import {ElInput} from "element-plus"; |
|||
|
|||
defineOptions({ name: 'TeamForm' }) |
|||
|
|||
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 inputValue = ref('') |
|||
const inputVisible = ref(false) |
|||
const isDisabled = ref(false) |
|||
const InputRef = ref<InstanceType<typeof ElInput>>() |
|||
|
|||
const itemData = ref({ |
|||
id: '', |
|||
content: '' |
|||
}) |
|||
|
|||
const formData = ref({ |
|||
id: '', |
|||
name: '', |
|||
itemCode: '', |
|||
available: 'TRUE', |
|||
remark: '', |
|||
createTime: '' |
|||
}) |
|||
const formRules = reactive({ |
|||
name: [ |
|||
{ required: true, message: '选择集名称不能为空', trigger: 'blur' }, |
|||
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } |
|||
], |
|||
remark: [ |
|||
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } |
|||
], |
|||
}) |
|||
const basicFormRef = ref() // 表单 Ref |
|||
|
|||
/** 删除巡检项 */ |
|||
const handleClose = (id: string) => { |
|||
const index = tags.value.findIndex(tag => tag.id === id); |
|||
if (index !== -1) { |
|||
tags.value.splice(index, 1); |
|||
} |
|||
} |
|||
|
|||
/** 弹窗相关参数 */ |
|||
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 addItem = () =>{ |
|||
addItemCommon(true,'xunJianItem') |
|||
} |
|||
|
|||
/** 选择巡检项弹窗 */ |
|||
const addItemCommon = (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 = inspectionItemApi.getInspectionItemPage |
|||
_searchTableAllSchemas.value = InspectionItem.allSchemas |
|||
openCommon() |
|||
} |
|||
|
|||
/** 弹窗选择之后 回调函数 添加选择集 */ |
|||
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => { |
|||
nextTick?.(() => { |
|||
if (formField === 'xunJianItem') { |
|||
val.forEach(item => { |
|||
const isExist = tags.value.some(tag => tag.content === item.content); |
|||
if (!isExist){ |
|||
const newItem = {}; |
|||
newItem['content'] = item.content; |
|||
newItem['id'] = item.id; |
|||
tags.value.push(newItem); |
|||
} |
|||
}); |
|||
} |
|||
}) |
|||
} |
|||
/*打开弹窗*/ |
|||
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 |
|||
// 修改时,设置数据 |
|||
if (row) { |
|||
tags.value=[]; |
|||
isDisabled.value = true; |
|||
formLoading.value = true |
|||
formData.value = row; |
|||
let item = (row.itemCode).split(",") |
|||
try { |
|||
for (var i = 0; i < item.length; i++) { |
|||
itemData.value = await request.get({ url: `/eam/basic/inspection-item/get?id=` + item[i] }); |
|||
tags.value.push(itemData.value); |
|||
} |
|||
} finally { |
|||
formLoading.value = false |
|||
} |
|||
} |
|||
// 新增时 |
|||
else { |
|||
resetForm() |
|||
isDisabled.value = false; |
|||
} |
|||
} |
|||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗 |
|||
|
|||
/** 提交表单 */ |
|||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调 |
|||
const submitForm = async () => { |
|||
// 校验表单 |
|||
if (!basicFormRef) return |
|||
const valid = await basicFormRef.value.validate() |
|||
if (!valid) return |
|||
if (tags.value.length > 10 ){ |
|||
message.warning('巡检项最多10个'); |
|||
return |
|||
} |
|||
|
|||
let result = ''; |
|||
for (var i = 0; i < tags.value.length; i++) { |
|||
result += tags.value[i].id + ','; |
|||
} |
|||
if(result.endsWith(',')){ |
|||
result = result.substring(0,result.length -1) |
|||
} |
|||
formData.value.itemCode = result |
|||
// 提交请求 |
|||
formLoading.value = true |
|||
//formData.value.members = JSON.stringify(tags.value) |
|||
try { |
|||
const data = formData.value as unknown as SelectSetApi.InspectionItemSelectSetVO |
|||
if (formType.value === 'create') { |
|||
await SelectSetApi.createInspectionItemSelectSet(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await SelectSetApi.updateInspectionItemSelectSet(data) |
|||
message.success(t('common.updateSuccess')) |
|||
} |
|||
dialogVisible.value = false |
|||
// 发送操作成功的事件 |
|||
emit('success') |
|||
} finally { |
|||
formLoading.value = false |
|||
} |
|||
} |
|||
|
|||
/** 重置表单 */ |
|||
const resetForm = () => { |
|||
formData.value = { |
|||
id: '', |
|||
name: '', |
|||
itemCode: '', |
|||
available: 'TRUE', |
|||
remark: '', |
|||
createTime: '' |
|||
} |
|||
tags.value=[]; |
|||
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,244 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="RelegateRecordMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="RelegateRecordMain.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="RelegateRecordMainRules" |
|||
:formAllSchemas="RelegateRecordMain.allSchemas" |
|||
:apiUpdate="RelegateRecordMainApi.updateRelegateRecordMain" |
|||
:apiCreate="RelegateRecordMainApi.createRelegateRecordMain" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
:isBusiness="false" |
|||
/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="RelegateRecordMain.allSchemas" /> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/wms/relegate-record-main/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { RelegateRecordMain,RelegateRecordMainRules } from './relegate-record-main.data' |
|||
import * as RelegateRecordMainApi from '@/api/wms/relegateRecordMain' |
|||
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: 'RelegateRecordMain' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(RelegateRecordMain.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: RelegateRecordMainApi.getRelegateRecordMainPage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn({hasPermi:'wms:relegate-record-main:create'}), // 新增 |
|||
defaultButtons.defaultImportBtn({hasPermi:'wms:relegate-record-main:import'}), // 导入 |
|||
defaultButtons.defaultExportBtn({hasPermi:'wms:relegate-record-main: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:'wms:relegate-record-main:update'}), // 编辑 |
|||
defaultButtons.mainListDeleteBtn({hasPermi:'wms:relegate-record-main: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 =RelegateRecordMain.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 RelegateRecordMainApi.createRelegateRecordMain(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await RelegateRecordMainApi.updateRelegateRecordMain(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, 'basicRelegateRecordMain') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await RelegateRecordMainApi.deleteRelegateRecordMain(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 RelegateRecordMainApi.exportRelegateRecordMain(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 RelegateRecordMainApi.importTemplate() |
|||
}) |
|||
|
|||
</script> |
@ -0,0 +1,204 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
|
|||
// 表单校验
|
|||
export const RelegateRecordMainRules = reactive({ |
|||
departmentCode: [required], |
|||
interfaceType: [required], |
|||
number: [required], |
|||
businessType: [required], |
|||
}) |
|||
|
|||
export const RelegateRecordMain = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: 'id', |
|||
field: 'id', |
|||
sort: 'custom', |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '申请单号', |
|||
field: 'requestNumber', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '执行时间', |
|||
field: 'executeTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: true, |
|||
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: 'activeDate', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: true, |
|||
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: 'available', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '申请时间', |
|||
field: 'requestTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: true, |
|||
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: 'dueTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: true, |
|||
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: 'departmentCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '用户组', |
|||
field: 'userGroupCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '接口类型', |
|||
field: 'interfaceType', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
form: { |
|||
component: 'SelectV2' |
|||
}, |
|||
}, |
|||
{ |
|||
label: '代码', |
|||
field: 'code', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '单据号', |
|||
field: 'number', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '业务类型', |
|||
field: 'businessType', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
form: { |
|||
component: 'SelectV2' |
|||
}, |
|||
}, |
|||
{ |
|||
label: '备注', |
|||
field: 'remark', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '创建时间', |
|||
field: 'createTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: true, |
|||
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')] |
|||
} |
|||
}, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '扩展属性', |
|||
field: 'extraProperties', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '地点ID', |
|||
field: 'siteId', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isForm: false, |
|||
table: { |
|||
width: 150, |
|||
fixed: 'right' |
|||
} |
|||
} |
|||
])) |
@ -0,0 +1,396 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="[...RelegateRequestMain.allSchemas.searchSchema, ...RelegateRequestDetail.allSchemas.searchSchema]" |
|||
@search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" :routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" @searchFormClick="searchFormClick" |
|||
:allSchemas="RelegateRequestMain.allSchemas" :detailAllSchemas="RelegateRequestDetail.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, $index }"> |
|||
<ButtonBase :Butttondata="butttondata(row, $index)" @button-base-click="buttonTableClick($event, row)" /> |
|||
</template> |
|||
</Table> |
|||
</ContentWrap> |
|||
|
|||
<!-- 表单弹窗:添加/修改 --> |
|||
<BasicForm ref="basicFormRef" |
|||
:isOpenSearchTable="false" |
|||
fieldTableColumn="itemCode" |
|||
@success="getList" |
|||
:rules="RelegateRequestMainRules" |
|||
:formAllSchemas="RelegateRequestMain.allSchemas" |
|||
:tableAllSchemas="RelegateRequestDetail.allSchemas" |
|||
:tableFormRules="RelegateRequestDetailRules" |
|||
:tableData="tableData" |
|||
:apiUpdate="RelegateRequestMainApi.updateRelegateRequestMain" |
|||
:apiCreate="RelegateRequestMainApi.createRelegateRequestMain" |
|||
:isBusiness="true" fromeWhere="RelegateRequestMain" |
|||
@handleAddTable="handleAddTable" |
|||
@handleDeleteTable="handleDeleteTable" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
@submitForm="submitForm" |
|||
:isShowButton=isShowButton /> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" |
|||
:isBasic="false" |
|||
:allSchemas="RelegateRequestMain.allSchemas" |
|||
:detailAllSchemas="RelegateRequestDetail.allSchemas" |
|||
:detailAllSchemasRules="RelegateRequestDetailRules" |
|||
:apiCreate="RelegateRequestDetailApi.createRelegateRequestDetail" |
|||
:apiUpdate="RelegateRequestDetailApi.updateRelegateRequestDetail" |
|||
:apiPage="RelegateRequestDetailApi.getRelegateRequestDetailPage" |
|||
:apiDelete="RelegateRequestDetailApi.deleteRelegateRequestDetail" |
|||
fromeWhere="RelegateRequestMain" |
|||
@searchTableSuccessDetail="searchTableSuccessDetail" |
|||
:detailButtonIsShowAdd="true" |
|||
:detailButtonIsShowDelete="true" /> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/wms/relegate-request-main/import" :importTemplateData="importTemplateData" |
|||
@success="importSuccess" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { RelegateRequestMain, RelegateRequestMainRules, RelegateRequestDetail, RelegateRequestDetailRules } from './relegateRequestMain.data' |
|||
import * as RelegateRequestMainApi from '@/api/wms/relegateRequestMain' |
|||
import * as RelegateRequestDetailApi from '@/api/wms/relegateRequestDetail' |
|||
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: 'RelegateRequestMain' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
const businessType = 'relegate' |
|||
routeName.value = route.name |
|||
const tableColumns = ref([...RelegateRequestMain.allSchemas.tableColumns, ...RelegateRequestDetail.allSchemas.tableMainColumns]) |
|||
const isShowButton = ref(true) |
|||
//定义 展示子表数据时是否显示新增/修改/删除按钮 |
|||
const trueFalse = ref(false) |
|||
|
|||
// 查询页面返回 |
|||
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => { |
|||
nextTick(() => { |
|||
if (type == 'tableForm') { |
|||
if (formField == 'itemCode') { |
|||
row['itemCode'] = val[0]['itemCode'] |
|||
row['uom'] = val[0]['uom'] |
|||
row['qty'] = val[0]['qty'] |
|||
row['fromBatch'] = val[0]['batch'] |
|||
row['fromPackingNumber'] = val[0]['packingNumber'] |
|||
row['toBatch'] = val[0]['batch'] |
|||
row['toPackingNumber'] = val[0]['packingNumber'] |
|||
row['fromLocationCode'] = val[0]['locationCode'] |
|||
row['fromInventoryStatus'] = val[0]['inventoryStatus'] |
|||
} else if (formField == 'downItemCode') { |
|||
row['downItemCode'] = val[0]['code'] |
|||
} else if (formField == 'toLocationCode') { |
|||
row['toLocationCode'] = val[0]['code'] |
|||
} else { |
|||
row[formField] = val[0][searchField] |
|||
} |
|||
} else { |
|||
const setV = {} |
|||
setV[formField] = val[0][searchField] |
|||
if (formField == 'fromWarehouseCode') { |
|||
setV['fromWarehouseCode'] = val[0]['code'] |
|||
} |
|||
formRef.setValues(setV) |
|||
} |
|||
}) |
|||
} |
|||
|
|||
// 查询页面返回——详情 |
|||
const searchTableSuccessDetail = (formField, searchField, val, formRef) => { |
|||
nextTick(() => { |
|||
const setV = {} |
|||
setV[formField] = val[0][searchField] |
|||
formRef.setValues(setV) |
|||
}) |
|||
} |
|||
|
|||
// 修改 tableform 属性 |
|||
RelegateRequestDetail.allSchemas.tableFormColumns.map(item => { |
|||
if (item.field == 'itemCode') { |
|||
item.tableForm.searchCondition = [ |
|||
{ |
|||
key: 'businessType', |
|||
value: businessType, |
|||
isMainValue: false |
|||
} |
|||
] |
|||
item.form.componentProps.searchCondition = [ |
|||
{ |
|||
key: 'businessType', |
|||
value: businessType, |
|||
isMainValue: false |
|||
} |
|||
] |
|||
} |
|||
if (item.field == "toLocationCode") { |
|||
item.tableForm.searchCondition = [ |
|||
{ |
|||
key: 'businessType', |
|||
value: businessType, |
|||
isMainValue: false |
|||
}] |
|||
item.form.componentProps.searchCondition = [ |
|||
{ |
|||
key: 'businessType', |
|||
value: businessType, |
|||
isMainValue: false |
|||
}] |
|||
item.tableForm.searchCondition = [ |
|||
{ |
|||
key: 'businessType', |
|||
value: businessType, |
|||
isMainValue: false |
|||
}] |
|||
item.form.componentProps.searchCondition = [ |
|||
{ |
|||
key: 'businessType', |
|||
value: businessType, |
|||
isMainValue: false |
|||
}] |
|||
} |
|||
}) |
|||
|
|||
// 字段设置 更新主列表字段 |
|||
const updataTableColumns = (val) => { |
|||
tableColumns.value = val |
|||
} |
|||
|
|||
const { tableObject, tableMethods } = useTable({ |
|||
getListApi: RelegateRequestDetailApi.getRelegateRequestDetailPage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn({ hasPermi: 'wms:relegate-request-main:create' }), // 新增 |
|||
defaultButtons.defaultImportBtn({ hasPermi: 'wms:relegate-request-main:import' }), // 导入 |
|||
defaultButtons.defaultExportBtn({ hasPermi: 'wms:relegate-request-main: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 isShowMainButton = (row, val) => { |
|||
if (val.indexOf(row.status) > -1) { |
|||
return false |
|||
} else { |
|||
return true |
|||
} |
|||
} |
|||
|
|||
// 列表-操作按钮 |
|||
const butttondata = (row, $index) => { |
|||
const findIndex = row['masterId'] ? tableObject.tableList.findIndex(item => item['masterId'] == row['masterId']) : -1 |
|||
if (findIndex > 0 && findIndex < $index) { |
|||
return [] |
|||
} |
|||
return [ |
|||
defaultButtons.mainListCloseBtn({hide:isShowMainButton(row,['2','3','4','6']),hasPermi:'wms:relegate-request-main:close'}), // 关闭 |
|||
defaultButtons.mainListReAddBtn({hide:isShowMainButton(row,['4','5']),hasPermi:'wms:relegate-request-main:reAdd'}), //重新添加 |
|||
defaultButtons.mainListSubmitBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:relegate-request-main:submit'}), // 提交审批 |
|||
defaultButtons.mainListTurnDownBtn({hide:isShowMainButton(row,['2']),hasPermi:'wms:relegate-request-main:refused'}), // 驳回 |
|||
defaultButtons.mainListApproveBtn({hide:isShowMainButton(row,['2']),hasPermi:'wms:relegate-request-main:agree'}), // 审批通过 |
|||
defaultButtons.mainListHandleBtn({hide:isShowMainButton(row,['3']),hasPermi:'wms:relegate-request-main:handle'}), // 处理 |
|||
defaultButtons.mainListEditBtn({ hide: isShowMainButton(row, ['1']), hasPermi: 'wms:relegate-request-main:update' }), // 编辑 |
|||
defaultButtons.mainListDeleteBtn({ hasPermi: 'wms:relegate-request-main: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) |
|||
} |
|||
//为true表示子表数据中存在数量为0的数据 |
|||
const flag = ref(false) |
|||
// form表单提交 |
|||
const submitForm = async (formType, data) => { |
|||
data.subList = tableData.value // 拼接子表数据参数 |
|||
let isExist = false |
|||
tableData.value.forEach(item => { |
|||
let rs = tableData.value.filter(filterItem => (filterItem.itemCode == item.itemCode)) |
|||
if (rs.length > 1) isExist = true |
|||
}) |
|||
if (isExist) { |
|||
basicFormRef.value.formLoading = false |
|||
return message.warning('物料代码重复') |
|||
} |
|||
data.subList.forEach(obj => { |
|||
if (obj.qty == 0) { |
|||
message.warning(`数量不能为0!`) |
|||
flag.value = true |
|||
return; |
|||
} |
|||
}) |
|||
if (flag.value) { |
|||
basicFormRef.value.formLoading = false |
|||
return |
|||
} |
|||
try { |
|||
if (formType === 'create') { |
|||
if (tableData.value.length <= 0) { |
|||
message.warning(`子表明细不能为空!`) |
|||
flag.value = true |
|||
basicFormRef.value.formLoading = false |
|||
return; |
|||
} |
|||
await RelegateRequestMainApi.createRelegateRequestMain(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await RelegateRequestMainApi.updateRelegateRequestMain(data) |
|||
message.success(t('common.updateSuccess')) |
|||
} |
|||
basicFormRef.value.dialogVisible = false |
|||
getList() |
|||
} finally { |
|||
basicFormRef.value.formLoading = false |
|||
} |
|||
} |
|||
|
|||
/** 详情操作 */ |
|||
const detailRef = ref() |
|||
const openDetail = (row: any, titleName: any, titleValue: any) => { |
|||
detailRef.value.openDetail(row, titleName, titleValue, 'basicRelegateRequestMain') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await RelegateRequestMainApi.deleteRelegateRequestMain(id) |
|||
message.success(t('common.delSuccess')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch { } |
|||
} |
|||
|
|||
/** |
|||
* tableForm方法 |
|||
*/ |
|||
const tableFormKeys = {} |
|||
RelegateRequestDetail.allSchemas.tableFormColumns.forEach(item => { |
|||
tableFormKeys[item.field] = item.default ? item.default : '' |
|||
}) |
|||
const tableData = ref([]) |
|||
|
|||
// 添加明细 |
|||
const handleAddTable = () => { |
|||
tableData.value.push(JSON.parse(JSON.stringify(tableFormKeys))) |
|||
} |
|||
// 删除明细 |
|||
const handleDeleteTable = (item, index) => { |
|||
tableData.value.splice(index, 1) |
|||
} |
|||
|
|||
/** 导出按钮操作 */ |
|||
const exportLoading = ref(false) // 导出的加载中 |
|||
const handleExport = async () => { |
|||
try { |
|||
// 导出的二次确认 |
|||
await message.exportConfirm() |
|||
// 发起导出 |
|||
exportLoading.value = true |
|||
const data = await RelegateRequestMainApi.exportRelegateRequestMain(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 RelegateRequestMainApi.importTemplate() |
|||
}) |
|||
|
|||
</script> |
@ -0,0 +1,674 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
import * as getRequestsettingApi from '@/api/wms/requestsetting/index' |
|||
|
|||
import * as ItembasicApi from '@/api/wms/itembasic' |
|||
import { Itembasic } from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data' |
|||
|
|||
import {Warehouse} from "@/views/wms/basicDataManage/factoryModeling/warehouse/warehouse.data"; |
|||
import * as WarehouseApi from "@/api/wms/warehouse"; |
|||
|
|||
import * as BalanceApi from '@/api/wms/balance' |
|||
import { Balance } from '@/views/wms/inventoryManage/balance/balance.data' |
|||
|
|||
import * as LocationApi from '@/api/wms/location' |
|||
import { Location } from '@/views/wms/basicDataManage/factoryModeling/location/location.data' |
|||
import * as confgiApi from '@/api/infra/config' |
|||
// 获取自动提交自动通过自动执行,跳过任务直接删生成记录的默认值
|
|||
const queryParams = { |
|||
pageSize:10, |
|||
pageNo:1, |
|||
code:'RelegateRequest' |
|||
} |
|||
const data = await getRequestsettingApi.getRequestsettingPage(queryParams) |
|||
const requestsettingData =data?.list[0]||{} |
|||
const confgiData = await confgiApi.queryByKey("relegateItemType") |
|||
// 表单校验
|
|||
export const RelegateRequestMainRules = reactive({ |
|||
fromWarehouseCode: [required], |
|||
number: [required], |
|||
businessType: [required], |
|||
autoCommit: [required], |
|||
autoAgree: [required], |
|||
autoExecute: [required], |
|||
directCreateRecord: [required], |
|||
concurrencyStamp: [required], |
|||
fromAreaTypes: [required], |
|||
fromAreaCodes: [required], |
|||
}) |
|||
|
|||
export const RelegateRequestMain = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: '单据号', |
|||
field: 'number', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
isForm: false, |
|||
table: { |
|||
width: 180 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '从仓库代码', |
|||
field: 'fromWarehouseCode', |
|||
sort: 'custom', |
|||
form: { |
|||
// labelMessage: '信息提示说明!!!',
|
|||
componentProps: { |
|||
isSearchList: true, // 开启查询弹窗
|
|||
searchListPlaceholder: '请选择仓库代码', // 输入框占位文本
|
|||
searchField: 'code', // 查询弹窗赋值字段
|
|||
searchTitle: '仓库信息', // 查询弹窗标题
|
|||
searchAllSchemas: Warehouse.allSchemas, // 查询弹窗所需类
|
|||
searchPage: WarehouseApi.getWarehousePage, // 查询弹窗所需分页方法
|
|||
searchCondition: [{ |
|||
key: 'available', |
|||
value: 'TRUE', |
|||
isMainValue: false |
|||
}] |
|||
} |
|||
}, |
|||
table: { |
|||
width: 180 |
|||
}, |
|||
}, |
|||
|
|||
{ |
|||
label: '业务类型', |
|||
field: 'businessType', |
|||
sort: 'custom', |
|||
isForm: false, |
|||
isTable: false |
|||
}, |
|||
{ |
|||
label: '备注', |
|||
field: 'remark', |
|||
sort: 'custom', |
|||
isForm: false, |
|||
isTable: false |
|||
}, |
|||
{ |
|||
label: '创建时间', |
|||
field: 'createTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
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')] |
|||
} |
|||
}, |
|||
isForm: false, |
|||
isTable: false |
|||
}, |
|||
{ |
|||
label: '扩展属性', |
|||
field: 'extraProperties', |
|||
sort: 'custom', |
|||
isForm: false, |
|||
isTable: false |
|||
}, |
|||
{ |
|||
label: '地点ID', |
|||
field: 'siteId', |
|||
sort: 'custom', |
|||
isForm: false, |
|||
isTable: false |
|||
}, |
|||
{ |
|||
label: '申请时间', |
|||
field: 'requestTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
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')] |
|||
} |
|||
}, |
|||
isForm: false, |
|||
isTable: false |
|||
}, |
|||
{ |
|||
label: '截止时间', |
|||
field: 'dueTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
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')] |
|||
} |
|||
}, |
|||
isForm: false, |
|||
isTable: false |
|||
}, |
|||
{ |
|||
label: '部门', |
|||
field: 'departmentCode', |
|||
sort: 'custom', |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '状态', |
|||
field: 'status', |
|||
dictType: DICT_TYPE.REQUEST_STATUS, |
|||
dictClass: 'string', |
|||
isSearch: true, |
|||
isForm: false, |
|||
isTable: true, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '自动提交', |
|||
field: 'autoCommit', |
|||
dictType: DICT_TYPE.TRUE_FALSE, |
|||
dictClass: 'string', |
|||
isTable: false, |
|||
isForm: false, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
form: { |
|||
component: 'Switch', |
|||
value: requestsettingData.autoCommit, |
|||
componentProps: { |
|||
inactiveValue: 'FALSE', |
|||
activeValue: 'TRUE', |
|||
disabled: true |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '自动通过', |
|||
field: 'autoAgree', |
|||
dictType: DICT_TYPE.TRUE_FALSE, |
|||
dictClass: 'string', |
|||
isTable: false, |
|||
isForm: false, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
form: { |
|||
component: 'Switch', |
|||
value: requestsettingData.autoCommit, |
|||
componentProps: { |
|||
inactiveValue: 'FALSE', |
|||
activeValue: 'TRUE', |
|||
disabled: true |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '自动执行', |
|||
field: 'autoExecute', |
|||
dictType: DICT_TYPE.TRUE_FALSE, |
|||
dictClass: 'string', |
|||
isTable: false, |
|||
isForm: false, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
form: { |
|||
component: 'Switch', |
|||
value: requestsettingData.autoCommit, |
|||
componentProps: { |
|||
inactiveValue: 'FALSE', |
|||
activeValue: 'TRUE', |
|||
disabled: true |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '直接生成记录', |
|||
field: 'directCreateRecord', |
|||
dictType: DICT_TYPE.TRUE_FALSE, |
|||
dictClass: 'string', |
|||
isTable: false, |
|||
isForm: false, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
form: { |
|||
component: 'Switch', |
|||
value: requestsettingData.autoCommit, |
|||
componentProps: { |
|||
inactiveValue: 'FALSE', |
|||
activeValue: 'TRUE', |
|||
disabled: true |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '并发乐观锁', |
|||
field: 'concurrencyStamp', |
|||
sort: 'custom', |
|||
isForm: false, |
|||
isTable: false |
|||
}, |
|||
{ |
|||
label: '权限所属人员id', |
|||
field: 'ruleUserId', |
|||
sort: 'custom', |
|||
isForm: false, |
|||
isTable: false |
|||
}, |
|||
{ |
|||
label: '工作流流水号', |
|||
field: 'serialNumber', |
|||
sort: 'custom', |
|||
isForm: false, |
|||
isTable: false |
|||
}, |
|||
{ |
|||
label: '原因', |
|||
field: 'reason', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isForm: false, |
|||
table: { |
|||
width: 150, |
|||
fixed: 'right' |
|||
} |
|||
} |
|||
])) |
|||
|
|||
// 表单校验
|
|||
export const RelegateRequestDetailRules = reactive({ |
|||
itemCode: [required], |
|||
downItemCode: [required], |
|||
businessType: [required], |
|||
available: [required], |
|||
departmentCode: [required], |
|||
concurrencyStamp: [required], |
|||
}) |
|||
|
|||
export const RelegateRequestDetail = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: '物料代码', |
|||
field: 'itemCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
form: { |
|||
componentProps: { |
|||
isSearchList: true, |
|||
searchListPlaceholder: '请选择物料代码', |
|||
searchField: 'itemCode', |
|||
searchTitle: '库存余额信息', |
|||
searchAllSchemas: Balance.allSchemas, |
|||
searchPage: BalanceApi.getBalancePageByBusinessTypeByItemType, |
|||
searchCondition: [{ |
|||
key: 'available', |
|||
value: 'TRUE', |
|||
isMainValue: false |
|||
}] |
|||
} |
|||
}, |
|||
tableForm:{ |
|||
isInpuFocusShow: true, |
|||
searchListPlaceholder: '请选择物料代码', // 输入框占位文本
|
|||
searchField: 'itemCode', // 查询弹窗赋值字段
|
|||
searchTitle: '库存余额信息', // 查询弹窗标题
|
|||
searchAllSchemas: Balance.allSchemas, // 查询弹窗所需类
|
|||
searchPage: BalanceApi.getBalancePageByBusinessTypeByItemType, // 查询弹窗所需分页方法
|
|||
searchCondition:[ |
|||
{ |
|||
key: 'available', |
|||
value: 'TRUE', |
|||
isMainValue: false |
|||
}] |
|||
}, |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '降级物料代码', |
|||
field: 'downItemCode', |
|||
sort: 'custom', |
|||
form: { |
|||
componentProps: { |
|||
isSearchList: true, |
|||
searchListPlaceholder: '请选择降级物料代码', |
|||
searchField: 'code', |
|||
searchTitle: '物料基础信息', |
|||
searchAllSchemas: Itembasic.allSchemas, |
|||
searchPage: ItembasicApi.getItembasicPage, |
|||
searchCondition: [{ |
|||
key: 'available', |
|||
value: 'TRUE', |
|||
isMainValue: false |
|||
},{ |
|||
key: 'type', |
|||
value: confgiData.itemType, |
|||
isMainValue: false |
|||
}] |
|||
} |
|||
}, |
|||
tableForm:{ |
|||
isInpuFocusShow: true, |
|||
searchListPlaceholder: '请选择降级物料代码', // 输入框占位文本
|
|||
searchField: 'itemCode', // 查询弹窗赋值字段
|
|||
searchTitle: '物料基础信息', // 查询弹窗标题
|
|||
searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类
|
|||
searchPage: ItembasicApi.getItembasicPage, // 查询弹窗所需分页方法
|
|||
searchCondition:[ |
|||
{ |
|||
key: 'available', |
|||
value: 'TRUE', |
|||
isMainValue: false |
|||
},{ |
|||
key: 'type', |
|||
value: confgiData.itemType, |
|||
isMainValue: false |
|||
}] |
|||
}, |
|||
isSearch: true, |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '计量单位', |
|||
field: 'uom', |
|||
dictType: DICT_TYPE.UOM, |
|||
dictClass: 'string', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 80 |
|||
}, |
|||
tableForm: { |
|||
type: 'Select', |
|||
disabled: true |
|||
}, |
|||
form: { |
|||
componentProps: { |
|||
disabled: true |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '数量', |
|||
field: 'qty', |
|||
sort: 'custom', |
|||
form: { |
|||
componentProps: { |
|||
disabled: true |
|||
} |
|||
}, |
|||
tableForm: { |
|||
disabled: true |
|||
}, |
|||
table: { |
|||
width: 80 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '从批次', |
|||
field: 'fromBatch', |
|||
sort: 'custom', |
|||
form: { |
|||
componentProps: { |
|||
disabled: true, |
|||
} |
|||
}, |
|||
tableForm: { |
|||
disabled: true |
|||
}, |
|||
table: { |
|||
width: 120 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '从包装号', |
|||
field: 'fromPackingNumber', |
|||
sort: 'custom', |
|||
form: { |
|||
componentProps: { |
|||
disabled: true, |
|||
} |
|||
}, |
|||
tableForm: { |
|||
disabled: true |
|||
}, |
|||
table: { |
|||
width: 120 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '从库位代码', |
|||
field: 'fromLocationCode', |
|||
sort: 'custom', |
|||
form: { |
|||
componentProps: { |
|||
disabled: true, |
|||
} |
|||
}, |
|||
tableForm: { |
|||
disabled: true |
|||
}, |
|||
table: { |
|||
width: 120 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '从库区类型', |
|||
field: 'fromAreaTypes', |
|||
dictType: DICT_TYPE.AREA_TYPE, |
|||
dictClass: 'string', |
|||
isTable: false, |
|||
isForm: false, |
|||
isTableForm: false, |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '从库区代码', |
|||
field: 'fromAreaCodes', |
|||
sort: 'custom', |
|||
isForm:false, |
|||
isTableForm: false, |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '到包装号', |
|||
field: 'toPackingNumber', |
|||
sort: 'custom', |
|||
tableForm: { |
|||
disabled: true |
|||
}, |
|||
table: { |
|||
width: 120 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '到批次', |
|||
field: 'toBatch', |
|||
sort: 'custom', |
|||
tableForm: { |
|||
disabled: true |
|||
}, |
|||
table: { |
|||
width: 120 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '到库位代码', |
|||
field: 'toLocationCode', |
|||
sort: 'custom', |
|||
tableForm:{ |
|||
isInpuFocusShow: true, // 开启查询弹窗
|
|||
searchListPlaceholder: '请选择到库位代码', |
|||
searchField: 'code', |
|||
searchTitle: '库位信息', |
|||
searchAllSchemas: Location.allSchemas, |
|||
searchPage: LocationApi.selectBusinessTypeToLocation, |
|||
}, |
|||
form: { |
|||
// labelMessage: '信息提示说明!!!',
|
|||
componentProps: { |
|||
isSearchList: true, // 开启查询弹窗
|
|||
searchListPlaceholder: '请选择到库位代码', |
|||
searchField: 'code', |
|||
searchTitle: '库位信息', |
|||
searchAllSchemas: Location.allSchemas, |
|||
searchPage: LocationApi.selectBusinessTypeToLocation, |
|||
} |
|||
}, |
|||
table: { |
|||
width: 120 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '到库区类型', |
|||
field: 'toAreaTypes', |
|||
dictType: DICT_TYPE.AREA_TYPE, |
|||
dictClass: 'string', |
|||
isTable: false, |
|||
sort: 'custom', |
|||
isTableForm: false |
|||
}, |
|||
{ |
|||
label: '到库区代码', |
|||
field: 'toAreaCodes', |
|||
sort: 'custom', |
|||
isForm:false, |
|||
isTableForm: false, |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '到仓库代码', |
|||
field: 'toWarehouseCode', |
|||
sort: 'custom', |
|||
isForm:false, |
|||
isTableForm: false, |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '是否可用', |
|||
field: 'available', |
|||
sort: 'custom', |
|||
isForm:false, |
|||
isTableForm: false, |
|||
isTable:false, |
|||
}, |
|||
{ |
|||
label: '备注', |
|||
field: 'remark', |
|||
sort: 'custom', |
|||
isForm:false, |
|||
isTableForm: false, |
|||
isTable:false, |
|||
}, |
|||
{ |
|||
label: '部门', |
|||
field: 'departmentCode', |
|||
sort: 'custom', |
|||
isForm:false, |
|||
isTableForm: false, |
|||
isTable:false, |
|||
}, |
|||
{ |
|||
label: '地点ID', |
|||
field: 'siteId', |
|||
sort: 'custom', |
|||
isForm:false, |
|||
isTableForm: false, |
|||
isTable:false, |
|||
}, |
|||
{ |
|||
label: '扩展属性', |
|||
field: 'extraProperties', |
|||
sort: 'custom', |
|||
isForm:false, |
|||
isTableForm: false, |
|||
isTable:false, |
|||
}, |
|||
{ |
|||
label: '创建时间', |
|||
field: 'createTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
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')] |
|||
} |
|||
}, |
|||
isForm:false, |
|||
isTableForm: false, |
|||
isTable:false, |
|||
}, |
|||
{ |
|||
label: '状态', |
|||
field: 'status', |
|||
dictType: DICT_TYPE.REQUEST_STATUS, |
|||
dictClass: 'string', |
|||
isForm: false, |
|||
isTable: true, |
|||
sort: 'custom', |
|||
isTableForm: false, |
|||
}, |
|||
{ |
|||
label: '并发乐观锁', |
|||
field: 'concurrencyStamp', |
|||
sort: 'custom', |
|||
isForm:false, |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
isTableForm: false, |
|||
isTable:false, |
|||
}, |
|||
{ |
|||
label: '工作流流水号', |
|||
field: 'serialNumber', |
|||
isForm:false, |
|||
sort: 'custom', |
|||
isTableForm: false, |
|||
isTable:false, |
|||
}, |
|||
{ |
|||
label: '权限所属人员id', |
|||
field: 'ruleUserId', |
|||
sort: 'custom', |
|||
isForm:false, |
|||
isTableForm: false, |
|||
isTable:false, |
|||
}, |
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isForm: false, |
|||
hiddenInMain:true, |
|||
table: { |
|||
width: 150, |
|||
fixed: 'right' |
|||
}, |
|||
isTableForm: false |
|||
} |
|||
])) |
@ -0,0 +1,553 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
import * as getRequestsettingApi from '@/api/wms/requestsetting/index' |
|||
|
|||
import * as ItembasicApi from "@/api/wms/itembasic"; |
|||
|
|||
import { Itembasic } from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data' |
|||
|
|||
import {Warehouse} from "@/views/wms/basicDataManage/factoryModeling/warehouse/warehouse.data"; |
|||
import * as WarehouseApi from "@/api/wms/warehouse"; |
|||
|
|||
import * as BalanceApi from '@/api/wms/balance' |
|||
import { Balance } from '@/views/wms/inventoryManage/balance/balance.data' |
|||
|
|||
// 获取自动提交自动通过自动执行,跳过任务直接删生成记录的默认值
|
|||
const queryParams = { |
|||
pageSize:10, |
|||
pageNo:1, |
|||
code:'RelegateRequest' |
|||
} |
|||
const data = await getRequestsettingApi.getRequestsettingPage(queryParams) |
|||
const requestsettingData =data?.list[0]||{} |
|||
// 表单校验
|
|||
export const RelegateRequestMainRules = reactive({ |
|||
fromWarehouseCode: [required], |
|||
number: [required], |
|||
businessType: [required], |
|||
autoCommit: [required], |
|||
autoAgree: [required], |
|||
autoExecute: [required], |
|||
directCreateRecord: [required], |
|||
concurrencyStamp: [required], |
|||
fromAreaTypes: [required], |
|||
fromAreaCodes: [required], |
|||
}) |
|||
|
|||
export const RelegateRequestMain = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: '单据号', |
|||
field: 'number', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
isForm: false |
|||
}, |
|||
{ |
|||
label: '从仓库代码', |
|||
field: 'fromWarehouseCode', |
|||
sort: 'custom', |
|||
form: { |
|||
// labelMessage: '信息提示说明!!!',
|
|||
componentProps: { |
|||
isSearchList: true, // 开启查询弹窗
|
|||
searchListPlaceholder: '请选择仓库代码', // 输入框占位文本
|
|||
searchField: 'code', // 查询弹窗赋值字段
|
|||
searchTitle: '仓库信息', // 查询弹窗标题
|
|||
searchAllSchemas: Warehouse.allSchemas, // 查询弹窗所需类
|
|||
searchPage: WarehouseApi.getWarehousePage, // 查询弹窗所需分页方法
|
|||
searchCondition: [{ |
|||
key: 'available', |
|||
value: 'TRUE', |
|||
isMainValue: false |
|||
}] |
|||
} |
|||
} |
|||
}, |
|||
|
|||
{ |
|||
label: '业务类型', |
|||
field: 'businessType', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
isForm: false, |
|||
isTable: false |
|||
}, |
|||
{ |
|||
label: '备注', |
|||
field: 'remark', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
isForm: false, |
|||
isTable: false |
|||
}, |
|||
{ |
|||
label: '创建时间', |
|||
field: 'createTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
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')] |
|||
} |
|||
}, |
|||
isForm: false, |
|||
isTable: false |
|||
}, |
|||
{ |
|||
label: '扩展属性', |
|||
field: 'extraProperties', |
|||
sort: 'custom', |
|||
isForm: false, |
|||
isTable: false |
|||
}, |
|||
{ |
|||
label: '地点ID', |
|||
field: 'siteId', |
|||
sort: 'custom', |
|||
isForm: false, |
|||
isTable: false |
|||
}, |
|||
{ |
|||
label: '申请时间', |
|||
field: 'requestTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
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')] |
|||
} |
|||
}, |
|||
isForm: false, |
|||
isTable: false |
|||
}, |
|||
{ |
|||
label: '截止时间', |
|||
field: 'dueTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
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')] |
|||
} |
|||
}, |
|||
isForm: false, |
|||
isTable: false |
|||
}, |
|||
{ |
|||
label: '部门', |
|||
field: 'departmentCode', |
|||
sort: 'custom', |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '状态', |
|||
field: 'status', |
|||
dictType: DICT_TYPE.REQUEST_STATUS, |
|||
dictClass: 'string', |
|||
isSearch: true, |
|||
isForm: false, |
|||
isTable: true, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '自动提交', |
|||
field: 'autoCommit', |
|||
dictType: DICT_TYPE.TRUE_FALSE, |
|||
dictClass: 'string', |
|||
isTable: false, |
|||
isForm: false, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
form: { |
|||
component: 'Switch', |
|||
value: requestsettingData.autoCommit, |
|||
componentProps: { |
|||
inactiveValue: 'FALSE', |
|||
activeValue: 'TRUE', |
|||
disabled: true |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '自动通过', |
|||
field: 'autoAgree', |
|||
dictType: DICT_TYPE.TRUE_FALSE, |
|||
dictClass: 'string', |
|||
isTable: false, |
|||
isForm: false, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
form: { |
|||
component: 'Switch', |
|||
value: requestsettingData.autoCommit, |
|||
componentProps: { |
|||
inactiveValue: 'FALSE', |
|||
activeValue: 'TRUE', |
|||
disabled: true |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '自动执行', |
|||
field: 'autoExecute', |
|||
dictType: DICT_TYPE.TRUE_FALSE, |
|||
dictClass: 'string', |
|||
isTable: false, |
|||
isForm: false, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
form: { |
|||
component: 'Switch', |
|||
value: requestsettingData.autoCommit, |
|||
componentProps: { |
|||
inactiveValue: 'FALSE', |
|||
activeValue: 'TRUE', |
|||
disabled: true |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '直接生成记录', |
|||
field: 'directCreateRecord', |
|||
dictType: DICT_TYPE.TRUE_FALSE, |
|||
dictClass: 'string', |
|||
isTable: false, |
|||
isForm: false, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
form: { |
|||
component: 'Switch', |
|||
value: requestsettingData.autoCommit, |
|||
componentProps: { |
|||
inactiveValue: 'FALSE', |
|||
activeValue: 'TRUE', |
|||
disabled: true |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '并发乐观锁', |
|||
field: 'concurrencyStamp', |
|||
sort: 'custom', |
|||
isForm: false, |
|||
isTable: false |
|||
}, |
|||
{ |
|||
label: '权限所属人员id', |
|||
field: 'ruleUserId', |
|||
sort: 'custom', |
|||
isForm: false, |
|||
isTable: false |
|||
}, |
|||
{ |
|||
label: '工作流流水号', |
|||
field: 'serialNumber', |
|||
sort: 'custom', |
|||
isForm: false, |
|||
isTable: false |
|||
}, |
|||
{ |
|||
label: '原因', |
|||
field: 'reason', |
|||
sort: 'custom', |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isForm: false, |
|||
table: { |
|||
width: 150, |
|||
fixed: 'right' |
|||
} |
|||
} |
|||
])) |
|||
|
|||
// 表单校验
|
|||
export const RelegateRequestDetailRules = reactive({ |
|||
itemCode: [required], |
|||
downItemCode: [required], |
|||
businessType: [required], |
|||
available: [required], |
|||
departmentCode: [required], |
|||
concurrencyStamp: [required], |
|||
}) |
|||
|
|||
export const RelegateRequestDetail = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: '物料代码', |
|||
field: 'itemCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
tableForm:{ |
|||
isInpuFocusShow: false, // 开启查询弹窗
|
|||
searchListPlaceholder: '请选择物料代码', |
|||
searchField: 'code', |
|||
searchTitle: '物料基础信息', |
|||
searchAllSchemas: Itembasic.allSchemas, |
|||
searchPage: ItembasicApi.getItembasicPage, |
|||
searchCondition: [{ |
|||
key: 'available', |
|||
value: 'TRUE', |
|||
isMainValue: false |
|||
}] |
|||
}, |
|||
form: { |
|||
componentProps: { |
|||
isSearchList: true, |
|||
searchListPlaceholder: '请选择物料代码', |
|||
searchField: 'itemCode', |
|||
searchTitle: '物料基础信息', |
|||
searchAllSchemas: Itembasic.allSchemas, |
|||
searchPage: ItembasicApi.getItembasicPage, |
|||
searchCondition: [{ |
|||
key: 'available', |
|||
value: 'TRUE', |
|||
isMainValue: false |
|||
}] |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '降级物料代码', |
|||
field: 'downItemCode', |
|||
sort: 'custom', |
|||
form: { |
|||
componentProps: { |
|||
isSearchList: true, |
|||
searchListPlaceholder: '请选择降级物料代码', |
|||
searchField: 'itemCode', |
|||
searchTitle: '物料基础信息', |
|||
searchAllSchemas: Itembasic.allSchemas, |
|||
searchPage: ItembasicApi.getItembasicPage, |
|||
searchCondition: [{ |
|||
key: 'available', |
|||
value: 'TRUE', |
|||
isMainValue: false |
|||
}] |
|||
} |
|||
}, |
|||
isSearch: true |
|||
}, |
|||
{ |
|||
label: '计量单位', |
|||
field: 'uom', |
|||
dictType: DICT_TYPE.UOM, |
|||
dictClass: 'string', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
tableForm: { |
|||
type: 'Select', |
|||
disabled: true |
|||
}, |
|||
form: { |
|||
componentProps: { |
|||
disabled: true |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '数量', |
|||
field: 'qty', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '从批次', |
|||
field: 'fromBatch', |
|||
sort: 'custom', |
|||
form: { |
|||
componentProps: { |
|||
disabled: true, |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '从包装号', |
|||
field: 'fromPackingNumber', |
|||
sort: 'custom', |
|||
form: { |
|||
componentProps: { |
|||
disabled: true, |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '从库位代码', |
|||
field: 'fromLocationCode', |
|||
sort: 'custom', |
|||
form: { |
|||
componentProps: { |
|||
disabled: true, |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '从库区类型', |
|||
field: 'fromAreaTypes', |
|||
sort: 'custom', |
|||
isForm:false, |
|||
}, |
|||
{ |
|||
label: '从库区代码', |
|||
field: 'fromAreaCodes', |
|||
sort: 'custom', |
|||
isForm:false, |
|||
}, |
|||
{ |
|||
label: '从仓库代码', |
|||
field: 'fromWarehouseCode', |
|||
sort: 'custom', |
|||
isForm:false, |
|||
}, |
|||
{ |
|||
label: '到包装号', |
|||
field: 'toPackingNumber', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '到批次', |
|||
field: 'toBatch', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '到库位代码', |
|||
field: 'toLocationCode', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '到仓库代码', |
|||
field: 'toWarehouseCode', |
|||
sort: 'custom', |
|||
isForm:false, |
|||
}, |
|||
{ |
|||
label: '到库区类型', |
|||
field: 'toAreaTypes', |
|||
sort: 'custom', |
|||
isForm:false, |
|||
}, |
|||
{ |
|||
label: '到库区代码', |
|||
field: 'toAreaCodes', |
|||
sort: 'custom', |
|||
isForm:false, |
|||
}, |
|||
{ |
|||
label: '是否可用', |
|||
field: 'available', |
|||
sort: 'custom', |
|||
isForm:false, |
|||
}, |
|||
{ |
|||
label: '备注', |
|||
field: 'remark', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '部门', |
|||
field: 'departmentCode', |
|||
sort: 'custom', |
|||
isForm:false, |
|||
}, |
|||
{ |
|||
label: '地点ID', |
|||
field: 'siteId', |
|||
sort: 'custom', |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
isForm:false, |
|||
}, |
|||
{ |
|||
label: '扩展属性', |
|||
field: 'extraProperties', |
|||
sort: 'custom', |
|||
isForm:false, |
|||
}, |
|||
{ |
|||
label: '创建时间', |
|||
field: 'createTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
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')] |
|||
} |
|||
}, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '状态', |
|||
field: 'status', |
|||
dictType: DICT_TYPE.REQUEST_STATUS, |
|||
dictClass: 'string', |
|||
isSearch: true, |
|||
isForm: false, |
|||
isTable: true, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '并发乐观锁', |
|||
field: 'concurrencyStamp', |
|||
sort: 'custom', |
|||
isForm:false, |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '工作流流水号', |
|||
field: 'serialNumber', |
|||
isForm:false, |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '权限所属人员id', |
|||
field: 'ruleUserId', |
|||
sort: 'custom', |
|||
isForm:false, |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isForm: false, |
|||
table: { |
|||
width: 150, |
|||
fixed: 'right' |
|||
} |
|||
} |
|||
])) |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue