Browse Source

发票修改

master_hella_20240701
zhaoxuebing 7 months ago
parent
commit
a320a27d98
  1. 4
      .env.development
  2. 2
      src/utils/dict.ts
  3. 241
      src/views/wms/inventoryjobManage/sparepartsrequisition/sparepartsrequisitionJobMain/index.vue
  4. 769
      src/views/wms/inventoryjobManage/sparepartsrequisition/sparepartsrequisitionJobMain/sparepartsrequisitionJobMain.data.ts
  5. 174
      src/views/wms/inventoryjobManage/sparepartsrequisition/sparepartsrequisitionRecordMain/index.vue
  6. 592
      src/views/wms/inventoryjobManage/sparepartsrequisition/sparepartsrequisitionRecordMain/sparepartsrequisitionRecordMain.data.ts
  7. 460
      src/views/wms/inventoryjobManage/sparepartsrequisition/sparepartsrequisitionRequestMain/index.vue
  8. 669
      src/views/wms/inventoryjobManage/sparepartsrequisition/sparepartsrequisitionRequestMain/sparepartsrequisitionRequestMain.data.ts

4
.env.development

@ -4,10 +4,10 @@ NODE_ENV=development
VITE_DEV=false VITE_DEV=false
# 请求路径 # 请求路径
VITE_BASE_URL='http://localhost:12080' VITE_BASE_URL='http://192.168.0.108:12080'
# 上传路径 # 上传路径
VITE_UPLOAD_URL='http://localhost:12080/admin-api/infra/file/upload' VITE_UPLOAD_URL='http://192.168.0.108:12080/admin-api/infra/file/upload'
# 接口前缀 # 接口前缀
VITE_API_BASEPATH=/dev-api VITE_API_BASEPATH=/dev-api

2
src/utils/dict.ts

@ -306,6 +306,6 @@ export enum DICT_TYPE {
REWORK_TYPE='rework_type',//工作类型:返工登记、返修登记 REWORK_TYPE='rework_type',//工作类型:返工登记、返修登记
REWORK_STATUS='rework_status',//返工返修状态:待返修,返修中,返修完成 REWORK_STATUS='rework_status',//返工返修状态:待返修,返修中,返修完成
REWORK_REPLACE_FLAG = 'rework_replace_flag',//是否有替换件 REWORK_REPLACE_FLAG = 'rework_replace_flag',//是否有替换件
SUPPLIERINVOICE_REQUEST_STATUS = 'supplierinvoice_request_status', //发票申请状态
} }

241
src/views/wms/inventoryjobManage/sparepartsrequisition/sparepartsrequisitionJobMain/index.vue

