|
@@ -192,6 +192,25 @@ $(document).ready(function () {
|
|
|
$("select[name='ration_lib']").html(html);
|
|
|
});
|
|
|
|
|
|
+ $("#addRatioBtn").click(function () {
|
|
|
+ let rationLibData = rationList === undefined ? [] : JSON.parse(rationList);
|
|
|
+ let unSelectLibs = [];
|
|
|
+ for (let lib of rationLibData) {
|
|
|
+ if (
|
|
|
+ $("input:hidden[name=ration_lib][data-id = " + lib.id + "]").length > 0
|
|
|
+ ) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ unSelectLibs.push(lib);
|
|
|
+ }
|
|
|
+ let html = "";
|
|
|
+ for (let tmp of unSelectLibs) {
|
|
|
+ let tmpHtml = '<option value="' + tmp.id + '">' + tmp.name + "</option>";
|
|
|
+ html += tmpHtml;
|
|
|
+ }
|
|
|
+ $("select[name='ration_lib']").html(html);
|
|
|
+ });
|
|
|
+
|
|
|
$("#ration_lib-search-box").on("input", function () {
|
|
|
var keyword = $(this).val().toLowerCase().trim(); // 获取输入的关键字并转为小写
|
|
|
// 遍历所有option元素
|
|
@@ -367,6 +386,57 @@ $(document).ready(function () {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+ // 排序点击
|
|
|
+ $("#openBillSort").click(function () {
|
|
|
+ let html = "";
|
|
|
+ const libs = $("input:hidden[name='bill_lib']");
|
|
|
+ for (let libEle of libs) {
|
|
|
+ let lib = JSON.parse($(libEle).val());
|
|
|
+
|
|
|
+ html += `
|
|
|
+ <p class="form-control-static billLibItem">
|
|
|
+ <a class="pull-right " title="上移" id="list_${lib.id}" onclick="libUp(${
|
|
|
+ lib.id
|
|
|
+ })">
|
|
|
+ <span class="glyphicon glyphicon-arrow-up"></span>
|
|
|
+ <input type="hidden" class="sort_temp_value" value='${JSON.stringify(
|
|
|
+ { id: lib.id, name: lib.name }
|
|
|
+ )}'>
|
|
|
+ </a>
|
|
|
+ <a class="pull-right stdBillUp" title="下移" onclick="libDown(${
|
|
|
+ lib.id
|
|
|
+ })">
|
|
|
+ <span class="glyphicon glyphicon-arrow-down"></span>
|
|
|
+ </a>
|
|
|
+ ${lib.name}
|
|
|
+ </p> `;
|
|
|
+ }
|
|
|
+ $("#stdBillList").html(html);
|
|
|
+ $("#stdBillSort").modal("show");
|
|
|
+ });
|
|
|
+
|
|
|
+ $("#billSortConfirm").click(function () {
|
|
|
+ let html = "";
|
|
|
+ const libs = $(".sort_temp_value");
|
|
|
+ libs.each(function (index) {
|
|
|
+ const lib = JSON.parse($(this).val());
|
|
|
+ html += `
|
|
|
+ <p class="form-control-static">
|
|
|
+ <a class="pull-right text-danger remove-lib" data-model="bill" title="移除">
|
|
|
+ <span class="glyphicon glyphicon-remove"></span>
|
|
|
+ </a>
|
|
|
+ <input type="hidden" name="bill_lib" data-id="${
|
|
|
+ lib.id
|
|
|
+ }" value='${JSON.stringify({ id: lib.id, name: lib.name })}'>
|
|
|
+ ${index === 0 ? '<i class="glyphicon glyphicon-flag"></i> ' : ""}${
|
|
|
+ lib.name
|
|
|
+ }
|
|
|
+ </p>`;
|
|
|
+ });
|
|
|
+ $(".bill-list").html(html);
|
|
|
+ $("#stdBillSort").modal("hide");
|
|
|
+ });
|
|
|
+
|
|
|
// 添加
|
|
|
$(".add-compilation").click(function () {
|
|
|
model = $(this).data("model");
|
|
@@ -754,6 +824,29 @@ $(document).ready(function () {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
+function libUp(id) {
|
|
|
+ const $item = $(`#list_${id}`).closest(".billLibItem");
|
|
|
+ const $prevItem = $item.prev();
|
|
|
+
|
|
|
+ if ($prevItem.length) {
|
|
|
+ $item.fadeOut(200, function () {
|
|
|
+ $prevItem.before($item);
|
|
|
+ $item.fadeIn(200);
|
|
|
+ });
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function libDown(id) {
|
|
|
+ const $item = $(`#list_${id}`).closest(".billLibItem");
|
|
|
+ const $nextItem = $item.next();
|
|
|
+ if ($nextItem.length) {
|
|
|
+ $item.fadeOut(200, function () {
|
|
|
+ $nextItem.after($item);
|
|
|
+ $item.fadeIn(200);
|
|
|
+ });
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* 初始化
|
|
|
*
|