6f68f042 by renchao@pashanhoo.com

style:弹窗修改

1 parent bef6274f
......@@ -13,5 +13,6 @@ const getters = {
addDict: state => state.dict.addDict,
dictData: state => state.dict.dictData,
djbxx: state => state.djbxx.djbxx,
isRefresh: state => state.user.isRefresh,
}
export default getters
......
/*
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-04-12 10:47:33
*/
import { getUserInfo } from '@/api/user'
const state = {
name: '',
avatar: 'https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png',
userData: {}
isRefresh: false,
}
const mutations = {
SET_NAME: (state, data) => {
state.name = data.loginName
state.userData = data
},
REFRESH: (state, data) => {
state.isRefresh = data
}
}
......@@ -19,6 +26,9 @@ const actions = {
resolve(true)
})
},
refreshPage ({ commit }, data) {
commit('REFRESH', data)
},
}
export default {
namespaced: true,
......
<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"/>
<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>
<el-form-item class="text-center">
<el-button @click="closeDialog">取消</el-button>
<el-button type="primary" @click="submitForm" plain>确定</el-button>
</el-form-item>
</el-form>
</template>
<script>
import { getLodop } from "@/utils/LodopFuncs"
import { mapGetters } from 'vuex'
import {addPrintTemplate,editPrintTemplate} from "@/api/system.js"
import store from '@/store/index.js'
import { addPrintTemplate, editPrintTemplate } from "@/api/system.js"
export default {
computed: {
...mapGetters(['dictData']),
},
props: {
value: { type: Boolean, default: false },
formData: {
type: Object,
default: () => { }
}
},
data () {
return {
myValue: this.value,
editFlag: false,
//打印模板设计保存状态 0:未操作 1:保存中 2:已保存
loadStatus: '0',
//表单提交数据
ruleForm: {
tmpno: '',
tmpname: '',
tmpfont: '',
tmpfontsize: '',
tmpcontent: ''
tmpno: '',
tmpname: '',
tmpfont: '',
tmpfontsize: '',
tmpcontent: ''
},
rules: {
tmpno: [
......@@ -68,76 +74,73 @@ export default {
},
}
},
watch: {
value (val) {
this.myValue = val
}
mounted () {
if (JSON.stringify(this.formData) != "{}") this.getDetailInfo(this.formData)
},
methods: {
//表单提交
submitForm () {
if(this.loadStatus == '1'){
return this.$message.error("模板设计保存中,请等待...")
if (this.loadStatus == '1') {
return this.$message.error("模板设计保存中,请等待...")
}
this.$refs.ruleForm.validate(valid => {
if (valid) {
if(this.editFlag){
this.editTemplate();
}else{
this.addTemplate();
}
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)
}
})
addTemplate () {
addPrintTemplate(this.ruleForm).then(res => {
if (res.code == 200) {
store.dispatch('user/refreshPage', true);
this.$message.success('保存成功');
this.$popupCacel()
} 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)
}
})
editTemplate () {
editPrintTemplate(this.ruleForm).then(res => {
if (res.code == 200) {
store.dispatch('user/refreshPage', true);
this.$message.success('保存成功');
this.$popupCacel()
} else {
this.$message.error(res.message)
}
})
},
closeDialog () {
this.$emit("input", false);
this.$popupCacel()
this.ruleForm = {
tmpno: '',
tmpname: '',
tmpfont: '',
tmpfontsize: '',
tmpcontent: ''
},
tmpno: '',
tmpname: '',
tmpfont: '',
tmpfontsize: '',
tmpcontent: ''
}
this.loadStatus = '0'
this.editFlag = false;
},
getDetailInfo(item){
getDetailInfo (item) {
this.ruleForm = item;
this.editFlag = true;
},
//设计打印模板
designByPRGData() {
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); //装载模板
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) {
......@@ -150,8 +153,8 @@ export default {
0
);
setTimeout(() => {
that.ruleForm.tmpcontent = document.getElementById("S1").value;
that.loadStatus = '2';
that.ruleForm.tmpcontent = document.getElementById("S1").value;
that.loadStatus = '2';
}, 1000);
};
LODOP.PRINT_DESIGN(); //打印设计或者打印维护需要放到最后
......@@ -162,6 +165,7 @@ export default {
<style scoped lang="scss">
@import "~@/styles/mixin.scss";
@import "~@/styles/dialogBoxheader.scss";
.font-red {
color: red
}
......
......@@ -2,38 +2,37 @@
<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>
<el-row>
<el-col :span="24" class="btnColRight">
<el-form-item>
{{ isRefresh }}
<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="270" :total="tableData.total"
@size-change="handleSizeChange" @p-current-change="handleCurrentChange" :column="tableData.columns"
:data="tableData.data"></lb-table>
@size-change="handleSizeChange" @p-current-change="handleCurrentChange" :column="tableData.columns"
: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>
<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 { mapGetters } from 'vuex'
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"
import { selectPrintTemplateList, delPrintTemplate } from "@/api/system.js"
export default {
name: "dymbgl",
mixins: [table],
components: {editDialog},
data () {
return {
isDialog: false,
......@@ -45,18 +44,28 @@ export default {
},
printItem: "",
printList: {
},
}
},
mounted(){
mounted () {
sendThis(this);
this.fetchData()
},
computed: {
...mapGetters(['isRefresh'])
},
watch: {
isRefresh: {
handler (newVal, oldVal) {
if (newVal) this.fetchData
}
}
},
methods: {
fetchData () {
selectPrintTemplateList({...this.pageData}).then(res => {
if(res.code == 200){
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 : []
......@@ -64,32 +73,29 @@ export default {
})
},
//打开新增弹窗
openAddDialog(){
this.isDialog = true;
openAddDialog () {
this.$popupDialog("新增打印模板", "system/dymbgl/components/editDialog", {}, "35%")
},
//打开编辑弹窗
openEditDialog(item){
this.isDialog = true;
this.$nextTick(() => {
this.$refs.editDialog.getDetailInfo(item);
})
openEditDialog (item) {
this.$popupDialog("编辑打印模板", "system/dymbgl/components/editDialog", item, "35%")
},
//删除数据
removeTemplate(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);
}
});
})
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",
......@@ -98,9 +104,9 @@ export default {
});
},
//设计打印模板
DesignByPRGData(item) {
let LODOP=getLodop(document.getElementById('LODOP_OB'),document.getElementById('LODOP_EM'));
LODOP.ADD_PRINT_DATA("ProgramData",item.tmpcontent); //装载模板
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) {
......