|
|
@@ -176,9 +176,10 @@ $(document).ready(() => {
|
|
|
contract: '合同管理',
|
|
|
construction: '施工日志',
|
|
|
quality: '质量管理',
|
|
|
+ inspection: '质量巡检',
|
|
|
};
|
|
|
- const tabTypeKeys = ['tourist', 'schedule', 'contract', 'construction', 'quality'];
|
|
|
-
|
|
|
+ const tabTypeKeys = ['tourist', 'schedule', 'contract', 'construction', 'quality', 'inspection'];
|
|
|
+
|
|
|
const $filterTenderDone = $('body #filter-tender-done')
|
|
|
if (window.location.search && window.location.search.split('done=')[1]) {
|
|
|
$filterTenderDone.prop('checked', window.location.search.split('done=')[1] === '1' ? true : false);
|
|
|
@@ -214,7 +215,8 @@ $(document).ready(() => {
|
|
|
setScheduleHtml(result.scheduleAuditList);
|
|
|
setContractHtml(result.contractAuditList);
|
|
|
setConstructionHtml(result.constructionAuditList);
|
|
|
- setQualityHtml(result.qualityAuditList);
|
|
|
+ setTenderPermissionHtml(result.qualityAuditList, 'quality');
|
|
|
+ setTenderPermissionHtml(result.inspectionAuditList, 'inspection');
|
|
|
resetAddUserHtml();
|
|
|
});
|
|
|
});
|
|
|
@@ -241,6 +243,8 @@ $(document).ready(() => {
|
|
|
$('#add_user_dropdownMenuButton').attr('data-type', 'construction');
|
|
|
} else if ($(this).attr('href') === '#zlgl') {
|
|
|
$('#add_user_dropdownMenuButton').attr('data-type', 'quality');
|
|
|
+ } else if ($(this).attr('href') === '#zlxj') {
|
|
|
+ $('#add_user_dropdownMenuButton').attr('data-type', 'inspection');
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
@@ -338,6 +342,30 @@ $(document).ready(() => {
|
|
|
type: 'save-permission',
|
|
|
uid,
|
|
|
members: [member],
|
|
|
+ key: 'quality',
|
|
|
+ };
|
|
|
+ const _self = $(this);
|
|
|
+ postData('/sp/' + spid + '/quality/' + cur_tenderid + '/audit/save', prop, function (data) {
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ // 权限更改
|
|
|
+ $('body').on('click', '#inspection-users input[type="checkbox"]', function () {
|
|
|
+ const uid = parseInt($(this).parents('tr').data('uid'));
|
|
|
+ const member = {
|
|
|
+ uid,
|
|
|
+ inspection: [1],
|
|
|
+ };
|
|
|
+ $(this).parents('tr').find('input[type="checkbox"]').each(function () {
|
|
|
+ if ($(this).is(':checked')) {
|
|
|
+ member.inspection.push($(this).data('value'));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ const prop = {
|
|
|
+ type: 'save-permission',
|
|
|
+ uid,
|
|
|
+ members: [member],
|
|
|
+ key: 'inspection',
|
|
|
};
|
|
|
const _self = $(this);
|
|
|
postData('/sp/' + spid + '/quality/' + cur_tenderid + '/audit/save', prop, function (data) {
|
|
|
@@ -369,8 +397,8 @@ $(document).ready(() => {
|
|
|
$('#'+ type + '-users').find('tr[data-id="'+ id +'"]').remove();
|
|
|
$('#remove-user').modal('hide');
|
|
|
});
|
|
|
- } else if (type === 'quality') {
|
|
|
- postData('/sp/' + spid + '/' + type + '/' + cur_tenderid + '/audit/save', { type: 'del-audit', id }, function (data) {
|
|
|
+ } else if (type === 'quality' || type === 'inspection') {
|
|
|
+ postData('/sp/' + spid + '/quality/' + cur_tenderid + '/audit/save', { type: 'del-audit', id, key: type }, function (data) {
|
|
|
$('#'+ type + '-users').find('tr[data-uid="'+ id +'"]').remove();
|
|
|
$('#remove-user').modal('hide');
|
|
|
});
|
|
|
@@ -578,13 +606,13 @@ $(document).ready(() => {
|
|
|
postData('/sp/' + spid + '/construction/' + cur_tenderid + '/audit/save', prop, function (datas) {
|
|
|
setConstructionHtml(datas);
|
|
|
});
|
|
|
- } else if (type === 'quality') {
|
|
|
+ } else if (type === 'quality' || type === 'inspection') {
|
|
|
const user = _.find(accountList, function (item) {
|
|
|
return item.id === id;
|
|
|
});
|
|
|
const saIdList = [];
|
|
|
- for (let i = 0; i < $('#quality-users tr').length; i++) {
|
|
|
- saIdList.push(parseInt($('#quality-users tr').eq(i).data('uid')));
|
|
|
+ for (let i = 0; i < $('#' + type + '-users tr').length; i++) {
|
|
|
+ saIdList.push(parseInt($('#' + type + '-users tr').eq(i).data('uid')));
|
|
|
}
|
|
|
if (_.includes(saIdList, id)) {
|
|
|
toastr.error('该用户已存在列表中,无需重复添加');
|
|
|
@@ -594,9 +622,10 @@ $(document).ready(() => {
|
|
|
const prop = {
|
|
|
id: id,
|
|
|
type: 'add-audit',
|
|
|
+ key: type,
|
|
|
};
|
|
|
postData('/sp/' + spid + '/quality/' + cur_tenderid + '/audit/save', prop, function (datas) {
|
|
|
- setQualityHtml(datas);
|
|
|
+ setTenderPermissionHtml(datas, type);
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
@@ -750,7 +779,9 @@ $(document).ready(() => {
|
|
|
userData.member = [1];
|
|
|
if ($('#quality-users tr').eq(i).find('input[data-block="upload"]').eq(0).is(':checked')) userData.member.push(2);
|
|
|
if ($('#quality-users tr').eq(i).find('input[data-block="add"]').eq(0).is(':checked')) userData.member.push(3);
|
|
|
- if ($('#quality-users tr').eq(i).find('input[data-block="add_inspection"]').eq(0).is(':checked')) userData.member.push(4);
|
|
|
+ } else if (userType === 'inspection') {
|
|
|
+ userData.member = [1];
|
|
|
+ if ($('#inspection-users tr').eq(i).find('input[data-block="add"]').eq(0).is(':checked')) userData.member.push(2);
|
|
|
}
|
|
|
saIdList.push(userData);
|
|
|
}
|
|
|
@@ -1088,26 +1119,25 @@ function setConstructionHtml(constructionAuditList) {
|
|
|
$('#construction-users').html(html);
|
|
|
}
|
|
|
|
|
|
-function setQualityHtml(qualityAuditList) {
|
|
|
+function setTenderPermissionHtml(auditList, key) {
|
|
|
const html = [];
|
|
|
- for (const m of qualityAuditList) {
|
|
|
- html.push(getUserPermissionHtml(m));
|
|
|
+ for (const m of auditList) {
|
|
|
+ html.push(getUserPermissionHtml(m, key));
|
|
|
}
|
|
|
- $('#quality-users').html(html.join(''));
|
|
|
+ $('#' + key + '-users').html(html.join(''));
|
|
|
}
|
|
|
|
|
|
-const getUserPermissionHtml = function(user) {
|
|
|
+const getUserPermissionHtml = function(user, key) {
|
|
|
const html = [];
|
|
|
html.push(`<tr data-uid="${user.uid}" data-id="${user.id}">`);
|
|
|
html.push(`<td>${user.name}</td>`, `<td>${user.role}</td>`);
|
|
|
- for (const block of permissionBlock) {
|
|
|
- for (const p of block.permission) {
|
|
|
- if (p.isDefault) continue;
|
|
|
- const checked = user[block.key] ? (user[block.key].indexOf(p.value) >= 0 ? 'checked' : '') : '';
|
|
|
- html.push(`<td class="text-center"><input type="checkbox" data-block="${p.key}" data-value="${p.value}" ${checked}></td>`);
|
|
|
- }
|
|
|
+ const block = _.find(permissionBlock, { key: key });
|
|
|
+ for (const p of block.permission) {
|
|
|
+ if (p.isDefault) continue;
|
|
|
+ const checked = user[block.key] ? (user[block.key].indexOf(p.value) >= 0 ? 'checked' : '') : '';
|
|
|
+ html.push(`<td class="text-center"><input type="checkbox" data-block="${p.key}" data-value="${p.value}" ${checked}></td>`);
|
|
|
}
|
|
|
- html.push(`<td class="text-center"><a href="#remove-user1" data-id="${user.uid}" data-toggle="modal" data-target="#remove-user" class="btn btn-sm btn-outline-danger remove-quality-user">移除</a></td>`);
|
|
|
+ html.push(`<td class="text-center"><a href="#remove-user1" data-id="${user.uid}" data-toggle="modal" data-target="#remove-user" class="btn btn-sm btn-outline-danger remove-${key}-user">移除</a></td>`);
|
|
|
html.push('</tr>');
|
|
|
return html.join('');
|
|
|
};
|