ZZJ 3 anni fa
parent
commit
81347e20e1
1 ha cambiato i file con 20 aggiunte e 4 eliminazioni
  1. 20 4
      src/views/system/jbdScan/goods/sampleTag.vue

+ 20 - 4
src/views/system/jbdScan/goods/sampleTag.vue

@@ -21,7 +21,7 @@
                   </div>
                   <div class="lh">
                     <div>样品名称:</div>
-                    <div>{{ item1.name }}</div>
+                    <div class="zgg">{{ item1.name }}</div>
                   </div>
                   <div class="la">
                     <div class="lh">
@@ -136,6 +136,10 @@ export default {
     this.getInit()
   },
   methods: {
+    removeCommas(str){
+      var regex = /^,|,$/g;
+      return str.replace(regex,'');
+    },
     printDemo() {
       this.$refs.easyPrint.print()
     },
@@ -155,19 +159,27 @@ export default {
         wjStr = wjStr.substring(0,wjStr.length-1);
         this.getLookJCXM(idStr,wjStr,this.jcxmList) 
       }else{
+        // 列表标签打印
         let ypInfo = []
         for(let item of this.obj){
+          console.log(item)
           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 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 sql2 = `select	xiang_mu_bian_hao FROM	t_mjjcnlfw WHERE	find_in_set(id_,(select concat( group_concat(jian_ce_xiang_mu2 ), ',', group_concat( tao_can_xiang_mu_ ) ) AS 'xiangMu'	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}' ) ) ) ) )`
           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 sql4 = `select concat(group_concat(jian_ce_xiang_mu2),',',group_concat(tao_can_xiang_mu_)) as 'xiangMu'  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),repostCurd('sql',sql4)]).then((res)=>{
             let yp = res[0].variables.data
             let jcxm = res[1].variables.data
             let wtrq = res[2].variables.data
+            let jcxmId = res[3].variables.data
             let xmbhIndex = 0;
+            // console.log(jcxmId)
             while(xmbhIndex <jcxm.length){
               yp.forEach((item,index)=>{
-                let count = item.jian_ce_xiang_mu_.split(',').length + xmbhIndex
+                // let count = item.jian_ce_xiang_mu_.split(',').length + xmbhIndex
+                let count = this.removeCommas(jcxmId[index].xiangMu).split(",").length +xmbhIndex
+                // console.log(count)
                 for(;xmbhIndex<count && xmbhIndex < jcxm.length;xmbhIndex++){
                     let x = {
                     yang_pin_ming_che : item.yang_pin_ming_che,
@@ -320,6 +332,10 @@ export default {
 </script>
 
 <style lang="scss" scoped>
+.zgg{
+  width:100px;
+  text-align: left;
+}
 .bg {
   // height: auto;
 }