Browse Source

Merge remote-tracking branch 'origin/master_hella' into master_hella

master_hella_20240701
gaojs 6 months ago
parent
commit
1a7524a57f
  1. 64
      src/api/eam/classTypeRole/index.ts
  2. 5
      src/api/system/role/index.ts
  3. 5
      src/api/wms/workshop/index.ts
  4. 2
      src/config/axios/config.ts
  5. 5
      src/utils/dict.ts
  6. 191
      src/views/eam/classTypeRole/classTypeRole.data.ts
  7. 264
      src/views/eam/classTypeRole/index.vue
  8. 14
      src/views/eam/spotCheckItem/spotCheckItem.data.ts
  9. 1
      src/views/mes/orderDay/components/BasicFormV2.vue
  10. 5
      src/views/mes/orderDay/components/schedule.vue
  11. 7
      src/views/mes/orderDay/orderDay.data.ts
  12. 15
      src/views/mes/processroute/index.vue
  13. 85
      src/views/system/role/role.data.ts
  14. 92
      src/views/wms/basicDataManage/itemManage/relegate/relegateRecord/index.vue
  15. 310
      src/views/wms/basicDataManage/itemManage/relegate/relegateRecord/relegateRecordMain.data.ts
  16. 76
      src/views/wms/basicDataManage/itemManage/relegate/relegateRequest/index.vue
  17. 4
      src/views/wms/basicDataManage/itemManage/relegate/relegateRequest/relegateRequestMain.data.ts

64
src/api/eam/classTypeRole/index.ts

@ -0,0 +1,64 @@
import request from '@/config/axios'
export interface ClassTypeRoleVO {
id: number
workerRoleId: string
engineerRoleId: string
type: string
factoryAreaCode: string
workshopCode: string
departmentCode: string
remark: string
siteId: string
available: string
deletionTime: Date
deleterId: byte[]
concurrencyStamp: number
}
// 查询厂区班组角色维护列表
export const getClassTypeRolePage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/eam/basic/class-type-role/senior', data })
} else {
return await request.get({ url: `/eam/basic/class-type-role/page`, params })
}
}
// 查询厂区班组角色维护详情
export const getClassTypeRole = async (id: number) => {
return await request.get({ url: `/eam/basic/class-type-role/get?id=` + id })
}
// 新增厂区班组角色维护
export const createClassTypeRole = async (data: ClassTypeRoleVO) => {
return await request.post({ url: `/eam/basic/class-type-role/create`, data })
}
// 修改厂区班组角色维护
export const updateClassTypeRole = async (data: ClassTypeRoleVO) => {
return await request.put({ url: `/eam/basic/class-type-role/update`, data })
}
// 删除厂区班组角色维护
export const deleteClassTypeRole = async (id: number) => {
return await request.delete({ url: `/eam/basic/class-type-role/delete?id=` + id })
}
// 导出厂区班组角色维护 Excel
export const exportClassTypeRole = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = { ...params }
return await request.downloadPost({ url: `/eam/basic/class-type-role/export-excel-senior`, data })
} else {
return await request.download({ url: `/eam/basic/class-type-role/export-excel`, params })
}
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/eam/basic/class-type-role/get-import-template' })
}

5
src/api/system/role/index.ts

@ -59,3 +59,8 @@ export const exportRole = (params) => {
params params
}) })
} }
// 查询角色列表
export const getRoleNoPage = async (params: PageParam) => {
return await request.get({ url: '/system/role/noPage', params })
}

5
src/api/wms/workshop/index.ts

