|
@@ -58,6 +58,7 @@ function getValueHtml(value) {
|
|
|
const html = [];
|
|
|
for (const v of value) {
|
|
|
html.push('<tr name="value" vid="' + v.id + '">');
|
|
|
+ html.push('<td><a href="javascript:void(0);" class="up-btn mr-2" title="上移"><i class="fa fa-caret-up"></i></a><a href="javascript:void(0);" class="down-btn" title="下移"><i class="fa fa-caret-down "></i></a></td>');
|
|
|
html.push('<td><input class="form-control form-control-sm" name="value" placeholder="请输入值" value="' + v.value + '" vid ="' + v.id + '"></td>');
|
|
|
html.push('<td>', v.relaTenders.length + v.newTenders.length ,'</td>');
|
|
|
html.push('<td><a href="javascript: void(0);" class="text-danger" name="del-value" vid="' + v.id + '">删除</a></td>');
|
|
@@ -113,11 +114,14 @@ function bindCategoryValueControl() {
|
|
|
const value = _.find(editCate.value, function (v) {
|
|
|
return v.id == vid;
|
|
|
});
|
|
|
+ const delHtml = $(this).parents('td').html();
|
|
|
+ const _self = $(this).parents('td');
|
|
|
$(this).remove();
|
|
|
if (value.delete) { return; }
|
|
|
|
|
|
if (value.relaTenders.length > 0) {
|
|
|
// 提示用户转移标段
|
|
|
+ _self.html(delHtml);
|
|
|
$('#tender-count').text(value.relaTenders.length).attr('vid', vid);
|
|
|
$('#tender-target').html(getValidValueHtml(vid));
|
|
|
$('input[type=radio]', '#tender-target')[0].checked = true;
|
|
@@ -293,4 +297,23 @@ $(document).ready(() => {
|
|
|
$('#del-cate').modal('hide');
|
|
|
});
|
|
|
});
|
|
|
+
|
|
|
+ // 上移值
|
|
|
+ $('body').on('click', '.up-btn', function () {
|
|
|
+ const prev = $(this).parents("tr").prev();
|
|
|
+ const prevIndex = parseInt($(prev).index('#value-list tr'));
|
|
|
+ $(this).parents("tr").insertBefore(prev);
|
|
|
+ // if(prevIndex === 1){
|
|
|
+ // console.log('hello');
|
|
|
+ // }
|
|
|
+ });
|
|
|
+ // 下一值
|
|
|
+ $('body').on('click', '.down-btn', function () {
|
|
|
+ const next = $(this).parents("tr").next();
|
|
|
+ const nextIndex = parseInt($(next).index('#value-list tr'));
|
|
|
+ const nowlength = $('#value-list tr').length - 1;
|
|
|
+ if (nextIndex < nowlength) {
|
|
|
+ $(this).parents("tr").insertAfter(next);
|
|
|
+ }
|
|
|
+ });
|
|
|
});
|