|
@@ -119,6 +119,16 @@
|
|
|
align="center"
|
|
|
label="备注">
|
|
|
</el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ fixed="right"
|
|
|
+ header-align="center"
|
|
|
+ align="center"
|
|
|
+ width="80"
|
|
|
+ label="操作">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button style="color: red" type="text" size="small" @click="deleteProductHandle(scope.row.productId)">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
</el-table>
|
|
|
</el-row>
|
|
|
<el-row v-if="!display" style="text-align: center; margin-top: 10px;">
|
|
@@ -131,18 +141,20 @@
|
|
|
<el-button v-if="!display" type="primary" @click="dataFormSubmit()">确定</el-button>
|
|
|
</span>
|
|
|
<!-- </el-dialog> -->
|
|
|
- <template-chose v-if="inboundVisible" ref="inbound" @addItems="addItems" />
|
|
|
+<!-- <template-chose v-if="inboundVisible" ref="inbound" @addItems="addItems" />-->
|
|
|
+ <add-or-update v-if="inboundVisible" ref="inbound" @addItem="addItem" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import templateChose from '../product/template-chose'
|
|
|
+ // import templateChose from '../product/template-chose'
|
|
|
import { getCustomer, getCoDetail } from '@/api/cus'
|
|
|
- import uploadComponent from '../common/upload-component'
|
|
|
import { getDictList } from '@/api/dict'
|
|
|
+ import uploadComponent from '../common/upload-component'
|
|
|
+ import AddOrUpdate from '../product/template-add-or-update'
|
|
|
export default {
|
|
|
name: 'communicate-add-or-update',
|
|
|
- components: {templateChose, uploadComponent},
|
|
|
+ components: {AddOrUpdate, uploadComponent},
|
|
|
computed: {
|
|
|
orgId: {
|
|
|
get () { return this.$store.state.user.orgId }
|
|
@@ -219,12 +231,7 @@
|
|
|
if (data.data.cusRCommProductVOS) {
|
|
|
data.data.cusRCommProductVOS.forEach((item) => {
|
|
|
this.cusRCommProductVOS.push({
|
|
|
- cnt: item.cnt,
|
|
|
- price: item.price,
|
|
|
- productId: item.productId,
|
|
|
- rate: item.rate,
|
|
|
- productName: item.productName,
|
|
|
- notes: item.notes
|
|
|
+ ...item
|
|
|
})
|
|
|
})
|
|
|
}
|
|
@@ -258,7 +265,7 @@
|
|
|
this.dataForm.cusRCommProductVOS = this.cusRCommProductVOS
|
|
|
}
|
|
|
this.$http({
|
|
|
- url: this.$http.adornUrl(`/biz-service/cusCommunication/save`),
|
|
|
+ url: !this.id ? this.$http.adornUrl(`/biz-service/cusCommunication/save`) : this.$http.adornUrl(`/biz-service/cusCommunication/update`),
|
|
|
method: 'post',
|
|
|
data: this.$http.adornData({...this.dataForm, orgId: this.orgId})
|
|
|
}).then(({data}) => {
|
|
@@ -289,19 +296,11 @@
|
|
|
})
|
|
|
},
|
|
|
addItem (item) {
|
|
|
+ if (!item.productId) {
|
|
|
+ item.productId = Math.round(Math.random() * 1000000)
|
|
|
+ }
|
|
|
this.cusRCommProductVOS.push({
|
|
|
- cnt: 1,
|
|
|
- price: 0,
|
|
|
- productId: item.productId,
|
|
|
- rate: 0,
|
|
|
- productName: item.productName,
|
|
|
- notes: item.notes
|
|
|
- })
|
|
|
- },
|
|
|
- addItems (items) {
|
|
|
- this.cusRCommProductVOS = []
|
|
|
- items.forEach((item) => {
|
|
|
- this.addItem(item)
|
|
|
+ ...item
|
|
|
})
|
|
|
},
|
|
|
uploadSuccess (fileList) {
|
|
@@ -309,6 +308,10 @@
|
|
|
},
|
|
|
typeChanged (item) {
|
|
|
this.detailVisible = item === '1'
|
|
|
+ },
|
|
|
+ // 删除产品项
|
|
|
+ deleteProductHandle (productId) {
|
|
|
+ this.cusRCommProductVOS.splice(this.cusRCommProductVOS.findIndex((item) => item.productId === productId))
|
|
|
}
|
|
|
}
|
|
|
}
|