Ver Fonte

修改标签,小猪修改表单index

ZZJ há 3 anos atrás
pai
commit
912743c650

+ 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 = () => { }

+ 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 = []
     }
   }
 }