浏览代码

前端 增量打印sdy

zhongtianhaoyuan 3 年之前
父节点
当前提交
8a70ff9375

+ 41 - 21
src/views/home/index.vue

@@ -28,21 +28,21 @@
         <div class="content2">
           <el-row class="content2-aside">
             <h3 class="title">采购合同完成进度</h3>
-            <el-col :span="12" class="chart-card">
+            <el-col :span="12" class="chart-card" >
               <div style="font-weight: bold;" class="">
-                <div ref="myEchart1" style="height: 288px;" class="roseChart"></div>
+                <div ref="myEchart1" style="height: 288px;" class="roseChart" @click="contract(0)"></div>
                 <div class="bottom-tip">统计单位:吨</div>
               </div>
             </el-col>
-            <el-col :span="12" class="chart-card">
+            <el-col :span="12" class="chart-card" >
               <div style="font-weight: bold;">
-                <div ref="myEchart2" style="height: 288px;" class="roseChart"></div>
+                <div ref="myEchart2" style="height: 288px;" class="roseChart" @click="contract(0)"></div>
                 <div class="bottom-tip">统计单位:元</div>
               </div>
             </el-col>
             <el-col :span="12" class="chart-card">
               <div style="font-weight: bold;">
-                <div ref="myEchart3" style="height: 288px;" class="roseChart"></div>
+                <div ref="myEchart3" style="height: 288px;" class="roseChart" @click="contract(0)"></div>
                 <div class="bottom-tip">统计单位:元</div>
               </div>
             </el-col>
@@ -101,32 +101,32 @@
             <h3 class="left-title">销售合同完成进度</h3>
             <el-col :span="12" class="chart-card">
               <div style="font-weight: bold;">
-                <div ref="myEchart4" style="height: 288px;" class="roseChart"></div>
+                <div ref="myEchart4" style="height: 288px;" class="roseChart" @click="contract(1)"></div>
                 <div class="bottom-tip">统计单位:吨</div>
               </div>
             </el-col>
-            <el-col :span="12" class="chart-card">
+            <el-col :span="12" class="chart-card" @click="contract(1)">
               <div style="font-weight: bold;">
-                <div ref="myEchart5" style="height: 288px;" class="roseChart"></div>
+                <div ref="myEchart5" style="height: 288px;" class="roseChart" @click="contract(1)"></div>
                 <div class="bottom-tip">统计单位:元</div>
               </div>
             </el-col>
-            <el-col :span="12" class="chart-card">
+            <el-col :span="12" class="chart-card" >
               <div style="font-weight: bold;">
-                <div ref="myEchart6" style="height: 288px;" class="roseChart"></div>
+                <div ref="myEchart6" style="height: 288px;" class="roseChart" @click="contract(1)"></div>
                 <div class="bottom-tip">统计单位:元</div>
               </div>
             </el-col>
           </el-row>
         </div>
-        <el-dialog :append-to-body="true" :show-close='false' :visible.sync="dialogVisible" width="30%"
+        <!-- <el-dialog :append-to-body="true" :show-close='false' :visible.sync="dialogVisible" width="30%"
           :before-close="handleClose">
           <span>这是一段信息</span>
           <span slot="footer" class="dialog-footer">
             <el-button @click="dialogVisible = false">取 消</el-button>
             <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
           </span>
-        </el-dialog>
+        </el-dialog> -->
         <!-- <img style='width:100%;margin-top:10px;' src="../../../public/img/tmt.gif" alt=""> -->
       </div>
     </div>
@@ -416,6 +416,18 @@
           this.number.news = news
         })
       },
