Browse Source

报价单

qymljy 2 years ago
parent
commit
b7b3f73daf

+ 397 - 0
src/SDrpManagement/QuotedPrice/components/productInventory.vue

@@ -0,0 +1,397 @@
+<template>
+  <div>
+    <div >
+      <el-input
+          size="small"
+          style="width: 200px;float: left"
+          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>
+      </el-input>&nbsp;
+      <product_table style="float: right" :id="data.sa_projectid"  ref="quoterPrice" @productAdd="productInitialization"></product_table>
+    </div>
+    <div class="produtMag-panel">
+      <el-table
+          ref="multipleTable"
+          :data="list"
+          style="width: 100%"
+          :header-cell-style="{height:'50px',color:'#768093',fontWeight:'100'}"
+          :cell-style="{height:'50px',color:'#768093',fontWeight:'200'}"
+          @selection-change="selectionChange">
+        <el-table-column
+            type="selection"
+            width="55">
+        </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="itemno"
+            label="产品编号"
+            width="180">
+        </el-table-column>
+        <el-table-column
+            prop="itemname"
+            label="产品名称"
+            width="180">
+        </el-table-column>
+        <el-table-column
+            label="型号/规格"
+            width="180">
+          <template slot-scope="scope">
+            <p><span>{{scope.row.model}}</span>&nbsp;/&nbsp;<span>{{scope.row.spec}}</span></p>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="caliber"
+            label="口径"
+            width="180">
+          <template slot-scope="scope">
+            <p><span>{{scope.row.caliber?scope.row.caliber:'--'}}</span></p>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="pressure"
+            label="压力"
+            width="180">
+          <template slot-scope="scope">
+            <p><span>{{scope.row.pressure?scope.row.pressure:'--'}}</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="brand"
+            label="品牌"
+            width="180">
+          <template slot-scope="scope">
+            <p v-for="(item,index) in scope.row.brand">
+              <span style="float: left" v-if="index === scope.row.brand.length -1">{{item?item.brandname+'':'--'}}</span>
+              <span style="float: left" v-else>{{item?item.brandname+',':'--'}}</span>
+            </p>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="itemclass"
+            label="类别"
+            width="180">
+          <template slot-scope="scope">
+            <p v-for="(item,index) in scope.row.itemclass">
+              <span style="float: left" v-if="index === scope.row.itemclass.length -1">{{item?item.itemclassname+'':'--'}}</span>
+              <span style="float: left" v-else>{{item?item.itemclassname+',':'--'}}</span>
+            </p>
+          </template>
+        </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="num"
+            label="数量"
+            width="180">
+          <template slot-scope="scope">
+            <el-input-number  v-model="scope.row.qty" size="mini" :min="1"  label="描述文字" @change="onChangeNum(scope.row.qty,scope.row,scope.$index)"></el-input-number>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="marketprice"
+            label="牌价"
+            width="100">
+          <template slot-scope="scope">
+            <p><span>{{scope.row.marketprice?scope.row.marketprice:'--'}}</span></p>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="discountrate"
+            label="折扣(%)"
+            width="100">
+          <template slot-scope="scope">
+            <el-input v-model="scope.row.discountrate" size="mini" placeholder="请输入折扣" @change="onChangeDiscountrate(scope.row.discountrate,scope.row,scope.$index)"></el-input>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="price"
+            label="单价"
+            width="100">
+          <template slot-scope="scope">
+            <el-input v-model="scope.row.price" size="mini" placeholder="请输入单价" @change="onChangePrice(scope.row.price,scope.row,scope.$index)"></el-input>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="amount"
+            label="金额"
+            width="100">
+          <template slot-scope="scope">
+            <p><span>{{scope.row.amount}}</span></p>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="specialoffer"
+            label="是否特价"
+            width="100">
+          <template slot-scope="scope">
+            <i class="el-icon-check" v-if="scope.row.specialoffer === 1"  style="color: red;font-size: 20px"></i>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="operation"
+            label="操作"
+            width="100">
+          <template slot-scope="scope">
+            <el-button size="mini" type="text" @click="deleteProduct(scope.row)">删除</el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+      <div style="margin-top:16px;text-align:right">
+        <el-pagination
+            background
+            small
+            @size-change="handleSizeChange"
+            @current-change="handleCurrentChange"
+            :current-page="currentPage"
+            :page-size="param.content.pageSize"
+            layout="total, prev, pager, next, jumper"
+            :total="total">
+        </el-pagination>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+import uploadFile from "@/components/upload/hw_obs_upload";
+import previewImage from "@/components/previewImage";
+import product_table from '../components/productTable'
+
+export default {
+  props:["data"],
+  name: "productInventory",
+  components:{uploadFile, previewImage,product_table},
+  data(){
+    return {
+      tablecols:[],
+      list:[],
+      total:0,
+      currentPage:0,
+      changeList:[],
+      param:{
+        "id": 20221021095503,
+        "version":1,
+        "content": {
+          "sa_quotedpriceid":'',
+          "pageNumber": 1,
+          "pageSize": 20,
+          "where": {
+            "condition": ""
+          }
+
+        }
+      }
+    }
+  },
+  methods:{
+    /*产品配置信息新增初始化*/
+    async productInitialization(id){
+      this.param.content.sa_quotedpriceid = id
+      const res = await this.$api.requested(this.param)
+      this.list = res.data
+      this.total = res.total
+      for (var i=0 ;i<this.list.length;i++){
+
+        this.list[i].discountrate = this.list[i].discountrate * 100
+
+      }
+      console.log(this.list,'产品配置信息')
+    },
+    /*产品配置信息*/
+    async productData(id){
+      this.param.content.sa_quotedpriceid = id
+      const res = await this.$api.requested(this.param)
+      this.list = res.data
+      this.total = res.total
+      for (var i=0 ;i<this.list.length;i++){
+        this.list[i].discountrate = this.list[i].discountrate * 100
+      }
+      console.log(this.list,'产品配置信息')
+    },
+    /*修改折扣或单价的时候刷新*/
+    async productDiscountrateData(id){
+      this.param.content.sa_quotedpriceid = id
+      const res = await this.$api.requested(this.param)
+      this.list = res.data
+      this.total = res.total
+      for (var i=0 ;i<this.list.length;i++){
+        this.list[i].discountrate = this.list[i].discountrate * 100
+      }
+      console.log(this.list,'产品配置信息')
+    },
+    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(){},
+    checkForm(){
+      this.$emit('checkForm')
+    },
+    quoterPrice(id,type){
+      console.log(id,"报价单id")
+      console.log(type,"项目报价")
+      this.$refs.quoterPrice.queryProduct(id,type)
+    },
+    onChangeNum (val,data,index) {
+      console.log(val,data,index)
+      /* data.amount = data.qty * data.price*/
+      this.$set(this.list,index,data)
+      this.$nextTick(()=>{
+        let obj = this.list.map(e=>{
+          return {
+            sa_quotedprice_itemsid:e.sa_quotedprice_itemsid,
+            itemid:e.itemid,
+            oldprice:e.marketprice,
+            price:e.price,
+            discountrate:(e.discountrate/100).toFixed(4),
+            qty:e.qty
+          }
+        })
+        this.changeData(obj)
+      })
+    },
+    onChangeDiscountrate(val,data,index) {
+      /* data.price = data.marketprice * (data.discountrate / 100)
+       data.amount = (data.qty * data.price).toFixed(2)*/
+      this.$set(this.list,index,data)
+      this.$nextTick(()=>{
+        let obj = this.list.map(e=>{
+          return {
+            sa_quotedprice_itemsid:e.sa_quotedprice_itemsid,
+            itemid:e.itemid,
+            oldprice:e.marketprice,
+            price:0,
+            discountrate:(e.discountrate/100).toFixed(4),
+            qty:e.qty
+          }
+        })
+        this.changeDiscountrateData(obj)
+      })
+    },
+    onChangePrice(val,data,index){
+      /*data.discountrate = ((data.price / data.marketprice) * 100).toFixed(2)
+      data.amount = data.qty * data.price*/
+      this.$set(this.list,index,data)
+      this.$nextTick(()=>{
+        this.objSet(this.list)
+      })
+    },
+    objSet(data){
+      let obj = data.map(e=>{
+        return {
+          sa_quotedprice_itemsid:e.sa_quotedprice_itemsid,
+          itemid:e.itemid,
+          oldprice:e.marketprice,
+          price:e.price,
+          discountrate:0,
+          qty:e.qty
+        }
+      })
+      this.changeDiscountrateData(obj)
+    },
+    async changeData(obj){
+      console.log(this.list,"数据")
+      const res = await this.$api.requested({
+        "id": 20221021095403,
+        "version":1,
+        "content": {
+          "sa_quotedpriceid":this.list[0].sa_quotedpriceid,     //sat_notice_classid<=0时 为新增
+          "items":obj
+        }
+      })
+      console.log(res)
+      this.productData(res.data[0].sa_quotedpriceid)
+    },
+    async changeDiscountrateData(obj){
+      console.log(this.list,"数据")
+      const res = await this.$api.requested({
+        "id": 20221021095403,
+        "version":1,
+        "content": {
+          "sa_quotedpriceid":this.list[0].sa_quotedpriceid,     //sat_notice_classid<=0时 为新增
+          "items":obj
+        }
+      })
+      console.log(res)
+      this.productDiscountrateData(res.data[0].sa_quotedpriceid)
+    },
+    async deleteProduct(val){
+      console.log(val)
+      const res = await this.$api.requested({
+        "id": 20221021095603,
+        "version":1,
+        "content": {
+          "sa_quotedprice_itemsids":[val.sa_quotedprice_itemsid]     //sat_notice_classid<=0时 为新增
+        }
+      })
+      this.tool.showMessage(res,()=>{
+        this.productData(val.sa_quotedpriceid)
+      })
+    }
+  },
+  mounted() {
+    console.log(this.data)
+    this.productData(this.data.sa_quotedpriceid)
+  }
+}
+</script>
+
+<style scoped>
+.produtMag-panel{
+  margin-top: 35px;
+  background: #fff;
+  border-radius:5px;
+
+  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:80px;height:80px;margin:0px auto;
+}
+</style>

