4e450e2e by 蔡俊立

打印模板

1 parent 7c91f8dd
......@@ -171,3 +171,48 @@ export function setAllRead () {
method: 'get'
})
}
//获取打印模板列表
export function selectPrintTemplateList (data) {
return request({
url: SERVER.SERVERAPI + '/rest/system/print/selectPrintTemplateList',
method: 'post',
data
})
}
//新增打印模板列表
export function addPrintTemplate (data) {
return request({
url: SERVER.SERVERAPI + '/rest/system/print/addPrintTemplate',
method: 'post',
data
})
}
//编辑打印模板列表
export function editPrintTemplate (data) {
return request({
url: SERVER.SERVERAPI + '/rest/system/print/editPrintTemplate',
method: 'post',
data
})
}
//删除打印模板列表
export function delPrintTemplate (params) {
return request({
url: SERVER.SERVERAPI + '/rest/system/print/delPrintTemplate',
method: 'get',
params: params
})
}
//根据模板编号获取打印模板
export function getPrintTemplateByCode (params) {
return request({
url: SERVER.SERVERAPI + '/rest/system/print/getPrintTemplateByCode',
method: 'get',
params: params
})
}
......
<template>
<dialogBox title="打印模板" @submitForm="submitForm" saveButton="保存" :isFullscreen="false" width="30%"
@closeDialog="closeDialog" v-model="myValue">
<el-form ref="ruleForm" :model="ruleForm" label-width="100px" :rules="rules">
<el-row>
<el-col :span="24">
<el-form-item label="模板编码:" prop="tmpno">
<el-input v-model="ruleForm.tmpno" :disabled="editFlag"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="模板名称:" prop="tmpname">
<el-input v-model="ruleForm.tmpname" :disabled="editFlag"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="模板设计:">
<el-button type="primary" @click="designByPRGData(ruleForm.tmpcontent)">模板设计</el-button>
<i class="el-icon-loading" style="font-size:24px;margin-left:10px;" v-if="loadStatus == '1'"></i>
<i class="el-icon-circle-check" style="font-size:24px;margin-left:10px;color:green" v-if="loadStatus == '2'"></i>
</el-form-item>
</el-col>
</el-row>
<object id="LODOP_OB" classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA" v-show="false">
<embed id="LODOP_EM" type="application/x-print-lodop" width=820 height=450 pluginspage="install_lodop32.exe"/>
</object>
<textarea rows="0" id="S1" cols="0" v-show="false"></textarea>
</el-form>
</dialogBox>
</template>
<script>
import { getLodop } from "@/utils/LodopFuncs"
import { mapGetters } from 'vuex'
import {addPrintTemplate,editPrintTemplate} from "@/api/system.js"
export default {
computed: {
...mapGetters(['dictData']),
},
props: {
value: { type: Boolean, default: false },
},
data () {
return {
myValue: this.value,
editFlag: false,
//打印模板设计保存状态 0:未操作 1:保存中 2:已保存
loadStatus: '0',
//表单提交数据
ruleForm: {
tmpno: '',
tmpname: '',
tmpfont: '',
tmpfontsize: '',
tmpcontent: ''
},
rules: {
tmpno: [
{ required: true, message: '模板编号不能为空', trigger: 'blur' }
],
tmpname: [
{ required: true, message: '模板名称不能为空', trigger: 'blur' }
],
},
}
},
watch: {
value (val) {
this.myValue = val
}
},
methods: {
//表单提交
submitForm () {
if(this.loadStatus == '1'){
return this.$message.error("模板设计保存中,请等待...")
}
this.$refs.ruleForm.validate(valid => {
if (valid) {
if(this.editFlag){
this.editTemplate();
}else{
this.addTemplate();
}
} else {
// console.log('error submit!!');
return false;
}
});
},
//新增
addTemplate(){
addPrintTemplate(this.ruleForm).then(res => {
if(res.code == 200){
this.$parent.fetchData();
this.$message.success('保存成功');
this.closeDialog();
}else{
this.$message.error(res.message)
}
})
},
//编辑
editTemplate() {
editPrintTemplate(this.ruleForm).then(res => {
if(res.code == 200){
this.$parent.fetchData();
this.$message.success('保存成功');
this.closeDialog();
}else{
this.$message.error(res.message)
}
})
},
closeDialog () {
this.$emit("input", false);
this.ruleForm = {
tmpno: '',
tmpname: '',
tmpfont: '',
tmpfontsize: '',
tmpcontent: ''
},
this.loadStatus = '0'
this.editFlag = false;
},
getDetailInfo(item){
this.ruleForm = item;
this.editFlag = true;
},
//设计打印模板
designByPRGData() {
let that = this;
that.loadStatus = '1';
let LODOP=getLodop(document.getElementById('LODOP_OB'),document.getElementById('LODOP_EM'));
LODOP.ADD_PRINT_DATA("ProgramData",this.ruleForm.tmpcontent); //装载模板
//窗口关闭后,回调函数中保存的设计代码
if (LODOP.CVERSION)
CLODOP.On_Return = function (TaskID, printList) {
if (LODOP.CVERSION)
LODOP.On_Return = function (TaskID, Value) {
document.getElementById("S1").value = Value;
};
document.getElementById("S1").value = LODOP.GET_VALUE(
"ProgramData",
0
);
setTimeout(() => {
that.ruleForm.tmpcontent = document.getElementById("S1").value;
that.loadStatus = '2';
}, 1000);
};
LODOP.PRINT_DESIGN(); //打印设计或者打印维护需要放到最后
}
}
}
</script>
<style scoped lang="scss">
@import "~@/styles/mixin.scss";
.font-red {
color: red
}
.middle-margin-bottom {
margin-top: 20px
}
</style>
......@@ -23,38 +23,38 @@ class data extends filter {
}
},
{
prop: "mbmc",
prop: "tmpno",
label: "模板编码",
},
{
prop: "mblx",
label: "模板类型",
prop: "tmpname",
label: "模板名称",
},
{
prop: "zt",
label: "字体",
prop: "tmpfont",
label: "模板字体",
},
{
prop: "ztdx",
label: "字体大小",
prop: "tmpfontsize",
label: "模板字体大小",
},
{
prop: "zjczsj",
prop: "updatetime",
label: "最近操作时间",
},
{
prop: "zjczr",
prop: "updater",
label: "最近操作人",
},
{
label: '操作',
width: '150',
align: 'center',
fixed: 'right',
render: (h, scope) => {
return (
<div>
<el-button type="text" icon="el-icon-edit-outline" onClick={() => { vm.editClick(scope) }}>设置打印模板</el-button>
<el-button type="text" icon="el-icon-edit-outline" onClick={() => { vm.openEditDialog(scope.row) }}>编辑</el-button>
{/* <el-button type="text" icon="el-icon-edit-outline" onClick={() => { vm.DesignByPRGData(scope.row) }}>设计</el-button> */}
{/* <el-button type="text" icon="el-icon-delete" onClick={() => { vm.removeTemplate(scope.row) }}>删除</el-button> */}
</div>
)
}
......
<template>
<div class="dymbgl from-clues-content">
<div class="from-clues">
<div class="from-clues-header">
<el-form>
<el-row>
<el-col :span="24" class="btnColRight">
<el-form-item>
<el-button type="primary" @click="fetchData">查询</el-button>
<el-button type="primary" @click="openAddDialog">新增</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<div class="from-clues-content">
<lb-table :page-size="pageData.size" :current-page.sync="pageData.current" :heightNum="215" :total="tableData.total"
@size-change="handleSizeChange" @p-current-change="handleCurrentChange" :column="tableData.columns"
:data="tableData.data">
</lb-table>
:data="tableData.data"></lb-table>
</div>
<object id="LODOP_OB" classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA" v-show="false">
<embed id="LODOP_EM" type="application/x-print-lodop" width=820 height=450 pluginspage="install_lodop32.exe"/>
</object>
<textarea rows="0" id="S1" cols="0" v-show="false"></textarea>
<editDialog ref="editDialog" v-model="isDialog" />
</div>
</template>
<script>
import { getLodop } from "@/utils/LodopFuncs"
import table from "@/utils/mixin/table"
import { datas, sendThis } from "./dymbgl"
import editDialog from "./components/editDialog.vue";
import {selectPrintTemplateList,delPrintTemplate} from "@/api/system.js"
export default {
name: "djbcx",
name: "dymbgl",
mixins: [table],
mounted () {
sendThis(this);
},
components: {editDialog},
data () {
return {
isDialog: false,
......@@ -24,34 +41,82 @@ export default {
tableData: {
total: 0,
columns: datas.columns(),
data: [
{
slsj: "2022-5-12",
}
]
data: []
},
printItem: "",
printList: {
year: '',
month: '',
day: '',
bh: '', // 编号
xzq: '',
xh: '',
d: '',
h: '',
qlr: '',
ywr: '',
zl: '',
bdcdyh: '',
qt: '',
fj: '',
zmsx: "证明事项",
},
}
},
mounted(){
sendThis(this);
this.fetchData()
},
methods: {
fetchData () {
selectPrintTemplateList({...this.pageData}).then(res => {
if(res.code == 200){
let { total, records } = res.result
this.tableData.total = total ? total : 0
this.tableData.data = records ? records : []
}
})
},
//打开新增弹窗
openAddDialog(){
this.isDialog = true;
},
//打开编辑弹窗
openEditDialog(item){
this.isDialog = true;
this.$nextTick(() => {
this.$refs.editDialog.getDetailInfo(item);
})
},
//删除数据
removeTemplate(item){
this.$confirm("确定要删除吗, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
delPrintTemplate({bsmTmp: item.bsmTmp}).then((res) => {
if (res.code == 200) {
this.$message.success("删除成功");
this.fetchData();
} else {
this.$message.error(res.message);
}
});
})
.catch(() => {
this.$message({
type: "info",
message: "已取消删除",
});
});
},
//设计打印模板
DesignByPRGData(item) {
let LODOP=getLodop(document.getElementById('LODOP_OB'),document.getElementById('LODOP_EM'));
LODOP.ADD_PRINT_DATA("ProgramData",item.tmpcontent); //装载模板
//窗口关闭后,回调函数中保存的设计代码
if (LODOP.CVERSION)
CLODOP.On_Return = function (TaskID, printList) {
if (LODOP.CVERSION)
LODOP.On_Return = function (TaskID, Value) {
document.getElementById("S1").value = Value;
};
document.getElementById("S1").value = LODOP.GET_VALUE(
"ProgramData",
0
);
setTimeout(() => {
item.tmpcontent = document.getElementById("S1").value;
}, 1000);
};
LODOP.PRINT_DESIGN(); //打印设计或者打印维护需要放到最后
},
editClick () {
let LODOP = getLodop();
......@@ -95,18 +160,9 @@ export default {
};
LODOP.PRINT_DESIGN(); //打印设计或者打印维护需要放到最后
},
handlePrint () {
let LODOP = getLodop();
// LODOP.ADD_PRINT_DATA("ProgramData", getSession("printValue"));
LODOP.PREVIEW();
},
},
};
</script>
<style scoped lang="scss">
@import "~@/styles/public.scss";
.dymbgl {
margin-top: -1px;
}
</style>
......
......@@ -5,6 +5,7 @@
<el-tab-pane :label="item.qlr + '(' + item.bdcqzh + ')'" :name="item.bsmBdcqz" v-for="(item,index) in headTabBdcqz" :key="index"></el-tab-pane>
</el-tabs>
<!-- <div class="zsyl-title">{{bdcqz.bdcqzlx == '1' ? '不动产权证书' : '不动产权证明'}}</div> -->
<div class="no-data">暂无数据</div>
<img :src="previewImage" class="imgClass">
</div>
</template>
......@@ -137,4 +138,11 @@ export default {
padding: 5px 0px;
font-size: 20px;
}
.no-data{
font-size:18px;
display: flex;
text-align: center;
justify-content: center;
}
</style>
......
import { getWorkFlowImage } from "@/api/workflow/jsydsyqFlow.js";
import { popupDialog } from "@/utils/popup.js";
import { getPrintTemplateByCode } from "@/api/system";
import { getLodop } from "@/utils/LodopFuncs"
import {
leftMenu,
stepExpandInfo,
......@@ -132,8 +134,21 @@ export default {
}, '1070px')
break;
case "B6":
popupDialog("打印申请书", "workflow/components/printApplication", this.currentSelectProps
, '1070px')
//根据编号获取对应信息
getPrintTemplateByCode({tmpno: 'dysqs'}).then(res => {
if(res.code == 200){
//打开模板设计
let LODOP=getLodop(document.getElementById('LODOP_OB'),document.getElementById('LODOP_EM'));
LODOP.ADD_PRINT_DATA("ProgramData",res.result.tmpcontent); //装载模板
//todo 调取后端接口获取数据 循环set
LODOP.SET_PRINT_STYLEA("qlrmc","CONTENT","计划大河风流看");
LODOP.PREVIEW();
}else{
this.$message.error(res.message)
}
})
break;
case "B7":
this.$popup("证书领取", "workflow/components/zslq", {
......
......@@ -68,6 +68,10 @@
</div>
</div>
</div>
<!-- 打印模板需要此模块 -->
<object id="LODOP_OB" classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA" v-show="false">
<embed id="LODOP_EM" type="application/x-print-lodop" width=820 height=450 pluginspage="install_lodop32.exe"/>
</object>
<fqsqDialog v-model="isDialog" :djywbm="$route.query.sqywbm" :isJump="true" @updateDialog="updateDialog" />
</div>
</template>
......