@ -55,4 +55,9 @@ export const exportWorkshop = async (params) => {
// 下载用户导入模板 // 下载用户导入模板
export const importTemplate = () => { export const importTemplate = () => {
return request.download({ url: '/wms/workshop/get-import-template' }) return request.download({ url: '/wms/workshop/get-import-template' })
}
// 查询车间列表
export const getWorkshopNoPage = async (params) => {
return await request.get({ url: `/wms/workshop/noPage`, params })
} }

2
src/config/axios/config.ts

@ -16,7 +16,7 @@ const config: {
/** /**
* *
*/ */
request_timeout: 3000000, request_timeout: 30000,
/** /**
* *

5
src/utils/dict.ts

@ -341,5 +341,6 @@ export enum DICT_TYPE {
// ========== eam - 业务 - ========== // ========== eam - 业务 - ==========
DEVICE_TYPE = 'device_type', // 设备类型 DEVICE_TYPE = 'device_type', // 设备类型
IS_UPDATED = 'is_updated', //是否可修改 IS_UPDATED = 'is_updated', //是否可修改
DATA_SCOPE = 'data_scope', // 数据范围
} ROLE_STATUS = 'role_status' // 角色状态
}

191
src/views/eam/classTypeRole/classTypeRole.data.ts

@ -0,0 +1,191 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import * as deptApi from '@/api/system/dept'
import * as roleApi from '@/api/system/role'
import { Role } from '@/views/system/role/role.data'
import { selectAllFactoryArea } from '@/api/system/dept'
import * as WorkshopApi from '@/api/wms/workshop'
import { Workshop } from '@/views/wms/basicDataManage/factoryModeling/workshop/workshop.data'
const roleList = await roleApi.getSimpleRoleList({})
const workshopList = await WorkshopApi.getWorkshopPage({ pageNo: 1, pageSize: 100 })
const roleListNoPage = await roleApi.getRoleNoPage({})
const workshopNoPage = await WorkshopApi.getWorkshopNoPage({ pageNo: 1, pageSize: 100 })
// 表单校验
export const ClassTypeRoleRules = reactive({
workerRoleId: [required],
engineerRoleId: [required],
workerRoleName: [required],
engineerRoleName: [required],
workshopName: [required],
type: [required],
factoryAreaCode: [required],
concurrencyStamp: [required]
})
export const ClassTypeRole = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '维修工角色',
field: 'workerRoleId',
sort: 'custom',
isSearch: true,
isDetail: false,
isForm: false,
isTable: true,
isTableForm: false,
search: {
component: 'Select',
componentProps: {
options: roleListNoPage,
optionsAlias: {
labelField: 'name',
valueField: 'id'
},
filterable: true,
}
},
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return roleList.find((item) => item.id == cellValue)?.name
},
},
{
label: '维修工角色',
field: 'workerRoleName',
sort: 'custom',
isTable: false,
form: {
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择角色', // 输入框占位文本
searchField: 'id', // 查询弹窗赋值字段
searchTitle: '维修工角色', // 查询弹窗标题
searchAllSchemas: Role.allSchemas, // 查询弹窗所需类
searchPage: roleApi.getRolePage, // 查询弹窗所需分页方法
searchCondition: []
}
},
},
{
label: '工程师角色',
field: 'engineerRoleId',
sort: 'custom',
isSearch: true,
isDetail: false,
isForm: false,
isTable: true,
isTableForm: false,
search: {
component: 'Select',
componentProps: {
options: roleListNoPage,
optionsAlias: {
labelField: 'name',
valueField: 'id'
},
filterable: true,
}
},
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return roleList.find((item) => item.id == cellValue)?.name
},
},
{
label: '工程师角色',
field: 'engineerRoleName',
sort: 'custom',
isTable: false,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择角色', // 输入框占位文本
searchField: 'id', // 查询弹窗赋值字段
searchTitle: '工程师角色', // 查询弹窗标题
searchAllSchemas: Role.allSchemas, // 查询弹窗所需类
searchPage: roleApi.getRolePage, // 查询弹窗所需分页方法
searchCondition: []
}
},
},
{
label: '班组',
field: 'type',
sort: 'custom',
isSearch: true,
dictType: DICT_TYPE.BASIC_TEAM_TYPE,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
},
{
label: '车间编号',
field: 'workshopCode',
sort: 'custom',
isSearch: true,
isDetail: false,
isForm: false,
isTable: true,
isTableForm: false,
search: {
component: 'Select',
componentProps: {
options: workshopNoPage,
optionsAlias: {
labelField: 'name',
valueField: 'code'
},
filterable: true,
}
},
formatter: (_: Recordable, __: TableColumn, cellValue: string) => {
return workshopList.list.find((item) => item.code == cellValue)?.name
},
},
{
label: '车间编号',
field: 'workshopName',
sort: 'custom',
isTable: false,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择车间代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '车间信息', // 查询弹窗标题
searchAllSchemas: Workshop.allSchemas, // 查询弹窗所需类
searchPage: WorkshopApi.getWorkshopPage, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
},
},
{
label: '备注',
field: 'remark',
sort: 'custom',
isSearch: true
},
{
label: '是否可用',
field: 'available',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
isTable: true,
isDetail: false,
isSearch: false,
isTableForm: false,
isForm: false,
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))

264
src/views/eam/classTypeRole/index.vue

@ -0,0 +1,264 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="ClassTypeRole.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="ClassTypeRole.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="ClassTypeRoleRules"
:formAllSchemas="ClassTypeRole.allSchemas"
:apiUpdate="ClassTypeRoleApi.updateClassTypeRole"
:apiCreate="ClassTypeRoleApi.createClassTypeRole"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="ClassTypeRole.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/eam/class-type-role/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { ClassTypeRole,ClassTypeRoleRules } from './classTypeRole.data'
import * as ClassTypeRoleApi from '@/api/eam/classTypeRole'
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 * as roleApi from '@/api/system/role'
import { Role } from '@/views/system/role/role.data'
import * as WorkshopApi from '@/api/wms/workshop'
import { Workshop } from '@/views/wms/basicDataManage/factoryModeling/workshop/workshop.data'
defineOptions({ name: 'ClassTypeRole' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(ClassTypeRole.allSchemas.tableColumns)
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
if(formField == 'workerRoleName'){
setV['workerRoleName'] = val[0]['name']
setV['workerRoleId'] = val[0][searchField]
}else if(formField == 'engineerRoleName'){
setV['engineerRoleName'] = val[0]['name']
setV['engineerRoleId'] = val[0][searchField]
}else if(formField == 'workshopName'){
setV['workshopName'] = val[0]['name']
setV['workshopCode'] = val[0][searchField]
}
formRef.setValues(setV)
})
}
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
const { tableObject, tableMethods } = useTable({
getListApi: ClassTypeRoleApi.getClassTypeRolePage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'eam:class-type-role:create'}), //
// defaultButtons.defaultImportBtn({hasPermi:'eam:class-type-role:import'}), //
// defaultButtons.defaultExportBtn({hasPermi:'eam:class-type-role:export'}), //
defaultButtons.defaultFreshBtn(null), //
// defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
// {
// label: '',
// name: 'zdy',
// hide: false,
// type: 'primary',
// icon: 'Select',
// color: ''
// },
]
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
openForm('create')
} else if (val == 'import') { //
handleImport()
} else if (val == 'export') { //
handleExport()
} else if (val == 'refresh') { //
getList()
} else if (val == 'filtrate') { //
} else { //
console.log('其他按钮', item)
}
}
// -
const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'eam:class-type-role:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'eam:class-type-role:delete'}), //
]
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = async (type: string, row?: any) => {
const roleList = await roleApi.getSimpleRoleList({})
const workshopList = await WorkshopApi.getWorkshopPage({ pageNo: 1, pageSize: 100 })
if(row != undefined){
row.workerRoleName = roleList.find(item => item.id == row.workerRoleId).name
row.engineerRoleName = roleList.find(item => item.id == row.engineerRoleId).name
row.workshopName = workshopList.list.find(item => item.code == row.workshopCode)?.name
}
basicFormRef.value.open(type, row)
}
// form
const formsSuccess = async (formType,data) => {
var isHave =ClassTypeRole.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 ClassTypeRoleApi.createClassTypeRole(data)
message.success(t('common.createSuccess'))
} else {
await ClassTypeRoleApi.updateClassTypeRole(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, 'basicClassTypeRole')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await ClassTypeRoleApi.deleteClassTypeRole(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 ClassTypeRoleApi.exportClassTypeRole(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 ClassTypeRoleApi.importTemplate()
})
</script>

14
src/views/eam/spotCheckItem/spotCheckItem.data.ts

@ -77,13 +77,13 @@ export const SpotCheckItem = useCrudSchemas(reactive<CrudSchema[]>([
label: '是否启用', label: '是否启用',
field: 'available', field: 'available',
sort: 'custom', sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE, dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑 dictClass: 'string', // 默认都是字符串类型其他暂不考虑
isTable: true, isTable: true,
isDetail: false, isDetail: false,
isSearch: false, isSearch: false,
isTableForm: false, isTableForm: false,
isForm: false, isForm: false,
}, },
{ {
label: '备注', label: '备注',

1
src/views/mes/orderDay/components/BasicFormV2.vue

@ -372,6 +372,7 @@ const submitForm = async () => {
/** 重置表单 */ /** 重置表单 */
const resetForm = () => { const resetForm = () => {
unref(formRef)?.resetFields() unref(formRef)?.resetFields()
//formRef.value?.resetFields()
} }
// //

5
src/views/mes/orderDay/components/schedule.vue

@ -438,6 +438,11 @@ const getConfigProcessEquipment= async (code:any) => {
} }
const nodeClick = (e, x, y, node, view) => { const nodeClick = (e, x, y, node, view) => {
//console.log(node.id) //console.log(node.id)
//console.log("schedule-nodeClick-440",node)
if(node.id=="startNode" || node.id=="endNode"){
return
}
getProcessBom(node.id) getProcessBom(node.id)
getConfigProcessWorkstation(node.id) getConfigProcessWorkstation(node.id)
getConfigProcessWorker(node.id) getConfigProcessWorker(node.id)

7
src/views/mes/orderDay/orderDay.data.ts

@ -178,11 +178,13 @@ export const OrderDay = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
required: true, required: true,
value:'',
form:{ form:{
component:'Select', component:'Select',
componentProps:{ componentProps:{
options:[{lablel:'1',value:'1'}] options:[],
} },
} }
}, },
{ {
@ -200,6 +202,7 @@ export const OrderDay = useCrudSchemas(reactive<CrudSchema[]>([
field: 'processrouteCode', field: 'processrouteCode',
sort: 'custom', sort: 'custom',
form: { form: {
value:"",
component:'Select', component:'Select',
componentProps: { componentProps: {
options: [] options: []

15
src/views/mes/processroute/index.vue

@ -126,8 +126,16 @@ const buttonBaseClick = (val, item) => {
} else if (val == 'export') { // } else if (val == 'export') { //
handleExport() handleExport()
} else if (val == 'refresh') { // } else if (val == 'refresh') { //
// if (tableObject.params.filters && tableObject.params.filters.length > 0 ) {
// searchFormClick({
// filters: tableObject.params.filters
// })
// } else {
// getList()
// }
getList() getList()
} else if (val == 'filtrate') { // } else if (val == 'filtrate') { //
} else { // } else { //
console.log('其他按钮', item) console.log('其他按钮', item)
} }
@ -257,12 +265,15 @@ const importSuccess = () => {
} }
// //
const searchFormClick = (searchData) => { const searchFormClick = async (searchData) => {
tableObject.params = { tableObject.params = {
isSearch: true, isSearch: true,
filters: searchData.filters filters: searchData.filters
} }
getList() //
//await getList()
//console.log('searchFormClick',tableObject.tableList )
//
} }
/** 初始化 **/ /** 初始化 **/

85
src/views/system/role/role.data.ts

@ -0,0 +1,85 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
// 表单校验
export const RoleRules = reactive({
name: [required],
code: [required],
})
export const Role = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '角色ID',
field: 'id',
sort: 'custom',
isForm: false,
},
{
label: '角色名称',
field: 'name',
sort: 'custom',
},
{
label: '角色权限字符串',
field: 'code',
sort: 'custom',
width: 200,
},
{
label: '显示顺序',
field: 'sort',
sort: 'custom',
form: {
component: 'InputNumber',
value: 0
},
},
{
label: '数据权限范围',
field: 'dataScope',
sort: 'custom',
dictType: DICT_TYPE.DATA_SCOPE,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
width: 200,
},
{
label: '数据部门范围',
field: 'dataScopeDeptIds',
sort: 'custom',
},
{
label: '角色状态',
field: 'status',
sort: 'custom',
dictType: DICT_TYPE.ROLE_STATUS,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
},
{
label: '角色类型',
field: 'type',
sort: 'custom',
dictType: DICT_TYPE.SYSTEM_ROLE_TYPE,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
},
{
label: '备注',
field: 'remark',
sort: 'custom',
},
{
label: '创建时间',
field: 'createTime',
sort: 'custom',
formatter: dateFormatter,
isForm: false,
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))

92
src/views/wms/basicDataManage/itemManage/relegate/relegateRecord/index.vue

@ -1,7 +1,7 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<Search :schema="RelegateRecordMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> <Search :schema="[...RelegateRecordMain.allSchemas.searchSchema, ...RelegateRecordDetail.allSchemas.searchSchema]" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap> </ContentWrap>
<!-- 列表头部 --> <!-- 列表头部 -->
@ -12,6 +12,7 @@
@updataTableColumns="updataTableColumns" @updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick" @searchFormClick="searchFormClick"
:allSchemas="RelegateRecordMain.allSchemas" :allSchemas="RelegateRecordMain.allSchemas"
:detailAllSchemas="RelegateRecordDetail.allSchemas"
/> />
<!-- 列表 --> <!-- 列表 -->
@ -27,9 +28,9 @@
v-model:currentPage="tableObject.currentPage" v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort" v-model:sort="tableObject.sort"
> >
<template #code="{row}"> <template #number="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> <el-button type="primary" link @click="openDetail(row, '单据号', row.number)">
<span>{{ row.code }}</span> <span>{{ row.number }}</span>
</el-button> </el-button>
</template> </template>
<template #action="{ row }"> <template #action="{ row }">
@ -41,29 +42,44 @@
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<BasicForm <BasicForm
ref="basicFormRef" ref="basicFormRef"
@success="formsSuccess" :isOpenSearchTable="true"
@success="getList"
:rules="RelegateRecordMainRules" :rules="RelegateRecordMainRules"
:formAllSchemas="RelegateRecordMain.allSchemas" :formAllSchemas="RelegateRecordMain.allSchemas"
:tableAllSchemas="RelegateRecordDetail.allSchemas"
:tableFormRules="RelegateRecordDetailRules"
:apiUpdate="RelegateRecordMainApi.updateRelegateRecordMain" :apiUpdate="RelegateRecordMainApi.updateRelegateRecordMain"
:apiCreate="RelegateRecordMainApi.createRelegateRecordMain" :apiCreate="RelegateRecordMainApi.createRelegateRecordMain"
:isBusiness="true"
fromeWhere="RelegateRecordMain"
@submitForm="submitForm"
@searchTableSuccess="searchTableSuccess" @searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/> />
<!-- 详情 --> <!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="RelegateRecordMain.allSchemas" /> <Detail
ref="detailRef"
<!-- 导入 --> :isBasic="true"
<ImportForm ref="importFormRef" url="/wms/relegate-record-main/import" :importTemplateData="importTemplateData" @success="importSuccess" /> :allSchemas="RelegateRecordMain.allSchemas"
:detailAllSchemas="RelegateRecordDetail.allSchemas"
:detailAllSchemasRules="RelegateRecordDetailRules"
:apiCreate="RelegateRecordDetailApi.createRelegateRecordDetail"
:apiUpdate="RelegateRecordDetailApi.updateRelegateRecordDetail"
:apiPage="RelegateRecordDetailApi.getRelegateRecordDetailPage"
:apiDelete="RelegateRecordDetailApi.deleteRelegateRecordDetail"
fromeWhere="RelegateRecordMain"
@searchTableSuccessDetail="searchTableSuccessDetail"
:detailButtonIsShowAdd="true"
:detailButtonIsShowDelete="true" />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import download from '@/utils/download' import download from '@/utils/download'
import { RelegateRecordMain,RelegateRecordMainRules } from './relegate-record-main.data' import { RelegateRecordMain,RelegateRecordMainRules,RelegateRecordDetail,RelegateRecordDetailRules } from './relegateRecordMain.data'
import * as RelegateRecordMainApi from '@/api/wms/relegateRecordMain' import * as RelegateRecordMainApi from '@/api/wms/relegateRecordMain'
import * as RelegateRecordDetailApi from '@/api/wms/relegateRecordDetail'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue' import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue' import Detail from '@/components/Detail/src/Detail.vue'
defineOptions({ name: 'RelegateRecordMain' }) defineOptions({ name: 'RelegateRecordMain' })
@ -74,7 +90,8 @@ const { t } = useI18n() // 国际化
const route = useRoute() // const route = useRoute() //
const routeName = ref() const routeName = ref()
routeName.value = route.name routeName.value = route.name
const tableColumns = ref(RelegateRecordMain.allSchemas.tableColumns) const tableColumns = ref([...RelegateRecordMain.allSchemas.tableColumns,...RelegateRecordDetail.allSchemas.tableMainColumns])
// //
const searchTableSuccess = (formField, searchField, val, formRef) => { const searchTableSuccess = (formField, searchField, val, formRef) => {
@ -85,13 +102,22 @@ const searchTableSuccess = (formField, searchField, val, formRef) => {
}) })
} }
//
const searchTableSuccessDetail = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
})
}
// //
const updataTableColumns = (val) => { const updataTableColumns = (val) => {
tableColumns.value = val tableColumns.value = val
} }
const { tableObject, tableMethods } = useTable({ const { tableObject, tableMethods } = useTable({
getListApi: RelegateRecordMainApi.getRelegateRecordMainPage // getListApi: RelegateRecordDetailApi.getRelegateRecordDetailPage //
}) })
// //
@ -119,8 +145,6 @@ const HeadButttondata = [
const buttonBaseClick = (val, item) => { const buttonBaseClick = (val, item) => {
if (val == 'add') { // if (val == 'add') { //
openForm('create') openForm('create')
} else if (val == 'import') { //
handleImport()
} else if (val == 'export') { // } else if (val == 'export') { //
handleExport() handleExport()
} else if (val == 'refresh') { // } else if (val == 'refresh') { //
@ -152,19 +176,16 @@ const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row) basicFormRef.value.open(type, row)
} }
/**
* tableForm方法
*/
const tableFormKeys = {}
RelegateRecordDetail.allSchemas.tableFormColumns.forEach(item => {
tableFormKeys[item.field] = item.default ? item.default : ''
})
// form // form
const formsSuccess = async (formType,data) => { const submitForm = 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') { if (formType === 'create') {
await RelegateRecordMainApi.createRelegateRecordMain(data) await RelegateRecordMainApi.createRelegateRecordMain(data)
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))
@ -211,20 +232,6 @@ const handleExport = async () => {
} }
} }
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: '物料降级记录主导入模版.xlsx'
})
//
const importSuccess = () => {
getList()
}
// //
const searchFormClick = (searchData) => { const searchFormClick = (searchData) => {
@ -238,7 +245,6 @@ const searchFormClick = (searchData) => {
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
getList() getList()
importTemplateData.templateUrl = await RelegateRecordMainApi.importTemplate()
}) })
</script> </script>

