From 6138e4435cf3736e23c68691f4d51e910a4ccf23 Mon Sep 17 00:00:00 2001
From: 王震 <10952869+daywangzhen@user.noreply.gitee.com>
Date: 星期一, 25 十二月 2023 15:20:05 +0800
Subject: [PATCH] 	modified:   src/page/PackingLedgerDetails/index.vue 	modified:   src/views/quality/Packaging_ledger/index.vue 	modified:   vue.config.js

---
 src/views/quality/Packaging_ledger/index.vue |  455 ++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 311 insertions(+), 144 deletions(-)

diff --git a/src/views/quality/Packaging_ledger/index.vue b/src/views/quality/Packaging_ledger/index.vue
index 430bba5..c465c2d 100644
--- a/src/views/quality/Packaging_ledger/index.vue
+++ b/src/views/quality/Packaging_ledger/index.vue
@@ -4,23 +4,23 @@
         <el-row>
             <el-col :span="11">
             <ttable
-        :table="table"
-        :isShowHide="true"
-        :prelang="prelang"
-        :options="options" 
-        ref="processconfiguration"
-        >
-        <template #toolbar></template>
+            :table="table"
+            :isShowHide="true"
+            :prelang="prelang"
+            :ajaxFun="ajaxFun"
+            :options="options" 
+            @handleSelectionChange="handleSelectionChange"
+            ref="processconfiguration"
+            >
+              <template #toolbar></template>
             </ttable>
             </el-col>
-
-
             <el-col :span="13" style="padding-left: 10px">
                 <el-card>
                 <div slot="header">
                 <el-row>
                     <el-col :span="8">
-                    <span>鏍囧噯鍙傛暟</span>
+                    <span>瑁呯鏄庣粏</span>
                     </el-col>
                     <el-col :span="8" :offset="4">
                     <!-- <el-button
@@ -32,38 +32,29 @@
                     </el-button> -->
                     </el-col>
                     <el-col :span="2">
-                    <!-- <el-button
+                    <el-button
                         style="float: right; padding: 3px 0"
                         type="text"
-                        :disabled="isSubmit"
-                        v-thinclick="`dataFormTestStandardParam`"
-                        v-if="editable"
+                        @click="addpreserve"
                         >淇濆瓨
-                    </el-button> -->
+                    </el-button>
                     </el-col>
                     <el-col :span="2">
-                    <!-- <el-button
+                    <el-button
+                        v-if="!isCheck"
                         style="float: right; padding: 3px 0"
                         type="text"
                         @click="relateOperationParam()"
-                        v-if="editable"
                         >娣诲姞
-                    </el-button> -->
+                    </el-button>
                     </el-col>
-                </el-row>
-                <el-row>
-                    <!-- <span style="font-weight:500" v-if="testNo.length > 0"
-                    >鎮ㄥ綋鍓嶉�夋嫨鐨勬娴嬫爣鍑嗙紪鍙锋槸锛�<span style="color:#066EFF">{{
-                        testNo
-                    }}</span></span
-                    > -->
                 </el-row>
                 </div>
                 <el-table
               :data="testStandardParams"
               id="testStandardParamTable"
               ref="testStandardParam"
-              :default-sort="{ prop: 'index' }"
+            
               highlight-current-row
               height="700"
               style="width: 100%"
@@ -72,122 +63,131 @@
               stripe
             >
               <el-table-column
-                prop="index"
+                type ="index"
                 label="搴忓彿"
                 align="center"
                 width="50"
               />
-              <!-- <el-table-column
-                label="鏄惁寮曠敤宸ヨ壓鍙傛暟"
-                prop="isReference"
-                align="center"
-              >
-                <template slot-scope="scope">
-                  <el-select
-                    v-model="scope.row.isReference"
-                    placeholder="璇烽�夋嫨"
-                    style="width: 100%;"
-                  >
-                    <el-option
-                      v-for="(item, index) in referenceOptions"
-                      :key="index"
-                      :label="item.label"
-                      :value="item.value"
-                    >
-                    </el-option>
-                  </el-select>
-                </template>
-              </el-table-column>
-              <el-table-column label="鏄惁鎶芥" prop="isCheck" align="center">
-                <template slot-scope="scope">
-                  <el-select
-                    v-model="scope.row.isCheck"
-                    placeholder="璇烽�夋嫨"
-                    style="width: 100%;"
-                  >
-                    <el-option
-                      v-for="(item, index) in isCheckOptions"
-                      :key="index"
-                      :label="item.label"
-                      :value="item.value"
-                    >
-                    </el-option>
-                  </el-select>
-                </template>
-              </el-table-column>
               <el-table-column
