Files
EPCMS/src/main/webapp/WEB-INF/template/extraField/dialog/edit.html
2024-04-29 17:04:35 +08:00

70 lines
2.4 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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>