mirror of
https://gitee.com/java110/MicroCommunityWeb.git
synced 2026-02-24 21:59:12 +08:00
优化代码
This commit is contained in:
parent
6d7d52d257
commit
7b431686e8
@ -35,8 +35,8 @@
|
||||
vc.http.apiGet('/contractFile/queryContractFile',
|
||||
param,
|
||||
function (json, res) {
|
||||
var _contractTFile = JSON.parse(json);
|
||||
vc.component.contractDetailInfo.files = _contractTFile.data;
|
||||
let _contractTFile = JSON.parse(json);
|
||||
$that.contractDetailFileInfo.files = _contractTFile.data;
|
||||
},
|
||||
function (errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
|
||||
@ -0,0 +1,88 @@
|
||||
<div id="searchOwnerInvoiceModel" class="modal fade" role="dialog"
|
||||
aria-labelledby="searchOwnerInvoiceModelLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-title" id="searchOwnerInvoiceModelLabel">
|
||||
<vc:i18n name="选择业主" namespace="searchOwnerInvoice"></vc:i18n>
|
||||
</h3>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="ibox ">
|
||||
<div class="row">
|
||||
<div class="col-sm-7 m-b-xs">
|
||||
<div class="input-group">
|
||||
<input :placeholder="vc.i18n('输入房屋编号楼栋-单元-房屋','searchOwnerInvoice')"
|
||||
type="text" v-model="searchOwnerInvoiceInfo.roomName"
|
||||
class="form-control form-control-sm">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<div class="input-group">
|
||||
<input :placeholder="vc.i18n('输入业主名称','searchOwnerInvoice')" type="text"
|
||||
v-model="searchOwnerInvoiceInfo._currentOwnerName"
|
||||
class="form-control form-control-sm">
|
||||
<span class="input-group-append">
|
||||
<button type="button" class="btn btn-sm btn-primary"
|
||||
v-on:click="searchOwnerInvoices()">
|
||||
<vc:i18n name="查询" namespace="searchOwnerInvoice"></vc:i18n>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table-responsive" style="margin-top:15px">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center">
|
||||
<vc:i18n name='业主名称' namespace='searchOwnerInvoice'></vc:i18n>
|
||||
</th>
|
||||
<th class="text-center">
|
||||
<vc:i18n name='发票类型' namespace='searchOwnerInvoice'></vc:i18n>
|
||||
</th>
|
||||
<th class="text-center">
|
||||
<vc:i18n name='发票名头' namespace='searchOwnerInvoice'></vc:i18n>
|
||||
</th>
|
||||
<th class="text-center">
|
||||
<vc:i18n name='纳税人识别号' namespace='searchOwnerInvoice'></vc:i18n>
|
||||
</th>
|
||||
<th class="text-center">
|
||||
<vc:i18n name='地址、电话' namespace='searchOwnerInvoice'></vc:i18n>
|
||||
</th>
|
||||
<th class="text-center">
|
||||
<vc:i18n name="操作" namespace="searchOwnerInvoice"></vc:i18n>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="ownerInvoice in ownerInvoiceInfo.ownerInvoices">
|
||||
<td class="text-center">{{ownerInvoice.ownerName}}</td>
|
||||
<td class="text-center">{{ownerInvoice.invoiceType == '1001'?'个人':'公司'}}
|
||||
</td>
|
||||
<td class="text-center">{{ownerInvoice.invoiceName}}</td>
|
||||
<td class="text-center">{{ownerInvoice.invoiceNum}}</td>
|
||||
<td class="text-center">{{ownerInvoice.invoiceAddress}}</td>
|
||||
<td class="text-center">
|
||||
<button class="btn btn-primary btn-xs" v-on:click="chooseOwnerInvoice(ownerInvoice)">
|
||||
<vc:i18n name="选择" namespace="searchOwnerInvoice">
|
||||
</vc:i18n>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<vc:create namespace="searchOwnerInvoice" path="frame/paginationPlus"></vc:create>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -0,0 +1,65 @@
|
||||
(function (vc) {
|
||||
vc.extends({
|
||||
propTypes: {
|
||||
emitChooseOwner: vc.propTypes.string,
|
||||
emitLoadData: vc.propTypes.string
|
||||
},
|
||||
data: {
|
||||
searchOwnerInvoiceInfo: {
|
||||
ownerInvoices: [],
|
||||
ownerNameLike: '',
|
||||
roomName: ''
|
||||
}
|
||||
},
|
||||
_initMethod: function () {
|
||||
},
|
||||
_initEvent: function () {
|
||||
vc.on('searchOwnerInvoice', 'openSearchOwnerInvoiceModel', function (_param) {
|
||||
$('#searchOwnerInvoiceModel').modal('show');
|
||||
$that._refreshsearchOwnerInvoiceData();
|
||||
$that._loadAllOwnerInvoiceInfo(1, 10);
|
||||
});
|
||||
vc.on('searchOwnerInvoice', 'paginationPlus', 'page_event', function (_currentPage) {
|
||||
$that._loadAllOwnerInvoiceInfo(_currentPage, 10);
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
_loadAllOwnerInvoiceInfo: function (_page, _row) {
|
||||
let param = {
|
||||
params: {
|
||||
page: _page,
|
||||
row: _row,
|
||||
communityId: vc.getCurrentCommunity().communityId,
|
||||
ownerNameLike: $that.searchOwnerInvoiceInfo.ownerNameLike,
|
||||
}
|
||||
};
|
||||
//发送get请求
|
||||
vc.http.apiGet('/invoice.listOwnerInvoice',
|
||||
param,
|
||||
function (json) {
|
||||
let _json = JSON.parse(json);
|
||||
$that.searchOwnerInvoiceInfo.ownerInvoices = _json.data;
|
||||
vc.emit('searchOwnerInvoice', 'paginationPlus', 'init', {
|
||||
total: _ownerInfo.records,
|
||||
currentPage: _page
|
||||
});
|
||||
},
|
||||
function () {
|
||||
console.log('请求失败处理');
|
||||
}
|
||||
);
|
||||
},
|
||||
chooseOwnerInvoice: function (_owner) {
|
||||
vc.emit($props.emitChooseOwner, 'chooseOwnerInvoice', _owner);
|
||||
vc.emit($props.emitLoadData, 'listOwnerInvoiceData', _owner);
|
||||
$('#searchOwnerInvoiceModel').modal('hide');
|
||||
},
|
||||
searchOwnerInvoices: function () {
|
||||
$that._loadAllOwnerInfo(1, 10, $that.searchOwnerInvoiceInfo.ownerNameLike);
|
||||
},
|
||||
_refreshsearchOwnerInvoiceData: function () {
|
||||
$that.searchOwnerInvoiceInfo.ownerNameLike = "";
|
||||
}
|
||||
}
|
||||
});
|
||||
})(window.vc);
|
||||
@ -79,14 +79,14 @@
|
||||
$that.addContractInfo.objId = param.ownerId;
|
||||
})
|
||||
vc.on("addContract", "notify3", function (info) {
|
||||
vc.component.addContractInfo.nextUserId = info.staffId;
|
||||
vc.component.addContractInfo.staffName = info.staffName;
|
||||
$that.addContractInfo.nextUserId = info.staffId;
|
||||
$that.addContractInfo.staffName = info.staffName;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
addContractValidate() {
|
||||
return vc.validate.validate({
|
||||
addContractInfo: vc.component.addContractInfo
|
||||
addContractInfo: $that.addContractInfo
|
||||
}, {
|
||||
'addContractInfo.contractName': [
|
||||
{
|
||||
@ -255,7 +255,7 @@
|
||||
param,
|
||||
function (json, res) {
|
||||
var _contractTFile = JSON.parse(json);
|
||||
vc.component.addContractInfo.rooms = _contractTFile.data;
|
||||
$that.addContractInfo.rooms = _contractTFile.data;
|
||||
},
|
||||
function (errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
@ -263,15 +263,15 @@
|
||||
);
|
||||
},
|
||||
saveContractInfo: function () {
|
||||
if (!vc.component.addContractValidate()) {
|
||||
if (!$that.addContractValidate()) {
|
||||
vc.toast(vc.validate.errInfo);
|
||||
return;
|
||||
}
|
||||
vc.component.addContractInfo.communityId = vc.getCurrentCommunity().communityId;
|
||||
$that.addContractInfo.communityId = vc.getCurrentCommunity().communityId;
|
||||
|
||||
vc.http.apiPost(
|
||||
'/contract/saveContract',
|
||||
JSON.stringify(vc.component.addContractInfo), {
|
||||
JSON.stringify($that.addContractInfo), {
|
||||
emulateJSON: true
|
||||
},
|
||||
function (json, res) {
|
||||
@ -293,7 +293,7 @@
|
||||
},
|
||||
clearAddContractInfo: function () {
|
||||
let _contractTypes = $that.addContractInfo.contractTypes;
|
||||
vc.component.addContractInfo = {
|
||||
$that.addContractInfo = {
|
||||
contractName: '',
|
||||
contractCode: '',
|
||||
contractType: '',
|
||||
@ -343,7 +343,7 @@
|
||||
param,
|
||||
function (json, res) {
|
||||
var _contractTypeManageInfo = JSON.parse(json);
|
||||
vc.component.addContractInfo.contractTypes = _contractTypeManageInfo.data;
|
||||
$that.addContractInfo.contractTypes = _contractTypeManageInfo.data;
|
||||
},
|
||||
function (errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
@ -362,7 +362,7 @@
|
||||
param,
|
||||
function (json, res) {
|
||||
var _contractTypeManageInfo = JSON.parse(json);
|
||||
vc.component.addContractInfo.contractPartyAs = _contractTypeManageInfo.data;
|
||||
$that.addContractInfo.contractPartyAs = _contractTypeManageInfo.data;
|
||||
},
|
||||
function (errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
@ -433,20 +433,20 @@
|
||||
}
|
||||
},
|
||||
getFile: function (e, index) {
|
||||
vc.component.addContractInfo.tempfile = e.target.files[0];
|
||||
$that.addContractInfo.contractFilePo[index].fileRealName = vc.component.addContractInfo.tempfile.name;
|
||||
$that.addContractInfo.tempfile = e.target.files[0];
|
||||
$that.addContractInfo.contractFilePo[index].fileRealName = $that.addContractInfo.tempfile.name;
|
||||
this._importData(index);
|
||||
},
|
||||
_importData: function (index) {
|
||||
// 导入数据
|
||||
let _fileName = vc.component.addContractInfo.tempfile.name;
|
||||
let _fileName = $that.addContractInfo.tempfile.name;
|
||||
let _suffix = _fileName.substring(_fileName.lastIndexOf('.') + 1);
|
||||
if (!vc.component.checkFileType(_suffix.toLowerCase())) {
|
||||
if (!$that.checkFileType(_suffix.toLowerCase())) {
|
||||
vc.toast('操作失败,请上传图片、PDF格式的文件');
|
||||
return;
|
||||
}
|
||||
var param = new FormData();
|
||||
param.append("uploadFile", vc.component.addContractInfo.tempfile);
|
||||
let param = new FormData();
|
||||
param.append("uploadFile", $that.addContractInfo.tempfile);
|
||||
vc.http.upload(
|
||||
'importRoomFee',
|
||||
'uploadContactFile',
|
||||
@ -505,7 +505,7 @@
|
||||
param,
|
||||
function (json, res) {
|
||||
let _expirationContractInfo = JSON.parse(json);
|
||||
vc.copyObject(_expirationContractInfo.data[0], vc.component.addContractInfo);
|
||||
vc.copyObject(_expirationContractInfo.data[0], $that.addContractInfo);
|
||||
$that.addContractInfo.contractId = '';
|
||||
$that.addContractInfo.contractCode = '';
|
||||
$that.addContractInfo.contractName = '';
|
||||
|
||||
@ -83,6 +83,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<vc:create path="property/searchOwner" emitChooseOwner="addOwnerInvoice" emitLoadData="addOwnerInvoice">
|
||||
<vc:create path="fee/searchOwnerInvoice" emitChooseOwner="addOwnerInvoice" emitLoadData="addOwnerInvoice">
|
||||
</vc:create>
|
||||
</div>
|
||||
@ -17,9 +17,8 @@
|
||||
|
||||
},
|
||||
_initEvent: function () {
|
||||
vc.on('addOwnerInvoice', 'chooseOwner', function (_owner) {
|
||||
$that.addOwnerInvoiceInfo.ownerName = _owner.name;
|
||||
$that.addOwnerInvoiceInfo.ownerId = _owner.ownerId;
|
||||
vc.on('addOwnerInvoice', 'chooseOwnerInvoice', function (_owner) {
|
||||
vc.copyObject(_owner,$that.addOwnerInvoiceInfo);
|
||||
$that._loadFeeDetails();
|
||||
});
|
||||
},
|
||||
@ -116,21 +115,16 @@
|
||||
if (_json.code == 0) {
|
||||
//关闭model
|
||||
vc.goBack();
|
||||
|
||||
return;
|
||||
}
|
||||
vc.toast(_json.msg);
|
||||
|
||||
},
|
||||
function (errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
|
||||
vc.toast(errInfo);
|
||||
|
||||
});
|
||||
},
|
||||
_openChooseOwner: function () {
|
||||
vc.emit('searchOwner', 'openSearchOwnerModel', {});
|
||||
vc.emit('searchOwnerInvoice', 'openSearchOwnerInvoiceModel', {});
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user