-                label="绾胯姱"
-                prop="wireCore"
-                align="center"
-                width="60"
-              >
-                <template slot-scope="scope">
-                  <el-input v-model="scope.row.wireCore"></el-input>
-                </template>
-              </el-table-column> -->
-              <el-table-column label="鍙傛暟缂栧彿" prop="code" align="center" />
-              <el-table-column
-                label="鍙傛暟椤�"
-                prop="parameterItem"
+                label="浜у搧"
+                prop="product"
+                show-overflow-tooltip
                 align="center"
               />
               <el-table-column
-                label="瑕佹眰鑼冨洿"
-                prop="referenceValue"
+                label="浜у搧缂栧彿"
+                prop="productNo"
+                show-overflow-tooltip
                 align="center"
               >
               </el-table-column>
               <el-table-column
-                label="榛樿鍊�"
-                prop="defaultValue"
+                label="鎵规鍙�"
+                prop="outBatchNo"
+                show-overflow-tooltip
                 align="center"
               >
               </el-table-column>
               <el-table-column
-                label="鍙傛暟椤圭被鍨�"
-                prop="paramType"
+                label="瑙勬牸鍨嬪彿"
+                prop="specs"
+                show-overflow-tooltip
                 align="center"
               >
               </el-table-column>
               <el-table-column
-                label="鍙傛暟鏍煎紡"
-                prop="parameterFormat"
+                label="鍗曚綅"
+                prop="unit"
+                show-overflow-tooltip
                 align="center"
+              >
+              </el-table-column>
+              <el-table-column
+                label="鏁伴噺"
+                prop="number"
+                align="center"
+                show-overflow-tooltip
                 width="80"
-              >
+              ></el-table-column>
+              <el-table-column
+                fixed="right"
+                label="鎿嶄綔"
+                align="center"
+                width="80">
                 <template slot-scope="scope">
-                  <el-input v-model="scope.row.parameterFormat"></el-input>
+                  <el-button type="text" @click="deleteadd(scope.row)" icon="el-icon-delete"  size="small">鍒犻櫎</el-button>
                 </template>
-              </el-table-column><el-table-column
-                label="娴嬭瘯鏂规硶"
-                prop="purpose"
-                align="center"
-                width="80"
-              >
               </el-table-column>
-              <el-table-column
-                label="娴嬭瘯鐩殑"
-                prop="method"
-                align="center"
-                width="80"
-              >
-              </el-table-column>
-              <el-table-column label="鍗曚綅" prop="unit" align="center" />
             </el-table>
                 </el-card>
             </el-col>
         </el-row>
-        </basic-container>
+
+        <!-- 鏂板 -->
+        <packfrom
+        :currshowlist.sync="addOrUpdateVisible"
+        @refreshDataList="getData">
+        </packfrom>
+        <packfromadd
+        :currshowlist.sync="increase"
+        :packageBoxIddata ="packageBoxId"
+        @handleSelectionChange = "preserve"
+        >
+        </packfromadd>
+      </basic-container>
+      <el-dialog title="鏍囩鍒楄〃" top="5vh" :visible.sync="diaPrintTab" width="500px">
+        <div style="width:100%;height: 400px;overflow-y: auto;">
+          <div id="qrCard" class="dia_body">
+            <el-card class="box-card" v-for="(item, i) in qrData" :key="i" style="margin-bottom: 10px;">
+              <el-row>
+                <el-col :span="10" :offset="3">搴忓彿锛�</el-col>
+                <el-col :span="10" style="font-weight: bold;">{{ i + 1 }}</el-col>
+              </el-row>
+              <el-row> 
+                <el-col :span="10" :offset="3">鍖呰缂栧彿锛�</el-col>
+                <el-col :span="10" style="font-weight: bold;">{{ item.packageNo }}</el-col>
+              </el-row>
+              <el-row>
+                <el-col :span="10" :offset="3">鍖呰鍙拌处浜岀淮鐮侊細</el-col>
+                <el-col :span="10">
+                  <vueQr :text=str+item.packageBoxId :size="110" :margin="1"></vueQr>
+                </el-col>
+              </el-row>
+            </el-card>
+          </div>
+        </div>
+        <span slot="footer" class="dialog-footer">
+          <el-button @click="diaPrintTab = false">鍙� 娑�</el-button>
+          <el-button type="primary" @click="printFun">鎵� 鍗�</el-button>
+        </span>
+      </el-dialog>
     </div>
 </template>
 
 <script>
+import { pagedata,dropById,list,saveList,deledata,sAuditstatus} from '@/api/quality/Packaging_ledger'
 import ttable from '@/views/common/ztt-table.vue'
