소스 검색

Merge branch 'master' of http://119.23.210.103:3000/wy/mj_firm_former

zhangjingyuan 3 년 전
부모
커밋
ec40b61094

+ 6 - 5
src/business/platform/form/formrender/dynamic-form/dynamic-form-table.vue

@@ -106,7 +106,7 @@
                     <template v-for="(button, b) in toolbarButtons ">
                       <template v-if="!(button.key === 'remove' && dataModel.length === 1)">
                         <el-button :key="b" :type="button.type" :icon="button.icon"
-                          @click="handleActionEvent(button, b)">
+                          @click="handleActionEvent(button, b, index)">
                           {{ button.label }}
                         </el-button>
                       </template>
@@ -521,13 +521,13 @@ export default {
       })
       return bs
     },
-    handleActionEvent(button, buttonIndex) {
+    handleActionEvent(button, buttonIndex, tableIndex) {
       // 起始下标
       let index = this.currentPage * 10 - 10 + buttonIndex
       this.actionCode = button.key === 'custom' ? (button.code || button.key + index) : button.key
       this.actionPosition = button.position || 'toolbar'
       // 前置事件
-      this.beforeScript(button, index, (result) => {
+      this.beforeScript(button, index,tableIndex, (result) => {
         this.editFromType = button.key
         if (!result) {
           return
@@ -969,7 +969,7 @@ export default {
       return true
     },
     // 前置脚本
-    beforeScript(button, index, callback) {
+    beforeScript(button, index,tableIndex, callback) {
       if (!this.hasScript()) {
         if (callback) {
           const flag = true
@@ -979,7 +979,8 @@ export default {
       }
       const params = {
         button: button,
-        index: index
+        index: index,
+        tableIndex: tableIndex
       }
       if (!callback) {
         callback = () => { }

+ 166 - 0
src/views/component/taocans.vue

@@ -0,0 +1,166 @@
+<template>
+      <div> 
+        <!-- <div>{{ datase }}</div> -->
+     <el-button type="success" @click="firstLoadQuyu()">查询</el-button> 
+    <el-table
+        :data="datase"
+        style="width: 100%,height:100%"
+        size="max"
+        
+        :span-method="objectSpanMethod"
+      >     <el-table-column
+            prop="tao_can_ming_chen"
+            label="套餐名称"
+            key="tao_can_ming_chen"
+            align="center"
+            :width=" 120 "
+          >
+        </el-table-column>
+        <el-table-column
+            prop="xiang_mu_ming_che"
+            label="检测项目"
+            key="xiang_mu_ming_che"
+            align="center"
+            :width=" 120 "
+          > </el-table-column>
+         <el-table-column
+            prop="jian_ce_fang_fa_"
+            label="检测方法"
+            key="jian_ce_fang_fa_"
+            align="center"
+            :width=" 120 "
+          > </el-table-column>
+          <el-table-column
+            prop="xiang_mu_dan_jia_"
+            label="项目单价(元)"
+            key="xiang_mu_dan_jia_"
+            align="center"
+            :width=" 120 "
+          > </el-table-column>
+          <el-table-column
+            prop="zhe_hou_jia_ge_"
+            label="折后价格(元)"
+            key="zhe_hou_jia_ge_"
+            align="center"
+            :width=" 120 "
+          > </el-table-column>
+      </el-table> 
+    </div>
+  </template>
+  
+  <script>
+    import curdPost from "@/business/platform/form/utils/custom/joinCURD.js";
+import { set } from 'vue';
+    export default {
+      data() {
+        return {
+          tableData: [{ 
+            id: '12987122',
+            name: '王小虎',
+            amount1: '234',
+            amount2: '3.2',
+            amount3: 10
+          }, {
+            id: '12987123',
+            name: '王小虎',
+            amount1: '165',
+            amount2: '4.43',
+            amount3: 12
+          }, {
+            id: '12987124',
+            name: '王小虎',
+            amount1: '324',
+            amount2: '1.9',
+            amount3: 9
+          }, {
+            id: '12987125',
+            name: '王小虎',
+            amount1: '621',
+            amount2: '2.2',
+            amount3: 17
+          }, {
+            id: '12987126',
+            name: '王小虎',
+            amount1: '539',
+            amount2: '4.1',
+            amount3: 15
+          }],
+          datase:[],
+          tableheader:[],
+          rowNumArr: [],
+          inde: 0,
+          spanArr:[],
+            pos:0,
+        };
+      },
+      props: {
+    field: Object,
+    formData: {
+      type: Object,
+      default() {
+        return {}
+      }
+    },
+    readonly: {
+      type: Boolean,
+      default: false,
+    }
+  },
+ mounted(){   
+    let this_= this;
+ 
+    setTimeout(()=>{
+       var  aa=this_.formData
+       console.log("th",this_.formData)
+       console.log("aa",aa)
+        let sqlString =`select  tc.tao_can_ming_chen,zb.xiang_mu_ming_che,jian_ce_fang_fa_,xiang_mu_dan_jia_,zhe_hou_jia_ge_  from  t_jctc   tc join t_tczb  zb on  tc.id_=zb.parent_id_  where  he_tong_bian_hao_='${this_.formData.heTongBianHao}'`
+       
+        curdPost("sql", sqlString).then((response) => {
+            console.log("response",response)
+            this_.datase = response.variables.data;
+            this_.getSpanArr(this_.datase)
+        })
+    },2000)
+        // let sqlString = `select * from t_bjd where id_='${this.formData.id}' order by create_time_ asc`;
+       // let sqlString =`select  tc.tao_can_ming_chen,zb.xiang_mu_ming_che,jian_ce_fang_fa_,xiang_mu_dan_jia_,zhe_hou_jia_ge_  from  t_jctc   tc join t_tczb  zb on  tc.id_=zb.parent_id_  where  he_tong_bian_hao_='C2023608'`
+
+        // this.tableheader = Object.keys(Object.assign({},...this.datase))
+ },
+      methods: {        
+        getSpanArr(data) {
+            for (var i = 0; i < data.length; i++) {
+                console.log(i)
+                if (i === 0) {
+                    this.spanArr.push(1);
+                    this.pos = 0;
+                } else {
+                // 判断当前元素与上一个元素是否相同
+                //这里的groupName是第一列的属性,我用来判断是否相同。
+                console.log(data[i].tao_can_ming_chen === data[i - 1].tao_can_ming_chen)
+                if (data[i].tao_can_ming_chen === data[i - 1].tao_can_ming_chen) {
+                    this.spanArr[this.pos] += 1;
+                    this.spanArr.push(0);
+                } else {
+                    this.spanArr.push(1);
+                    this.pos = i;
+                }
+                }
+                console.log(this.pos)
+            }
+            console.log(this.spanArr)
+        },
+    objectSpanMethod({ row, column, rowIndex, columnIndex }) {
+        if (columnIndex === 0) {
+            const _row = this.spanArr[rowIndex];
+            const _col = _row > 0 ? 1 : 0;
+            return {
+            // _row = 0,_col = 0 表示这一次不合并,不显示,
+            // _row = 2,_col = 1 表示这一次合并第一列的两行
+            rowspan: _row,
+            colspan: _col,
+            };
+        }
+    },
+    }
+}
+  </script>

+ 156 - 33
src/views/system/jbdScan/goods/sampleTag.vue

@@ -3,17 +3,17 @@
     <el-dialog 
       width="21cm"
       height="10cm" 
-       :modal-append-to-body='true' :append-to-body="true" title="样品标签" :visible.sync="scanVisible">
+       :modal-append-to-body='true' :append-to-body="true" title="样品标签" :visible.sync="scanVisible" @close="sacnClose">
       <!-- 表单是否显示 -->
-      <div style="height:500px">
+      <div style="height:500px" v-if="scanVisible">
           <div ref="qrcode" id="box">
           <vue-easy-print tableShow ref="easyPrint"
             :onePageRow="onePageRow"
           >
             <div v-for="(item1, index1) in list" :key="index1"  style="display: inline-block" >
-              <div v-for="(item2, index2) in parseInt(item1.num)" :key="index2" 
-              style="display: inline-block"
-              ><!-- style="page-break-after:always" -->
+              <!-- <div v-for="(item2, index2) in parseInt(item1.num)" :key="index2" 
+              style="display: inline-block" > -->
+              <!-- style="page-break-after:always" -->
                <div class="All">
                 <div class="tagBox">
                   <div class="lh">
@@ -25,31 +25,32 @@
                       <div>样本编号:</div>
                       <div>{{ item1.serial }}</div>
                     </div>
-                    <div class="lh" style="margin-left: 4px">
+                    <!-- <div class="lh" style="margin-left: 4px">
                          <div>样品数量:</div>
                          <div>{{ index2 + 1 }}/{{ item1.num }}支</div>
-                    </div>
-                    <!-- <div class="lh" style="margin-left: 5px">
-                      <div>收样时间:</div>
-                      <div>{{ item1.num }}</div>
+                    </div> -->
+                    <!-- <div class="lh" style="margin-left: 4px">
+                      <div>送检日期:</div>
+                      <div>{{ item1.type }}</div>
                     </div> -->
                   </div>
-                  <!-- <div class="lh">
+                  <div class="lh">
                     <div>检测项目:</div>
-                    <div>{{ item1.type }}</div>
-                  </div> -->
-                  <!-- <div class="lh">
-                    <div>存储条件:</div>
                     <div>{{ item1.condition }}</div>
-                  </div> -->
+                  </div>
+                  <div class="lh">
+                    <div>送检日期:</div>
+                    <div>{{ item1.type }}</div>
+                  </div>
+                 
 
                   <div class="lh">
                     <div>流转状态:</div>
-                    <div>▢待检,▢已检,▢留样</div>
+                    <div>▢待检,▢在检,▢已检,▢留样</div>
                   </div>
                  
                   <div class="ewm">
-                    <vue-barcode :value="item1.serial" :width=1.5 :height=25 :fontSize=15 :margin=3 ></vue-barcode>
+                    <vue-barcode :value="item1.serial" :width=1.5 :height=25 :fontSize=15 :margin=3 :displayValue="false" ></vue-barcode>
                   </div>
 
                   <!-- <div
@@ -57,7 +58,7 @@
                   ></div> -->
 
 
-                </div>
+                <!-- </div> -->
                </div>
               </div>
             </div>
@@ -78,6 +79,7 @@
 import VueBarcode from 'vue-barcode';
 import vueEasyPrint from "vue-easy-print";
 import repostCurd from '@/business/platform/form/utils/custom/joinCURD.js';
+import { resolve } from 'path';
 
 export default {
   components: {
@@ -109,9 +111,9 @@ export default {
       list: [{
         name: 5,
         serial: 5,
-        // type: 5,
-        num: 5
-        // condition: 5
+        type: 5,
+        // num: 5,
+        condition: 5
       }],
       visible: true,
       sampleShuLiangList:[]
@@ -130,21 +132,139 @@ export default {
     printDemo() {
       this.$refs.easyPrint.print()
     },
-    getInit() {
-      console.log('getInit:',this.obj)
-      this.sampleShuLiangList = []
+    async getInit() {
+      let this_ = this;
+      // console.log('getInit:',this.obj)
+      this.jcxmList = []
       var idStr = '';
-      this.obj.forEach(item=>{
+      var wjStr = '';
+      if(this.obj.length > 0 && this.obj[0].indexOf(" ") != -1){
+        this.obj.forEach(item=>{
         idStr += item.split(" ")[0] + ','
-        this.sampleShuLiangList.push(parseInt(item.split(" ")[1]))
-      })
-      idStr = idStr.substring(0,idStr.length-1);
-      if(!isNaN(this.sampleShuLiangList[0])){
-        this.getLooks(idStr,this.sampleShuLiangList)
+        wjStr += item.split(" ")[1] + ','
+        this.jcxmList.push(item.split(" ")[2].split(','))
+        })
+        idStr = idStr.substring(0,idStr.length-1);
+        wjStr = wjStr.substring(0,wjStr.length-1);
+        this.getLookJCXM(idStr,wjStr,this.jcxmList) 
       }else{
-        this.getLook(idStr)
-      }
+        let ypInfo = []
+        for(let item of this.obj){
+          let sql1 = `select yang_pin_ming_che,yang_pin_bian_hao,jian_ce_xiang_mu_ from t_mjypdjb where find_in_set(id_,'${item}')`
+          let sql2 = `select xiang_mu_bian_hao from t_mjjcnlfw where find_in_set(id_,(select group_concat(jian_ce_xiang_mu_) from t_mjypdjb where find_in_set(id_,'${item}')))`
+          let sql3 =`select wei_tuo_ri_qi_ from t_mjwtsqb where FIND_IN_SET(id_,	(select group_concat(wai_jian_) from t_mjypb where find_in_set(yang_pin_bian_hao,(select group_concat(yang_pin_bian_hao) from t_mjypdjb where find_in_set(id_,'${item}')))))`
+          await Promise.all([repostCurd('sql',sql1),repostCurd('sql',sql2),repostCurd('sql',sql3)]).then((res)=>{
+            let yp = res[0].variables.data
+            let jcxm = res[1].variables.data
+            let wtrq = res[2].variables.data
+            let xmbhIndex = 0;
+            while(xmbhIndex <jcxm.length){
+              yp.forEach((item,index)=>{
+                let count = item.jian_ce_xiang_mu_.split(',').length + xmbhIndex
+                for(;xmbhIndex<count;xmbhIndex++){
+                    let x = {
+                    yang_pin_ming_che : item.yang_pin_ming_che,
+                    yang_pin_bian_hao : item.yang_pin_bian_hao,
+                    xiang_mu_bian_hao : jcxm[xmbhIndex].xiang_mu_bian_hao,
+                    wei_tuo_ri_qi_    : wtrq[index].wei_tuo_ri_qi_
+                    }
+                    ypInfo.push(x)
+                }
+              })
+            }
+            
+          })
+        }
+          this_.getLook2(ypInfo)
+       
+        /*
+        let ypInfo = []
+        let promiseArr = [];
+        let p = new Promise((resolve,reject) =>{
+              let sql1 = `select yang_pin_ming_che,yang_pin_bian_hao,jian_ce_xiang_mu_ from t_mjypdjb where find_in_set(id_,'${this.obj}')`
+              repostCurd('sql',sql1).then(res=>{
+                const data =  res.variables.data 
+                data.forEach((item,index)=>{
+                  let sql2 =  `select xiang_mu_bian_hao from t_mjjcnlfw where find_in_set(id_,'${item.jian_ce_xiang_mu_}')`
+                  repostCurd('sql',sql2).then(r=>{
+                    let result = r.variables.data
+                    data[index].xiang_mu_bian_hao = result
+                  })
+                })
+                this_.ypInfo = data
+                // console.log(this_.ypInfo)
+              })
+        })
+        promiseArr.push(p)
+        Promise.all([p]).then(([res]) =>{
+          console.log(res)
+          this_.getLook2(this_.ypInfo);
+        })
+        */
 
+      }
+    },
+    getLook2(data){
+      let list = []
+      data.forEach(item=>{
+        let o = {
+          name: item.yang_pin_ming_che,
+          serial: item.yang_pin_bian_hao,
+          type: item.wei_tuo_ri_qi_,
+          condition: item.xiang_mu_bian_hao
+        }
+        list.push(o)
+      })
+      this.list = list;
+    },
+    getLookJCXM(id,wjStr,jcxmList){
+      // console.log(id,wjStr,jcxmList)
+      let jcxmSQL = `select xiang_mu_bian_hao from t_mjjcnlfw where find_in_set(id_,'${jcxmList}')`
+      let sql = `select yang_pin_ming_che,yang_pin_bian_hao from t_mjypb where find_in_set(id_,'${id}')`
+      let wtsql = `select wei_tuo_ri_qi_ from t_mjwtsqb where find_in_set(id_,'${wjStr}')`
+      Promise.all([repostCurd("sql", jcxmSQL),repostCurd("sql", sql),repostCurd('sql',wtsql)]).then((res1,res2,res3)=>{
+          // console.log(res1[0].variables.data)
+          // console.log(res1[1].variables.data)
+          // console.log(res1[2].variables.data)
+          let jcxmInfo = res1[0].variables.data
+          let ypInfo = res1[1].variables.data
+          let rq = res1[2].variables.data
+          let list = []
+          ypInfo.forEach((item,index) => {
+            rq.forEach((a,b)=>{
+              jcxmInfo.forEach((it,ind)=>{
+              let o = {
+                  name: item.yang_pin_ming_che,
+                  serial: item.yang_pin_bian_hao,
+                  type: a.wei_tuo_ri_qi_,
+                  condition: it.xiang_mu_bian_hao
+                }
+                list.push(o)
+            })
+            })
+          })
+          this.list = list
+      })
+      /*
+      let sql = `select * from t_mjypb where find_in_set(id_,'${id}')`
+      repostCurd("sql", sql).then(res => {
+          const data = res.variables.data
+          let list = []
+          data.forEach((item,index) => {
+            let num = ShuLiangList[index]
+            if(typeof(num) == 'number'){
+                let o = {
+                  name: item.yang_pin_ming_che,
+                  serial: item.yang_pin_bian_hao,
+                  // type: item.jian_ce_xiang_mu_,
+                  num: num,
+                  // condition: item.yang_ben_yun_shu_
+                }
+                list.push(o)
+            }
+          })
+          this.list = list
+      })*/
     },
     getLooks(id,ShuLiangList) {
       let sql = `select * from t_mjypb where find_in_set(id_,'${id}')`
@@ -187,6 +307,9 @@ export default {
           })
           this.list = list
       })
+    },
+    sacnClose(){
+      this.list = []
     }
   }
 }