|
|
@@ -78,9 +78,15 @@
|
|
|
<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>
|
|
|
@@ -90,10 +96,10 @@ import Printer from './printer.js';
|
|
|
import { message } from 'ant-design-vue';
|
|
|
import CommonTable from '../common/CommonTable.vue';
|
|
|
import { workBinColumns } 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: [],
|
|
|
@@ -180,6 +186,7 @@ export default {
|
|
|
printEpcVisible: false,
|
|
|
isCardEpc: false,
|
|
|
selectedIds: [],
|
|
|
+ writeEpcVisible: false,
|
|
|
};
|
|
|
},
|
|
|
computed: {},
|
|
|
@@ -353,76 +360,83 @@ export default {
|
|
|
window.open(url);
|
|
|
},
|
|
|
|
|
|
- cardEpc: function () {
|
|
|
- const _self = this;
|
|
|
- _self.isCardEpc = true;
|
|
|
- let recordIds = _self.getSelectedRecordIds();
|
|
|
- if (recordIds == null || recordIds.length == 0) {
|
|
|
- Notify.error('提示', '请先选择发卡数据。', false);
|
|
|
- return;
|
|
|
- }
|
|
|
|
|
|
- if (recordIds.length > 1) {
|
|
|
- Notify.error('提示', '至多选择一条发卡数据。', false);
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- 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);
|
|
|
- },
|
|
|
- });
|
|
|
+ cardEpc: function (epc) {
|
|
|
+ const _self = this;
|
|
|
+ _self.writeEpcVisible = true;
|
|
|
+ _self.$refs.writeEpc.writeSingleEpc(epc);
|
|
|
},
|
|
|
|
|
|
+ // cardEpc: function () {
|
|
|
+ // const _self = this;
|
|
|
+ // _self.isCardEpc = true;
|
|
|
+ // let recordIds = _self.getSelectedRecordIds();
|
|
|
+ // if (recordIds == null || recordIds.length == 0) {
|
|
|
+ // Notify.error('提示', '请先选择发卡数据。', false);
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+
|
|
|
+ // if (recordIds.length > 1) {
|
|
|
+ // Notify.error('提示', '至多选择一条发卡数据。', false);
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+
|
|
|
+ // 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;
|
|
|
},
|
|
|
|
|
|
/**
|