新增APP的动态表单设置,修改原动态表单文件名称

This commit is contained in:
wenc000 2020-02-10 00:16:55 +08:00
parent bedc825ede
commit 0313511b5c
8 changed files with 508 additions and 52 deletions

View File

@ -0,0 +1,40 @@
package com.cm.common.plugin.controller.app.routes;
import com.cm.common.constants.ISystemConstant;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
/**
* When you feel like quitting. Think about why you started
* 当你想要放弃的时候想想当初你为何开始
*
* @ClassName: DynamicFormAppRouteController
* @Description: 动态表单APP
* @Author: WangGeng
* @Date: 2020/2/8 10:25 下午
* @Version: 1.0
**/
@Api(tags = ISystemConstant.API_TAGS_APP_ROUTE_PREFIX + "动态表单页面接口")
@Controller
@RequestMapping(ISystemConstant.APP_ROUTE_PREFIX + "/dynamicform")
public class DynamicFormAppRouteController {
@ApiOperation(value = "动态表单新增页面", notes = "动态表单新增页面接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "tableName", value = "表名", paramType = "path")
})
@GetMapping("savedynamicformrelease/{tableName}")
public ModelAndView saveDynamicForm(@PathVariable("tableName") String tableName) {
ModelAndView mv = new ModelAndView("dynamic/form/app/save-dynamic-form.html");
mv.addObject("tableName", tableName);
return mv;
}
}

View File

