|
|
|
|
@ -231,7 +231,7 @@
|
|
|
|
|
@click="openSubmitDialog(scope.row)"
|
|
|
|
|
v-hasPermi="['erp:stock-out:update-status']"
|
|
|
|
|
>
|
|
|
|
|
{{ t('ErpStock.Out.submitAudit') }}
|
|
|
|
|
{{ submitActionText }}
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button
|
|
|
|
|
v-if="Number(scope.row.status) === 10"
|
|
|
|
|
@ -275,9 +275,9 @@
|
|
|
|
|
<!-- 琛ㄥ崟闈㈡澘锛氭坊鍔?淇敼 -->
|
|
|
|
|
<StockOutForm v-else ref="formRef" @success="getList" @closed="formVisible = false" />
|
|
|
|
|
|
|
|
|
|
<Dialog :title="t('ErpStock.Out.submitAudit')" v-model="submitDialogVisible" width="520px">
|
|
|
|
|
<Dialog :title="submitActionText" v-model="submitDialogVisible" width="520px">
|
|
|
|
|
<el-form ref="submitFormRef" :model="submitFormData" :rules="submitFormRules" label-width="90px">
|
|
|
|
|
<el-form-item :label="t('ErpStock.Out.auditUser')" prop="auditUserId">
|
|
|
|
|
<el-form-item v-if="!isAuditDisabled" :label="t('ErpStock.Out.auditUser')" prop="auditUserId">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="submitFormData.auditUserId"
|
|
|
|
|
clearable
|
|
|
|
|
@ -338,6 +338,7 @@ import { WarehouseApi, WarehouseVO } from '@/api/erp/stock/warehouse'
|
|
|
|
|
import { UserVO } from '@/api/system/user'
|
|
|
|
|
import * as UserApi from '@/api/system/user'
|
|
|
|
|
import { erpCountTableColumnFormatter, erpPriceTableColumnFormatter } from '@/utils'
|
|
|
|
|
import * as ConfigApi from '@/api/infra/config'
|
|
|
|
|
|
|
|
|
|
/** ERP 鍏跺畠鍏ュ簱鍗曞垪琛?*/
|
|
|
|
|
defineOptions({ name: 'ErpStockOut' })
|
|
|
|
|
@ -384,6 +385,8 @@ const userList = ref<UserVO[]>([]) // 鐢ㄦ埛鍒楄〃
|
|
|
|
|
|
|
|
|
|
const formVisible = ref(false) // 琛ㄥ崟鏄惁鍙
|
|
|
|
|
const actionLoading = ref(false)
|
|
|
|
|
const isAuditDisabled = ref(false)
|
|
|
|
|
const submitActionText = computed(() => isAuditDisabled.value ? '出库' : t('ErpStock.Out.submitAudit'))
|
|
|
|
|
const submitDialogVisible = ref(false)
|
|
|
|
|
const submitFormRef = ref()
|
|
|
|
|
const submitFormData = reactive({
|
|
|
|
|
@ -391,7 +394,7 @@ const submitFormData = reactive({
|
|
|
|
|
auditUserId: '',
|
|
|
|
|
remark: ''
|
|
|
|
|
})
|
|
|
|
|
const submitFormRules = reactive({
|
|
|
|
|
const submitFormRules = computed(() => isAuditDisabled.value ? {} : {
|
|
|
|
|
auditUserId: [{ required: true, message: t('ErpStock.Out.validatorAuditUserRequired'), trigger: 'change' }]
|
|
|
|
|
})
|
|
|
|
|
const auditDialogVisible = ref(false)
|
|
|
|
|
@ -404,10 +407,21 @@ const auditFormData = reactive({
|
|
|
|
|
const auditDialogTitle = computed(() => auditFormData.status === '20' ? t('ErpStock.Out.auditApprove') : t('ErpStock.Out.auditReject'))
|
|
|
|
|
const auditRemarkPlaceholder = computed(() => auditFormData.status === '20' ? t('ErpStock.Out.placeholderAuditApproveRemark') : t('ErpStock.Out.placeholderAuditRejectRemark'))
|
|
|
|
|
|
|
|
|
|
const loadAuditConfig = async () => {
|
|
|
|
|
try {
|
|
|
|
|
const data = await ConfigApi.getConfigPage({ pageNo: 1, pageSize: 10, key: 'isAudit' } as PageParam & { key: string })
|
|
|
|
|
const auditConfig = data?.list?.find((item) => item?.key === 'isAudit')
|
|
|
|
|
isAuditDisabled.value = auditConfig?.value === '0'
|
|
|
|
|
} catch {
|
|
|
|
|
isAuditDisabled.value = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 鏌ヨ鍒楄〃 */
|
|
|
|
|
const getList = async () => {
|
|
|
|
|
loading.value = true
|
|
|
|
|
try {
|
|
|
|
|
await loadAuditConfig()
|
|
|
|
|
const data = await StockOutApi.getStockOutPage(queryParams)
|
|
|
|
|
list.value = data.list
|
|
|
|
|
total.value = data.total
|
|
|
|
|
@ -461,14 +475,19 @@ const openSubmitDialog = (row: StockOutVO) => {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleSubmitStockOut = async () => {
|
|
|
|
|
await submitFormRef.value.validate()
|
|
|
|
|
if (!isAuditDisabled.value) {
|
|
|
|
|
await submitFormRef.value.validate()
|
|
|
|
|
}
|
|
|
|
|
actionLoading.value = true
|
|
|
|
|
try {
|
|
|
|
|
await StockOutApi.submitStockOut({
|
|
|
|
|
const data: { id: string; auditUserId?: string; remark?: string } = {
|
|
|
|
|
id: submitFormData.id,
|
|
|
|
|
auditUserId: submitFormData.auditUserId,
|
|
|
|
|
remark: submitFormData.remark
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
if (!isAuditDisabled.value) {
|
|
|
|
|
data.auditUserId = submitFormData.auditUserId
|
|
|
|
|
}
|
|
|
|
|
await StockOutApi.submitStockOut(data as { id: string; auditUserId: string; remark?: string })
|
|
|
|
|
message.success(t('ErpStock.Out.submitSuccess'))
|
|
|
|
|
submitDialogVisible.value = false
|
|
|
|
|
await getList()
|
|
|
|
|
|