+ 3 - 2
src/SDrpManagement/QuotedPrice/components/quotedPriceProduct.vue

@@ -195,6 +195,7 @@ export default {
       total:0,
       currentPage:0,
       changeList:[],
+      sa_quotedpriceid:'',
       param:{
         "id": 20221021095503,
         "version":1,
@@ -288,7 +289,7 @@ export default {
             itemid:e.itemid,
             oldprice:e.marketprice,
             price:e.price,
-            discountrate:e.discountrate,
+            discountrate:(e.discountrate/100).toFixed(4),
             qty:e.qty
           }
         })
@@ -306,7 +307,7 @@ export default {
             itemid:e.itemid,
             oldprice:e.marketprice,
             price:0,
-            discountrate:e.discountrate/100,
+            discountrate:(e.discountrate/100).toFixed(4),
             qty:e.qty
           }
         })

+ 69 - 3
src/SDrpManagement/QuotedPrice/detail/components/examineTo.vue

@@ -1,8 +1,21 @@
 <template>
   <div>
-    <el-popconfirm title="确定通过审核吗?" @confirm="CheckRow()">
-      <el-button slot="reference" size="mini" style="width:100%">审 核</el-button>
-    </el-popconfirm>
+    <el-button slot="reference" size="mini" style="width:100%" @click="onShow">审 核</el-button>
+    <el-dialog title="报价单审核" :visible.sync="draw" width="20%" append-to-body>
+      <el-form :model="form">
+        <el-form-item  :label-width="formLabelWidth">
+          <p>是否对该报价单进行审核</p>
+        </el-form-item>
+        <el-form-item v-if="examineDraw" label="退回原因:" :label-width="formLabelWidth" prop="backreason">
+          <el-input size="small" v-model="form.backreason"></el-input>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button size="mini" @click="draw = false">取 消</el-button>
+        <el-button type="primary" size="mini" @click="breakShow">退 回</el-button>
+        <el-button type="primary" size="mini" @click="onExamine">确 定</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
@@ -10,6 +23,29 @@
 export default {
   name: "examineTo",
   props:["sa_quotedpriceid"],
+  data(){
+    return {
+      draw:false,
+      examineDraw:false,
+      form: {
+        name: '',
+        backreason:'',
+        region: '',
+        date1: '',
+        date2: '',
+        delivery: false,
+        type: [],
+        resource: '',
+        desc: ''
+      },
+      rules:{
+        backreason:[
+          { required: true, message: '还未填写退回原因', trigger: 'change'},
+        ],
+      },
+      formLabelWidth: '120px'
+    }
+  },
   methods:{
     async CheckRow(){
       console.log("报价单id"+this.sa_quotedpriceid)
@@ -24,6 +60,36 @@ export default {
         console.log(res)
         this.$emit("onExamine")
       })
+    },
+    onShow(){
+      this.draw = true
+    },
+    breakShow(){
+      this.examineDraw = true
+    },
+    onExamine(){
+      console.log("审核操作开始")
+      if (this.form.backreason === ''){
+        console.log("执行222")
+        this.CheckRow()
+      }else{
+        console.log("执行1111")
+        this.onBack()
+      }
+    },
+    async onBack(){
+      console.log("执行")
+      /*this.$refs.form.validate(async (valid) => {
+        if (!valid) return false*/
+        const res = await this.$api.requested({
+          "sa_quotedpriceid":this.sa_quotedpriceid,
+          "backreason":this.form.backreason
+        })
+        this.tool.showMessage(res,()=>{
+          console.log(res)
+          this.$emit("onExamine")
+        })
+      /*})*/
     }
   }
 }

