初始版本
This commit is contained in:
69
src/main/webapp/WEB-INF/template/extraField/dialog/edit.html
Normal file
69
src/main/webapp/WEB-INF/template/extraField/dialog/edit.html
Normal file
@@ -0,0 +1,69 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
|
||||
<div class="dialog functionDialog common_dialog_functionDialog" th:data-width="800" th:data-height="600">
|
||||
<div class="title">
|
||||
<span th:text="${title}"></span>
|
||||
<div class="dialogClose">╳</div>
|
||||
</div>
|
||||
<div class="dialogBody addPage">
|
||||
<form>
|
||||
<div class="simpleAddBody submitBody">
|
||||
<div th:each="item : ${list}" class="input-wrapper">
|
||||
<label>显示:</label>
|
||||
<div class="common-single-checkbox" th:data-init="${item.available}"></div>
|
||||
<input class="text data-input" type="text" th:name="${item.fieldName}" th:value="${item.name}">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="dialogFooter">
|
||||
<a class="cancel">取消</a>
|
||||
<a class="confirm">保存</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(function () {
|
||||
$dialog = $(".common_dialog_functionDialog");
|
||||
|
||||
Dialog.start({
|
||||
dialog: $dialog,
|
||||
confirm: function (close) {
|
||||
submit();
|
||||
close();
|
||||
}
|
||||
});
|
||||
|
||||
function submit() {
|
||||
var extraFields = [];
|
||||
$dialog.find('.input-wrapper').each(function () {
|
||||
extraFields.push({
|
||||
fieldName: $(this).find('.data-input').attr('name'),
|
||||
name: $(this).find('.data-input').val(),
|
||||
available: $(this).find('.common-single-checkbox').attr('data-flag')
|
||||
})
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
url: '/admin/extraField/extend.html',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
space: '[[${space}]]',
|
||||
extraFields: JSON.stringify(extraFields)
|
||||
},
|
||||
success: function (res) {
|
||||
if (res.errorCode !== '0') {
|
||||
Dialog.error(res.errorInfo);
|
||||
} else {
|
||||
Dialog.success("保存成功");
|
||||
Dialog.close($dialog);
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
console.log('ajax error');
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</html>
|
||||
Reference in New Issue
Block a user