310
src/views/wms/basicDataManage/itemManage/relegate/relegateRecord/relegateRecordMain.data.ts

@ -1,5 +1,11 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
import { handleTreeToComponentOptions } from '@/utils/tree'
import * as DeptApi from '@/api/system/dept'
const deptList = ref<Tree[]>([]) // 树形结构
// 加载部门树(默认格式)
deptList.value = handleTreeToComponentOptions(await DeptApi.getSimpleDeptList())
// 表单校验 // 表单校验
export const RelegateRecordMainRules = reactive({ export const RelegateRecordMainRules = reactive({
@ -11,31 +17,28 @@ export const RelegateRecordMainRules = reactive({
export const RelegateRecordMain = useCrudSchemas(reactive<CrudSchema[]>([ export const RelegateRecordMain = useCrudSchemas(reactive<CrudSchema[]>([
{ {
label: 'id', label: '单据号',
field: 'id', field: 'number',
sort: 'custom', sort: 'custom',
isForm: false, isSearch: true,
table: {
width: 180
},
}, },
{ {
label: '申请单号', label: '申请单号',
field: 'requestNumber', field: 'requestNumber',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
table: {
width: 180
},
}, },
{ {
label: '执行时间', label: '执行时间',
field: 'executeTime', field: 'executeTime',
sort: 'custom', sort: 'custom',
formatter: dateFormatter, 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: { form: {
component: 'DatePicker', component: 'DatePicker',
componentProps: { componentProps: {
@ -43,49 +46,34 @@ export const RelegateRecordMain = useCrudSchemas(reactive<CrudSchema[]>([
valueFormat: 'x' valueFormat: 'x'
} }
}, },
table: {
width: 200
},
}, },
{ {
label: '生效日期', label: '是否可用',
field: 'activeDate', field: 'available',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: false,
sort: 'custom', sort: 'custom',
formatter: dateFormatter, table: {
isSearch: true, width: 150
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: { form: {
component: 'DatePicker', component: 'Switch',
value: 'TRUE',
componentProps: { componentProps: {
type: 'datetime', inactiveValue: 'FALSE',
valueFormat: 'x' activeValue: 'TRUE'
} }
}, }
},
{
label: '是否可用',
field: 'available',
sort: 'custom',
isSearch: true,
}, },
{ {
label: '申请时间', label: '申请时间',
field: 'requestTime', field: 'requestTime',
sort: 'custom', sort: 'custom',
formatter: dateFormatter, 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: { form: {
component: 'DatePicker', component: 'DatePicker',
componentProps: { componentProps: {
@ -93,109 +81,233 @@ export const RelegateRecordMain = useCrudSchemas(reactive<CrudSchema[]>([
valueFormat: 'x' valueFormat: 'x'
} }
}, },
table: {
width: 200
},
}, },
{ {
label: '截止时间', label: '部门',
field: 'dueTime', field: 'departmentCode',
sort: 'custom', sort: 'custom',
formatter: dateFormatter, isTable: false,
isSearch: true, isDetail: false,
search: { isSearch: false,
component: 'DatePicker', isTableForm: false,
form: {
component: 'TreeSelect',
componentProps: { // 假设deptList是部门数据列表
data: deptList,
placeholder: "请选择部门",
filterable: true,
// multiple: true,
}
}
},
{
label: '业务类型',
field: 'businessType',
sort: 'custom',
table: {
width: 150
},
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))
// 表单校验
export const RelegateRecordDetailRules = reactive({
itemCode: [required],
downItemCode: [required],
businessType: [required],
fromBatch: [required],
fromPackingNumber: [required],
fromLocationCode: [required],
available: [required],
departmentCode: [required],
concurrencyStamp: [required],
})
export const RelegateRecordDetail = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '物料代码',
field: 'itemCode',
sort: 'custom',
table: {
width: 180
},
},
{
label: '降级后物料代码',
field: 'downItemCode',
sort: 'custom',
table: {
width: 180
},
},
{
label: '计量单位',
field: 'uom',
dictType: DICT_TYPE.UOM,
dictClass: 'string',
sort: 'custom',
table: {
width: 150
},
tableForm: {
type: 'Select',
disabled: true
},
form: {
componentProps: { componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss', disabled: true
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
} }
}
},
{
label: '数量',
field: 'qty',
sort: 'custom',
table: {
width: 150
}, },
form: { form: {
component: 'DatePicker', component: 'InputNumber',
componentProps: { componentProps: {
type: 'datetime', min: 0,
valueFormat: 'x' precision: 6
} }
}, },
tableForm: {
type: 'InputNumber',
min: 0,
precision: 6
}
}, },
{ {
label: '部门', label: '库存状态',
field: 'departmentCode', field: 'inventoryStatus',
sort: 'custom', sort: 'custom',
isSearch: true, dictType: DICT_TYPE.INVENTORY_STATUS,
dictClass: 'string',
isTable: true,
table: {
width: 150
},
tableForm: {
type: 'Select'
},
hiddenInMain: true,
isTableForm: false,
isForm: false,
}, },
{ {
label: '用户组', label: '从批次',
field: 'userGroupCode', field: 'fromBatch',
sort: 'custom', sort: 'custom',
isSearch: true, table: {
width: 150
},
}, },
{ {
label: '接口类型', label: '从包装号',
field: 'interfaceType', field: 'fromPackingNumber',
sort: 'custom', sort: 'custom',
isSearch: true, table: {
form: { width: 180
component: 'SelectV2' },
},
}, },
{ {
label: '代码', label: '从库位代码',
field: 'code', field: 'fromLocationCode',
sort: 'custom', sort: 'custom',
isSearch: true, table: {
width: 180
},
}, },
{ {
label: '单据号', label: '从库区类型',
field: 'number', field: 'fromAreaTypes',
dictType: DICT_TYPE.AREA_TYPE,
dictClass: 'string',
isTable:false,
sort: 'custom', sort: 'custom',
isSearch: true, table: {
width: 150
},
isForm: false,
}, },
{ {
label: '业务类型', label: '从库区代码',
field: 'businessType', field: 'fromAreaCodes',
sort: 'custom', sort: 'custom',
isSearch: true, table: {
form: { width: 150
component: 'SelectV2' },
},
}, },
{ {
label: '备注', label: '到包装号',
field: 'remark', field: 'toPackingNumber',
sort: 'custom', sort: 'custom',
isSearch: true, table: {
width: 180
},
},
{
label: '到批次',
field: 'toBatch',
sort: 'custom',
table: {
width: 150
},
}, },
{ {
label: '创建时间', label: '到库位代码',
field: 'createTime', field: 'toLocationCode',
sort: 'custom', sort: 'custom',
formatter: dateFormatter, table: {
isSearch: true, width: 180
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: '扩展属性', label: '到仓库代码',
field: 'extraProperties', field: 'toWarehouseCode',
sort: 'custom', sort: 'custom',
isSearch: true, table: {
width: 180
},
}, },
{ {
label: '地点ID', label: '到库区类型',
field: 'siteId', field: 'toAreaTypes',
dictType: DICT_TYPE.AREA_TYPE,
dictClass: 'string',
isTable:false,
sort: 'custom', sort: 'custom',
isSearch: true, table: {
width: 150
},
isForm: false,
},
{
label: '到库区代码',
field: 'toAreaCodes',
sort: 'custom',
table: {
width: 150
},
}, },
{ {
label: '操作', label: '操作',
field: 'action', field: 'action',
isForm: false, isForm: false,
hiddenInMain:true,
table: { table: {
width: 150, width: 150,
fixed: 'right' fixed: 'right'

76
src/views/wms/basicDataManage/itemManage/relegate/relegateRequest/index.vue

@ -87,8 +87,6 @@ const businessType = 'relegate'
routeName.value = route.name routeName.value = route.name
const tableColumns = ref([...RelegateRequestMain.allSchemas.tableColumns, ...RelegateRequestDetail.allSchemas.tableMainColumns]) const tableColumns = ref([...RelegateRequestMain.allSchemas.tableColumns, ...RelegateRequestDetail.allSchemas.tableMainColumns])
const isShowButton = ref(true) const isShowButton = ref(true)
// //
const trueFalse = ref(false)
// //
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => { const searchTableSuccess = (formField, searchField, val, formRef, type, row) => {
@ -103,7 +101,7 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row) =>
row['toBatch'] = val[0]['batch'] row['toBatch'] = val[0]['batch']
row['toPackingNumber'] = val[0]['packingNumber'] row['toPackingNumber'] = val[0]['packingNumber']
row['fromLocationCode'] = val[0]['locationCode'] row['fromLocationCode'] = val[0]['locationCode']
row['fromInventoryStatus'] = val[0]['inventoryStatus'] row['inventoryStatus'] = val[0]['inventoryStatus']
} else if (formField == 'downItemCode') { } else if (formField == 'downItemCode') {
row['downItemCode'] = val[0]['code'] row['downItemCode'] = val[0]['code']
} else if (formField == 'toLocationCode') { } else if (formField == 'toLocationCode') {
@ -239,20 +237,86 @@ const butttondata = (row, $index) => {
return [] return []
} }
return [ return [
defaultButtons.mainListCloseBtn({hide:isShowMainButton(row,['2','3','4','6']),hasPermi:'wms:relegate-request-main:close'}), // defaultButtons.mainListCloseBtn({hide:isShowMainButton(row,['2','3','4']),hasPermi:'wms:relegate-request-main:close'}), //
defaultButtons.mainListReAddBtn({hide:isShowMainButton(row,['4','5']),hasPermi:'wms:relegate-request-main:reAdd'}), // 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.mainListSubmitBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:relegate-request-main:submit'}), //
defaultButtons.mainListTurnDownBtn({hide:isShowMainButton(row,['2']),hasPermi:'wms:relegate-request-main:refused'}), // 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.mainListApproveBtn({hide:isShowMainButton(row,['2']),hasPermi:'wms:relegate-request-main:agree'}), //
defaultButtons.mainListHandleBtn({hide:isShowMainButton(row,['3']),hasPermi:'wms:relegate-request-main:handle'}), // 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.mainListEditBtn({ hide: isShowMainButton(row, ['1']), hasPermi: 'wms:relegate-request-main:update' }), //
defaultButtons.mainListDeleteBtn({ hasPermi: 'wms:relegate-request-main:delete' }), // // defaultButtons.mainListDeleteBtn({ hasPermi: 'wms:relegate-request-main:delete' }), //
] ]
} }
// - // -
const buttonTableClick = async (val, row) => { const buttonTableClick = async (val, row) => {
if (val == 'edit') { // if (val == 'mainClose') { //
await message.confirm('确认要关闭吗?')
tableObject.loading = true
RelegateRequestMainApi.close(row.masterId).then(() => {
message.success(t('common.updateSuccess'))
tableObject.loading = false
getList()
}).catch(err => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'mainReAdd') { //
await message.confirm('确认要重新添加吗?')
tableObject.loading = true
RelegateRequestMainApi.reAdd(row.masterId).then(() => {
message.success(t('common.updateSuccess'))
tableObject.loading = false
getList()
}).catch(err => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'mainSubmit') { //
await message.confirm('确认要提交审批吗?')
tableObject.loading = true
RelegateRequestMainApi.submit(row.masterId).then(() => {
message.success(t('common.updateSuccess'))
tableObject.loading = false
getList()
}).catch(err => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'mainTurnDown') { //
await message.confirm('确认要驳回吗?')
tableObject.loading = true
RelegateRequestMainApi.refused(row.masterId).then(() => {
message.success(t('common.updateSuccess'))
tableObject.loading = false
getList()
}).catch(err => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'mainApprove') { //
await message.confirm('确认要审批通过吗?')
tableObject.loading = true
RelegateRequestMainApi.agree(row.masterId).then(() => {
message.success(t('common.updateSuccess'))
tableObject.loading = false
getList()
}).catch(err => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'mainHandle') { //
await message.confirm('确认要处理吗?')
tableObject.loading = true
RelegateRequestMainApi.handle(row.masterId).then(() => {
message.success(t('common.updateSuccess'))
tableObject.loading = false
getList()
}).catch(err => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'edit') { //
openForm('update', row) openForm('update', row)
} else if (val == 'delete') { // } else if (val == 'delete') { //
handleDelete(row.id) handleDelete(row.id)

4
src/views/wms/basicDataManage/itemManage/relegate/relegateRequest/relegateRequestMain.data.ts

@ -283,7 +283,7 @@ export const RelegateRequestMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'action', field: 'action',
isForm: false, isForm: false,
table: { table: {
width: 150, width: 200,
fixed: 'right' fixed: 'right'
} }
} }
@ -666,7 +666,7 @@ export const RelegateRequestDetail = useCrudSchemas(reactive<CrudSchema[]>([
isForm: false, isForm: false,
hiddenInMain:true, hiddenInMain:true,
table: { table: {
width: 150, width: 200,
fixed: 'right' fixed: 'right'
}, },
isTableForm: false isTableForm: false

Loading…
Cancel
Save