167 lines
6.7 KiB
JavaScript
167 lines
6.7 KiB
JavaScript
(function (vc) {
|
|
vc.extends({
|
|
data: {
|
|
selectIds: [],
|
|
doImportCreateFeeInfo: {
|
|
communityId: vc.getCurrentCommunity().communityId,
|
|
excelTemplate: ''
|
|
}
|
|
},
|
|
_initMethod: function () { },
|
|
_initEvent: function () {
|
|
vc.on('accountManageVoucher', 'openaccountManageVoucherModal', function (_param) {
|
|
$('#accountManageVoucherModal').modal('show');
|
|
$that._listAccounts(1, 15);
|
|
// vc.component.reportPayFeeDetailInfo.selectFeeIds = [];
|
|
// $that.reportPayFeeDetailInfo.conditions.voucherFlag = "checkNull";
|
|
// $that._queryMethod();
|
|
});
|
|
// 监听关闭事件
|
|
$('#accountManageVoucherModal').on('hidden.bs.modal', function () {
|
|
// $that.reportPayFeeDetailInfo.conditions.voucherFlag = "";
|
|
// $that._queryMethod(true);
|
|
vc.emit('accountManageVoucher', 'modalClosed', {});
|
|
});
|
|
},
|
|
watch: {
|
|
// ✅ 监听数组变化
|
|
'reportPayFeeDetailInfo.selectFeeIds': {
|
|
handler: function (newVal) {
|
|
// 判断是否刚好选中10个
|
|
let checkAllBox = document.getElementById('quan');
|
|
if (checkAllBox) {
|
|
if (newVal.length === 10) {
|
|
checkAllBox.checked = true;
|
|
} else {
|
|
checkAllBox.checked = false;
|
|
}
|
|
}
|
|
},
|
|
deep: true
|
|
}
|
|
},
|
|
mounted() {
|
|
if (this.accountManageInfo.acctTypes && this.accountManageInfo.acctTypes.length > 0) {
|
|
this.accountManageInfo.conditions.acctType = this.accountManageInfo.acctTypes[0].statusCd;
|
|
}
|
|
},
|
|
methods: {
|
|
_accountVoucherDetail: function () {
|
|
alert(1)
|
|
// $that._queryMethod(true);
|
|
vc.emit('accountManageVoucherDetail', 'openaccountManageVoucherDetailModal', {})
|
|
},
|
|
_swatchAcctTypeBySelect() {
|
|
// 选中的账户类型对象
|
|
const selected = this.accountManageInfo.acctTypes.find(
|
|
(item) => item.statusCd === this.accountManageInfo.conditions.acctType
|
|
);
|
|
if (selected) {
|
|
this._swatchAcctType(selected);
|
|
}
|
|
},
|
|
// 你原本已有的方法
|
|
_swatchAcctType(item) {
|
|
this.accountManageInfo.conditions.acctType = item.statusCd;
|
|
// 这里可以加上刷新查询逻辑
|
|
this._queryAccountMethod();
|
|
},
|
|
_createVoucher: function () {
|
|
let ids = $that.selectIds;
|
|
if (ids.length === 0) {
|
|
vc.toast('请先选中至少一条数据');
|
|
return;
|
|
}
|
|
ids = ids.toString();
|
|
let param = {
|
|
ids: ids,
|
|
type: 'ACCOUNT'
|
|
}
|
|
|
|
vc.http.apiPost(
|
|
'/reportFeeMonthStatistics/generateVoucher',
|
|
JSON.stringify(param),
|
|
{
|
|
emulateJSON: true
|
|
},
|
|
function (json, res) {
|
|
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
|
|
let _json = JSON.parse(json);
|
|
if (_json.code == 200) {
|
|
//关闭model
|
|
vc.toast('生成凭证成功');
|
|
let checkAllBox = document.getElementById('quan');
|
|
checkAllBox.checked = false;
|
|
$('#accountManageVoucherModal').modal('hide');
|
|
$that.selectIds = [];
|
|
// vc.emit('chainSupplierManage', 'listChainSupplier', {});
|
|
|
|
return;
|
|
}
|
|
vc.message(_json.msg);
|
|
|
|
},
|
|
function (errInfo, error) {
|
|
console.log('请求失败处理');
|
|
|
|
vc.message(errInfo);
|
|
|
|
});
|
|
|
|
},
|
|
_createAllVoucher: function () {
|
|
$that.accountManageInfo.conditions.communityId = vc.getCurrentCommunity().communityId;
|
|
let param = $that.accountManageInfo.conditions;
|
|
param.ownerName = param.ownerName.trim();
|
|
param.idCard = param.idCard.trim();
|
|
param.link = param.link.trim();
|
|
param.acctType = param.acctType.trim();
|
|
param.type = 'ALLACCOUNT';
|
|
|
|
vc.http.apiPost(
|
|
'/reportFeeMonthStatistics/generateVoucher',
|
|
JSON.stringify(param),
|
|
{
|
|
emulateJSON: true
|
|
},
|
|
function (json, res) {
|
|
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
|
|
let _json = JSON.parse(json);
|
|
if (_json.code == 200) {
|
|
//关闭model
|
|
vc.toast('生成凭证成功');
|
|
let checkAllBox = document.getElementById('quan');
|
|
checkAllBox.checked = false;
|
|
$('#accountManageVoucherModal').modal('hide');
|
|
$that.selectIds = [];
|
|
// vc.emit('chainSupplierManage', 'listChainSupplier', {});
|
|
|
|
return;
|
|
}
|
|
vc.message(_json.msg);
|
|
|
|
},
|
|
function (errInfo, error) {
|
|
console.log('请求失败处理');
|
|
|
|
vc.message(errInfo);
|
|
|
|
});
|
|
|
|
},
|
|
checkAll: function (e) {
|
|
var checkObj = document.querySelectorAll('.checkItem'); // 获取所有checkbox项
|
|
if (e.target.checked) { // 判定全选checkbox的勾选状态
|
|
for (var i = 0; i < checkObj.length; i++) {
|
|
if (!checkObj[i].checked) { // 将未勾选的checkbox选项push到绑定数组中
|
|
$that.selectIds.push(checkObj[i].value);
|
|
}
|
|
}
|
|
} else { // 如果是去掉全选则清空checkbox选项绑定数组
|
|
$that.selectIds = [];
|
|
}
|
|
},
|
|
|
|
}
|
|
});
|
|
})(window.vc); |