diff --git a/src/views/modules/erf/components/expRawMaterialList.vue b/src/views/modules/erf/components/expRawMaterialList.vue
index 732db1c..bebfd70 100644
--- a/src/views/modules/erf/components/expRawMaterialList.vue
+++ b/src/views/modules/erf/components/expRawMaterialList.vue
@@ -7,7 +7,7 @@
type="primary"
size="small"
class="add-btn"
- v-if="!disabled"
+ v-if="canEdit"
@click="openAddDialog">
新增物料
@@ -15,11 +15,16 @@
type="primary"
size="small"
class="reset-btn"
- v-if="!disabled"
+ v-if="canEdit"
:disabled="selectedRows.length === 0"
@click="batchDeleteRawMaterial">
批量删除
+
+ 仅试验负责人可维护原材料清单
+
@@ -37,7 +42,7 @@
type="selection"
width="55"
align="center"
- v-if="!disabled">
+ v-if="canEdit">
@@ -71,6 +76,19 @@
show-overflow-tooltip>
+
+
+
+ {{ scope.row.processStep || '-' }}
+
+
+
+ v-if="canEdit">
+
+
+
+
+
+
+
import { getRawMaterialList, saveRawMaterial, deleteRawMaterial, batchDeleteRawMaterial, getPartDescByPartNo } from '@/api/erf/erf'
+import { searchStandardRoutingOperationList } from '@/api/part/standardRoutingOperation'
export default {
name: 'ExpRawMaterialList',
@@ -218,6 +254,16 @@ export default {
type: String,
default: ''
},
+ // 试验负责人(显示名)
+ projectLeader: {
+ type: String,
+ default: ''
+ },
+ // 试验负责人(用户名)
+ projectLeaderName: {
+ type: String,
+ default: ''
+ },
// 是否禁用编辑
disabled: {
type: Boolean,
@@ -248,6 +294,7 @@ export default {
applyNo: '',
site: '',
buNo: '',
+ processStep: '',
partNo: '',
partDesc: '',
quantity: '',
@@ -256,7 +303,13 @@ export default {
},
// 保存加载状态
- saveLoading: false
+ saveLoading: false,
+
+ // 标准工序下拉选项
+ processOptions: [],
+
+ // 标准工序加载状态
+ processOptionsLoading: false
}
},
@@ -269,6 +322,44 @@ export default {
if (newVal) {
this.loadRawMaterialList()
}
+ },
+ buNo(newVal, oldVal) {
+ if (newVal !== oldVal) {
+ if (this.canEdit) {
+ this.loadProcessOptions()
+ } else {
+ this.processOptions = []
+ }
+ }
+ },
+ canEdit(newVal) {
+ if (newVal) {
+ this.loadProcessOptions()
+ } else {
+ this.processOptions = []
+ }
+ }
+ },
+
+ computed: {
+ /**
+ * 是否可编辑原材料清单(仅试验负责人)
+ */
+ canEdit() {
+ if (this.disabled) {
+ return false
+ }
+ const currentUserName = (this.$store.state.user.name || '').trim()
+ const currentUserDisplay = (this.$store.state.user.userDisplay || '').trim()
+ const leaderList = [this.projectLeaderName, this.projectLeader]
+ .filter(item => item && item.trim())
+ .map(item => item.trim())
+
+ if (leaderList.length === 0) {
+ return false
+ }
+
+ return leaderList.some(item => item === currentUserName || item === currentUserDisplay)
}
},
@@ -297,16 +388,82 @@ export default {
})
},
+ /**
+ * 按BU加载标准工序下拉
+ */
+ loadProcessOptions() {
+ if (!this.buNo) {
+ this.processOptions = []
+ return
+ }
+
+ this.processOptionsLoading = true
+ const queryData = {
+ userName: this.$store.state.user.name,
+ site: this.site || this.$store.state.user.site,
+ buNo: this.buNo,
+ page: 1,
+ limit: 500
+ }
+
+ searchStandardRoutingOperationList(queryData).then(({data}) => {
+ this.processOptionsLoading = false
+ if (data && data.code === 0) {
+ const list = (data.page && data.page.list) ? data.page.list : []
+ const optionMap = {}
+ list.forEach(item => {
+ const processName = item.operationName ? item.operationName.trim() : ''
+ if (!processName) {
+ return
+ }
+ if (!optionMap[processName]) {
+ const hasOperationNo = item.operationNo !== null && item.operationNo !== undefined && item.operationNo !== ''
+ optionMap[processName] = {
+ value: processName,
+ label: hasOperationNo ? `${item.operationNo} - ${processName}` : processName
+ }
+ }
+ })
+ this.processOptions = Object.values(optionMap)
+ } else {
+ this.processOptions = []
+ this.$message.error(data.msg || '加载标准工序失败')
+ }
+ }).catch(() => {
+ this.processOptionsLoading = false
+ this.processOptions = []
+ this.$message.error('加载标准工序异常')
+ })
+ },
+
+ /**
+ * 编辑场景兜底:已选工序不在下拉时补充显示
+ */
+ ensureProcessOption(processStep) {
+ if (!processStep) {
+ return
+ }
+ const exists = this.processOptions.some(item => item.value === processStep)
+ if (!exists) {
+ this.processOptions.push({
+ value: processStep,
+ label: processStep
+ })
+ }
+ },
+
/**
* 打开新增弹窗
*/
openAddDialog() {
+ this.loadProcessOptions()
this.dialogTitle = '新增物料'
this.formData = {
id: null,
applyNo: this.applyNo,
site: this.site || this.$store.state.user.site,
buNo: this.buNo,
+ processStep: '',
partNo: '',
partDesc: '',
quantity: '',
@@ -326,12 +483,14 @@ export default {
applyNo: row.applyNo,
site: row.site,
buNo: this.buNo,
+ processStep: row.processStep || '',
partNo: row.partNo,
partDesc: row.partDesc,
quantity: row.quantity,
umid: row.umid || '',
remark: row.remark
}
+ this.ensureProcessOption(this.formData.processStep)
this.dialogVisible = true
},
@@ -345,6 +504,11 @@ export default {
return
}
+ if (!this.formData.processStep) {
+ this.$message.warning('请选择工序')
+ return
+ }
+
const qty = Number(this.formData.quantity)
if (isNaN(qty) || qty <= 0) {
this.$message.warning('请输入有效数字(必须大于0)')
@@ -358,6 +522,7 @@ export default {
id: this.formData.id,
applyNo: this.formData.applyNo,
site: this.formData.site,
+ processStep: this.formData.processStep,
partNo: this.formData.partNo || null,
partDesc: this.formData.partDesc,
quantity: this.formData.quantity,
diff --git a/src/views/modules/erf/expApplyList.vue b/src/views/modules/erf/expApplyList.vue
index a6ae395..b35a97e 100644
--- a/src/views/modules/erf/expApplyList.vue
+++ b/src/views/modules/erf/expApplyList.vue
@@ -329,6 +329,8 @@
:apply-no="currentRow.applyNo"
:site="currentRow.site || $store.state.user.site"
:buNo="currentRow.buNo"
+ :project-leader="currentRow.projectLeader"
+ :project-leader-name="currentRow.projectLeaderName"
:disabled="currentRow.status === '已完成' || currentRow.status === '已取消'"
:height="detailHeight">
@@ -1647,17 +1649,20 @@ export default {
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
+ this.sendLoading = true
cancelExpApply({
applyNo: this.currentRow.applyNo,
currentUserId: this.$store.state.user.id
}).then(({data}) => {
+ this.sendLoading = false
if (data && data.code === 0) {
- this.$message.success('取消成功')
+ this.$message.success(data.msg || '取消成功')
this.getDataList()
} else {
this.$message.error(data.msg || '取消失败')
}
}).catch(() => {
+ this.sendLoading = false
this.$message.error('取消异常')
})
})