ljlong_2630
1 month ago
3 changed files with 1461 additions and 0 deletions
@ -0,0 +1,346 @@ |
|||
<!-- 导入组件 --> |
|||
<template> |
|||
<Dialog v-model="dialogVisible" :title="t('ts.导入')" width="600" :close-on-click-modal="false"> |
|||
<el-upload |
|||
ref="uploadRef" |
|||
v-model:file-list="fileList" |
|||
:action=" |
|||
importUrl + |
|||
'?mode=' + |
|||
mode + |
|||
'&file=' + |
|||
file + |
|||
'&updatePart=' + |
|||
updatePart + |
|||
'&outFile=' + |
|||
outFile + |
|||
'&extend=' + extend + |
|||
'&fromInventoryStatus=' + fromInventoryStatus + |
|||
'&toInventoryStatus=' + toInventoryStatus |
|||
" |
|||
:auto-upload="false" |
|||
:disabled="formLoading" |
|||
:headers="uploadHeaders" |
|||
:limit="1" |
|||
:on-error="submitFormError" |
|||
:on-exceed="handleExceed" |
|||
:on-success="submitFormSuccess" |
|||
:accept="accept" |
|||
drag |
|||
style="width: 300px; margin: 0 auto" |
|||
v-loading="formLoading" |
|||
> |
|||
<Icon icon="ep:upload-filled" color="#c0c4cc" :size="60" /> |
|||
<div class="el-upload__text">{{t('ts.将文件拖到此处,或')}}<em>{{t('ts.点击上传')}}</em></div> |
|||
<template #tip> |
|||
<div class="el-upload__tip ml--126px mr--80px"> |
|||
<div class="flex"> |
|||
<div |
|||
class="label h-32px mr-26px color-#acaeb3 font-size-14px w-100px text-right" |
|||
style="line-height: 32px" |
|||
>{{t('ts.导入模式')}}</div |
|||
> |
|||
<div class=""> |
|||
<div class="radio"> |
|||
<el-radio-group v-model="mode"> |
|||
<!-- <el-radio :label="1" :disabled="updateIsDisable">{{ t('ts.更新')}}</el-radio> --> |
|||
<el-radio :label="2" :disabled="appendIsDisable">{{ t('ts.追加') }}</el-radio> |
|||
<!-- <el-radio :label="3" :disabled="coverIsDisable">{{ t('ts.覆盖') }}</el-radio> --> |
|||
</el-radio-group> |
|||
</div> |
|||
|
|||
<div class="tips color-#acaeb3 font-size-14px"> |
|||
<!-- <div class="mt-2">{{t('ts.更新:新增并修改')}}</div> --> |
|||
<div class="mt-2">{{ t('ts.追加:只新增,不修改') }}</div> |
|||
<!-- <div class="mt-2">{{ t('ts.覆盖:只修改不新增') }}</div> --> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="flex mt-16px"> |
|||
<!-- <div |
|||
class="label h-32px mr-26px color-#acaeb3 font-size-14px w-100px text-right" |
|||
style="line-height: 32px" |
|||
>{{ t('ts.部分保存') }}</div |
|||
> |
|||
<div class=""> |
|||
<div class="switch"> |
|||
<el-switch v-model="updatePart" /> |
|||
</div> |
|||
<div class="tips color-#acaeb3 font-size-14px"> |
|||
<div class="mt-2">{{ t('ts.部分保存:如存在错误数据,正确数据正常导入') }}</div> |
|||
<div class="mt-2">{{ t('ts.全部保存:全部数据正确,才能导入') }}</div> |
|||
</div> |
|||
</div> --> |
|||
</div> |
|||
<div class="flex mt-16px" v-if="isShowOut"> |
|||
<div |
|||
class="label h-32px mr-26px color-#acaeb3 font-size-14px w-100px text-right" |
|||
style="line-height: 32px" |
|||
>是否外部资源</div |
|||
> |
|||
<div class=""> |
|||
<div class="switch"> |
|||
<el-switch v-model="outFile" /> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
</el-upload> |
|||
<template #footer> |
|||
<div class="flex items-center"> |
|||
<div class="flex-1 text-left"> |
|||
<el-button type="primary" plain @click="importTemplate" v-if="isShowDownloadBtn"> |
|||
<Icon icon="ep:download" /> |
|||
{{ t('ts.下载模板') }} |
|||
</el-button> |
|||
</div> |
|||
<el-button :disabled="formLoading" type="primary" @click="submitForm">{{ t('ts.确 定') }}</el-button> |
|||
<el-button @click="dialogVisible = false">{{ t('ts.取 消') }}</el-button> |
|||
</div> |
|||
</template> |
|||
</Dialog> |
|||
</template> |
|||
<script lang="ts" setup> |
|||
import { getAccessToken, getTenantId } from '@/utils/auth' |
|||
import download from '@/utils/download' |
|||
import { getBaseUrl } from '@/utils/systemParam' |
|||
|
|||
defineOptions({ name: 'ImportFormOnlyAdd' }) |
|||
const { t } = useI18n() |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
|
|||
const dialogVisible = ref(false) // 弹窗的是否展示 |
|||
const formLoading = ref(false) // 表单的加载中 |
|||
const uploadRef = ref() |
|||
const uploadHeaders = ref() // 上传 Header 头 |
|||
const fileList = ref([]) // 文件列表 |
|||
const file = ref('') |
|||
|
|||
const props = defineProps({ |
|||
importTemplateData: { |
|||
type: Object, |
|||
required: true |
|||
}, |
|||
// 可以导入的文件类型 |
|||
accept: { |
|||
type: String, |
|||
required: false, |
|||
default: '.txt' |
|||
}, |
|||
// 是否更新已经存在的用户数据.默认值是1 |
|||
mode: { |
|||
type: Number, |
|||
required: false, |
|||
default: 2 |
|||
}, |
|||
// 更新是否禁用,默认值不禁用 |
|||
updateIsDisable: { |
|||
type: Boolean, |
|||
required: false, |
|||
default: false |
|||
}, |
|||
// 追加是否禁用,默认值不禁用 |
|||
appendIsDisable: { |
|||
type: Boolean, |
|||
required: false, |
|||
default: false |
|||
}, |
|||
// 覆盖是否禁用,默认值不禁用 |
|||
coverIsDisable: { |
|||
type: Boolean, |
|||
required: false, |
|||
default: false |
|||
}, |
|||
// 是否部门保存,默认是 |
|||
updatePart: { |
|||
type: Boolean, |
|||
required: false, |
|||
default: false |
|||
}, |
|||
url: { |
|||
type: String, |
|||
required: false |
|||
}, |
|||
// 显示是否外部资源 |
|||
isShowOut: { |
|||
type: Boolean, |
|||
required: false, |
|||
default: false |
|||
}, |
|||
outFile: { |
|||
type: Boolean, |
|||
required: false, |
|||
default: false |
|||
}, |
|||
// 扩展额外属性 |
|||
extend: { |
|||
type: String, |
|||
required: false, |
|||
default: '' |
|||
}, |
|||
// 库存修改 扩展额外属性 TODO: 后续优化 业务限定属性应转为统一的额外扩展属性 此处不应该出现业务相关属性 cxm |
|||
fromInventoryStatus: { |
|||
type: String, |
|||
required: false, |
|||
default: '' |
|||
}, |
|||
// 库存修改 扩展额外属性 TODO: 后续优化 业务限定属性应转为统一的额外扩展属性 此处不应该出现业务相关属性 cxm |
|||
toInventoryStatus: { |
|||
type: String, |
|||
required: false, |
|||
default: '' |
|||
}, |
|||
// 是否显示盘点任务下载模板按钮 |
|||
isShowDownloadBtn: { |
|||
type: Boolean, |
|||
required: false, |
|||
default: false |
|||
}, |
|||
}) |
|||
const importTemplateData = ref(props.importTemplateData) |
|||
const accept = ref(props.accept) |
|||
const mode = ref(props.mode) //是否更新已经存在的用户数据.默认值是1 |
|||
const updateIsDisable = ref(props.updateIsDisable) //更新是否禁用,默认值不禁用 |
|||
const appendIsDisable = ref(props.appendIsDisable) //追加是否禁用,默认值不禁用 |
|||
const coverIsDisable = ref(props.coverIsDisable) //覆盖是否禁用,默认值不禁用 |
|||
const updatePart = ref(props.updatePart) //是否部门保存 |
|||
const outFile = ref(props.outFile) //是否引入外部资源 |
|||
|
|||
const importUrl = getBaseUrl() + import.meta.env.VITE_API_URL + props.url |
|||
|
|||
/** 打开弹窗 */ |
|||
const open = () => { |
|||
dialogVisible.value = true |
|||
resetForm() |
|||
} |
|||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗 |
|||
|
|||
/** 提交表单 */ |
|||
const submitForm = async () => { |
|||
if (fileList.value.length == 0) { |
|||
message.error('请上传文件') |
|||
return |
|||
} |
|||
file.value = fileList.value[0].name |
|||
// 提交请求 |
|||
uploadHeaders.value = { |
|||
Authorization: 'Bearer ' + getAccessToken(), |
|||
'tenant-id': getTenantId() |
|||
} |
|||
formLoading.value = true |
|||
uploadRef.value!.submit() |
|||
} |
|||
|
|||
/** 文件上传成功 */ |
|||
const emits = defineEmits(['success']) |
|||
const submitFormSuccess = (response: any) => { |
|||
formLoading.value = true |
|||
console.log(response) |
|||
if (response) { |
|||
if (response.code == 500) { |
|||
uploadRef.value!.clearFiles() |
|||
message.error('导入失败') |
|||
formLoading.value = false |
|||
return |
|||
} else if (response.code == 0) { |
|||
if (response.data.errorCount > 0) { |
|||
message.confirm('文件中有部分数据导入失败,是否下载失败数据?').then(() => { |
|||
// download.excel(file, 'file_' + new Date().getTime()) |
|||
// 通过url下载文件 |
|||
// const downloadElement = document.createElement('a') |
|||
// console.log(172, getBaseUrl() + import.meta.env.VITE_API_URL + '/' + response.data.errorFile) |
|||
// console.log(172, getBaseUrl() + '/admin-api/opt/profile/' + response.data.errorFile) |
|||
window.open( |
|||
getBaseUrl() + '/admin-api' + response.data.errorFile, |
|||
'222' |
|||
) |
|||
// downloadElement.setAttribute('href', getBaseUrl() + import.meta.env.VITE_API_URL + response.data.errorFile ) |
|||
// 点击下载 |
|||
// downloadElement.click() |
|||
}) |
|||
} else { |
|||
message.success('导入成功') |
|||
} |
|||
}else if(response.data == null){ |
|||
message.error(response.msg) |
|||
} |
|||
} |
|||
|
|||
// if (response.code !== 0) { |
|||
// message.error(response.msg) |
|||
// formLoading.value = false |
|||
// return |
|||
// } |
|||
// // 拼接提示语 |
|||
// const data = response.data |
|||
// const create = response.data.importResult[0] |
|||
// const update = response.data.importResult[1] |
|||
// const failure = response.data.importResult[2] |
|||
// let text = '上传成功数量:' + data[create].length + ';' |
|||
// for (let name of data[create]) { |
|||
// text += '< ' + name + ' >' |
|||
// } |
|||
// text += '更新成功数量:' + data[update].length + ';' |
|||
// for (const name of data[update]) { |
|||
// text += '< ' + name + ' >' |
|||
// } |
|||
// text += '更新失败数量:' + Object.keys(data[failure]).length + ';' |
|||
// for (const name in data[failure]) { |
|||
// text += '< ' + name + ': ' + data[failure][name] + ' >' |
|||
// } |
|||
// message.alert(text) |
|||
|
|||
// 发送操作成功的事件 |
|||
|
|||
formLoading.value = false |
|||
emits('success') |
|||
dialogVisible.value = false |
|||
} |
|||
/** 上传错误提示 */ |
|||
const submitFormError = (): void => { |
|||
message.error('上传失败,请您重新上传!') |
|||
formLoading.value = false |
|||
} |
|||
|
|||
/** 重置表单 */ |
|||
const resetForm = () => { |
|||
// 重置上传状态和文件 |
|||
formLoading.value = false |
|||
uploadRef.value?.clearFiles() |
|||
fileList.value = [] |
|||
} |
|||
|
|||
/** 文件数超出提示 */ |
|||
const handleExceed = (): void => { |
|||
message.error('最多只能上传一个文件!') |
|||
} |
|||
|
|||
/** 下载模板操作 */ |
|||
const importTemplate = () => { |
|||
const res = importTemplateData.value.templateUrl |
|||
download.excel(res, importTemplateData.value.templateTitle) |
|||
} |
|||
</script> |
|||
|
|||
<style scoped lang="scss"> |
|||
.tips { |
|||
div { |
|||
position: relative; |
|||
padding-left: 22px; |
|||
|
|||
&::before { |
|||
width: 4px; |
|||
height: 4px; |
|||
border-radius: 50%; |
|||
content: ''; |
|||
background: #c2c2c2; |
|||
position: absolute; |
|||
top: 50%; |
|||
margin-top: -2px; |
|||
left: 4px; |
|||
} |
|||
} |
|||
} |
|||
</style> |
@ -0,0 +1,874 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter, dateFormatter2 } from '@/utils/formatTime' |
|||
|
|||
/** |
|||
* @returns {Array} 发货记录主表 |
|||
*/ |
|||
export const DeliverRecordMain = 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 |
|||
} |
|||
}, |
|||
{ |
|||
label: '发货记录单号', |
|||
field: 'deliverRecordNumber', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail: false |
|||
}, |
|||
{ |
|||
label: '发货计划单号', |
|||
field: 'deliverPlanNumber', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 180 |
|||
}, |
|||
isTable: true, |
|||
isDetail: true |
|||
}, |
|||
// {
|
|||
// label: '客户发货单号',
|
|||
// field: 'customerDeliverNumber',
|
|||
// sort: 'custom',
|
|||
// table: {
|
|||
// width: 150
|
|||
// },
|
|||
// },
|
|||
{ |
|||
label: '客户订单号', |
|||
field: 'customerOrderNumber', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 180 |
|||
}, |
|||
isTable: true, |
|||
isForm: true, |
|||
form: { |
|||
component: 'Input', |
|||
componentProps: { |
|||
|
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '状态', |
|||
field: 'status', |
|||
dictType: DICT_TYPE.REQUEST_STATUS, |
|||
dictClass: 'string', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm: false, |
|||
isDetail: false, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
} |
|||
}, |
|||
{ |
|||
label: '客户代码', |
|||
field: 'customerCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isSearch: true |
|||
}, |
|||
{ |
|||
label: '发货类型', |
|||
field: 'deliverType', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
dictType: DICT_TYPE.DELIVER_TYPE, |
|||
dictClass: 'string', |
|||
table: { |
|||
width: 150 |
|||
} |
|||
}, |
|||
{ |
|||
label: '客户月台代码', |
|||
field: 'customerDockCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isTable: false |
|||
}, |
|||
{ |
|||
label: '承运商', |
|||
field: 'carrierCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isTable: false |
|||
}, |
|||
{ |
|||
label: '运输方式', |
|||
field: 'transferMode', |
|||
dictType: DICT_TYPE.TRANSFER_MODE, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isTable: false |
|||
}, |
|||
{ |
|||
label: '车牌号', |
|||
field: 'vehiclePlateNumber', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isTable: false |
|||
}, |
|||
{ |
|||
label: '申请时间', |
|||
field: 'requestTime', |
|||
formatter: dateFormatter, |
|||
detail: { |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
|||
}, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 180 |
|||
}, |
|||
isTable: false, |
|||
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 |
|||
}, |
|||
isTable: false, |
|||
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 |
|||
}, |
|||
isTable: false, |
|||
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 |
|||
}, |
|||
isTable: false, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
style: { width: '100%' }, |
|||
type: 'date', |
|||
dateFormat: 'YYYY-MM-DD', |
|||
valueFormat: 'x' |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '从仓库代码', |
|||
field: 'fromWarehouseCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isTable: false |
|||
}, |
|||
{ |
|||
label: '到仓库代码', |
|||
field: 'toWarehouseCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isTable: false |
|||
}, |
|||
{ |
|||
label: '从库区类型范围', |
|||
field: 'fromAreaTypes', |
|||
dictType: DICT_TYPE.AREA_TYPE, |
|||
dictClass: 'string', |
|||
isTable: false, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
} |
|||
}, |
|||
{ |
|||
label: '到库区类型范围', |
|||
field: 'toAreaTypes', |
|||
dictType: DICT_TYPE.AREA_TYPE, |
|||
dictClass: 'string', |
|||
isTable: false, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
} |
|||
}, |
|||
{ |
|||
label: '从库区代码范围', |
|||
field: 'fromAreaCodes', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isTable: false |
|||
}, |
|||
{ |
|||
label: '到库区代码范围', |
|||
field: 'toAreaCodes', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isTable: false |
|||
}, |
|||
{ |
|||
label: '从月台代码', |
|||
field: 'fromDockCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isTable: false |
|||
}, |
|||
{ |
|||
label: '出库事务类型', |
|||
field: 'outTransactionType', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isTable: false |
|||
}, |
|||
{ |
|||
label: '入库事务类型', |
|||
field: 'inTransactionType', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isTable: false |
|||
}, |
|||
{ |
|||
label: '业务类型', |
|||
field: 'businessType', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isTable: false |
|||
}, |
|||
{ |
|||
label: '部门', |
|||
field: 'departmentCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isTable: false |
|||
}, |
|||
{ |
|||
label: '接口类型', |
|||
field: 'interfaceType', |
|||
dictType: DICT_TYPE.INTERFACE_TYPE, |
|||
dictClass: 'string', |
|||
isTable: false, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
} |
|||
}, |
|||
{ |
|||
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 |
|||
}, |
|||
isTable: false, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
valueFormat: 'x' |
|||
} |
|||
}, |
|||
isSearch: false, |
|||
search: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
type: 'daterange', |
|||
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
|||
}, |
|||
}, |
|||
}, |
|||
{ |
|||
label: '创建者', |
|||
field: 'creator', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isTable: false |
|||
}, |
|||
// {
|
|||
// label: '代码',
|
|||
// field: 'code',
|
|||
// sort: 'custom',
|
|||
// table: {
|
|||
// width: 150
|
|||
// },
|
|||
// },
|
|||
{ |
|||
label: '是否可用', |
|||
field: 'available', |
|||
dictType: DICT_TYPE.TRUE_FALSE, |
|||
dictClass: 'string', |
|||
isSearch: false, |
|||
isTable: false, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
form: { |
|||
component: 'Switch', |
|||
value: 'TRUE', |
|||
componentProps: { |
|||
inactiveValue: 'FALSE', |
|||
activeValue: 'TRUE' |
|||
} |
|||
} |
|||
} |
|||
]) |
|||
) |
|||
|
|||
//表单校验
|
|||
export const DeliverRecordMainRules = reactive({ |
|||
requestNumber: [ |
|||
{ required: true, message: '请选择申请单号', trigger: 'change' } |
|||
], |
|||
customerCode: [ |
|||
{ required: true, message: '请选择客户代码', trigger: 'change' } |
|||
], |
|||
customerDockCode: [ |
|||
{ required: true, message: '请选择客户月台代码', trigger: 'change' } |
|||
], |
|||
fromWarehouseCode: [ |
|||
{ required: true, message: '请选择从仓库代码', trigger: 'change' } |
|||
], |
|||
fromAreaTypes: [ |
|||
{ required: true, message: '请选择从库区类型范围', trigger: 'change' } |
|||
], |
|||
fromAreaCodes: [ |
|||
{ required: true, message: '请选择从库区代码范围', trigger: 'change' } |
|||
], |
|||
toWarehouseCode: [ |
|||
{ required: true, message: '请选择到仓库代码', trigger: 'change' } |
|||
], |
|||
toAreaTypes: [ |
|||
{ 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 DeliverRecordDetail = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: '单据号', |
|||
field: 'number', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 180 |
|||
}, |
|||
isTable: false |
|||
}, |
|||
// {
|
|||
// label: '销售订单号',
|
|||
// field: 'soNumber',
|
|||
// sort: 'custom',
|
|||
// table: {
|
|||
// width: 150
|
|||
// },
|
|||
// },
|
|||
// {
|
|||
// label: '销售订单行',
|
|||
// field: 'soLine',
|
|||
// sort: 'custom',
|
|||
// table: {
|
|||
// width: 150
|
|||
// },
|
|||
// },
|
|||
{ |
|||
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 |
|||
}, |
|||
hiddenInMain: true |
|||
}, |
|||
{ |
|||
label: '物料描述2', |
|||
field: 'itemDesc2', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
hiddenInMain: true |
|||
}, |
|||
{ |
|||
label: '批次', |
|||
field: 'batch', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '包装号', |
|||
field: 'packingNumber', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '父包装号', |
|||
field: 'parentPackingNumber', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '包装规格', |
|||
field: 'packUnit', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm:false, |
|||
isDetail:false, |
|||
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 |
|||
}, |
|||
hiddenInMain: true, |
|||
form: { |
|||
component: 'InputNumber', |
|||
} |
|||
}, |
|||
{ |
|||
label: '金额', |
|||
field: 'amount', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
hiddenInMain: true, |
|||
form: { |
|||
component: 'InputNumber', |
|||
} |
|||
}, |
|||
{ |
|||
label: '在途库库位', |
|||
field: 'onTheWayLocationCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '从库位', |
|||
field: 'fromLocationCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '到库位', |
|||
field: 'toLocationCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '从库位组', |
|||
field: 'fromLocationGroupCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
hiddenInMain: true, |
|||
}, |
|||
{ |
|||
label: '到库位组', |
|||
field: 'toLocationGroupCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
hiddenInMain: true, |
|||
}, |
|||
{ |
|||
label: '从库区', |
|||
field: 'fromAreaCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
hiddenInMain: true, |
|||
}, |
|||
{ |
|||
label: '到库区', |
|||
field: 'toAreaCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
hiddenInMain: true, |
|||
}, |
|||
// {
|
|||
// label: '从器具号',
|
|||
// field: 'fromContainerNumber',
|
|||
// sort: 'custom',
|
|||
// table: {
|
|||
// width: 150
|
|||
// },
|
|||
// isTable: false,
|
|||
// },
|
|||
// {
|
|||
// label: '到器具号',
|
|||
// field: 'toContainerNumber',
|
|||
// sort: 'custom',
|
|||
// table: {
|
|||
// width: 150
|
|||
// },
|
|||
// isTable: false,
|
|||
// },
|
|||
{ |
|||
label: '库存状态', |
|||
field: 'inventoryStatus', |
|||
dictType: DICT_TYPE.INVENTORY_STATUS, |
|||
dictClass: 'string', |
|||
isTable: false, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '从货主代码', |
|||
field: 'fromOwnerCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isTable: false, |
|||
}, |
|||
{ |
|||
label: '到货主代码', |
|||
field: 'toOwnerCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isTable: false, |
|||
}, |
|||
{ |
|||
label: '项目代码', |
|||
field: 'projectCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isTable: false, |
|||
}, |
|||
{ |
|||
label: '备注', |
|||
field: 'remark', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isTable: false, |
|||
}, |
|||
{ |
|||
label: '接口类型', |
|||
field: 'interfaceType', |
|||
dictType: DICT_TYPE.INTERFACE_TYPE, |
|||
dictClass: 'string', |
|||
isTable: false, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '创建时间', |
|||
field: 'createTime', |
|||
formatter: dateFormatter, |
|||
detail: { |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
|||
}, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 180 |
|||
}, |
|||
isTable: true, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
valueFormat: 'x' |
|||
} |
|||
}, |
|||
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')] |
|||
}, |
|||
}, |
|||
}, |
|||
{ |
|||
label: '创建者', |
|||
field: 'creator', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isTable: true, |
|||
}, |
|||
// {
|
|||
// label: '任务明细ID',
|
|||
// field: 'jobDetailId',
|
|||
// sort: 'custom',
|
|||
// table: {
|
|||
// width: 150
|
|||
// },
|
|||
// },
|
|||
// {
|
|||
// label: '代码',
|
|||
// field: 'code',
|
|||
// sort: 'custom',
|
|||
// table: {
|
|||
// width: 150
|
|||
// },
|
|||
// },
|
|||
])) |
|||
|
|||
//表单校验
|
|||
export const DeliverRecordDetailRules = reactive({ |
|||
// soNumber: [
|
|||
// { required: true, message: '请选择销售订单号', trigger: 'change' }
|
|||
// ],
|
|||
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' } |
|||
], |
|||
toLocationCode: [ |
|||
{ required: true, message: '请选择到库位代码', trigger: 'change' } |
|||
], |
|||
toLocationGroupCode: [ |
|||
{ required: true, message: '请选择到库位组代码', trigger: 'change' } |
|||
], |
|||
toAreaCode: [ |
|||
{ 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' } |
|||
], |
|||
}) |
@ -0,0 +1,241 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="[...DeliverRecordMain.allSchemas.searchSchema,...DeliverRecordDetail.allSchemas.searchSchema]" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="DeliverRecordMain.allSchemas" |
|||
:detailAllSchemas="DeliverRecordDetail.allSchemas" |
|||
/> |
|||
|
|||
<!-- 列表 --> |
|||
<ContentWrap> |
|||
<Table v-clientTable |
|||
:columns="tableColumns" |
|||
:data="tableObject.tableList" |
|||
:loading="tableObject.loading" |
|||
:pagination="{ |
|||
total: tableObject.total |
|||
}" |
|||
v-model:pageSize="tableObject.pageSize" |
|||
v-model:currentPage="tableObject.currentPage" |
|||
v-model:sort="tableObject.sort" |
|||
> |
|||
<template #number="{row}"> |
|||
<el-button type="primary" link @click="openDetail(row, '单据号', row.number)"> |
|||
<span>{{ row.number }}</span> |
|||
</el-button> |
|||
</template> |
|||
<template #action="{ row,$index }"> |
|||
<ButtonBase :Butttondata="butttondata(row,$index)" @button-base-click="buttonTableClick($event,row)" /> |
|||
</template> |
|||
</Table> |
|||
</ContentWrap> |
|||
|
|||
<!-- 表单弹窗:添加/修改 --> |
|||
<BasicForm |
|||
ref="formRef" |
|||
@success="getList" |
|||
:rules="DeliverRecordMainRules" |
|||
:formAllSchemas="DeliverRecordMain.allSchemas" |
|||
:tableAllSchemas="DeliverRecordDetail.allSchemas" |
|||
:tableFormRules="DeliverRecordDetailRules" |
|||
:isBusiness="true" |
|||
/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail |
|||
ref="detailRef" |
|||
:isBasic="false" |
|||
:allSchemas="DeliverRecordMain.allSchemas" |
|||
:detailAllSchemas="DeliverRecordDetail.allSchemas" |
|||
:detailAllSchemasRules="DeliverRecordDetailRules" |
|||
:apiPage="DeliverRecordDetailApi.getDeliverRecordDetailPage" |
|||
/> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportFormOnlyAdd ref="importFormRef" url="/wms/deliver-record-main/import-toyota_supplies" @success="importSuccess" :isShowDownloadBtn="false"/> |
|||
</template> |
|||
|
|||
|
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { getAccessToken } from '@/utils/auth' |
|||
import { DeliverRecordMain,DeliverRecordMainRules,DeliverRecordDetail,DeliverRecordDetailRules } from './deliverRecordMain.data' |
|||
import * as DeliverRecordMainApi from '@/api/wms/deliverRecordMain' |
|||
import * as DeliverRecordDetailApi from '@/api/wms/deliverRecordDetail' |
|||
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|||
import { CACHE_KEY, useCache } from '@/hooks/web/useCache' |
|||
import { getJmreportBaseUrl } from '@/utils/systemParam' |
|||
import { formatDate } from '@/utils/formatTime' |
|||
import { usePageLoading } from '@/hooks/web/usePageLoading' |
|||
const { loadStart, loadDone } = usePageLoading() |
|||
// 发货记录主 |
|||
defineOptions({ name: 'FtSuppliesRecordMain' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const businessType = ref() |
|||
const importFileName = ref() |
|||
console.log(99 , routeName.value) |
|||
const tableColumns = ref([...DeliverRecordMain.allSchemas.tableColumns,...DeliverRecordDetail.allSchemas.tableMainColumns]) |
|||
|
|||
const { tableObject, tableMethods } = useTable({ |
|||
getListApi: DeliverRecordDetailApi.getDeliverRecordDetailPage // 分页接口 |
|||
}) |
|||
|
|||
// 判断 路由名称 进行条件过滤 |
|||
/** |
|||
* OktoholdRequestMain 合格转隔离 |
|||
*/ |
|||
if ( routeName.value == 'FtSuppliesRecordMain') { |
|||
tableObject.params = { |
|||
businessType: 'FtSuppliesRecord' |
|||
} |
|||
businessType.value = 'FtSuppliesRecord' |
|||
importFileName.value = '丰田补给品发货记录' |
|||
} |
|||
|
|||
// 字段设置 更新主列表字段 |
|||
const updataTableColumns = (val) => { |
|||
tableColumns.value = val |
|||
} |
|||
|
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultImportBtn({hasPermi:`wms:${routeName.value}:import`}), // 导出 |
|||
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 if (val == 'import') { // 导入 |
|||
handleImport() |
|||
} else { // 其他按钮 |
|||
console.log('其他按钮', item) |
|||
} |
|||
} |
|||
|
|||
// 列表-操作按钮 |
|||
const butttondata = (row,$index) => { |
|||
const findIndex = row['masterId']?tableObject.tableList.findIndex(item=>item['masterId'] == row['masterId']):-1 |
|||
if(findIndex>-1&&findIndex<$index){ |
|||
return [] |
|||
}else{ |
|||
return [defaultButtons.mainListDocumentPrintBtn(null),] // 标签打印 |
|||
} |
|||
} |
|||
|
|||
// 列表-操作按钮事件 |
|||
const buttonTableClick = async (val, row) => { |
|||
if (val == 'documentPrint') { // 标签打印 |
|||
handlePoint(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,'recordDeliverMain') |
|||
} |
|||
|
|||
/** 导出按钮操作 */ |
|||
const handleExport = async () => { |
|||
try { |
|||
// 导出的二次确认 |
|||
await message.exportConfirm() |
|||
// 发起导出 |
|||
loadStart() |
|||
const excelTitle = ref(route.meta.title) |
|||
const data = await DeliverRecordMainApi.exportDeliverRecordMain(tableObject.params) |
|||
download.excel(data, `【${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) |
|||
} catch { |
|||
} finally { |
|||
loadDone() |
|||
} |
|||
} |
|||
|
|||
const BASE_URL = getJmreportBaseUrl() |
|||
const src = ref(BASE_URL + '/jmreport/view/929209659733770240?token=' + getAccessToken()) |
|||
// 标签打印 |
|||
const handlePoint = async (row) => { |
|||
window.open(src.value+'&id='+row.masterId) |
|||
} |
|||
|
|||
// 筛选提交 |
|||
const searchFormClick = (searchData) => { |
|||
tableObject.params.isSearch = true |
|||
console.log('searchData',searchData.filters); |
|||
if(!searchData.filters){//重置的时候应用 |
|||
searchData.filters = [] |
|||
} |
|||
let filters = [...searchData.filters] |
|||
if(!filters.find(item=>item.column=='business_type')){ |
|||
filters = [...filters,{ |
|||
action:'==', |
|||
column:'business_type', |
|||
value:'FtSuppliesRecordMain', |
|||
}] |
|||
} |
|||
tableObject.params.filters = filters |
|||
getList() // 刷新当前列表 |
|||
} |
|||
|
|||
/** 导入 */ |
|||
const importFormRef = ref() |
|||
const handleImport = () => { |
|||
importFormRef.value.open() |
|||
} |
|||
|
|||
// 导入成功之后 |
|||
const importSuccess = () => { |
|||
getList() |
|||
} |
|||
|
|||
|
|||
/** 初始化 **/ |
|||
onMounted(async () => { |
|||
tableObject.params.businessType = 'FtSuppliesRecordMain' |
|||
getList() |
|||
|
|||
}) |
|||
</script> |
Loading…
Reference in new issue