|
@@ -75,8 +75,9 @@
|
|
|
<a-button type="primary" style="width: 80px" @click="print()">
|
|
<a-button type="primary" style="width: 80px" @click="print()">
|
|
|
{{ $t("lang.AssetLabelPrint.print") }}
|
|
{{ $t("lang.AssetLabelPrint.print") }}
|
|
|
</a-button>
|
|
</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()">
|
|
<a-button type="primary" style="width: 80px;margin-left: 12px" @click="reQuery()">
|
|
|
{{ $t("lang.AssetLabelPrint.query") }}
|
|
{{ $t("lang.AssetLabelPrint.query") }}
|
|
|
</a-button>
|
|
</a-button>
|
|
@@ -94,9 +95,16 @@
|
|
|
<div v-if="column.dataIndex === 'printStatus'">
|
|
<div v-if="column.dataIndex === 'printStatus'">
|
|
|
{{ record.printStatus ? '已打印' : '未打印' }}
|
|
{{ record.printStatus ? '已打印' : '未打印' }}
|
|
|
</div>
|
|
</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>
|
|
</template>
|
|
|
</CommonTable>
|
|
</CommonTable>
|
|
|
|
|
|
|
|
|
|
+ <WriteEpc ref="writeEpc" v-model:visible="writeEpcVisible" @ok="closePrintEpc" />
|
|
|
|
|
+
|
|
|
<Loading v-if="loading" />
|
|
<Loading v-if="loading" />
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
@@ -106,10 +114,10 @@ import Printer from './printer.js';
|
|
|
import { message } from 'ant-design-vue';
|
|
import { message } from 'ant-design-vue';
|
|
|
import CommonTable from '../common/CommonTable.vue';
|
|
import CommonTable from '../common/CommonTable.vue';
|
|
|
import { assetLabelPrintColumns } from './columns.js';
|
|
import { assetLabelPrintColumns } from './columns.js';
|
|
|
-import { Common, Notify, PrintEpc } from 'pc-component-v3';
|
|
|
|
|
|
|
+import { Common, Notify, PrintEpc ,WriteEpc} from 'pc-component-v3';
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
- components: { PrintEpc, CommonTable },
|
|
|
|
|
|
|
+ components: { PrintEpc, CommonTable,WriteEpc },
|
|
|
data: function () {
|
|
data: function () {
|
|
|
return {
|
|
return {
|
|
|
assetInstanceDtoList: [],
|
|
assetInstanceDtoList: [],
|
|
@@ -198,6 +206,7 @@ export default {
|
|
|
printEpcVisible: false,
|
|
printEpcVisible: false,
|
|
|
isCardEpc: false,
|
|
isCardEpc: false,
|
|
|
selectedIds: [],
|
|
selectedIds: [],
|
|
|
|
|
+ writeEpcVisible: false,
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
computed: {},
|
|
computed: {},
|
|
@@ -371,76 +380,43 @@ export default {
|
|
|
window.open(url);
|
|
window.open(url);
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
- cardEpc: function () {
|
|
|
|
|
|
|
+ cardEpc: function (epc) {
|
|
|
const _self = this;
|
|
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 () {
|
|
closePrintEpc: function () {
|
|
|
const _self = this;
|
|
const _self = this;
|
|
|
- _self.printEpcVisible = false;
|
|
|
|
|
|
|
+ _self.writeEpcVisible = false;
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
/**
|