|
@@ -161,13 +161,13 @@ function bindCategoryControl() {
|
|
|
const list = $('#value-list');
|
|
|
list.html(getValueHtml(editCate.value) + '<tr id="add-value-row"><td colspan="3"><a href="javascript: void(0);">添加新值</a></td></tr>');
|
|
|
$('#add-value-row').click(function () {
|
|
|
- const newID = _.maxBy(editCate.value, function (v) { return v.id; }).id + 1;
|
|
|
+ const newID = editCate.value.length > 0 ? _.maxBy(editCate.value, function (v) { return v.id; }).id + 1 : 1;
|
|
|
const newValue = {
|
|
|
isNew: true,
|
|
|
id: newID,
|
|
|
value: '',
|
|
|
relaTenders: [],
|
|
|
- newTenders: [],
|
|
|
+ newTenders: editCate.value.length > 0 ? [] : tenders.concat([]),
|
|
|
};
|
|
|
editCate.value.push(newValue);
|
|
|
$(this).before(getValueHtml([newValue]));
|