You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

230 lines
11 KiB

2 years ago
<!DOCTYPE html>
<!--解决idea thymeleaf 表达式模板报红波浪线-->
<!--suppress ALL -->
<html xmlns:th="http://www.thymeleaf.org">
<head>
<!-- 引入公用部分 -->
<script th:replace="common/head::static"></script>
<!-- 样式 -->
<link th:href="@{/css/common/contianer.css}" rel="stylesheet" type="text/css"/>
<style>
.layui-form-label {
width: 90px;
}
.layui-form-item .layui-input-inline {
width: 260px;
}
</style>
<script th:inline="javascript">
const file = /*[[${file}]]*/ {};
</script>
</head>
<body>
<div class="layui-row">
<!-- 操作表单 -->
<div class="layui-col-md12">
<div class="layui-card" style="margin-bottom: 0">
<!--<div class="layui-card-header">文件选择</div>-->
<div class="layui-card-body">
<div class="layui-upload">
<h2 th:text="${file.fileName}" style="margin-bottom: 10px;"></h2>
</div>
<form class="layui-form dynamic-form" id="file-form" lay-filter="file-form" style="border: 1px solid #eee; padding-top:15px">
2 years ago
<input type="hidden" name="id">
<input type="hidden" name="fileName">
<input type="hidden" name="entityId">
<input type="hidden" name="fileSuffix">
<input type="hidden" name="fileType">
<input type="hidden" name="fileSize">
<input type="hidden" name="path">
<input type="hidden" name="remark">
<input type="hidden" name="isChunk">
<input type="hidden" name="isMerge">
<input type="hidden" name="currentChunkIndex">
<input type="hidden" name="MD5">
<input type="hidden" name="isFirst">
<div class="layui-form-item"
th:each="field,iterStat : ${allUploadFormConfig.get(file.dataType)}"
th:if="${field.isShow && field.fieldName != 'dataType'}"
th:style="${field.fieldType == 'textarea' ? 'width: calc(100% - 30px);' : ''}"
th:with="username=*{userName}">
<label th:if="${field.isRequired}" class="layui-form-label">
<label style="color: red">*</label>
<label th:text="${field.showTitle}">*</label>
</label>
<label th:if="${!field.isRequired}" class="layui-form-label" th:text="${field.showTitle}"></label>
<div class="layui-input-block">
<!-- 文本框类型 -->
<!-- 任务时间修改为可编辑 2024/04/10 by xiongcl -->
<input class="layui-input" type="text" autocomplete="off"
th:id="${field.fieldName == 'inputDate' ? 'edit-date' : 'edit' }"
th:if="${field.fieldType == 'input' || field.fieldType == 'date'}"
th:name="${field.fieldName}"
th:value="${field.fieldName}"
th:disabled="${field.isDisabled}"
th:placeholder="${field.showTitle}"
th:readonly="${field.fieldName == 'entryStaff'}"
th:lay-verify="${field.isRequired ? 'required' : ''}">
<!-- 文本域类型 -->
<textarea class="layui-textarea" type="text" autocomplete="off"
th:if="${field.fieldType == 'textarea'}"
th:name="${field.fieldName}"
th:disabled="${field.isDisabled}"
th:placeholder="${field.showTitle}"
th:lay-verify="${field.isRequired ? 'required' : ''}"></textarea>
<th:block th:if="${field.fieldType == 'radio' && field.isShow}">
<input class="layui-inline" type="radio"
th:each="exp, stat : ${#strings.listSplit(field.dictType, ';')}"
th:with="tmp=${#strings.arraySplit(exp, '-')}, value=${tmp[0]}, title=${tmp[1]}, checked=${#arrays.length(tmp)==3?tmp[2]:false}"
th:name="${field.fieldName}"
th:value="${value}"
th:title="${title}"
th:checked="${checked}"
/>
</th:block>
<!-- 数据字典类型 -->
<div dict-component="select"
th:if="${field.fieldType == 'dict'}"
th:disabled="${field.isDisabled}"
th:dict-type="${field.dictType}"
th:dict-name="${field.fieldName}"
th:id="${'dict-'+field.fieldName}"></div>
2 years ago
</div>
</div>
<div class="layui-form-item" style="width: 100%" th:each="labelSet, iterState:${LabelConfigSet}">
2 years ago
<label class="layui-form-label" th:text="${labelSet.fieldTitle}">标签类型</label>
<div class="layui-input-block">
<div class="label-set-component"
th:data-id="${labelSet.id}"
th:data-field-title="${labelSet.fieldTitle}"
th:data-label-id="${labelSet.labelId}"
th:data-label-title="${labelSet.labelTitle}"
th:data-label-id-path="${labelSet.labelIdPath}"
th:data-label-title-path="${labelSet.labelTitlePath}"></div>
</div>
2 years ago
</div>
<div class="layui-form-item" style="width: 100%">
2 years ago
<label class="layui-form-label"><a class="label-type choose-data add-other" id="addOtherLabelBtn">添加</a>其他标签</label>
<div class="layui-input-block other-label-item">
<div class="label-set-component other-label" th:data-field-title="其他标签"></div>
</div>
2 years ago
</div>
<button class="layui-btn layui-btn-sm" id="btn_submit"
style="width: 100%;position: absolute; left: -50px; height: 0; border:0">
2 years ago
</button>
</form>
</div>
</div>
</div>
</div>
</body>
<!-- js -->
<script th:replace="common/head::static-foot"></script>
<script type="text/javascript">
let saveResult = {
done: false,
success: false,
data: null
};
let editPage;
layui.use(['layer', 'form', 'laydate', 'dict', 'datalabel', 'editPage'], function () {
let form = layui.form,
layer = layui.layer,
laydate = layui.laydate;
editPage = layui.editPage;
const requestParam = layui.url().search;
editPage.init({
formId: 'file-form',
formInitUrl: requestParam.id ? `${ctx}/sys/file/get/${requestParam.id}` : '',
formSubmitInvoke: async function () { // 自定义表单提交时的方法
let response,formVal = form.val('file-form');
if (!formVal['secretLevel']) {
showErrorMsg("请选择文件密级");
return false;
}
if(formVal.exerciseData === '1'){
if(!formVal['inputDate']){
showErrorMsg('任务时间不能为空');return false;
}
if(!formVal['source']){
showErrorMsg('文件来源不能为空');return false;
}
if(!formVal['taskCode']){
showErrorMsg('任务代号不能为空');return false;
}
if(!formVal['taskNature']){
showErrorMsg('任务性质不能为空');return false;
}
if(!formVal['troopCode']){
showErrorMsg('部队代号不能为空');return false;
}
if(!formVal['equipmentModel']){
showErrorMsg('装备型号不能为空');return false;
}
}
formVal.labels = layui.datalabel.getData(formVal.id, 'file');
await $.ajax({
url: `${ctx}/sys/file/save`,
type: 'post',
data: formVal,
async: false,
success: res => response = res,
error: () => response = {flag: false, msg: '保存失败'}
})
return response
},
formInitDone: function (data) {
initDictData(data);
if (file.labels) {
layui.datalabel.setData(file.labels)
}
if (data.exerciseData === '1') {
$('.star-mark').show();
}
form.on('radio(exerciseData)', function ({value}) {
if (value === '1') {
$('.star-mark').show();
} else {
$('.star-mark').hide();
}
});
}
});
function initDictData(file) {
layui.dict.setData('dict-data-form', file);
layui.dict.setData('dict-target-type', file);
layui.dict.setData('dict-task-nature', file);
}
function renderLaydate() {
laydate.render({
elem: '#input-data',
format: "yyyy-MM-dd HH:mm:ss",
type: 'datetime',
value: new Date(),
isInitValue: true,
});
}
<!-- 任务时间修改为可编辑 2024/04/10 by xiongcl -->
laydate.render({
elem: '#edit-date',
format: "yyyy-MM-dd HH:mm:ss",
type: 'datetime',
value: new Date(),
isInitValue: true,
});
2 years ago
});
function save() {
return editPage.submit();
}
</script>
</html>