|
|
|
|
@ -237,7 +237,7 @@
|
|
|
|
|
|
|
|
|
|
<Dialog :title="t('ErpStock.Move.submit')" v-model="submitDialogVisible" width="500">
|
|
|
|
|
<el-form ref="submitFormRef" :model="submitForm" :rules="submitRules" label-width="auto">
|
|
|
|
|
<el-form-item :label="t('ErpStock.Move.auditUserName')" prop="auditUserId">
|
|
|
|
|
<el-form-item v-if="!isAuditDisabled" :label="t('ErpStock.Move.auditUserName')" prop="auditUserId">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="submitForm.auditUserId"
|
|
|
|
|
filterable
|
|
|
|
|
@ -301,6 +301,7 @@ import { ProductApi, ProductVO } from '@/api/erp/product/product'
|
|
|
|
|
import { WarehouseApi, WarehouseVO } from '@/api/erp/stock/warehouse'
|
|
|
|
|
import { UserVO } from '@/api/system/user'
|
|
|
|
|
import * as UserApi from '@/api/system/user'
|
|
|
|
|
import * as ConfigApi from '@/api/infra/config'
|
|
|
|
|
import { erpCountTableColumnFormatter, erpPriceTableColumnFormatter } from '@/utils'
|
|
|
|
|
|
|
|
|
|
/** ERP 库存调度单列表 */
|
|
|
|
|
@ -331,14 +332,15 @@ const userList = ref<UserVO[]>([]) // 用户列表
|
|
|
|
|
const submitFormRef = ref()
|
|
|
|
|
const submitDialogVisible = ref(false)
|
|
|
|
|
const submitLoading = ref(false)
|
|
|
|
|
const isAuditDisabled = ref(false)
|
|
|
|
|
const submitForm = reactive({
|
|
|
|
|
id: undefined as number | undefined,
|
|
|
|
|
auditUserId: undefined as number | undefined,
|
|
|
|
|
remark: undefined as string | undefined
|
|
|
|
|
})
|
|
|
|
|
const submitRules = {
|
|
|
|
|
const submitRules = computed(() => isAuditDisabled.value ? {} : {
|
|
|
|
|
auditUserId: [{ required: true, message: t('ErpStock.Move.validatorAuditUserRequired'), trigger: 'change' }]
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
const auditDialogVisible = ref(false)
|
|
|
|
|
const auditLoading = ref(false)
|
|
|
|
|
const auditForm = reactive({
|
|
|
|
|
@ -349,11 +351,21 @@ const auditForm = reactive({
|
|
|
|
|
const auditDialogTitle = computed(() =>
|
|
|
|
|
auditForm.status === 20 ? t('ErpStock.Move.auditApprove') : t('ErpStock.Move.auditReject')
|
|
|
|
|
)
|
|
|
|
|
const loadAuditConfig = async () => {
|
|
|
|
|
try {
|
|
|
|
|
const data = await ConfigApi.getConfigPage({ pageNo: 1, pageSize: 10, key: 'transferAduit' } as PageParam & { key: string })
|
|
|
|
|
const auditConfig = data?.list?.find((item) => item?.key === 'transferAduit')
|
|
|
|
|
isAuditDisabled.value = auditConfig?.value === '0'
|
|
|
|
|
} catch {
|
|
|
|
|
isAuditDisabled.value = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 查询列表 */
|
|
|
|
|
const getList = async () => {
|
|
|
|
|
loading.value = true
|
|
|
|
|
try {
|
|
|
|
|
await loadAuditConfig()
|
|
|
|
|
const data = await StockMoveApi.getStockMovePage(queryParams)
|
|
|
|
|
list.value = data.list
|
|
|
|
|
total.value = data.total
|
|
|
|
|
@ -403,16 +415,27 @@ const openSubmitDialog = (row: StockMoveVO) => {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleSubmit = async () => {
|
|
|
|
|
await submitFormRef.value.validate()
|
|
|
|
|
if (!submitForm.id || !submitForm.auditUserId) return
|
|
|
|
|
if (!isAuditDisabled.value) {
|
|
|
|
|
await submitFormRef.value.validate()
|
|
|
|
|
}
|
|
|
|
|
if (!submitForm.id || (!isAuditDisabled.value && !submitForm.auditUserId)) return
|
|
|
|
|
submitLoading.value = true
|
|
|
|
|
try {
|
|
|
|
|
await StockMoveApi.submitStockMove({
|
|
|
|
|
id: submitForm.id,
|
|
|
|
|
auditUserId: submitForm.auditUserId,
|
|
|
|
|
remark: submitForm.remark
|
|
|
|
|
})
|
|
|
|
|
message.success(t('ErpStock.Move.submitSuccess'))
|
|
|
|
|
if (isAuditDisabled.value) {
|
|
|
|
|
await StockMoveApi.auditStockMove({
|
|
|
|
|
id: submitForm.id,
|
|
|
|
|
status: 20,
|
|
|
|
|
remark: submitForm.remark
|
|
|
|
|
})
|
|
|
|
|
message.success(t('ErpStock.Move.auditApproveSuccess'))
|
|
|
|
|
} else {
|
|
|
|
|
await StockMoveApi.submitStockMove({
|
|
|
|
|
id: submitForm.id,
|
|
|
|
|
auditUserId: submitForm.auditUserId,
|
|
|
|
|
remark: submitForm.remark
|
|
|
|
|
})
|
|
|
|
|
message.success(t('ErpStock.Move.submitSuccess'))
|
|
|
|
|
}
|
|
|
|
|
submitDialogVisible.value = false
|
|
|
|
|
await getList()
|
|
|
|
|
} finally {
|
|
|
|
|
|