+ 5 - 1
src/SDrpManagement/QuotedPrice/detail/index.vue

@@ -29,6 +29,9 @@
       <div slot="slot1" class="container normal-panel">
         <project_change :data="mainData" v-if="flag"></project_change>
       </div>
+      <div slot="slot2" class="container normal-panel">
+        <productInventory :data="mainData" v-if="flag"></productInventory>
+      </div>
       <div slot="slot3" class="container normal-panel">
         <customer_assocalated :data="mainData" v-if="flag"></customer_assocalated>
       </div>
@@ -50,6 +53,7 @@ import submit_to from './components/submitTo'
 import examine_to from './components/examineTo'
 import project_change from './modules/projectChange/index'
 import customer_assocalated from './modules/customerAssociated/index'
+import productInventory from './modules/productInventory/index'
 export default {
   name: "index",
   data(){
@@ -60,7 +64,7 @@ export default {
     }
   },
   components:{
-    detailed,contacts,address_manage,submit_to,examine_to,project_change,customer_assocalated
+    detailed,contacts,address_manage,submit_to,examine_to,project_change,customer_assocalated,productInventory
   },
   methods:{
     async queryMainData(id){

+ 397 - 0
src/SDrpManagement/QuotedPrice/detail/modules/productInventory/index.vue

@@ -0,0 +1,397 @@
+<template>
+  <div>
+    <div >
+      <el-input
+          size="small"
+          style="width: 200px;float: left"
+          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>
+      </el-input>&nbsp;
+      <product_table style="float: right" :data="data"  ref="quoterPrice" @productAdd="productInitialization"></product_table>
+    </div>
+    <div class="produtMag-panel">
+      <el-table
+          ref="multipleTable"
+          :data="list"
+          style="width: 100%"
+          :header-cell-style="{height:'50px',color:'#768093',fontWeight:'100'}"
+          :cell-style="{height:'50px',color:'#768093',fontWeight:'200'}"
+          @selection-change="selectionChange">
+        <el-table-column
+            type="selection"
+            width="55">
+        </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="itemno"
+            label="产品编号"
+            width="180">
+        </el-table-column>
+        <el-table-column
+            prop="itemname"
+            label="产品名称"
+            width="180">
+        </el-table-column>
+        <el-table-column
+            label="型号/规格"
+            width="180">
+          <template slot-scope="scope">
+            <p><span>{{scope.row.model}}</span>&nbsp;/&nbsp;<span>{{scope.row.spec}}</span></p>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="caliber"
+            label="口径"
+            width="180">
+          <template slot-scope="scope">
+            <p><span>{{scope.row.caliber?scope.row.caliber:'--'}}</span></p>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="pressure"
+            label="压力"
+            width="180">
+          <template slot-scope="scope">
+            <p><span>{{scope.row.pressure?scope.row.pressure:'--'}}</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="brand"
+            label="品牌"
+            width="180">
+          <template slot-scope="scope">
+            <p v-for="(item,index) in scope.row.brand">
+              <span style="float: left" v-if="index === scope.row.brand.length -1">{{item?item.brandname+'':'--'}}</span>
+              <span style="float: left" v-else>{{item?item.brandname+',':'--'}}</span>
+            </p>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="itemclass"
+            label="类别"
+            width="180">
+          <template slot-scope="scope">
+            <p v-for="(item,index) in scope.row.itemclass">
+              <span style="float: left" v-if="index === scope.row.itemclass.length -1">{{item?item.itemclassname+'':'--'}}</span>
+              <span style="float: left" v-else>{{item?item.itemclassname+',':'--'}}</span>
+            </p>
+          </template>
+        </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="num"
+            label="数量"
+            width="180">
+          <template slot-scope="scope">
+            <el-input-number  v-model="scope.row.qty" size="mini" :min="1"  label="描述文字" @change="onChangeNum(scope.row.qty,scope.row,scope.$index)"></el-input-number>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="marketprice"
+            label="牌价"
+            width="100">
+          <template slot-scope="scope">
+            <p><span>{{scope.row.marketprice?scope.row.marketprice:'--'}}</span></p>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="discountrate"
+            label="折扣(%)"
+            width="100">
+          <template slot-scope="scope">
+            <el-input v-model="scope.row.discountrate" size="mini" placeholder="请输入折扣" @change="onChangeDiscountrate(scope.row.discountrate,scope.row,scope.$index)"></el-input>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="price"
+            label="单价"
+            width="100">
+          <template slot-scope="scope">
+            <el-input v-model="scope.row.price" size="mini" placeholder="请输入单价" @change="onChangePrice(scope.row.price,scope.row,scope.$index)"></el-input>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="amount"
+            label="金额"
+            width="100">
+          <template slot-scope="scope">
+            <p><span>{{scope.row.amount}}</span></p>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="specialoffer"
+            label="是否特价"
+            width="100">
+          <template slot-scope="scope">
+            <i class="el-icon-check" v-if="scope.row.specialoffer === 1"  style="color: red;font-size: 20px"></i>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="operation"
+            label="操作"
+            width="100">
+          <template slot-scope="scope">
+            <el-button size="mini" type="text" @click="deleteProduct(scope.row)">删除</el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+      <div style="margin-top:16px;text-align:right">
+        <el-pagination
+            background
+            small
+            @size-change="handleSizeChange"
+            @current-change="handleCurrentChange"
+            :current-page="currentPage"
+            :page-size="param.content.pageSize"
+            layout="total, prev, pager, next, jumper"
+            :total="total">
+        </el-pagination>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+import uploadFile from "@/components/upload/hw_obs_upload";
+import previewImage from "@/components/previewImage";
+import product_table from './productTable'
+
+export default {
+  props:["data"],
+  name: "productInventory",
+  components:{uploadFile, previewImage,product_table},
+  data(){
+    return {
+      tablecols:[],
+      list:[],
+      total:0,
+      currentPage:0,
+      changeList:[],
+      param:{
+        "id": 20221021095503,
+        "version":1,
+        "content": {
+          "sa_quotedpriceid":'',
+          "pageNumber": 1,
+          "pageSize": 20,
+          "where": {
+            "condition": ""
+          }
+
+        }
+      }
+    }
+  },
+  methods:{
+    /*产品配置信息新增初始化*/
+    async productInitialization(id){
+      this.param.content.sa_quotedpriceid = id
+      const res = await this.$api.requested(this.param)
+      this.list = res.data
+      this.total = res.total
+      for (var i=0 ;i<this.list.length;i++){
+
+        this.list[i].discountrate = this.list[i].discountrate * 100
+
+      }
+      console.log(this.list,'产品配置信息')
+    },
+    /*产品配置信息*/
+    async productData(){
+      this.param.content.sa_quotedpriceid = this.data.sa_quotedpriceid
+      const res = await this.$api.requested(this.param)
+      this.list = res.data
+      this.total = res.total
+      for (var i=0 ;i<this.list.length;i++){
+        this.list[i].discountrate = this.list[i].discountrate * 100
+      }
+      console.log(this.list,'产品配置信息')
+    },
+    /*修改折扣或单价的时候刷新*/
+    async productDiscountrateData(id){
+      this.param.content.sa_quotedpriceid = id
+      const res = await this.$api.requested(this.param)
+      this.list = res.data
+      this.total = res.total
+      for (var i=0 ;i<this.list.length;i++){
+        this.list[i].discountrate = this.list[i].discountrate * 100
+      }
+      console.log(this.list,'产品配置信息')
+    },
+    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(){},
+    checkForm(){
+      this.$emit('checkForm')
+    },
+    quoterPrice(id,type){
+      console.log(id,"报价单id")
+      console.log(type,"项目报价")
+      this.$refs.quoterPrice.queryProduct(id,type)
+    },
+    onChangeNum (val,data,index) {
+      console.log(val,data,index)
+      /* data.amount = data.qty * data.price*/
+      this.$set(this.list,index,data)
+      this.$nextTick(()=>{
+        let obj = this.list.map(e=>{
+          return {
+            sa_quotedprice_itemsid:e.sa_quotedprice_itemsid,
+            itemid:e.itemid,
+            oldprice:e.marketprice,
+            price:e.price,
+            discountrate:(e.discountrate/100).toFixed(4),
+            qty:e.qty
+          }
+        })
+        this.changeData(obj)
+      })
+    },
+    onChangeDiscountrate(val,data,index) {
+      /* data.price = data.marketprice * (data.discountrate / 100)
+       data.amount = (data.qty * data.price).toFixed(2)*/
+      this.$set(this.list,index,data)
+      this.$nextTick(()=>{
+        let obj = this.list.map(e=>{
+          return {
+            sa_quotedprice_itemsid:e.sa_quotedprice_itemsid,
+            itemid:e.itemid,
+            oldprice:e.marketprice,
+            price:0,
+            discountrate:(e.discountrate/100).toFixed(4),
+            qty:e.qty
+          }
+        })
+        this.changeDiscountrateData(obj)
+      })
+    },
+    onChangePrice(val,data,index){
+      /*data.discountrate = ((data.price / data.marketprice) * 100).toFixed(2)
+      data.amount = data.qty * data.price*/
+      this.$set(this.list,index,data)
+      this.$nextTick(()=>{
+        this.objSet(this.list)
+      })
+    },
+    objSet(data){
+      let obj = data.map(e=>{
+        return {
+          sa_quotedprice_itemsid:e.sa_quotedprice_itemsid,
+          itemid:e.itemid,
+          oldprice:e.marketprice,
+          price:e.price,
+          discountrate:0,
+          qty:e.qty
+        }
+      })
+      this.changeDiscountrateData(obj)
+    },
+    async changeData(obj){
+      console.log(this.list,"数据")
+      const res = await this.$api.requested({
+        "id": 20221021095403,
+        "version":1,
+        "content": {
+          "sa_quotedpriceid":this.list[0].sa_quotedpriceid,     //sat_notice_classid<=0时 为新增
+          "items":obj
+        }
+      })
+      console.log(res)
+      this.productData(res.data[0].sa_quotedpriceid)
+    },
+    async changeDiscountrateData(obj){
+      console.log(this.list,"数据")
+      const res = await this.$api.requested({
+        "id": 20221021095403,
+        "version":1,
+        "content": {
+          "sa_quotedpriceid":this.list[0].sa_quotedpriceid,     //sat_notice_classid<=0时 为新增
+          "items":obj
+        }
+      })
+      console.log(res)
+      this.productDiscountrateData(res.data[0].sa_quotedpriceid)
+    },
+    async deleteProduct(val){
+      console.log(val)
+      const res = await this.$api.requested({
+        "id": 20221021095603,
+        "version":1,
+        "content": {
+          "sa_quotedprice_itemsids":[val.sa_quotedprice_itemsid]     //sat_notice_classid<=0时 为新增
+        }
+      })
+      this.tool.showMessage(res,()=>{
+        this.productData(val.sa_quotedpriceid)
+      })
+    }
+  },
+  mounted() {
+    console.log(this.data)
+    this.productData()
+  }
+}
+</script>
+
+<style scoped>
+.produtMag-panel{
+  margin-top: 35px;
+  background: #fff;
+  border-radius:5px;
+
+  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:80px;height:80px;margin:0px auto;
+}
+</style>

+ 285 - 0
src/SDrpManagement/QuotedPrice/detail/modules/productInventory/productTable.vue

@@ -0,0 +1,285 @@
+<template>
+  <div>
+    <el-button size="small"  type="primary" icon="el-icon-plus" @click="onShow">添加商品</el-button>
+    <el-drawer
+        title="选择商品"
+        :visible.sync="dialogProductVisible"
+        append-to-body
+        size="70%"
+        direction="rtl"
+        @close="onColes">
+      <div class="drawer__panel">
+        <div class="flex-align-center flex-between ">
+          <slot name="operation"></slot>
+          <div class="flex-align-center">
+            <el-input size="small"  suffix-icon="el-icon-search" v-model="params.content.where.condition" placeholder="产品名称,编号" @keyup.enter.native="productData(params.content.pageNumber = 1)" @clear="productData(params.content.pageNumber = 1)" clearable></el-input>&nbsp;
+          </div>
+        </div>
+        <div class="produtMag-panel">
+          <el-table
+              ref="multipleTable"
+              :data="list"
+              style="width: 100%"
+              :header-cell-style="{height:'50px',color:'#768093',fontWeight:'100'}"
+              :cell-style="{height:'50px',color:'#768093',fontWeight:'200'}"
+              @selection-change="selectionChange">
+            <el-table-column
+                type="selection"
+                width="55">
+            </el-table-column>
+            <el-table-column
+                align="center"
+                label="产品图"
+                width="80">
+              <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="itemno"
+                label="产品编号"
+                width="180">
+            </el-table-column>
+            <el-table-column
+                prop="itemname"
+                label="产品名称"
+                width="180">
+            </el-table-column>
+            <el-table-column
+                label="型号/规格"
+                >
+              <template slot-scope="scope">
+                <p><span>{{scope.row.model}}</span>&nbsp;/&nbsp;<span>{{scope.row.spec}}</span></p>
+              </template>
+            </el-table-column>
+            <el-table-column
+                prop="caliber"
+                label="口径"
+                width="180">
+            </el-table-column>
+            <el-table-column
+                prop="pressure"
+                label="压力"
+                width="180">
+            </el-table-column>
+            <el-table-column
+                prop="material"
+                label="材质"
+                width="180">
+            </el-table-column>
+            <el-table-column
+                prop="brand"
+                label="品牌"
+                width="180">
+              <template slot-scope="scope">
+                <p v-for="(item,index) in scope.row.brand">
+                  <span style="float: left" v-if="index === scope.row.brand.length -1">{{item?item.brandname+'':'--'}}</span>
+                  <span style="float: left" v-else>{{item?item.brandname+',':'--'}}</span>
+                </p>
+              </template>
+            </el-table-column>
+            <el-table-column
+                prop="itemclass"
+                label="类别"
+                width="180">
+              <template slot-scope="scope">
+                <p v-for="(item,index) in scope.row.itemclass">
+                  <span style="float: left" v-if="index === scope.row.itemclass.length -1">{{item?item.itemclassname+'':'--'}}</span>
+                  <span style="float: left" v-else>{{item?item.itemclassname+',':'--'}}</span>
+                </p>
+              </template>
+            </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="marketprice"
+                label="牌价"
+                width="100">
+              <template slot-scope="scope">
+                  <span >{{scope.row.marketprice?scope.row.marketprice+',':'--'}}</span>
+              </template>
+            </el-table-column>
+          </el-table>
+          <div style="margin-top:16px;text-align:right">
+            <el-pagination
+                background
+                small
+                @size-change="handleSizeChange"
+                @current-change="handleCurrentChange"
+                :current-page="currentPage"
+                :page-size="params.content.pageSize"
+                layout="total, prev, pager, next, jumper"
+                :total="total">
+            </el-pagination>
+          </div>
+        </div>
+      </div>
+      <div class="fixed__btn__panel">
+        <el-button size="small" @click="onColes" class="normal-btn-width">取 消</el-button>
+        <el-button size="small" type="primary" @click="onSubmit"  class="normal-btn-width">确 定</el-button>
+      </div>
+    </el-drawer>
+  </div>
+</template>
+
+<script>
+import uploadFile from "@/components/upload/hw_obs_upload";
+import previewImage from "@/components/previewImage";
+
+export default {
+  name: "productTable",
+  props:["data"],
+  components:{uploadFile, previewImage},
+  data(){
+    return {
+      dialogProductVisible:false,
+      type:'',
+      tablecols:[],
+      list:[],
+      total:0,
+      currentPage:0,
+      tableSelectData:[],
+      selectData:[],
+      params:{
+        "id": 20221020164903,
+        "version":1,
+        "content": {
+          "sa_projectid":'',
+          "sa_quotedpriceid":"",
+          "pageNumber": 1,
+          "pageSize": 20,
+          "where": {
+            "condition": ""
+          }
+
+        }
+      }
+    }
+  },
+  methods:{
+    onShow(){
+      this.dialogProductVisible = true
+      console.log(this.data,"报价单")
+      this.productData()
+    },
+    onColes(){
+      this.dialogProductVisible = false
+    },
+    async onSubmit(){
+      const res = await this.$api.requested({
+        "id": 20221021095403,
+        "version":1,
+        "content": {
+          "sa_quotedpriceid":this.params.content.sa_quotedpriceid,     //sat_notice_classid<=0时 为新增
+          "items":this.selectData
+        }
+      })
+      this.tool.showMessage(res,()=>{
+        console.log(res)
+        this.dialogProductVisible = false
+        this.$emit('productAdd',this.params.content.sa_quotedpriceid)
+      })
+    },
+    /*获取产品信息*/
+    queryProduct(id,type){
+      console.log(id,type)
+      this.dialogProductVisible = true
+      this.params.content.sa_projectid = this.id
+      console.log(id,"报价单id五")
+      this.type = type
+      console.log(this.type)
+      this.productData(id)
+    },
+    /*产品配置信息*/
+    async productData(){
+      this.params.content.sa_quotedpriceid = this.data.sa_quotedpriceid
+      this.params.content.sa_projectid = this.data.sa_projectid
+      const res = await this.$api.requested(this.params)
+      this.list = res.data
+      this.total = res.total
+      console.log(res,'产品配置信息')
+      this.$nextTick(()=>{
+        console.log(this.data.quotedpricetype)
+        if (this.data.quotedpricetype === '项目报价'){
+          for (let i=0;i<this.list.length;i++){
+            this.$refs.multipleTable.toggleRowSelection(this.list[i],true)
+          }
+        }
+      })
+
+    },
+    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(){
+      console.log("执行")
+      this.search = ""
+      this.param.content.where.condition = this.search
+      this.productData()
+    },
+    queryClick(){
+      this.param.content.where.condition = this.search
+      this.productData()
+    },
+    selectionChange(val){
+      console.log(val)
+      this.tableSelectData = val
+      if (this.type === '项目报价'){
+        let obj = this.tableSelectData.map(e=>{
+          return {
+            sa_quotedprice_itemsid:'0',
+            itemid:e.itemid,
+            oldprice:e.marketprice,
+            /*price:(e.marketprice * 100)/100,*/
+            price:0,
+            discountrate:0,
+            qty:e.qty
+          }
+        })
+        console.log(obj)
+        this.selectData = obj
+      }else {
+        let obj = this.tableSelectData.map(e=>{
+          return {
+            sa_quotedprice_itemsid:'0',
+            itemid:e.itemid,
+            oldprice:e.marketprice,
+            /*price:(e.marketprice * 100)/100,*/
+            price:0,
+            discountrate:0,
+            qty:1
+          }
+        })
+        console.log(obj)
+        this.selectData = obj
+      }
+    }
+  },
+  mounted() {
+  }
+}
+</script>
+
+<style scoped>
+.image {
+  width:40px;height:40px;margin:0px auto;
+}
+</style>

+ 0 - 272
src/SDrpManagement/QuotedPrice/modules/ProjectQuotationAddCopy.vue

@@ -1,272 +0,0 @@
-<template>
-  <div>
-    <el-drawer
-        title="创建项目报价"
-        :visible.sync="drawer"
-        size="70%"
-        direction="rtl"
-        append-to-body
-        @close="onClose">
-      <div class="drawer__panel" style="margin-bottom: 0px">
-        <el-row style="margin-top: 10px">
-          <el-form :model="form" :rules="rules" ref="form"  size="mini" label-position="right">
-            <el-col :span="11">
-              <el-form-item label="报价类型:" label-width="90px" >
-                <el-input v-model="form.type" autocomplete="off" placeholder="报价类型" disabled></el-input>
-              </el-form-item>
-            </el-col>
-            <el-col :offset="2" :span="11">
-              <el-form-item label="是否特价:" label-width="90px" >
-                <el-input  v-model="form.specialOffer" autocomplete="off" placeholder="是否特价" disabled></el-input>
-              </el-form-item>
-            </el-col>
-            <el-col :span="11" v-if="isQuotedPrice">
-              <el-form-item label="项目名称:" label-width="90px" prop="projectname">
-                <el-input  v-model="form.projectname" autocomplete="off" placeholder="请选择项目" @focus="project" @projectList="projectList"></el-input>
-              </el-form-item>
-            </el-col>
-            <el-col :offset="2" :span="11" v-if="isQuotedPrice">
-              <el-form-item label="项目编号:" label-width="90px" >
-                <el-input  v-model="form.projectnum" autocomplete="off" placeholder="项目编号" disabled></el-input>
-              </el-form-item>
-            </el-col>
-            <el-col :span="11">
-              <el-form-item label="客户:" label-width="90px" prop="enterprisename">
-                <el-input  v-model="form.enterprisename" autocomplete="off" placeholder="请选择客户"  @focus="customer" @customerList="customerList"></el-input>
-              </el-form-item>
-            </el-col>
-            <el-col :offset="2" :span="11">
-              <el-form-item label="报价日期:" label-width="90px">
-                <el-date-picker
-                    v-model="form.billdate"
-                    style="width: 100%"
-                    type="date"
-                    value-format="yyyy-MM-dd"
-                    placeholder="选择日期"
-                    :picker-options="pickerOptions">
-                </el-date-picker>
-              </el-form-item>
-            </el-col>
-            <el-col :span="11">
-              <el-form-item label="有效期:" label-width="90px" >
-                <el-date-picker
-                    v-model="date"
-                    style="width: 100%"
-                    type="daterange"
-                    value-format="yyyy-MM-dd"
-                    range-separator="至"
-                    start-placeholder="开始日期"
-                    end-placeholder="结束日期"
-                    :picker-options="pickerOptions">
-                </el-date-picker>
-              </el-form-item>
-            </el-col>
-            <el-col :offset="2" :span="11">
-              <el-form-item label="联系人:" label-width="90px" prop="name">
-                <el-input  v-model="form.name" autocomplete="off" placeholder="联系人" @focus="contacts" @contactsList="contactsList"></el-input>
-              </el-form-item>
-            </el-col>
-            <el-col :span="11">
-              <el-form-item label="手机号:" label-width="90px" >
-                <el-input  v-model="form.phonenumber" autocomplete="off" placeholder="手机号" disabled></el-input>
-              </el-form-item>
-            </el-col>
-          </el-form>
-        </el-row>
-      </div>
-      <div >
-        <el-divider></el-divider>
-      </div>
-      <div style="margin:30px 20px 20px 20px">
-        <quoted_price_product :id="form.sa_projectid" ref="quoterPrice" @checkForm="onSubmit" ></quoted_price_product>
-      </div>
-      <div class="fixed__btn__panel">
-        <el-button size="small" @click="onClose" class="normal-btn-width">取 消</el-button>
-        <el-button :disabled="form.sa_quotedpriceid === 0" size="small" type="primary" @click="getSubmit" class="normal-btn-width">确 定</el-button>
-      </div>
-    </el-drawer>
-    <project_table v-if="projectDrawer" :projectDrawer="projectDrawer" @projectData="projectData" @projectList="projectList"></project_table>
-    <customer_table v-if="customerDrawer" :customerDrawer="customerDrawer" :id="form.sa_projectid" :isQuotedPrice="isQuotedPrice" @customerData="customerData"  @customerList="customerList"></customer_table>
-    <contacts_table v-if="contactsDrawer" :contactsDrawer="contactsDrawer" :id="form.sys_enterpriseid" @contactsData="contactsData" @contactsList="contactsList"></contacts_table>
-  </div>
-</template>
-
-<script>
-import project_table from '../components/projectTable'
-import customer_table from '../components/customerTable'
-import contacts_table from '../components/contactsTable'
-import quoted_price_product from '../components/quotedPriceProduct'
-export default {
-  name: "ProjectQuotationAdd",
-  props:["drawerShow","typeData"],
-  components:{project_table,customer_table,contacts_table,quoted_price_product},
-  data(){
-    return {
-      pickerOptions: {
-        disabledDate(time) {
-          return time.getTime() + 3600 * 1000 * 24 < Date.now() ;
-        },
-      },
-      drawer:false,
-      projectDrawer:false,
-      customerDrawer:false,
-      contactsDrawer:false,
-      isQuotedPrice:false,
-      date:[],
-      form:{
-        type:'',
-        projectnum:'',
-        enterprisename:'',
-        name:'',
-        phonenumber:'',
-        specialOffer:'否',
-        sa_quotedpriceid:0,     //sat_notice_classid<=0时 为新增
-        sys_enterpriseid: "",
-        contactsid:8,
-        sa_projectid: "0",
-        discountrate: 0,
-        remarks: "",
-        invaliddate: "",
-        projectname: "",
-        address: "",
-        billdate:"",
-        enddate:'',
-        begdate:''
-      },
-      rules:{
-        projectname:[
-          { required: true, message: '请选择项目', trigger: 'change'},
-        ],
-        enterprisename:[
-          { required: true, message: '请选择客户', trigger: 'change'},
-        ],
-        name:[
-          { required: true, message: '请选择联系人', trigger: 'change'},
-        ]
-      },
-    }
-  },
-  methods:{
-    onClose(){
-      this.drawer = false
-      this.$emit('addSuccess')
-    },
-    onSubmit(){
-      console.log(this.date)
-      if (this.date.length === 0){
-        this.form.begdate = ''
-        this.form.enddate = ''
-      }else {
-        this.form.begdate = this.date[0]
-        this.form.enddate = this.date[1]
-      }
-      console.log(this.form,"表单")
-      this.$refs.form.validate(async (valid) => {
-        if (!valid) return false
-        const res = await this.$api.requested({
-          "id": 20221020164803,
-          "version":1,
-          "content": this.form
-        })
-        this.$refs.quoterPrice.quoterPrice(res.data.sa_quotedpriceid,this.form.type)
-        this.form.sa_quotedpriceid = res.data.sa_quotedpriceid
-      })
-    },
-    getSubmit(){
-      this.drawer = false
-      console.log(this.data)
-      if (this.date === '' && this.date === 'undefined'){
-        this.form.begdate = ''
-        this.form.enddate = ''
-      }else {
-        this.form.begdate = this.date[0]
-        this.form.enddate = this.date[1]
-      }
-      console.log(this.form,"表单")
-      this.$refs.form.validate(async (valid) => {
-        if (!valid) return false
-        const res = await this.$api.requested({
-          "id": 20221020164803,
-          "version":1,
-          "content": this.form
-        })
-        this.tool.showMessage(res,() => {
-          this.$emit('addSuccess')
-        })
-      })
-
-    },
-    project(){
-      this.projectDrawer = true
-    },
-    customer(){
-      this.customerDrawer = true
-    },
-    contacts(){
-      this.contactsDrawer = true
-    },
-    customerList(){
-      this.customerDrawer = false
-    },
-    projectList(){
-      this.projectDrawer = false
-    },
-    contactsList(){
-      this.contactsDrawer = false
-    },
-    /*项目选择信息*/
-    projectData(val){
-      this.projectDrawer = false
-      this.form.sa_projectid = val.sa_projectid
-      this.form.projectname = val.projectname
-      this.form.projectnum = val.projectnum
-    },
-    /*客户选择信息*/
-    customerData(val){
-      this.contactsDrawer = false
-      this.form.sys_enterpriseid = val.sys_enterpriseid
-      this.form.enterprisename = val.enterprisename
-    },
-    /*联系人选择信息*/
-    contactsData(val){
-      this.contactsDrawer = false
-      this.form.contactsid = val.contactsid
-      this.form.name = val.name
-      this.form.phonenumber = val.phonenumber
-    },
-    /*isSpecial(val){
-      console.log("获取")
-      console.log(val,'是否特价')
-    }*/
-
-
-  },
-  mounted() {
-    if (this.drawerShow){this.drawer = true}
-    console.log(this.typeData)
-    this.form.type = this.typeData
-    if (this.typeData === '项目报价'){
-      this.isQuotedPrice = true
-    }else {
-      this.isQuotedPrice = false
-    }
-    const date = new Date()
-    console.log(date)
-    this.form.billdate = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()
-    console.log(this.form)
-  },
-  created() {
-    /*if (this.drawerShow){
-      this.drawer = true
-    }*/
-  }
-}
-</script>
-
-<style scoped>
->>> .el-divider--horizontal {
-  height: 1px;
-  width: 100%;
-  margin: 0px;
-}
-</style>

+ 1 - 1
src/components/dynamic-table/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
     <el-table ref="table" :row-class-name="tableClassName" highlight-current-row :data="data" :header-cell-style="{background:'#EEEEEE',color:'#333'}" size="mini" :height="height" @row-click="rowClick" style="width:100%;min-height:300px"  border>
-      <el-table-column v-for="col in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :width="col.width === 0 ? 150 : col.width" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?'right':false : ''">
+      <el-table-column v-for="col in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :width="col.width" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?'right':false : ''">
         <template slot-scope="scope">
           <!-- 自定义表格显示内容 -->
           <slot v-if="custom" name="customcol" :column="{data:scope.row,columnname:col.columnname}"></slot>