|
@@ -7,19 +7,13 @@
|
|
* @date 2018/6/21
|
|
* @date 2018/6/21
|
|
* @version
|
|
* @version
|
|
*/
|
|
*/
|
|
-
|
|
|
|
-// 向后端请求中间计量号
|
|
|
|
-function getNewMeasureCode() {
|
|
|
|
- postData('/measure/newCode', null, function (code) {
|
|
|
|
- if (code !== '') {
|
|
|
|
- $('#mj-code').val(code);
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
+function getMid() {
|
|
|
|
+ return window.location.pathname.split('/')[3];
|
|
}
|
|
}
|
|
// 新增计量范围
|
|
// 新增计量范围
|
|
function addMeasurePos(pid) {
|
|
function addMeasurePos(pid) {
|
|
postData('/measure/pos', {
|
|
postData('/measure/pos', {
|
|
- mid: $('#measures').val(),
|
|
|
|
|
|
+ mid: window.location.pathname.split('/')[3],
|
|
operate: 'add',
|
|
operate: 'add',
|
|
pid: pid,
|
|
pid: pid,
|
|
}, function (data) {
|
|
}, function (data) {
|
|
@@ -35,41 +29,125 @@ function addMeasurePos(pid) {
|
|
// 移除计量范围
|
|
// 移除计量范围
|
|
function removeMeasurePos(pid) {
|
|
function removeMeasurePos(pid) {
|
|
postData('/measure/pos', {
|
|
postData('/measure/pos', {
|
|
- mid: $('#measures').val(),
|
|
|
|
|
|
+ mid: getMid(),
|
|
operate: 'remove',
|
|
operate: 'remove',
|
|
pid: pid,
|
|
pid: pid,
|
|
}, function (data) {
|
|
}, function (data) {
|
|
$('tr[id='+ pid +']', '#measurePosList').remove();
|
|
$('tr[id='+ pid +']', '#measurePosList').remove();
|
|
})
|
|
})
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+//
|
|
|
|
+function getAuditorHtml(audit) {
|
|
|
|
+ const html = [];
|
|
|
|
+ html.push('<li class="list-group-item" auditorId="'+ audit.audit_id +'"><a href="javascript: void(0)" class="text-danger pull-right">移除</a>');
|
|
|
|
+ html.push('<span>');
|
|
|
|
+ html.push(audit.order + ' ');
|
|
|
|
+ html.push(audit.name + ' ');
|
|
|
|
+ html.push('</span>');
|
|
|
|
+ html.push('<small class="text-muted">');
|
|
|
|
+ html.push(audit.role);
|
|
|
|
+ html.push('</small></li>')
|
|
|
|
+ return html.join('');
|
|
|
|
+}
|
|
|
|
+function bindRemoveAuditor(obj) {
|
|
|
|
+ obj.click(function () {
|
|
|
|
+ const li = $(this).parent();
|
|
|
|
+ const data = {
|
|
|
|
+ mid: getMid(),
|
|
|
|
+ auditorId: parseInt(li.attr('auditorId')),
|
|
|
|
+ }
|
|
|
|
+ postData('/measure/audit/remove', data, (data) => {
|
|
|
|
+ li.remove();
|
|
|
|
+ for (const a of data) {
|
|
|
|
+ const aLi = $('li[auditorId=' + a.audit_id + ']');
|
|
|
|
+ $('span', aLi).text(a.order + ' ' + a.name + ' ');
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+}
|
|
|
|
+function getAuditStatuHtml(measure) {
|
|
|
|
+ const html = [];
|
|
|
|
+ if (measure.status === auditConst.status.checkNo) {
|
|
|
|
+ html.push('<a href="#sp-list" data-toggle="modal" data-target="#sp-list" class="btn btn-outline-warning btn-sm pull-right text-dark">报审退回</a>');
|
|
|
|
+ } else if (measure.status === auditConst.status.checking) {
|
|
|
|
+ html.push('<a href="#sp-list" data-toggle="modal" data-target="#sp-list" class="btn btn-outline-warning btn-sm pull-right text-dark">审批中</a>');
|
|
|
|
+ } else if (measure.status === auditConst.status.checked) {
|
|
|
|
+ html.push('<a href="#sp-list" data-toggle="modal" data-target="#sp-list" class="btn btn-outline-secondary btn-sm pull-right">审批完成</a>');
|
|
|
|
+ }
|
|
|
|
+ if (measure.user_id === userId ) {
|
|
|
|
+ if (!measure.status || measure.status === auditConst.status.uncheck) {
|
|
|
|
+ html.push('<a href="#sub-sp" data-toggle="modal" data-target="#sub-sp" class="btn btn-primary btn-sm pull-right">上报审批</a>');
|
|
|
|
+ } else if (measure.status === auditConst.status.checkNo) {
|
|
|
|
+ html.push('<a href="#sub-sp" data-toggle="modal" data-target="#sub-sp2" class="btn btn-primary btn-sm pull-right">重新上报</a>');
|
|
|
|
+ }
|
|
|
|
+ html.push('<a href="#del" data-toggle="modal" data-target="#del" class="btn btn-outline-danger btn-sm pull-right">删除' + measure.code + '</a>');
|
|
|
|
+ }
|
|
|
|
+ return html.join('');
|
|
|
|
+}
|
|
|
|
+function getAuditListHtml(measure) {
|
|
|
|
+ const html = [];
|
|
|
|
+ for (const auditor of measure.auditors) {
|
|
|
|
+ html.push('<li class="list-group-item" auditorId="' + auditor.audit_id + '">');
|
|
|
|
+ if (auditor.status !== auditConst.status.uncheck) {
|
|
|
|
+ html.push('<span class="' + auditConst.statusClass[auditor.status] + ' pull-right">' + auditConst.statusString[auditor.status] + '</span>');
|
|
|
|
+ }
|
|
|
|
+ html.push('<h5 class="card-title">' + auditor.order + ' ' + auditor.name + ' <small class="text-muted">' + auditor.role + '</small></h5>');
|
|
|
|
+ html.push('<p class="card-text">', (auditor.opinion ? auditor.opinion : ''), ' ', (auditor.end_time ? moment(auditor.end_time).format('YYYY-MM-DD') : ''), '</p>');
|
|
|
|
+ html.push('</li>');
|
|
|
|
+ }
|
|
|
|
+ return html.join('');
|
|
|
|
+}
|
|
|
|
|
|
$(document).ready(() => {
|
|
$(document).ready(() => {
|
|
autoFlashHeight();
|
|
autoFlashHeight();
|
|
|
|
|
|
- // 新增中间计量 modal显示
|
|
|
|
- $('#add-mj').on('show.bs.modal', function() {
|
|
|
|
- getNewMeasureCode();
|
|
|
|
- if ($('#measures')[0].options.length === 0) {
|
|
|
|
- $('#addCancel').hide();
|
|
|
|
- } else {
|
|
|
|
- $('#addCancel').show();
|
|
|
|
|
|
+ // 上报审批 搜索
|
|
|
|
+ $('#searchAccount').click(() => {
|
|
|
|
+ const data = {
|
|
|
|
+ keyword: $('#searchName').val(),
|
|
}
|
|
}
|
|
|
|
+ postData('/search/user', data, (data) => {
|
|
|
|
+ const resultDiv = $('#searchResult');
|
|
|
|
+ $('h5>span', resultDiv).text(data.name);
|
|
|
|
+ $('#addAuditor').attr('auditorId', data.id);
|
|
|
|
+ $('h6', resultDiv).text(data.role);
|
|
|
|
+ $('p', resultDiv).text(data.company);
|
|
|
|
+ resultDiv.show();
|
|
|
|
+ }, () => {
|
|
|
|
+ $('#searchResult').hide();
|
|
|
|
+ });
|
|
});
|
|
});
|
|
- // 新增中间计量--刷新编号
|
|
|
|
- $('#autoCode').click(getNewMeasureCode);
|
|
|
|
- // 添加中间计量 确定
|
|
|
|
- $('#addOk').click(function () {
|
|
|
|
|
|
+ // 上报审批 添加审批人
|
|
|
|
+ $('#addAuditor').click(() => {
|
|
const data = {
|
|
const data = {
|
|
- code: $('#mj-code').val(),
|
|
|
|
- date: $('#mj-date').val(),
|
|
|
|
|
|
+ mid: getMid(),
|
|
|
|
+ auditorId: $('#addAuditor').attr('auditorId'),
|
|
};
|
|
};
|
|
- postData('/measure/list/add', data, function (rst) {
|
|
|
|
- $('#mj-code').removeClass('is-invalid');
|
|
|
|
- $('#mj-add').modal('hide');
|
|
|
|
- }, function () {
|
|
|
|
- $('#mj-code').addClass('is-invalid');
|
|
|
|
- $('#mj-Hint').show();
|
|
|
|
|
|
+ postData('/measure/audit/add', data, (data) => {
|
|
|
|
+ $('#auditors').append(getAuditorHtml(data));
|
|
|
|
+ bindRemoveAuditor($('li[auditorId=' + data.audit_id + ']>a'));
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ // 上报审批
|
|
|
|
+ $('#auditStart').click(() => {
|
|
|
|
+ const data = { mid: getMid() };
|
|
|
|
+ postData('/measure/audit/start', data, function (data) {
|
|
|
|
+ $('#sub-sp').modal('hide');
|
|
|
|
+ // 审批状态等
|
|
|
|
+ $('#operate').html(getAuditStatuHtml(data));
|
|
|
|
+ // 审批流程列表
|
|
|
|
+ $('ul', '#sp-list').html(getAuditListHtml(data));
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ // 重新上报
|
|
|
|
+ $('#auditRestart').click(() => {
|
|
|
|
+ const data = { mid: getMid() };
|
|
|
|
+ postData('/measure/audit/start', data, function (data) {
|
|
|
|
+ $('#sub-sp2').modal('hide');
|
|
|
|
+ // 审批状态等
|
|
|
|
+ $('#operate').html(getAuditStatuHtml(data));
|
|
|
|
+ // 审批流程列表
|
|
|
|
+ $('ul', '#sp-list').html(getAuditListHtml(data));
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
|
|
@@ -132,17 +210,12 @@ $(document).ready(() => {
|
|
const col = sheet.zh_setting.cols[args.col];
|
|
const col = sheet.zh_setting.cols[args.col];
|
|
if (node && node.is_leaf) {
|
|
if (node && node.is_leaf) {
|
|
const updateData = {
|
|
const updateData = {
|
|
- mid: $('#measures').val(),
|
|
|
|
|
|
+ mid: getMid(),
|
|
bid: node.ledger_id,
|
|
bid: node.ledger_id,
|
|
update: {},
|
|
update: {},
|
|
}
|
|
}
|
|
updateData.update[col.field] = col.type === 'Number' ? parseFloat(args.editingText) : args.editingText;
|
|
updateData.update[col.field] = col.type === 'Number' ? parseFloat(args.editingText) : args.editingText;
|
|
- // begin test
|
|
|
|
- // node[col.field] = col.type === 'Number' ? parseFloat(args.editingText) : args.editingText;
|
|
|
|
- // node.deal_totalprice = node.unit_price * node.deal_quantity;
|
|
|
|
- // const nodes = treeCalc.calculateParent(sheet.zh_tree, node, ['deal_totalprice']);
|
|
|
|
- // SpreadJsObj.reLoadNodesData(sheet, nodes);
|
|
|
|
- // end test;
|
|
|
|
|
|
+
|
|
postData('/measure/billsUpdate', updateData, function (data) {
|
|
postData('/measure/billsUpdate', updateData, function (data) {
|
|
if (sheet.zh_tree.loadLeafData) {
|
|
if (sheet.zh_tree.loadLeafData) {
|
|
sheet.zh_tree.loadLeafData(data);
|
|
sheet.zh_tree.loadLeafData(data);
|
|
@@ -162,12 +235,28 @@ $(document).ready(() => {
|
|
} else {
|
|
} else {
|
|
SpreadJsObj.reLoadSheetData(billsSpread.getActiveSheet());
|
|
SpreadJsObj.reLoadSheetData(billsSpread.getActiveSheet());
|
|
}
|
|
}
|
|
|
|
+ // 审批状态等
|
|
|
|
+ $('#operate').html(getAuditStatuHtml(data));
|
|
|
|
+ $('ul', '#sp-list').html(getAuditListHtml(data));
|
|
|
|
+ // 上报审批 审批人列表
|
|
|
|
+ const ad = [];
|
|
|
|
+ for (const auditor of data.auditors) {
|
|
|
|
+ ad.push(getAuditorHtml(auditor));
|
|
|
|
+ }
|
|
|
|
+ $('#auditors').html(ad.join(''));
|
|
|
|
+ // 重新上报 审批人列表
|
|
|
|
+ if (data.status === auditConst.status.checkNo) {
|
|
|
|
+ $('#re-hint').text('重新上报后,将由 ' + data.auditors[0].name +' 继续审批');
|
|
|
|
+ $('#re-auditors').html(getAuditListHtml(data));
|
|
|
|
+ }
|
|
|
|
+ // 绑定移除方法
|
|
|
|
+ bindRemoveAuditor($('a', '#auditors'));
|
|
});
|
|
});
|
|
}
|
|
}
|
|
// 新增计量清单
|
|
// 新增计量清单
|
|
function addMeasureBills (bid) {
|
|
function addMeasureBills (bid) {
|
|
const data = {
|
|
const data = {
|
|
- mid: $('#measures').val(),
|
|
|
|
|
|
+ mid: getMid(),
|
|
operate: 'add',
|
|
operate: 'add',
|
|
bid: bid,
|
|
bid: bid,
|
|
};
|
|
};
|
|
@@ -179,7 +268,7 @@ $(document).ready(() => {
|
|
// 移除计量清单
|
|
// 移除计量清单
|
|
function removeMeasureBills (bid) {
|
|
function removeMeasureBills (bid) {
|
|
const data = {
|
|
const data = {
|
|
- mid: $('#measures').val(),
|
|
|
|
|
|
+ mid: getMid(),
|
|
operate: 'remove',
|
|
operate: 'remove',
|
|
bid: bid,
|
|
bid: bid,
|
|
};
|
|
};
|
|
@@ -199,175 +288,74 @@ $(document).ready(() => {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- if (!codeRule || codeRule.length === 0) {
|
|
|
|
- codeRule = [];
|
|
|
|
- const firstSet = new codeRuleSet($('div.modal-body', '#first'));
|
|
|
|
- // 确认规则上传服务器
|
|
|
|
- $('#setRule', '#first').bind('click', function () {
|
|
|
|
- const data = {
|
|
|
|
- rule: ruleType,
|
|
|
|
- data: JSON.stringify(codeRule),
|
|
|
|
- };
|
|
|
|
- postData('/tender/rule', data, function () {
|
|
|
|
- $('#first').modal('hide');
|
|
|
|
- $('#add-mj').modal('show');
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- $('#first').modal('show');
|
|
|
|
- } else if ($('#measures')[0].options.length === 0) {
|
|
|
|
- $('#add-mj').modal('show');
|
|
|
|
- } else {
|
|
|
|
- // 添加计量清单
|
|
|
|
- $('#addMeasureBills').click(function () {
|
|
|
|
- if ($('#measurePosList').children().length === 0) {
|
|
|
|
- $('#add-pos').modal('show');
|
|
|
|
- } else {
|
|
|
|
- $('#add-qd').modal('show');
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- // 搜索项目节部位
|
|
|
|
- $('#search-pos').click(function () {
|
|
|
|
- const keyword = $('input', '#add-pos').val();
|
|
|
|
- if (keyword !== '') {
|
|
|
|
- postData('/measure/search', {
|
|
|
|
- mid: $('#measures').val(),
|
|
|
|
- searchType: 'pos',
|
|
|
|
- keyword: keyword
|
|
|
|
- }, function (data) {
|
|
|
|
- const html = [];
|
|
|
|
- for (const d of data) {
|
|
|
|
- const tr = [];
|
|
|
|
- tr.push('<tr id="' + d.ledger_id +'">');
|
|
|
|
- tr.push('<td>' + d.code + '</td>');
|
|
|
|
- tr.push('<td>' + d.name + '</td>');
|
|
|
|
- tr.push('<td><a href="javascript: void(0)" onclick="addMeasurePos(' + d.ledger_id + ')">添加</a></td>');
|
|
|
|
- tr.push('</tr>');
|
|
|
|
- html.push(tr.join(''));
|
|
|
|
- }
|
|
|
|
- $('#searchedPosList').html(html.join(''));
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- // 选择计量清单
|
|
|
|
- $('#chooseBills').click(function () {
|
|
|
|
- $('#add-pos').modal('hide');
|
|
|
|
- $('#add-qd').modal('show');
|
|
|
|
- });
|
|
|
|
- // 搜索计量清单
|
|
|
|
- $('#search-bills').click(function () {
|
|
|
|
- const keyword = $('input', '#add-qd').val();
|
|
|
|
- if (keyword !== '') {
|
|
|
|
- postData('/measure/search', {
|
|
|
|
- mid: $('#measures').val(),
|
|
|
|
- searchType: 'bills',
|
|
|
|
- keyword: keyword
|
|
|
|
- }, function (data) {
|
|
|
|
- const html = [];
|
|
|
|
- for (const d of data) {
|
|
|
|
- const tr = [];
|
|
|
|
- const check = billsTree.getItems(d.ledger_id) ? 'checked' : '';
|
|
|
|
- tr.push('<tr id="' + d.ledger_id +'">');
|
|
|
|
- tr.push('<td>' + d.b_code + '</td>');
|
|
|
|
- tr.push('<td>' + d.name + '</td>');
|
|
|
|
- tr.push('<td>' + d.unit + '</td>');
|
|
|
|
- tr.push('<td>' + (d.unit_price ? d.unit_price : '') + '</td>');
|
|
|
|
- tr.push('<td><input type="checkbox" ' + check + '> 已选择</td>');
|
|
|
|
- tr.push('</tr>');
|
|
|
|
- html.push(tr.join(''));
|
|
|
|
- }
|
|
|
|
- $('#searchedBillsList').html(html.join(''));
|
|
|
|
- $('input[type=checkbox]', '#add-qd').click(checkMeasureBills);
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- // 选择计量范围
|
|
|
|
- $('#choosePos').click(function () {
|
|
|
|
- $('#add-qd').modal('hide');
|
|
|
|
|
|
+ // 添加计量清单
|
|
|
|
+ $('#addMeasureBills').click(function () {
|
|
|
|
+ if ($('#measurePosList').children().length === 0) {
|
|
$('#add-pos').modal('show');
|
|
$('#add-pos').modal('show');
|
|
- });
|
|
|
|
-
|
|
|
|
- getMeasureDetail($('#measures').val());
|
|
|
|
- }
|
|
|
|
- const staticSet = new codeRuleSet($('#rule'), '#static');
|
|
|
|
-});
|
|
|
|
-
|
|
|
|
-class codeRuleSet {
|
|
|
|
- constructor (obj) {
|
|
|
|
- this.body = obj;
|
|
|
|
- // 切换规则组件类型
|
|
|
|
- $('select', obj).change(function () {
|
|
|
|
- const codeType = this.selectedIndex;
|
|
|
|
- if (codeType === ruleConst.ruleType.addNo) {
|
|
|
|
- $('#format', obj).show();
|
|
|
|
- $('#text', obj).show();
|
|
|
|
- $('#text>label', obj).text('起始编号');
|
|
|
|
- $('#text>input', obj).val('001');
|
|
|
|
- const s = '0000000000' + 1;
|
|
|
|
- $('#text>input', obj).val(s.substr(s.length - $('#format>input', obj).val()));
|
|
|
|
- } else if (codeType === ruleConst.ruleType.text) {
|
|
|
|
- $('#format', obj).hide();
|
|
|
|
- $('#text', obj).show();
|
|
|
|
- $('#text>label', obj).text('文本');
|
|
|
|
- $('#text>input', obj).val('').attr('placeholder', '请在这里输入需要的文本');
|
|
|
|
- } else {
|
|
|
|
- $('#format', obj).hide();
|
|
|
|
- $('#text', obj).hide();
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- // 修改编号位数
|
|
|
|
- $('#format>input', obj).change(function () {
|
|
|
|
- const s = '0000000000' + parseInt($('#text>input', obj).val());
|
|
|
|
- $('#text>input', obj).val(s.substr(s.length - $(this).val()));
|
|
|
|
- });
|
|
|
|
- // 新增规则组件
|
|
|
|
- $('#addRule', obj).click(function () {
|
|
|
|
- const codeType = $('select', obj)[0].selectedIndex;
|
|
|
|
- const rule = {rule_type: codeType}, html = [];
|
|
|
|
- let preview;
|
|
|
|
- switch (codeType) {
|
|
|
|
- case ruleConst.ruleType.tenderName: {
|
|
|
|
- preview = $('#tenderName').text();
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- case ruleConst.ruleType.text: {
|
|
|
|
- rule.text = $('#text>input', obj).val();
|
|
|
|
- preview = rule.text;
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- case ruleConst.ruleType.inDate: {
|
|
|
|
- preview = moment().format('YYYYMM');
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- case ruleConst.ruleType.addNo: {
|
|
|
|
- rule.format = parseInt($('#format>input', obj).val());
|
|
|
|
- rule.start = parseInt($('#text>input', obj).val());
|
|
|
|
- const s = '0000000000';
|
|
|
|
- preview = s.substr(s.length - rule.format);
|
|
|
|
- break;
|
|
|
|
|
|
+ } else {
|
|
|
|
+ $('#add-qd').modal('show');
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ // 搜索项目节部位
|
|
|
|
+ $('#search-pos').click(function () {
|
|
|
|
+ const keyword = $('input', '#add-pos').val();
|
|
|
|
+ if (keyword !== '') {
|
|
|
|
+ postData('/measure/search', {
|
|
|
|
+ mid: getMid(),
|
|
|
|
+ searchType: 'pos',
|
|
|
|
+ keyword: keyword
|
|
|
|
+ }, function (data) {
|
|
|
|
+ const html = [];
|
|
|
|
+ for (const d of data) {
|
|
|
|
+ const tr = [];
|
|
|
|
+ tr.push('<tr id="' + d.ledger_id +'">');
|
|
|
|
+ tr.push('<td>' + d.code + '</td>');
|
|
|
|
+ tr.push('<td>' + d.name + '</td>');
|
|
|
|
+ tr.push('<td><a href="javascript: void(0)" onclick="addMeasurePos(' + d.ledger_id + ')">添加</a></td>');
|
|
|
|
+ tr.push('</tr>');
|
|
|
|
+ html.push(tr.join(''));
|
|
}
|
|
}
|
|
- }
|
|
|
|
- // 更新规则
|
|
|
|
- codeRule.push(rule);
|
|
|
|
- // 更新规则显示
|
|
|
|
- html.push('<span class="badge badge-light" title="' + ruleConst.ruleString[codeType] + '" rule="' + JSON.stringify(rule) + '">');
|
|
|
|
- html.push('<span>' + preview + '</span>');
|
|
|
|
- html.push('<a href="javascript: void(0);" class="text-danger" title="移除"><i class="fa fa-remove"></i></a>');
|
|
|
|
- html.push('</span>');
|
|
|
|
- const part = $('#ruleParts', obj).append(html.join(''));
|
|
|
|
- // 更新规则预览
|
|
|
|
- $('#preview', obj).text($('#preview', obj).text() + preview);
|
|
|
|
-
|
|
|
|
- $('a', part).bind('click', function () {
|
|
|
|
- const index = $('a', obj).index(this);
|
|
|
|
- codeRule.splice(index, 1);
|
|
|
|
- $(this).parent().remove();
|
|
|
|
- const rules = $('span>span', obj), ruleText = [];
|
|
|
|
- for (const r of rules) {
|
|
|
|
- ruleText.push(r.innerText);
|
|
|
|
|
|
+ $('#searchedPosList').html(html.join(''));
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ // 选择计量清单
|
|
|
|
+ $('#chooseBills').click(function () {
|
|
|
|
+ $('#add-pos').modal('hide');
|
|
|
|
+ $('#add-qd').modal('show');
|
|
|
|
+ });
|
|
|
|
+ // 搜索计量清单
|
|
|
|
+ $('#search-bills').click(function () {
|
|
|
|
+ const keyword = $('input', '#add-qd').val();
|
|
|
|
+ if (keyword !== '') {
|
|
|
|
+ postData('/measure/search', {
|
|
|
|
+ mid: getMid(),
|
|
|
|
+ searchType: 'bills',
|
|
|
|
+ keyword: keyword
|
|
|
|
+ }, function (data) {
|
|
|
|
+ const html = [];
|
|
|
|
+ for (const d of data) {
|
|
|
|
+ const tr = [];
|
|
|
|
+ const check = billsTree.getItems(d.ledger_id) ? 'checked' : '';
|
|
|
|
+ tr.push('<tr id="' + d.ledger_id +'">');
|
|
|
|
+ tr.push('<td>' + d.b_code + '</td>');
|
|
|
|
+ tr.push('<td>' + d.name + '</td>');
|
|
|
|
+ tr.push('<td>' + d.unit + '</td>');
|
|
|
|
+ tr.push('<td>' + (d.unit_price ? d.unit_price : '') + '</td>');
|
|
|
|
+ tr.push('<td><input type="checkbox" ' + check + '> 已选择</td>');
|
|
|
|
+ tr.push('</tr>');
|
|
|
|
+ html.push(tr.join(''));
|
|
}
|
|
}
|
|
- $('#preview', obj).text(ruleText.join(''));
|
|
|
|
|
|
+ $('#searchedBillsList').html(html.join(''));
|
|
|
|
+ $('input[type=checkbox]', '#add-qd').click(checkMeasureBills);
|
|
});
|
|
});
|
|
- });
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ // 选择计量范围
|
|
|
|
+ $('#choosePos').click(function () {
|
|
|
|
+ $('#add-qd').modal('hide');
|
|
|
|
+ $('#add-pos').modal('show');
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ getMeasureDetail(getMid());
|
|
|
|
+});
|