Browse Source

项目商机、报价单、合同商品明细列表修改

qymljy 2 years ago
parent
commit
12f1f5bc23

+ 107 - 51
src/HDrpManagement/contractManage/components/productDetailList/productDetailList.vue

@@ -3,7 +3,6 @@
     <div>
       <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"/>
         <slot name="export"></slot>
         <uploadAllData
             v-if="tool.checkAuth($route.name,'productDetailManage') && data.status === '新建' && isLeader"
@@ -19,39 +18,39 @@
                     @addSuccess="addProducts" @addProduct="addProduct" @uploadData="uploadData" @closeDrawer="listData"
                      ref="addProduct"
         ></addProduct>
+        <el-button size="small" v-if="tool.checkAuth($route.name,'productDetailManage') && data.status === '新建' && isLeader" :type="delProductData.length === 0?'':'primary'" @click="onDelProduct" :disabled="delProductData.length === 0">删 除</el-button>
       </div>
-      <tableLayout :layout="tablecols" :data="list" :opwidth="200" height="calc(100vh - 550px)" :width="true" :custom="true" fixedName="operation amount" >
+      <div class="produtMag-panel">
+      </div>
+      <tableLayout checkbox="true"  :layout="tablecols" :data="list" :opwidth="200" height="calc(100vh - 550px)" :width="true" :custom="true" fixedName="operation amount" @selectionChange="selectionChange">
         <template v-slot:customcol="scope">
           <div v-if="scope.column.columnname == 'qty'">
-            <el-input-number size="mini" v-if="editIndex == scope.column.data.sa_contract_itemsid" v-model="scope.column.data.qty" @change="qtyChange" :min="1" label="描述文字"></el-input-number>
-            <el-input-number size="mini" v-else disabled v-model="scope.column.data.qty" @change="qtyChange" :min="1" label="描述文字"></el-input-number>
+<!--            <el-input-number size="mini" v-if="editIndex == scope.column.data.sa_contract_itemsid" v-model="scope.column.data.qty" @change="qtyChange" :min="1" label="描述文字"></el-input-number>-->
+            <el-input-number size="mini"  v-model="scope.column.data.qty" @change="qtyChange(scope.column.data.qty,scope.$index,scope.column.data)" :min="1" label="描述文字" :disabled="!tool.checkAuth($route.name,'productDetailManage') || data.status !== '新建' || !isLeader"></el-input-number>
           </div>
           <div v-else-if="scope.column.columnname == 'attinfos'">
-            <previewImage 
-              v-if="scope.column.data.attinfos[0]" 
-              style="width:38px;height:38px;margin:0px" 
-              class="image" 
-              :image="scope.column.data.attinfos[0]" 
-              :list="scope.column.data.attinfos" 
+            <previewImage
+              v-if="scope.column.data.attinfos[0]"
+              style="width:38px;height:38px;margin:0px"
+              class="image"
+              :image="scope.column.data.attinfos[0]"
+              :list="scope.column.data.attinfos"
               :deletebtn="false"
             ></previewImage>
           </div>
           <div v-else-if="scope.column.columnname == 'type'">
-            <el-select v-if="editIndex == scope.column.data.sa_contract_itemsid" v-model="scope.column.data.type">
+            <el-select v-model="scope.column.data.type" @change="changeType(scope.column.data.type,scope.$index,scope.column.data)" :disabled="!tool.checkAuth($route.name,'productDetailManage') || data.status !== '新建' || !isLeader">
               <el-option label="折扣系数" value="折扣系数"></el-option>
               <el-option label="指定单价" value="指定单价"></el-option>
             </el-select>
-            <p v-else>{{scope.column.data[scope.column.columnname]}}</p>
           </div>
           <div v-else-if="scope.column.columnname == 'discountrate'">
 <!--            <el-input size="mini" v-if="editIndex == scope.column.data.sa_contract_itemsid" v-model="form.discountrate" @input="discountrateChange($event,scope.column.data)"></el-input>-->
-            <el-input size="mini" v-if="editIndex == scope.column.data.sa_contract_itemsid && scope.column.data.type == '折扣系数'" v-model="form.discountrate" @change="discountrateChange($event,scope.column.data)"></el-input>
-            <p v-else>{{scope.column.data[scope.column.columnname]}}</p>
+            <el-input size="mini" :disabled="scope.column.data.type === '指定单价' || !tool.checkAuth($route.name,'productDetailManage') || data.status !== '新建' || !isLeader "  v-model="scope.column.data.discountrate" @change="discountrateChange(scope.column.data.discountrate,scope.$index,scope.column.data)"></el-input>
           </div>
           <div v-else-if="scope.column.columnname == 'price'">
 <!--            <el-input size="mini" v-if="editIndex == scope.column.data.sa_contract_itemsid" v-model="form.price" @input="priceChange($event,scope.column.data)"></el-input>-->
-            <el-input size="mini" v-if="editIndex == scope.column.data.sa_contract_itemsid && scope.column.data.type == '指定单价'" v-model="form.price" @change="priceChange($event,scope.column.data)"></el-input>
-            <p v-else>{{tool.formatAmount(scope.column.data[scope.column.columnname],2)}}</p>
+            <el-input size="mini" :disabled="scope.column.data.type === '折扣系数' || !tool.checkAuth($route.name,'productDetailManage') || data.status !== '新建' || !isLeader"  v-model="scope.column.data.price" @change="priceChange(scope.column.data.price,scope.$index,scope.column.data)"></el-input>
           </div>
           <div v-else-if="scope.column.columnname == 'countPrice'">
             <p>{{tool.formatAmount(scope.column.data.price * scope.column.data.qty,2)}}</p>
@@ -68,24 +67,24 @@
           <p v-else>{{scope.column.data[scope.column.columnname]}}</p>
         </template>
         <template v-slot:opreation="scope">
-          <el-button v-if="editIndex == scope.data.sa_contract_itemsid" type="text" size="mini" @click="save(scope.data)" class="inline-16">保 存</el-button>
-          <slot name="edit" :data="scope.data" v-else></slot>
-          <slot name="del" :data="scope.data"></slot>
-          <!-- <edit :data="scope.data"></edit> -->
         </template>
       </tableLayout>
     </div>
-    <div style="margin-top:16px;text-align:right">
-      <el-pagination
-          background
-          @size-change="handleSizeChange"
-          @current-change="handleCurrentChange"
-          :current-page="params.content.pageNumber"
-          :page-sizes="[20, 50, 100, 200]"
-          :page-size="100"
-          layout="total,sizes, prev, pager, next, jumper"
-          :total="total">
-      </el-pagination>
+    <div style="height: 35px;margin-top: 20px">
+      <div style="float: left">金额(元):{{ data.signamount ? tool.formatAmount(data.signamount,2) : '0.00'}}</div>
+      <div style="float: right">
+        <el-pagination
+            background
+            @size-change="handleSizeChange"
+            @current-change="handleCurrentChange"
+            :current-page="params.content.pageNumber"
+            :page-sizes="[20, 50, 100, 200]"
+            :page-size="100"
+            layout="total,sizes, prev, pager, next, jumper"
+            :total="total">
+        </el-pagination>
+      </div>
+
     </div>
   </div>
 </template>
