199 lines
5.9 KiB
Vue
199 lines
5.9 KiB
Vue
<template>
|
|
<div >
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
<el-row :gutter="0" style="display: flex;flex-wrap: wrap;">
|
|
<el-col :span="8">
|
|
<el-form-item label="模板名称" prop="name">
|
|
<el-input v-model="form.name" placeholder="请输入模板名称" />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="4">
|
|
<el-form-item label="模版代码" prop="code" >
|
|
<el-input v-model="form.code" placeholder="请输入模版代码" :disabled="form.id!=null" />
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
<el-col :span="6">
|
|
<el-form-item label="模板版本" prop="version">
|
|
<el-input v-model="form.version" placeholder="" />
|
|
</el-form-item>
|
|
</el-col>
|
|
<!-- <el-col :span="24">
|
|
<el-form-item label="公共模板标识" prop="isPublic">
|
|
<el-input v-model="form.isPublic" placeholder="请输入公共模板标识" />
|
|
</el-form-item>
|
|
</el-col> -->
|
|
<el-col :span="6">
|
|
<el-form-item label="快递类型" prop="expressType">
|
|
<el-input v-model="form.expressType" placeholder="请输入快递类型" />
|
|
</el-form-item>
|
|
</el-col>
|
|
<!-- <el-col :span="24">
|
|
<el-form-item label="模板内容-在线模版" prop="tplData">
|
|
<el-input v-model="form.tplData" placeholder="请输入模板内容-在线模版" />
|
|
</el-form-item>
|
|
</el-col> -->
|
|
<el-col :span="6">
|
|
<el-form-item label="启用状态" prop="status">
|
|
<el-radio-group v-model="form.status">
|
|
<el-radio :label="1">是</el-radio>
|
|
<el-radio :label="0">否</el-radio>
|
|
</el-radio-group>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="24">
|
|
<el-form-item label="加密模版" prop="tplEncData">
|
|
<el-input v-model="form.tplEncData" type="textarea" rows="6" placeholder="" disabled />
|
|
<FileUpload :showTip="true" :isNeedUpload="false" :fileType="['xtpl']" :limit="1" @onUploaded="onTplUploaded"></FileUpload>
|
|
</el-form-item>
|
|
</el-col>
|
|
<!-- <el-col :span="12">
|
|
<el-form-item label="pdf模版" prop="tplPdfData">
|
|
<el-input v-model="form.tplPdfData" type="textarea" rows="12" placeholder="" disabled />
|
|
</el-form-item>
|
|
</el-col> -->
|
|
<!-- <el-col :span="24">
|
|
<el-form-item label="在线图片" prop="tplPicUrl">
|
|
<el-input v-model="form.tplPicUrl" placeholder="请输入在线图片" />
|
|
</el-form-item>
|
|
</el-col> -->
|
|
|
|
<el-col :span="24">
|
|
<el-form-item label="排序" prop="orderNum">
|
|
<el-input v-model="form.orderNum" placeholder="排序" />
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
|
|
<el-col :span="24">
|
|
<el-form-item label="备注" prop="remark">
|
|
<el-input v-model="form.remark" type="textarea" placeholder="请输入备注" />
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
|
|
</el-row>
|
|
</el-form>
|
|
<div style="text-align: center;margin-bottom: 10px;">
|
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
<el-button @click="cancel">取 消</el-button>
|
|
</div>
|
|
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { listEmisPrintTpl, getEmisPrintTpl, delEmisPrintTpl, addEmisPrintTpl, updateEmisPrintTpl } from "@/api/emis/emisPrintTpl";
|
|
import {Base64} from "js-base64"
|
|
export default {
|
|
name: "emisPrintTplForm",
|
|
props:{
|
|
id:{
|
|
type:[Number,Array]
|
|
}
|
|
},
|
|
components: { },
|
|
dicts: [
|
|
],
|
|
data() {
|
|
return {
|
|
emisPrintTplOptions: [],
|
|
// 遮罩层
|
|
loading: true,
|
|
// 表单参数
|
|
form: {},
|
|
// 表单校验
|
|
rules: {
|
|
id: [
|
|
{ required: true, message: "id不能为空", trigger: "blur" }
|
|
],
|
|
status: [
|
|
{ required: true, message: "0-初始不能为空", trigger: "blur" }
|
|
],
|
|
}
|
|
};
|
|
},
|
|
watch: {
|
|
"id": {
|
|
handler (newValue, oldValue) {
|
|
this.id = newValue;
|
|
this.initData();
|
|
},
|
|
deep: true
|
|
}
|
|
},
|
|
created() {
|
|
this.initData();
|
|
},
|
|
|
|
methods: {
|
|
onTplUploaded(val){
|
|
this.form.tplEncData=Base64.decode(val);
|
|
},
|
|
initData() {
|
|
|
|
if(this.id !=null) {
|
|
this.loading = true;
|
|
getEmisPrintTpl(this.id).then(response => {
|
|
this.form = response.data;
|
|
this.loading = false;
|
|
});
|
|
}else{
|
|
this.reset();
|
|
}
|
|
// this.getTreeselect();
|
|
},
|
|
// 取消按钮
|
|
cancel() {
|
|
this.reset();
|
|
this.$emit("on-cancel");
|
|
},
|
|
// 表单重置
|
|
reset() {
|
|
this.form = {
|
|
id: null,
|
|
code: null,
|
|
name: null,
|
|
version: null,
|
|
isPublic: null,
|
|
merchId: null,
|
|
expressType: null,
|
|
tplData: null,
|
|
tplEncData: null,
|
|
tplPdfData: null,
|
|
tplPicUrl: null,
|
|
status: null,
|
|
delFlag: null,
|
|
createBy: null,
|
|
createTime: null,
|
|
updateBy: null,
|
|
updateTime: null,
|
|
remark: null,
|
|
createSite: null,
|
|
updateSite: null
|
|
};
|
|
this.resetForm("form");
|
|
},
|
|
/** 提交按钮 */
|
|
submitForm() {
|
|
this.$refs["form"].validate(valid => {
|
|
if (valid) {
|
|
if (this.form.id != null) {
|
|
updateEmisPrintTpl(this.form).then(response => {
|
|
this.$modal.msgSuccess("修改成功");
|
|
this.$emit("on-changed");
|
|
});
|
|
} else {
|
|
addEmisPrintTpl(this.form).then(response => {
|
|
this.$modal.msgSuccess("添加成功");
|
|
this.$emit("on-changed");
|
|
});
|
|
}
|
|
}
|
|
});
|
|
},
|
|
|
|
}
|
|
};
|
|
</script>
|