|
|
@@ -4,6 +4,20 @@
|
|
|
<div class="flex-align-center" style="margin-bottom:10px">
|
|
|
<el-input size="small" style="width:200px;margin-right:10px" v-model="params.content.where.condition" placeholder="产品编号、产品名称、材质、品牌" @clear="listData(params.content.pageNumber = 1)" @keyup.native.enter="listData(params.content.pageNumber = 1)" clearable></el-input>
|
|
|
<slot name="addProduct"/>
|
|
|
+ <addTool ref="addTool" :params="paramsAdd" :tablecolsAdd="tablecolsAdd" title="添加" @addSuccess="addTools"
|
|
|
+ @addProduct="addTool" @uploadData="uploadData" @closeDrawer="listData();$emit('onSuccess')"
|
|
|
+ v-if="tool.checkAuth($route.name,'toolListManage') && data.status == '新建' && isLeader" class="inline-16"
|
|
|
+ ></addTool>
|
|
|
+ <uploadAllData
|
|
|
+ v-if="tool.checkAuth($route.name,'toolListManage') && data.status == '新建' && isLeader"
|
|
|
+ class="inline-16"
|
|
|
+ :total="total"
|
|
|
+ @onSuccess="listData();$emit('onSuccess')"
|
|
|
+ @handlePullApi="handlePullApi"
|
|
|
+ @handleDelApi="handleDelApi"
|
|
|
+ idName="sa_contract_itemsid"
|
|
|
+ type="del"
|
|
|
+ ></uploadAllData>
|
|
|
</div>
|
|
|
<tableLayout :layout="tablecols" :data="list" :opwidth="200" height="calc(100vh - 550px)" :custom="true" fixedName="operation qty marketprice discountrate price countPrice" >
|
|
|
<template v-slot:customcol="scope">
|
|
|
@@ -71,16 +85,19 @@
|
|
|
// import edit from './editProduct'
|
|
|
import addProduct from './addTool'
|
|
|
import previewImage from '@/components/previewImage/index'
|
|
|
+import addTool from '@/template/addTool/index'
|
|
|
+import uploadAllData from '@/components/uploadAllData/index'
|
|
|
export default {
|
|
|
- components: {addProduct,previewImage},
|
|
|
+ components: {addProduct,previewImage,addTool,uploadAllData},
|
|
|
name: '',
|
|
|
+ props:["data","isLeader"],
|
|
|
data() {
|
|
|
return {
|
|
|
list:[],
|
|
|
params: {
|
|
|
"id": 20221122165302,
|
|
|
"content": {
|
|
|
- "sa_contractid": '',
|
|
|
+ "sa_contractid": this.$route.query.id,
|
|
|
"pageNumber": 1,
|
|
|
"pageSize": 100,
|
|
|
"where": {
|
|
|
@@ -88,12 +105,25 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
},
|
|
|
+ paramsAdd:{
|
|
|
+ "id": 20221124093602,
|
|
|
+ "content": {
|
|
|
+ "sa_contractid": this.$route.query.id,
|
|
|
+ "pageNumber": 1,
|
|
|
+ "pageSize": 100,
|
|
|
+ "where": {
|
|
|
+ "condition": "",
|
|
|
+ "istool":1//是否是工具
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
form: {
|
|
|
qty:'',
|
|
|
discountrate:'',
|
|
|
price:'',
|
|
|
},
|
|
|
tablecols:[],
|
|
|
+ tablecolsAdd:[],
|
|
|
total:0,
|
|
|
editIndex:'',
|
|
|
totalPrice:0,
|
|
|
@@ -107,6 +137,7 @@ export default {
|
|
|
created () {
|
|
|
if (this.$route.query.id) this.listData()
|
|
|
this.tablecols = this.tool.tabelCol(this.$route.name).toolTable.tablecols
|
|
|
+ this.tablecolsAdd = this.tool.tabelCol(this.$route.name).addToolTable.tablecols
|
|
|
},
|
|
|
methods: {
|
|
|
async listData(){
|
|
|
@@ -172,6 +203,89 @@ export default {
|
|
|
this.params.content.pageNumber = val
|
|
|
this.listData()
|
|
|
},
|
|
|
+ /*批量添加工具*/
|
|
|
+ async addTools(data){
|
|
|
+ let item = data.map(item => {
|
|
|
+ return {
|
|
|
+ "itemid": item.itemid,
|
|
|
+ "price": item.marketprice,
|
|
|
+ "qty": 1,
|
|
|
+ "marketprice":item.marketprice,
|
|
|
+ "type":'指定单价'
|
|
|
+ }
|
|
|
+ })
|
|
|
+ let res = await this.$api.requested({
|
|
|
+ "id": 20221123164402,
|
|
|
+ "content": {
|
|
|
+ "sa_contractid": this.$route.query.id,
|
|
|
+ "items": item
|
|
|
+ },
|
|
|
+ })
|
|
|
+ this.tool.showMessage(res,() => {
|
|
|
+ this.listData()
|
|
|
+ this.$refs.addTool.listData()
|
|
|
+ this.$emit('onSuccess')
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /*单独添加*/
|
|
|
+ async addTool(data){
|
|
|
+ let res = await this.$api.requested({
|
|
|
+ "id": 20221123164402,
|
|
|
+ "content": {
|
|
|
+ "sa_contractid": this.$route.query.id,
|
|
|
+ "items": [
|
|
|
+ {
|
|
|
+ "itemid": data.itemid,
|
|
|
+ "price": data.marketprice,
|
|
|
+ "qty": 1,
|
|
|
+ "marketprice":data.marketprice,
|
|
|
+ "type":'指定单价'
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ })
|
|
|
+ this.tool.showMessage(res,() => {
|
|
|
+ this.listData()
|
|
|
+ this.$refs.addTool.listData()
|
|
|
+ this.$emit('onSuccess')
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /*一键添加*/
|
|
|
+ uploadData (uploadApi,data) {
|
|
|
+ uploadApi.id = 20221123164402
|
|
|
+ uploadApi.content = {
|
|
|
+ "sa_contractid": this.$route.query.id, //订单ID
|
|
|
+ "items": data.map(e=>{
|
|
|
+ return {
|
|
|
+ "itemid": e.itemid,
|
|
|
+ "price": e.marketprice,
|
|
|
+ "qty": 1,
|
|
|
+ "marketprice":e.marketprice,
|
|
|
+ "type":'指定单价'
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ this.listData()
|
|
|
+ this.$refs.addTool.listData()
|
|
|
+ this.$emit('onSuccess')
|
|
|
+ },
|
|
|
+ /*拉取数据*/
|
|
|
+ handlePullApi (pullApi) {
|
|
|
+ pullApi.content = JSON.parse(JSON.stringify(this.params.content))
|
|
|
+ pullApi.id = 20221122165302
|
|
|
+ pullApi.content.sa_contractid = this.$route.query.id
|
|
|
+ },
|
|
|
+ /*一键删除*/
|
|
|
+ handleDelApi (delApi,data) {
|
|
|
+ delApi.id = 20221123164502
|
|
|
+ delApi.content = {
|
|
|
+ "sa_contractid":this.$route.query.id,
|
|
|
+ "sa_contract_itemsids":data,
|
|
|
+ "pageNumber":0,
|
|
|
+ "pageSize":0
|
|
|
+ }
|
|
|
+ this.listData()
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|