5
0

2 Commits 6ed2e227b5 ... db85ac583e

Autor SHA1 Nachricht Datum
  ZhangJunQuan db85ac583e Merge branch 'master' of https://git.leanwo.com/Chengfei_LiTiKu/pc-client-cf vor 4 Monaten
  ZhangJunQuan b842fff1e8 发卡 vor 4 Monaten

+ 40 - 65
src/custom/printer/AssetLabelPrinting.vue

@@ -94,9 +94,16 @@
         <div v-if="column.dataIndex === 'printStatus'">
           {{ record.printStatus ? '已打印' : '未打印' }}
         </div>
+        <div v-if="column.dataIndex === 'operate'">
+          <a-button style="width: 80px; margin-left: 12px" type="dashed" @click="cardEpc(record.epc)">
+            发卡
+          </a-button>
+        </div>
       </template>
     </CommonTable>
 
+    <WriteEpc ref="writeEpc" v-model:visible="writeEpcVisible" @ok="closePrintEpc" />
+
     <Loading v-if="loading" />
   </div>
 </template>
@@ -106,10 +113,10 @@ import Printer from './printer.js';
 import { message } from 'ant-design-vue';
 import CommonTable from '../common/CommonTable.vue';
 import { assetLabelPrintColumns } from './columns.js';
