|
@@ -280,8 +280,38 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <SumPrint :listItem="queryItem" v-if="isShowPrint" @backListFormDetail="backList" />
|
|
|
+
|
|
|
+ <print-preview ref="preView" />
|
|
|
+
|
|
|
+ <el-dialog title="密码确认" :visible.sync="isShowDialog" :show-close="false" width="40%" :close-on-click-modal="false">
|
|
|
+ <el-form ref="dialogForm" :model="dialogForm" :rules="dialogFormRules" label-position="right" label-width="70px">
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :xs="24" :sm="24" :lg="24">
|
|
|
+ <el-form-item label="密码" prop="password">
|
|
|
+ <el-input v-model="dialogForm.password" autocomplete="off" placeholder="请输入密码"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :xs="24" :sm="12" :lg="12">
|
|
|
+ <el-form-item label="操作人" prop="createMan">
|
|
|
+ <el-input v-model="dialogForm.createMan" readonly></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :xs="24" :sm="12" :lg="12" style="height: 51px;">
|
|
|
+ <el-form-item label="操作日期" prop="createDate">
|
|
|
+ <el-date-picker v-model="dialogForm.createDate" readonly type="date" value-format="yyyy-MM-dd"
|
|
|
+ style="width: 100%;" placeholder="选择日期">
|
|
|
+ </el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="cancelDialogForm">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="submitDialogForm">确 定</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
|
|
|
+
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -291,9 +321,37 @@ import { checkPassword } from "@/api/supply/pickup";
|
|
|
import { getCategoryList, getSalesmanList } from '@/api/common'
|
|
|
import SumPrint from '@/views/supply/deliver/components/sum_print'
|
|
|
|
|
|
+import { disAutoConnect, hiprint, defaultElementTypeProvider } from 'vue-plugin-hiprint'
|
|
|
+disAutoConnect();
|
|
|
+
|
|
|
+import panel from './components/design/panel'
|
|
|
+import { getDetail, detailArr } from './components/design/print-data'
|
|
|
+
|
|
|
+import printPreview from './components/design/preview.vue'
|
|
|
export default {
|
|
|
components: {
|
|
|
SumPrint,
|
|
|
+ printPreview
|
|
|
+
|
|
|
+ },
|
|
|
+ filters: {
|
|
|
+ orderTypeFilter(val) {
|
|
|
+ const MAP = {
|
|
|
+ HOME: '家用单',
|
|
|
+ TRADE: '商用单',
|
|
|
+ RETAIL: '零售单',
|
|
|
+ RETAIL_POLICY: '销售政策单',
|
|
|
+ PERMU_HOME: '置换家用单',
|
|
|
+ PERMU_TRADE: '置换商用单',
|
|
|
+ PERMU_RETAIL: '置换零售单',
|
|
|
+ PERMU_RETAIL_POLICY: '置换销售政策单',
|
|
|
+ REQUISITION_HOME: '调拨家用单',
|
|
|
+ REQUISITION_TRADE: '调拨商用单',
|
|
|
+ REQUISITION_RETAIL: '调拨零售单',
|
|
|
+ REQUISITION_RETAIL_POLICY: '调拨销售政策单',
|
|
|
+ }
|
|
|
+ return MAP[val];
|
|
|
+ }
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
@@ -323,6 +381,51 @@ export default {
|
|
|
tableSelection: [],
|
|
|
queryItem: {},
|
|
|
isShowPrint: false,
|
|
|
+ curPaper: {
|
|
|
+ type: 'A5',
|
|
|
+ width: 500,
|
|
|
+ height: 147.6
|
|
|
+
|
|
|
+ },
|
|
|
+ paperTypes: {
|
|
|
+ 'A3': {
|
|
|
+ width: 420,
|
|
|
+ height: 296.6
|
|
|
+ },
|
|
|
+ 'A4': {
|
|
|
+ width: 210,
|
|
|
+ height: 296.6
|
|
|
+ },
|
|
|
+ 'A5': {
|
|
|
+ width: 210,
|
|
|
+ height: 147.6
|
|
|
+ },
|
|
|
+ 'B3': {
|
|
|
+ width: 500,
|
|
|
+ height: 352.6
|
|
|
+ },
|
|
|
+ 'B4': {
|
|
|
+ width: 250,
|
|
|
+ height: 352.6
|
|
|
+ },
|
|
|
+ 'B5': {
|
|
|
+ width: 250,
|
|
|
+ height: 175.6
|
|
|
+ }
|
|
|
+ },
|
|
|
+ scaleValue: 1,
|
|
|
+ scaleMax: 5,
|
|
|
+ scaleMin: 0.5,
|
|
|
+ isShowDialog: false,
|
|
|
+ dialogForm: {
|
|
|
+ password: "",
|
|
|
+ createMan: "",
|
|
|
+ createDate: "",
|
|
|
+ },
|
|
|
+ dialogFormRules: {
|
|
|
+ password: [{ required: true, message: "请输入密码", trigger: "blur" }],
|
|
|
+ },
|
|
|
+ hiprintTemplate:''
|
|
|
}
|
|
|
},
|
|
|
|
|
@@ -515,8 +618,69 @@ export default {
|
|
|
|
|
|
// 点击打印
|
|
|
toPrint() {
|
|
|
+ // this.$refs
|
|
|
this.queryItem = this.tableSelection;
|
|
|
- this.isShowPrint = true;
|
|
|
+ // console.log(this.tableSelection);
|
|
|
+ // this.isShowPrint = true;
|
|
|
+ // this.$refs.myPdfComponent.print()
|
|
|
+ // console.log(this.hiprintTemplate, detailArr);
|
|
|
+ // getDetail(this.tableSelection)
|
|
|
+ // this.$refs.preView.show(this.hiprintTemplate, detailArr)
|
|
|
+ if (!this.tableSelection[0].printNum) {
|
|
|
+ this.queryItem = this.tableSelection;
|
|
|
+ // this.isShowPrint = true;
|
|
|
+ getDetail(this.tableSelection)
|
|
|
+ this.$refs.preView.show(this.hiprintTemplate, detailArr)
|
|
|
+ } else {
|
|
|
+ this.queryItem = this.tableSelection;
|
|
|
+ this.dialogForm.createMan = JSON.parse(
|
|
|
+ localStorage.getItem("supply_user")
|
|
|
+ ).nickName;
|
|
|
+ this.dialogForm.createDate = this.getDate();
|
|
|
+ this.isShowDialog = true;
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ // 关闭弹窗
|
|
|
+ cancelDialogForm() {
|
|
|
+ this.isShowDialog = false;
|
|
|
+ this.$refs.dialogForm.resetFields();
|
|
|
+ },
|
|
|
+
|
|
|
+ // 提交 弹窗
|
|
|
+ submitDialogForm() {
|
|
|
+ this.$refs.dialogForm.validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ let params = {
|
|
|
+ shipId: this.queryItem[0].invoiceId,
|
|
|
+ password: this.dialogForm.password,
|
|
|
+ };
|
|
|
+ checkPassword(params).then((res) => {
|
|
|
+ this.cancelDialogForm();
|
|
|
+ getDetail(this.tableSelection)
|
|
|
+ this.$refs.preView.show(this.hiprintTemplate, detailArr)
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ getDate() {
|
|
|
+ var date = new Date();
|
|
|
+ var seperator1 = "-";
|
|
|
+ var year = date.getFullYear();
|
|
|
+ var month = date.getMonth() + 1;
|
|
|
+ var strDate = date.getDate();
|
|
|
+ if (month >= 1 && month <= 9) {
|
|
|
+ month = "0" + month;
|
|
|
+ }
|
|
|
+ if (strDate >= 0 && strDate <= 9) {
|
|
|
+ strDate = "0" + strDate;
|
|
|
+ }
|
|
|
+ var currentdate = year + seperator1 + month + seperator1 + strDate;
|
|
|
+ return currentdate;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
},
|
|
|
|
|
|
backList() {
|
|
@@ -524,6 +688,25 @@ export default {
|
|
|
this.isShowPrint = false;
|
|
|
},
|
|
|
|
|
|
+ /**
|
|
|
+ * 设置纸张大小
|
|
|
+ * @param type [A3, A4, A5, B3, B4, B5, other]
|
|
|
+ * @param value {width,height} mm
|
|
|
+ */
|
|
|
+ setPaper(type, value) {
|
|
|
+ try {
|
|
|
+ if (Object.keys(this.paperTypes).includes(type)) {
|
|
|
+ this.curPaper = { type: type, width: value.width, height: value.height }
|
|
|
+ this.hiprintTemplate.setPaper(value.width, value.height)
|
|
|
+ } else {
|
|
|
+ this.curPaper = { type: 'other', width: value.width, height: value.height }
|
|
|
+ this.hiprintTemplate.setPaper(value.width, value.height)
|
|
|
+
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ this.$message.error(`操作失败: ${error}`)
|
|
|
+ }
|
|
|
+ },
|
|
|
|
|
|
}
|
|
|
}
|