|
@@ -354,6 +354,7 @@ $(document).ready(function () {
|
|
|
scroll(ele, step);
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
// 动态绑定(新增的也能监听到)
|
|
|
$(rationBodySelector).on("drag", dragSelector, function (ev) {
|
|
|
const { clientX, clientY } = ev;
|
|
@@ -434,6 +435,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");
|
|
@@ -820,6 +872,30 @@ $(document).ready(function () {
|
|
|
*
|
|
|
* @return {void|boolean}
|
|
|
*/
|
|
|
+
|
|
|
+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);
|
|
|
+ });
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
function initCompilation() {
|
|
|
let billListData = billList === undefined ? [] : JSON.parse(billList);
|
|
|
let rationLibData = rationList === undefined ? [] : JSON.parse(rationList);
|