@ -0,0 +1,241 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="UnplannedissueJobMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="UnplannedissueJobMain.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
<Table
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total
}"
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #number="{row}">
<el-button type="primary" link @click="openDetail(row, '单据号', row.number)">
<span>{{ row.number }}</span>
</el-button>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" />
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="formRef"
@success="getList"
:rules="UnplannedissueJobMainRules"
:formAllSchemas="UnplannedissueJobMain.allSchemas"
:searchTableParams="searchTableParams"
:tableAllSchemas="UnplannedissueJobDetail.allSchemas"
:tableFormRules="UnplannedissueJobDetailRules"
:apiUpdate="UnplannedissueJobMainApi.updateUnplannedissueJobMain"
:apiCreate="UnplannedissueJobMainApi.createUnplannedissueJobMain"
:isBusiness="true"
@searchTableSuccess="searchTableSuccess"
/>
<!-- 详情 -->
<Detail
ref="detailRef"
:isBasic="false"
:allSchemas="UnplannedissueJobMain.allSchemas"
:detailAllSchemas="UnplannedissueJobDetail.allSchemas"
:detailAllSchemasRules="UnplannedissueJobDetailRules"
:searchTableParams="searchTableParams"
:apiPage="UnplannedissueJobDetailApi.getUnplannedissueJobDetailPage"
/>
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { UnplannedissueJobMain,UnplannedissueJobMainRules,UnplannedissueJobDetail,UnplannedissueJobDetailRules } from './sparepartsrequisitionJobMain.data'
import * as UnplannedissueJobMainApi from '@/api/wms/unplannedissueJobMain'
import * as UnplannedissueJobDetailApi from '@/api/wms/unplannedissueJobDetail'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
//
defineOptions({ name: 'UnplannedissueJobMain' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(UnplannedissueJobMain.allSchemas.tableColumns)
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
//
const searchTableParams = ref([
//{
// formField: 'productItemCode',
// searchTableTitle: '',
// searchTableAllSchemas: Itembasic.allSchemas,
// searchTablePage: ItembasicApi.getItembasicPage
//}
])
//
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => {
nextTick(() => {
if (type == 'tableForm') {
//
//row[formField] = val[0][searchField]
//row['poLine'] = val[0]['poLine']
//row['batch'] = val[0]['toBatch']
//row['altBatch'] = val[0]['altBatch']
//row['itemCode'] = val[0]['itemCode']
//row['itemName'] = val[0]['itemName']
//row['itemDesc1'] = val[0]['itemDesc1']
//row['itemDesc2'] = val[0]['itemDesc2']
//row['projectCode'] = val[0]['projectCode']
//row['qty'] = val[0]['qty']
//row['uom'] = val[0]['uom']
} else {
const setV = {}
setV[formField] = val[0][searchField]
//setV['ppNumber'] = val[0]['ppNumber']
//setV['supplierCode'] = val[0]['supplierCode']
formRef.setValues(setV)
}
})
}
//
// const Echo = ['ppNumber','poLine', 'batch', 'altBatch', 'itemCode', 'itemName', 'itemDesc1', 'itemDesc2', 'projectCode', 'qty', 'uom']
const Echo = []
const { tableObject, tableMethods } = useTable({
getListApi: UnplannedissueJobMainApi.getUnplannedissueJobMainPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultExportBtn({hasPermi:'wms:unplannedissue-job-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 == 'export') { //
handleExport()
} else if (val == 'refresh') { //
if (tableObject.params.filters && tableObject.params.filters.length > 0 ) {
searchFormClick({
filters: tableObject.params.filters
})
} else {
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) => {
return [
// defaultButtons.mainListJobAccBtn({hide:isShowMainButton(row,['1'])}), //
// defaultButtons.mainListJobCloBtn({hide:isShowMainButton(row,['1'])}), //
// defaultButtons.mainListJobAbaBtn({hide:isShowMainButton(row,['2'])}), //
// defaultButtons.mainListJobExeBtn({hide:isShowMainButton(row,['2'])}), //
]
}
// -
const buttonTableClick = async (val, row) => {
if (val == 'mainJobExe') { //
console.log('列表-操作按钮事件-执行')
} else if (val == 'mainJobAba') { //
console.log('列表-操作按钮事件-放弃')
} else if (val == 'mainJobClo') { //
console.log('列表-操作按钮事件-关闭')
} else if (val == 'mainJobAcc') { //
console.log('列表-操作按钮事件-承接')
}
}
//
const { wsCache } = useCache()
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
const departmentCode = wsCache.get(CACHE_KEY.DEPT).find((account) => account.id == row.departmentCode)?.name
if (departmentCode) row.departmentCode = JSON.parse(JSON.stringify(departmentCode))
detailRef.value.openDetail(row, titleName, titleValue,'jobUnplannedissueMain')
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await UnplannedissueJobMainApi.exportUnplannedissueJobMain(tableObject.params)
download.excel(data, '计划外出库任务主.xlsx')
} catch {
} finally {
exportLoading.value = false
}
}
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
/** 初始化 **/
onMounted(async () => {
getList()
})
</script>

769
src/views/wms/inventoryjobManage/sparepartsrequisition/sparepartsrequisitionJobMain/sparepartsrequisitionJobMain.data.ts

@ -0,0 +1,769 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import { TableColumn } from '@/types/table'
/**
* @returns {Array}
*/
export const UnplannedissueJobMain = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '单据号',
field: 'number',
sort: 'custom',
table: {
width: 150,
fixed: 'left'
},
isSearch: true,
},
{
label: '状态',
field: 'status',
dictType: DICT_TYPE.JOB_STATUS,
dictClass: 'string',
isSearch: true,
isTable: true,
sort: 'custom',
table: {
width: 150
},
},
{
label: '申请单号',
field: 'requestNumber',
sort: 'custom',
table: {
width: 150
},
isSearch: true,
},
{
label: '申请时间',
field: 'requestTime',
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
},
{
label: '要求截止时间',
field: 'requestDueTime',
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
},
{
label: '过期时间',
field: 'expiredTime',
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
},
{
label: '从仓库代码',
field: 'fromWarehouseCode',
sort: 'custom',
table: {
width: 150
},
},
{
label: '从库区代码范围',
field: 'fromAreaCodes',
sort: 'custom',
table: {
width: 150
},
},
// {
// label: '状态',
// field: 'jobStageStatus',
// sort: 'custom',
// table: {
// width: 150
// },
// },
{
label: '从库区类型范围',
field: 'fromAreaTypes',
dictType: DICT_TYPE.AREA_TYPE,
dictClass: 'string',
isSearch: true,
isTable: true,
sort: 'custom',
table: {
width: 150
},
},
{
label: '到库区类型范围',
field: 'toAreaTypes',
dictType: DICT_TYPE.AREA_TYPE,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
},
},
{
label: '优先级',
field: 'priority',
sort: 'custom',
table: {
width: 150
},
form: {
component: 'InputNumber',
}
},
{
label: '优先级增量',
field: 'priorityIncrement',
sort: 'custom',
table: {
width: 150
},
form: {
component: 'InputNumber',
}
},
{
label: '业务类型',
field: 'businessType',
sort: 'custom',
table: {
width: 150
},
},
{
label: '部门',
field: 'departmentCode',
sort: 'custom',
table: {
width: 150
},
},
{
label: '备注',
field: 'remark',
sort: 'custom',
table: {
width: 150
},
},
{
label: '自动完成',
field: 'autoComplete',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
}
},
{
label: '允许修改库位',
field: 'allowModifyLocation',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
}
},
{
label: '允许修改数量',
field: 'allowModifyQty',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
}
},
{
label: '允许大于推荐数量',
field: 'allowBiggerQty',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
}
},
{
label: '允许小于推荐数量',
field: 'allowSmallerQty',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
}
},
{
label: '允许修改库存状态',
field: 'allowModifyInventoryStatus',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
}
},
{
label: '允许连续扫描',
field: 'allowContinuousScanning',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
}
},
{
label: '允许部分完成',
field: 'allowPartialComplete',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
}
},
{
label: '允许修改批次',
field: 'allowModifyBatch',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
}
},
{
label: '允许修改箱码',
field: 'allowModifyPackingNumber',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
}
},
{
label: '承接时间',
field: 'acceptTime',
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
},
{
label: '承接人',
field: 'acceptUserId',
sort: 'custom',
table: {
width: 150
},
},
{
label: '完成时间',
field: 'completeTime',
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
},
{
label: '完成人',
field: 'completeUserId',
sort: 'custom',
table: {
width: 150
},
},
{
label: '创建时间',
field: 'createTime',
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
},
{
label: '创建者',
field: 'creator',
sort: 'custom',
table: {
width: 150
},
},
{
label: '最后更新时间',
field: 'updateTime',
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
},
{
label: '最后更新者',
field: 'updater',
sort: 'custom',
table: {
width: 150
},
},
{
label: '操作',
field: 'action',
isDetail: false,
isForm: false,
table: {
width: 120,
fixed: 'right'
},
}
]))
//表单校验
export const UnplannedissueJobMainRules = reactive({
requestNumber: [
{ required: true, message: '请选择申请单号', trigger: 'change' }
],
fromWarehouseCode: [
{ required: true, message: '请选择仓库代码', trigger: 'change' }
],
fromAreaTypes: [
{ required: true, message: '请选择从库区类型范围', trigger: 'change' }
],
fromAreaCodes: [
{ required: true, message: '请选择从库区代码范围', trigger: 'change' }
],
requestTime: [
{ required: true, message: '请输入申请时间', trigger: 'change' }
],
requestDueTime: [
{ required: true, message: '请输入要求截止时间', trigger: 'change' }
],
status: [
{ required: true, message: '请选择状态', trigger: 'change' }
],
// jobStageStatus: [
// { required: true, message: '请选择阶段状态', trigger: 'change' }
// ],
priority: [
{ required: true, message: '请输入优先级', trigger: 'blur' }
],
priorityIncrement: [
{ required: true, message: '请输入优先级增量', trigger: 'blur' }
],
departmentCode: [
{ required: true, message: '请输入部门', trigger: 'blur' }
],
userPositionCode: [
{ required: true, message: '请输入岗位', trigger: 'blur' }
],
number: [
{ required: true, message: '请输入单据号', trigger: 'blur' }
],
businessType: [
{ required: true, message: '请输入业务类型', trigger: 'blur' }
],
createTime: [
{ required: true, message: '请输入创建时间', trigger: 'blur' }
],
creator: [
{ required: true, message: '请输入创建者', trigger: 'blur' }
],
})
/**
* @returns {Array}
*/
export const UnplannedissueJobDetail = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '单据号',
field: 'number',
sort: 'custom',
table: {
width: 180
},
},
{
label: '物料代码',
field: 'itemCode',
sort: 'custom',
table: {
width: 150
},
},
{
label: '物料名称',
field: 'itemName',
sort: 'custom',
table: {
width: 150
},
},
{
label: '物料描述1',
field: 'itemDesc1',
sort: 'custom',
table: {
width: 150
},
},
{
label: '物料描述2',
field: 'itemDesc2',
sort: 'custom',
table: {
width: 150
},
},
{
label: '批次',
field: 'batch',
sort: 'custom',
table: {
width: 150
},
},
{
label: '包装号',
field: 'packingNumber',
sort: 'custom',
table: {
width: 150
},
},
{
label: '器具号',
field: 'containerNumber',
sort: 'custom',
table: {
width: 150
},
},
{
label: '数量',
field: 'qty',
sort: 'custom',
table: {
width: 150
},
form: {
component: 'InputNumber',
}
},
{
label: '计量单位',
field: 'uom',
dictType: DICT_TYPE.UOM,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
},
},
{
label: '从库位代码',
field: 'fromLocationCode',
sort: 'custom',
table: {
width: 150
},
},
{
label: '库存状态',
field: 'inventoryStatus',
dictType: DICT_TYPE.INVENTORY_STATUS,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
},
},
{
label: '原因',
field: 'reason',
dictType: DICT_TYPE.UNPLANNED_ISSUE_REASON,
dictClass: 'string',
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return cellValue
},
table: {
width: 150
},
form: {
componentProps: {
filterable: true
}
},
tableForm: {
type: 'Select',
filterable: true
}
},
{
label: '货主代码',
field: 'ownerCode',
sort: 'custom',
table: {
width: 150
},
},
{
label: '项目代码',
field: 'projectCode',
sort: 'custom',
table: {
width: 150
},
},
{
label: '备注',
field: 'remark',
sort: 'custom',
table: {
width: 150
},
},
{
label: '创建时间',
field: 'createTime',
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
},
{
label: '创建者',
field: 'creator',
sort: 'custom',
table: {
width: 150
},
},
]))
//表单校验
export const UnplannedissueJobDetailRules = reactive({
packingNumber: [
{ required: true, message: '请选择包装号', trigger: 'change' }
],
batch: [
{ required: true, message: '请输入批次', trigger: 'blur' }
],
inventoryStatus: [
{ required: true, message: '请选择库存状态', trigger: 'change' }
],
fromLocationCode: [
{ required: true, message: '请选择从库位代码', trigger: 'change' }
],
number: [
{ required: true, message: '请输入单据号', trigger: 'blur' }
],
itemCode: [
{ required: true, message: '请选择物料代码', trigger: 'change' }
],
createTime: [
{ required: true, message: '请输入创建时间', trigger: 'blur' }
],
creator: [
{ required: true, message: '请输入创建者', trigger: 'blur' }
],
})

