|
|
@@ -6,6 +6,8 @@ $(function () {
|
|
|
let dispNameArr;
|
|
|
let preDeleteId = null;
|
|
|
let deleteCount = 0;
|
|
|
+ let selCompilationId,
|
|
|
+ compilationsArr = [];
|
|
|
$('#del').on('hidden.bs.modal', function () {
|
|
|
deleteCount = 0;
|
|
|
});
|
|
|
@@ -124,7 +126,9 @@ $(function () {
|
|
|
});
|
|
|
|
|
|
});
|
|
|
- getCompilationList();
|
|
|
+ getCompilationList(function (data) {
|
|
|
+ compilationsArr = data.compilation;
|
|
|
+ });
|
|
|
|
|
|
// 导入原始数据按钮
|
|
|
let rationRepId = 0;
|
|
|
@@ -216,6 +220,46 @@ $(function () {
|
|
|
}
|
|
|
window.location.href = '/rationRepository/api/export?rationRepId=' + id;
|
|
|
});
|
|
|
+
|
|
|
+ //设置补充定额库章节树模板
|
|
|
+ $("#showArea").on("click", ".set-comple", function () {
|
|
|
+ let id = $(this).data("id");
|
|
|
+ id = parseInt(id);
|
|
|
+ if (isNaN(id) || id <= 0) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ rationRepId = id;
|
|
|
+ $('#templateA').addClass('disabled');
|
|
|
+ $('#template').modal('show');
|
|
|
+ $('#compilations').empty();
|
|
|
+ for (let data of compilationsArr) {
|
|
|
+ let $opt = $(`<option value="${data._id}">${data.name}</option>`);
|
|
|
+ $('#compilations').append($opt);
|
|
|
+ }
|
|
|
+ $('#compilations').change();
|
|
|
+ });
|
|
|
+ $('#compilations').change(function () {
|
|
|
+ selCompilationId = $(this).select().val();
|
|
|
+ CommonAjax.get(`api/sectionTemplateCount/${selCompilationId}`, function (rstData) {
|
|
|
+ rstData.data.count > 0 ?
|
|
|
+ $('#templateText').text('该费用定额下已有定额章节树模板数据,是否确认覆盖数据?') :
|
|
|
+ $('#templateText').text('确认是否将此库的章节树设置成该费用定额下补充定额章节树模板?');
|
|
|
+ $('#templateA').removeClass('disabled');
|
|
|
+ });
|
|
|
+ });
|
|
|
+ $('#templateA').click(function () {
|
|
|
+ if (rationRepId <= 0 && selCompilationId) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ $.bootstrapLoading.start();
|
|
|
+ CommonAjax.post('api/initSectionTemplate', {rationLibId: rationRepId, compilationId: selCompilationId}, function () {
|
|
|
+ $.bootstrapLoading.end();
|
|
|
+ $('#template').modal('hide');
|
|
|
+ }, function () {
|
|
|
+ $.bootstrapLoading.end();
|
|
|
+ $('#template').modal('hide');
|
|
|
+ });
|
|
|
+ });
|
|
|
});
|
|
|
|
|
|
function getAllRationLib(callback){
|
|
|
@@ -248,6 +292,7 @@ function getAllRationLib(callback){
|
|
|
"<td><a class='btn btn-secondary btn-sm import-source' href='javacript:void(0);' data-id='"+ id +"' title='导入原始数据'><i class='fa fa-sign-in fa-rotate-90'></i>导入</a></td>" +
|
|
|
"<td><a class='btn btn-success btn-sm export' href='javacript:void(0);' data-toggle='modal' data-id='"+ id +"' data-target='#emport' title='导出内部数据'><i class='fa fa-sign-out fa-rotate-270'></i>导出</a> " +
|
|
|
"<a class='btn btn-secondary btn-sm import-data' href='javacript:void(0);' data-id='"+ id +"' title='导入内部数据'><i class='fa fa-sign-in fa-rotate-90'></i>导入</a></td>" +
|
|
|
+ "<td><a class='btn btn-secondary btn-sm set-comple' href='javacript:void(0);' data-id='"+ id +"' title='将章节树设为补充模板数据'><i class='fa fa-sign-in fa-rotate-90'></i>设置</a></td>" +
|
|
|
"</tr>");
|
|
|
$("#tempId").attr("id", id);
|
|
|
}
|
|
|
@@ -256,13 +301,12 @@ function getAllRationLib(callback){
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
-function getCompilationList(){
|
|
|
+function getCompilationList(callback){
|
|
|
$.ajax({
|
|
|
type: 'post',
|
|
|
url: 'api/getCompilationList',
|
|
|
dataType: 'json',
|
|
|
success: function (result) {
|
|
|
- console.log(result);
|
|
|
//addoptions
|
|
|
for(let i = 0; i < result.data.compilation.length; i++){
|
|
|
let $option = $("<option >"+ result.data.compilation[i].name +"</option>");
|
|
|
@@ -274,7 +318,6 @@ function getCompilationList(){
|
|
|
let compilationId = result.data.compilation[0]._id;
|
|
|
//console.log(compilationId);
|
|
|
let gljLibOps = getGljLibOps(compilationId, result.data.gljLibs);
|
|
|
- console.log(gljLibOps);
|
|
|
for(let i = 0; i < gljLibOps.length; i++){
|
|
|
let $option = $("<option >"+ gljLibOps[i].dispName +"</option>");
|
|
|
$option.val(gljLibOps[i].ID);
|
|
|
@@ -292,6 +335,7 @@ function getCompilationList(){
|
|
|
$('#gljLibSels').append($option);
|
|
|
}
|
|
|
});
|
|
|
+ callback(result.data);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
@@ -336,6 +380,7 @@ function createRationLib(rationObj, dispNamesArr){
|
|
|
"<td><a class='btn btn-secondary btn-sm import-source' href='javacript:void(0);' data-id='"+ id +"' title='导入原始数据'><i class='fa fa-sign-in fa-rotate-90'></i>导入</a></td>" +
|
|
|
"<td><a class='btn btn-success btn-sm export' href='javacript:void(0);' data-toggle='modal' data-id='"+ id +"' data-target='#emport' title='导出内部数据'><i class='fa fa-sign-out fa-rotate-270'></i>导出</a> " +
|
|
|
"<a class='btn btn-secondary btn-sm import-data' href='javacript:void(0);' data-id='"+ id +"' title='导入内部数据'><i class='fa fa-sign-in fa-rotate-90'></i>导入</a></td>" +
|
|
|
+ "<td><a class='btn btn-secondary btn-sm set-comple' href='javacript:void(0);' data-id='"+ id +"' title='将章节树设为补充模板数据'><i class='fa fa-sign-in fa-rotate-90'></i>设置</a></td>" +
|
|
|
"</tr>");
|
|
|
$("#tempId").attr("id", id);
|
|
|
}
|