|
|
@@ -72,6 +72,17 @@ $(document).ready(function() {
|
|
|
const getStackedBarTipSf = function (data) {
|
|
|
return data.stackedBarSfTips ? data.stackedBarSfTips.join('\n') : '';
|
|
|
};
|
|
|
+ if (shenpi_status) {
|
|
|
+ contractSpreadSetting.cols.push(
|
|
|
+ {title: '审批进度', colSpan: '1', rowSpan: '2', field: 'shenpi_status', hAlign: 1, width: 100, formatter: '@', readOnly: true, getValue:'getValue.shenpi_status', foreColor:'foreColor.shenpi_status'},
|
|
|
+ );
|
|
|
+ contractCol.getValue.shenpi_status = function (data) {
|
|
|
+ return data.c_code && data.status && (!data.settle_code || (data.settle_code && data.status === auditConst.status.checked)) ? auditConst.auditProgress[data.status] : '';
|
|
|
+ };
|
|
|
+ contractCol.foreColor.shenpi_status = function (data) {
|
|
|
+ return data.c_code && data.status ? auditConst.auditClassColor[data.status] : '';
|
|
|
+ };
|
|
|
+ }
|
|
|
const colMap = {
|
|
|
yf_price: {title: '累计应付', colSpan: '1', rowSpan: '2', field: 'yf_price', hAlign: 2, width: 120, formatter: '@', readOnly: true},
|
|
|
stackedBar: {title: '应付进度', colSpan: '1', rowSpan: '2', formatter: '@', readOnly: true, field: 'stackedBar', hAlign: 0, width: 200, cellType: 'stackedBar', stackedBarCover: true, bc_type: 'grid', getTip: getStackedBarTip, hintNum: true},
|
|
|
@@ -310,7 +321,7 @@ $(document).ready(function() {
|
|
|
},
|
|
|
changeContractTab: function (node, need = false) {
|
|
|
if ($('.bc-bar .nav li .active').attr('href') === '#htdetail') {
|
|
|
- if (node.settle_code) {
|
|
|
+ if (node.settle_code || (shenpi_status && node.status !== auditConst.status.uncheck && node.status !== auditConst.status.checkNo)) {
|
|
|
$('#edit_contract_btn').hide();
|
|
|
} else {
|
|
|
$('#edit_contract_btn').show();
|
|
|
@@ -336,6 +347,7 @@ $(document).ready(function() {
|
|
|
$('#edit_contract_btn').hide();
|
|
|
$('#save_contract_btn').hide();
|
|
|
$('#cancel_contract_btn').hide();
|
|
|
+ $('#add_contract_pay_btn').hide();
|
|
|
if (node.settle_code) {
|
|
|
$('#add_contract_pay_btn').hide();
|
|
|
if (need) {
|
|
|
@@ -343,10 +355,10 @@ $(document).ready(function() {
|
|
|
$('#htpay-table tbody').find('.pay-del').hide();
|
|
|
}
|
|
|
} else {
|
|
|
- if (node.uid === user_id || permission_add_pay) $('#add_contract_pay_btn').show();
|
|
|
+ if ((node.uid === user_id || permission_add_pay) && (!shenpi_status || (shenpi_status && node.status === auditConst.status.checked))) $('#add_contract_pay_btn').show();
|
|
|
if (need && contractPays && contractPays.length > 0) {
|
|
|
for (const [i, cp] of contractPays.entries()) {
|
|
|
- if (cp.uid === user_id) {
|
|
|
+ if (cp.uid === user_id && (!pay_shenpi_status || (pay_shenpi_status && (cp.status === auditConst.status.uncheck || cp.status === auditConst.status.checkNo)))) {
|
|
|
$('#htpay-table tbody tr').eq(i).find('.pay-edit').show();
|
|
|
$('#htpay-table tbody tr').eq(i).find('.pay-del').show();
|
|
|
}
|
|
|
@@ -365,6 +377,102 @@ $(document).ready(function() {
|
|
|
openContractPayFiles: function (pay) {
|
|
|
this.setContractFiles(pay.files, pay.cid, pay.id, '#cons-pay-file table tbody');
|
|
|
},
|
|
|
+ checkCloseStatus: function (node) {
|
|
|
+ if (pay_shenpi_status) {
|
|
|
+ let have_uncheck = false;
|
|
|
+ for (const pay of contractPays) {
|
|
|
+ if (pay.status !== auditConst.status.checked) {
|
|
|
+ have_uncheck = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (have_uncheck) {
|
|
|
+ $('a[href*="#cons-close"]').hide();
|
|
|
+ } else if ((node.uid === user_id || permission_edit_contract) && !node.settle_code) {
|
|
|
+ $('a[href*="#cons-close"]').show();
|
|
|
+ }
|
|
|
+ } else if ((node.uid === user_id || permission_edit_contract) && !node.settle_code) {
|
|
|
+ $('a[href*="#cons-close"]').show();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ setContractBtn: function (node) {
|
|
|
+ if (shenpi_status) {
|
|
|
+ let shenpi_html = '';
|
|
|
+ $('a[href*="#cons-unlock"]').hide();
|
|
|
+ $('a[href*="#cons-close"]').hide();
|
|
|
+ if ((node.uid === user_id || permission_edit_contract) && node.settle_code && node.status !== auditConst.status.checked) {
|
|
|
+ $('a[href*="#cons-unlock"]').show();
|
|
|
+ } else if (!(node.settle_code && node.status !== auditConst.status.checked)) {
|
|
|
+ if (node.status === auditConst.status.uncheck) {
|
|
|
+ if (node.uid === user_id || is_admin || permission_edit_contract) {
|
|
|
+ shenpi_html += '<a href="javascript:void(0);" node-cid="' + node.id + '" node-cpid="" class="btn btn-primary btn-sm show-sub-sp">待上报</a>';
|
|
|
+ } else {
|
|
|
+ shenpi_html += '<button class="btn btn-outline-secondary btn-sm" data-toggle="tooltip" data-placement="bottom" title="上报中">上报中</button>';
|
|
|
+ }
|
|
|
+ } else if (node.status === auditConst.status.checkNo) {
|
|
|
+ if (node.uid === user_id || is_admin || permission_edit_contract) {
|
|
|
+ shenpi_html += '<a href="javascript:void(0);" node-cid="' + node.id + '" node-cpid="" class="btn btn-primary btn-sm show-sub-sp mr-2">重新上报</a>';
|
|
|
+ }
|
|
|
+ shenpi_html += '<a href="javascript: void(0);" node-cid="' + node.id + '" node-cpid="" data-title="审批退回" class="btn btn-outline-warning btn-sm show-sp-list">审批退回</a>';
|
|
|
+ } else if (node.status === auditConst.status.checked) {
|
|
|
+ shenpi_html += '<a href="javascript:void(0);" node-cid="' + node.id + '" node-cpid="" class="btn btn-outline-success btn-sm mr-1 show-sp-list">审批完成</a>';
|
|
|
+ if (node.settle_code) {
|
|
|
+ $('a[href*="#cons-unlock"]').show();
|
|
|
+ $('a[href*="#cons-close"]').hide();
|
|
|
+ } else {
|
|
|
+ $('a[href*="#cons-unlock"]').hide();
|
|
|
+ contractTreeSpreadObj.checkCloseStatus(node);
|
|
|
+ }
|
|
|
+ } else if (node.status === auditConst.status.checking || node.status === auditConst.status.checkNoPre) {
|
|
|
+ if (node.curAuditorIds.length > 0 && node.curAuditorIds.indexOf(user_id) > -1) {
|
|
|
+ shenpi_html += '<a href="javascript: void(0);" node-cid="' + node.id + '" node-cpid="" data-operate="checked" data-title="审批通过" class="btn btn-success btn-sm mr-2 show-sp-list">审批通过</a>';
|
|
|
+ shenpi_html += '<a href="javascript: void(0);" node-cid="' + node.id + '" node-cpid="" data-operate="checkNo" data-title="审批退回" class="btn btn-warning btn-sm show-sp-list">审批退回</a>';
|
|
|
+ } else if (node.status === auditConst.status.checking) {
|
|
|
+ shenpi_html += '<a href="javascript:void(0);" node-cid="' + node.id + '" node-cpid="" class="btn btn-outline-secondary btn-sm btn-block show-sp-list">审批中</a>';
|
|
|
+ } else if (node.status === auditConst.status.checkNoPre) {
|
|
|
+ shenpi_html += '<a href="javascript:void(0);" node-cid="' + node.id + '" node-cpid="" class="btn btn-outline-warning btn-sm btn-block show-sp-list">审批退回</a>';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $('#shenpi_btn').html(shenpi_html);
|
|
|
+ if (node.uid === user_id || permission_edit_contract) {
|
|
|
+ contractTreeSpreadObj.changeContractTab(node);
|
|
|
+ } else {
|
|
|
+ $('#edit_contract_btn').hide();
|
|
|
+ $('#save_contract_btn').hide();
|
|
|
+ $('#cancel_contract_btn').hide();
|
|
|
+ $('a[href*="#cons-upfile"]').hide();
|
|
|
+ if (node && node.c_code && $('.bc-bar .nav li .active').attr('href') === '#htfile' && permission_att) $('a[href*="#cons-upfile"]').show();
|
|
|
+ if (node && node.c_code && $('.bc-bar .nav li .active').attr('href') === '#htpay' && (node.uid === user_id || permission_add_pay) && node.status === auditConst.status.checked) {
|
|
|
+ $('#add_contract_pay_btn').show();
|
|
|
+ } else {
|
|
|
+ $('#add_contract_pay_btn').hide();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if ((node.uid === user_id || permission_edit_contract)) {
|
|
|
+ if (node.settle_code) {
|
|
|
+ $('a[href*="#cons-unlock"]').show();
|
|
|
+ $('a[href*="#cons-close"]').hide();
|
|
|
+ } else {
|
|
|
+ $('a[href*="#cons-unlock"]').hide();
|
|
|
+ contractTreeSpreadObj.checkCloseStatus(node);
|
|
|
+ }
|
|
|
+ contractTreeSpreadObj.changeContractTab(node);
|
|
|
+ } else {
|
|
|
+ $('#edit_contract_btn').hide();
|
|
|
+ $('#save_contract_btn').hide();
|
|
|
+ $('#cancel_contract_btn').hide();
|
|
|
+ $('a[href*="#cons-unlock"]').hide();
|
|
|
+ $('a[href*="#cons-close"]').hide();
|
|
|
+ $('a[href*="#cons-upfile"]').hide();
|
|
|
+ if (node && node.c_code && $('.bc-bar .nav li .active').attr('href') === '#htfile' && permission_att) $('a[href*="#cons-upfile"]').show();
|
|
|
+ if (node && node.c_code && $('.bc-bar .nav li .active').attr('href') === '#htpay' && (node.uid === user_id || permission_add_pay)) {
|
|
|
+ $('#add_contract_pay_btn').show();
|
|
|
+ } else {
|
|
|
+ $('#add_contract_pay_btn').hide();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
setContractFiles: function (files, cid, cpid = null, _this = '#htfile-table tbody') {
|
|
|
let filesHtml = '';
|
|
|
const newFiles = files.map(file => {
|
|
|
@@ -393,13 +501,14 @@ $(document).ready(function() {
|
|
|
let paysHtml = '';
|
|
|
const newPays = pays.map(pay => {
|
|
|
let showEdit = false;
|
|
|
- if (pay.uid === user_id && !node.settle_code) {
|
|
|
+ if (pay.uid === user_id && !node.settle_code && (!pay_shenpi_status || (pay_shenpi_status && (pay.status === auditConst.status.uncheck || pay.status === auditConst.status.checkNo)))) {
|
|
|
showEdit = true
|
|
|
}
|
|
|
return {...pay, showEdit}
|
|
|
})
|
|
|
console.log(pays);
|
|
|
newPays.forEach((pay, idx) => {
|
|
|
+ const shenpi_html = setPayShenpiHtml(pay);
|
|
|
const operationHtml = !pay.fpcid ? `<a href="javascript:void(0);" class="text-primary pay-edit" data-id="${pay.id}" ${!pay.showEdit ? `style="display:none"` : ''}>编辑</a> <a href="javascript:void(0);" class="text-danger pay-del" data-id="${pay.id}" ${!pay.showEdit ? `style="display:none"` : ''}>删除</a>` : '';
|
|
|
paysHtml += `<tr class="text-center" data-cpid="${pay.id}">
|
|
|
<td style="position: relative">${idx + 1}${ pay.fpcid ? '<a href="javascript:void(0);" style="position: absolute;right: 2px;top:50%;transform: translate(-50%, -50%);"><i class="fa fa-cny"></i></a>' : ''}</td>
|
|
|
@@ -413,6 +522,7 @@ $(document).ready(function() {
|
|
|
<td>${moment(pay.create_time).format('YYYY-MM-DD HH:mm:ss')}</td>
|
|
|
<td>${pay.remark}</td>
|
|
|
<td><a href="javascript:void(0);" class="text-primary open-pay-files" data-cpid="${pay.id}"><i class="fa fa-paperclip fa-rotate-90"></i></a> <span class="files-num">${pay.files.length > 0 ? pay.files.length : ''}</span></td>
|
|
|
+ ${shenpi_html}
|
|
|
<td>${operationHtml}</td>
|
|
|
</tr>`;
|
|
|
});
|
|
|
@@ -437,32 +547,12 @@ $(document).ready(function() {
|
|
|
}
|
|
|
$('#htdetail_df_price').text(ZhCalc.sub(node.yf_price, node.sf_price) || '');
|
|
|
postData(window.location.pathname + '/update', {postType: 'get-contract', postData: node.id}, function (result) {
|
|
|
+ const refreshNode = contractTree.loadPostData({ update: result.contract });
|
|
|
+ contractTreeSpreadObj.refreshTree(contractSheet, refreshNode);
|
|
|
contractTreeSpreadObj.setContractPays(result.pays, node);
|
|
|
contractTreeSpreadObj.setContractFiles(result.files, node.id);
|
|
|
+ contractTreeSpreadObj.setContractBtn(result.contract);
|
|
|
});
|
|
|
- if ((node.uid === user_id || permission_edit_contract)) {
|
|
|
- if (node.settle_code) {
|
|
|
- $('a[href*="#cons-unlock"]').show();
|
|
|
- $('a[href*="#cons-close"]').hide();
|
|
|
- } else {
|
|
|
- $('a[href*="#cons-unlock"]').hide();
|
|
|
- $('a[href*="#cons-close"]').show();
|
|
|
- }
|
|
|
- contractTreeSpreadObj.changeContractTab(node);
|
|
|
- } else {
|
|
|
- $('#edit_contract_btn').hide();
|
|
|
- $('#save_contract_btn').hide();
|
|
|
- $('#cancel_contract_btn').hide();
|
|
|
- $('a[href*="#cons-unlock"]').hide();
|
|
|
- $('a[href*="#cons-close"]').hide();
|
|
|
- $('a[href*="#cons-upfile"]').hide();
|
|
|
- if (node && node.c_code && $('.bc-bar .nav li .active').attr('href') === '#htfile' && permission_att) $('a[href*="#cons-upfile"]').show();
|
|
|
- if (node && node.c_code && $('.bc-bar .nav li .active').attr('href') === '#htpay' && (node.uid === user_id || permission_add_pay)) {
|
|
|
- $('#add_contract_pay_btn').show();
|
|
|
- } else {
|
|
|
- $('#add_contract_pay_btn').hide();
|
|
|
- }
|
|
|
- }
|
|
|
} else {
|
|
|
$('#htdetail-table').hide();
|
|
|
$('#htpay-table').hide();
|
|
|
@@ -475,6 +565,7 @@ $(document).ready(function() {
|
|
|
$('a[href*="#cons-upfile"]').hide();
|
|
|
if (node && node.c_code && $('.bc-bar .nav li .active').attr('href') === '#htfile' && permission_att) $('a[href*="#cons-upfile"]').show();
|
|
|
$('#add_contract_pay_btn').hide();
|
|
|
+ $('#shenpi_btn').html('');
|
|
|
}
|
|
|
},
|
|
|
selectionChanged: function (e, info) {
|
|
|
@@ -892,7 +983,17 @@ $(document).ready(function() {
|
|
|
const contractContextMenuOptions = {
|
|
|
selector: '#contract-spread',
|
|
|
build: function ($trigger, e) {
|
|
|
+ const oldSelections = SpreadJsObj.getSelectObject(contractSheet);
|
|
|
+ const selections = contractSheet.getSelections();
|
|
|
+ const oldRow = selections && selections.length > 0 ? selections[0].row : null;
|
|
|
const target = SpreadJsObj.safeRightClickSelection($trigger, e, contractSpread);
|
|
|
+ const newSelections = SpreadJsObj.getSelectObject(contractSheet);
|
|
|
+ const newRow = contractSheet.getSelections() && contractSheet.getSelections().length > 0 ? contractSheet.getSelections()[0].row : null;
|
|
|
+ if (oldRow !== newRow) {
|
|
|
+ contractTreeSpreadObj.refreshOperationValid(contractSheet);
|
|
|
+ contractTreeSpreadObj.setContract(contractSheet);
|
|
|
+ SpreadJsObj.saveTopAndSelect(contractSheet, ckBillsSpread);
|
|
|
+ }
|
|
|
return target.hitTestType === spreadNS.SheetArea.viewport || target.hitTestType === spreadNS.SheetArea.rowHeader;
|
|
|
},
|
|
|
items: {}
|
|
|
@@ -1500,14 +1601,15 @@ $(document).ready(function() {
|
|
|
$('#add_contract_pay_btn').hide();
|
|
|
if (node && node.c_code) {
|
|
|
if ($('.bc-bar .nav li .active').attr('href') === '#htfile' && permission_att) $('a[href*="#cons-upfile"]').show();
|
|
|
- if ($('.bc-bar .nav li .active').attr('href') === '#htpay' && !node.settle_code && permission_add_pay) $('#add_contract_pay_btn').show();
|
|
|
+ if ($('.bc-bar .nav li .active').attr('href') === '#htpay' && !node.settle_code && permission_add_pay && (!shenpi_status || (shenpi_status && node.status === auditConst.status.checked))) $('#add_contract_pay_btn').show();
|
|
|
if ((node.uid === user_id || permission_edit_contract)) contractTreeSpreadObj.changeContractTab(node, true);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
$('#edit_contract_btn').on('click', function () {
|
|
|
const node = SpreadJsObj.getSelectObject(contractSheet);
|
|
|
- if (node && node.c_code && (node.uid === user_id || permission_edit_contract)) {
|
|
|
+ console.log(node);
|
|
|
+ if (node && node.c_code && (node.uid === user_id || permission_edit_contract) && (!shenpi_status || (shenpi_status && node.status === auditConst.status.uncheck || node.status === auditConst.status.checkNo))) {
|
|
|
$('#edit_contract_btn').hide();
|
|
|
$('#save_contract_btn').show();
|
|
|
$('#cancel_contract_btn').show();
|
|
|
@@ -1650,6 +1752,7 @@ $(document).ready(function() {
|
|
|
const refreshNode = contractTree.loadPostData(result.node);
|
|
|
contractTreeSpreadObj.refreshTree(contractSheet, refreshNode);
|
|
|
contractTreeSpreadObj.setContractPays(result.pays, node);
|
|
|
+ contractTreeSpreadObj.checkCloseStatus(node);
|
|
|
})
|
|
|
}, '确认删除该合同' + contractConst.typeName[contract_type] + '?');
|
|
|
});
|
|
|
@@ -2161,6 +2264,10 @@ $(document).ready(function() {
|
|
|
toastr.error('没有权限添加合同' + contractConst.typeName[contract_type]);
|
|
|
return;
|
|
|
}
|
|
|
+ if (!(!shenpi_status || (shenpi_status && node.status === auditConst.status.checked))) {
|
|
|
+ toastr.error('该合同审批状态未通过,不能添加');
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (node.settle_code) {
|
|
|
toastr.error('该合同已结算,不能添加');
|
|
|
return;
|
|
|
@@ -2183,6 +2290,7 @@ $(document).ready(function() {
|
|
|
const refreshNode = contractTree.loadPostData(result.node);
|
|
|
contractTreeSpreadObj.refreshTree(contractSheet, refreshNode);
|
|
|
contractTreeSpreadObj.setContractPays(result.pays, node);
|
|
|
+ contractTreeSpreadObj.checkCloseStatus(node);
|
|
|
// const selection = contractSheet.getSelections();
|
|
|
// const sel = selection ? selection[0] : contractSheet.getSelections()[0];
|
|
|
// const row = sel ? sel.row : -1;
|
|
|
@@ -2389,17 +2497,491 @@ $(document).ready(function() {
|
|
|
const refreshNode = contractTree.loadPostData(result);
|
|
|
contractTreeSpreadObj.refreshTree(contractSheet, refreshNode);
|
|
|
const newNode = SpreadJsObj.getSelectObject(contractSheet);
|
|
|
- contractTreeSpreadObj.changeContractTab(newNode, true);
|
|
|
+ console.log(newNode);
|
|
|
+ contractTreeSpreadObj.setContractBtn(newNode);
|
|
|
+ // contractTreeSpreadObj.changeContractTab(newNode, true);
|
|
|
// const selection = contractSheet.getSelections();
|
|
|
// const sel = selection ? selection[0] : contractSheet.getSelections()[0];
|
|
|
// const row = sel ? sel.row : -1;
|
|
|
// contractTreeSpreadObj.setForeColor(contractSheet, row);
|
|
|
$('#cons-unlock').modal('hide');
|
|
|
- $('a[href*="#cons-unlock"]').hide();
|
|
|
- $('a[href*="#cons-close"]').show();
|
|
|
+ // $('a[href*="#cons-unlock"]').hide();
|
|
|
+ // if (shenpi_status && node.status !== auditConst.status.checked) {
|
|
|
+ // $('a[href*="#cons-close"]').hide();
|
|
|
+ // } else {
|
|
|
+ // $('a[href*="#cons-close"]').show();
|
|
|
+ // }
|
|
|
});
|
|
|
});
|
|
|
|
|
|
+ if (shenpi_status || pay_shenpi_status) {
|
|
|
+ $('body').on('click', '.show-sub-sp', function () {
|
|
|
+ console.log($(this).attr('node-cid'));
|
|
|
+ let node = _.find(contractTree.nodes, { id: $(this).attr('node-cid') });
|
|
|
+ const cpid = $(this).attr('node-cpid');
|
|
|
+ if (cpid) {
|
|
|
+ node = _.find(contractPays, { id: parseInt(cpid) });
|
|
|
+ $('#contract-add-group').hide();
|
|
|
+ $('#pay-add-group').show();
|
|
|
+ $('#change-pay-sp-group').val(node.sp_group);
|
|
|
+ $('#start-sp-cid').val(node.cid);
|
|
|
+ $('#start-sp-cpid').val(node.id);
|
|
|
+ } else {
|
|
|
+ $('#contract-add-group').show();
|
|
|
+ $('#pay-add-group').hide();
|
|
|
+ $('#change-sp-group').val(node.sp_group);
|
|
|
+ $('#start-sp-cid').val(node.id);
|
|
|
+ $('#start-sp-cpid').val('');
|
|
|
+ }
|
|
|
+ if (!node) {
|
|
|
+ toastr.error('合同数据获取失败');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ console.log(node);
|
|
|
+ setStartAuditsHtml(node);
|
|
|
+ $('#sub-sp').modal('show');
|
|
|
+ });
|
|
|
+
|
|
|
+ $('body').on('click', '.show-sp-list', function () {
|
|
|
+ let node = _.find(contractTree.nodes, { id: $(this).attr('node-cid') });
|
|
|
+ const cpid = $(this).attr('node-cpid');
|
|
|
+ if (cpid) {
|
|
|
+ node = _.find(contractPays, { id: parseInt(cpid) });
|
|
|
+ $('#check-sp-cid').val(node.cid);
|
|
|
+ $('#check-sp-cpid').val(node.id);
|
|
|
+ } else {
|
|
|
+ $('#check-sp-cid').val(node.id);
|
|
|
+ $('#check-sp-cpid').val('');
|
|
|
+ }
|
|
|
+ if (!node) {
|
|
|
+ toastr.error('合同数据获取失败');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ console.log(node);
|
|
|
+ const title = $(this).attr('data-title') || '审批流程';
|
|
|
+ $('#sp-list').find('.modal-title').text(title);
|
|
|
+ let html = '';
|
|
|
+ const operate = $(this).attr('data-operate') || null;
|
|
|
+ if (operate) {
|
|
|
+ if (operate === 'checked') {
|
|
|
+ html += `<button type="button" class="btn btn-sm btn-success" id="check-sp-btn">确认通过</button>`;
|
|
|
+ } else if (operate === 'checkNo') {
|
|
|
+ html += `<button type="button" class="btn btn-sm btn-warning" id="check-sp-btn">确认退回</button>`;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $('#check-sp-btn-html').html(html);
|
|
|
+ $('#check-operate').val(operate || '');
|
|
|
+ setCheckAuditsHtml(node, operate);
|
|
|
+ $('#sp-list').modal('show');
|
|
|
+ });
|
|
|
+
|
|
|
+ $('#sp-list').on('shown.bs.modal', function () {
|
|
|
+ const scrollBox = $(this).find('div[class="col-8 modal-height-500"]');
|
|
|
+ const bdiv = (scrollBox.offset() && scrollBox.offset().top) || 0;
|
|
|
+ scrollBox.scrollTop(0);
|
|
|
+ const hdiv = divSearch($(this).find('textarea')) ? $(this).find('textarea') : null;
|
|
|
+ const hdheight = hdiv ? hdiv.parents('.timeline-item-content').offset().top : null;
|
|
|
+ if (hdiv && scrollBox.length && scrollBox[0].scrollHeight > 200 && hdheight - bdiv > 200) {
|
|
|
+ scrollBox.scrollTop(hdheight - bdiv);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ function divSearch(div) {
|
|
|
+ if (div.length > 0) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 展开历史审核记录
|
|
|
+ $('body').on('click', '.modal-body #fold-btn', function () {
|
|
|
+ const type = $(this).data('target')
|
|
|
+ const auditCard = $(this).parent().parent()
|
|
|
+ if (type === 'show') {
|
|
|
+ $(this).data('target', 'hide')
|
|
|
+ auditCard.find('.fold-card').slideDown('swing', () => {
|
|
|
+ auditCard.find('#fold-btn').text('收起历史审核记录')
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ $(this).data('target', 'show')
|
|
|
+ auditCard.find('.fold-card').slideUp('swing', () => {
|
|
|
+ auditCard.find('#fold-btn').text('展开历史审核记录')
|
|
|
+ })
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ function getNode(from = 'start') {
|
|
|
+ const cid = $('#'+ from +'-sp-cid').val();
|
|
|
+ const cpid = $('#'+ from +'-sp-cpid').val();
|
|
|
+ let node = _.find(contractTree.nodes, { id: cid });
|
|
|
+ if (cpid) {
|
|
|
+ node = _.find(contractPays, { id: parseInt(cpid) });
|
|
|
+ }
|
|
|
+ if (!node) {
|
|
|
+ toastr.error('合同数据获取失败');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ return node;
|
|
|
+ }
|
|
|
+
|
|
|
+ function setStartAuditsHtml(node) {
|
|
|
+ let html = '';
|
|
|
+ for (let i = 0, iLen = node.auditorGroups.length; i < iLen; i++) {
|
|
|
+ html += `<li class="list-group-item d-flex" auditorId="${node.auditorGroups[i][0].aid}">
|
|
|
+ <div class="col-auto">${i+1}</div>
|
|
|
+ <div class="col">`;
|
|
|
+ for (const auditor of node.auditorGroups[i]) {
|
|
|
+ html += `<div class="d-inline-block mx-1" auditorId="${auditor.aid}">
|
|
|
+ <i class="fa fa-user text-muted"></i> ${auditor.name} <small class="text-muted">${auditor.role}</small>
|
|
|
+ </div>`;
|
|
|
+ }
|
|
|
+ const common_html = node.auditorGroups[i][0].audit_type !== auditType.key.common ? `<span class="badge badge-pill badge-${auditType.info[node.auditorGroups[i][0].audit_type].class} badge-bg-small"><small>${auditType.info[node.auditorGroups[i][0].audit_type].long}</small></span>` : '';
|
|
|
+ const del_html = shenpi.contract === shenpiConst.sp_status.sqspr ||
|
|
|
+ (shenpi.contract === shenpiConst.sp_status.gdzs && i+1 !== iLen) && (user_id === node.uid || is_admin || permission_edit_contract) ?
|
|
|
+ `<a href="javascript: void(0)" class="text-danger pull-right">移除</a>` : '';
|
|
|
+ html += `</div>
|
|
|
+ <div class="col-auto">
|
|
|
+ ${common_html}
|
|
|
+ ${del_html}
|
|
|
+ </div>
|
|
|
+ </li>`;
|
|
|
+ }
|
|
|
+ $('#auditors').html(html);
|
|
|
+ }
|
|
|
+
|
|
|
+ const getGroupAuditHtml = function (group) {
|
|
|
+ return group.map(u => { return `<small class="d-inline-block text-dark mx-1" title="${u.role}" data-auditorId="${u.aid}">${u.name}</small>`; }).join('');
|
|
|
+ };
|
|
|
+
|
|
|
+ const getAuditTypeHtml = function (type) {
|
|
|
+ if (type === auditType.key.common) return '';
|
|
|
+ return `<div class="li-subscript"><span class="badge badge-pill badge-${auditType.info[type].class} p-1 badge-bg-small"><small>${auditType.info[type].short}</small></span></div>`;
|
|
|
+ };
|
|
|
+
|
|
|
+ const getAuditTypeText = function (type) {
|
|
|
+ if (type === auditType.key.common) return '';
|
|
|
+ return `<span class="text-${auditType.info[type].class}">${auditType.info[type].long}</span>`;
|
|
|
+ };
|
|
|
+
|
|
|
+ function setCheckAuditsHtml(node, operate) {
|
|
|
+ // 获取审批流程
|
|
|
+ const { auditHistory, auditors2, user } = node;
|
|
|
+ let auditorsHTML = [];
|
|
|
+ auditors2.forEach((group, idx) => {
|
|
|
+ if (idx === 0) {
|
|
|
+ auditorsHTML.push(`<li class="list-group-item d-flex justify-content-between align-items-center">
|
|
|
+ <span class="mr-1"><i class="fa fa fa-play-circle fa-rotate-90"></i></span>
|
|
|
+ <span class="text-muted">${getGroupAuditHtml(group)}</span>
|
|
|
+ <span class="badge badge-light badge-pill ml-auto"><small>原报</small></span>
|
|
|
+ </li>`);
|
|
|
+ } else if(idx === auditors2.length -1 && idx !== 0) {
|
|
|
+ auditorsHTML.push(`<li class="list-group-item d-flex justify-content-between align-items-center">
|
|
|
+ <span class="mr-1"><i class="fa fa fa-stop-circle fa-rotate-90"></i></span>
|
|
|
+ <span class="text-muted">${getGroupAuditHtml(group)}</span>
|
|
|
+ <div class="d-flex ml-auto">
|
|
|
+ ${getAuditTypeHtml(group[0].audit_type)}
|
|
|
+ <span class="badge badge-light badge-pill ml-auto"><small>终审</small></span>
|
|
|
+ </div>
|
|
|
+ </li>`);
|
|
|
+ } else {
|
|
|
+ auditorsHTML.push(`<li class="list-group-item d-flex justify-content-between align-items-center">
|
|
|
+ <span class="mr-1"><i class="fa fa fa-chevron-circle-down"></i></span>
|
|
|
+ <span class="text-muted">${getGroupAuditHtml(group)}</span>
|
|
|
+ <div class="d-flex ml-auto">
|
|
|
+ ${getAuditTypeHtml(group[0].audit_type)}
|
|
|
+ <span class="badge badge-light badge-pill"><small>${transFormToChinese(idx)}审</small></span>
|
|
|
+ </div>
|
|
|
+ </li>`);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $('#auditor-list').empty();
|
|
|
+ $('#auditor-list').append(auditorsHTML.join(''));
|
|
|
+
|
|
|
+ let historyHTML = [];
|
|
|
+ auditHistory.forEach((his, idx) => {
|
|
|
+ if (idx === auditHistory.length - 1 && auditHistory.length !== 1) {
|
|
|
+ historyHTML.push(`<div class="text-right"><a href="javascript: void(0);" id="fold-btn" data-target="show">展开历史审批流程</a></div>`);
|
|
|
+ }
|
|
|
+ historyHTML.push(`<div class="${idx < auditHistory.length - 1 ? 'fold-card' : ''}">`);
|
|
|
+ historyHTML.push(`<div class="text-center text-muted">${idx+1}#</div>`);
|
|
|
+ historyHTML.push(`<ul class="timeline-list list-unstyled mt-2 ${ idx === auditHistory.length - 1 && auditHistory.length !== 1 ? 'last-auditor-list' : '' }">`);
|
|
|
+ his.forEach((group, index) => {
|
|
|
+ historyHTML.push(`<li class="timeline-list-item pb-2 ${ group.status === auditConst.status.uncheck && idx === auditHistory.length - 1 && auditHistory.length !== 1 ? 'is_uncheck' : ''}">`);
|
|
|
+ if (group.endYear) {
|
|
|
+ historyHTML.push(`<div class="timeline-item-date">${group.endYear}<span>${group.endDate}</span><span>${group.endTime}</span></div>`);
|
|
|
+ }
|
|
|
+ if (index < his.length - 1) {
|
|
|
+ historyHTML.push('<div class="timeline-item-tail"></div>');
|
|
|
+ }
|
|
|
+ if (group.status === auditConst.status.checked) {
|
|
|
+ historyHTML.push('<div class="timeline-item-icon bg-success text-light"><i class="fa fa-check"></i></div>');
|
|
|
+ } else if (group.status === auditConst.status.checkNo || group.status === auditConst.status.checkNoPre) {
|
|
|
+ historyHTML.push('<div class="timeline-item-icon bg-warning text-light"><i class="fa fa-level-up"></i></div>');
|
|
|
+ } else if (group.status === auditConst.status.checking) {
|
|
|
+ historyHTML.push('<div class="timeline-item-icon bg-warning text-light"><i class="fa fa-ellipsis-h"></i></div>');
|
|
|
+ // } else if(group.status === auditConst.status.checkAgain) {
|
|
|
+ // historyHTML.push('<div class="timeline-item-icon bg-warning text-light"><i class="fa fa-check"></i></div>');
|
|
|
+ } else {
|
|
|
+ historyHTML.push('<div class="timeline-item-icon bg-secondary text-light"></div>');
|
|
|
+ }
|
|
|
+
|
|
|
+ historyHTML.push('<div class="timeline-item-content">');
|
|
|
+ historyHTML.push('<div class="py-1">');
|
|
|
+ if (index === 0) {
|
|
|
+ historyHTML.push('<span class="text-black-50">原报</span>');
|
|
|
+ historyHTML.push(`<span class="pull-right text-success">${idx !== 0 ? '重新' : ''}上报审批</span>`);
|
|
|
+ } else {
|
|
|
+ const statuStr = group.status !== auditConst.status.uncheck ?
|
|
|
+ `<span class="pull-right ${auditConst.statusClass[group.status]}">${auditConst.statusString[group.status]}</span>` : '';
|
|
|
+ historyHTML.push(`
|
|
|
+ <span class="text-black-50">
|
|
|
+ ${ group.audit_order === 0 ? '原报' : !group.is_final ? group.audit_order + '审' : '终审' } ${getAuditTypeText(group.audit_type)}
|
|
|
+ </span>
|
|
|
+ ${statuStr}`);
|
|
|
+ }
|
|
|
+ historyHTML.push('</div>');
|
|
|
+ historyHTML.push('<div class="card"><div class="card-body px-3 py-0">');
|
|
|
+ for (const [i, auditor] of group.auditors.entries()) {
|
|
|
+ historyHTML.push(`<div class="card-text p-2 py-3 row ${ ( i > 0 ? 'border-top' : '') }">`);
|
|
|
+ let companyRolePart = '';
|
|
|
+ const rolePart = auditor.role ? ' - ' + auditor.role : '';
|
|
|
+ companyRolePart = `<span class="text-muted ml-1">${auditor.company}${rolePart}</span>`;
|
|
|
+ historyHTML.push(`<div class="col-10"><span class="h6">${auditor.name}</span>${companyRolePart}</div>`);
|
|
|
+ historyHTML.push('<div class="col">');
|
|
|
+ if (auditor.status === auditConst.status.checked) {
|
|
|
+ historyHTML.push('<span class="pull-right text-success"><i class="fa fa-check-circle"></i></span>');
|
|
|
+ } else if (auditor.status === auditConst.status.checkNo || auditor.status === auditConst.status.checkNoPre) {
|
|
|
+ historyHTML.push('<span class="pull-right text-warning"><i class="fa fa-share-square fa-rotate-270"></i></span>');
|
|
|
+ } else if (auditor.status === auditConst.status.checking) {
|
|
|
+ historyHTML.push('<span class="pull-right text-warning"><i class="fa fa-commenting"></i></span>');
|
|
|
+ // } else if (auditor.status === auditConst.status.checkAgain) {
|
|
|
+ // historyHTML.push('<span class="pull-right text-warning"><i class="fa fa-check"></i></span>');
|
|
|
+ }
|
|
|
+ historyHTML.push('</div>');
|
|
|
+ if (auditor.opinion) {
|
|
|
+ historyHTML.push(`<div class="col-12 py-1 bg-light"><i class="fa fa-commenting-o mr-1"></i>${auditor.opinion}</div>`);
|
|
|
+ }
|
|
|
+ if (auditor.status === auditConst.status.checking && auditor.aid === user_id && operate) {
|
|
|
+ historyHTML.push(`<div class="col-12 py-1 bg-light">`);
|
|
|
+ if (operate === 'checked') {
|
|
|
+ historyHTML.push(`<textarea class="form-control form-control-sm" name="opinion">同意</textarea>`);
|
|
|
+ } else if (operate === 'checkNo') {
|
|
|
+ historyHTML.push(`<textarea class="form-control form-control-sm" name="opinion">不同意</textarea>`);
|
|
|
+ historyHTML.push(`<div id="reject-process" class="alert alert-warning"
|
|
|
+ style="margin-top: 15px;">
|
|
|
+ <div class="form-check form-check-inline">
|
|
|
+ <input class="form-check-input" type="radio" name="checkType" id="inlineRadio1" value="${auditConst.status.checkNo}">
|
|
|
+ <label class="form-check-label" for="inlineRadio1">退回原报</label>
|
|
|
+ </div>`);
|
|
|
+ if (auditor.audit_order > 1) {
|
|
|
+ const pre = his.find(x => { return x.audit_order === auditor.audit_order - 1});
|
|
|
+ const pre_audit = pre.audit_type === auditType.key.common ? pre.auditors[0].name : `${pre.audit_order}审`;
|
|
|
+ historyHTML.push(`
|
|
|
+ <div class="form-check form-check-inline">
|
|
|
+ <input class="form-check-input" type="radio" name="checkType" id="inlineRadio2" value="${auditConst.status.checkNoPre}">
|
|
|
+ <label class="form-check-label" for="inlineRadio2">退回上一审批人 ${pre_audit}</label>
|
|
|
+ </div>`);
|
|
|
+ }
|
|
|
+ historyHTML.push(`</div>`);
|
|
|
+ }
|
|
|
+ historyHTML.push(`</div>`);
|
|
|
+ }
|
|
|
+ historyHTML.push('</div>');
|
|
|
+ }
|
|
|
+ historyHTML.push('</div></div>');
|
|
|
+ historyHTML.push('</div>');
|
|
|
+ historyHTML.push('</li>');
|
|
|
+ });
|
|
|
+ historyHTML.push('</div>');
|
|
|
+ historyHTML.push('</ul>');
|
|
|
+ });
|
|
|
+ $('#audit-list').empty();
|
|
|
+ $('#audit-list').append(historyHTML.join(''));
|
|
|
+ }
|
|
|
+
|
|
|
+ function setPayShenpiHtml(pay, reload = false) {
|
|
|
+ let shenpi_html = '';
|
|
|
+ if (pay_shenpi_status) {
|
|
|
+ shenpi_html += !reload ? `<td class="shenpi-td ${auditConst.auditProgressClass[pay.status]}">` : '';
|
|
|
+ if ((pay.status === auditConst.status.uncheck || pay.status === auditConst.status.checkNo) && pay.uid === user_id) {
|
|
|
+ shenpi_html += `<a href="javascript:void(0);" node-cid="${pay.cid}" node-cpid="${pay.id}" class="btn ${auditConst.statusButtonClass[pay.status]} btn-sm show-sub-sp">${auditConst.statusButton[pay.status]}</a>`;
|
|
|
+ } else if ((pay.status === auditConst.status.checking || pay.status === auditConst.status.checkNoPre) && pay.curAuditors && pay.curAuditors.findIndex(x => { return x.aid === user_id; }) >= 0) {
|
|
|
+ shenpi_html += `<a href="javascript: void(0);" node-cid="${pay.cid}" node-cpid="${pay.id}" data-operate="checked" data-title="审批通过" class="btn btn-success btn-sm mr-2 show-sp-list">审批通过</a>`;
|
|
|
+ shenpi_html += `<a href="javascript: void(0);" node-cid="${pay.cid}" node-cpid="${pay.id}" data-operate="checkNo" data-title="审批退回" class="btn btn-warning btn-sm show-sp-list">审批退回</a>`;
|
|
|
+ } else {
|
|
|
+ if (pay.status === auditConst.status.checked && pay.final_auditor_str) {
|
|
|
+ shenpi_html += `<a href="javascript:void(0);" node-cid="${pay.cid}" node-cpid="${pay.id}" class="show-sp-list">${pay.final_auditor_str}</a>`;
|
|
|
+ } else if (pay.status === auditConst.status.checkNo && pay.curAuditors2 && pay.curAuditors2.length > 0) {
|
|
|
+ if (pay.curAuditors2[0].audit_type === auditType.key.common) {
|
|
|
+ shenpi_html += `<a href="javascript:void(0);" node-cid="${pay.cid}" node-cpid="${pay.id}" class="show-sp-list">${pay.curAuditors2[0].name}${pay.curAuditors2[0].role !== '' && pay.curAuditors2[0].role !== null ? '-' + pay.curAuditors2[0].role : ''}</a>`;
|
|
|
+ } else {
|
|
|
+ shenpi_html += `<a href="javascript:void(0);" node-cid="${pay.cid}" node-cpid="${pay.id}" class="show-sp-list">${transFormToChinese(pay.curAuditors2[0].audit_order) + '审'}</a>`;
|
|
|
+ }
|
|
|
+ } else if (pay.curAuditors.length > 0) {
|
|
|
+ if (pay.curAuditors[0].audit_type === auditType.key.common) {
|
|
|
+ shenpi_html += `<a href="javascript:void(0);" node-cid="${pay.cid}" node-cpid="${pay.id}" class="show-sp-list">${pay.curAuditors[0].name}${pay.curAuditors[0].role !== '' && pay.curAuditors[0].role !== null ? '-' + pay.curAuditors[0].role : ''}</a>`;
|
|
|
+ } else {
|
|
|
+ shenpi_html += `<a href="javascript:void(0);" node-cid="${pay.cid}" node-cpid="${pay.id}" class="show-sp-list">${transFormToChinese(pay.curAuditors[0].audit_order) + '审'}</a>`;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ shenpi_html += ` ${auditConst.auditProgress[pay.status]}`;
|
|
|
+ }
|
|
|
+ shenpi_html += !reload ? '</td>' : '';
|
|
|
+ }
|
|
|
+ return shenpi_html;
|
|
|
+ }
|
|
|
+
|
|
|
+ let timer3 = null
|
|
|
+ let oldSearchVal3 = null
|
|
|
+
|
|
|
+ $('#gr-search3').bind('input propertychange', function(e) {
|
|
|
+ oldSearchVal3 = e.target.value
|
|
|
+ timer3 && clearTimeout(timer3)
|
|
|
+ timer3 = setTimeout(() => {
|
|
|
+ const newVal = $('#gr-search3').val()
|
|
|
+ let html = ''
|
|
|
+ if (newVal && newVal === oldSearchVal3) {
|
|
|
+ accountList3.filter(item => item && (item.name.indexOf(newVal) !== -1 || (item.mobile && item.mobile.indexOf(newVal) !== -1))).forEach(item => {
|
|
|
+ html += `<dd class="border-bottom p-2 mb-0 " data-id="${item.id}" >
|
|
|
+ <p class="mb-0 d-flex"><span class="text-primary">${item.name}</span><span
|
|
|
+ class="ml-auto">${item.mobile || ''}</span></p>
|
|
|
+ <span class="text-muted">${item.role || ''}</span>
|
|
|
+ </dd>`
|
|
|
+ })
|
|
|
+ $('.search-user-list').empty()
|
|
|
+ $('.search-user-list').append(html)
|
|
|
+ } else {
|
|
|
+ if (!$('.search-user-list .acc-btn').length) {
|
|
|
+ accountGroup3.forEach((group, idx) => {
|
|
|
+ if (!group) return
|
|
|
+ html += `<dt><a href="javascript: void(0);" class="acc-btn" data-groupid="${idx}" data-type="hide"><i class="fa fa-plus-square"></i>
|
|
|
+ </a> ${group.groupName}</dt>
|
|
|
+ <div class="dd-content" data-toggleid="${idx}">`
|
|
|
+ group.groupList.forEach(item => {
|
|
|
+ html += `<dd class="border-bottom p-2 mb-0 " data-id="${item.id}" >
|
|
|
+ <p class="mb-0 d-flex"><span class="text-primary">${item.name}</span><span
|
|
|
+ class="ml-auto">${item.mobile || ''}</span></p>
|
|
|
+ <span class="text-muted">${item.role || ''}</span>
|
|
|
+ </dd>`
|
|
|
+ });
|
|
|
+ html += '</div>'
|
|
|
+ })
|
|
|
+ $('.search-user-list').empty()
|
|
|
+ $('.search-user-list').append(html)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, 400);
|
|
|
+ });
|
|
|
+
|
|
|
+ // 添加到成员中
|
|
|
+ $('.search-user-list').on('click', 'dt', function () {
|
|
|
+ const idx = $(this).find('.acc-btn').attr('data-groupid')
|
|
|
+ const type = $(this).find('.acc-btn').attr('data-type')
|
|
|
+ if (type === 'hide') {
|
|
|
+ $(this).parent().find(`div[data-toggleid="${idx}"]`).show(() => {
|
|
|
+ $(this).children().find('i').removeClass('fa-plus-square').addClass('fa-minus-square-o')
|
|
|
+ $(this).find('.acc-btn').attr('data-type', 'show')
|
|
|
+
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ $(this).parent().find(`div[data-toggleid="${idx}"]`).hide(() => {
|
|
|
+ $(this).children().find('i').removeClass('fa-minus-square-o').addClass('fa-plus-square')
|
|
|
+ $(this).find('.acc-btn').attr('data-type', 'hide')
|
|
|
+ })
|
|
|
+ }
|
|
|
+ return false
|
|
|
+ });
|
|
|
+
|
|
|
+ // 添加到审批流程中
|
|
|
+ $('.search-user-list').on('click', 'dd', function () {
|
|
|
+ const node = getNode();
|
|
|
+ const id = parseInt($(this).data('id'));
|
|
|
+ if (id) {
|
|
|
+ postData(window.location.pathname + '/check', {postType: 'add-audit', id: node.id, auditorId: id}, function (result) {
|
|
|
+ setStartAuditChange(node, result);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 删除审批人
|
|
|
+ $('body').on('click', '#auditors li a', function () {
|
|
|
+ const node = getNode();
|
|
|
+ const li = $(this).parents('li');
|
|
|
+ const data = {
|
|
|
+ postType: 'del-audit', id: node.id,
|
|
|
+ auditorId: parseInt(li.attr('auditorId')),
|
|
|
+ };
|
|
|
+ postData(window.location.pathname + '/check', data, (result) => {
|
|
|
+ setStartAuditChange(node, result);
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ $('#change-sp-group').change(function () {
|
|
|
+ const node = getNode();
|
|
|
+ postData(window.location.pathname + '/check', {postType: 'change-sp', id: node.id, sp_group: $(this).val()}, function (result) {
|
|
|
+ setStartAuditChange(node, result);
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ function setStartAuditChange(node, result) {
|
|
|
+ if (node.cid) {
|
|
|
+ contractPays.splice(contractPays.findIndex(item => item.id === node.id), 1, result);
|
|
|
+ } else {
|
|
|
+ const refreshNode = contractTree.loadPostData({ update: result });
|
|
|
+ contractTreeSpreadObj.refreshTree(contractSheet, refreshNode);
|
|
|
+ }
|
|
|
+ setStartAuditsHtml(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ $('#start-sp-btn').click(function () {
|
|
|
+ const node = getNode();
|
|
|
+ postData(window.location.pathname + '/check', {postType: 'start', id: node.id}, function (result) {
|
|
|
+ setShenpiChange(node, result);
|
|
|
+ $('#sub-sp').modal('hide');
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ $('body').on('click', '#check-sp-btn', function () {
|
|
|
+ const node = getNode('check');
|
|
|
+ const operate = $('#check-operate').val();
|
|
|
+ console.log(node, operate);
|
|
|
+ const checkType = operate === 'checked' ? auditConst.status.checked : parseInt($('#audit-list').find('input[name="checkType"]:checked').val());
|
|
|
+ if ($('#warning-text').length) $('#warning-text').remove();
|
|
|
+ if (!checkType && !$('#warning-text').length) {
|
|
|
+ $('#reject-process').prepend('<p id="warning-text" style="color: red; margin: 0;">请选择退回流程</p>');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ const data = {
|
|
|
+ postType: 'check',
|
|
|
+ id: node.id,
|
|
|
+ checkType,
|
|
|
+ opinion: $('#audit-list').find('textarea').val().replace(/\r\n/g, '<br/>').replace(/\n/g, '<br/>').replace(/\s/g, ' '),
|
|
|
+ }
|
|
|
+ console.log(data);
|
|
|
+ postData(window.location.pathname + '/check', data, function (result) {
|
|
|
+ setShenpiChange(node, result);
|
|
|
+ $('#sp-list').modal('hide');
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ function setShenpiChange(node, result) {
|
|
|
+ if (node.cid) {
|
|
|
+ contractPays.splice(contractPays.findIndex(item => item.id === node.id), 1, result);
|
|
|
+ const shenpi_html = setPayShenpiHtml(result, true);
|
|
|
+ $("#htpay-table tbody").find(`tr[data-cpid="${node.id}"]`).children('.shenpi-td').html(shenpi_html);
|
|
|
+ $("#htpay-table tbody").find(`tr[data-cpid="${node.id}"]`).children('.shenpi-td').addClass(auditConst.auditProgressClass[result.status]);
|
|
|
+ $('#htpay-table tbody').find(`tr[data-cpid="${node.id}"]`).find('.pay-edit').hide();
|
|
|
+ $('#htpay-table tbody').find(`tr[data-cpid="${node.id}"]`).find('.pay-del').hide();
|
|
|
+ if (node.uid === user_id && (result.status === auditConst.status.uncheck || result.status === auditConst.status.checkNo)) {
|
|
|
+ $('#htpay-table tbody').find(`tr[data-cpid="${node.id}"]`).find('.pay-edit').show();
|
|
|
+ $('#htpay-table tbody').find(`tr[data-cpid="${node.id}"]`).find('.pay-del').show();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ const refreshNode = contractTree.loadPostData({update: result});
|
|
|
+ contractTreeSpreadObj.refreshTree(contractSheet, refreshNode);
|
|
|
+ contractTreeSpreadObj.setContractBtn(result);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
const stdLibCellDoubleClick = function (updateData, stdNode, stdTree) {
|
|
|
if (!permission_edit) return;
|
|
|
const mainSheet = contractSheet;
|