|
@@ -0,0 +1,728 @@
|
|
|
+
|
|
|
+// 游客及投资管理用户添加到其他标段
|
|
|
+const tenderTree4User = [];
|
|
|
+let parentId4User = 0;
|
|
|
+// 初始化TenderTree数据
|
|
|
+function initTenderTree4User () {
|
|
|
+ const levelCategory = category.filter(function (c) {
|
|
|
+ return c.level && c.level > 0;
|
|
|
+ });
|
|
|
+ function findCategoryNode4User(cid, value, array) {
|
|
|
+ for (const a of array) {
|
|
|
+ if (a.cid === cid && a.vid === value) {
|
|
|
+ return a;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ function getCategoryNode4User(category, value, parent, i = null) {
|
|
|
+ const array = parent ? parent.children : tenderTree4User;
|
|
|
+ let cate = findCategoryNode4User(category.id, value, array);
|
|
|
+ if (!cate) {
|
|
|
+ const cateValue = findNode2('id', value, category.value);
|
|
|
+ if (!cateValue) return null;
|
|
|
+ cate = {
|
|
|
+ cid: category.id,
|
|
|
+ vid: value,
|
|
|
+ name: cateValue.value,
|
|
|
+ children: [],
|
|
|
+ level: i ? i : category.level,
|
|
|
+ sort_id: ++parentId2,
|
|
|
+ sort: cateValue.sort,
|
|
|
+ };
|
|
|
+ array.push(cate);
|
|
|
+ }
|
|
|
+ return cate;
|
|
|
+ }
|
|
|
+ function loadTenderCategory4User (tender) {
|
|
|
+ let tenderCategory = null;
|
|
|
+ for (const [index,lc] of levelCategory.entries()) {
|
|
|
+ const tenderCate = findNode2('cid', lc.id, tender.category);
|
|
|
+ if (tenderCate) {
|
|
|
+ tenderCategory = getCategoryNode4User(lc, tenderCate.value, tenderCategory);
|
|
|
+ } else {
|
|
|
+ if (index === 0 && tender.category) {
|
|
|
+ for (const [i,c] of tender.category.entries()) {
|
|
|
+ const cate = findNode2('id', c.cid, category);
|
|
|
+ if (cate) tenderCategory = getCategoryNode4User(cate, c.value, tenderCategory, i+1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return tenderCategory;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return tenderCategory;
|
|
|
+ }
|
|
|
+ tenderTree4User.splice(0, tenderTree4User.length);
|
|
|
+ for (const t of tenders) {
|
|
|
+ t.valid = true;
|
|
|
+ delete t.level;
|
|
|
+ if (t.category && levelCategory.length > 0) {
|
|
|
+ const parent = loadTenderCategory4User(t);
|
|
|
+ if (parent) {
|
|
|
+ t.level = parent.level + 1;
|
|
|
+ parent.children.push(t);
|
|
|
+ } else {
|
|
|
+ tenderTree4User.push(t);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ tenderTree4User.push(t);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ sortTenderTree(tenderTree4User);
|
|
|
+}
|
|
|
+function recursiveGetTenderNodeHtml4User (node, arr, pid) {
|
|
|
+ const html = [];
|
|
|
+ html.push('<tr pid="' + pid + '">');
|
|
|
+ // 名称
|
|
|
+ html.push('<td class="in-' + node.level + '">');
|
|
|
+ if (node.cid) {
|
|
|
+ html.push('<i class="fa fa-folder-o"></i> ', node.name);
|
|
|
+ } else {
|
|
|
+ html.push('<span class="text-muted mr-2">');
|
|
|
+ html.push(arr.indexOf(node) === arr.length - 1 ? '└' : '├');
|
|
|
+ html.push('</span>');
|
|
|
+ //html.push('<a href="/tender/' + node.id + '">', node[c.field], '</a>');
|
|
|
+ html.push('<a href="javascript: void(0)" id="' + node.id + '">', node.name, '</a>');
|
|
|
+ }
|
|
|
+ html.push('</td>');
|
|
|
+ html.push('<td>');
|
|
|
+ if (!node.cid) {
|
|
|
+ html.push('<input data-tid="'+ node.id +'" type="checkbox"'+ (cur_tenderid === node.id ? ' checked disabled' : '') +'>');
|
|
|
+ }
|
|
|
+ html.push('</td>');
|
|
|
+ html.push('</tr>');
|
|
|
+ if (node.children) {
|
|
|
+ for (const c of node.children) {
|
|
|
+ html.push(recursiveGetTenderNodeHtml4User(c, node.children, node.sort_id));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return html.join('');
|
|
|
+}
|
|
|
+// 根据TenderTree数据获取Html代码
|
|
|
+function getTenderTreeHtml4User () {
|
|
|
+ if (tenderTree4User.length > 0) {
|
|
|
+ const html = [];
|
|
|
+ html.push('<table class="table table-hover table-bordered">');
|
|
|
+ html.push('<thead>', '<tr>');
|
|
|
+ html.push('<th>名称</th>');
|
|
|
+ html.push('<th width="40">选择</th>');
|
|
|
+ html.push('</tr>', '</thead>');
|
|
|
+ parentId4User = 0;
|
|
|
+ for (const t of tenderTree4User) {
|
|
|
+ html.push(recursiveGetTenderNodeHtml4User(t, tenderTree4User, ''));
|
|
|
+ }
|
|
|
+ html.push('</table>');
|
|
|
+ return html.join('');
|
|
|
+ } else {
|
|
|
+ return EmptyTenderHtml.join('');
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+$(document).ready(() => {
|
|
|
+ autoFlashHeight();
|
|
|
+ function getObjHeight(select) {
|
|
|
+ return select.length > 0 ? select.height() : 0;
|
|
|
+ }
|
|
|
+ const cHeader = getObjHeight($(".c-header"));
|
|
|
+ $('.tab-content').height($(window).height()-cHeader-90+53-46);
|
|
|
+
|
|
|
+ $('body').on('click', '.c-body .tender-info', function () {
|
|
|
+ $('.c-body .tender-info').removeClass('table-warning');
|
|
|
+ $(this).addClass('table-warning');
|
|
|
+ const tid = parseInt($(this).attr('data-id'));
|
|
|
+ if (!tid) {
|
|
|
+ toastr.warning('不存在标段无法设置');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 请求获取右侧列表信息
|
|
|
+ postData('/setting/manage/tender/save', { type: 'msg', tid: parseInt($(this).attr('data-id'))}, function (result) {
|
|
|
+ sp_lc = result.shenpi.sp_lc;
|
|
|
+ sp_type = result.shenpi.sp_type;
|
|
|
+ sp_status = result.shenpi.sp_status;
|
|
|
+ sp_status_list = result.shenpi.sp_status_list;
|
|
|
+ cur_tenderid = result.tender.id;
|
|
|
+ cur_uid = result.tender.user_id;
|
|
|
+ setShenpiHtml(result.shenpi, result.tender, result.revising);
|
|
|
+ setTouristHtml(result.tourists);
|
|
|
+ setScheduleHtml(result.scheduleAuditList);
|
|
|
+ resetAddUserHtml();
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ setTimeout(function () {
|
|
|
+ $('.c-body .tender-info').eq(0).click();// 需要延时加载
|
|
|
+ }, 500);
|
|
|
+
|
|
|
+
|
|
|
+ $('body').on('click', '.nav .nav-link', function () {
|
|
|
+ if ($(this).attr('href') === '#splc') {
|
|
|
+ $('#user-set').hide();
|
|
|
+ } else {
|
|
|
+ $('#user-set').show();
|
|
|
+ if ($(this).attr('href') === '#guest') {
|
|
|
+ $('#add_user_dropdownMenuButton').attr('data-type', 'tourist');
|
|
|
+ } else if ($(this).attr('href') === '#tzpro') {
|
|
|
+ $('#add_user_dropdownMenuButton').attr('data-type', 'schedule');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ $('body').on('click', '.c-body a', function (e) {
|
|
|
+ e.stopPropagation();
|
|
|
+ });
|
|
|
+
|
|
|
+ // 权限设置
|
|
|
+ $('body').on('click', '#tourist-users .set-tourist-permission', function () {
|
|
|
+ const id = parseInt($(this).data('id'));
|
|
|
+ const permission = {
|
|
|
+ file: ($(this).attr('name') === 'file' ? $(this).is(':checked') : $('#' + id + '_file').is(':checked')) ? 1 : 0,
|
|
|
+ tag: ($(this).attr('name') === 'tag' ? $(this).is(':checked') : $('#' + id + '_tag').is(':checked')) ? 1 : 0,
|
|
|
+ }
|
|
|
+ const prop = {
|
|
|
+ id,
|
|
|
+ type: 'permission',
|
|
|
+ permission,
|
|
|
+ }
|
|
|
+ console.log(prop);
|
|
|
+ postData('/tender/' + cur_tenderid + '/tourist/audit/save', prop, function (data) {
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ // 权限更改
|
|
|
+ $('body').on('click', '#schedule-users input[type="checkbox"]', function () {
|
|
|
+ let permission = scPermission.no;
|
|
|
+ const value = parseInt($(this).data('zhi'));
|
|
|
+ if ($(this).is(':checked')) {
|
|
|
+ if (value === scPermission.edit) {
|
|
|
+ permission = scPermission.edit;
|
|
|
+ $(this).parents('td').siblings().find('input').prop('checked', true);
|
|
|
+ } else if (value === scPermission.show) {
|
|
|
+ permission = scPermission.show;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (value === scPermission.edit) {
|
|
|
+ permission = scPermission.show;
|
|
|
+ } else if (value === scPermission.show) {
|
|
|
+ permission = scPermission.no;
|
|
|
+ $(this).parents('td').siblings().find('input').prop('checked', false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const id = parseInt($(this).data('id'));
|
|
|
+ const prop = {
|
|
|
+ id,
|
|
|
+ permission,
|
|
|
+ type: 'edit',
|
|
|
+ };
|
|
|
+ const _self = $(this);
|
|
|
+ postData('/tender/' + cur_tenderid + '/schedule/audit/save', prop, function (data) {
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ // 移除游客用户
|
|
|
+ $('body').on('click', '#tourist-users .remove-tourist-user', function () {
|
|
|
+ $('#remove_user_type').val('tourist');
|
|
|
+ $('#remove_user_id').val($(this).data('id'));
|
|
|
+ });
|
|
|
+
|
|
|
+ // 移除投资进度用户
|
|
|
+ $('body').on('click', '#schedule-users .remove-schedule-user', function () {
|
|
|
+ $('#remove_user_type').val('schedule');
|
|
|
+ $('#remove_user_id').val($(this).data('id'));
|
|
|
+ });
|
|
|
+
|
|
|
+ // 移除用户确定
|
|
|
+ $('#remove_user_btn').click(function () {
|
|
|
+ const type = $('#remove_user_type').val();
|
|
|
+ if (type !== 'tourist' && type !== 'schedule') {
|
|
|
+ toastr.error('参数有误');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const id = parseInt($('#remove_user_id').val());
|
|
|
+ const prop = {
|
|
|
+ id: id,
|
|
|
+ type: 'del',
|
|
|
+ };
|
|
|
+ postData('/tender/' + cur_tenderid + '/' + type + '/audit/save', prop, function (data) {
|
|
|
+ $('#'+ type + '-users').find('tr[data-id="'+ id +'"]').remove();
|
|
|
+ $('#remove-user').modal('hide');
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ // 投资进度
|
|
|
+ let timerAddUser = null;
|
|
|
+ let oldSearchValAddUser = null;
|
|
|
+ $('body').on('input propertychange', '#add_user_dropdownMenu2 .gr-search', function (e) {
|
|
|
+ oldSearchValAddUser = e.target.value;
|
|
|
+ timerAddUser && clearTimeout(timerAddUser);
|
|
|
+ timerAddUser = setTimeout(() => {
|
|
|
+ const newVal = $(this).val();
|
|
|
+ if (newVal && newVal === oldSearchValAddUser) {
|
|
|
+ let html = '';
|
|
|
+ accountList.filter(item => item && item.id !== cur_uid && (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>`
|
|
|
+ });
|
|
|
+ $('#add_user_dropdownMenu2 .book-list').empty();
|
|
|
+ $('#add_user_dropdownMenu2 .book-list').append(html);
|
|
|
+ } else {
|
|
|
+ if (!$('#add_user_dropdownMenu2 .acc-btn').length) {
|
|
|
+ resetAddUserHtml();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, 400);
|
|
|
+ });
|
|
|
+
|
|
|
+ function resetAddUserHtml() {
|
|
|
+ let html = '';
|
|
|
+ accountGroup.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 => {
|
|
|
+ if (item.id !== cur_uid) {
|
|
|
+ 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>';
|
|
|
+ });
|
|
|
+ $('#add_user_dropdownMenu2 .book-list').empty();
|
|
|
+ $('#add_user_dropdownMenu2 .book-list').append(html);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 添加审批流程按钮逻辑
|
|
|
+ $('body').on('click', '#add_user_dropdownMenu2 .book-list 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;
|
|
|
+ });
|
|
|
+
|
|
|
+ // 选中用户
|
|
|
+ $('body').on('click', '#add_user_dropdownMenu2 dl dd', function () {
|
|
|
+ const id = parseInt($(this).data('id'));
|
|
|
+ if (id) {
|
|
|
+ const user = _.find(accountList, function (item) {
|
|
|
+ return item.id === id;
|
|
|
+ });
|
|
|
+ const type = $('#add_user_dropdownMenuButton').attr('data-type');
|
|
|
+ if (type === 'tourist') {
|
|
|
+ const saIdList = [];
|
|
|
+ for (let i = 0; i < $('#tourist-users tr').length; i++) {
|
|
|
+ saIdList.push(parseInt($('#tourist-users tr').eq(i).data('uid')));
|
|
|
+ }
|
|
|
+ if (_.includes(saIdList, id)) {
|
|
|
+ toastr.error('该用户已存在列表中,无需重复添加');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const prop = {
|
|
|
+ user_id: id,
|
|
|
+ type: 'add',
|
|
|
+ };
|
|
|
+ postData('/tender/' + cur_tenderid + '/tourist/audit/save', prop, function (data) {
|
|
|
+ const html = `<tr data-uid="${user.id}" data-id="${data.id}">
|
|
|
+ <td>${user.name}</td>
|
|
|
+ <td>${user.role}</td>
|
|
|
+ <td class="text-center">
|
|
|
+ <div class="custom-control custom-checkbox mb-2">
|
|
|
+ <input type="checkbox" id="${data.id}_file" data-id="${data.id}" name="file" class="custom-control-input set-tourist-permission">
|
|
|
+ <label class="custom-control-label" for="${data.id}_file"></label>
|
|
|
+ </div>
|
|
|
+ </td>
|
|
|
+ <td class="text-center">
|
|
|
+ <div class="custom-control custom-checkbox mb-2">
|
|
|
+ <input type="checkbox" id="${data.id}_tag" data-id="${data.id}" name="tag" class="custom-control-input set-tourist-permission">
|
|
|
+ <label class="custom-control-label" for="${data.id}_tag"></label>
|
|
|
+ </div>
|
|
|
+ </td>
|
|
|
+ <td class="text-center">
|
|
|
+ <a href="#remove-user1" data-id="${data.id}" data-toggle="modal" data-target="#remove-user" class="btn btn-sm btn-outline-danger remove-tourist-user">移除</a>
|
|
|
+ </td>
|
|
|
+ </tr>`;
|
|
|
+ $('#tourist-users').append(html);
|
|
|
+ });
|
|
|
+ } else if (type === 'schedule') {
|
|
|
+ const user = _.find(accountList, function (item) {
|
|
|
+ return item.id === id;
|
|
|
+ });
|
|
|
+ const saIdList = [];
|
|
|
+ for (let i = 0; i < $('#schedule-users tr').length; i++) {
|
|
|
+ saIdList.push(parseInt($('#schedule-users tr').eq(i).data('uid')));
|
|
|
+ }
|
|
|
+ if (_.includes(saIdList, id)) {
|
|
|
+ toastr.error('该用户已存在列表中,无需重复添加');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const prop = {
|
|
|
+ audit_id: id,
|
|
|
+ type: 'add',
|
|
|
+ };
|
|
|
+ postData('/tender/' + cur_tenderid + '/schedule/audit/save', prop, function (data) {
|
|
|
+ const html = `<tr data-uid="${user.id}" data-id="${data.id}">
|
|
|
+ <td>${user.name}</td>
|
|
|
+ <td>${user.role}</td>
|
|
|
+ <td class="text-center">
|
|
|
+ <div class="custom-control custom-checkbox mb-2">
|
|
|
+ <input type="checkbox" data-zhi="${scPermission.show}" data-id="${data.id}" id="${data.id}_customRadio41" name="customCheckbox" class="custom-control-input" checked>
|
|
|
+ <label class="custom-control-label" for="${data.id}_customRadio41"></label>
|
|
|
+ </div>
|
|
|
+ </td>
|
|
|
+ <td class="text-center">
|
|
|
+ <div class="custom-control custom-checkbox mb-2">
|
|
|
+ <input type="checkbox" data-zhi="${scPermission.edit}" data-id="${data.id}" id="${data.id}_customRadio42" name="customCheckbox" class="custom-control-input">
|
|
|
+ <label class="custom-control-label" for="${data.id}_customRadio42"></label>
|
|
|
+ </div>
|
|
|
+ </td>
|
|
|
+ <td class="text-center">
|
|
|
+ <a href="#remove-user1" data-id="${data.id}" data-toggle="modal" data-target="#remove-user" class="btn btn-sm btn-outline-danger remove-schedule-user">移除</a>
|
|
|
+ </td>
|
|
|
+ </tr>`;
|
|
|
+ $('#schedule-users').append(html);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ initTenderTree4User();
|
|
|
+ $('#set-other-tender-user-a').click(function () {
|
|
|
+ if(!cur_tenderid) {
|
|
|
+ toastr.warning('未选中标段无法设置');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const userType = $('#add_user_dropdownMenuButton').attr('data-type');
|
|
|
+ const saIdList = [];
|
|
|
+ for (let i = 0; i < $('#'+ userType +'-users tr').length; i++) {
|
|
|
+ saIdList.push(parseInt($('#'+ userType +'-users tr').eq(i).data('uid')));
|
|
|
+ }
|
|
|
+ if (saIdList.length > 0) {
|
|
|
+ $('#bdcopy').modal('show');
|
|
|
+ } else {
|
|
|
+ toastr.warning('未存在'+ (userType === 'tourist' ? '游客' : '投资进度') +'用户账号,无法应用至其他标段');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $('#bdcopy').on('show.bs.modal', function () {
|
|
|
+ const html = getTenderTreeHtml4User();
|
|
|
+ $('#tender-list-4user').html(html);
|
|
|
+ $('#search-tender').val('');
|
|
|
+ $('#search-tender-result').text('0/0');
|
|
|
+ $('#up-tender-search').attr('disabled', true);
|
|
|
+ $('#down-tender-search').attr('disabled', true);
|
|
|
+ setTimeout(function () { $('#tender-list-4user').scrollTop(0); },500);
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ let timer4SearchTender = null;
|
|
|
+ let oldSearchVal4SearchTender = null;
|
|
|
+ $('body').on('input propertychange', '#bdcopy input[name="tender-name"]', function(e) {
|
|
|
+ oldSearchVal4SearchTender = e.target.value;
|
|
|
+ timer4SearchTender && clearTimeout(timer4SearchTender);
|
|
|
+ timer4SearchTender = setTimeout(() => {
|
|
|
+ const newVal = $(this).val();
|
|
|
+
|
|
|
+ const resultLength = $('#tender-list-4user').find('.result').length;
|
|
|
+ if (resultLength > 0) {
|
|
|
+ let content = $('#tender-list-4user').html();
|
|
|
+ const replaceStr = $('#tender-list-4user').find('.result').eq(0).html();
|
|
|
+ const regExp2 = new RegExp('<span class="result" style="background: yellow;">' + replaceStr + '</span>', 'g');
|
|
|
+ content = content.replace(regExp2, replaceStr);
|
|
|
+ const regExp3 = new RegExp('<span class="result" style="background: orange;">' + replaceStr + '</span>', 'g');
|
|
|
+ content = content.replace(regExp3, replaceStr);
|
|
|
+ $('#tender-list-4user').html(content);
|
|
|
+ }
|
|
|
+ $('#search-tender-result').text('0/0');
|
|
|
+ $('#up-tender-search').attr('disabled', true);
|
|
|
+ $('#down-tender-search').attr('disabled', true);
|
|
|
+ if (newVal && newVal === oldSearchVal4SearchTender) {
|
|
|
+ const regExp = new RegExp(newVal, 'g');
|
|
|
+ for (let i = 0; i < $('#tender-list-4user tr').length; i++) {
|
|
|
+ if (_.includes($('#tender-list-4user tr').eq(i).children('td').eq(0).children('a').html(), newVal)) {
|
|
|
+ $('#tender-list-4user tr').eq(i).children('td').eq(0).children('a').html($('#tender-list-4user tr').eq(i).children('td').eq(0).children('a').html().replace(regExp, '<span class="result" style="background: yellow;">' + newVal + '</span>'))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const resultLength2 = $('#tender-list-4user').find('.result').length;
|
|
|
+ if (resultLength2 > 0) {
|
|
|
+ $('#tender-list-4user').find('.result').eq(0).css('background', 'orange');
|
|
|
+ $('#search-tender-result').text('1/' + resultLength2);
|
|
|
+ $('#up-tender-search').attr('disabled', false);
|
|
|
+ $('#down-tender-search').attr('disabled', false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if($('#tender-list-4user').find('.result').length > 0) {
|
|
|
+ const X = $('#tender-list-4user').find('.result').eq(0).offset().top;
|
|
|
+ $('#tender-list-4user').scrollTop(X - $('#tender-list-4user').offset().top + $('#tender-list-4user').scrollTop() - 30);
|
|
|
+ }
|
|
|
+ }, 400);
|
|
|
+ });
|
|
|
+
|
|
|
+ $('#up-tender-search').on('click', function () {
|
|
|
+ const cur = parseInt($('#search-tender-result').text().split('/')[0]);
|
|
|
+ const total = parseInt($('#search-tender-result').text().split('/')[1]);
|
|
|
+ const now = cur - 1 !== 0 ? cur - 1: total;
|
|
|
+ $('#tender-list-4user').find('.result').eq(cur-1).css('background', 'yellow');
|
|
|
+ $('#tender-list-4user').find('.result').eq(now-1).css('background', 'orange');
|
|
|
+ // $('#tender-list tr').eq(searchUser[cur-1]).children('td').eq(2).html($('#tender-list tr').eq(searchUser[cur-1]).children('td').eq(2).html().replace('<span class="result" style="background:orange;">', '<span class="result" style="background:yellow;">'))
|
|
|
+ // $('#tender-list tr').eq(searchUser[now-1]).children('td').eq(2).html($('#tender-list tr').eq(searchUser[now-1]).children('td').eq(2).html().replace('<span class="result" style="background:yellow;">', '<span class="result" style="background:orange;">'))
|
|
|
+ $('#search-tender-result').text(now + '/' + total);
|
|
|
+ const X = $('#tender-list-4user').find('.result').eq(now-1).offset().top;
|
|
|
+ $('#tender-list-4user').scrollTop(X - $('#tender-list-4user').offset().top + $('#tender-list-4user').scrollTop() - 30);
|
|
|
+ });
|
|
|
+
|
|
|
+ $('#down-tender-search').on('click', function () {
|
|
|
+ const cur = parseInt($('#search-tender-result').text().split('/')[0]);
|
|
|
+ const total = parseInt($('#search-tender-result').text().split('/')[1]);
|
|
|
+ const now = cur + 1 > total ? 1: cur + 1;
|
|
|
+ $('#tender-list-4user').find('.result').eq(cur-1).css('background', 'yellow');
|
|
|
+ $('#tender-list-4user').find('.result').eq(now-1).css('background', 'orange');
|
|
|
+ // $('#tender-list tr').eq(searchUser[cur-1]).children('td').eq(2).html($('#tender-list tr').eq(searchUser[cur-1]).children('td').eq(2).html().replace('<span class="result" style="background:orange;">', '<span class="result" style="background:yellow;">'))
|
|
|
+ // $('#tender-list tr').eq(searchUser[now-1]).children('td').eq(2).html($('#tender-list tr').eq(searchUser[now-1]).children('td').eq(2).html().replace('<span class="result" style="background:yellow;">', '<span class="result" style="background:orange;">'))
|
|
|
+ $('#search-tender-result').text(now + '/' + total);
|
|
|
+ const X = $('#tender-list-4user').find('.result').eq(now-1).offset().top;
|
|
|
+ $('#tender-list-4user').scrollTop(X - $('#tender-list-4user').offset().top + $('#tender-list-4user').scrollTop() -30);
|
|
|
+ });
|
|
|
+
|
|
|
+ $('#save-other-tender-user').click(function () {
|
|
|
+ $(this).attr('disabled', true);
|
|
|
+ const num = $('#tender-list-4user input:checked').length;
|
|
|
+ if (num < 2) {
|
|
|
+ toastr.warning('请选择需要应用同步的标段');
|
|
|
+ $(this).attr('disabled', false);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const userType = $('#add_user_dropdownMenuButton').attr('data-type');
|
|
|
+ const data = {
|
|
|
+ type: 'copy2otu',
|
|
|
+ tid: cur_tenderid,
|
|
|
+ userType,
|
|
|
+ };
|
|
|
+ const saIdList = [];
|
|
|
+ for (let i = 0; i < $('#'+ userType +'-users tr').length; i++) {
|
|
|
+ const userData = {
|
|
|
+ uid: parseInt($('#'+ userType +'-users tr').eq(i).data('uid')),
|
|
|
+ }
|
|
|
+ if (userType === 'tourist') {
|
|
|
+ userData.permission = {
|
|
|
+ file: $('#tourist-users tr').eq(i).find('input[type="checkbox"]').eq(0).is(':checked') ? 1 : 0,
|
|
|
+ tag: $('#tourist-users tr').eq(i).find('input[type="checkbox"]').eq(1).is(':checked') ? 1 : 0,
|
|
|
+ };
|
|
|
+ } else if (userType === 'schedule') {
|
|
|
+ let permission = scPermission.no;
|
|
|
+ const _this = $('#schedule-users tr').eq(i).find('input[type="checkbox"]').eq(0);
|
|
|
+ const _other = $('#schedule-users tr').eq(i).find('input[type="checkbox"]').eq(1);
|
|
|
+ if (_this.is(':checked') && _other.is(':checked')) {
|
|
|
+ permission = scPermission.edit;
|
|
|
+ } else if (_this.is(':checked') && !_other.is(':checked')) {
|
|
|
+ permission = scPermission.show;
|
|
|
+ }
|
|
|
+ userData.permission = permission;
|
|
|
+ }
|
|
|
+ saIdList.push(userData);
|
|
|
+ }
|
|
|
+ data.auditList = saIdList;
|
|
|
+ // 获取已选中的标段
|
|
|
+ const tenderList = [];
|
|
|
+ for (let i = 0; i < num; i++) {
|
|
|
+ const tid = parseInt($('#tender-list-4user input:checked').eq(i).data('tid'));
|
|
|
+ if (tid !== cur_tenderid) {
|
|
|
+ tenderList.push(tid);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ data.tidList = tenderList.join(',');
|
|
|
+ console.log(data);
|
|
|
+ // 请求获取右侧列表信息
|
|
|
+ const _self = $(this);
|
|
|
+ postData('/setting/manage/tender/save', data, function (result) {
|
|
|
+ toastr.success('应用至其他标段成功');
|
|
|
+ _self.attr('disabled', false);
|
|
|
+ $('#bdcopy').modal('hide');
|
|
|
+ }, function () {
|
|
|
+ _self.attr('disabled', false);
|
|
|
+ });
|
|
|
+ });
|
|
|
+})
|
|
|
+
|
|
|
+const tenderListSpec = (function(){
|
|
|
+ function getTenderTreeHeaderHtml() {
|
|
|
+ const html = [];
|
|
|
+ html.push('<table class="table table-hover table-bordered">');
|
|
|
+ html.push('<thead style="position: fixed;left:176px;top: 34px;">', '<tr>');
|
|
|
+ html.push('<th class="text-center" style="width: 80%">', '标段名称', '</th>');
|
|
|
+ html.push('<th class="text-center" style="width: 20%">', '创建人', '</th>');
|
|
|
+ html.push('</tr>', '</thead>');
|
|
|
+ return html.join('');
|
|
|
+ }
|
|
|
+ function getTenderNodeHtml(node, arr, pid) {
|
|
|
+ const html = [];
|
|
|
+ html.push('<tr pid="' + pid + '"', (node.cid ? '' : 'class="tender-info" data-id="'+ node.id +'"'), '>');
|
|
|
+ // 名称
|
|
|
+ html.push('<td style="width: 80%" class="in-' + node.level + '">');
|
|
|
+ if (node.cid) {
|
|
|
+ html.push('<span onselectstart="return false" style="{-moz-user-select:none}" class="fold-switch mr-1" title="收起" cid="'+ node.sort_id +'"><i class="fa fa-minus-square-o"></i></span> <i class="fa fa-folder-o"></i> ', node.name);
|
|
|
+ } else {
|
|
|
+ html.push('<div class="d-flex justify-content-between align-items-center">');
|
|
|
+ html.push('<div>');
|
|
|
+ html.push('<span class="text-muted mr-2">');
|
|
|
+ html.push(arr.indexOf(node) === arr.length - 1 ? '└' : '├');
|
|
|
+ html.push('</span>');
|
|
|
+ //html.push('<a href="/tender/' + node.id + '">', node[c.field], '</a>');
|
|
|
+ html.push('<a href="javascript: void(0)" id="' + node.id + '" name="name">', node.name, '</a>');
|
|
|
+ html.push('</div>');
|
|
|
+ html.push('<div class="btn-group-table" tid="' + node.id + '">');
|
|
|
+ html.push('<a href="javascript:void(0);" name="edit" class="mr-1"><i class="fa fa-pencil fa-fw"></i></a>');
|
|
|
+ const hasStage = node.progress ? node.stage_count > 0 : !!node.lastStage;
|
|
|
+ if (!hasStage) {
|
|
|
+ html.push('<a href="javascript:void(0);" name="del" class="mr-1"><i class="fa fa-trash-o fa-fw text-danger"></i></a>');
|
|
|
+ } else {
|
|
|
+ html.push('<a href="javascript:void(0);" data-toggle="tooltip" title="请先删除所有期" class="mr-1"><i class="fa fa-trash-o fa-fw text-secondary"></i></a>');
|
|
|
+ }
|
|
|
+ html.push('</div></div>');
|
|
|
+ }
|
|
|
+ html.push('</td>');
|
|
|
+ // 创建人
|
|
|
+ html.push('<td style="width: 20%" class="text-center">', node.user_name ? node.user_name : '', '</td>');
|
|
|
+ html.push('</tr>');
|
|
|
+ return html.join('');
|
|
|
+ }
|
|
|
+ return { getTenderNodeHtml, getTenderTreeHeaderHtml }
|
|
|
+})();
|
|
|
+
|
|
|
+function setShenpiHtml(shenpi, tender, revising) {
|
|
|
+ let html = '';
|
|
|
+ if (shenpi.sp_lc.length > 0) {
|
|
|
+ for (const sp of shenpi.sp_lc) {
|
|
|
+ html += `<div class="card mb-3">
|
|
|
+ <div class="card-body ${sp.code}_div">
|
|
|
+ <a class="pull-right set-otherTender" data-name="${sp.name}" data-code="${sp.code}" href="#batch" data-toggle="modal" data-target="#batch">设置其他标段</a>
|
|
|
+ <a class="pull-right set-otherShenpi mr-3" data-name="${sp.name}" data-code="${sp.code}" href="javascript: void(0);">设置其他流程</a>`;
|
|
|
+ if (sp.code === 'stage' && !revising && tender.ledger_status === auditConst.ledger.status.checked) {
|
|
|
+ html += `<a class="pull-right mr-3" id="stage_cooperation" ${sp.status !== shenpi.sp_status.gdspl ? 'style="display: none"' : '' } data-name="${sp.name}" data-code="${sp.code}" href="#cooperation" data-toggle="modal" data-target="#cooperation">多人协同 <i class="fa fa-lock"></i></a>`;
|
|
|
+ }
|
|
|
+ html += `
|
|
|
+ <h5 class="card-title">${sp.name}</h5>
|
|
|
+ <div class="form-group">
|
|
|
+ <div class="form-group form-check">`;
|
|
|
+ for (const st in shenpi.sp_status_list) {
|
|
|
+ if (shenpi.sp_status_list[st]) {
|
|
|
+ html += `<div class="custom-control custom-checkbox custom-control-inline">
|
|
|
+ <input type="radio" class="custom-control-input" data-code="${sp.code}" value="${shenpi.sp_status_list[st].status}" name="${sp.code}" id="${sp.code}_${shenpi.sp_status_list[st].status}" ${sp.status === shenpi.sp_status_list[st].status ? 'checked' : ''}>
|
|
|
+ <label class="custom-control-label" for="${sp.code}_${shenpi.sp_status_list[st].status}">${shenpi.sp_status_list[st].name}</label>
|
|
|
+ </div>`;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ html += `
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="alert alert-warning">${shenpi.sp_status_list[sp.status].name}:${shenpi.sp_status_list[sp.status].msg}</div>
|
|
|
+ <div class="lc-show">`;
|
|
|
+ if (sp.status === sp_status.sqspr) {
|
|
|
+ html += ``;
|
|
|
+ } else if (sp.status === sp_status.gdspl) {
|
|
|
+ let addhtml = '<ul class="list-unstyled">\n';
|
|
|
+ const flow = sp_lc.find(x => { return x.code === sp.code; });
|
|
|
+ flow.auditGroupList = sp.auditGroupList;
|
|
|
+ if (sp.auditGroupList && sp.auditGroupList.length !== 0) {
|
|
|
+ for(const [i, auditGroup] of sp.auditGroupList.entries()) {
|
|
|
+ addhtml += auditUtils.getAuditGroupHtml(sp.code, auditGroup, i + 1);
|
|
|
+ }
|
|
|
+ addhtml += '<li class="pl-3"><a href="javascript:void(0);" class="add-audit"><i class="fa fa-plus"></i> 添加流程</a></li>';
|
|
|
+ } else {
|
|
|
+ addhtml += auditUtils.getAuditGroupHtml(sp.code, [], 1);
|
|
|
+ }
|
|
|
+ addhtml += '</ul>\n';
|
|
|
+ html += addhtml;
|
|
|
+ } else if (sp.status === sp_status.gdzs) {
|
|
|
+ let addhtml = '<ul class="list-unstyled">\n' +
|
|
|
+ ' <li class="d-flex justify-content-start mb-3">\n' +
|
|
|
+ ' <span class="col-auto">授权审批人</span>\n' +
|
|
|
+ ' <span class="col-7">\n' +
|
|
|
+ ' <span class="d-inline-block"></span>\n' +
|
|
|
+ ' </span>\n' +
|
|
|
+ ' </li>\n';
|
|
|
+ addhtml += sp.audit ? makeAudit(sp.audit) : makeSelectAudit(sp.code);
|
|
|
+ addhtml += '</ul>\n';
|
|
|
+ html += addhtml;
|
|
|
+ }
|
|
|
+ html += ` </div>
|
|
|
+ </div>
|
|
|
+ </div>`;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $('#splc').html(html);
|
|
|
+}
|
|
|
+
|
|
|
+function setTouristHtml(tourists) {
|
|
|
+ let html = '';
|
|
|
+ if (tourists.length > 0) {
|
|
|
+ for (const t of tourists) {
|
|
|
+ html += `<tr data-uid="${t.user_id}" data-id="${t.id}">
|
|
|
+ <td>${t.user_name}</td>
|
|
|
+ <td>${t.user_role}</td>
|
|
|
+ <td class="text-center">
|
|
|
+ <div class="custom-control custom-checkbox mb-2">
|
|
|
+ <input type="checkbox" id="${t.id}_file" data-id="${t.id}" name="file" class="custom-control-input set-tourist-permission" ${t.permission.file ? 'checked' : ''}>
|
|
|
+ <label class="custom-control-label" for="${t.id}_file"></label>
|
|
|
+ </div>
|
|
|
+ </td>
|
|
|
+ <td class="text-center">
|
|
|
+ <div class="custom-control custom-checkbox mb-2">
|
|
|
+ <input type="checkbox" id="${t.id}_tag" data-id="${t.id}" name="tag" class="custom-control-input set-tourist-permission" ${t.permission.tag ? 'checked' : ''}>
|
|
|
+ <label class="custom-control-label" for="${t.id}_tag"></label>
|
|
|
+ </div>
|
|
|
+ </td>
|
|
|
+ <td class="text-center">
|
|
|
+ <a href="#remove-user1" data-id="${t.id}" data-toggle="modal" data-target="#remove-user" class="btn btn-sm btn-outline-danger remove-tourist-user">移除</a>
|
|
|
+ </td>
|
|
|
+ </tr>`;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $('#tourist-users').html(html);
|
|
|
+}
|
|
|
+
|
|
|
+function setScheduleHtml(scheduleAuditList) {
|
|
|
+ let html = '';
|
|
|
+ if (scheduleAuditList.length > 0) {
|
|
|
+ for (const sa of scheduleAuditList) {
|
|
|
+ const audit = _.find(accountList, { id: sa.audit_id });
|
|
|
+ html += `<tr data-uid="${sa.audit_id}" data-id="${sa.id}">
|
|
|
+ <td>${audit ? audit.name : ''}</td>
|
|
|
+ <td>${audit ? audit.role : ''}</td>
|
|
|
+ <td class="text-center">
|
|
|
+ <div class="custom-control custom-checkbox mb-2">
|
|
|
+ <input type="checkbox" data-zhi="${scPermission.show}" data-id="${sa.id}" id="${sa.id}_customRadio41" name="customCheckbox" class="custom-control-input" ${sa.permission !== scPermission.no ? 'checked' : ''}>
|
|
|
+ <label class="custom-control-label" for="${sa.id}_customRadio41"></label>
|
|
|
+ </div>
|
|
|
+ </td>
|
|
|
+ <td class="text-center">
|
|
|
+ <div class="custom-control custom-checkbox mb-2">
|
|
|
+ <input type="checkbox" data-zhi="${scPermission.edit}" data-id="${sa.id}" id="${sa.id}_customRadio42" name="customCheckbox" class="custom-control-input" ${sa.permission === scPermission.edit ? 'checked' : ''}>
|
|
|
+ <label class="custom-control-label" for="${sa.id}_customRadio42"></label>
|
|
|
+ </div>
|
|
|
+ </td>
|
|
|
+ <td class="text-center">
|
|
|
+ <a href="#remove-user1" data-id="${sa.id}" data-toggle="modal" data-target="#remove-user" class="btn btn-sm btn-outline-danger remove-schedule-user">移除</a>
|
|
|
+ </td>
|
|
|
+ </tr>`;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $('#schedule-users').html(html);
|
|
|
+}
|