|
@@ -110,7 +110,7 @@
|
|
|
</el-row>
|
|
|
<el-row>
|
|
|
<div class="title"><span style="color: red">*</span> 关联图纸</div>
|
|
|
- <el-table :data="dataForm.drawingList" border style="width: 100%;">
|
|
|
+ <el-table :data="drawingList" border style="width: 100%;">
|
|
|
<el-table-column label="序号" type="index" width="50" align="center">
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="drawingName" header-align="center" align="center" label="图纸名称">
|
|
@@ -121,6 +121,11 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="notes" header-align="center" align="center" label="备注">
|
|
|
</el-table-column>
|
|
|
+ <el-table-column header-align="center" align="center" label="操作">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button type="text" size="small" @click="removeDrawingItem(scope.$index)">移除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
</el-table>
|
|
|
<el-row style="text-align: center; margin-top: 10px;">
|
|
|
<el-button v-show="!display" type="primary" icon="el-icon-plus" @click="addDrawingList"></el-button>
|
|
@@ -162,12 +167,14 @@
|
|
|
<!-- </el-dialog> -->
|
|
|
<template-chose v-if="productListVisible" ref="productList" @addItems="addProductItems" />
|
|
|
<templateChoseMaterial v-if="materialListVisible" ref="materialList" @addItems="addMaterialItems" />
|
|
|
+ <template-draw-choose v-if="drawListVisible" ref="drawList" @addItems="addDrawItems" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import templateChose from '../product/template-chose'
|
|
|
import templateChoseMaterial from '../product/template-chose-material'
|
|
|
+import templateDrawChoose from './draw-template-choose'
|
|
|
import { getDictList } from '@/api/dict'
|
|
|
import { getProductDetail } from '@/api/product'
|
|
|
import UploadComponent from '../common/upload-component-v2'
|
|
@@ -178,7 +185,7 @@ import DocComponents from '../common/doc-components'
|
|
|
|
|
|
export default {
|
|
|
name: 'product-add-or-update',
|
|
|
- components: { DocComponents, DrawComponents, CusComponent, UploadComponent, templateChose, templateChoseMaterial },
|
|
|
+ components: { DocComponents, DrawComponents, CusComponent, UploadComponent, templateChose, templateChoseMaterial, templateDrawChoose },
|
|
|
computed: {
|
|
|
orgId: {
|
|
|
get () { return this.$store.state.user.orgId }
|
|
@@ -193,6 +200,7 @@ export default {
|
|
|
return {
|
|
|
productListVisible: false,
|
|
|
materialListVisible: false,
|
|
|
+ drawListVisible: false,
|
|
|
visible: false,
|
|
|
display: false,
|
|
|
optionsType: [],
|
|
@@ -203,8 +211,11 @@ export default {
|
|
|
id: 0,
|
|
|
productDetails: [],
|
|
|
materialList: [],
|
|
|
+ drawingList: [],
|
|
|
displayProductList: false,
|
|
|
- dataForm: {},
|
|
|
+ dataForm: {
|
|
|
+ drawingList: []
|
|
|
+ },
|
|
|
dataRule: {
|
|
|
productName: [{ required: true, message: '请输入物料名称', trigger: 'blur' }],
|
|
|
productSpec: [{ required: true, message: '请输入物料规格', trigger: 'blur' }],
|
|
@@ -231,7 +242,9 @@ export default {
|
|
|
this.listingList = []
|
|
|
this.stepList = []
|
|
|
this.logList = []
|
|
|
- this.dataForm = {}
|
|
|
+ this.dataForm = {
|
|
|
+ drawList: []
|
|
|
+ }
|
|
|
this.productDetails = []
|
|
|
this.materialList = []
|
|
|
// this.optionsTech = []
|
|
@@ -291,8 +304,8 @@ export default {
|
|
|
dealStepLogs(data.data.workFlowBusinessExt.processLogList, this.logList)
|
|
|
}
|
|
|
// 组合小产品
|
|
|
- if (data.data.composeProductMaterialList) {
|
|
|
- data.data.composeProductMaterialList.forEach((item) => {
|
|
|
+ if (data.data.productMaterialList) {
|
|
|
+ data.data.productMaterialList.forEach((item) => {
|
|
|
this.productDetails.push({
|
|
|
...item,
|
|
|
productSpec: item.specifications
|
|
@@ -406,43 +419,12 @@ export default {
|
|
|
})
|
|
|
})
|
|
|
}
|
|
|
- // // 产品配料清单
|
|
|
- // this.dataForm.productMaterialList = []
|
|
|
- // if (this.materialList.length > 0) {
|
|
|
- // this.materialList.forEach((item) => {
|
|
|
- // this.dataForm.productMaterialList.push({
|
|
|
- // ...item
|
|
|
- // })
|
|
|
- // })
|
|
|
- // }
|
|
|
- // 产品技术文件
|
|
|
- let fList = this.fileList
|
|
|
- if (fList.length > 0) {
|
|
|
- this.dataForm.attachList = []
|
|
|
- for (let i = 0; i < fList.length; i++) {
|
|
|
- this.dataForm.attachList.push({
|
|
|
- fileName: fList[i].name,
|
|
|
- url: fList[i].url
|
|
|
- })
|
|
|
- }
|
|
|
- } else {
|
|
|
- this.$message.error('请上传产品技术文件')
|
|
|
- return
|
|
|
- }
|
|
|
- // 产品配料清单附件
|
|
|
- let fList2 = this.listingList
|
|
|
- if (fList2.length > 0) {
|
|
|
- this.dataForm.listingList = []
|
|
|
- for (let i = 0; i < fList2.length; i++) {
|
|
|
- this.dataForm.listingList.push({
|
|
|
- fileName: fList2[i].name,
|
|
|
- url: fList2[i].url
|
|
|
- })
|
|
|
- }
|
|
|
- } else {
|
|
|
- this.$message.error('请上传产品配料清单附件')
|
|
|
+ if (this.drawingList.length <= 0) {
|
|
|
+ this.$message.error('请选择关联图纸')
|
|
|
return
|
|
|
}
|
|
|
+ this.dataForm.drawingList = this.drawingList
|
|
|
+
|
|
|
this.$http({
|
|
|
url: !this.id ? this.$http.adornUrl(`/biz-service/product/save`) : this.$http.adornUrl(`/biz-service/product/update`),
|
|
|
method: 'post',
|
|
@@ -474,7 +456,27 @@ export default {
|
|
|
},
|
|
|
// 添加关联图纸
|
|
|
addDrawingList () {
|
|
|
-
|
|
|
+ this.drawListVisible = true
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.drawList.init()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ addDrawItems (items) {
|
|
|
+ items.forEach((item) => {
|
|
|
+ this.addDrawItem(item)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ addDrawItem (item) {
|
|
|
+ this.drawingList.push({
|
|
|
+ drawingId: item.drawingId,
|
|
|
+ drawingName: item.drawingName,
|
|
|
+ drawingNo: item.drawingNo,
|
|
|
+ source: item.source,
|
|
|
+ notes: item.notes
|
|
|
+ })
|
|
|
+ },
|
|
|
+ removeDrawingItem (index) {
|
|
|
+ this.drawingList.splice(index, 1)
|
|
|
}
|
|
|
}
|
|
|
}
|