-import { Common, Notify, PrintEpc } from 'pc-component-v3';
+import { Common, Notify, PrintEpc,WriteEpc } from 'pc-component-v3';
 
 export default {
-  components: { PrintEpc, CommonTable },
+  components: { PrintEpc, CommonTable,WriteEpc },
   data: function () {
     return {
       assetInstanceDtoList: [],
@@ -198,6 +205,7 @@ export default {
       printEpcVisible: false,
       isCardEpc: false,
       selectedIds: [],
+      writeEpcVisible: false,
     };
   },
   computed: {},
@@ -371,76 +379,43 @@ export default {
       window.open(url);
     },
 
-    cardEpc: function () {
+    cardEpc: function (epc) {
       const _self = this;
-      _self.isCardEpc = true;
-      let recordIds = _self.getSelectedRecordIds();
-      if (recordIds == null || recordIds.length == 0) {
-        Notify.error('提示', '请先选择发卡数据。', false);
-        return;
-      }
+      _self.writeEpcVisible = true;
+      _self.$refs.writeEpc.writeSingleEpc(epc);
+    },
 
-      if (recordIds.length > 1) {
-        Notify.error('提示', '至多选择一条发卡数据。', false);
-        return;
+     writeSelectEpc: function () {
+      const datas = [];
+      const tableDatas = JSON.parse(
+        JSON.stringify(this.assetInstanceDtoList),
+      );
+      if (tableDatas && tableDatas.length > 0) {
+        const isSelect = tableDatas.some(item => {
+          return item.checked == true;
+        });
+        console.log(isSelect);
+        if (!isSelect) {
+          Notify.error('提示', '请选择一条发卡数据。', false);
+          return;
+        }
+        tableDatas.forEach(item => {
+          if (item.checked) {
+            datas.push(item.epc);
+          }
+        });
+        if (datas.length > 1) {
+          Notify.error('提示', '请至多选择一条发卡数据。', false);
+          return;
+        }
+        this.writeEpcVisible = true;
+        this.$refs.writeEpc.writeSingleEpc(datas[0]);
       }
-
-      let contents = [];
-      let contentCards = [];
-
-      $.ajax({
-        url: Common.getApiURL(
-          'AssetInstanceResource/print?printPreview=' +
-          false +
-          '&templateId=' +
-          _self.templateId,
-        ),
-        dataType: 'json',
-        type: 'post',
-        contentType: 'application/json',
-        data: JSON.stringify(recordIds),
-        beforeSend: function (request) {
-          Common.addTokenToRequest(request);
-          _self.loading = true;
-        },
-        success: function (datas) {
-          datas.forEach(function (item) {
-            var printItem = {
-              id: null,
-              name: null,
-              content: item,
-            };
-            if (
-              printItem.content == null ||
-              printItem.content.printItems == null ||
-              printItem.content.printItems.length == 0
-            ) {
-              Notify.error('错误', '打印模板无数据,不能打印。');
-              return;
-            }
-            var content = JSON.stringify(printItem.content);
-            if (content == null || content == '' || content == '{}') {
-              Notify.error('错误', '请先选择模板,再点击下载。');
-              return;
-            }
-            contents.push(printItem.content);
-          });
-          _self.printEpcVisible = true;
-          _self.$refs.printEpc.printPrintPages(contents);
-          _self.loading = false;
-          _self.isCardEpc = false;
-        },
-        error: function (XMLHttpRequest, textStatus, errorThrown) {
-          _self.loading = false;
-          _self.isCardEpc = false;
-          Common.processException(XMLHttpRequest, textStatus, errorThrown);
-        },
-      });
     },
 
     closePrintEpc: function () {
       const _self = this;
-      _self.printEpcVisible = false;
+      _self.writeEpcVisible = false;
     },
 
     /**

+ 43 - 67
src/custom/printer/ClampPrinting.vue

@@ -75,8 +75,9 @@
           <a-button type="primary" style="width: 80px" @click="print()">
             {{ $t("lang.AssetLabelPrint.print") }}
           </a-button>
-          <PrintEpc ref="printEpc" v-model:visible="printEpcVisible" :printer-name="selectedPrinterCard"
-            @ok="closePrintEpc" />
+          <!-- <a-button type="primary" style="width: 80px;margin-left: 12px" @click="writeSelectEpc()">
+            发卡
+          </a-button> -->
           <a-button type="primary" style="width: 80px;margin-left: 12px" @click="reQuery()">
             {{ $t("lang.AssetLabelPrint.query") }}
           </a-button>
@@ -94,9 +95,16 @@
         <div v-if="column.dataIndex === 'printStatus'">
           {{ record.printStatus ? '已打印' : '未打印' }}
         </div>
+        <div v-if="column.dataIndex === 'operate'">
+          <a-button style="width: 80px; margin-left: 12px" type="dashed" @click="cardEpc(record.epc)">
+            发卡
+          </a-button>
+        </div>
       </template>
     </CommonTable>
 
+    <WriteEpc ref="writeEpc" v-model:visible="writeEpcVisible" @ok="closePrintEpc" />
+
     <Loading v-if="loading" />
   </div>
 </template>
@@ -106,10 +114,10 @@ import Printer from './printer.js';
 import { message } from 'ant-design-vue';
 import CommonTable from '../common/CommonTable.vue';
 import { assetLabelPrintColumns } from './columns.js';
-import { Common, Notify, PrintEpc } from 'pc-component-v3';
+import { Common, Notify, PrintEpc ,WriteEpc} from 'pc-component-v3';
 
 export default {
-  components: { PrintEpc, CommonTable },
+  components: { PrintEpc, CommonTable,WriteEpc },
   data: function () {
     return {
       assetInstanceDtoList: [],
@@ -198,6 +206,7 @@ export default {
       printEpcVisible: false,
       isCardEpc: false,
       selectedIds: [],
+      writeEpcVisible: false,
     };
   },
   computed: {},
@@ -371,76 +380,43 @@ export default {
       window.open(url);
     },
 
-    cardEpc: function () {
+    cardEpc: function (epc) {
       const _self = this;
-      _self.isCardEpc = true;
-      let recordIds = _self.getSelectedRecordIds();
-      if (recordIds == null || recordIds.length == 0) {
-        Notify.error('提示', '请先选择发卡数据。', false);
-        return;
-      }
+      _self.writeEpcVisible = true;
+      _self.$refs.writeEpc.writeSingleEpc(epc);
+    },
 
-      if (recordIds.length > 1) {
-        Notify.error('提示', '至多选择一条发卡数据。', false);
-        return;
+     writeSelectEpc: function () {
+      const datas = [];
+      const tableDatas = JSON.parse(
+        JSON.stringify(this.assetInstanceDtoList),
+      );
+      if (tableDatas && tableDatas.length > 0) {
+        const isSelect = tableDatas.some(item => {
+          return item.checked == true;
+        });
+        console.log(isSelect);
+        if (!isSelect) {
+          Notify.error('提示', '请选择一条发卡数据。', false);
+          return;
+        }
+        tableDatas.forEach(item => {
+          if (item.checked) {
+            datas.push(item.epc);
+          }
+        });
+        if (datas.length > 1) {
+          Notify.error('提示', '请至多选择一条发卡数据。', false);
+          return;
+        }
+        this.writeEpcVisible = true;
+        this.$refs.writeEpc.writeSingleEpc(datas[0]);
       }
-
-      let contents = [];
-      let contentCards = [];
-
-      $.ajax({
-        url: Common.getApiURL(
-          'AssetInstanceResource/print?printPreview=' +
-          false +
-          '&templateId=' +
-          _self.templateId,
-        ),
-        dataType: 'json',
-        type: 'post',
-        contentType: 'application/json',
-        data: JSON.stringify(recordIds),
-        beforeSend: function (request) {
-          Common.addTokenToRequest(request);
-          _self.loading = true;
-        },
-        success: function (datas) {
-          datas.forEach(function (item) {
-            var printItem = {
-              id: null,
-              name: null,
-              content: item,
-            };
-            if (
-              printItem.content == null ||
-              printItem.content.printItems == null ||
-              printItem.content.printItems.length == 0
-            ) {
-              Notify.error('错误', '打印模板无数据,不能打印。');
-              return;
-            }
-            var content = JSON.stringify(printItem.content);
-            if (content == null || content == '' || content == '{}') {
-              Notify.error('错误', '请先选择模板,再点击下载。');
-              return;
-            }
-            contents.push(printItem.content);
-          });
-          _self.printEpcVisible = true;
-          _self.$refs.printEpc.printPrintPages(contents);
-          _self.loading = false;
-          _self.isCardEpc = false;
-        },
-        error: function (XMLHttpRequest, textStatus, errorThrown) {
-          _self.loading = false;
-          _self.isCardEpc = false;
-          Common.processException(XMLHttpRequest, textStatus, errorThrown);
-        },
-      });
     },
 
     closePrintEpc: function () {
       const _self = this;
-      _self.printEpcVisible = false;
+      _self.writeEpcVisible = false;
     },
 
     /**

+ 5 - 5
src/custom/printer/columns.js

@@ -21,11 +21,6 @@ export const assetLabelPrintColumns = [
     key: 'inventoryNo',
     dataIndex: 'inventoryNo',
   },
-  {
-    title: '规格型号',
-    key: 'type',
-    dataIndex: 'type',
-  },
   {
     title: 'epc',
     key: 'epc',
@@ -36,6 +31,11 @@ export const assetLabelPrintColumns = [
     key: 'printStatus',
     dataIndex: 'printStatus',
   },
+  {
+    title: '操作列',
+    key: 'operate',
+    dataIndex: 'operate',
+  },
 ].map(item => ({ ...item, align: 'center', resizable: true, maxWidth: 300, minWidth: 75 }));
 
 export const workBinColumns = [

+ 12 - 12
webpack.dev.js

@@ -60,71 +60,71 @@ module.exports = WebpackMerge.merge(baseConfig, {
     
     proxy: {
       '/api': {
-        target: 'http://y7bb56b4.natappfree.cc',
+        target: 'http://127.0.0.1:10026',
         ws: false,
         changeOrigin: true,
         secure:true,
       },
       '/static': {
-        target: 'http://y7bb56b4.natappfree.cc',
+        target: 'http://127.0.0.1:10026',
         ws: false,
         changeOrigin: true,
         secure:true,
       },
       '/content': {
-        target: 'http://y7bb56b4.natappfree.cc',
+        target: 'http://127.0.0.1:10026',
         ws: false,
         changeOrigin: true,
         secure:true,
       },
       '/dashboard': {
-        target: 'http://y7bb56b4.natappfree.cc',
+        target: 'http://127.0.0.1:10026',
         ws: false,
         changeOrigin: true,
         secure:true,
       },
       '/assets': {
-        target: 'http://y7bb56b4.natappfree.cc',
+        target: 'http://127.0.0.1:10026',
         ws: false,
         changeOrigin: true,
         secure:true,
       },
       '/mock': {
-        target: 'http://y7bb56b4.natappfree.cc',
+        target: 'http://127.0.0.1:10026',
         ws: false,
         changeOrigin: true,
         secure:true,
       },
       '/authApi': {
-        target: 'http://y7bb56b4.natappfree.cc',
+        target: 'http://127.0.0.1:10026',
         ws: false,
         changeOrigin: true,
         secure:true,
       },
       '/Dictionary': {
-        target: 'http://y7bb56b4.natappfree.cc',
+        target: 'http://127.0.0.1:10026',
         ws: false,
         changeOrigin: true,
         secure:true,
       },
       '/Files': {
-        target: 'http://y7bb56b4.natappfree.cc',
+        target: 'http://127.0.0.1:10026',
         ws: false,
         changeOrigin: true,
         secure:true,
       },
       '/WebSocket': {
-        target: 'http://y7bb56b4.natappfree.cc',
+        target: 'http://127.0.0.1:10026',
         ws: true,
         changeOrigin: true,
       },
       '/TrainVideo': {
-        target: 'http://y7bb56b4.natappfree.cc',
+        target: 'http://127.0.0.1:10026',
         ws: true,
         changeOrigin: true,
       },
       '/gateway-api': {
-        target: 'http://y7bb56b4.natappfree.cc',
+        target: 'http://127.0.0.1:10026',
         ws: true,
         changeOrigin: true,
         secure:true,