@@ -104,6 +103,7 @@ export default {
   data() {
     return {
       list:[],
+      delProductData:[],
       paramsAdd:{
         "id": 20221124093602,
         "content": {
@@ -128,6 +128,8 @@ export default {
           },
       },
       form: {
+        itemid:'',
+        sa_contract_itemsid:'',
         qty:'',
         discountrate:'',
         price:'',
@@ -160,43 +162,62 @@ export default {
       this.total = res.total
       this.$emit('priceChange')
     },
-    qtyChange (num) {
-      this.form.qty = num
-      
+    qtyChange (num,index,data) {
+      data.qty = num
+      this.$set(this.list,index,data)
+      this.save(data)
     },
     handleChange(num) {
       
     },
-    discountrateChange (num,data) {
+    changeType(num,index,data){
+      console.log(num)
+      data.type = num
+      this.$set(this.list,index,data)
+      this.save(data)
+    },
+    discountrateChange (num,index,data) {
       if (num > 100){
-        this.form.discountrate = 100
-      }else if (num < 1){
-        this.form.discountrate = 1
+        data.discountrate = 100
+      }else if (num < 0){
+        data.discountrate = 0
       }else {
-        this.form.discountrate = Math.round(num*100)/100
+        data.discountrate = Math.round(num*100)/100
       }
-      this.form.price = Math.round((this.form.discountrate / 100 * data.marketprice) *100)/100
+      data.price = (data.discountrate / 100 * data.marketprice).toFixed(2)
+      this.$set(this.list,index,data)
+      this.save(data)
     },
-    priceChange (num,data) {
+    priceChange (num,index,data) {
       if (num > data.marketprice){
-        this.form.price = data.marketprice
-      }else if (num < data.marketprice * 0.01){
-        this.form.price = data.marketprice * 0.01
+        data.price = data.marketprice
+      }else if (num < 0 ){
+        data.price = 0
       }else {
-        this.form.price = Math.round(num*100)/100
+        data.price = Math.round(num*100)/100
       }
-      this.form.discountrate = Math.round((this.form.price / data.marketprice * 100)*100)/100
-      
+      console.log(data.price)
+      data.discountrate = Math.round((data.price / data.marketprice * 100)*100)/100
+      console.log(data.discountrate)
+      this.$set(this.list,index,data)
+      this.save(data)
     },
     async save (data) {
-      
-      this.form.discountrate = (this.form.discountrate/100).toFixed(4)
-      this.form.type = data.type
       let res = await this.$api.requested({
         "id": 20221122200302,
         "content": {
           "sa_contractid":this.$route.query.id,
-          "items": [this.form]
+          "items": [
+            {
+              marketprice:data.marketprice,
+              itemid:data.itemid,
+              sa_contract_itemsid:data.sa_contract_itemsid,
+              qty:data.qty,
+              discountrate:(data.discountrate/100).toFixed(4),
+              price:data.price,
+              type:data.type
+            }
+          ]
         },
       })
       this.tool.showMessage(res,() => {
@@ -295,6 +316,41 @@ export default {
       }
       this.listData()
     },
+    selectionChange(val){
+      this.delProductData = []
+      val.forEach((item,index) => {
+        this.delProductData[index] = item.sa_contract_itemsid
+      })
+    },
+    /*批量删除判断*/
+    onDelProduct() {
+      this.$confirm('此操作将删除这些商品, 是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.delProduct()
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '取消删除'
+        });
+      });
+    },
+    /*批量删除商品*/
+    async delProduct(){
+      const res = await this.$api.requested({
+        "id": 20221123164502,
+        "content": {
+          "sa_contractid":this.$route.query.id,
+          "sa_contract_itemsids":this.delProductData
+        },
+      })
+      this.tool.showMessage(res,()=>{
+        this.listData()
+        this.$emit("delSuccess")
+      })
+    },
   },
 };
 </script>

+ 347 - 0
src/HDrpManagement/contractManage/components/productDetailList/productDetailListCopy.vue

@@ -0,0 +1,347 @@
+<template>
+  <div>
+    <div>
+      <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"/>
+        <slot name="export"></slot>
+        <uploadAllData
+            v-if="tool.checkAuth($route.name,'productDetailManage') && data.status === '新建' && isLeader"
+            :total="total"
+            @onSuccess="listData()"
+            @handlePullApi="handlePullApi"
+            @handleDelApi="handleDelApi"
+            idName="sa_contract_itemsid"
+            type="del"
+        ></uploadAllData>
+        <addProduct v-if="tool.checkAuth($route.name,'productDetailManage') && data.status === '新建' && isLeader"
+                    class="inline-16"  :params="paramsAdd" :tablecolsAdd="tablecolsAdd" title="添加"
+                    @addSuccess="addProducts" @addProduct="addProduct" @uploadData="uploadData" @closeDrawer="listData"
+                     ref="addProduct"
+        ></addProduct>
+        <el-button size="small" :type="delProductData.length === 0?'':'primary'" @click="onDelProduct" :disabled="delProductData.length === 0">删 除</el-button>
+      </div>
+      <div class="produtMag-panel">
+      </div>
+      <tableLayout checkbox="true"  :layout="tablecols" :data="list" :opwidth="200" height="calc(100vh - 550px)" :width="true" :custom="true" fixedName="operation amount" @selectionChange="selectionChange">
+        <template v-slot:customcol="scope">
+          <div v-if="scope.column.columnname == 'qty'">
+            <el-input-number size="mini" v-if="editIndex == scope.column.data.sa_contract_itemsid" v-model="scope.column.data.qty" @change="qtyChange" :min="1" label="描述文字"></el-input-number>
+            <el-input-number size="mini" v-else disabled v-model="scope.column.data.qty" @change="qtyChange" :min="1" label="描述文字"></el-input-number>
+          </div>
+          <div v-else-if="scope.column.columnname == 'attinfos'">
+            <previewImage
+              v-if="scope.column.data.attinfos[0]"
+              style="width:38px;height:38px;margin:0px"
+              class="image"
+              :image="scope.column.data.attinfos[0]"
+              :list="scope.column.data.attinfos"
+              :deletebtn="false"
+            ></previewImage>
+          </div>
+          <div v-else-if="scope.column.columnname == 'type'">
+            <el-select v-if="editIndex == scope.column.data.sa_contract_itemsid" v-model="scope.column.data.type">
+              <el-option label="折扣系数" value="折扣系数"></el-option>
+              <el-option label="指定单价" value="指定单价"></el-option>
+            </el-select>
+            <p v-else>{{scope.column.data[scope.column.columnname]}}</p>
+          </div>
+          <div v-else-if="scope.column.columnname == 'discountrate'">
+<!--            <el-input size="mini" v-if="editIndex == scope.column.data.sa_contract_itemsid" v-model="form.discountrate" @input="discountrateChange($event,scope.column.data)"></el-input>-->
+            <el-input size="mini" v-if="editIndex == scope.column.data.sa_contract_itemsid && scope.column.data.type == '折扣系数'" v-model="form.discountrate" @change="discountrateChange($event,scope.column.data)"></el-input>
+            <p v-else>{{scope.column.data[scope.column.columnname]}}</p>
+          </div>
+          <div v-else-if="scope.column.columnname == 'price'">
+<!--            <el-input size="mini" v-if="editIndex == scope.column.data.sa_contract_itemsid" v-model="form.price" @input="priceChange($event,scope.column.data)"></el-input>-->
+            <el-input size="mini" v-if="editIndex == scope.column.data.sa_contract_itemsid && scope.column.data.type == '指定单价'" v-model="form.price" @change="priceChange($event,scope.column.data)"></el-input>
+            <p v-else>{{tool.formatAmount(scope.column.data[scope.column.columnname],2)}}</p>
+          </div>
+          <div v-else-if="scope.column.columnname == 'countPrice'">
+            <p>{{tool.formatAmount(scope.column.data.price * scope.column.data.qty,2)}}</p>
+          </div>
+          <div v-else-if="scope.column.columnname == 'marketprice'">
+            <p>{{tool.formatAmount((scope.column.data.marketprice),2)}}</p>
+          </div>
+          <div v-else-if="scope.column.columnname == 'amount'">
+            <p>{{tool.formatAmount((scope.column.data.amount),2)}}</p>
+          </div>
+          <div v-else-if="scope.column.columnname == 'brand'">
+            {{scope.column.data[scope.column.columnname][0] && scope.column.data[scope.column.columnname][0].brandname}}
+          </div>
+          <p v-else>{{scope.column.data[scope.column.columnname]}}</p>
+        </template>
+        <template v-slot:opreation="scope">
+          <el-button v-if="editIndex == scope.data.sa_contract_itemsid" type="text" size="mini" @click="save(scope.data)" class="inline-16">保 存</el-button>
+          <slot name="edit" :data="scope.data" v-else></slot>
+          <slot name="del" :data="scope.data"></slot>
+          <!-- <edit :data="scope.data"></edit> -->
+        </template>
+      </tableLayout>
+    </div>
+    <div style="height: 35px;margin-top: 20px">
+      <div style="float: left">金额(元):{{ data.signamount ? tool.formatAmount(data.signamount,2) : '0.00'}}</div>
+      <div style="float: right">
+        <el-pagination
+            background
+            @size-change="handleSizeChange"
+            @current-change="handleCurrentChange"
+            :current-page="params.content.pageNumber"
+            :page-sizes="[20, 50, 100, 200]"
+            :page-size="100"
+            layout="total,sizes, prev, pager, next, jumper"
+            :total="total">
+        </el-pagination>
+      </div>
+
+    </div>
+  </div>
+</template>
+
+<script>
+// import edit from './editProduct'
+
+// import addProduct from './addProduct'
+import addProduct from '@/template/addProduct'
+import previewImage from '@/components/previewImage/index'
+import uploadAllData from '@/components/uploadAllData/index'
+export default {
+  components: {addProduct,previewImage,uploadAllData},
+  name: '',
+  props:["data","isLeader"],
+  data() {
+    return {
+      list:[],
+      delProductData:[],
+      paramsAdd:{
+        "id": 20221124093602,
+        "content": {
+          "sa_contractid": this.$route.query.id,
+          "pageNumber": 1,
+          "pageSize": 100,
+          "where": {
+            "condition": "",
+            "istool":0//是否是工具
+          }
+        },
+      },
+      params: {
+          "id": 20221122165302,
+          "content": {
+              "sa_contractid": this.$route.query.id,
+              "pageNumber": 1,
+              "pageSize": 100,
+              "where": {
+                  "condition": "",
+              }
+          },
+      },
+      form: {
+        qty:'',
+        discountrate:'',
+        price:'',
+        type:''
+      },
+      tablecols:[],
+      tablecolsAdd:[],
+      total:0,
+      editIndex:''
+    };
+  },
+  computed:{
+  },
+  watch:{
+  },
+  created () {
+    if (this.$route.query.id) this.listData()
+    this.tablecols = this.tool.tabelCol(this.$route.name).productDetailTable.tablecols
+    this.tablecolsAdd = this.tool.tabelCol(this.$route.name).addProductTable.tablecols
+
+  },
+  methods: {
+    async listData(){
+      this.params.content.sa_contractid = this.$route.query.id
+      const res = await this.$api.requested(this.params)
+      res.data.forEach((e,index)=>{
+        res.data[index].discountrate = Math.round((e.discountrate * 100)*100)/100
+      })
+      this.list = res.data
+      this.total = res.total
+      this.$emit('priceChange')
+    },
+    qtyChange (num) {
+      this.form.qty = num
+      
+    },
+    handleChange(num) {
+      
+    },
+    discountrateChange (num,data) {
+      if (num > 100){
+        this.form.discountrate = 100
+      }else if (num < 1){
+        this.form.discountrate = 1
+      }else {
+        this.form.discountrate = Math.round(num*100)/100
+      }
+      this.form.price = Math.round((this.form.discountrate / 100 * data.marketprice) *100)/100
+    },
+    priceChange (num,data) {
+      if (num > data.marketprice){
+        this.form.price = data.marketprice
+      }else if (num < data.marketprice * 0.01){
+        this.form.price = data.marketprice * 0.01
+      }else {
+        this.form.price = Math.round(num*100)/100
+      }
+      this.form.discountrate = Math.round((this.form.price / data.marketprice * 100)*100)/100
+      
+    },
+    async save (data) {
+      
+      this.form.discountrate = (this.form.discountrate/100).toFixed(4)
+      this.form.type = data.type
+      let res = await this.$api.requested({
+        "id": 20221122200302,
+        "content": {
+          "sa_contractid":this.$route.query.id,
+          "items": [this.form]
+        },
+      })
+      this.tool.showMessage(res,() => {
+        this.editIndex = ''
+        this.listData()
+        this.$emit('editSuccess',res.data.signamount)
+      })
+    },
+    handleSizeChange(val) {
+      // console.log(`每页 ${val} 条`);
+      this.params.content.pageSize = val
+      this.listData()
+    },
+    handleCurrentChange(val) {
+      // console.log(`当前页: ${val}`);
+      this.params.content.pageNumber = val
+      this.listData()
+    },
+    /*批量添加*/
+    async addProducts(data){
+      let item = data.map(item => {
+        return {
+          "itemid": item.itemid,
+          "price": item.marketprice,
+          "qty": 1,
+          'marketprice':item.marketprice,
+          type:'折扣系数'
+        }
+      })
+      const res = await this.$api.requested({
+        "id": 20221123164402,
+        "content": {
+          "sa_contractid": this.$route.query.id,
+          "items": item
+        },
+      })
+      this.tool.showMessage(res,()=>{
+        this.listData()
+        this.$refs.addProduct.listData()
+      })
+    },
+    /*单独添加*/
+    async addProduct(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.addProduct.listData()
+      })
+    },
+    /*一键添加*/
+    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.addProduct.listData()
+    },
+    /*获取要删除的数据*/
+    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()
+    },
+    selectionChange(val){
+      this.delProductData = []
+      val.forEach((item,index) => {
+        this.delProductData[index] = item.sa_contract_itemsid
+      })
+    },
+    /*批量删除判断*/
+    onDelProduct() {
+      this.$confirm('此操作将删除这些商品, 是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.delProduct()
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '取消删除'
+        });
+      });
+    },
+    /*批量删除商品*/
+    async delProduct(){
+      const res = await this.$api.requested({
+        "id": 20221123164502,
+        "content": {
+          "sa_contractid":this.$route.query.id,
+          "sa_contract_itemsids":this.delProductData
+        },
+      })
+      this.tool.showMessage(res,()=>{
+        this.listData()
+        this.$emit("delSuccess")
+      })
+    },
+  },
+};
+</script>
+
+<style scoped>
+
+</style>

+ 70 - 35
src/HDrpManagement/contractManage/components/productList/productBillno.vue

@@ -6,11 +6,11 @@
         <slot name="addProduct"/>
         <addProductContract class="inline-16"  title="添 加" :tablecolsAdd="tablecolsAdd" :tradefield="data.tradefield" :data="data"
                              @addSuccess="queryProuctAdds" ref="addProduct" @addProduct="queryProuctAdd" @uploadData="queryUploadData"
-                             @closeDrawer="listData();$emit('onSuccess')"
+                             @closeDrawer="listData();$emit('onSuccess')" v-if="tool.checkAuth($route.name,'productBillManage') && data.status === '新建' && isLeader"
         >
         </addProductContract>
         <uploadAllData
-            class="inline-16 "
+            v-if="tool.checkAuth($route.name,'productBillManage') && data.status === '新建' && isLeader"
             :total="total"
             @onSuccess="listData();$emit('onSuccess')"
             @handlePullApi="handlePullApi"
@@ -18,12 +18,12 @@
             idName="sa_contract_itemsid"
             type="del"
         ></uploadAllData>
+        <el-button v-if="tool.checkAuth($route.name,'productBillManage') && data.status === '新建' && isLeader" size="small" :type="delProductData.length === 0?'':'primary'" @click="onDelProduct" :disabled="delProductData.length === 0">删 除</el-button>
       </div>
-      <tableLayout :layout="tablecols" :data="list" :width="true" :opwidth="200" height="calc(100vh - 550px)" :custom="true" fixedName="operation countPrice" >
+      <tableLayout checkbox="true" :layout="tablecols" :data="list" :width="true" :opwidth="200" height="calc(100vh - 550px)" :custom="true" fixedName="operation countPrice" @selectionChange="selectionChange">
         <template v-slot:customcol="scope">
           <div v-if="scope.column.columnname == 'qty'">
-            <el-input-number size="mini" v-if="editIndex == scope.column.data.sa_contract_itemsid" v-model="scope.column.data.qty" @change="qtyChange" :min="1" label="描述文字"></el-input-number>
-            <el-input-number size="mini" v-else disabled v-model="scope.column.data.qty" @change="qtyChange($event,scope.column.data,scope.column.data.index)" :min="1" label="描述文字"></el-input-number>
+            <el-input-number size="mini" v-model="scope.column.data.qty" @change="qtyChange($event,scope.column.data,scope.column.data.index)" :min="1" label="描述文字" :disabled="!tool.checkAuth($route.name,'productBillManage') || data.status !== '新建' || !isLeader"></el-input-number>
           </div>
           <div v-else-if="scope.column.columnname == 'attinfos'">
             <previewImage 
@@ -36,16 +36,14 @@
             ></previewImage>
           </div>
           <div v-else-if="scope.column.columnname == 'remarks'">
-            <el-input size="mini" v-if="editIndex == scope.column.data.sa_contract_itemsid" v-model="form.remarks" @change="remarksChange($event,scope.column.data,scope.column.data.index)"></el-input>
+            <el-input size="mini" v-if="editIndex == scope.column.data.sa_contract_itemsid" v-model="form.remarks" @change="remarksChange($event,scope.column.data,scope.column.data.index)" ></el-input>
             <p v-else>{{scope.column.data[scope.column.columnname]}}</p>
           </div>
           <div v-else-if="scope.column.columnname == 'discountrate'">
-            <el-input size="mini" v-if="editIndex == scope.column.data.sa_contract_itemsid" v-model="form.discountrate" @change="discountrateChange($event,scope.column.data,scope.column.data.index)"></el-input>
-            <p v-else>{{scope.column.data[scope.column.columnname]}}</p>
+            <el-input size="mini"v-model="scope.column.data.discountrate" @change="discountrateChange($event,scope.column.data,scope.column.data.index)" :disabled="!tool.checkAuth($route.name,'productBillManage') || data.status !== '新建' || !isLeader"></el-input>
           </div>
           <div v-else-if="scope.column.columnname == 'price'">
-            <el-input size="mini" v-if="editIndex == scope.column.data.sa_contract_itemsid" v-model="form.price" @change="priceChange($event,scope.column.data,scope.column.data.index)"></el-input>
-            <p v-else>{{tool.formatAmount(scope.column.data[scope.column.columnname],2)}}</p>
+            <el-input size="mini"  v-model="scope.column.data.price" @change="priceChange($event,scope.column.data,scope.column.data.index)" :disabled="!tool.checkAuth($route.name,'productBillManage') || data.status !== '新建' || !isLeader"></el-input>
           </div>
           <div v-else-if="scope.column.columnname == 'countPrice'">
             <p>{{tool.formatAmount((scope.column.data.price * scope.column.data.qty),2)}}</p>
@@ -60,10 +58,6 @@
           <p v-if="!scope.column.data[scope.column.columnname] && scope.column.data[[scope.column.columnname]] !== 0 && scope.column.columnname != 'operation' && scope.column.columnname != 'countPrice'">--</p>
         </template>
         <template v-slot:opreation="scope">