+      //跳转
+      contract(index){
+         if(index == 0){
+            this.$router.push({
+              name:"buyContract"
+            })
+          }else if(index == 1){
+            this.$router.push({
+              name:"salesContract"
+            })
+          }
+      },
       getTime() {
         const date = new Date();
         const year = date.getFullYear();
@@ -454,10 +466,12 @@
               // 圆环图各环节的名称和值(系列中各数据项的名称和值)
               data = [{
                 name: '已完成量',
-                value: this.chartsData[i].biViewInfoList[0].count
+                value: this.chartsData[i].biViewInfoList[0].count,
+                type:"采购合同"
               }, {
                 name: '待完成量',
-                value: this.chartsData[i].biViewInfoList[1].count
+                value: this.chartsData[i].biViewInfoList[1].count,
+                type:"采购合同"
               }]
               text = '合同总量'
               formatter = '{b}{c}吨 </br> 占比{d}%'
@@ -470,10 +484,12 @@
               // 圆环图各环节的名称和值(系列中各数据项的名称和值)
               data = [{
                 name: '已开票',
-                value: this.chartsData[i].biViewInfoList[0].count
+                value: this.chartsData[i].biViewInfoList[0].count,
+                type:"采购合同"
               }, {
                 name: '待开票',
-                value: this.chartsData[i].biViewInfoList[1].count
+                value: this.chartsData[i].biViewInfoList[1].count,
+                type:"采购合同"
               }]
               text = '合同总额'
               formatter = '{b}{c}元 </br> 占比{d}%'
@@ -485,10 +501,12 @@
               // 圆环图各环节的名称和值(系列中各数据项的名称和值)
               data = [{
                 name: '已付款',
-                value: this.chartsData[i].biViewInfoList[0].count
+                value: this.chartsData[i].biViewInfoList[0].count,
+                type: "采购合同"
               }, {
                 name: '待付款',
-                value: this.chartsData[i].biViewInfoList[1].count
+                value: this.chartsData[i].biViewInfoList[1].count,
+                   type: "采购合同"
               }]
               text = '合同总额'
               formatter = '{b}{c}元 </br> 占比{d}%'
@@ -500,7 +518,8 @@
               // 圆环图各环节的名称和值(系列中各数据项的名称和值)
               data = [{
                 name: '已完成量',
-                value: this.chartsData[i].biViewInfoList[0].count
+                value: this.chartsData[i].biViewInfoList[0].count,
+                  type: "销售合同"
               }, {
                 name: '待完成量',
                 value: this.chartsData[i].biViewInfoList[1].count
@@ -619,8 +638,9 @@
           myChart.off('click');
           myChart.on('click', function(params) {
             //  var a = params.dataIndex
-            console.log(params, '我被点击了');
-            app.dialogVisible = true
+            // console.log(params, '我被点击了');
+            // app.dialogVisible = true
+           return
           })
         }
         console.log(this.totalReserves)

+ 56 - 8
src/views/warehouse/warehouseManagementList.vue

@@ -504,16 +504,64 @@ export default {
           if(response.records.length == 0){
             this.$message.error("暂未查到所要打印的出入库信息")
           }else{
-            sessionStorage.setItem("inOutWarehouse_Print",JSON.stringify(response.records))
-          let i = ""
-          i = this.parameter.radio+"&warehouseName=" + this.parameter.warehouseName
-           window.open('../../../../../static/warehousePrint.html?type=' + i)
+            var warehousePrint = response.records
+            if(this.parameter.proportion){
+               var countWeight = 0
+            for(let i = 0 ; i < warehousePrint.length ; i++){
+              countWeight += Number(warehousePrint[i].netWeight)
+            }
+            var increment = (countWeight * (Number(this.parameter.proportion)/100)).toFixed(2)//所要增加的量
+            printAdd().toPromise()
+             .then((response1) => {
+                for(let i = 0 ; i < response1.length ; i++){
+                  increment = Number(increment)
+                  if(increment > 0){
+                    let index = Math.round(Math.random()*response1.length - 1)
+                    let pro = response1[index]  //取出假数据并设定值
+                    
+                    //  pro.inOutDate = warehousePrint[Math.round(Math.random()* warehousePrint.length - 1)].inOutDate
+                    //  pro.contractNo = warehousePrint[Math.round(Math.random()* warehousePrint.length - 1)].contractNo
+                    //  pro.companyName = warehousePrint[Math.round(Math.random()* warehousePrint.length - 1)].companyName
+                    //  pro.goodsName = warehousePrint[Math.round(Math.random()* warehousePrint.length - 1)].goodsName + "1"
+                    //  pro.boxNo = warehousePrint[Math.round(Math.random()* warehousePrint.length - 1)].boxNo
+                  console.log(warehousePrint)
+                    pro.netWeight = Number((Math.random()*(70-10+1)+10).toFixed(2))
+                     pro.tare = Number((Math.random()*(20-10+1)+10).toFixed(2))
+                    pro.grossWeight = Number((pro.tare + pro.netWeight).toFixed(2))
+                      if(pro.netWeight < increment){
+                         increment = (increment - pro.netWeight).toFixed(2)  //所要增的量
+                        if(increment < 10 && pro.netWeight <= 60){
+                        pro.netWeight += Number(increment)
+                                 pro.grossWeight = Number((pro.tare + pro.netWeight).toFixed(2))
+                        increment = 0
+                         warehousePrint.push(pro)
+                          }else{
+                              warehousePrint.push(pro)
+                          }
+                      }else{
+                          pro.netWeight = Number(increment.toFixed(2))
+                          pro.grossWeight = Number((pro.tare + pro.netWeight).toFixed(2))
+                          increment = 0
+                          warehousePrint.push(pro)
+                      }
+                    response1.splice(index,1)//删除已添加过得假数据车牌号
+                  }else{
+                    sessionStorage.setItem("inOutWarehouse_Print",JSON.stringify(warehousePrint))
+                    let i = ""
+                    i = this.parameter.radio+"&warehouseName=" + this.parameter.warehouseName
+                    window.open('../../../../../static/warehousePrint.html?type=' + i)
+                    // return
+                  }
+                }
+             }) 
+             }else{
+                sessionStorage.setItem("inOutWarehouse_Print",JSON.stringify(response.records))
+                    let i = ""
+                    i = this.parameter.radio+"&warehouseName=" + this.parameter.warehouseName
+                    window.open('../../../../../static/warehousePrint.html?type=' + i)
+             }
           }
         })
-        printAdd().toPromise()
-        .then((response) => {
-          console.log(response)
-        })
       }
     },
     startChane(e){

+ 6 - 1
src/views/warehouse/warehouseManagementRecord.vue

@@ -410,7 +410,12 @@
 					if (index === 0) {
 						sums[index] = '合计'
 					} else if (
-						index === 6 
+						index === 4||
+						index === 5||
+						index === 6||
+						index === 7||
+						index === 8||
+						index === 9
 					) {
 						const values = data.map((item) => Number(item[column.property]))
 						if (!values.every((value) => isNaN(value))) {