Browse Source

4、原材料清单增加工序字段,需要下拉选择

5、原材料清单需要设置成只有试验负责人才有权限增删改
master
han\hanst 2 weeks ago
parent
commit
49e4d7dce7
  1. 175
      src/views/modules/erf/components/expRawMaterialList.vue
  2. 7
      src/views/modules/erf/expApplyList.vue

175
src/views/modules/erf/components/expRawMaterialList.vue

@ -7,7 +7,7 @@
type="primary" type="primary"
size="small" size="small"
class="add-btn" class="add-btn"
v-if="!disabled"
v-if="canEdit"
@click="openAddDialog"> @click="openAddDialog">
新增物料 新增物料
</el-button> </el-button>
@ -15,11 +15,16 @@
type="primary" type="primary"
size="small" size="small"
class="reset-btn" class="reset-btn"
v-if="!disabled"
v-if="canEdit"
:disabled="selectedRows.length === 0" :disabled="selectedRows.length === 0"
@click="batchDeleteRawMaterial"> @click="batchDeleteRawMaterial">
批量删除 批量删除
</el-button> </el-button>
<span
v-if="!disabled && !canEdit"
style="margin-left: 8px; color: #909399; font-size: 12px;">
仅试验负责人可维护原材料清单
</span>
</div> </div>
<!-- 数据表格 --> <!-- 数据表格 -->
@ -37,7 +42,7 @@
type="selection" type="selection"
width="55" width="55"
align="center" align="center"
v-if="!disabled">
v-if="canEdit">
</el-table-column> </el-table-column>
<!-- 序号 --> <!-- 序号 -->
@ -71,6 +76,19 @@
show-overflow-tooltip> show-overflow-tooltip>
</el-table-column> </el-table-column>
<!-- 工序 -->
<el-table-column
prop="processStep"
label="工序"
min-width="140"
align="center"
header-align="center"
show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.processStep || '-' }}
</template>
</el-table-column>
<!-- 数量 --> <!-- 数量 -->
<el-table-column <el-table-column
prop="quantity" prop="quantity"
@ -111,7 +129,7 @@
width="150" width="150"
align="center" align="center"
header-align="center" header-align="center"
v-if="!disabled">
v-if="canEdit">
<template slot-scope="scope"> <template slot-scope="scope">
<el-link <el-link
style="cursor:pointer; margin-right: 10px;" style="cursor:pointer; margin-right: 10px;"
@ -136,6 +154,23 @@
:close-on-click-modal="false"> :close-on-click-modal="false">
<el-form :model="formData" label-width="80px" size="small"> <el-form :model="formData" label-width="80px" size="small">
<el-form-item label="工序" required>
<el-select
v-model="formData.processStep"
placeholder="请选择工序"
filterable
clearable
:loading="processOptionsLoading"
style="width: 100%">
<el-option
v-for="item in processOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="物料编码"> <el-form-item label="物料编码">
<el-input <el-input
v-model="formData.partNo" v-model="formData.partNo"
@ -198,6 +233,7 @@
<script> <script>
import { getRawMaterialList, saveRawMaterial, deleteRawMaterial, batchDeleteRawMaterial, getPartDescByPartNo } from '@/api/erf/erf' import { getRawMaterialList, saveRawMaterial, deleteRawMaterial, batchDeleteRawMaterial, getPartDescByPartNo } from '@/api/erf/erf'
import { searchStandardRoutingOperationList } from '@/api/part/standardRoutingOperation'
export default { export default {
name: 'ExpRawMaterialList', name: 'ExpRawMaterialList',
@ -218,6 +254,16 @@ export default {
type: String, type: String,
default: '' default: ''
}, },
//
projectLeader: {
type: String,
default: ''
},
//
projectLeaderName: {
type: String,
default: ''
},
// //
disabled: { disabled: {
type: Boolean, type: Boolean,
@ -248,6 +294,7 @@ export default {
applyNo: '', applyNo: '',
site: '', site: '',
buNo: '', buNo: '',
processStep: '',
partNo: '', partNo: '',
partDesc: '', partDesc: '',
quantity: '', quantity: '',
@ -256,7 +303,13 @@ export default {
}, },
// //
saveLoading: false
saveLoading: false,
//
processOptions: [],
//
processOptionsLoading: false
} }
}, },
@ -269,6 +322,44 @@ export default {
if (newVal) { if (newVal) {
this.loadRawMaterialList() 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() { openAddDialog() {
this.loadProcessOptions()
this.dialogTitle = '新增物料' this.dialogTitle = '新增物料'
this.formData = { this.formData = {
id: null, id: null,
applyNo: this.applyNo, applyNo: this.applyNo,
site: this.site || this.$store.state.user.site, site: this.site || this.$store.state.user.site,
buNo: this.buNo, buNo: this.buNo,
processStep: '',
partNo: '', partNo: '',
partDesc: '', partDesc: '',
quantity: '', quantity: '',
@ -326,12 +483,14 @@ export default {
applyNo: row.applyNo, applyNo: row.applyNo,
site: row.site, site: row.site,
buNo: this.buNo, buNo: this.buNo,
processStep: row.processStep || '',
partNo: row.partNo, partNo: row.partNo,
partDesc: row.partDesc, partDesc: row.partDesc,
quantity: row.quantity, quantity: row.quantity,
umid: row.umid || '', umid: row.umid || '',
remark: row.remark remark: row.remark
} }
this.ensureProcessOption(this.formData.processStep)
this.dialogVisible = true this.dialogVisible = true
}, },
@ -345,6 +504,11 @@ export default {
return return
} }
if (!this.formData.processStep) {
this.$message.warning('请选择工序')
return
}
const qty = Number(this.formData.quantity) const qty = Number(this.formData.quantity)
if (isNaN(qty) || qty <= 0) { if (isNaN(qty) || qty <= 0) {
this.$message.warning('请输入有效数字(必须大于0)') this.$message.warning('请输入有效数字(必须大于0)')
@ -358,6 +522,7 @@ export default {
id: this.formData.id, id: this.formData.id,
applyNo: this.formData.applyNo, applyNo: this.formData.applyNo,
site: this.formData.site, site: this.formData.site,
processStep: this.formData.processStep,
partNo: this.formData.partNo || null, partNo: this.formData.partNo || null,
partDesc: this.formData.partDesc, partDesc: this.formData.partDesc,
quantity: this.formData.quantity, quantity: this.formData.quantity,

7
src/views/modules/erf/expApplyList.vue

@ -329,6 +329,8 @@
:apply-no="currentRow.applyNo" :apply-no="currentRow.applyNo"
:site="currentRow.site || $store.state.user.site" :site="currentRow.site || $store.state.user.site"
:buNo="currentRow.buNo" :buNo="currentRow.buNo"
:project-leader="currentRow.projectLeader"
:project-leader-name="currentRow.projectLeaderName"
:disabled="currentRow.status === '已完成' || currentRow.status === '已取消'" :disabled="currentRow.status === '已完成' || currentRow.status === '已取消'"
:height="detailHeight"> :height="detailHeight">
</exp-raw-material-list> </exp-raw-material-list>
@ -1647,17 +1649,20 @@ export default {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.sendLoading = true
cancelExpApply({ cancelExpApply({
applyNo: this.currentRow.applyNo, applyNo: this.currentRow.applyNo,
currentUserId: this.$store.state.user.id currentUserId: this.$store.state.user.id
}).then(({data}) => { }).then(({data}) => {
this.sendLoading = false
if (data && data.code === 0) { if (data && data.code === 0) {
this.$message.success('取消成功')
this.$message.success(data.msg || '取消成功')
this.getDataList() this.getDataList()
} else { } else {
this.$message.error(data.msg || '取消失败') this.$message.error(data.msg || '取消失败')
} }
}).catch(() => { }).catch(() => {
this.sendLoading = false
this.$message.error('取消异常') this.$message.error('取消异常')
}) })
}) })

Loading…
Cancel
Save