-          <el-button v-if="editIndex == scope.data.sa_contract_itemsid" type="text" size="mini" @click="save" class="inline-16">保 存</el-button>
-          <slot name="edit" :data="scope.data" v-else></slot>
-          <slot name="del" :data="scope.data"></slot>
-          <!-- <edit :data="scope.data"></edit> -->
         </template>
       </tableLayout>
     </div>
@@ -107,10 +101,11 @@ import uploadAllData from '@/components/uploadAllData/index'
 export default {
   components: {addProduct,previewImage,addProductContract,uploadAllData},
   name: '',
-  props:["data"],
+  props:["data","isLeader"],
   data() {
     return {
       list:[],
+      delProductData:[],
       params: {
       "id": 20221122165302,
         "content": {
@@ -159,10 +154,9 @@ export default {
     },
     /*修改数量*/
     qtyChange (num,data,index) {
-      this.form.qty = Math.round(num *100)/100
-      data.qty = this.form.qty
+      data.qty = Math.round(num *100)/100
       this.$set(this.list,index,data)
-      console.log(num);
+      this.save(data)
     },
     handleChange(num) {
       console.log(num);
@@ -174,40 +168,46 @@ export default {
     },
     /*修改折扣*/
     discountrateChange (num,data,index) {
-      console.log(num,data,index)
       if (num>100){
-        this.form.discountrate = 100
+        data.discountrate = 100
       }else if (num < 0){
-        this.form.discountrate = 0
+        data.discountrate = 0
       }else {
-        this.form.discountrate = Math.round(num *100)/100
+        data.discountrate = Math.round(num *100)/100
       }
-      this.form.price = Math.round((this.form.discountrate / 100 * data.marketprice)*100)/100
-      data.price = this.form.price
+     data.price = Math.round((data.discountrate / 100 * data.marketprice)*100)/100
       this.$set(this.list,index,data)
+      this.save(data)
     },
     /*修改价格*/
     priceChange (num,data,index) {
       if (num > data.marketprice){
-        this.form.price = data.marketprice
-      }else if (num < data.marketprice * 0.01){
-        this.form.price = data.marketprice * 0.01
+       data.price = data.marketprice
+      }else if (num < 0){
+        data.price = 0
       }else {
-        this.form.price = Math.round(num * 100)/100
+        data.price = Math.round(num * 100)/100
       }
-      this.form.discountrate = Math.round((this.form.price / data.marketprice * 100)*100)/100
-      data.price = this.form.price
+      data.discountrate = Math.round((data.price / data.marketprice * 100)*100)/100
       this.$set(this.list,index,data)
-      console.log(this.form.price,data.marketprice);
-      
+      this.save(data)
     },
-    async save () {
-      this.form.discountrate = (this.form.discountrate/100).toFixed(4)
+    async save (data) {
       let res = await this.$api.requested({
         "id": 20221122200302,
         "content": {
           "sa_contractid":this.$route.query.id,
-          "items": [this.form]
+          "items": [
+            {
+              marketprice:data.marketprice,
+              itemid:data.itemid,
+              sa_contract_itemsid:data.sa_contract_itemsid,
+              qty:data.qty,
+              discountrate:(data.discountrate/100).toFixed(4),
+              price:data.price,
+              type:data.type
+            }
+          ]
         },
       })
       this.tool.showMessage(res,() => {
@@ -379,6 +379,41 @@ export default {
         this.$emit('onSuccess')
       })
     },
+    selectionChange(val){
+      this.delProductData = []
+      val.forEach((item,index) => {
+        this.delProductData[index] = item.sa_contract_itemsid
+      })
+    },
+    /*批量删除判断*/
+    onDelProduct() {
+      this.$confirm('此操作将删除这些商品, 是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.delProduct()
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '取消删除'
+        });
+      });
+    },
+    /*批量删除商品*/
+    async delProduct(){
+      const res = await this.$api.requested({
+        "id": 20221123164502,
+        "content": {
+          "sa_contractid":this.$route.query.id,
+          "sa_contract_itemsids":this.delProductData
+        },
+      })
+      this.tool.showMessage(res,()=>{
+        this.listData()
+        this.$emit("delSuccess")
+      })
+    },
   },
 };
 </script>

+ 65 - 21
src/HDrpManagement/contractManage/components/toolList/toolList.vue

@@ -10,7 +10,6 @@
         ></addTool>
         <uploadAllData
             v-if="tool.checkAuth($route.name,'toolListManage') && data.status == '新建' && isLeader"
-            class="inline-16"
             :total="total"
             @onSuccess="listData();$emit('onSuccess')"
             @handlePullApi="handlePullApi"
@@ -18,12 +17,12 @@
             idName="sa_contract_itemsid"
             type="del"
         ></uploadAllData>
+        <el-button size="small" v-if="tool.checkAuth($route.name,'toolListManage') && data.status == '新建' && isLeader" :type="delProductData.length === 0?'':'primary'" @click="onDelProduct" :disabled="delProductData.length === 0">删 除</el-button>
       </div>
-      <tableLayout :layout="tablecols" :data="list" :opwidth="200" height="calc(100vh - 550px)" :custom="true" fixedName="operation  countPrice" >
+      <tableLayout checkbox="true" :layout="tablecols" :data="list" :opwidth="200" height="calc(100vh - 550px)" :custom="true" fixedName="operation  countPrice" @selectionChange="selectionChange">
         <template v-slot:customcol="scope">
           <div v-if="scope.column.columnname == 'qty'">
-            <el-input-number size="mini" v-if="editIndex == scope.column.data.sa_contract_itemsid" v-model="scope.column.data.qty" @change="qtyChange($event,scope.column.data,scope.column.data.index)" :min="1" label="描述文字"></el-input-number>
-            <el-input-number size="mini" v-else disabled v-model="scope.column.data.qty" @change="qtyChange($event,scope.column.data,scope.column.data.index)" :min="1" label="描述文字"></el-input-number>
+            <el-input-number size="mini"  v-model="scope.column.data.qty" @change="qtyChange($event,scope.column.data,scope.column.data.index)" :min="1" label="描述文字" :disabled="!tool.checkAuth($route.name,'toolListManage') || data.status != '新建' || !isLeader"></el-input-number>
           </div>
           <div v-else-if="scope.column.columnname == 'attinfos'">
             <previewImage 
@@ -40,8 +39,7 @@
             <p v-else>{{scope.column.data[scope.column.columnname]}}</p>
           </div>-->
           <div v-else-if="scope.column.columnname == 'price'">
-            <el-input size="mini" v-if="editIndex == scope.column.data.sa_contract_itemsid" v-model="form.price" @change="priceChange($event,scope.column.data,scope.column.data.index)"></el-input>
-            <p v-else>{{tool.formatAmount(scope.column.data[scope.column.columnname],2)}}</p>
+            <el-input size="mini"  v-model="scope.column.data.price" @change="priceChange($event,scope.column.data,scope.column.data.index)" :disabled="!tool.checkAuth($route.name,'toolListManage') || data.status != '新建' || !isLeader"></el-input>
           </div>
           <div v-else-if="scope.column.columnname == 'countPrice'">
             <p>{{tool.formatAmount((scope.column.data.price * scope.column.data.qty),2)}}</p>
@@ -55,15 +53,15 @@
           <p v-else>{{scope.column.data[scope.column.columnname]}}</p>
         </template>
         <template v-slot:opreation="scope">
-          <el-button v-if="editIndex == scope.data.sa_contract_itemsid" type="text" size="mini" @click="save" class="inline-16">保 存</el-button>
+<!--          <el-button v-if="editIndex == scope.data.sa_contract_itemsid" type="text" size="mini" @click="save" class="inline-16">保 存</el-button>
           <slot name="edit" :data="scope.data" v-else></slot>
           <slot name="del" :data="scope.data"></slot>
-          <!-- <edit :data="scope.data"></edit> -->
+           <edit :data="scope.data"></edit> -->
         </template>
       </tableLayout>
     </div>
     <div style="height: 35px;margin-top: 20px">
-      <div style="float: left">合计(元):{{ totalPrice }}</div>
+      <div style="float: left">金额(元):{{ totalPrice }}</div>
       <div style="float: right">
         <el-pagination
             background
@@ -94,6 +92,7 @@ export default {
   data() {
     return {
       list:[],
+      delProductData:[],
       params: {
           "id": 20221122165302,
           "content": {
@@ -153,10 +152,9 @@ export default {
       this.$emit('priceChange')
     },
     qtyChange (num,data,index) {
-      this.form.qty = Math.round(num *100)/100
-      data.qty = this.form.qty
+      data.qty = Math.round(num *100)/100
       this.$set(this.list,index,data)
-      console.log(num);
+      this.save(data)
       
     },
     handleChange(num) {
@@ -168,23 +166,34 @@ export default {
       this.form.price = this.form.discountrate * data.marketprice
     },*/
     priceChange (num,data,index) {
-      if (num < 1){
-        this.form.price = 1
-      }else {
-        this.form.price = Math.round(num * 100)/100
+      if (num < 0){
+        data.price = 0
+      }else if(num > data.marketprice){
+        data.price = data.marketprice
+      }
+      else {
+        data.price = Math.round(num * 100)/100
       }
      /* this.form.discountrate = this.form.price / data.marketprice*/
-      data.price = this.form.price
       this.$set(this.list,index,data)
-      console.log(this.form.price,data.marketprice);
-      
+      this.save(data)
     },
-    async save () {
+    async save (data) {
       let res = await this.$api.requested({
         "id": 20221122200302,
         "content": {
           "sa_contractid":this.$route.query.id,
-          "items": [this.form]
+          "items": [
+            {
+              marketprice:data.marketprice,
+              itemid:data.itemid,
+              sa_contract_itemsid:data.sa_contract_itemsid,
+              qty:data.qty,
+              discountrate:(data.discountrate/100).toFixed(4),
+              price:data.price,
+              type:data.type
+            }
+          ]
         },
       })
       this.tool.showMessage(res,() => {
@@ -286,6 +295,41 @@ export default {
       }
       this.listData()
     },
+    selectionChange(val){
+      this.delProductData = []
+      val.forEach((item,index) => {
+        this.delProductData[index] = item.sa_contract_itemsid
+      })
+    },
+    /*批量删除判断*/
+    onDelProduct() {
+      this.$confirm('此操作将删除这些商品, 是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.delProduct()
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '取消删除'
+        });
+      });
+    },
+    /*批量删除商品*/
+    async delProduct(){
+      const res = await this.$api.requested({
+        "id": 20221123164502,
+        "content": {
+          "sa_contractid":this.$route.query.id,
+          "sa_contract_itemsids":this.delProductData
+        },
+      })
+      this.tool.showMessage(res,()=>{
+        this.listData()
+        this.$emit("delSuccess")
+      })
+    },
   },
 };
 </script>

+ 11 - 30
src/HDrpManagement/contractManage/modules/detail.vue

@@ -26,26 +26,21 @@
       </div>
       <div slot="slot0" >
         <!--项目产品明细折扣表-->
-        <productBillno :data="mainData" ref="billno" @priceChange="queryMainData" v-if="mainData.type == '项目'">
-<!--          <addProduct ref="addProduct" :data="mainData" v-if="tool.checkAuth($route.name,'productBillManage')" :disabled="mainData.status != '新建' || !isLeader" slot="addProduct" @onSuccess="$refs.billno.listData()"/>-->
-
+        <productBillno :data="mainData" :isLeader="isLeader" ref="billno" @priceChange="queryMainData" v-if="mainData.type == '项目'">
           <template v-slot:edit="scope">
-            <el-button 
+<!--            <el-button
               v-if="tool.checkAuth($route.name,'productBillManage')"
               class="inline-16" 
               :disabled="mainData.status != '新建' || !isLeader" 
               type="text" size="mini" slot="edit" 
               @click="$refs.billno.editIndex = scope.data.sa_contract_itemsid;$refs.billno.form = Object.assign({},$refs.billno.form,scope.data)"
-            >编 辑</el-button>
+            >编 辑</el-button>-->
           </template>
           <template v-slot:del="scope">
-            <delete-btn v-if="tool.checkAuth($route.name,'productBillManage')"  :nameId="20221123164502" :disabled="mainData.status != '新建' || !isLeader" nameKey="sa_contract_itemsids" :id="scope.data.sa_contract_itemsid" @deleteSuccess="$refs.billno.listData()"></delete-btn>
           </template>
         </productBillno>
         <!--产品明细折扣表-->
         <productDetailList :data="mainData" :isLeader="isLeader" ref="productDetailList" v-if="mainData.type == '框架'" @priceChange="queryMainData">
-<!--          <addProductDetail :disabled="mainData.status != '新建' || !isLeader" slot="addProduct" v-if="tool.checkAuth($route.name,'productDetailManage')"
-                            @onSuccess="$refs.productDetailList.listData()" />-->
           <importFile
             v-if="tool.checkAuth($route.name,'exportProduct')"
             slot="export"
@@ -56,26 +51,12 @@
             @clearUrl="errorUrl = null"
             @onSuccess="bindImportOrder"
           ></importFile>
-          <template v-slot:edit="scope">
-            <el-button 
-              v-if="tool.checkAuth($route.name,'productDetailManage')"
-              class="inline-16" 
-              :disabled="mainData.status != '新建' || !isLeader" 
-              type="text" 
-              size="mini" 
-              slot="edit" 
-              @click="$refs.productDetailList.editIndex = scope.data.sa_contract_itemsid;$refs.productDetailList.form = Object.assign({},$refs.productDetailList.form,scope.data)"
-            >编 辑</el-button>
-          </template>
-          <template v-slot:del="scope">
-            <delete-btn v-if="tool.checkAuth($route.name,'productDetailManage')" :nameId="20221123164502" :disabled="mainData.status != '新建' || !isLeader" nameKey="sa_contract_itemsids" :id="scope.data.sa_contract_itemsid" @deleteSuccess="$refs.productDetailList.listData()"></delete-btn>
-          </template>
         </productDetailList>
         <!--工具清单-->
         <toolList :data="mainData" :isLeader="isLeader" ref="toolList" v-if="mainData.type == '工具借用'" @priceChange="queryMainData">
 <!--          <addTool v-if="tool.checkAuth($route.name,'toolListManage')" :disabled="mainData.status != '新建' || !isLeader" slot="addProduct" @onSuccess="$refs.toolList.listData()"/>-->
           <template v-slot:edit="scope">
-            <el-button 
+<!--            <el-button
               v-if="tool.checkAuth($route.name,'toolListManage')"
               class="inline-16" 
               :disabled="mainData.status != '新建' || !isLeader" 
@@ -83,11 +64,11 @@
               size="mini" 
               slot="edit" 
               @click="$refs.toolList.editIndex = scope.data.sa_contract_itemsid;$refs.toolList.form = Object.assign({},$refs.toolList.form,scope.data)"
-            >编 辑</el-button>
+            >编 辑</el-button>-->
           </template>
-          <template v-slot:del="scope">
+<!--          <template v-slot:del="scope">
             <delete-btn v-if="tool.checkAuth($route.name,'toolListManage')" :nameId="20221123164502" :disabled="mainData.status != '新建' || !isLeader" nameKey="sa_contract_itemsids" :id="scope.data.sa_contract_itemsid" @deleteSuccess="$refs.toolList.listData()"></delete-btn>
-          </template>
+          </template>-->
         </toolList>
         <BaseInfo v-if="mainData.type == '居间'" :detailInfo="detailInfo"/>
       </div>
@@ -488,10 +469,10 @@ export default {
             label:'签约日期',
             value:this.mainData.signdate
           },
-          // {
-          //   label:'签约金额(元)',
-          //   value:this.mainData.signamount?this.mainData.signamount:0
-          // },
+          {
+            label:'签约金额(元)',
+            value:this.mainData.signamount?this.tool.formatAmount(this.mainData.signamount,2):0.00
+          },
           {
             label:'业务员',
             value:this.mainData.salername

+ 1 - 1
src/HDrpManagement/projectChange/modules/detail.vue

@@ -52,7 +52,7 @@
       <contacts v-if="mainData" :data="mainData" />
     </div>
     <div slot="slot3" class=" normal-panel" >
-      <product_set :data="mainData"  v-if="flag === 1"  @productSetSuccess="queryMainData($route.query.id)" @delSuccess="queryMainData($route.query.id)"/>
+      <product_set :data="mainData"  v-if="flag === 1" :flagTag="flagTag" :disabled="mainData.disabled"  @productSetSuccess="queryMainData($route.query.id)" @delSuccess="queryMainData($route.query.id)"/>
     </div>
     <div slot="slot4" class="normal-panel" >
       <quotation :data="mainData" v-if="flag === 1" />

+ 27 - 142
src/HDrpManagement/projectChange/modules/modules/productSet/index.vue

@@ -3,12 +3,12 @@
   <div>
     <div style="margin-bottom: 15px">
       <addProduct ref="addProduct" @uploadData="uploadData" @closeDrawer="listData"
-                  :tradefield="data.tradefield" v-if="tool.checkAuth($route.name,'productSetManage') && data.disabled"
+                  :tradefield="data.tradefield" v-if="tool.checkAuth($route.name,'productSetManage') && data.disabled && flagTag ===0"
                   class="inline-16" :params="paramsAdd" title="添 加"
                   @addSuccess="addProducts" :discountrate="discountrate" @addProduct="addProduct" :tablecolsAdd="tablecolsAdd"
       ></addProduct>
       <uploadAllData
-          v-if="tool.checkAuth($route.name,'productSetManage') && data.disabled"
+          v-if="tool.checkAuth($route.name,'productSetManage') && data.disabled && flagTag ===0"
           class="inline-16"
           :total="total"
           @onSuccess="listData()"
@@ -17,7 +17,7 @@
           idName="sa_project_itemsid"
           type="del"
       ></uploadAllData>
-      <el-button  v-if="tool.checkAuth($route.name,'productSetManage') && data.disabled" class="inline-16" size="small" :type="delProductData.length === 0?'':'primary'" @click="onDelProduct" :disabled="delProductData.length === 0">删 除</el-button>
+      <el-button  v-if="tool.checkAuth($route.name,'productSetManage') && data.disabled && flagTag ===0 " class="inline-16" size="small" :type="delProductData.length === 0?'':'primary'" @click="onDelProduct" :disabled="delProductData.length === 0">删 除</el-button>
       <el-input
           size="small"
           style="width: 200px;"
@@ -29,144 +29,27 @@
           clearable></el-input>&nbsp;
       <div style="float: right">
         <label class="search__label">预计折扣(%):</label>
-        <el-input style="width: 100px;" v-model="discountrate" size="small"   label="默认折扣"  :disabled="!tool.checkAuth($route.name,'productSetManage') || !data.disabled" @change="discountrateChange(discountrate)"></el-input>
+        <el-input style="width: 100px;" v-model="discountrate" size="small"   label="默认折扣"  :disabled="!tool.checkAuth($route.name,'productSetManage') || !data.disabled || flagTag !==0" @change="discountrateChange(discountrate)"></el-input>
       </div>
     </div>
     <div class="produtMag-panel">
-      <el-table
-          ref="multipleTable"
-          :data="list"
-          style="width: 100%"
-          height="calc(100vh - 500px)"
-          :header-cell-style="{height:'50px',color:'#606266',fontWeight:'400'}"
-          :cell-style="{height:'50px',color:'#666666',fontWeight:'400'}"
-          @selection-change="selectionChange"
-          border>
-        <el-table-column
-            type="selection"
-            width="55"
-            fixed>
-        </el-table-column>
-        <el-table-column
-            align="center"
-            label="产品图"
-            width="100">
-          <template slot-scope="scope">
-            <div v-if="scope.row.attinfos[0]">
-              <previewImage class="image" :image="scope.row.attinfos[0]" :list="scope.row.attinfos" :deletebtn="false"></previewImage>
-            </div>
-          </template>
-        </el-table-column>
-        <el-table-column
-            prop="itemname"
-            label="商品名称"
-            width="180">
-        </el-table-column>
-        <el-table-column
-            prop="itemno"
-            label="编码"
-            width="180">
-        </el-table-column>
-        <el-table-column
-            prop="erpitemno"
-            label="品号"
-            width="180">
-        </el-table-column>
-        <el-table-column
-            label="型号"
-            width="180">
-          <template slot-scope="scope">
-            <p><span>{{scope.row.model || '--'}}</span></p>
-          </template>
-        </el-table-column>
-        <el-table-column
-            prop="marketprice"
-            label="牌价(元)"
-            width="100">
-          <template slot-scope="scope">
-            <p><span>{{scope.row.marketprice?tool.formatAmount(scope.row.marketprice,2):'--'}}</span></p>
-          </template>
-        </el-table-column>
-        <el-table-column
-            prop="qty"
-            label="数量"
-            width="180">
-          <template slot-scope="scope">
-            <el-input-number v-model="scope.row.qty" size="mini" :min="1"  label="描述文字" @change="numChange(scope.row.qty,scope.$index,scope.row)" :disabled="!data.disabled"></el-input-number>
-          </template>
-        </el-table-column>
-        <el-table-column
-            prop="price"
-            label="单价(元)"
-            width="120">
-          <template slot-scope="scope">
-            <el-input v-model="scope.row.price" size="mini"    @change="priceChange(scope.row.price,scope.$index,scope.row)" :disabled="!data.disabled"></el-input>
-          </template>
-        </el-table-column>
-        
-        <el-table-column
-            label="规格"
-            width="180">
-          <template slot-scope="scope">
-            <p><span>{{scope.row.spec || '--'}}</span></p>
-          </template>
-        </el-table-column>
-        <el-table-column
-            prop="material"
-            label="材质"
-            width="180">
-          <template slot-scope="scope">
-            <p><span>{{scope.row.material?scope.row.material:'--'}}</span></p>
-          </template>
-        </el-table-column>
-        <el-table-column
-            prop="standards"
-            label="标准"
-            width="100">
-        </el-table-column>
-       
-        <el-table-column
-            prop="unitid"
-            label="计量单位"
-            width="100">
-          <template slot-scope="scope">
-            <el-tag size="mini" type="info" effect="plain">{{scope.row.unitname}}/{{scope.row.axunitname}}</el-tag>
-          </template>
-        </el-table-column>
-        <el-table-column
-            prop="material"
-            label="产线"
-            width="180">
-          <template slot-scope="scope">
-            <p><span>{{scope.row.prodline || '--'}}</span></p>
-          </template>
-        </el-table-column>
-        <el-table-column
-            prop="material"
-            label="装置"
-            width="180">
-          <template slot-scope="scope">
-            <p><span>{{scope.row.device || '--'}}</span></p>
-          </template>
-        </el-table-column>
-        <el-table-column
-            prop="material"
-            label="特殊说明"
-            width="180">
-          <template slot-scope="scope">
-            <p><span>{{scope.row.specalnote || '--'}}</span></p>
-          </template>
-        </el-table-column>
-        <el-table-column
-            prop="amount"
-            label="金额(元)"
-            fixed="right"
-            width="100">
-          <template slot-scope="scope">
-            <p><span>{{scope.row.amount?tool.formatAmount(scope.row.amount,2):'--'}}</span></p>
-          </template>
-        </el-table-column>
-      </el-table>
+      <tableLayout :layout="tablecols" checkbox="true"  :data="list" :opwidth="200" height="calc(100vh - 550px)" :width="true" :custom="true" fixedName="amount" @selectionChange="selectionChange">
+        <template v-slot:customcol="scope">
+          <div v-if="scope.column.columnname == 'qty'">
+            <el-input-number v-model="scope.column.data.qty" size="mini" :min="1"  label="描述文字" @change="numChange(scope.column.data.qty,scope.$index,scope.column.data)" :disabled="!disabled || !tool.checkAuth($route.name,'productSetManage') || flagTag !==0 "></el-input-number>
+          </div>
+          <div v-else-if="scope.column.columnname == 'price'">
+            <el-input v-model="scope.column.data.price" size="mini"    @change="priceChange(scope.column.data.price,scope.$index,scope.column.data)" :disabled="!disabled || !tool.checkAuth($route.name,'productSetManage') || flagTag !==0 "></el-input>
+          </div>
+          <div v-else-if="scope.column.columnname == 'marketprice'">
+            <p>{{tool.formatAmount((scope.column.data.marketprice),2)}}</p>
+          </div>
+          <div v-else-if="scope.column.columnname == 'amount'">
+            <p>{{tool.formatAmount((scope.column.data.amount),2)}}</p>
+          </div>
+          <p v-else>{{scope.column.data[scope.column.columnname]}}</p>
+        </template>
+      </tableLayout>
       <div style="margin-top:16px;">
         <div style="float: left">
           <span>金额(元):{{totalPrice?tool.formatAmount(totalPrice,2):'0.00'}}</span>
@@ -198,8 +81,9 @@ import uploadFile from "@/components/upload/hw_obs_upload";
 import previewImage from "@/components/previewImage";
 import delete_product from './deleteProduct'
 import uploadAllData from '@/components/uploadAllData/index'
+
 export default {
-  props:["data"],
+  props:["data","disabled","flagTag"],
   components:{add,uploadAllData,addProduct,uploadFile, previewImage,delete_product},
   data () {
     return {
@@ -258,7 +142,6 @@ export default {
     },*/
 
     async listData(){
-      console.log("成功")
       this.discountrate = Math.round((this.data.discountrate * 100) * 100) / 100
       this.totalPrice = 0
       this.params.content.sa_projectid = this.data.sa_projectid
@@ -313,8 +196,8 @@ export default {
       this.params.content.pageNumber = val
       this.listData()
     },
+    /*批量新增*/
     async addProducts(items){
-      console.log(items,'商品明细')
       this.items = []
       this.items = items.map(e=>{
         return {
@@ -336,8 +219,8 @@ export default {
       this.$refs.addProduct.listData()
       this.listData()
     },
+    /*单个新增商品*/
     async addProduct(items){
-      console.log(items,'商品明细')
       const res = await this.$api.requested({
         "id": 20221021145502,
         "content": {
@@ -376,6 +259,7 @@ export default {
         this.delProductData[index] = item.sa_project_itemsid
       })
     },
+    /*批量删除判断*/
     onDelProduct() {
       this.$confirm('此操作将删除这些商品, 是否继续?', '提示', {
         confirmButtonText: '确定',
@@ -494,6 +378,7 @@ export default {
   created() {
     /*this.getProductList()*/
     /*this.tablecols = this.tool.tabelCol(this.$route.name).projectSetTable.tablecols*/
+    this.tablecols = this.tool.tabelCol(this.$route.name).projectSetTable.tablecols
     this.tablecolsAdd = this.tool.tabelCol(this.$route.name).addProductTable.tablecols
    /* this.data.discountrate = Math.round((this.data.discountrate * 100) * 100) / 100*/
   },

+ 524 - 0
src/HDrpManagement/projectChange/modules/modules/productSet/indexCopy2.vue

@@ -0,0 +1,524 @@
+
+<template>
+  <div>
+    <div style="margin-bottom: 15px">
+      <addProduct ref="addProduct" @uploadData="uploadData" @closeDrawer="listData"
+                  :tradefield="data.tradefield" v-if="tool.checkAuth($route.name,'productSetManage') && data.disabled"
+                  class="inline-16" :params="paramsAdd" title="添 加"
+                  @addSuccess="addProducts" :discountrate="discountrate" @addProduct="addProduct" :tablecolsAdd="tablecolsAdd"
+      ></addProduct>
+      <uploadAllData
+          v-if="tool.checkAuth($route.name,'productSetManage') && data.disabled"
+          class="inline-16"
+          :total="total"
+          @onSuccess="listData()"
+          @handlePullApi="handlePullApi"
+          @handleDelApi="handleDelApi"
+          idName="sa_project_itemsid"
+          type="del"
+      ></uploadAllData>
+      <el-button  v-if="tool.checkAuth($route.name,'productSetManage') && data.disabled" class="inline-16" size="small" :type="delProductData.length === 0?'':'primary'" @click="onDelProduct" :disabled="delProductData.length === 0">删 除</el-button>
+      <el-input
+          size="small"
+          style="width: 200px;"
+          :suffix-icon="params.content.where.condition?params.content.where.condition.length > 0?'':'':'el-icon-search'"
+          v-model="params.content.where.condition"
+          placeholder="产品名称,产品编号,品号"
+          @keyup.enter.native="listData(params.content.pageNumber= 1)"
+          @clear="listData(params.content.pageNumber= 1)"
+          clearable></el-input>&nbsp;
+      <div style="float: right">
+        <label class="search__label">预计折扣(%):</label>
+        <el-input style="width: 100px;" v-model="discountrate" size="small"   label="默认折扣"  :disabled="!tool.checkAuth($route.name,'productSetManage') || !data.disabled" @change="discountrateChange(discountrate)"></el-input>
+      </div>
+    </div>
+    <div class="produtMag-panel">
+      <el-table
+          ref="multipleTable"
+          :data="list"
+          style="width: 100%"
+          height="calc(100vh - 500px)"
+          :header-cell-style="{height:'50px',color:'#606266',fontWeight:'400'}"
+          :cell-style="{height:'50px',color:'#666666',fontWeight:'400'}"
+          @selection-change="selectionChange"
+          border>
+        <el-table-column
+            type="selection"
+            width="55"
+            fixed>
+        </el-table-column>
+        <el-table-column
+            align="center"
+            label="产品图"
+            width="100">
+          <template slot-scope="scope">
+            <div v-if="scope.row.attinfos[0]">
+              <previewImage class="image" :image="scope.row.attinfos[0]" :list="scope.row.attinfos" :deletebtn="false"></previewImage>
+            </div>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="itemname"
+            label="商品名称"
+            width="180">
+        </el-table-column>
+        <el-table-column
+            prop="itemno"
+            label="编码"
+            width="180">
+        </el-table-column>
+        <el-table-column
+            prop="erpitemno"
+            label="品号"
+            width="180">
+        </el-table-column>
+        <el-table-column
+            label="型号"
+            width="180">
+          <template slot-scope="scope">
+            <p><span>{{scope.row.model || '--'}}</span></p>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="marketprice"
+            label="牌价(元)"
+            width="100">
+          <template slot-scope="scope">
+            <p><span>{{scope.row.marketprice?tool.formatAmount(scope.row.marketprice,2):'--'}}</span></p>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="qty"
+            label="数量"
+            width="180">
+          <template slot-scope="scope">
+            <el-input-number v-model="scope.row.qty" size="mini" :min="1"  label="描述文字" @change="numChange(scope.row.qty,scope.$index,scope.row)" :disabled="!data.disabled"></el-input-number>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="price"
+            label="单价(元)"
+            width="120">
+          <template slot-scope="scope">
+            <el-input v-model="scope.row.price" size="mini"    @change="priceChange(scope.row.price,scope.$index,scope.row)" :disabled="!data.disabled"></el-input>
+          </template>
+        </el-table-column>
+        
+        <el-table-column
+            label="规格"
+            width="180">
+          <template slot-scope="scope">
+            <p><span>{{scope.row.spec || '--'}}</span></p>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="material"
+            label="材质"
+            width="180">
+          <template slot-scope="scope">
+            <p><span>{{scope.row.material?scope.row.material:'--'}}</span></p>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="standards"
+            label="标准"
+            width="100">
+        </el-table-column>
+       
+        <el-table-column
+            prop="unitid"
+            label="计量单位"
+            width="100">
+          <template slot-scope="scope">
+            <el-tag size="mini" type="info" effect="plain">{{scope.row.unitname}}/{{scope.row.axunitname}}</el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="material"
+            label="产线"
+            width="180">
+          <template slot-scope="scope">
+            <p><span>{{scope.row.prodline || '--'}}</span></p>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="material"
+            label="装置"
+            width="180">
+          <template slot-scope="scope">
+            <p><span>{{scope.row.device || '--'}}</span></p>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="material"
+            label="特殊说明"
+            width="180">
+          <template slot-scope="scope">
+            <p><span>{{scope.row.specalnote || '--'}}</span></p>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="amount"
+            label="金额(元)"
+            fixed="right"
+            width="100">
+          <template slot-scope="scope">
+            <p><span>{{scope.row.amount?tool.formatAmount(scope.row.amount,2):'--'}}</span></p>
+          </template>
+        </el-table-column>
+      </el-table>
+      <div style="margin-top:16px;">
+        <div style="float: left">
+          <span>金额(元):{{totalPrice?tool.formatAmount(totalPrice,2):'0.00'}}</span>
+        </div>
+        <div style="float: right">
+          <el-pagination
+              background
+              @size-change="handleSizeChange"
+              @current-change="handleCurrentChange"
+              :current-page="params.content.pageNumber"
+              :page-sizes="[20, 50, 100, 200]"
+              :page-size="100"
+              layout="total,sizes, prev, pager, next, jumper"
+              :total="total">
+          </el-pagination>
+        </div>
+
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+import add from './add'
+import addProduct from '@/template/addProduct'
+import edit from "@/HDrpManagement/projectChange/modules/modules/andEnterprise/components/edit";
+import to_del from "@/HDrpManagement/projectChange/modules/modules/andEnterprise/components/toDel";
+import uploadFile from "@/components/upload/hw_obs_upload";
+import previewImage from "@/components/previewImage";
+import delete_product from './deleteProduct'
+import uploadAllData from '@/components/uploadAllData/index'
+export default {
+  props:["data"],
+  components:{add,uploadAllData,addProduct,uploadFile, previewImage,delete_product},
+  data () {
+    return {
+      tableHieght:"860px",
+      totalPrice:0,
+      tablecols:[],
+      tablecolsAdd:[],
+      list:[],
+      total:0,
+      currentPage:0,
+      search:'',
+      options:[],
+      productList:'',
+      delProductData:[],
+      discountrate:'',
+      paramsAdd:{
+        "id": 20221021171802,
+        "content": {
+          "sa_projectid": this.$route.query.id,
+          "pageNumber": 1,
+          "pageSize": 100,
+          "where": {
+            "condition": "",
+            "tradefield": "",
+            "standards": "",
+            "itemclassid": "",
+            "sa_brandid": "",
+            "model":"",
+            "spec":"",
+            "material":''
+          }
+        },
+      },
+      params:{
+        "id": 20221021145702,
+        "content": {
+          "sa_projectid": this.$route.query.id,
+          "pageNumber": 1,
+          "pageSize": 100,
+          "where": {
+            "condition": ""
+          }
+        },
+      },
+      items:[]
+    }
+  },
+  provide () {
+    return {
+      productList:() => this.productList
+    }
+  },
+  methods:{
+    /*list (vm) {
+      vm.content.sa_projectid = this.$route.query.id
+    },*/
+
+    async listData(){
+      console.log("成功")
+      this.discountrate = Math.round((this.data.discountrate * 100) * 100) / 100
+      this.totalPrice = 0
+      this.params.content.sa_projectid = this.data.sa_projectid
+      const res = await this.$api.requested(this.params)
+      this.list = res.data
+      res.data.forEach((e,index)=>{
+        this.list[index].price = this.list[index].price.toFixed(2)
+      })
+      this.totalPrice = res.tips.amount
+      this.total = res.total
+      this.$emit("delSuccess")
+    },
+    uploadData (uploadApi,data) {
+      uploadApi.id = 20221021145502
+      uploadApi.content = {
+        "sa_projectid": this.$route.query.id, //订单ID
+        "items": data.map(e=>{
+          return {
+            sa_project_itemsid:0,
+            itemid:e.itemid,
+            qty:e.orderminqty,
+            remarks:e.remarks,
+            marketprice:e.marketprice,
+            price:(e.marketprice * (this.discountrate / 100)).toFixed(4)
+          }
+        })
+      }
+    },
+    handlePullApi (pullApi) {
+      pullApi.content = JSON.parse(JSON.stringify(this.params.content))
+      pullApi.id = 20221021145702
+      pullApi.content.sa_projectid = this.$route.query.id
+    },
+    handleDelApi (delApi,data) {
+      delApi.id = 20221021145602
+      delApi.content = {
+        "deletereason": "",
+        "sa_projectid":this.$route.query.id,
+        "sa_project_itemsids":data,
+        "pageNumber":0,
+        "pageSize":0
+      }
+      this.listData()
+    },
+    handleSizeChange(val) {
+      // console.log(`每页 ${val} 条`);
+      this.params.content.pageSize = val
+      this.listData()
+    },
+    handleCurrentChange(val) {
+      // console.log(`当前页: ${val}`);
+      this.params.content.pageNumber = val
+      this.listData()
+    },
+    async addProducts(items){
+      console.log(items,'商品明细')
+      this.items = []
+      this.items = items.map(e=>{
+        return {
+          sa_project_itemsid:0,
+          itemid:e.itemid,
+          qty:e.orderminqty,
+          remarks:e.remarks,
+          marketprice:e.marketprice,
+          price:(e.marketprice * (this.discountrate / 100)).toFixed(4)
+        }
+      })
+      const res = await this.$api.requested({
+        "id": 20221021145502,
+        "content": {
+          "sa_projectid": this.$route.query.id,
+          "items": this.items
+        },
+      })
+      this.$refs.addProduct.listData()
+      this.listData()
+    },
+    async addProduct(items){
+      console.log(items,'商品明细')
+      const res = await this.$api.requested({
+        "id": 20221021145502,
+        "content": {
+          "sa_projectid": this.$route.query.id,
+          "items": [
+            {
+              "sa_project_itemsid":0,
+              "itemid": items.itemid,
+              "qty": items.orderminqty,
+              "remarks": "",
+              "marketprice":items.marketprice,
+              "price":(items.marketprice * (this.discountrate / 100)).toFixed(4)
+            }
+          ]
+        },
+      })
+      this.$refs.addProduct.listData()
+      this.listData()
+    },
+    onSuccess(){
+      this.listData()
+      this.$emit("productSetSuccess")
+    },
+    clearData(){
+      this.search = ""
+      this.params.content.where.condition = this.search
+      this.listData()
+    },
+    queryClick(){
+      this.params.content.where.condition = this.search
+      this.listData()
+    },
+    selectionChange(val){
+      this.delProductData = []
+      val.forEach((item,index) => {
+        this.delProductData[index] = item.sa_project_itemsid
+      })
+    },
+    onDelProduct() {
+      this.$confirm('此操作将删除这些商品, 是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.delProduct()
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '取消删除'
+        });
+      });
+    },
+    /*批量删除商品*/
+    async delProduct(){
+      const res = await this.$api.requested({
+        "id": 20221021145602,
+        "content": {
+          "deletereason": "",
+          "sa_projectid":this.data.sa_projectid,
+          "sa_project_itemsids":this.delProductData
+        },
+      })
+      this.tool.showMessage(res,()=>{
+        this.listData()
+        this.$emit("delSuccess")
+      })
+    },
+    /*修改商品数量*/
+    numChange(val,index,data){
+      data.qty = val.toFixed(2)
+      data.amount = (data.price * data.qty).toFixed(2)
+      this.$set(this.list,index,data)
+      this.onChangQty(data,data.qty)
+    },
+    /*修改单价*/
+    priceChange(val,index,data){
+      if (val > data.marketprice){
+        data.price = this.tool.formatAmount(data.marketprice,2)
+      }else if(val < 0) {
+        data.price = 0
+      }else {
+        data.price = this.tool.formatAmount(val ,2)
+      }
+      data.amount = this.tool.formatAmount(data.price * data.qty,2)
+      this.$set(this.list,index,data)
+      this.onChangePrice(data,data.price)
+    },
+    /*执行修改数量*/
+    async onChangQty(data,val){
+      const res = await this.$api.requested({
+        "id": 20221021145502,
+        "content": {
+          "sa_projectid": this.data.sa_projectid,
+          "items": [
+            {
+              "sa_project_itemsid":data.sa_project_itemsid,
+              "itemid": data.itemid,
+              "qty": val,
+              "remarks": "",
+              "marketprice": data.marketprice, //市场价
+              "price": data.price //单价
+            }
+          ]
+        }
+      })
+      this.listData()
+      this.$emit("productSetSuccess")
+    },
+    /*执行修改单价*/
+    async onChangePrice(data,val){
+      const res = await this.$api.requested({
+        "id": 20221021145502,
+        "content": {
+          "sa_projectid": this.data.sa_projectid,
+          "items": [
+            {
+              "sa_project_itemsid":data.sa_project_itemsid,
+              "itemid": data.itemid,
+              "qty": data.qty,
+              "remarks": "",
+              "marketprice": data.marketprice, //市场价
+              "price": val //单价
+            }
+          ]
+        }
+      })
+      this.listData()
+      this.$emit("productSetSuccess")
+    },
+    /*修改预计折扣*/
+    async discountrateChange(val){
+      if (val > 100){
+        this.discountrate = 100
+      }else if(val < 0){
+        this.discountrate = 0
+      }else {
+        this.discountrate = Math.round(val * 100)/100
+      }
+     /* this.discountrate = (this.discountrate / 100).toFixed(4)*/
+      const res = await this.$api.requested({
+        "id": 20230207090702,
+        "content": {
+          "sa_projectid": this.$route.query.id,
+          "discountrate": (this.discountrate / 100).toFixed(4)
+        },
+      })
+      this.tool.showMessage(res,()=>{
+        this.data.discountrate = this.discountrate / 100
+        this.$emit("productSetSuccess")
+        this.listData()
+      })
+    }
+  },
+  created() {
+    /*this.getProductList()*/
+    /*this.tablecols = this.tool.tabelCol(this.$route.name).projectSetTable.tablecols*/
+    this.tablecolsAdd = this.tool.tabelCol(this.$route.name).addProductTable.tablecols
+   /* this.data.discountrate = Math.round((this.data.discountrate * 100) * 100) / 100*/
+  },
+  mounted () {
+    this.listData()
+  }
+}
+
+</script>
+<style scoped>
+/* /deep/.el-table__cell .cell {
+  display: flex;
+  justify-content: s;
+} */
+.produtMag-panel{
+  /* margin: 30px; */
+  padding:0 10px 10px 10px;
+  background: #fff;
+  border-radius:5px;
+  overflow: hidden;
+  border:1px solid rgb(0 0 0 / 5%)
+  /* box-shadow: 0 5px 5px rgb(0 0 0 / 10%);
+  transform: translate3d(0,-2px,0); */
+}
+.image {
+  width:38px;height:38px;margin:0px auto;
+}
+</style>

+ 48 - 18
src/SDrpManagement/QuotedPrice/detail/modules/productInventory/index.vue

@@ -38,7 +38,7 @@
       ></addProduct>
     </div>
     <div class="produtMag-panel">
-      <el-table
+<!--      <el-table
           ref="multipleTable"
           :data="list"
           style="width: 100%"
@@ -52,7 +52,7 @@
             width="55"
             fixed>
         </el-table-column>
-<!--        <el-table-column
+&lt;!&ndash;        <el-table-column
             align="center"
             label="产品图"
             width="100">
@@ -61,7 +61,7 @@
               <previewImage class="image" :image="scope.row.attinfos[0]" :list="scope.row.attinfos" :deletebtn="false"></previewImage>
             </div>
           </template>
-        </el-table-column>-->
+        </el-table-column>&ndash;&gt;
         <el-table-column
             prop="itemname"
             label="商品名称"
@@ -90,7 +90,7 @@
             width="80"
         >
           <template slot-scope="scope">
-            <p><span>{{scope.row.marketprice?tool.formatAmount(scope.row.marketprice,2):'--'}}</span></p>
+            <p><span>{{scope.row.marketprice?tool.formatAmount(scope.row.marketprice,2):'&#45;&#45;'}}</span></p>
           </template>
         </el-table-column>
         <el-table-column
@@ -100,7 +100,7 @@
         >
           <template slot-scope="scope">
             <span>
-<!--              <el-input-number :disabled="!saveShow || index !== scope.row.rowindex" v-model="scope.row.qty" size="mini"  :min="1" label="描述文字" @change="onChangeNum(scope.row.qty,scope.row,scope.$index)"></el-input-number>-->
+&lt;!&ndash;              <el-input-number :disabled="!saveShow || index !== scope.row.rowindex" v-model="scope.row.qty" size="mini"  :min="1" label="描述文字" @change="onChangeNum(scope.row.qty,scope.row,scope.$index)"></el-input-number>&ndash;&gt;
                   <el-input-number :disabled="data.status !== '新建'" v-model="scope.row.qty" size="mini"  :min="1" label="描述文字" @change="onChangeNum(scope.row.qty,scope.row,scope.$index)"></el-input-number>
 
             </span>
@@ -123,7 +123,7 @@
                  <el-input :disabled="data.status !== '新建'"  v-model="scope.row.discountrate" size="mini" placeholder="请输入折扣" @change="onChangeDiscountrate(scope.row.discountrate,scope.row,scope.$index)"></el-input>
               </span>
             </div>
-<!--            <span v-else>
+&lt;!&ndash;            <span v-else>
               <span v-if="saveShow && index === scope.row.rowindex">
                  <el-input v-model="scope.row.discountrate" size="mini" placeholder="请输入折扣" @change="onChangeDiscountrate(scope.row.discountrate,scope.row,scope.$index)"></el-input>
               </span>
@@ -131,7 +131,7 @@
                 <span >{{tool.formatAmount(scope.row.discountrate,2)}}</span>
               </span>
 
-            </span>-->
+            </span>&ndash;&gt;
           </template>
         </el-table-column>
         <el-table-column
@@ -152,14 +152,14 @@
                 <el-input :disabled="data.status !== '新建'"  v-model="scope.row.price" size="mini" placeholder="请输入单价" @change="onChangePrice(scope.row.price,scope.row,scope.$index)"></el-input>
               </span>
             </div>
-<!--            <span v-else>
+&lt;!&ndash;            <span v-else>
               <span v-if="saveShow && index === scope.row.rowindex">
                 <el-input v-model="scope.row.price" size="mini" placeholder="请输入单价" @change="onChangePrice(scope.row.price,scope.row,scope.$index)"></el-input>
               </span>
                <span v-else>
                 <span >{{tool.formatAmount(scope.row.price,2)}}</span>
               </span>
-            </span>-->
+            </span>&ndash;&gt;
           </template>
         </el-table-column>
         <el-table-column
@@ -186,7 +186,7 @@
             label="材质"
             width="180">
           <template slot-scope="scope">
-            <p><span>{{scope.row.material?scope.row.material:'--'}}</span></p>
+            <p><span>{{scope.row.material?scope.row.material:'&#45;&#45;'}}</span></p>
           </template>
         </el-table-column>
         <el-table-column
@@ -207,7 +207,7 @@
             label="装置"
             width="180">
           <template slot-scope="scope">
-            <p><span>{{scope.row.device || '--'}}</span></p>
+            <p><span>{{scope.row.device || '&#45;&#45;'}}</span></p>
           </template>
         </el-table-column>
         <el-table-column
@@ -215,7 +215,7 @@
             label="产线"
             width="180">
           <template slot-scope="scope">
-            <p><span>{{scope.row.prodline || '--'}}</span></p>
+            <p><span>{{scope.row.prodline || '&#45;&#45;'}}</span></p>
           </template>
         </el-table-column>
         <el-table-column
@@ -223,7 +223,7 @@
             label="特殊说明"
             width="180">
           <template slot-scope="scope">
-            <p><span>{{scope.row.specalnote || '--'}}</span></p>
+            <p><span>{{scope.row.specalnote || '&#45;&#45;'}}</span></p>
           </template>
         </el-table-column>
         
@@ -250,7 +250,7 @@
             <div v-else-if="scope.row.discountDifferenceAmount < 0 " >
               <p><span style="color: #ef230c ">{{tool.formatAmount(scope.row.amount,2)}}</span></p>
             </div>
-<!--            <p v-else><span>{{tool.formatAmount(scope.row.amount,2)}}</span></p>-->
+&lt;!&ndash;            <p v-else><span>{{tool.formatAmount(scope.row.amount,2)}}</span></p>&ndash;&gt;
           </template>
         </el-table-column>
         <el-table-column
@@ -260,10 +260,10 @@
             fixed="right">
           <template slot-scope="scope">
             <i class="el-icon-check" v-if="scope.row.discountDifferenceAmount < 0"  style="color: red;font-size: 20px"></i>
-            <p v-else>--</p>
+            <p v-else>&#45;&#45;</p>
           </template>
         </el-table-column>
-        <!-- <el-table-column
+        &lt;!&ndash; <el-table-column
             prop="operation"
             fixed="right"
             label="操作"
@@ -280,8 +280,37 @@
 
            <el-button  size="mini" type="text" class="inline-16" @click="saveShow = false;index = '';productData()" v-if="saveShow && index === scope.row.rowindex">取 消</el-button>
           </template>
-        </el-table-column> -->
-      </el-table>
+        </el-table-column> &ndash;&gt;
+      </el-table>-->
+      <tableLayout :layout="tablecols" checkbox="true"  :data="list" :opwidth="200" height="calc(100vh - 550px)" :width="true" :custom="true" fixedName="offerPrice amount" @selectionChange="selectionChange">
+        <template v-slot:customcol="scope">
+          <div v-if="scope.column.columnname == 'qty'">
+            <el-input-number :disabled="data.status !== '新建' || !tool.checkAuth($route.name,'productDetails') || !disabled" v-model="scope.column.data.qty" size="mini"  :min="1" label="描述文字" @change="onChangeNum(scope.column.data.qty,scope.column.data,scope.$index)"></el-input-number>
+          </div>
+          <div v-else-if="scope.column.columnname == 'discountrate'">
+            <el-input :disabled="data.status !== '新建' || !tool.checkAuth($route.name,'productDetails') || !disabled"  v-model="scope.column.data.discountrate" size="mini" placeholder="请输入折扣" @change="onChangeDiscountrate(scope.column.data.discountrate,scope.column.data,scope.$index)"></el-input>
+          </div>
+          <div v-else-if="scope.column.columnname == 'price'">
+            <el-input :disabled="data.status !== '新建' || !tool.checkAuth($route.name,'productDetails') || !disabled"  v-model="scope.column.data.price" size="mini" placeholder="请输入单价" @change="onChangePrice(scope.column.data.price,scope.column.data,scope.$index)"></el-input>
+          </div>
+          <div v-else-if="scope.column.columnname == 'offerPrice'">
+            <span v-if="scope.column.data.discountDifferenceAmount < 0" style="color: red">是</span>
+            <span v-else>否</span>
+          </div>
+          <div v-else-if="scope.column.columnname == 'amount'">
+            <span v-if="scope.column.data.discountDifferenceAmount < 0" style="color: red">{{tool.formatAmount(scope.column.data.amount,2)}}</span>
+            <span v-else style="color: #5daf34">{{tool.formatAmount(scope.column.data.amount,2)}}</span>
+          </div>
+          <div v-else-if="scope.column.columnname == 'discountDifferenceAmount'">
+            <span v-if="scope.column.data.discountDifferenceAmount < 0" style="color: red">{{tool.formatAmount(scope.column.data.discountDifferenceAmount,2)}}</span>
+            <span v-else style="color: #5daf34">{{tool.formatAmount(scope.column.data.discountDifferenceAmount,2)}}</span>
+          </div>
+          <div v-else-if="scope.column.columnname == 'marketprice'">
+            <p>{{tool.formatAmount((scope.column.data.marketprice),2)}}</p>
+          </div>
+          <p v-else>{{scope.column.data[scope.column.columnname]}}</p>
+        </template>
+      </tableLayout>
       <div style="height: 35px;margin-top: 20px">
         <div style="float: left">总金额(元):{{ tool.formatAmount(totalPrice,2) }}</div>
         <div style="float: right">
@@ -657,6 +686,7 @@ export default {
   },
   created() {
     this.tablecolsAdd = this.tool.tabelCol(this.$route.name).addProductTable.tablecols
+    this.tablecols = this.tool.tabelCol(this.$route.name).productDetailsDiscountTable.tablecols
   }
 }
 </script>

+ 679 - 0
src/SDrpManagement/QuotedPrice/detail/modules/productInventory/indexCopy1.vue

@@ -0,0 +1,679 @@
+<template>
+  <div>
+    <div style="margin-bottom: 15px">
+      <el-input
+          size="small"
+          style="width: 200px;"
+          class="inline-16"
+          suffix-icon="el-icon-search"
+          v-model="param.content.where.condition"
+          placeholder="产品名称,产品编号,品号"
+          @keyup.enter.native="productData(param.content.pageNumber = 1)"
+          @clear="productData(param.content.pageNumber = 1)"
+          clearable
+          border>
+      </el-input>&nbsp;
+<!--      <product_table style="float: right" :data="data"  ref="quoterPrice" @productAdd="productInitialization" ></product_table>-->
+      <uploadAllData
+          v-if="tool.checkAuth($route.name,'productDetails') && data.status === '新建' && disabled"
+          class="inline-16"
+          :total="total"
+          @onSuccess="productData()"
+          @handlePullApi="handlePullApi"
+          @handleDelApi="handleDelApi"
+          idName="sa_quotedprice_itemsid"
+          type="del"
+      ></uploadAllData>
+      <el-button size="small" class="inline-16" :type="itemids.length === 0?'':'primary'" :disabled="itemids.length === 0" @click="deleteProducts">删除</el-button>
+      <addProductProject v-if="tool.checkAuth($route.name,'productDetails') && data.status === '新建' && disabled && data.quotedpricetype === '项目报价'"
+                           class="inline-16" @productAdd="productData" title="自项目产品添加" :params="paramsProjectAdd" :tablecolsAdd="tablecolsAdd"
+                         @addSuccess="addProducts" @addProduct="addProduct" @uploadData="uploadData" @closeDrawer="productData"
+                         :tradefield="data.tradefield" ref="addProductProject"
+      ></addProductProject>
+<!--      <productTable v-if="tool.checkAuth($route.name,'productDetails') && data.status === '新建' && disabled"  class="inline-16" @productAdd="productData"></productTable>-->
+      <addProduct v-if="tool.checkAuth($route.name,'productDetails') && data.status === '新建' && disabled"
+                  class="inline-16" @productAdd="productData" :params="paramsAdd" :tablecolsAdd="tablecolsAdd" title="自产品档案添加"
+                  @addSuccess="addProducts" @addProduct="addProduct" @uploadData="uploadData" @closeDrawer="productData"
+                  :tradefield="data.tradefield" ref="addProduct"
+      ></addProduct>
+    </div>
+    <div class="produtMag-panel">
+      <el-table
+          ref="multipleTable"
+          :data="list"
+          style="width: 100%"
+          height="calc(100vh - 500px)"
+          :header-cell-style="{height:'50px',color:'#606266',fontWeight:'400'}"
+          :cell-style="{height:'50px',color:'#666666',fontWeight:'400'}"
+          @selection-change="selectionChange"
+         border>
+        <el-table-column
+            type="selection"
+            width="55"
+            fixed>
+        </el-table-column>
+<!--        <el-table-column
+            align="center"
+            label="产品图"
+            width="100">
+          <template slot-scope="scope">
+            <div v-if="scope.row.attinfos[0]">
+              <previewImage class="image" :image="scope.row.attinfos[0]" :list="scope.row.attinfos" :deletebtn="false"></previewImage>
+            </div>
+          </template>
+        </el-table-column>-->
+        <el-table-column
+            prop="itemname"
+            label="商品名称"
+            width="180">
+        </el-table-column>
+        <el-table-column
+            prop="itemno"
+            label="编码"
+            width="180">
+        </el-table-column>
+        <el-table-column
+            prop="erpitemno"
+            label="品号"
+            width="180">
+        </el-table-column>
+        <el-table-column
+            label="型号"
+            width="180">
+          <template slot-scope="scope">
+            <p><span>{{scope.row.model}}</span></p>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="marketprice"
+            label="牌价"
+            width="80"
+        >
+          <template slot-scope="scope">
+            <p><span>{{scope.row.marketprice?tool.formatAmount(scope.row.marketprice,2):'--'}}</span></p>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="num"
+            label="数量"
+            width="160"
+        >
+          <template slot-scope="scope">
+            <span>
+<!--              <el-input-number :disabled="!saveShow || index !== scope.row.rowindex" v-model="scope.row.qty" size="mini"  :min="1" label="描述文字" @change="onChangeNum(scope.row.qty,scope.row,scope.$index)"></el-input-number>-->
+                  <el-input-number :disabled="data.status !== '新建'" v-model="scope.row.qty" size="mini"  :min="1" label="描述文字" @change="onChangeNum(scope.row.qty,scope.row,scope.$index)"></el-input-number>
+
+            </span>
+          </template>
+        </el-table-column>
+        
+        <el-table-column
+            prop="discountrate"
+            label="折扣(%)"
+            width="100"
+        >
+          <template slot-scope="scope">
+            <div v-if="scope.row.discountDifferenceAmount >= 0 ">
+              <span v-if="tool.checkAuth($route.name,'productDetails') || data.status == '新建' || disabled">
+                 <el-input :disabled="data.status !== '新建'"  v-model="scope.row.discountrate" size="mini" placeholder="请输入折扣" @change="onChangeDiscountrate(scope.row.discountrate,scope.row,scope.$index)"></el-input>
+              </span>
+            </div>
+            <div v-else-if="scope.row.discountDifferenceAmount < 0 ">
+              <span v-if="tool.checkAuth($route.name,'productDetails') || data.status == '新建' || disabled">
+                 <el-input :disabled="data.status !== '新建'"  v-model="scope.row.discountrate" size="mini" placeholder="请输入折扣" @change="onChangeDiscountrate(scope.row.discountrate,scope.row,scope.$index)"></el-input>
+              </span>
+            </div>
+<!--            <span v-else>
+              <span v-if="saveShow && index === scope.row.rowindex">
+                 <el-input v-model="scope.row.discountrate" size="mini" placeholder="请输入折扣" @change="onChangeDiscountrate(scope.row.discountrate,scope.row,scope.$index)"></el-input>
+              </span>
+              <span v-else>
+                <span >{{tool.formatAmount(scope.row.discountrate,2)}}</span>
+              </span>
+
+            </span>-->
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="price"
+            label="单价"
+            width="120"
+        >
+          <template slot-scope="scope">
+            <div v-if="scope.row.discountDifferenceAmount >= 0 ">
+              <p v-if="!disabled"><span :style="[setTopColor]">{{tool.formatAmount(scope.row.price,2)}}</span></p>
+              <span v-if="tool.checkAuth($route.name,'productDetails') || data.status == '新建' || disabled">
+                <el-input :disabled="data.status !== '新建'"  v-model="scope.row.price" size="mini" placeholder="请输入单价" @change="onChangePrice(scope.row.price,scope.row,scope.$index)"></el-input>
+              </span>
+            </div>
+            <div v-else-if="scope.row.discountDifferenceAmount < 0 " >
+              <p v-if="!disabled"><span :style="[setDownColor]">{{tool.formatAmount(scope.row.price,2)}}</span></p>
+              <span v-if="tool.checkAuth($route.name,'productDetails') || data.status == '新建' || disabled">
+                <el-input :disabled="data.status !== '新建'"  v-model="scope.row.price" size="mini" placeholder="请输入单价" @change="onChangePrice(scope.row.price,scope.row,scope.$index)"></el-input>
+              </span>
+            </div>
+<!--            <span v-else>
+              <span v-if="saveShow && index === scope.row.rowindex">
+                <el-input v-model="scope.row.price" size="mini" placeholder="请输入单价" @change="onChangePrice(scope.row.price,scope.row,scope.$index)"></el-input>
+              </span>
+               <span v-else>
+                <span >{{tool.formatAmount(scope.row.price,2)}}</span>
+              </span>
+            </span>-->
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="discountDifferenceAmount"
+            label="单价差额(元)"
+            width="100"
+        >
+          <template slot-scope="scope">
+            <p><span>{{tool.formatAmount(scope.row.discountDifferenceAmount,2)}}</span></p>
+          </template>
+        </el-table-column>
+        
+        
+        
+        <el-table-column
+            label="规格"
+            width="180">
+          <template slot-scope="scope">
+            <p><span>{{scope.row.spec}}</span></p>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="material"
+            label="材质"
+            width="180">
+          <template slot-scope="scope">
+            <p><span>{{scope.row.material?scope.row.material:'--'}}</span></p>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="standards"
+            label="标准"
+            width="100">
+        </el-table-column>
+        <el-table-column
+            prop="unitid"
+            label="计量单位"
+            width="100">
+          <template slot-scope="scope">
+            <el-tag size="mini" type="info" effect="plain">{{scope.row.unitname}}/{{scope.row.axunitname}}</el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="device"
+            label="装置"
+            width="180">
+          <template slot-scope="scope">
+            <p><span>{{scope.row.device || '--'}}</span></p>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="prodline"
+            label="产线"
+            width="180">
+          <template slot-scope="scope">
+            <p><span>{{scope.row.prodline || '--'}}</span></p>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="specalnote"
+            label="特殊说明"
+            width="180">
+          <template slot-scope="scope">
+            <p><span>{{scope.row.specalnote || '--'}}</span></p>
+          </template>
+        </el-table-column>
+        
+
+        <el-table-column
+            prop="mindiscountrate"
+            label="最低授权折扣(%)"
+            width="80"
+            >
+          <template slot-scope="scope">
+            <p><span>{{scope.row.mindiscountrate}}</span></p>
+          </template>
+        </el-table-column>
+
+        <el-table-column
+            prop="amount"
+            label="金额"
+            width="100"
+            fixed="right">
+          <template slot-scope="scope">
+            <div v-if="scope.row.discountDifferenceAmount >= 0  ">
+              <p ><span style="color: #79da56">{{tool.formatAmount(scope.row.amount,2)}}</span></p>
+            </div>
+            <div v-else-if="scope.row.discountDifferenceAmount < 0 " >
+              <p><span style="color: #ef230c ">{{tool.formatAmount(scope.row.amount,2)}}</span></p>
+            </div>
+<!--            <p v-else><span>{{tool.formatAmount(scope.row.amount,2)}}</span></p>-->
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="specialoffer"
+            label="是否特价"
+            width="50"
+            fixed="right">
+          <template slot-scope="scope">
+            <i class="el-icon-check" v-if="scope.row.discountDifferenceAmount < 0"  style="color: red;font-size: 20px"></i>
+            <p v-else>--</p>
+          </template>
+        </el-table-column>
+        <!-- <el-table-column
+            prop="operation"
+            fixed="right"
+            label="操作"
+            width="120">
+          <template slot-scope="scope">
+            <el-button  size="mini" type="text" class="inline-16" @click="onEdit(scope.row)" v-if="index !== scope.row.rowindex" :disabled="!tool.checkAuth($route.name,'productDetails') || data.status !== '新建' || !disabled">编 辑</el-button>
+            <el-button  size="mini" type="text" class="inline-16" @click="onSave(scope.row)" v-if="saveShow && index === scope.row.rowindex">保 存</el-button>
+            <el-popconfirm
+                title="确定删除该产品吗?"
+                @confirm="deleteProduct(scope.row)"
+            >
+              <el-button class="inline-16" slot="reference" size="mini" type="text"  :disabled="!tool.checkAuth($route.name,'productDetails') || data.status !== '新建' || !disabled" >删 除</el-button>
+            </el-popconfirm>
+
+           <el-button  size="mini" type="text" class="inline-16" @click="saveShow = false;index = '';productData()" v-if="saveShow && index === scope.row.rowindex">取 消</el-button>
+          </template>
+        </el-table-column> -->
+      </el-table>
+      <div style="height: 35px;margin-top: 20px">
+        <div style="float: left">总金额(元):{{ tool.formatAmount(totalPrice,2) }}</div>
+        <div style="float: right">
+          <el-pagination
+              background
+              @size-change="handleSizeChange"
+              @current-change="handleCurrentChange"
+              :current-page="param.content.pageNumber"
+              :page-sizes="[20, 50, 100, 200]"
+              :page-size="100"
+              layout="total,sizes, prev, pager, next, jumper"
+              :total="total">
+          </el-pagination>
+        </div>
+
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+import uploadFile from "@/components/upload/hw_obs_upload";
+import previewImage from "@/components/previewImage";
+import product_table from './productTable'
+import productTableProject from "@/SDrpManagement/QuotedPrice/components/productTableProject";
+import productTable from "@/SDrpManagement/QuotedPrice/components/productTable";
+import addProduct from '@/template/addProduct'
+import addProductProject from '@/template/addProduct'
+import uploadAllData from '@/components/uploadAllData/index'
+export default {
+  props:["data","disabled"],
+  name: "productInventory",
+  components:{uploadAllData,addProductProject,addProduct,uploadFile, previewImage,product_table,productTableProject,productTable},
+  data(){
+    return {
+      discountrate:'',
+      tablecols:[],
+      tablecolsAdd:[],
+      list:[],
+      total:0,
+      currentPage:0,
+      changeList:[],
+      totalPrice:0,
+      saveShow:false,
+      index:'',
+      setTopColor:{
+        color:'#79da56'
+      },
+      setDownColor:{
+        color:'#ef230c'
+      },
+      paramsAdd:{
+        "id": 20221020164903,
+        "content": {
+          "sa_projectid":0,
+          "sa_quotedpriceid":this.$route.query.id,
+          "pageNumber": 1,
+          "pageSize": 100,
+          "where": {
+            "condition": "",
+            "tradefield":"",
+            "itemclassid":"",
+            "sa_brandid":"",
+            "standards":""
+          }
+
+        }
+      },
+      paramsProjectAdd:{
+        "id": 20221020164903,
+        "content": {
+          "sa_projectid":this.data.sa_projectid,
+          "sa_quotedpriceid":this.$route.query.id,
+          "pageNumber": 1,
+          "pageSize": 100,
+          "where": {
+            "condition": "",
+            "tradefield":"",
+            "itemclassid":"",
+            "sa_brandid":"",
+            "standards":""
+          }
+
+        }
+      },
+      param:{
+        "id": 20221021095503,
+        "content": {
+          "sa_quotedpriceid":'',
+          "pageNumber": 1,
+          "pageSize": 100,
+          "where": {
+            "condition": ""
+          }
+        }
+      },
+      itemids:[],
+      items:[]
+    }
+  },
+  methods:{
+    /*产品配置信息*/
+    async productData(){
+      this.param.content.sa_quotedpriceid = this.$route.query.id
+      const res = await this.$api.requested(this.param)
+      this.list = res.data
+      this.total = res.total
+      this.totalPrice = 0
+      for (var i=0 ;i<res.data.length;i++){
+        this.list[i].discountrate = Math.round((res.data[i].discountrate * 100)*100)/100
+        this.list[i].mindiscountrate = Math.round((res.data[i].mindiscountrate * 100) * 100)/100
+        this.list[i].price = Math.round(res.data[i].price * 100)/100
+        this.list[i].discountDifferenceAmount = Math.round(res.data[i].discountDifferenceAmount * 100)/100
+       /* this.totalPrice = this.totalPrice + res.data[i].qty * res.data[i].price*/
+      }
+      if (this.total !== 0){
+        this.totalPrice = Math.round(res.data[0].rowstotal[0].sumamount * 100)/100
+      }
+      this.$emit('productSuccess')
+
+    },
+    /*批量添加商品*/
+    async addProducts(item){
+      this.items = []
+      this.items = item.map(e=>{
+        this.discountrate = e.discountrate || this.data.discountrate.toFixed(4)
+        return {
+          "sa_quotedprice_itemsid":0,
+          "itemid":e.itemid,
+          "price":(e.marketprice * this.discountrate).toFixed(4),
+          "marketprice":e.marketprice,
+          "discountrate":this.discountrate,
+          "qty":e.qty === ''? e.orderminqty:e.qty
+        }
+      })
+      const res = await this.$api.requested({
+        "id": 20221021095403,
+        "content": {
+          "sa_quotedpriceid":this.$route.query.id,     //sat_notice_classid<=0时 为新增
+          "items":this.items
+        }
+      })
+      this.tool.showMessage(res,()=>{
+        this.productData()
+        this.$refs.addProduct.listData()
+        this.$refs.addProductProject.listData()
+
+      })
+    },
+    /*单个添加商品*/
+    async addProduct(item){
+      this.discountrate = item.discountrate || this.data.discountrate.toFixed(4)
+      const res = await this.$api.requested({
+        "id": 20221021095403,
+        "content": {
+          "sa_quotedpriceid":this.$route.query.id,     //sat_notice_classid<=0时 为新增
+          "items":[
+            {
+              "sa_quotedprice_itemsid":0,
+              "itemid":item.itemid,
+              "price":(item.marketprice * this.discountrate).toFixed(4),
+              "discountrate":this.discountrate,
+              "qty":item.qty === '' ? item.orderminqty : item.qty,
+            }
+          ]
+        }
+      })
+      this.tool.showMessage(res,()=>{
+        this.productData()
+        this.$refs.addProduct.listData()
+        this.$refs.addProductProject.listData()
+      })
+    },
+    /*一键全选*/
+    uploadData(uploadApi,data){
+      uploadApi.id = 20221021095403
+      uploadApi.content = {
+        "sa_quotedpriceid": this.$route.query.id, //订单ID
+        "items": data.map(e=>{
+          this.discountrate = e.discountrate || this.data.discountrate.toFixed(4)
+          return {
+            sa_quotedprice_itemsid:0,
+            itemid:e.itemid,
+            qty:e.qty === '' ? e.orderminqty : e.qty,
+            marketprice:e.marketprice,
+            price:(e.marketprice * this.discountrate).toFixed(4),
+            discountrate:this.discountrate
+          }
+        })
+      }
+      this.productData()
+      this.$refs.addProduct.listData()
+    },
+    handleSizeChange(val) {
+      // console.log(`每页 ${val} 条`);
+      this.param.content.pageSize = val
+      this.productData()
+    },
+    handleCurrentChange(val) {
+      // console.log(`当前页: ${val}`);
+      this.param.content.pageNumber = val
+      this.productData()
+    },
+    onSuccess(){
+      this.productData()
+    },
+    clearData(){
+      this.search = ""
+      this.param.content.where.condition = this.search
+      this.productData()
+    },
+    queryClick(){
+      this.param.content.where.condition = this.search
+      this.productData()
+    },
+    /*批量勾选*/
+    selectionChange(val){
+      this.itemids = []
+      val.forEach((item,index)=>{
+        this.itemids[index] = item.sa_quotedprice_itemsid
+      })
+    },
+    checkForm(){
+      this.$emit('checkForm')
+    },
+    quoterPrice(id,type){
+      this.$refs.quoterPrice.queryProduct(id,type)
+    },
+    /*删除添加的产品*/
+    async deleteProduct(val){
+      const res = await this.$api.requested({
+        "id": 20221021095603,
+        "content": {
+          "sa_quotedprice_itemsids":[val.sa_quotedprice_itemsid]     //sat_notice_classid<=0时 为新增
+        }
+      })
+      this.tool.showMessage(res,()=>{
+        this.productData()
+      })
+    },
+    /*批量删除添加的产品*/
+   deleteProducts(){
+      this.$confirm('确定删除已选的产品吗?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(async () => {
+        const res = await this.$api.requested({
+          "id": 20221021095603,
+          "content": {
+            "sa_quotedprice_itemsids":this.itemids     //sat_notice_classid<=0时 为新增
+          }
+        })
+        this.tool.showMessage(res,()=>{
+          this.productData()
+        })
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '已取消删除'
+        });
+      });
+    },
+    /*获取要删除的数据*/
+    handlePullApi (pullApi) {
+      pullApi.content = JSON.parse(JSON.stringify(this.param.content))
+      pullApi.id = 20221021095503
+      pullApi.content.sa_quotedpriceid = this.$route.query.id
+    },
+    /*一键删除*/
+    handleDelApi (delApi,data) {
+      delApi.id = 20221021095603
+      delApi.content = {
+        "sa_quotedprice_itemsids":data,
+        "pageNumber":0,
+        "pageSize":0
+      }
+      this.productData()
+    },
+    onChangeNum (val,data,index) {
+      data.qty = Math.round(val *100)/100
+      data.amount = Math.round((data.qty * data.price) * 100)/100
+      data.discountDifferenceAmount = Math.round((data.marketprice * (data.discountrate/100) - data.marketprice * (data.mindiscountrate/100)) * 100)/100
+      this.$set(this.list,index,data)
+      this.totalPrice = 0
+      for (var i=0 ;i<this.list.length;i++){
+        this.totalPrice = this.totalPrice + this.list[i].qty * this.list[i].price
+      }
+      this.totalPrice = Math.round(this.totalPrice * 100)/100
+      this.$emit('productData',this.list)
+      this.onSave(this.list[index])
+    },
+    onChangeDiscountrate(val,data,index) {
+      data.specialoffer = 0
+      if (val > 100){
+        data.discountrate = 100
+      }else if (val <= 0){
+        data.discountrate = 1
+      }else {
+        data.discountrate = Math.round(val * 100)/100
+      }
+      data.price = Math.round((data.marketprice * (data.discountrate / 100)) *100)/100
+      data.amount = Math.round((data.qty * data.price)*100)/100
+      data.discountDifferenceAmount =  Math.round(( data.marketprice * (data.discountrate/100) - data.marketprice * (data.mindiscountrate/100)) * 100)/100
+      if (data.discountDifferenceAmount < 0){
+        data.specialoffer =1
+      }
+      this.$set(this.list,index,data)
+      this.totalPrice = 0
+      for (var i=0 ;i<this.list.length;i++){
+        this.totalPrice = this.totalPrice + this.list[i].qty * this.list[i].price
+      }
+      this.totalPrice = Math.round(this.totalPrice * 100)/100
+      this.$emit('productData',this.list)
+      this.onSave(this.list[index])
+    },
+    onChangePrice(val,data,index){
+      data.specialoffer = 0
+      if (val > data.marketprice) {
+        data.price = data.marketprice
+      }else if (val < data.marketprice * 0.01){
+        data.price = data.marketprice * 0.01
+      }else {
+        data.price = Math.round(data.price * 100)/100
+      }
+      data.discountrate = Math.round(((data.price / data.marketprice) * 100) *100)/100
+      data.discountDifferenceAmount =  Math.round(( data.marketprice * (data.discountrate/100) - data.marketprice * (data.mindiscountrate/100)) * 100)/100
+      data.amount = Math.round((data.qty * data.price)*100)/100
+      if (data.discountDifferenceAmount < 0){
+        data.specialoffer =1
+      }
+      this.$set(this.list,index,data)
+      this.totalPrice = 0
+      for (var i=0 ;i<this.list.length;i++){
+        this.totalPrice = this.totalPrice + this.list[i].qty * this.list[i].price
+      }
+      this.totalPrice = Math.round(this.totalPrice * 100)/100
+      this.$emit('productData',this.list)
+      this.onSave(this.list[index])
+    },
+    onEdit(row){
+      this.saveShow = true
+      this.index = row.rowindex
+    },
+    async onSave(row){
+
+      const res = await this.$api.requested({
+        "id": 20221021095403,
+        "content": {
+          "sa_quotedpriceid":this.$route.query.id,     //sat_notice_classid<=0时 为新增
+          "items":[
+            {
+              "sa_quotedprice_itemsid":row.sa_quotedprice_itemsid,
+              "itemid":row.itemid,
+              "price":row.price,
+              "discountrate":(row.discountrate / 100).toFixed(4),
+              "qty":row.qty
+            }
+          ]
+        }
+      })
+      this.tool.showMessage(res,()=>{
+        this.saveShow = false
+        this.index = ''
+        this.productData()
+        this.$emit('productSuccess')
+
+      })
+    }
+  },
+  mounted() {
+    this.productData()
+  },
+  created() {
+    this.tablecolsAdd = this.tool.tabelCol(this.$route.name).addProductTable.tablecols
+    this.tablecols = this.tool.tabelCol(this.$route.name).productDetailsDiscountTable.tablecols
+  }
+}
+</script>
+
+<style scoped>
+.produtMag-panel{
+  /* margin: 30px; */
+  padding:0 10px 10px 10px;
+  background: #fff;
+  border-radius:5px;
+  overflow: hidden;
+  border:1px solid rgb(0 0 0 / 5%)
+  /* box-shadow: 0 5px 5px rgb(0 0 0 / 10%);
+  transform: translate3d(0,-2px,0); */
+}
+.image {
+  width:38px;height:38px;margin:0px auto;
+}
+</style>

+ 9 - 2
src/components/dynamic-table/index.vue

@@ -2,7 +2,11 @@
   <div>
     <!-- :header-cell-style="{background:'#EEEEEE',color:'#333'}" -->
     <el-table ref="table" :row-class-name="tableClassName" highlight-current-row :data="data"  size="mini"  :height="height" @row-click="rowClick" style="width:100%;min-height:910px;" :header-cell-style="{height:'50px',color:'#606266',fontWeight:'400',fontSize:'14px'}"
-              :cell-style="{height:'50px',color:'#666666',fontWeight:'400'}" border>
+              :cell-style="{height:'50px',color:'#666666',fontWeight:'400'}" border @selection-change="selectionChange">
+      <el-table-column
+          type="selection"
+          width="55"  v-if="checkbox">
+      </el-table-column>
       <el-table-column v-for="col in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :width="width && col.width === 0 ? 150 : col.width" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?'right':false : false">
         <template slot-scope="scope">
           <div class="table-panel">
@@ -28,7 +32,7 @@ export default {
     custom:是否启用自定义结构;
     opwidth:操作列宽度
   */
-  props:['layout','data','custom','height','fixedName','width'],
+  props:['layout','data','custom','height','fixedName','width','checkbox'],
   data () {
     return {
       list:[],
@@ -45,6 +49,9 @@ export default {
     },
     tableClassName ({row,rowIndex}) {
       row.index = rowIndex
+    },
+    selectionChange(row){
+      this.$emit('selectionChange',row)
     }
   },
   mounted () {

+ 69 - 0
src/components/table/index5.vue

@@ -0,0 +1,69 @@
+<template>
+  <div>
+    <el-table ref="tables" :row-class-name="tableClassName" v-loading="loading" highlight-current-row :data="data" :header-cell-style="{height:'50px',color:'#606266',fontWeight:'400',fontSize:'14px'}"
+              :cell-style="{height:'50px',color:'#666666',fontWeight:'400'}" size="mini" :height="height" @row-click="rowClick" style="width:100%" @selection-change="handleSelectionChange"  border>
+      <el-table-column
+        type="selection"
+        width="55" @handleSelectionChange="handleSelectionChange"  >
+      </el-table-column>
+      <el-table-column  v-for="col in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :width="col.width">
+        <template slot-scope="scope">
+          <!-- 自定义表格显示内容 -->
+          <slot v-if="custom" name="customcol" :column="{data:scope.row,columnname:col.columnname}"></slot>
+          <!-- 否则就是默认 -->
+          <span v-else>{{scope.row[col.columnname]}}</span>
+          <!-- 操作结构内容 -->
+          <slot v-if="col.columnname === 'operation'" name="opreation" :data="scope.row"></slot>
+        </template>
+      </el-table-column>
+    </el-table>
+  </div>
+</template>
+
+<script>
+import {mapGetters} from "vuex"
+export default {
+  /*
+    layout:表结构数据;
+    data:表渲染数据;
+    custom:是否启用自定义结构;
+    opwidth:操作列宽度
+  */
+  props:['layout','data','custom','height','checkbox'],
+  data () {
+    return {
+      list:[],
+    }
+  },
+  computed:{
+    ...mapGetters({
+      loading:'loading'
+    })
+  },
+  methods:{
+    rowClick (row) {
+      this.$emit('rowClick',row)
+    },
+    tableClassName ({row,rowIndex}) {
+      row.index = rowIndex
+    },
+    handleSelectionChange(val) {
+      this.$emit('checkboxCallBack',val)      
+    },
+    isCheck(row,rowIndex) {
+      if (!row.status) return true
+      if(row.status == '待跟进' || row.status == '跟进中' || row.projectnum) {
+        return true
+      } else {
+        return false
+      }
+    }
+  },
+  mounted () {
+    // this.listData()
+  }
+}
+
+</script>
+<style>
+</style>