174
src/views/wms/inventoryjobManage/sparepartsrequisition/sparepartsrequisitionRecordMain/index.vue

@ -0,0 +1,174 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="UnplannedissueRecordMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="UnplannedissueRecordMain.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
<Table
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total
}"
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #number="{row}">
<el-button type="primary" link @click="openDetail(row, '单据号', row.number)">
<span>{{ row.number }}</span>
</el-button>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" />
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="formRef"
@success="getList"
:rules="UnplannedissueRecordMainRules"
:formAllSchemas="UnplannedissueRecordMain.allSchemas"
:tableAllSchemas="UnplannedissueRecordDetail.allSchemas"
:tableFormRules="UnplannedissueRecordDetailRules"
:isBusiness="true"
/>
<!-- 详情 -->
<Detail
ref="detailRef"
:isBasic="false"
:allSchemas="UnplannedissueRecordMain.allSchemas"
:detailAllSchemas="UnplannedissueRecordDetail.allSchemas"
:detailAllSchemasRules="UnplannedissueRecordDetailRules"
:apiPage="UnplannedissueRecordDetailApi.getUnplannedissueRecordDetailPage"
/>
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { UnplannedissueRecordMain,UnplannedissueRecordMainRules,UnplannedissueRecordDetail,UnplannedissueRecordDetailRules } from './sparepartsrequisitionRecordMain.data'
import * as UnplannedissueRecordMainApi from '@/api/wms/unplannedissueRecordMain'
import * as UnplannedissueRecordDetailApi from '@/api/wms/unplannedissueRecordDetail'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
//
defineOptions({ name: 'UnplannedissueRecordMain' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(UnplannedissueRecordMain.allSchemas.tableColumns)
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
const { tableObject, tableMethods } = useTable({
getListApi: UnplannedissueRecordMainApi.getUnplannedissueRecordMainPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultExportBtn({hasPermi:'wms:unplannedissue-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 == 'export') { //
handleExport()
} else if (val == 'refresh') { //
if (tableObject.params.filters && tableObject.params.filters.length > 0 ) {
searchFormClick({
filters: tableObject.params.filters
})
} else {
getList()
}
} else if (val == 'filtrate') { //
} else { //
console.log('其他按钮', item)
}
}
// -
const butttondata = (row) => {
return []
}
// -
const buttonTableClick = async (val, row) => {
}
//
const { wsCache } = useCache()
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
const departmentCode = wsCache.get(CACHE_KEY.DEPT).find((account) => account.id == row.departmentCode)?.name
if (departmentCode) row.departmentCode = JSON.parse(JSON.stringify(departmentCode))
detailRef.value.openDetail(row, titleName, titleValue,'recordUnplannedissueMain')
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await UnplannedissueRecordMainApi.exportUnplannedissueRecordMain(tableObject.params)
download.excel(data, '计划外出库记录主.xlsx')
} catch {
} finally {
exportLoading.value = false
}
}
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
/** 初始化 **/
onMounted(async () => {
getList()
})
</script>

592
src/views/wms/inventoryjobManage/sparepartsrequisition/sparepartsrequisitionRecordMain/sparepartsrequisitionRecordMain.data.ts

@ -0,0 +1,592 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter,dateFormatter2 } from '@/utils/formatTime'
import { TableColumn } from '@/types/table'
/**
* @returns {Array}
*/
export const UnplannedissueRecordMain = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '单据号',
field: 'number',
sort: 'custom',
table: {
width: 180,
fixed: 'left'
},
isSearch: true
},
{
label: '申请单号',
field: 'requestNumber',
sort: 'custom',
table: {
width: 180
},
isSearch: true
},
{
label: '任务单号',
field: 'jobNumber',
sort: 'custom',
table: {
width: 180
},
isSearch: true
},
{
label: '申请时间',
field: 'requestTime',
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
},
{
label: '截止时间',
field: 'dueTime',
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
},
{
label: '执行时间',
field: 'executeTime',
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
},
{
label: '生效日期',
field: 'activeDate',
formatter: dateFormatter2,
detail: {
dateFormat: 'YYYY-MM-DD'
},
sort: 'custom',
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
style: {width: '100%'},
type: 'date',
dateFormat: 'YYYY-MM-DD',
valueFormat: 'x',
}
},
},
{
label: '从仓库代码',
field: 'fromWarehouseCode',
sort: 'custom',
table: {
width: 150
},
},
{
label: '从库区类型范围',
field: 'fromAreaTypes',
dictType: DICT_TYPE.AREA_TYPE,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
},
},
{
label: '从库区代码范围',
field: 'fromAreaCodes',
sort: 'custom',
table: {
width: 150
},
},
{
label: '从月台代码',
field: 'fromDockCode',
sort: 'custom',
table: {
width: 150
},
},
{
label: '出库事务类型',
field: 'outTransactionType',
sort: 'custom',
table: {
width: 150
},
},
{
label: '入库事务类型',
field: 'inTransactionType',
sort: 'custom',
table: {
width: 150
},
},
{
label: '业务类型',
field: 'businessType',
sort: 'custom',
table: {
width: 150
},
},
{
label: '部门',
field: 'departmentCode',
sort: 'custom',
table: {
width: 150
},
},
{
label: '接口类型',
field: 'interfaceType',
dictType: DICT_TYPE.INTERFACE_TYPE,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
},
},
{
label: '备注',
field: 'remark',
sort: 'custom',
table: {
width: 150
},
},
{
label: '创建时间',
field: 'createTime',
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
},
{
label: '创建者',
field: 'creator',
sort: 'custom',
table: {
width: 150
},
},
// {
// label: '代码',
// field: 'code',
// sort: 'custom',
// table: {
// width: 150
// },
// },
{
label: '是否可用',
field: 'available',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: true,
isTable: true,
sort: 'custom',
table: {
width: 150
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
}
},
]))
//表单校验
export const UnplannedissueRecordMainRules = reactive({
requestNumber: [
{ required: true, message: '请选择申请单号', trigger: 'change' }
],
fromWarehouseCode: [
{ required: true, message: '请选择从仓库代码', trigger: 'change' }
],
fromAreaTypes: [
{ required: true, message: '请选择从库区类型范围', trigger: 'change' }
],
fromAreaCodes: [
{ required: true, message: '请选择从库区代码范围', trigger: 'change' }
],
outTransaction: [
{ required: true, message: '请输入出库事务类型', trigger: 'blur' }
],
inTransaction: [
{ required: true, message: '请输入入库事务类型', trigger: 'blur' }
],
executeTime: [
{ required: true, message: '请输入执行时间', trigger: 'change' }
],
activeDate: [
{ required: true, message: '请输入生效日期', trigger: 'change' }
],
available: [
{ required: true, message: '请输入是否可用', trigger: 'blur' }
],
departmentCode: [
{ required: true, message: '请输入部门', trigger: 'blur' }
],
interfaceType: [
{ required: true, message: '请选择接口类型', trigger: 'change' }
],
number: [
{ required: true, message: '请输入单据号', trigger: 'blur' }
],
businessType: [
{ required: true, message: '请输入业务类型', trigger: 'blur' }
],
createTime: [
{ required: true, message: '请输入创建时间', trigger: 'blur' }
],
creator: [
{ required: true, message: '请输入创建者', trigger: 'blur' }
],
})
/**
* @returns {Array}
*/
export const UnplannedissueRecordDetail = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '单据号',
field: 'number',
sort: 'custom',
table: {
width: 180
},
},
{
label: '物料代码',
field: 'itemCode',
sort: 'custom',
table: {
width: 150
},
},
{
label: '物料名称',
field: 'itemName',
sort: 'custom',
table: {
width: 150
},
},
{
label: '物料描述1',
field: 'itemDesc1',
sort: 'custom',
table: {
width: 150
},
},
{
label: '物料描述2',
field: 'itemDesc2',
sort: 'custom',
table: {
width: 150
},
},
{
label: '批次',
field: 'batch',
sort: 'custom',
table: {
width: 150
},
},
{
label: '包装号',
field: 'packingNumber',
sort: 'custom',
table: {
width: 150
},
},
{
label: '器具号',
field: 'containerNumber',
sort: 'custom',
table: {
width: 150
},
},
{
label: '数量',
field: 'qty',
sort: 'custom',
table: {
width: 150
},
form: {
component: 'InputNumber',
}
},
{
label: '计量单位',
field: 'uom',
dictType: DICT_TYPE.UOM,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
},
},
{
label: '单价',
field: 'singlePrice',
sort: 'custom',
table: {
width: 150
},
form: {
component: 'InputNumber',
}
},
{
label: '金额',
field: 'amount',
sort: 'custom',
table: {
width: 150
},
form: {
component: 'InputNumber',
}
},
{
label: '库存状态',
field: 'inventoryStatus',
dictType: DICT_TYPE.INVENTORY_STATUS,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
},
},
{
label: '从库位代码',
field: 'fromLocationCode',
sort: 'custom',
table: {
width: 150
},
},
{
label: '原因',
field: 'reason',
dictType: DICT_TYPE.UNPLANNED_ISSUE_REASON,
dictClass: 'string',
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return cellValue
},
table: {
width: 150
},
form: {
componentProps: {
filterable: true
}
},
tableForm: {
type: 'Select',
filterable: true
}
},
{
label: '货主代码',
field: 'ownerCode',
sort: 'custom',
table: {
width: 150
},
},
{
label: '从库位组代码',
field: 'fromLocationGroupCode',
sort: 'custom',
table: {
width: 150
},
},
{
label: '从库区代码',
field: 'fromAreaCode',
sort: 'custom',
table: {
width: 150
},
},
{
label: '项目代码',
field: 'projectCode',
sort: 'custom',
table: {
width: 150
},
},
{
label: '接口类型',
field: 'interfaceType',
dictType: DICT_TYPE.INTERFACE_TYPE,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
},
},
{
label: '备注',
field: 'remark',
sort: 'custom',
table: {
width: 150
},
},
// {
// label: '任务明细ID',
// field: 'jobDetailId',
// sort: 'custom',
// table: {
// width: 150
// },
// },
{
label: '创建时间',
field: 'createTime',
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
},
{
label: '创建者',
field: 'creator',
sort: 'custom',
table: {
width: 150
},
},
// {
// label: '代码',
// field: 'code',
// sort: 'custom',
// table: {
// width: 150
// },
// },
]))
//表单校验
export const UnplannedissueRecordDetailRules = reactive({
packingNumber: [
{ required: true, message: '请选择包装号', trigger: 'change' }
],
batch: [
{ required: true, message: '请输入批次', trigger: 'blur' }
],
inventoryStatus: [
{ required: true, message: '请选择库存状态', trigger: 'change' }
],
fromLocationCode: [
{ required: true, message: '请选择从库位代码', trigger: 'change' }
],
fromLocationGroupCode: [
{ required: true, message: '请选择从库位组代码', trigger: 'change' }
],
fromAreaCode: [
{ required: true, message: '请选择从库区代码', trigger: 'change' }
],
number: [
{ required: true, message: '请输入单据号', trigger: 'blur' }
],
itemCode: [
{ required: true, message: '请选择物料代码', trigger: 'change' }
],
createTime: [
{ required: true, message: '请输入创建时间', trigger: 'blur' }
],
creator: [
{ required: true, message: '请输入创建者', trigger: 'blur' }
],
})

