mirror of
https://gitee.com/java110/MicroCommunityWeb.git
synced 2026-02-24 21:59:12 +08:00
优化代码
This commit is contained in:
parent
6a027f67b2
commit
7b9d53f1ab
32
public/components/admin/addTemplateView/addTemplateView.html
Normal file
32
public/components/admin/addTemplateView/addTemplateView.html
Normal file
@ -0,0 +1,32 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="ibox">
|
||||
<div class="ibox-title">
|
||||
<h5>合同模板</h5>
|
||||
<div class="ibox-tools" style="top:10px;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label">模板内容</label>
|
||||
<div class="col-sm-10 ">
|
||||
<div class=" no-padding">
|
||||
<div class="summernote"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ibox-content">
|
||||
<button class="btn btn-primary float-right" type="button" v-on:click="saveTemplateInfo()"><i
|
||||
class="fa fa-check"></i> 提交
|
||||
</button>
|
||||
<button type="button" class="btn btn-warning float-right" style="margin-right:20px;"
|
||||
v-on:click="closeTemplateInfo()">取消
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
146
public/components/admin/addTemplateView/addTemplateView.js
Normal file
146
public/components/admin/addTemplateView/addTemplateView.js
Normal file
@ -0,0 +1,146 @@
|
||||
(function (vc) {
|
||||
|
||||
vc.extends({
|
||||
data: {
|
||||
addTemplateViewInfo: {
|
||||
contractTypeId: '',
|
||||
context: '',
|
||||
templateId: ''
|
||||
}
|
||||
},
|
||||
_initMethod: function () {
|
||||
vc.component._initTemplateInfo();
|
||||
},
|
||||
_initEvent: function () {
|
||||
|
||||
vc.on('addTemplateView', 'openTemplate', function (_param) {
|
||||
$that.clearaddTemplateViewInfo();
|
||||
$that.addTemplateViewInfo.contractTypeId = _param.contractTypeId;
|
||||
$that._loadTemplate();
|
||||
})
|
||||
|
||||
},
|
||||
methods: {
|
||||
addTemplateValidate() {
|
||||
return vc.validate.validate({
|
||||
addTemplateViewInfo: vc.component.addTemplateViewInfo
|
||||
}, {
|
||||
'addTemplateViewInfo.contractTypeId': [
|
||||
{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "合同类型不能为空"
|
||||
}
|
||||
],
|
||||
'addTemplateViewInfo.context': [
|
||||
{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "模板内容必填"
|
||||
},
|
||||
]
|
||||
|
||||
});
|
||||
},
|
||||
saveTemplateInfo: function () {
|
||||
let _url = "/contract/saveContractTypeTemplate";
|
||||
if ($that.addTemplateViewInfo.templateId != '' && $that.addTemplateViewInfo.templateId != '-1') {
|
||||
_url = "/contract/updateContractTypeTemplate";
|
||||
}
|
||||
|
||||
vc.http.apiPost(_url,
|
||||
JSON.stringify(vc.component.addTemplateViewInfo),
|
||||
{
|
||||
emulateJSON: true
|
||||
},
|
||||
function (json, res) {
|
||||
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
|
||||
if (res.status == 200) {
|
||||
//关闭model
|
||||
vc.component.clearaddTemplateViewInfo();
|
||||
vc.emit('contractTypeManage', 'componentShow', {});
|
||||
return;
|
||||
}
|
||||
vc.toast(json);
|
||||
|
||||
},
|
||||
function (errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
|
||||
vc.toast(errInfo);
|
||||
|
||||
});
|
||||
},
|
||||
clearaddTemplateViewInfo: function () {
|
||||
vc.component.addTemplateViewInfo = {
|
||||
contractTypeId: '',
|
||||
context: '',
|
||||
templateId: ''
|
||||
|
||||
};
|
||||
},
|
||||
_initTemplateInfo: function () {
|
||||
vc.component.addTemplateViewInfo.startTime = vc.dateFormat(new Date().getTime());
|
||||
var $summernote = $('.summernote').summernote({
|
||||
lang: 'zh-CN',
|
||||
height: 300,
|
||||
placeholder: '必填,请输入合同模板',
|
||||
callbacks: {
|
||||
onImageUpload: function (files, editor, $editable) {
|
||||
vc.component.sendFile($summernote, files);
|
||||
},
|
||||
onChange: function (contents, $editable) {
|
||||
vc.component.addTemplateViewInfo.context = contents;
|
||||
}
|
||||
},
|
||||
toolbar: [
|
||||
['style', ['style']],
|
||||
['font', ['bold', 'italic', 'underline', 'clear']],
|
||||
['fontname', ['fontname']],
|
||||
['color', ['color']],
|
||||
['para', ['ul', 'ol', 'paragraph']],
|
||||
['height', ['height']],
|
||||
['table', ['table']],
|
||||
['view', ['fullscreen', 'codeview']],
|
||||
['help', ['help']]
|
||||
],
|
||||
});
|
||||
},
|
||||
closeTemplateInfo: function () {
|
||||
vc.emit('contractTypeManage', 'componentShow', {});
|
||||
|
||||
},
|
||||
|
||||
_loadTemplate: function () {
|
||||
let param = {
|
||||
params: {
|
||||
page: 1,
|
||||
row: 1,
|
||||
contractTypeId: $that.addTemplateViewInfo.contractTypeId
|
||||
}
|
||||
}
|
||||
//发送get请求
|
||||
vc.http.apiGet('/contract/queryContractTypeTemplate',
|
||||
param,
|
||||
function (json, res) {
|
||||
var _contractTypeManageInfo = JSON.parse(json);
|
||||
|
||||
let _contractTypeTemplates = _contractTypeManageInfo.data;
|
||||
|
||||
if (_contractTypeTemplates.length < 1) {
|
||||
return;
|
||||
}
|
||||
$that.addTemplateViewInfo.templateId = _contractTypeTemplates[0].templateId;
|
||||
$that.addTemplateViewInfo.context = _contractTypeTemplates[0].context;
|
||||
$(".summernote").summernote('code', $that.addTemplateViewInfo.context);
|
||||
|
||||
}, function (errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
})(window.vc);
|
||||
@ -87,6 +87,10 @@
|
||||
<button class="btn-white btn btn-xs"
|
||||
v-on:click="_openEditContractModel(contract)">变更</button>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<button class="btn-white btn btn-xs"
|
||||
v-on:click="_printContract(contract)">打印</button>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<button class="btn-white btn btn-xs"
|
||||
v-on:click="_openDeleteContractModel(contract)">删除</button>
|
||||
|
||||
@ -77,6 +77,9 @@
|
||||
} else {
|
||||
vc.component.contractManageInfo.moreCondition = true;
|
||||
}
|
||||
},
|
||||
_printContract: function (_contract) {
|
||||
window.open("/print.html#/pages/admin/printContract?contractTypeId=" + _contract.contractType);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<div>
|
||||
<div class="row">
|
||||
<div class="row" v-if="contractTypeManageInfo.componentShow == 'contractTypeList'">
|
||||
<div class="col-lg-12">
|
||||
<div class="ibox ">
|
||||
<div class="ibox-title">
|
||||
@ -43,7 +43,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="row" v-if="contractTypeManageInfo.componentShow == 'contractTypeList'">
|
||||
<div class="col-lg-12">
|
||||
<div class="ibox">
|
||||
<div class="ibox-title">
|
||||
@ -78,6 +78,10 @@
|
||||
<button class="btn-white btn btn-xs"
|
||||
v-on:click="_openContractTypeSpecModel(contractType)">扩展信息</button>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<button class="btn-white btn btn-xs"
|
||||
v-on:click="_openContractTemplate(contractType)">合同模板</button>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<button class="btn-white btn btn-xs"
|
||||
v-on:click="_openEditContractTypeModel(contractType)">修改</button>
|
||||
@ -104,6 +108,10 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-show="contractTypeManageInfo.componentShow != 'contractTypeList'">
|
||||
<vc:create path="admin/addTemplateView"></vc:create>
|
||||
</div>
|
||||
|
||||
<vc:create path="admin/addContractType" callBackListener="" callBackFunction=""></vc:create>
|
||||
<vc:create path="admin/editContractType"></vc:create>
|
||||
<vc:create path="admin/deleteContractType"></vc:create>
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
records: 1,
|
||||
moreCondition: false,
|
||||
contractTypeId: '',
|
||||
componentShow: 'contractTypeList',
|
||||
conditions: {
|
||||
typeName: '',
|
||||
audit: '',
|
||||
@ -24,6 +25,10 @@
|
||||
},
|
||||
_initEvent: function () {
|
||||
|
||||
vc.on('contractTypeManage', 'componentShow', function (_param) {
|
||||
vc.component.contractTypeManageInfo.componentShow = 'contractTypeList';
|
||||
});
|
||||
|
||||
vc.on('contractTypeManage', 'listContractType', function (_param) {
|
||||
vc.component._listContractTypes(DEFAULT_PAGE, DEFAULT_ROWS);
|
||||
});
|
||||
@ -72,6 +77,10 @@
|
||||
_openContractTypeSpecModel: function (_contractType) {
|
||||
vc.jumpToPage('/admin.html#/pages/admin/contractTypeSpecManage?contractTypeId=' + _contractType.contractTypeId);
|
||||
},
|
||||
_openContractTemplate: function (_contractType) {
|
||||
$that.contractTypeManageInfo.componentShow = '';
|
||||
vc.emit('addTemplateView', 'openTemplate', _contractType);
|
||||
},
|
||||
_moreCondition: function () {
|
||||
if (vc.component.contractTypeManageInfo.moreCondition) {
|
||||
vc.component.contractTypeManageInfo.moreCondition = false;
|
||||
|
||||
21
public/pages/admin/printContract/printContract.html
Normal file
21
public/pages/admin/printContract/printContract.html
Normal file
@ -0,0 +1,21 @@
|
||||
<div>
|
||||
<div>
|
||||
<div>
|
||||
<div class=" text-center">
|
||||
<h1>合同打印</h1>
|
||||
</div>
|
||||
<div class="row margin-top">
|
||||
<div class="col-sm-12">
|
||||
<div v-html="printContractInfo.context"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="print-btn">
|
||||
<button class="btn btn-primary float-right" type="button" v-on:click="_printContractDiv()">
|
||||
<i class="fa fa-check"></i> 打印
|
||||
</button>
|
||||
<button type="button" class="btn btn-warning float-right" style="margin-right:20px;" v-on:click="_closePage()">取消
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
69
public/pages/admin/printContract/printContract.js
Normal file
69
public/pages/admin/printContract/printContract.js
Normal file
@ -0,0 +1,69 @@
|
||||
(function (vc) {
|
||||
|
||||
vc.extends({
|
||||
data: {
|
||||
printContractInfo: {
|
||||
contractTypeId: '',
|
||||
context: ''
|
||||
},
|
||||
printFlag: '0'
|
||||
},
|
||||
_initMethod: function () {
|
||||
//vc.component._initPrintPurchaseApplyDateInfo();
|
||||
|
||||
$that.printContractInfo.contractTypeId = vc.getParam('contractTypeId');
|
||||
|
||||
$that._loadContract();
|
||||
},
|
||||
_initEvent: function () {
|
||||
|
||||
|
||||
},
|
||||
methods: {
|
||||
_initPayFee: function () {
|
||||
|
||||
},
|
||||
_loadContract: function () {
|
||||
var param = {
|
||||
params: {
|
||||
page: 1,
|
||||
row: 1,
|
||||
contractTypeId: $that.printContractInfo.contractTypeId
|
||||
}
|
||||
};
|
||||
|
||||
//发送get请求
|
||||
vc.http.apiGet('/contract/queryContractTypeTemplate',
|
||||
param,
|
||||
function (json, res) {
|
||||
let _info = JSON.parse(json);
|
||||
let _data = _info.data;
|
||||
if (_data.length > 0) {
|
||||
$that.printContractInfo.context = _data[0].context;
|
||||
}
|
||||
}, function (errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
}
|
||||
);
|
||||
|
||||
},
|
||||
|
||||
_printContractDiv: function () {
|
||||
|
||||
$that.printFlag = '1';
|
||||
console.log('console.log($that.printFlag);', $that.printFlag);
|
||||
document.getElementById("print-btn").style.display = "none";//隐藏
|
||||
|
||||
window.print();
|
||||
//$that.printFlag = false;
|
||||
window.opener = null;
|
||||
window.close();
|
||||
},
|
||||
_closePage: function () {
|
||||
window.opener = null;
|
||||
window.close();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
})(window.vc);
|
||||
Loading…
Reference in New Issue
Block a user