diff --git a/src/pages_function/pages/materialCheck/index.vue b/src/pages_function/pages/materialCheck/index.vue
index 7193a67..4296adb 100644
--- a/src/pages_function/pages/materialCheck/index.vue
+++ b/src/pages_function/pages/materialCheck/index.vue
@@ -78,12 +78,12 @@
{{ textValue(item.remark) }}
-
- 通过
- 驳回
- 提交
- 盘点
- 删除
+
+ 通过
+ 驳回
+ 提交
+ 盘点
+ 删除
@@ -110,7 +110,7 @@
✕
-
+
*审核人
{{ selectedSubmitAuditor ? selectedSubmitAuditor.label : '请选择' }}
@@ -146,18 +146,26 @@ import NavBar from '@/components/common/NavBar.vue'
import { getMaterialCheckPage, deleteMaterialCheck, submitMaterialCheck, auditMaterialCheck } from '@/api/mes/materialCheck'
import { getWarehouseSimpleList } from '@/api/mes/sparepart'
import { getSimpleUserList } from '@/api/mes/moldget'
+import { getConfigPage } from '@/api/infra/config'
+import { DICT_TYPE, useDict } from '@/utils/dict'
const selectedStatus = ref('')
const searchKeyword = ref('')
const materialWarehouseId = ref('')
-const statusOptions = computed(() => [
- { label: '全部', value: '' },
- { label: '待提交', value: '0' },
- { label: '审核中', value: '10' },
- { label: '已通过', value: '20' },
- { label: '已驳回', value: '1' }
-])
+const statusOptions = computed(() => {
+ const dictOptions = (erp_audit_status.value || [])
+ .filter((item) => item?.label !== undefined && item?.value !== undefined)
+ .map((item) => ({ ...item, value: String(item.value) }))
+ if (dictOptions.length) return [{ label: '全部', value: '' }, ...dictOptions]
+ return [
+ { label: '全部', value: '' },
+ { label: '待提交', value: '0' },
+ { label: '审核中', value: '10' },
+ { label: '已通过', value: '20' },
+ { label: '已驳回', value: '1' }
+ ]
+})
const statusLabels = computed(() => statusOptions.value.map((item) => item.label))
const statusIndex = computed(() => {
@@ -179,6 +187,22 @@ const showGoTop = ref(false)
let searchTimer = null
+// 审核配置
+const isAuditDisabled = ref(false)
+const { erp_audit_status } = useDict(DICT_TYPE.ERP_AUDIT_STATUS)
+
+async function loadAuditConfig() {
+ try {
+ const res = await getConfigPage({ pageNo: 1, pageSize: 10, key: 'inventoryAudit' })
+ const root = res && res.data !== undefined ? res.data : res
+ const rows = root?.list || root?.rows || root?.records || []
+ const config = Array.isArray(rows) ? rows.find((item) => item?.key === 'inventoryAudit') : null
+ isAuditDisabled.value = config?.value === '0'
+ } catch (e) {
+ isAuditDisabled.value = false
+ }
+}
+
async function loadMaterialWarehouse() {
try {
const res = await getWarehouseSimpleList()
@@ -230,10 +254,8 @@ function statusClass(s) {
return ''
}
-const CHECK_STATUS_MAP = { 0: '未盘点', 1: '已盘点' }
function checkStatusText(s) {
- const num = Number(s)
- return CHECK_STATUS_MAP[num] || textValue(num)
+ return Number(s) === 1 ? '已盘点' : '未盘点'
}
function checkStatusClass(s) {
const num = Number(s)
@@ -326,29 +348,47 @@ function openDetail(item) {
})
}
-function showActions(item) {
- if (!item) return false
- const status = Number(item.status)
- const checkStatus = Number(item.checkStatus)
- if (status === 10) return true
- if ((status === 0 || status === 1) && checkStatus === 1) return true
- if (checkStatus !== 1 && status !== 20) return true
- if (status !== 20) return true
- return false
+function statusValue(item) {
+ return Number(item?.status)
+}
+
+function isChecked(item) {
+ return Number(item?.checkStatus) === 1
+}
+
+function shouldShowExecute(item) {
+ return !isChecked(item) || statusValue(item) === 1
+}
+
+function isExecuteDisabled(item) {
+ return statusValue(item) === 20
+}
+
+function canExecute(item) {
+ return shouldShowExecute(item) && !isExecuteDisabled(item)
+}
+
+function canSubmitAudit(item) {
+ const status = statusValue(item)
+ const submitStatuses = isAuditDisabled.value ? [0, 1, 10] : [0, 1]
+ return submitStatuses.includes(status) && isChecked(item)
+}
+
+function canAudit(item) {
+ return !isAuditDisabled.value && statusValue(item) === 10 && isChecked(item)
}
-function showSubmit(item) {
- if (!item) return false
- const status = Number(item.status)
- const checkStatus = Number(item.checkStatus)
- return (status === 0 || status === 1) && checkStatus === 1
+function canDelete(item) {
+ return statusValue(item) !== 20
}
-function showCheck(item) {
- if (!item) return false
- const checkStatus = Number(item.checkStatus)
- const status = Number(item.status)
- return checkStatus !== 1 && status !== 20
+function hasActions(item) {
+ return shouldShowExecute(item) || canSubmitAudit(item) || canAudit(item) || canDelete(item)
+}
+
+function handleExecute(item) {
+ if (!canExecute(item)) return
+ goExecute(item)
}
const showSubmitModal = ref(false)
@@ -396,13 +436,25 @@ async function loadSubmitAuditorOptions() {
}
async function confirmSubmitAudit() {
- if (!selectedSubmitAuditor.value) {
+ if (!currentSubmitItem.value?.id) return
+ if (!isAuditDisabled.value && !selectedSubmitAuditor.value) {
uni.showToast({ title: '请选择审核人', icon: 'none' })
return
}
- if (!currentSubmitItem.value?.id) return
try {
uni.showLoading({ title: '提交中...', mask: true })
+ if (isAuditDisabled.value) {
+ await auditMaterialCheck({
+ id: currentSubmitItem.value.id,
+ status: 20,
+ remark: submitRemark.value || undefined
+ })
+ uni.hideLoading()
+ uni.showToast({ title: '提交成功', icon: 'success' })
+ closeSubmitDialog()
+ fetchList(true)
+ return
+ }
await submitMaterialCheck({
id: currentSubmitItem.value.id,
auditUserId: selectedSubmitAuditor.value.value,
@@ -520,6 +572,7 @@ function clearSearchTimer() {
onShow(async () => {
await loadMaterialWarehouse()
+ loadAuditConfig()
fetchList(true)
})
@@ -723,6 +776,11 @@ onUnload(() => {
color: #dc2626;
}
+ &.action-btn-disabled {
+ background: #f1f5f7;
+ color: #94a3b8;
+ }
+
&:active {
opacity: 0.8;
}
diff --git a/src/pages_function/pages/moldRepair/form.vue b/src/pages_function/pages/moldRepair/form.vue
index b5ec152..73f7fc5 100644
--- a/src/pages_function/pages/moldRepair/form.vue
+++ b/src/pages_function/pages/moldRepair/form.vue
@@ -242,7 +242,7 @@