Browse Source

销售预测

qymljy 2 years ago
parent
commit
40725e3bcc

+ 2 - 1
src/HDrpManagement/contractManage/components/selectAgent.vue

@@ -33,7 +33,7 @@
 	</div>
   <el-empty v-if="tableData.length === 0" description="暂无数据" :image-size="40"></el-empty>
   <el-button size="mini" type="text" style="margin-top:16px;float:right" @click="onCancel">取 消</el-button>
-	<el-button size="mini" type="primary" style="margin-top:16px;float:right;margin-right:10px" @click="onSelect">确 定</el-button>
+<!--	<el-button size="mini" type="primary" style="margin-top:16px;float:right;margin-right:10px" @click="onSelect">确 定</el-button>-->
  	<div style="margin-top:16px;text-align:left">
     <el-pagination
     background
@@ -96,6 +96,7 @@ export default {
 					return e.sys_enterpriseid !== item.sys_enterpriseid
 				})
 			}
+      this.onSelect()
 		},
 		showSelelctIcon (item) {
 			let _isSame = this.selected.some(m=>item.sys_enterpriseid === m.sys_enterpriseid)

+ 1 - 1
src/HManagement/salesForecastTemplate/modules/edit.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
     <el-button :type="data.status === '结束' ||  data.status === '发布'?'':'primary'" :disabled="data.status === '结束' ||  data.status === '发布' "  size="mini" @click="onShow(dialogFormVisible = true)">编 辑</el-button>
-    <el-drawer append-to-body title="新建模板" :visible.sync="dialogFormVisible" size="800px">
+    <el-drawer append-to-body title="编辑模板" :visible.sync="dialogFormVisible" size="800px">
       <div class="drawer__panel">
         <el-row :gutter="20">
           <el-form :model="form" ref="form" :rules="rules" label-position="right" label-width="80px" size="small">

+ 194 - 104
src/template/salesForecastUseProject/addProduct.vue

@@ -6,110 +6,142 @@
       :visible.sync="drawer"
       append-to-body
       direction="rtl"
+      :show-close="false"
       size="80%">
       <div class="drawer__panel">
-        <el-table
-          ref="multipleTable"
-          :data="list"
-          style="width: 100%"
-          :header-cell-style="{height:'50px',color:'#606266',fontWeight:'400'}"
-          :cell-style="{height:'50px',color:'#666666',fontWeight:'400'}">
-        <el-table-column
-            align="center"
-            label="产品图"
-            width="80">
-          <template slot-scope="scope">
-            <div v-if="scope.row.attinfos[0]">
-              <previewImage style="height:38px;width:38px" :image="scope.row.attinfos[0]" :list="scope.row.attinfos" :deletebtn="false"></previewImage>
+        <div class="flex-align-center flex-between " style="margin-top:-10px;margin-bottom: 10px">
+          <div class="flex-align-center">
+            <el-input size="small"  suffix-icon="el-icon-search" v-model="param.content.where.condition" placeholder="产品名称,编号" @keyup.enter.native="listData(param.content.pageNumber = 1)" @clear="listData(param.content.pageNumber = 1)" clearable></el-input>&nbsp;
+          </div>
+          <div style="float: right">
+            <el-button style="float: right" type="primary" size="mini" @click="onSubmit"  :disabled="tableSelectData.length === 0 ">批量添加</el-button>
+          </div>
+        </div>
+        <div class="produtMag-panel" style="margin-top: 10px">
+          <el-table
+              ref="multipleTable"
+              :data="list"
+              style="width: 100%"
+              :header-cell-style="{height:'50px',color:'#606266',fontWeight:'400'}"
+              :cell-style="{height:'50px',color:'#666666',fontWeight:'400'}"
+              @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 style="height:38px;width:38px" :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" :key="index">
+                  <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" :key="index">
+                  <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">
+            </el-table-column>
+            <el-table-column
+                label="操作"
+                width="90"
+                fixed="right">
+              <template slot-scope="scope">
+                <el-button type="text" size="small" @click="addProduct(scope.row)">添加</el-button>
+              </template>
+            </el-table-column>
+          </el-table>
+<!--          <div class="container normal-panel" style="text-align:right">
+            <el-pagination
+                background
+                @size-change="handleSizeChange"
+                @current-change="handleCurrentChange"
+                :current-page="currentPage"
+                :page-sizes="[20, 50, 100, 200]"
+                layout="total,sizes, prev, pager, next, jumper"
+                :total="total">
+            </el-pagination>
+          </div>-->
+          <div>
+            <div style="float: left">已选:{{selectTotal}}个商品</div>
+            <div style="margin-top:16px;text-align:right">
+              <el-pagination
+                  background
+                  small
+                  @size-change="handleSizeChange"
+                  @current-change="handleCurrentChange"
+                  :current-page="currentPage"
+                  :page-sizes="[20, 50, 100, 200]"
+                  layout="total, prev, pager, next, jumper"
+                  :total="total">
+              </el-pagination>
             </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" :key="index">
-              <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" :key="index">
-              <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">
-        </el-table-column>
-        <el-table-column
-            label="操作"
-            width="90"
-            fixed="right">
-          <template slot-scope="scope">
-            <el-button type="text" size="small" @click="addProduct(scope.row)">添加</el-button>
-          </template>
-        </el-table-column>
-        </el-table>
-        <div class="container normal-panel" style="text-align:right">
-          <el-pagination
-            background
-            @size-change="handleSizeChange"
-            @current-change="handleCurrentChange"
-            :current-page="currentPage"
-            :page-sizes="[20, 50, 100, 200]"
-            layout="total,sizes, prev, pager, next, jumper"
-            :total="total">
-          </el-pagination>
+          </div>
         </div>
+
       </div>
     </el-drawer>
   </div>
@@ -127,14 +159,19 @@ export default {
       drawer:false,
       param:{
         "id": 20221208105403,
-        "version":1,
         "content": {
-          "sa_projectid":this.id
+          "sa_projectid":this.id,
+          "where": {
+            "condition": ""
+          }
         }
       },
       list:[],
       currentPage:0,
-      total:0
+      selectTotal:0,
+      total:0,
+      tableSelectData:[],
+      selectData:[]
     }
   },
   methods:{
@@ -158,13 +195,13 @@ export default {
     onShow () {
       console.log(this.mainData)
       this.listData()
+      this.selectListData()
     },
     async addProduct (row) {
       console.log(row,"添加商品")
       row.sa_salesforecastid = 0
       const res = await this.$api.requested({
         "id": 20220906155003,
-        "version":1,
         "content": {
             "sa_salesforecastmodelid":this.mainData.sa_salesforecastmodelid,
             "sa_salesforecastbillid":this.$route.query.id,
@@ -185,7 +222,60 @@ export default {
       this.tool.showMessage(res,()=>{
         this.$emit('onSuccess')
         this.listData()
+        this.selectListData()
+      })
+    },
+    /*选择要添加的数据*/
+    selectionChange(val){
+      console.log(val)
+      this.tableSelectData = []
+      this.tableSelectData = val
+      let obj = this.tableSelectData.map(e=>{
+        return {
+          "sa_salesforecastid":0,
+          "itemid":e.itemid,
+          "itemclassnum":'',
+          "orderqty": 1,
+          "orderamount": e.marketprice,
+          "invoiceqty": 1,
+          "invoiceamount": e.marketprice,
+          "outqty": 1,
+          "outamount": e.marketprice
+        }
+      })
+      this.selectData = obj
+      console.log(this.selectData)
+    },
+    /*批量添加产品*/
+    async onSubmit(){
+      const res = await this.$api.requested({
+        "id": 20220906155003,
+        "content": {
+          "sa_salesforecastmodelid":this.mainData.sa_salesforecastmodelid,
+          "sa_salesforecastbillid":this.$route.query.id,
+          "sa_projectid":this.id,
+          "itemclassinfos": this.selectData
+        }
+      })
+      this.tool.showMessage(res,()=>{
+        this.$emit('onSuccess')
+        this.listData()
+        this.selectListData()
+      })
+    },
+    /*已选产品*/
+    async selectListData(){
+      const res = await this.$api.requested({
+        "id": 20220906154703,
+        "content": {
+          "sa_salesforecastbillid":this.$route.query.id,
+          "where":{
+            "sa_projectid":'',
+            "condition":""
+          }
+        }
       })
+      this.selectTotal = res.total
     }
   },
   mounted () {