460
src/views/wms/inventoryjobManage/sparepartsrequisition/sparepartsrequisitionRequestMain/index.vue

@ -0,0 +1,460 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="UnplannedissueRequestMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="UnplannedissueRequestMain.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
<Table
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total
}"
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #number="{row}">
<el-button type="primary" link @click="openDetail(row, '单据号', row.number)">
<span>{{ row.number }}</span>
</el-button>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" />
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="formRef"
@success="getList"
:rules="UnplannedissueRequestMainRules"
:formAllSchemas="UnplannedissueRequestMain.allSchemas"
:tableAllSchemas="UnplannedissueRequestDetail.allSchemas"
:tableFormRules="UnplannedissueRequestDetailRules"
:tableData="tableData"
:apiUpdate="UnplannedissueRequestMainApi.updateUnplannedissueRequestMain"
:apiCreate="UnplannedissueRequestMainApi.createUnplannedissueRequestMain"
:isBusiness="true"
@handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable"
@searchTableSuccess="searchTableSuccess"
@submitForm="submitForm"
@tableFormSelectOnBlur="tableFormSelectOnBlur"
/>
<!-- 详情 -->
<Detail
ref="detailRef"
:isBasic="false"
:allSchemas="UnplannedissueRequestMain.allSchemas"
:detailAllSchemas="UnplannedissueRequestDetail.allSchemas"
:detailAllSchemasRules="UnplannedissueRequestDetailRules"
:apiCreate="UnplannedissueRequestDetailApi.createUnplannedissueRequestDetail"
:apiUpdate="UnplannedissueRequestDetailApi.updateUnplannedissueRequestDetail"
:apiPage="UnplannedissueRequestDetailApi.getUnplannedissueRequestDetailPage"
:apiDelete="UnplannedissueRequestDetailApi.deleteUnplannedissueRequestDetail"
:Echo="Echo"
@searchTableSuccessDetail="searchTableSuccessDetail"
:detailValidate="detailValidate"
@onBlur="onBlur"
/>
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/wms/unplannedissue-request-main/import" :importTemplateData="importTemplateData"
@success="importSuccess" :updateIsDisable="true" :coverIsDisable="true" :mode="2" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
import { UnplannedissueRequestMain,UnplannedissueRequestMainRules,UnplannedissueRequestDetail,UnplannedissueRequestDetailRules } from './sparepartsrequisitionRequestMain.data'
import * as UnplannedissueRequestMainApi from '@/api/wms/unplannedissueRequestMain'
import * as UnplannedissueRequestDetailApi from '@/api/wms/unplannedissueRequestDetail'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
//
defineOptions({ name: 'UnplannedissueRequestMain' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(UnplannedissueRequestMain.allSchemas.tableColumns)
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
//
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => {
nextTick(() => {
if (type == 'tableForm') {
//
row[formField] = val[0][searchField]
row['packingNumber'] = val[0]['packingNumber']
row['containerNumber'] = val[0]['containerNumber']
row['batch'] = val[0]['batch']
row['inventoryStatus'] = val[0]['inventoryStatus']
row['fromLocationCode'] = val[0]['locationCode']
row['itemCode'] = val[0]['itemCode']
} else {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
}
})
}
//
const searchTableSuccessDetail = (formField, searchField, val, formRef ) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
setV['packingNumber'] = val[0]['packingNumber']
setV['containerNumber'] = val[0]['containerNumber']
setV['batch'] = val[0]['batch']
setV['inventoryStatus'] = val[0]['inventoryStatus']
setV['fromLocationCode'] = val[0]['locationCode']
setV['itemCode'] = val[0]['itemCode']
formRef.setValues(setV)
})
}
//
// const Echo = ['ppNumber','poLine', 'batch', 'altBatch', 'itemCode', 'itemName', 'itemDesc1', 'itemDesc2', 'projectCode', 'qty', 'uom']
const Echo = []
const { tableObject, tableMethods } = useTable({
getListApi: UnplannedissueRequestMainApi.getUnplannedissueRequestMainPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'wms:unplannedissue-request-main:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'wms:unplannedissue-request-main:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'wms:unplannedissue-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') { //
if (tableObject.params.filters && tableObject.params.filters.length > 0 ) {
searchFormClick({
filters: tableObject.params.filters
})
} else {
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) => {
return [
defaultButtons.mainListCloseBtn({hide:isShowMainButton(row,['1','2','3','4']),hasPermi:'wms:unplannedissue-request-main:close'}), //
defaultButtons.mainListReAddBtn({hide:isShowMainButton(row,['5']),hasPermi:'wms:unplannedissue-request-main:reAdd'}), //
defaultButtons.mainListSubmitBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:unplannedissue-request-main:submit'}), //
defaultButtons.mainListTurnDownBtn({hide:isShowMainButton(row,['2']),hasPermi:'wms:unplannedissue-request-main:refused'}), //
defaultButtons.mainListApproveBtn({hide:isShowMainButton(row,['2']),hasPermi:'wms:unplannedissue-request-main:agree'}), //
defaultButtons.mainListHandleBtn({hide:isShowMainButton(row,['3']),hasPermi:'wms:unplannedissue-request-main:handle'}), //
defaultButtons.mainListEditBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:unplannedissue-request-main:update'}), //
// defaultButtons.mainListDeleteBtn({hasPermi:'wms:unplannedissue-request-main:delete'}), //
]
}
// -
const buttonTableClick = async (val, row) => {
if (val == 'mainClose') { //
console.log('列表-操作按钮事件-关闭')
handleClose(row.id)
} else if (val == 'mainReAdd') { //
console.log('列表-操作按钮事件-重新添加')
handleReAdd(row.id)
} else if (val == 'mainSubmit') { //
console.log('列表-操作按钮事件-提交审批')
handleSubmit(row.id)
} else if (val == 'mainTurnDown') { //
console.log('列表-操作按钮事件-驳回')
handleRefused(row.id)
} else if (val == 'mainApprove') { //
console.log('列表-操作按钮事件-审批通过')
handleAgree(row.id)
} else if (val == 'mainHandle') { //
handleHandle(row.id)
} else if (val == 'edit') { //
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
}
}
/** 处理按钮操作 */
const handleHandle = async (id: number) => {
await message.confirm(t('common.confirmHandle'))
tableObject.loading = true
await UnplannedissueRequestMainApi.handleUnplannedissueRequestMain(id)
message.success(t('common.handleSuccess'))
tableObject.loading = false
await getList()
}
/** 审批通过按钮操作 */
const handleAgree = async (id: number) => {
await message.confirm(t('common.confirmAgree'))
tableObject.loading = true
await UnplannedissueRequestMainApi.agreeUnplannedissueRequestMain(id)
message.success(t('common.agreeSuccess'))
tableObject.loading = false
await getList()
}
/** 审批驳回按钮操作 */
const handleRefused = async (id: number) => {
await message.confirm(t('common.confirmRefused'))
tableObject.loading = true
await UnplannedissueRequestMainApi.refusedUnplannedissueRequestMain(id)
message.success(t('common.refusedSuccess'))
tableObject.loading = false
await getList()
}
/** 提交按钮操作 */
const handleSubmit = async (id: number) => {
await message.confirm(t('common.confirmSubmit'))
tableObject.loading = true
await UnplannedissueRequestMainApi.submitUnplannedissueRequestMain(id)
message.success(t('common.submitSuccess'))
tableObject.loading = false
await getList()
}
/** 关闭按钮操作 */
const handleClose = async (id: number) => {
await message.confirm(t('common.confirmColse'))
tableObject.loading = true
await UnplannedissueRequestMainApi.closeUnplannedissueRequestMain(id)
message.success(t('common.closeSuccess'))
tableObject.loading = false
await getList()
}
/** 重新添加按钮操作 */
const handleReAdd = async (id: number) => {
await message.confirm(t('common.confirmReAdd'))
tableObject.loading = true
await UnplannedissueRequestMainApi.reAddUnplannedissueRequestMain(id)
message.success(t('common.reAddSuccess'))
tableObject.loading = false
await getList()
}
/** 添加/修改操作 */
const formRef = ref()
const openForm =async (type: string, row?: number) => {
tableData.value = [] //
formRef.value.open(type, row)
}
//
const { wsCache } = useCache()
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
const departmentCode = wsCache.get(CACHE_KEY.DEPT).find((account) => account.id == row.departmentCode)?.name
if (departmentCode) row.departmentCode = JSON.parse(JSON.stringify(departmentCode))
detailRef.value.openDetail(row, titleName, titleValue,'requestUnplannedissueMain')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
tableObject.loading = true
//
await UnplannedissueRequestMainApi.deleteUnplannedissueRequestMain(id)
message.success(t('common.delSuccess'))
tableObject.loading = false
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await UnplannedissueRequestMainApi.exportUnplannedissueRequestMain(tableObject.params)
download.excel(data, '计划外出库申请主.xlsx')
} catch {
} finally {
exportLoading.value = false
}
}
/**
* tableForm方法
*/
const tableFormKeys = {}
UnplannedissueRequestDetail.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 submitForm = async (formType, data) => {
data.subList = tableData.value //
try {
if (formType === 'create') {
console.log("【计划外出库子列表】",data.subList)
if(data.subList.length == 0){
message.warning("请添加子列表数据")
return;
}
let flag = false;
data.subList.forEach((item) => {
if(item.qty == 0){
message.warning("数量不能为0")
flag = true;
return;
}
})
if(flag){
formRef.value.formLoading = false
return
}
await UnplannedissueRequestMainApi.createUnplannedissueRequestMain(data)
message.success(t('common.createSuccess'))
} else {
await UnplannedissueRequestMainApi.updateUnplannedissueRequestMain(data)
message.success(t('common.updateSuccess'))
}
formRef.value.dialogVisible = false
//
getList()
} finally {
formRef.value.formLoading = false
}
}
const onBlur = (field, e) => {
if (field == 'reason') {
detailRef.value.formRef.formRef.formModel[field] = e.target.value
}
}
const tableFormSelectOnBlur = (field, val, row, index) => {
if (field == 'reason') {
tableData.value[index][field] = val.target.value
}
}
// /
const detailValidate = (data) => {
let tag = false;
if(data.qty <= 0){
message.warning('数量必须大于0')
tag = false;
return tag;
}else {
tag = true;
return tag;
}
}
/** 导入 */
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 UnplannedissueRequestMainApi.importTemplate()
})
</script>

