|
@@ -302,6 +302,9 @@ $(document).ready(function () {
|
|
if (type !== auditType.key.common || auditGroup.length === 0) {
|
|
if (type !== auditType.key.common || auditGroup.length === 0) {
|
|
html.push(this.getSelectAuditHtml(code));
|
|
html.push(this.getSelectAuditHtml(code));
|
|
}
|
|
}
|
|
|
|
+ if (type === auditType.key.joint && auditGroup.length > 0) {
|
|
|
|
+ html.push(`<button class="btn btn-sm btn-outline-primary">协同设置</button>`);
|
|
|
|
+ }
|
|
html.push('</span>');
|
|
html.push('</span>');
|
|
return html.join('');
|
|
return html.join('');
|
|
},
|
|
},
|
|
@@ -961,6 +964,114 @@ $(document).ready(function () {
|
|
}
|
|
}
|
|
const auditAss = new AuditAss();
|
|
const auditAss = new AuditAss();
|
|
|
|
|
|
|
|
+ class AuditJoint {
|
|
|
|
+ constructor() {
|
|
|
|
+ this.spread = SpreadJsObj.createNewSpread($('#joint-spread')[0]);
|
|
|
|
+ this.sheet = this.spread.getActiveSheet();
|
|
|
|
+ this.tree = createNewPathTree('base', {
|
|
|
|
+ id: 'ledger_id',
|
|
|
|
+ pid: 'ledger_pid',
|
|
|
|
+ order: 'order',
|
|
|
|
+ level: 'level',
|
|
|
|
+ rootId: -1,
|
|
|
|
+ });
|
|
|
|
+ this.selectJoint = [{ value: 0, text: '' }];
|
|
|
|
+ this.spreadSetting = {
|
|
|
|
+ cols: [
|
|
|
|
+ {title: '编号', colSpan: '1', rowSpan: '1', field: 'code', hAlign: 0, width: 165, formatter: '@', cellType: 'tree', readOnly: true },
|
|
|
|
+ {title: '名称', colSpan: '1', rowSpan: '1', field: 'name', hAlign: 0, width: 185, formatter: '@', readOnly: true },
|
|
|
|
+ {title: '协同人', colSpan: '1', rowSpan: '1', field: 'audit_id', hAlign: 1, width: 100, cellType: 'customizeCombo', comboItems: this.selectJoint },
|
|
|
|
+ ],
|
|
|
|
+ emptyRows: 0,
|
|
|
|
+ headRows: 1,
|
|
|
|
+ headRowHeight: [32],
|
|
|
|
+ defaultRowHeight: 21,
|
|
|
|
+ headerFont: '12px 微软雅黑',
|
|
|
|
+ font: '12px 微软雅黑',
|
|
|
|
+ };
|
|
|
|
+ sjsSettingObj.setFxTreeStyle(this.spreadSetting, sjsSettingObj.FxTreeStyle.jz);
|
|
|
|
+ SpreadJsObj.initSheet(this.sheet, this.spreadSetting);
|
|
|
|
+
|
|
|
|
+ const self = this;
|
|
|
|
+ SpreadJsObj.addDeleteBind(this.spread, function() { return; });
|
|
|
|
+ SpreadJsObj.selChangedRefreshBackColor(this.sheet);
|
|
|
|
+ this.spread.bind(spreadNS.Events.EditEnded, function(e, info) {
|
|
|
|
+ const node = SpreadJsObj.getSelectObject(info.sheet);
|
|
|
|
+ const col = info.sheet.zh_setting.cols[info.col];
|
|
|
|
+ node[col.field] = info.editingText;
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ $('#joint').on('shown.bs.modal', function() {
|
|
|
|
+ self.spread.refresh();
|
|
|
|
+ });
|
|
|
|
+ $('#joint-ok').click(function() {
|
|
|
|
+ const data = self.getJointAuditLedgerData();
|
|
|
|
+ postData(`/tender/${cur_tenderid}/shenpi/joint/save`, data, function(result) {
|
|
|
|
+ $('#joint').modal('hide');
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ _refreshJointTree() {
|
|
|
|
+ const ledgerAss = {};
|
|
|
|
+ for (const a of this.auditors) {
|
|
|
|
+ a.lid.forEach(l => { ledgerAss[l] = a; });
|
|
|
|
+ }
|
|
|
|
+ for (const n of this.tree.nodes) {
|
|
|
|
+ const la = ledgerAss[n.ledger_id];
|
|
|
|
+ n.audit_id = la ? la.audit_id : 0;
|
|
|
|
+ n.audit_name = la ? la.name : '';
|
|
|
|
+ }
|
|
|
|
+ SpreadJsObj.reloadColData(this.sheet, 2);
|
|
|
|
+ }
|
|
|
|
+ setJointAuditors(auditors) {
|
|
|
|
+ this.auditors = auditors;
|
|
|
|
+ this.selectJoint.length = 1;
|
|
|
|
+ const html = [];
|
|
|
|
+ for (const auditor of auditors) {
|
|
|
|
+ auditor.lid = auditor.audit_ledger_id ? auditor.audit_ledger_id.split(',') : [];
|
|
|
|
+ html.push(`<tr><td>${auditor.name}</td><td>${auditor.company}</td><td>${auditor.lid.length}<button class="ml-2 btn btn-sm btn-outline-danger" jaid="${auditor.audit_id}">清空</button></td></tr>`);
|
|
|
|
+ this.selectJoint.push({ value: auditor.audit_id, text: auditor.name });
|
|
|
|
+ }
|
|
|
|
+ $('#joint_table').html(html.join(''));
|
|
|
|
+ this._refreshJointTree();
|
|
|
|
+ }
|
|
|
|
+ loadJointData(sp_type, audit_order) {
|
|
|
|
+ const data = { sp_type, audit_order };
|
|
|
|
+ if (!this.loaded) data.ledger = 1;
|
|
|
|
+
|
|
|
|
+ const self = this;
|
|
|
|
+ postData(`/tender/${cur_tenderid}/shenpi/joint/load`, data, function(result) {
|
|
|
|
+ self.loaded = true;
|
|
|
|
+ if (result.ledgerList) {
|
|
|
|
+ self.tree.loadDatas(result.ledgerList);
|
|
|
|
+ SpreadJsObj.loadSheetData(self.sheet, SpreadJsObj.DataType.Tree, self.tree);
|
|
|
|
+ }
|
|
|
|
+ self.setJointAuditors(result.jointAuditors);
|
|
|
|
+ if (self.auditors.length > 0) {
|
|
|
|
+ $('#joint').modal('show');
|
|
|
|
+ } else {
|
|
|
|
+ toastr.warning(`${audit_order}审未添加任何协同人,请先添加协同人再分配协同台账`);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ getJointAuditLedgerData() {
|
|
|
|
+ this.auditors.forEach(a => { a.lid = []; });
|
|
|
|
+ for (const node of this.tree.nodes) {
|
|
|
|
+ if (node.audit_id > 0) {
|
|
|
|
+ const relaAudit = this.auditors.find(x => { return x.audit_id === node.audit_id; });
|
|
|
|
+ if (relaAudit) relaAudit.lid.push(node.ledger_id);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return this.auditors.map(a => {
|
|
|
|
+ return { id: a.id, audit_ledger_id: a.lid.join(',') };
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ const auditJoint = new AuditJoint();
|
|
|
|
+ $('body').on('click', '[name=joint-set]', function() {
|
|
|
|
+ auditJoint.loadJointData(this.getAttribute('sp_type'), this.getAttribute('audit_order'));
|
|
|
|
+ });
|
|
|
|
+
|
|
$.subMenu({
|
|
$.subMenu({
|
|
menu: '#sub-menu', miniMenu: '#sub-mini-menu', miniMenuList: '#mini-menu-list',
|
|
menu: '#sub-menu', miniMenu: '#sub-mini-menu', miniMenuList: '#mini-menu-list',
|
|
toMenu: '#to-menu', toMiniMenu: '#to-mini-menu',
|
|
toMenu: '#to-menu', toMiniMenu: '#to-mini-menu',
|