Merge pull request 'main' (#152) from 616036448/Admin.NET.Pro:main into main
Reviewed-on: http://101.43.53.74:3000/Admin.NET/Admin.NET.Pro/pulls/152
This commit is contained in:
commit
2927c4814c
@ -7,7 +7,7 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<link rel="stylesheet" type="text/css" media="print" href="/print-lock.css" />
|
<link rel="stylesheet" type="text/css" media="print" href="/print-lock.css" />
|
||||||
<link rel="icon" id="favicon" href="data:;base64,=" />
|
<link rel="icon" id="favicon" href="data:;base64,=" />
|
||||||
<title>Admin.NET</title>
|
<title>正在加载中...</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<div style="margin: 0px 0px 0px 0px">
|
<div style="margin: 0px 0px 0px 0px">
|
||||||
<HiprintDesign ref="hiprintDesignRef" />
|
<HiprintDesign :mode-index="mode" ref="hiprintDesignRef" />
|
||||||
</div>
|
</div>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<span class="dialog-footer" style="margin-top: 10px">
|
<span class="dialog-footer" style="margin-top: 10px">
|
||||||
@ -93,6 +93,8 @@ import { UpdatePrintInput } from '/@/api-services/models';
|
|||||||
|
|
||||||
const hiprintDesignRef = ref<InstanceType<typeof HiprintDesign>>();
|
const hiprintDesignRef = ref<InstanceType<typeof HiprintDesign>>();
|
||||||
|
|
||||||
|
const mode = ref(0);
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
title: String,
|
title: String,
|
||||||
});
|
});
|
||||||
@ -110,6 +112,8 @@ onMounted(async () => {});
|
|||||||
// 打开弹窗
|
// 打开弹窗
|
||||||
const openDialog = (row: any) => {
|
const openDialog = (row: any) => {
|
||||||
state.ruleForm = JSON.parse(JSON.stringify(row));
|
state.ruleForm = JSON.parse(JSON.stringify(row));
|
||||||
|
let templateJson = JSON.parse(state.ruleForm.template);
|
||||||
|
mode.value = templateJson.panels[0].index;
|
||||||
state.isShowDialog = true;
|
state.isShowDialog = true;
|
||||||
ruleFormRef.value?.resetFields();
|
ruleFormRef.value?.resetFields();
|
||||||
|
|
||||||
@ -147,7 +151,9 @@ const templateCancel = () => {
|
|||||||
|
|
||||||
// 模板设置提交
|
// 模板设置提交
|
||||||
const templateSubmit = async () => {
|
const templateSubmit = async () => {
|
||||||
state.ruleForm.template = JSON.stringify(hiprintDesignRef.value?.hiprintTemplate.getJson());
|
let templateJson=hiprintDesignRef.value?.hiprintTemplate.getJson();
|
||||||
|
templateJson.panels[0].index=hiprintDesignRef.value?.mode;
|
||||||
|
state.ruleForm.template = JSON.stringify(templateJson);
|
||||||
if (state.ruleForm.id != undefined && state.ruleForm.id > 0) {
|
if (state.ruleForm.id != undefined && state.ruleForm.id > 0) {
|
||||||
await getAPI(SysPrintApi).apiSysPrintUpdatePost(state.ruleForm);
|
await getAPI(SysPrintApi).apiSysPrintUpdatePost(state.ruleForm);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
<el-row :gutter="8" style="margin-bottom: 5px">
|
<el-row :gutter="8" style="margin-bottom: 5px">
|
||||||
<el-col :span="4">
|
<el-col :span="4">
|
||||||
<!-- 流程下拉 模板选择 -->
|
<!-- 流程下拉 模板选择 -->
|
||||||
<el-select v-model="state.mode" showSearch @change="changeMode" :defaultValue="0" option-label-prop="label" class="w100">
|
<el-select v-model="mode" showSearch @change="changeMode" :defaultValue="0" option-label-prop="label" class="w100">
|
||||||
<el-option v-for="(opt, idx) in state.modeList" :key="idx" :label="opt.name" :value="idx">
|
<el-option v-for="(opt, idx) in state.modeList" :key="idx" :label="opt.name" :value="idx">
|
||||||
{{ opt.name }}
|
{{ opt.name }}
|
||||||
</el-option>
|
</el-option>
|
||||||
@ -109,12 +109,20 @@ import providers from './providers';
|
|||||||
import PrintPreview from './preview.vue';
|
import PrintPreview from './preview.vue';
|
||||||
import printData from './print-data';
|
import printData from './print-data';
|
||||||
|
|
||||||
|
//父级传递来的参数
|
||||||
|
var props = defineProps({
|
||||||
|
modeIndex: {
|
||||||
|
type: Number,
|
||||||
|
default: 0,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
let hiprintTemplate = ref();
|
let hiprintTemplate = ref();
|
||||||
|
// 模板选择
|
||||||
|
let mode = ref(0);
|
||||||
|
|
||||||
const preViewRef = ref();
|
const preViewRef = ref();
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
// 模板选择
|
|
||||||
mode: 0,
|
|
||||||
modeList: [] as any,
|
modeList: [] as any,
|
||||||
// 当前纸张
|
// 当前纸张
|
||||||
curPaper: {
|
curPaper: {
|
||||||
@ -178,7 +186,7 @@ const curPaperType = computed(() => {
|
|||||||
|
|
||||||
// 选择模板
|
// 选择模板
|
||||||
const changeMode = () => {
|
const changeMode = () => {
|
||||||
let provider = providers[state.mode];
|
let provider = providers[mode.value];
|
||||||
hiprint.init({
|
hiprint.init({
|
||||||
providers: [provider.f],
|
providers: [provider.f],
|
||||||
});
|
});
|
||||||
@ -318,6 +326,7 @@ onMounted(() => {
|
|||||||
state.modeList = providers.map((e) => {
|
state.modeList = providers.map((e) => {
|
||||||
return { type: e.type, name: e.name, value: e.value };
|
return { type: e.type, name: e.name, value: e.value };
|
||||||
});
|
});
|
||||||
|
mode.value = props.modeIndex;
|
||||||
changeMode();
|
changeMode();
|
||||||
// otherPaper(); // 默认纸张
|
// otherPaper(); // 默认纸张
|
||||||
});
|
});
|
||||||
@ -333,7 +342,7 @@ const initPaper = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 导出对象
|
// 导出对象
|
||||||
defineExpose({ hiprintTemplate, initPaper });
|
defineExpose({ hiprintTemplate, initPaper, mode });
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user