669
src/views/wms/inventoryjobManage/sparepartsrequisition/sparepartsrequisitionRequestMain/sparepartsrequisitionRequestMain.data.ts

@ -0,0 +1,669 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import * as getRequestsettingApi from '@/api/wms/requestsetting/index'
import * as BalanceApi from '@/api/wms/balance'
import { Balance } from '@/views/wms/inventoryManage/balance/balance.data'
const { t } = useI18n() // 国际化
// 获取自动提交自动通过自动执行,跳过任务直接删生成记录的默认值
const queryParams = {
pageSize:10,
pageNo:1,
code:'UnplannedDeliverRequest'
}
const data = await getRequestsettingApi.getRequestsettingPage(queryParams)
const requestsettingData =data?.list[0]||{}
// 获取当前操作人的部门
import { useUserStore } from '@/store/modules/user'
import { TableColumn } from '@/types/table'
const userStore = useUserStore()
const userDept = userStore.userSelfInfo.dept
// id 转str 否则form回显匹配不到
userDept.id = userDept.id.toString()
const userDeptArray:any = [userDept]
/**
* @returns {Array}
*/
export const UnplannedissueRequestMain = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '单据号',
field: 'number',
sort: 'custom',
table: {
width: 180,
fixed: 'left'
},
isForm: false,
isSearch: true,
},
{
label: '状态',
field: 'status',
dictType: DICT_TYPE.REQUEST_STATUS,
dictClass: 'string',
isSearch: true,
isTable: true,
sort: 'custom',
table: {
width: 150
},
form: {
value: '1',
componentProps: {
disabled: true
}
}
},
{
label: '申请时间',
field: 'requestTime',
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
style: {width:'100%'},
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
},
{
label: '截止时间',
field: 'dueTime',
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
style: {width:'100%'},
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
},
{
label: '从仓库代码',
field: 'fromWarehouseCode',
sort: 'custom',
table: {
width: 150
},
isForm: false,
},
{
label: '从库区类型范围',
field: 'fromAreaTypes',
dictType: DICT_TYPE.AREA_TYPE,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
},
isSearch: true,
isForm: false,
},
{
label: '从库区代码范围',
field: 'fromAreaCodes',
sort: 'custom',
table: {
width: 150
},
isSearch: true,
isForm: false,
},
{
label: '业务类型',
field: 'businessType',
sort: 'custom',
table: {
width: 150
},
form: {
value: 'UnplannedDeliver',
componentProps: {
disabled: true
}
},
isForm: false,
},
{
label: '部门',
field: 'departmentCode',
sort: 'custom',
table: {
width: 150
},
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return userDeptArray.find((account) => account.id == cellValue)?.name
},
form: {
value: userDept.id,
component: 'Select',
api: () => userDeptArray,
componentProps: {
disabled: true,
optionsAlias: {
labelField: 'name',
valueField: 'id'
}
}
}
},
{
label: '自动提交',
field: 'autoCommit',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: true,
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: true,
sort: 'custom',
table: {
width: 150
},
form: {
component: 'Switch',
value: requestsettingData.autoAgree,
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE',
disabled: true
}
}
},
{
label: '自动执行',
field: 'autoExecute',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
},
form: {
component: 'Switch',
value: requestsettingData.autoExecute,
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE',
disabled: true
}
}
},
{
label: '直接生成记录',
field: 'directCreateRecord',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isForm: false,
isTable: false,
sort: 'custom',
table: {
width: 150
},
form: {
component: 'Switch',
value: requestsettingData.directCreateRecord,
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE',
disabled: true
}
}
},
{
label: '备注',
field: 'remark',
sort: 'custom',
table: {
width: 150
},
isTable: false,
},
{
label: '创建时间',
field: 'createTime',
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
style: {width:'100%'},
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
isForm: false,
},
{
label: '创建者',
field: 'creator',
sort: 'custom',
table: {
width: 150
},
isForm: false,
},
{
label: '最后更新时间',
field: 'updateTime',
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
style: {width:'100%'},
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
isForm: false,
},
{
label: '最后更新者',
field: 'updater',
sort: 'custom',
table: {
width: 150
},
isForm: false,
},
{
label: '操作',
field: 'action',
isDetail: false,
isForm: false,
table: {
width: 300,
fixed: 'right'
},
}
]))
//表单校验
export const UnplannedissueRequestMainRules = reactive({
departmentCode: [
{ required: true, message: '请输入部门', trigger: 'blur' }
],
autoCommit: [
{ required: true, message: '请选择是否自动提交', trigger: 'change' }
],
autoAgree: [
{ required: true, message: '请选择是否自动通过', trigger: 'change' }
],
autoExecute: [
{ required: true, message: '请选择是否自动执行', trigger: 'change' }
],
directCreateRecord: [
{ required: true, message: '请选择是否跳过任务直接生成记录', trigger: 'change' }
],
remark: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
})
/**
* @returns {Array}
*/
export const UnplannedissueRequestDetail = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '单据号',
field: 'number',
sort: 'custom',
table: {
width: 180
},
isTableForm: false,
form: {
componentProps: {
disabled: true
}
}
},
{
label: '物料代码',
field: 'itemCode',
sort: 'custom',
table: {
width: 150
},
},
{
label: '物料名称',
field: 'itemName',
sort: 'custom',
table: {
width: 150
},
isTableForm: false,
isForm: false,
},
{
label: '物料描述1',
field: 'itemDesc1',
sort: 'custom',
table: {
width: 150
},
isTableForm: false,
isForm: false,
},
{
label: '物料描述2',
field: 'itemDesc2',
sort: 'custom',
table: {
width: 150
},
isTableForm: false,
isForm: false,
},
{
label: '批次',
field: 'batch',
sort: 'custom',
table: {
width: 150
},
},
{
label: '包装号',
field: 'packingNumber',
sort: 'custom',
table: {
width: 150
},
tableForm:{
isInpuFocusShow: true, // 开启查询弹窗
searchListPlaceholder: '请选择包装号',
searchField: 'packingNumber',
searchTitle: '库存余额信息',
searchAllSchemas: Balance.allSchemas,
searchPage: BalanceApi.getBalancePage
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择包装号',
searchField: 'packingNumber',
searchTitle: '库存余额信息',
searchAllSchemas: Balance.allSchemas,
searchPage: BalanceApi.getBalancePage
}
}
},
{
label: '器具号',
field: 'containerNumber',
sort: 'custom',
table: {
width: 150
},
},
{
label: '数量',
field: 'qty',
sort: 'custom',
table: {
width: 150
},
form: {
component: 'InputNumber',
componentProps: {
min: 0,
precision: 6,
}
},
tableForm: {
type: 'InputNumber',
min: 0,
precision: 6,
}
},
{
label: '计量单位',
field: 'uom',
dictType: DICT_TYPE.UOM,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
},
tableForm: {
type: 'Select'
}
},
{
label: '库存状态',
field: 'inventoryStatus',
dictType: DICT_TYPE.INVENTORY_STATUS,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
},
tableForm: {
type: 'Select'
}
},
{
label: '从库位代码',
field: 'fromLocationCode',
sort: 'custom',
table: {
width: 150
},
},
{
label: '原因',
field: 'reason',
dictType: DICT_TYPE.UNPLANNED_ISSUE_REASON,
dictClass: 'string',
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return cellValue
},
table: {
width: 150
},
form: {
componentProps: {
filterable: true
}
},
tableForm: {
type: 'Select',
filterable: true
}
},
{
label: '项目代码',
field: 'projectCode',
sort: 'custom',
table: {
width: 150
},
isTableForm: false,
isForm: false,
},
{
label: '从货主代码',
field: 'fromOwnerCode',
sort: 'custom',
table: {
width: 150
},
isForm: false,
isTableForm: false
},
{
label: '备注',
field: 'remark',
sort: 'custom',
table: {
width: 150
},
},
{
label: '创建时间',
field: 'createTime',
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
style: {width:'100%'},
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
isTableForm: false,
isForm: false
},
{
label: '创建者',
field: 'creator',
sort: 'custom',
table: {
width: 150
},
isTableForm: false,
isForm: false
},
{
label: '最后更新时间',
field: 'updateTime',
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
style: {width:'100%'},
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
isTableForm: false,
isForm: false
},
{
label: '最后更新者',
field: 'updater',
sort: 'custom',
table: {
width: 150
},
isTableForm: false,
isForm: false
},
{
label: '操作',
field: 'action',
isDetail: false,
isForm: false ,
table: {
width: 150,
fixed: 'right'
},
isTableForm:false,
}
]))
//表单校验
export const UnplannedissueRequestDetailRules = reactive({
packingNumber: [
{ required: true, message: '请选择包装号', trigger: 'change' },
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
batch: [
{ required: true, message: '请输入批次', trigger: 'blur' },
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
containerNumber: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
inventoryStatus: [
{ required: true, message: '请选择库存状态', trigger: 'change' }
],
fromLocationCode: [
{ required: true, message: '请选择从库位代码', trigger: 'change' },
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
itemCode: [
{ required: true, message: '请选择物料代码', trigger: 'change' },
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
remark: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
})
Loading…
Cancel
Save