|
@@ -315,7 +315,7 @@ $(document).ready(function() {
|
|
|
$('#htpay-table tbody').find('.pay-del').hide();
|
|
|
}
|
|
|
} else {
|
|
|
- $('#add_contract_pay_btn').show();
|
|
|
+ if (node.uid === user_id || permission_add_pay) $('#add_contract_pay_btn').show();
|
|
|
if (need && contractPays && contractPays.length > 0) {
|
|
|
for (const [i, cp] of contractPays.entries()) {
|
|
|
if (cp.uid === user_id) {
|
|
@@ -372,8 +372,9 @@ $(document).ready(function() {
|
|
|
})
|
|
|
console.log(pays);
|
|
|
newPays.forEach((pay, idx) => {
|
|
|
+ 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>${idx + 1}</td>
|
|
|
+ <td>${idx + 1}${ pay.fpcid ? '<a href="javascript:void(0);" class="float-right"><i class="fa fa-cny"></i></a>' : ''}</td>
|
|
|
<td>${moment(pay.pay_time).format('YYYY-MM-DD')}</td>
|
|
|
<td>${pay.pay_price}</td>
|
|
|
<td>${pay.debit_price}</td>
|
|
@@ -384,7 +385,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>
|
|
|
- <td><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></td>
|
|
|
+ <td>${operationHtml}</td>
|
|
|
</tr>`;
|
|
|
});
|
|
|
$('#htpay-table tbody').html(paysHtml);
|
|
@@ -410,7 +411,7 @@ $(document).ready(function() {
|
|
|
contractTreeSpreadObj.setContractPays(result.pays, node);
|
|
|
contractTreeSpreadObj.setContractFiles(result.files, node.id);
|
|
|
});
|
|
|
- if (node.uid === user_id) {
|
|
|
+ if ((node.uid === user_id || permission_edit_contract)) {
|
|
|
if (node.settle_code) {
|
|
|
$('a[href*="#cons-unlock"]').show();
|
|
|
$('a[href*="#cons-close"]').hide();
|
|
@@ -427,7 +428,11 @@ $(document).ready(function() {
|
|
|
$('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();
|
|
|
- $('#add_contract_pay_btn').hide();
|
|
|
+ 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();
|
|
@@ -1157,15 +1162,17 @@ $(document).ready(function() {
|
|
|
$('.bc-bar ul li a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
|
|
const node = SpreadJsObj.getSelectObject(contractSheet);
|
|
|
$('a[href*="#cons-upfile"]').hide();
|
|
|
+ $('#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 (node.uid === user_id) contractTreeSpreadObj.changeContractTab(node, true);
|
|
|
+ if ($('.bc-bar .nav li .active').attr('href') === '#htpay' && !node.settle_code && permission_add_pay) $('#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) {
|
|
|
+ if (node && node.c_code && (node.uid === user_id || permission_edit_contract)) {
|
|
|
$('#edit_contract_btn').hide();
|
|
|
$('#save_contract_btn').show();
|
|
|
$('#cancel_contract_btn').show();
|
|
@@ -1186,7 +1193,7 @@ $(document).ready(function() {
|
|
|
|
|
|
$('#save_contract_btn').on('click', function () {
|
|
|
const node = SpreadJsObj.getSelectObject(contractSheet);
|
|
|
- if (node && node.c_code && node.uid === user_id) {
|
|
|
+ if (node && node.c_code && (node.uid === user_id || permission_edit_contract)) {
|
|
|
const data = {
|
|
|
id: node.id,
|
|
|
};
|
|
@@ -1237,7 +1244,7 @@ $(document).ready(function() {
|
|
|
|
|
|
$('#cancel_contract_btn').on('click', function () {
|
|
|
const node = SpreadJsObj.getSelectObject(contractSheet);
|
|
|
- if (node && node.c_code && node.uid === user_id) {
|
|
|
+ if (node && node.c_code && (node.uid === user_id || permission_edit_contract)) {
|
|
|
$('#edit_contract_btn').show();
|
|
|
$('#save_contract_btn').hide();
|
|
|
$('#cancel_contract_btn').hide();
|
|
@@ -1531,6 +1538,12 @@ $(document).ready(function() {
|
|
|
if (ca && ca.permission_add) {
|
|
|
txt.push('添加合同');
|
|
|
}
|
|
|
+ if (ca && ca.permission_edit_contract) {
|
|
|
+ txt.push('编辑合同');
|
|
|
+ }
|
|
|
+ if (ca && ca.permission_add_pay) {
|
|
|
+ txt.push('添加支付');
|
|
|
+ }
|
|
|
if (ca && ca.permission_show_unit) {
|
|
|
txt.push('查看本单位合同');
|
|
|
}
|
|
@@ -1754,8 +1767,8 @@ $(document).ready(function() {
|
|
|
toastr.error('请选择一个合同节点');
|
|
|
return;
|
|
|
}
|
|
|
- if (node.uid !== user_id) {
|
|
|
- toastr.error('只能修改自己的合同' + contractConst.typeName[contract_type]);
|
|
|
+ if (!(node.uid === user_id || permission_add_pay)) {
|
|
|
+ toastr.error('没有权限添加合同' + contractConst.typeName[contract_type]);
|
|
|
return;
|
|
|
}
|
|
|
if (node.settle_code) {
|
|
@@ -1810,8 +1823,8 @@ $(document).ready(function() {
|
|
|
toastr.error('请选择一个合同节点');
|
|
|
return;
|
|
|
}
|
|
|
- if (node.uid !== user_id) {
|
|
|
- toastr.error('只能添加自己的合同' + contractConst.typeName[contract_type]);
|
|
|
+ if (!(node.uid === user_id || permission_add_pay)) {
|
|
|
+ toastr.error('没有权限添加合同' + contractConst.typeName[contract_type]);
|
|
|
return;
|
|
|
}
|
|
|
if (node.settle_code) {
|
|
@@ -1968,10 +1981,10 @@ $(document).ready(function() {
|
|
|
toastr.error('请选择一个合同节点');
|
|
|
return;
|
|
|
}
|
|
|
- if (node.uid !== user_id && !permission_att) {
|
|
|
- $('#cons-pay-file .upload-permission').hide();
|
|
|
- } else {
|
|
|
+ if (node.uid === user_id || pay.uid === user_id || permission_att) {
|
|
|
$('#cons-pay-file .upload-permission').show();
|
|
|
+ } else {
|
|
|
+ $('#cons-pay-file .upload-permission').hide();
|
|
|
}
|
|
|
$('#cons-pay-file').modal('show');
|
|
|
$('#cons-pay-file input[name="cpid"]').val(cpid);
|
|
@@ -2119,8 +2132,8 @@ $(document).ready(function() {
|
|
|
},
|
|
|
spreadSetting: {
|
|
|
cols: [
|
|
|
- {title: '项目节编号', field: 'code', hAlign: 0, width: 120, formatter: '@', readOnly: true, cellType: 'tree'},
|
|
|
- {title: '名称', field: 'name', hAlign: 0, width: 150, formatter: '@', readOnly: true},
|
|
|
+ {title: '项目节编号', field: 'code', hAlign: 0, width: 180, formatter: '@', readOnly: true, cellType: 'tree'},
|
|
|
+ {title: '名称', field: 'name', hAlign: 0, width: 200, formatter: '@', readOnly: true},
|
|
|
],
|
|
|
treeCol: 0,
|
|
|
emptyRows: 0,
|