|
@@ -452,9 +452,12 @@ $(function () {
|
|
|
postData(preUrl + '/save', { type: 'contract_list' }, function (result) {
|
|
|
contracts = result.contracts;
|
|
|
contractTrees = result.contractTrees;
|
|
|
- sqTree.loadDatas(contractTrees);
|
|
|
+ sqTree.loadDatas(contractTrees.concat(contracts));
|
|
|
const level2Tree = _.filter(sqTree.nodes, function (item) {
|
|
|
- return item.level === 2;
|
|
|
+ return item.level === 2 && !item.c_code;
|
|
|
+ });
|
|
|
+ contracts = _.filter(sqTree.nodes, function (item) {
|
|
|
+ return item.c_code && item.c_code !== '';
|
|
|
});
|
|
|
makeContractListHtml(contracts);
|
|
|
let html2 = '<option value="0">全部</option>';
|
|
@@ -465,13 +468,14 @@ $(function () {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- function makeContractListHtml(list) {
|
|
|
+ function makeContractListHtml(list, hide = false) {
|
|
|
let html = '';
|
|
|
- for (const c of list) {
|
|
|
- const tree = _.find(contractTrees, function (item) {
|
|
|
- return item.contract_id === parseInt(c.full_path.split('-')[1] || 0);
|
|
|
- });
|
|
|
- html += `<tr class="text-center">
|
|
|
+ if (!hide) {
|
|
|
+ for (const c of list) {
|
|
|
+ const tree = _.find(contractTrees, function (item) {
|
|
|
+ return item.contract_id === parseInt(c.full_path.split('-')[1] || 0);
|
|
|
+ });
|
|
|
+ html += `<tr class="text-center tr-show" data-id="${c.id}">
|
|
|
<td><input type="checkbox" data-contract-id="${c.id}" ${_.findIndex(contractList, { cid: c.id }) !== -1 ? 'checked disabled' : ''}></td>
|
|
|
<td>${tree ? tree.name : ''}</td>
|
|
|
<td class="text-left">${c.c_code}</td>
|
|
@@ -480,8 +484,14 @@ $(function () {
|
|
|
<td>${c.entity}</td>
|
|
|
<td>${c.bank_account}</td>
|
|
|
</tr>`;
|
|
|
+ }
|
|
|
+ $('#contract-list').html(html);
|
|
|
+ } else {
|
|
|
+ $('#contract-list tr').removeClass('tr-show').hide();
|
|
|
+ for (const c of list) {
|
|
|
+ $(`#contract-list tr[data-id="${c.id}"]`).addClass('tr-show').show();
|
|
|
+ }
|
|
|
}
|
|
|
- $('#contract-list').html(html);
|
|
|
}
|
|
|
|
|
|
$('body').on('change', '#contract-tree', function () {
|
|
@@ -506,11 +516,11 @@ $(function () {
|
|
|
const list = _.filter(contracts, function (item) {
|
|
|
return (selectTree !== '0' ? _.includes(item.full_path, '-' + selectTree + '-') : true) && (keyword !== '' ? (item.c_code.indexOf(keyword) > -1 || item.name.indexOf(keyword) > -1) : true);
|
|
|
});
|
|
|
- makeContractListHtml(list);
|
|
|
+ makeContractListHtml(list, true);
|
|
|
}
|
|
|
|
|
|
$('#select-all-contract').click(function () {
|
|
|
- $('#contract-list input:not(:disabled)').prop('checked', $(this).prop('checked'));
|
|
|
+ $('#contract-list tr[class*="tr-show"] input:not(:disabled)').prop('checked', $(this).prop('checked'));
|
|
|
});
|
|
|
|
|
|
$('#add-contract-btn').click(function () {
|