+import packfrom from './pack-from.vue'
+import packfromadd from './pack-fromadd.vue'
+import vueQr from 'vue-qr'
+import PrintJS from 'print-js'
 export default {
     data(){
         return {
+          str:"http://192.168.2.213:8080/#/pack?id=",
+          qrData:[],
+          diaPrintTab: false,
+          multipleSelection: [],
+          isCheck: false,
+          dataway:{},
+          goid:'',
+          testStandardParams: [],
+          packageBoxId:{},
             prelang: 'operation',
             dataListLoading: false,
+            ajaxFun: pagedata,
+            increase:false,
+            addOrUpdateVisible:false,
             options: {
                 height: 300, // 榛樿楂樺害-涓轰簡琛ㄥご鍥哄畾
                 stripe: true, // 鏄惁涓烘枒椹汗 table
@@ -196,6 +196,7 @@
                 lazy: false, // 鏄惁闇�瑕佹噿鍔犺浇
                 fit: true, // 鍒楃殑瀹藉害鏄惁鑷拺寮�
                 multiSelect: true, //
+                isEdit:false,
                 seqNo: true,
                 isShowHide: true, // 鏄惁鏄剧ず鏄惧奖鎸夐挳
                 isRefresh: true, // 鏄惁鏄剧ず鍒锋柊鎸夐挳
@@ -209,49 +210,41 @@
                 data: [],
                 // 鏍囬
                 column: [
+                {
+                  minWidth: 'code',
+                  prop: 'state',
+                  label: '鐘舵��',
+                  sort: true,
+                  isTrue: true,
+                  isSearch: true,
+                  searchInfoType: 'text'
+                },
                   {
                     minWidth: '140',
-                    prop: 'oo',
-                    label: '璁㈠崟缂栧彿',
+                    prop: 'packageNo',
+                    label: '鍖呰缂栧彿',
                     isTrue: true,
                     isSearch: true,
                     searchInfoType: 'text',
                   },{
                     minWidth: '140',
-                    prop: 'materhhooial',
-                    label: '璐ㄩ噺杩芥函鍙�',
+                    prop: 'createUser',
+                    label: '鍒涘缓浜�',
+                    isTrue: true,
+                    isSearch: true,
+                    searchInfoType: 'text',
+                  },{
+                    minWidth: '140',
+                    prop: 'contractNo',
+                    label: '鍚堝悓鍙�',
                     isTrue: true,
                     isSearch: true,
                     searchInfoType: 'text',
                   },
                   {
                     minWidth: '140',
-                    prop: 'mateuurial',
-                    label: '浜у搧鍚嶇О',
-                    isTrue: true,
-                    isSearch: true,
-                    searchInfoType: 'text',
-                  },
-                  {
-                    minWidth: '140',
-                    prop: 'materoiial',
-                    label: '瑙勬牸鍨嬪彿',
-                    isTrue: true,
-                    isSearch: true,
-                    searchInfoType: 'text',
-                  },
-                  {
-                    minWidth: '140',
-                    prop: 'matperoial',
-                    label: '鍗曚綅',
-                    isTrue: true,
-                    isSearch: true,
-                    searchInfoType: 'text',
-                  },
-                  {
-                    minWidth: '140',
-                    prop: 'materpial',
-                    label: '鏁伴噺',
+                    prop: 'updateUser',
+                    label: '鏇存柊浜�',
                     isTrue: true,
                     isSearch: true,
                     searchInfoType: 'text',
@@ -259,8 +252,18 @@
                   {
                     minWidth: '130',
                     width: '150',
-                    prop: 'dealTime',
-                    label: '鍏ュ簱鏃堕棿',
+                    prop: 'updateTime',
+                    label: '鏇存柊鏃ユ湡',
+                    sort: true,
+                    isTrue: true,
+                    isSearch: true,
+                    searchInfoType: 'datetimerange',
+                },
+                {
+                    minWidth: '130',
+                    width: '150',
+                    prop: 'createTime',
+                    label: '鍒涘缓鏃ユ湡',
                     sort: true,
                     isTrue: true,
                     isSearch: true,
@@ -268,20 +271,184 @@
                 },
                 ],
                 toolbar: [
-                  {
-                    text: 'xxx',
-                    type: 'primary',
-                  },
+                    {
+                      text: '鏂板',
+                      type: 'primary',
+                      fun: this.addOrUpdateHandle
+                    },
+                    {
+                      text: '鏍囩鎵撳嵃',
+                      type: 'primary',
+                      fun: this.printLabel
+                    },
                 ],
+                operator: [
+                    {
+                      text: '妫�楠�',
+                      icon: 'el-icon-position',
+                      type: 'text',
+                      size: 'small',
+                      fun: this.check
+                    },{
+                      text: '鍒犻櫎',
+                      icon: 'el-icon-delete',
+                      type: 'text',
+                      size: 'small',
+                      fun: this.deleteHandle
+                    }
+                  ],
+                  operatorConfig: {
+                    fixed: 'right',
+                    label: '鎿嶄綔',
+                    width: 120,
+                    minWidth: 120
+                  }
             },
        }
     },
-    medthods: {},
-//     computed: {
-//     ...mapGetters(['permissions'])
-//   },
     components: {
-    ttable
+      ttable,
+      packfrom,
+      packfromadd,
+      vueQr
+    },
+    watch: {
+      diaPrintTab(newVal){
+        if(!newVal){
+          this.qrData = []
+        }
+      }
+    },
+    methods: {
+      //鎵撳嵃鎸夐挳
+      printFun() {
+          this.diaPrintTab = false;
+          PrintJS({
+              printable: 'qrCard',//椤甸潰
+              type: "html",//鏂囨。绫诲瀷
+                maxWidth:450,
+                targetStyles:['*'],                 
+                style: `@page {
+                  margin:0;
+                  padding: 0;
+                  size: 360px 170px;
+                }
+                html{
+                  zoom:100%;
+                }
+                @media print{
+                  width: 360px;
+                  height: 170px;
+                  margin:0;
+                  padding: 0;
+                }`,
+                onPrintDialogClose: this.erexcel=false,
+                targetStyles: ["*"], // 浣跨敤dom鐨勬墍鏈夋牱寮忥紝寰堥噸瑕�
+                font_size: '',
+          });
+      },
+      handleSelectionChange(val){
+        this.multipleSelection = val
+        console.log(this.multipleSelection[0].id,"鏁版嵁");
+        let lastRow = val[val.length - 1]
+        this.handleCurrentChange(lastRow)
+      },
+      printLabel(){
+        if(this.multipleSelection.length==0){
+          this.$message.warning('璇烽�夋嫨涓�鏉℃暟鎹�')
+          return
+        }
+        this.diaPrintTab = true
+        this.multipleSelection.forEach(item=>{
+          let obj = {
+            packageNo: item.packageNo,
+            contractNo: item.contractNo,
+            packageBoxId:item.id
+          }
+          this.qrData.push(obj)
+        })
+      },
+       // 鑾峰彇鏁版嵁鍒楄〃
+      getData() {
+        this.$refs.processconfiguration.refreshData()
+      },
+      wayRenovate(){
+        this.getData()
+      },
+      //add
+      addOrUpdateHandle(){
+        this.addOrUpdateVisible = true
+      },
+      //鍒犻櫎
+      deleteHandle(row){
+        dropById({id:row.id}).then((res) =>{
+          this.getData()
+          this.$message.success('鍒犻櫎鎴愬姛')
+        })
+      },
+      handleCurrentChange(row){
+        if(row.state=='宸叉姤妫�'){
+          this.isCheck = true
+        }
+        this.dataway = row
+        this.packageBoxId = {
+          packageBoxId:row.id
+        }
+        this.goid = row.id
+        this.rightquery()
+      },
+      rightquery(){
+        list({packageBoxId:this.goid}).then((res) =>{
+          this.testStandardParams = res.data.data
+        })
+      },
+      //璇︽儏娣诲姞
+      relateOperationParam(){
+        if (this.dataway.state == "鏈姤妫�") {
+            this.increase = true
+        }else{
+          this.$message.error('璇峰厛閫夋嫨鍖呰椤圭洰')
+        }
+      },
+      preserve(datalist){
+        this.testStandardParams = datalist
+      },
+      //鍙宠竟淇濆瓨
+      addpreserve(){
+         this.testStandardParams.forEach(el => {
+              el.packageBoxId =this.goid
+         });
+         console.log(this.testStandardParams);
+  //       return
+        saveList(this.testStandardParams).then((res) =>{
+          if(res.status===200){
+            this.$message.success('淇濆瓨鎴愬姛')
+            this.rightquery()
+          }
+        }).catch(error=>{
+          console.error(error);
+        })
+      },
+      //鍒犻櫎
+      deleteadd(row){
+          deledata({id:row.id}).then((res)=>{
+          this.$message.success('鍒犻櫎鎴愬姛')
+          this.rightquery()
+          })
+      },
+      //瀹℃牳
+      check(row){
+        let packageBox = {
+                id:row.id,
+                packageNo:row.packageNo,
+                contractNo:row.contractNo,
+                customerId:row.customerId,
+        }
+        sAuditstatus(packageBox).then((res) =>{
+          this.getData()
+          this.$message.success('妫�楠屾垚鍔�')
+        })
+      },
     },
 }
 </script>
\ No newline at end of file

--
Gitblit v1.9.3