@ -54,7 +54,7 @@ public class DynamicFormRouteController extends AbstractController {
})
@GetMapping("savedynamicform/{tableName}")
public ModelAndView saveDynamicForm(@PathVariable("tableName") String tableName) {
ModelAndView mv = new ModelAndView("dynamic/form/savedynamicform");
ModelAndView mv = new ModelAndView("dynamic/form/save-dynamic-form");
mv.addObject("tableName", tableName);
List<DynamicFormFormShowFieldDTO> dynamicFormFormShowFieldDTOs = dynamicFormService.listFormShowFieldOfPage(tableName);
@ -71,13 +71,14 @@ public class DynamicFormRouteController extends AbstractController {
})
@GetMapping("updatedynamicform/{tableName}/{uuidValue}")
public ModelAndView updateDynamicForm(@PathVariable("tableName") String tableName, @PathVariable("uuidValue") String uuidValue) {
ModelAndView mv = new ModelAndView("dynamic/form/updatedynamicform");
ModelAndView mv = new ModelAndView("dynamic/form/update-dynamic-form");
mv.addObject("tableName", tableName);
mv.addObject("uuidValue", uuidValue);
List<DynamicFormFormShowFieldDTO> dynamicFormFormShowFieldDTOs = dynamicFormService.listFormShowFieldOfPage(tableName);
mv.addObject("dynamicFormFormShowFieldDTOList", dynamicFormFormShowFieldDTOs);
setDynamicFieldData(mv, dynamicFormFormShowFieldDTOs);
setCurrentUserIdAndNameValues(mv, dynamicFormFormShowFieldDTOs);
return mv;
}
@ -88,7 +89,7 @@ public class DynamicFormRouteController extends AbstractController {
})
@GetMapping("updatedynamicjoinform/{tableName}/{joinKey}/{joinId}")
public ModelAndView updateDynamicJoinForm(@PathVariable("tableName") String tableName, @PathVariable("joinKey") String joinKey, @PathVariable("joinId") String joinId) {
ModelAndView mv = new ModelAndView("dynamic/form/updatedynamicjoinform");
ModelAndView mv = new ModelAndView("dynamic/form/update-dynamic-join-form");
mv.addObject("tableName", tableName);
mv.addObject("joinKey", joinKey);
mv.addObject("joinId", joinId);
@ -139,7 +140,7 @@ public class DynamicFormRouteController extends AbstractController {
})
@GetMapping("listdynamicform/{tableName}")
public ModelAndView listDynamicForm(@PathVariable("tableName") String tableName) {
ModelAndView mv = new ModelAndView("dynamic/form/listdynamicform");
ModelAndView mv = new ModelAndView("dynamic/form/list-dynamic-form");
mv.addObject("tableName", tableName);
mv.addObject("uuidField", String.format("%sId", tableName));
mv.addObject("dynamicListFormShowFieldDTOList", dynamicFormService.listListShowFieldOfPage(tableName));

View File

@ -55,7 +55,7 @@ public class DynamicTableServiceImpl extends AbstractService implements IDynamic
@Override
public void deleteTableColumnType(String tableName, String deleteDynamicFormField) throws RemoveException {
StringBuilder deleteTableColumnTypeSQL = new StringBuilder(String.format("ALTER TABLE `%s%s` DROP %s", DYNAMIC_TABLE_PREFIX, WStringUtil.lowerUpper2UnderLine(tableName), deleteDynamicFormField));
StringBuilder deleteTableColumnTypeSQL = new StringBuilder(String.format("ALTER TABLE `%s%s` DROP `%s`", DYNAMIC_TABLE_PREFIX, WStringUtil.lowerUpper2UnderLine(tableName), deleteDynamicFormField));
dynamicTableDao.deleteTableColumnType(deleteTableColumnTypeSQL.toString());
}

View File

@ -0,0 +1,385 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<base th:href="${#httpServletRequest.getScheme() + '://' + #httpServletRequest.getServerName() + ':' + #request.getServerPort() + #request.getContextPath() + '/'} ">
<meta charset="UTF-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="assets/wxpage/css/weui.css"/>
<link rel="stylesheet" href="assets/wxpage/css/weuix.css"/>
<style>
.layui-m-layercont {height: 100%;}
.page-iframe {width: 100%;height:100%;border: 0;}
</style>
</head>
<body>
<div id="app" class="weui-cells weui-cells_form" style="margin-top:0;">
<!-- 文本start -->
<div class="form-item">
<div class="weui-cells__title">输入文本</div>
<div class="weui-cell">
<div class="weui-cell__bd">
<input class="weui-input" placeholder="请输入文本" type="text">
</div>
</div>
</div>
<!-- 文本end -->
<!-- 时间戳start -->
<div class="form-item">
<div class="weui-cells__title">时间戳</div>
<div class="weui-cell">
<div class="weui-cell__bd">
<input class="weui-input" id="datetime" value="" type="text" placeholder="点击选择时间戳">
</div>
</div>
</div>
<!-- 时间戳end -->
<!-- 日期start -->
<div class="form-item">
<div class="weui-cells__title">日期</div>
<div class="weui-cell">
<div class="weui-cell__bd">
<input class="weui-input" id="date" value="" type="text" placeholder="点击选择日期">
</div>
</div>
</div>
<!-- 日期end -->
<!-- 整形start -->
<div class="form-item">
<div class="weui-cells__title">整形</div>
<div class="weui-cell">
<div class="weui-cell__bd">
<input class="weui-input" type="number" pattern="[0-9]*" placeholder="请输入整形">
</div>
</div>
</div>
<!-- 整形end -->
<!-- 双精度start -->
<div class="form-item">
<div class="weui-cells__title">双精度</div>
<div class="weui-cell">
<div class="weui-cell__bd">
<input class="weui-input" type="number" step="0.01" pattern="^[-//+]?//d+(//.//d*)?|//.//d+$" placeholder="请输入双精度">
</div>
</div>
</div>
<!-- 双精度end -->
<!-- 文本域start -->
<div class="form-item">
<div class="weui-cells__title">文本域</div>
<div class="weui-cell">
<div class="weui-cell__bd">
<textarea class="weui-textarea" placeholder="请输入文本域" rows="4"></textarea>
</div>
</div>
</div>
<!-- 文本域end -->
<!-- 富文本start -->
<div class="form-item">
<div class="weui-cells__title">富文本</div>
<div class="weui-cell">
<div class="weui-cell__bd">
<div id="richEditor"></div>
</div>
</div>
</div>
<!-- 富文本end -->
<!-- 下拉列表start -->
<div class="form-item">
<div class="weui-cells__title">下拉列表</div>
<div class="weui-cell">
<div class="weui-cell__bd">
<input class="weui-input" id="select" type="text" value="" placeholder="点击选择">
</div>
</div>
</div>
<!-- 下拉列表end -->
<!-- 单选start -->
<div class="form-item">
<div class="weui-cells__title">单选列表项</div>
<div class="weui-cells weui-cells_radio">
<label class="weui-cell weui-check__label" for="x11">
<div class="weui-cell__bd">
<p>选项1</p>
</div>
<div class="weui-cell__ft">
<input class="weui-check" name="radio1" id="x11" type="radio">
<span class="weui-icon-checked"></span>
</div>
</label>
<label class="weui-cell weui-check__label" for="x12">
<div class="weui-cell__bd">
<p>选项2</p>
</div>
<div class="weui-cell__ft">
<input name="radio1" class="weui-check" id="x12" checked="checked" type="radio">
<span class="weui-icon-checked"></span>
</div>
</label>
</div>
</div>
<!-- 单选end -->
<!-- 复选start -->
<div class="form-item">
<div class="weui-cells__title">复选列表项</div>
<div class="weui-cells weui-cells_checkbox">
<label class="weui-cell weui-check__label" for="s11">
<div class="weui-cell__hd">
<input class="weui-check" name="checkbox1" id="s11" checked="checked" type="checkbox">
<i class="weui-icon-checked"></i>
</div>
<div class="weui-cell__bd">
<p>天下第一</p>
</div>
</label>
<label class="weui-cell weui-check__label" for="s12">
<div class="weui-cell__hd">
<input name="checkbox1" class="weui-check" id="s12" type="checkbox">
<i class="weui-icon-checked"></i>
</div>
<div class="weui-cell__bd">
<p>举世无双</p>
</div>
</label>
</div>
</div>
<!-- 复选end -->
<!-- 文件上传start -->
<div class="form-item">
<div class="weui-cells__title">上传文件</div>
<div class="weui-cells">
<div class="weui-cell file-upload">
<div class="weui-cell__bd">
<p>天字第一号</p>
</div>
<div class="weui-cell__ft" style="font-size: unset;">删除</div>
</div>
</div>
<div class="upload-file-button-box">
<a href="javascript:void(0);" class="weui-btn weui-btn_mini bg-blue">上传文件</a>
</div>
</div>
<!-- 文件上传end -->
<!-- 人员选择start -->
<div class="form-item">
<div class="weui-cells__title">选择人员</div>
<div class="weui-cell">
<div class="weui-cell__bd">
<input id="selectUser" type="hidden">
<input id="selectUserSelectUser" class="weui-input" placeholder="点击选择人员" type="text" readonly>
</div>
</div>
</div>
<!-- 人员选择end -->
<!-- 部门选择start -->
<div class="form-item">
<div class="weui-cells__title">选择人员</div>
<div class="weui-cell">
<div class="weui-cell__bd">
<input id="selectDepartment" type="hidden">
<input id="selectDepartmentSelectDepartment" class="weui-input" placeholder="点击选择部门" type="text" readonly>
</div>
</div>
</div>
<!-- 部门选择end -->
</div>
<script type="text/javascript" src="assets/js/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="assets/wxpage/js/zepto.min.js"></script>
<script type="text/javascript" src="assets/wxpage/js/zepto.weui.js"></script>
<script type="text/javascript" src="assets/wxpage/js/php.js"></script>
<script type="text/javascript" src="assets/js/vue.min.js"></script>
<script type="text/javascript" src="assets/js/vendor/layer/layer.js"></script>
<script type="text/javascript" src="assets/wxpage/js/dialog.js"></script>
<script type="text/javascript" src="assets/js/vendor/wangEditor/wangEditor.min.js"></script>
<script type="text/javascript">
function initRichEditor(id) {
// 富文本
var E = window.wangEditor
var editor = new E(id);
editor.customConfig.menus = [
'head',
'bold',
'fontSize',
'italic',
'justify',
'quote'
];
editor.customConfig.zIndex = 100;
editor.create()
}
initRichEditor('#richEditor');
function initSelect(id, name, data) {
// 下拉选择
$(id).select({
title: name,
items: data
});
}
initSelect('#select', '选择手机', [
{
title: "iPhone 8",
value: "001",
},
{
title: "iPhone 9",
value: "002",
},
{
title: "iPhone x",
value: "003",
},
{
title: "iPhone xs",
value: "004",
},
{
title: "iPhone xs1",
value: "005",
},
{
title: "iPhone xs2",
value: "006",
},
{
title: "iPhone xs3",
value: "007",
},
{
title: "iPhone xs4",
value: "008",
}
]);
function initDateTime(id, title, min, max) {
// 时间戳
$(id).datetimePicker({
title: title,
min: min,
max: max,
onChange: function (picker, values, displayValues) {
console.log(values);
}
});
}
initDateTime('#datetime', '出发时间', '1960-12-12 00:00:00', '2060-12-12 23:59:59');
function initDate(id, title, startYear, endYear) {
// 日期
$(id).datetimePicker({
title: title,
years: range(startYear, endYear),
times: function () {
return [];
},
parse: function (str) {
return str.split("-");
},
onChange: function (picker, values, displayValues) {
console.log(values);
}
});
}
initDate('#date', '生日', 1960, 2060);
// 选择人员
$(document).on('click', '#selectUserSelectUser', function() {
var selectedUsers = [];
var selectDepartmentUser = $('#selectUser').val().split(',');
for(var selectDepartmentUserIndex = 0, item = selectDepartmentUser[selectDepartmentUserIndex]; item = selectDepartmentUser[selectDepartmentUserIndex++];) {
var userInfo = item.split('|');
selectedUsers.push({
userId: userInfo[0],
departmentId: userInfo[1]
});
}
top.dialog.dialogData.selectedUsers = selectedUsers;
top.dialog.open({
url: 'approute/tree/treeuserrelease',
title: '选择组织部门人员',
width: '100%',
height: '100%',
onClose: function() {
var selectedUsers = top.dialog.dialogData.selectedDepartmentUsers;
if(selectedUsers != null && selectedUsers.length > 0) {
var selectedUsersVal = '';
var showSelectedUsersVal = '';
for(var j = 0, selectUser = selectedUsers[j]; selectUser = selectedUsers[j++];) {
if(selectedUsersVal.length > 0) {
selectedUsersVal += ',';
}
if(showSelectedUsersVal.length > 0) {
showSelectedUsersVal += ',';
}
selectedUsersVal += (selectUser.userId +'|'+ selectUser.departmentId +'|'+ selectUser.userName +'|'+ selectUser.userTitle);
showSelectedUsersVal += selectUser.userName;
}
$('#selectUser').val(selectedUsersVal);
$('#selectUserSelectUser').val(showSelectedUsersVal);
} else {
$('#selectUser').val('');
$('#selectUserSelectUser').val('');
}
}
});
});
// 选择部门
$(document).on('click', '#selectDepartmentSelectDepartment', function() {
var name = this.dataset.name;
var selectedNodes = [];
var selectDepartment = $('#selectDepartment').val().split(',');
for(var selectDepartmentIndex = 0, item = selectDepartment[selectDepartmentIndex]; item = selectDepartment[selectDepartmentIndex++];) {
var departmentInfo = item.split('|');
selectedNodes.push({
id: departmentInfo[0],
name: departmentInfo[1],
title: departmentInfo[1]
});
}
top.dialog.tree({
title: '选择部门',
apiUri: 'app/department/listztreedepartmentrelease',
width: '100%',
height: '100%',
dataFilter: function(treeId, parentNode, childNodes) {
return childNodes;
},
check: {
enable: true,
selectType: 'checkbox',
checkboxType: {Y: 'ps', N: 'ps'},
radioType: 'level',
},
selectedNodes: selectedNodes,
onClose: function() {
var selectNodes = top.dialog.dialogTreeData.selectedNodes;
if(typeof(selectNodes) != 'undefined' && selectNodes != null) {
if(selectNodes.length > 0) {
var selectedDepartmentVal = '';
var showSelectedDepartmentsVal = '';
for(var j = 0, selectNode = selectNodes[j]; selectNode = selectNodes[j++];) {
if(selectedDepartmentVal.length > 0) {
selectedDepartmentVal += ',';
}
if(showSelectedDepartmentsVal.length > 0) {
showSelectedDepartmentsVal += ',';
}
selectedDepartmentVal += (selectNode.id +'|'+ selectNode.name);
showSelectedDepartmentsVal += selectNode.name;
}
$('#selectDepartment').val(selectedDepartmentVal);
$('#selectDepartmentSelectDepartment').val(showSelectedDepartmentsVal);
} else {
$('#selectDepartment').val('');
$('#selectDepartmentSelectDepartment').val('');
}
}
}
});
});
</script>
</body>
</html>

View File

@ -162,19 +162,18 @@
return value;
}
});
} else if(item.fieldTyp === 'currentUser'
|| item.fieldTyp === 'currentDepartment'
|| item.fieldTyp === 'currentRole'
|| item.fieldTyp === 'currentGroup'
|| item.fieldTyp === 'currentPosition') {
} else if(item.fieldType === 'currentUser'
|| item.fieldType === 'currentDepartment'
|| item.fieldType === 'currentRole'
|| item.fieldType === 'currentGroup'
|| item.fieldType === 'currentPosition') {
autoCols.push({field: item.fieldName, width: 150, title: item.fieldExplain, align:'center',
templet: function(row) {
var currentData = row[this.field];
if(typeof(currentData) === 'undefined' || currentData == null || currentData == '') {
return '-';
}
var idAndNameValue = currentData;
return idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.splice('\\|')[1] : '无';
return currentData != null && currentData != '' ? currentData.split('|')[1] : '无';
}
});
} else {

View File

@ -126,40 +126,40 @@
<div class="layui-form-item" th:if="${dynamicFormFormShowFieldDTO.fieldType eq 'currentUser'}">
<label class="layui-form-label" th:text="${dynamicFormFormShowFieldDTO.fieldExplain}"></label>
<div class="layui-input-block">
<input type="hidden" th:id="${dynamicFormFormShowFieldDTO.fieldName}" th:name="${dynamicFormFormShowFieldDTO.fieldName}">
<input type="text" class="layui-input" th:id="${dynamicFormFormShowFieldDTO.fieldName +'CurrentUser'}" readonly>
<input type="hidden" th:id="${dynamicFormFormShowFieldDTO.fieldName}" th:name="${dynamicFormFormShowFieldDTO.fieldName}" th:value="${userIdAndValue}">
<input type="text" class="layui-input" th:id="${dynamicFormFormShowFieldDTO.fieldName +'CurrentUser'}" th:value="${userNameValue}" readonly>
</div>
</div>
<!--/* 当前组织 */-->
<div class="layui-form-item" th:if="${dynamicFormFormShowFieldDTO.fieldType eq 'currentDepartment'}">
<label class="layui-form-label" th:text="${dynamicFormFormShowFieldDTO.fieldExplain}"></label>
<div class="layui-input-block">
<input type="hidden" th:id="${dynamicFormFormShowFieldDTO.fieldName}" th:name="${dynamicFormFormShowFieldDTO.fieldName}">
<input type="text" class="layui-input" th:id="${dynamicFormFormShowFieldDTO.fieldName +'CurrentDepartment'}" readonly>
<input type="hidden" th:id="${dynamicFormFormShowFieldDTO.fieldName}" th:name="${dynamicFormFormShowFieldDTO.fieldName}" th:value="${departmentIdAndNamesValue}">
<input type="text" class="layui-input" th:id="${dynamicFormFormShowFieldDTO.fieldName +'CurrentDepartment'}" th:value="${departmentNamesValue}" readonly>
</div>
</div>
<!--/* 当前角色 */-->
<div class="layui-form-item" th:if="${dynamicFormFormShowFieldDTO.fieldType eq 'currentRole'}">
<label class="layui-form-label" th:text="${dynamicFormFormShowFieldDTO.fieldExplain}"></label>
<div class="layui-input-block">
<input type="hidden" th:id="${dynamicFormFormShowFieldDTO.fieldName}" th:name="${dynamicFormFormShowFieldDTO.fieldName}">
<input type="text" class="layui-input" th:id="${dynamicFormFormShowFieldDTO.fieldName +'CurrentRole'}" readonly>
<input type="hidden" th:id="${dynamicFormFormShowFieldDTO.fieldName}" th:name="${dynamicFormFormShowFieldDTO.fieldName}" th:value="${roleIdAndNamesValue}">
<input type="text" class="layui-input" th:id="${dynamicFormFormShowFieldDTO.fieldName +'CurrentRole'}" th:value="${roleNamesValue}" readonly>
</div>
</div>
<!--/* 当前组 */-->
<div class="layui-form-item" th:if="${dynamicFormFormShowFieldDTO.fieldType eq 'currentGroup'}">
<label class="layui-form-label" th:text="${dynamicFormFormShowFieldDTO.fieldExplain}"></label>
<div class="layui-input-block">
<input type="hidden" th:id="${dynamicFormFormShowFieldDTO.fieldName}" th:name="${dynamicFormFormShowFieldDTO.fieldName}">
<input type="text" class="layui-input" th:id="${dynamicFormFormShowFieldDTO.fieldName +'CurrentGroup'}" readonly>
<input type="hidden" th:id="${dynamicFormFormShowFieldDTO.fieldName}" th:name="${dynamicFormFormShowFieldDTO.fieldName}" th:value="${groupIdAndNamesValue}">
<input type="text" class="layui-input" th:id="${dynamicFormFormShowFieldDTO.fieldName +'CurrentGroup'}" th:value="${groupNamesValue}" readonly>
</div>
</div>
<!--/* 当前职位 */-->
<div class="layui-form-item" th:if="${dynamicFormFormShowFieldDTO.fieldType eq 'currentPosition'}">
<label class="layui-form-label" th:text="${dynamicFormFormShowFieldDTO.fieldExplain}"></label>
<div class="layui-input-block">
<input type="hidden" th:id="${dynamicFormFormShowFieldDTO.fieldName}" th:name="${dynamicFormFormShowFieldDTO.fieldName}">
<input type="text" class="layui-input" th:id="${dynamicFormFormShowFieldDTO.fieldName +'CurrentPosition'}" readonly>
<input type="hidden" th:id="${dynamicFormFormShowFieldDTO.fieldName}" th:name="${dynamicFormFormShowFieldDTO.fieldName}" th:value="${positionIdAndNamesValue}">
<input type="text" class="layui-input" th:id="${dynamicFormFormShowFieldDTO.fieldName +'CurrentPosition'}" th:value="${positionNamesValue}" readonly>
</div>
</div>
<!--/* 选择联表 */-->
@ -467,38 +467,53 @@
}, function(code, data) {
top.dialog.msg(data.msg);
});
} else if(item.fieldTyp === 'currentUser') {
} else if(item.fieldType === 'currentUser') {
var formData = {};
var idAndNameValue = dataFormData[item.fieldName];
var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.splice('\\|')[1] : '';
var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.split('|')[1] : '';
if(nameValue === '') {
return;
}
formData[item.fieldName] = idAndNameValue;
formData[item.fieldName +'CurrentUser'] = nameValue;
form.val('dataForm', formData);
} else if(item.fieldTyp === 'currentDepartment') {
} else if(item.fieldType === 'currentDepartment') {
var formData = {};
var idAndNameValue = dataFormData[item.fieldName];
var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.splice('\\|')[1] : '';
var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.split('|')[1] : '';
if(nameValue === '') {
return;
}
formData[item.fieldName] = idAndNameValue;
formData[item.fieldName +'CurrentDepartment'] = nameValue;
form.val('dataForm', formData);
} else if(item.fieldTyp === 'currentRole') {
} else if(item.fieldType === 'currentRole') {
var formData = {};
var idAndNameValue = dataFormData[item.fieldName];
var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.splice('\\|')[1] : '';
var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.split('|')[1] : '';
if(nameValue === '') {
return;
}
formData[item.fieldName] = idAndNameValue;
formData[item.fieldName +'CurrentRole'] = nameValue;
form.val('dataForm', formData);
} else if(item.fieldTyp === 'currentGroup') {
} else if(item.fieldType === 'currentGroup') {
var formData = {};
var idAndNameValue = dataFormData[item.fieldName];
var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.splice('\\|')[1] : '';
var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.split('|')[1] : '';
if(nameValue === '') {
return;
}
formData[item.fieldName] = idAndNameValue;
formData[item.fieldName +'CurrentGroup'] = nameValue;
form.val('dataForm', formData);
} else if(item.fieldTyp === 'currentPosition') {
} else if(item.fieldType === 'currentPosition') {
var formData = {};
var idAndNameValue = dataFormData[item.fieldName];
var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.splice('\\|')[1] : '';
var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.split('|')[1] : '';
if(nameValue === '') {
return;
}
formData[item.fieldName] = idAndNameValue;
formData[item.fieldName +'CurrentPosition'] = nameValue;
form.val('dataForm', formData);

View File

@ -120,40 +120,40 @@
<div class="layui-form-item" th:if="${dynamicFormFormShowFieldDTO.fieldType eq 'currentUser'}">
<label class="layui-form-label" th:text="${dynamicFormFormShowFieldDTO.fieldExplain}"></label>
<div class="layui-input-block">
<input type="hidden" th:id="${dynamicFormFormShowFieldDTO.fieldName}" th:name="${dynamicFormFormShowFieldDTO.fieldName}">
<input type="text" class="layui-input" th:id="${dynamicFormFormShowFieldDTO.fieldName +'CurrentUser'}" readonly>
<input type="hidden" th:id="${dynamicFormFormShowFieldDTO.fieldName}" th:name="${dynamicFormFormShowFieldDTO.fieldName}" th:value="${userIdAndValue}">
<input type="text" class="layui-input" th:id="${dynamicFormFormShowFieldDTO.fieldName +'CurrentUser'}" th:value="${userNameValue}" readonly>
</div>
</div>
<!--/* 当前组织 */-->
<div class="layui-form-item" th:if="${dynamicFormFormShowFieldDTO.fieldType eq 'currentDepartment'}">
<label class="layui-form-label" th:text="${dynamicFormFormShowFieldDTO.fieldExplain}"></label>
<div class="layui-input-block">
<input type="hidden" th:id="${dynamicFormFormShowFieldDTO.fieldName}" th:name="${dynamicFormFormShowFieldDTO.fieldName}">
<input type="text" class="layui-input" th:id="${dynamicFormFormShowFieldDTO.fieldName +'CurrentDepartment'}" readonly>
<input type="hidden" th:id="${dynamicFormFormShowFieldDTO.fieldName}" th:name="${dynamicFormFormShowFieldDTO.fieldName}" th:value="${departmentIdAndNamesValue}">
<input type="text" class="layui-input" th:id="${dynamicFormFormShowFieldDTO.fieldName +'CurrentDepartment'}" th:value="${departmentNamesValue}" readonly>
</div>
</div>
<!--/* 当前角色 */-->
<div class="layui-form-item" th:if="${dynamicFormFormShowFieldDTO.fieldType eq 'currentRole'}">
<label class="layui-form-label" th:text="${dynamicFormFormShowFieldDTO.fieldExplain}"></label>
<div class="layui-input-block">
<input type="hidden" th:id="${dynamicFormFormShowFieldDTO.fieldName}" th:name="${dynamicFormFormShowFieldDTO.fieldName}">
<input type="text" class="layui-input" th:id="${dynamicFormFormShowFieldDTO.fieldName +'CurrentRole'}" readonly>
<input type="hidden" th:id="${dynamicFormFormShowFieldDTO.fieldName}" th:name="${dynamicFormFormShowFieldDTO.fieldName}" th:value="${roleIdAndNamesValue}">
<input type="text" class="layui-input" th:id="${dynamicFormFormShowFieldDTO.fieldName +'CurrentRole'}" th:value="${roleNamesValue}" readonly>
</div>
</div>
<!--/* 当前组 */-->
<div class="layui-form-item" th:if="${dynamicFormFormShowFieldDTO.fieldType eq 'currentGroup'}">
<label class="layui-form-label" th:text="${dynamicFormFormShowFieldDTO.fieldExplain}"></label>
<div class="layui-input-block">
<input type="hidden" th:id="${dynamicFormFormShowFieldDTO.fieldName}" th:name="${dynamicFormFormShowFieldDTO.fieldName}">
<input type="text" class="layui-input" th:id="${dynamicFormFormShowFieldDTO.fieldName +'CurrentGroup'}" readonly>
<input type="hidden" th:id="${dynamicFormFormShowFieldDTO.fieldName}" th:name="${dynamicFormFormShowFieldDTO.fieldName}" th:value="${groupIdAndNamesValue}">
<input type="text" class="layui-input" th:id="${dynamicFormFormShowFieldDTO.fieldName +'CurrentGroup'}" th:value="${groupNamesValue}" readonly>
</div>
</div>
<!--/* 当前职位 */-->
<div class="layui-form-item" th:if="${dynamicFormFormShowFieldDTO.fieldType eq 'currentPosition'}">
<label class="layui-form-label" th:text="${dynamicFormFormShowFieldDTO.fieldExplain}"></label>
<div class="layui-input-block">
<input type="hidden" th:id="${dynamicFormFormShowFieldDTO.fieldName}" th:name="${dynamicFormFormShowFieldDTO.fieldName}">
<input type="text" class="layui-input" th:id="${dynamicFormFormShowFieldDTO.fieldName +'CurrentPosition'}" readonly>
<input type="hidden" th:id="${dynamicFormFormShowFieldDTO.fieldName}" th:name="${dynamicFormFormShowFieldDTO.fieldName}" th:value="${positionIdAndNamesValue}">
<input type="text" class="layui-input" th:id="${dynamicFormFormShowFieldDTO.fieldName +'CurrentPosition'}" th:value="${positionNamesValue}" readonly>
</div>
</div>
<!--/* 选择联表 */-->
@ -466,38 +466,54 @@
}, function(code, data) {
top.dialog.msg(data.msg);
});
} else if(item.fieldTyp === 'currentUser') {
} else if(item.fieldType === 'currentUser') {
var formData = {};
var idAndNameValue = dataFormData[item.fieldName];
var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.splice('\\|')[1] : '';
console.log(idAndNameValue)
var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.split('|')[1] : '';
if(nameValue === '') {
return;
}
formData[item.fieldName] = idAndNameValue;
formData[item.fieldName +'CurrentUser'] = nameValue;
form.val('dataForm', formData);
} else if(item.fieldTyp === 'currentDepartment') {
} else if(item.fieldType === 'currentDepartment') {
var formData = {};
var idAndNameValue = dataFormData[item.fieldName];
var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.splice('\\|')[1] : '';
var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.split('|')[1] : '';
if(nameValue === '') {
return;
}
formData[item.fieldName] = idAndNameValue;
formData[item.fieldName +'CurrentDepartment'] = nameValue;
form.val('dataForm', formData);
} else if(item.fieldTyp === 'currentRole') {
} else if(item.fieldType === 'currentRole') {
var formData = {};
var idAndNameValue = dataFormData[item.fieldName];
var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.splice('\\|')[1] : '';
var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.split('|')[1] : '';
if(nameValue === '') {
return;
}
formData[item.fieldName] = idAndNameValue;
formData[item.fieldName +'CurrentRole'] = nameValue;
form.val('dataForm', formData);
} else if(item.fieldTyp === 'currentGroup') {
} else if(item.fieldType === 'currentGroup') {
var formData = {};
var idAndNameValue = dataFormData[item.fieldName];
var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.splice('\\|')[1] : '';
var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.split('|')[1] : '';
if(nameValue === '') {
return;
}
formData[item.fieldName] = idAndNameValue;
formData[item.fieldName +'CurrentGroup'] = nameValue;
form.val('dataForm', formData);
} else if(item.fieldTyp === 'currentPosition') {
} else if(item.fieldType === 'currentPosition') {
var formData = {};
var idAndNameValue = dataFormData[item.fieldName];
var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.splice('\\|')[1] : '';
var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.split('|')[1] : '';
if(nameValue === '') {
return;
}
formData[item.fieldName] = idAndNameValue;
formData[item.fieldName +'CurrentPosition'] = nameValue;
form.val('dataForm', formData);