新增动态连表查询,适用于列表的拓展属性
This commit is contained in:
parent
0780956db5
commit
2739703619
@ -66,6 +66,17 @@ public class DynamicDataController extends AbstractController {
|
|||||||
return dynamicDataService.updateDynamicData(tableName, id, params);
|
return dynamicDataService.updateDynamicData(tableName, id, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = " 修改动态数据(链接)", notes = " 修改动态数据(链接)接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "tableName", value = "表名", paramType = "path"),
|
||||||
|
@ApiImplicitParam(name = "id", value = "id", paramType = "path")
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@PutMapping("updatedynamicjoindata/{tableName}/{joinKey}/{joinId}")
|
||||||
|
public SuccessResult updateDynamicJoinData(@PathVariable("tableName") String tableName, @PathVariable("joinKey") String joinKey, @PathVariable("joinId") String joinId, @RequestBody Map<String, Object> params) {
|
||||||
|
return dynamicDataService.updateDynamicJoinData(tableName, joinKey, joinId, params);
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "动态数据列表", notes = "动态数据列表接口")
|
@ApiOperation(value = "动态数据列表", notes = "动态数据列表接口")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "tableName", value = "表名", paramType = "path")
|
@ApiImplicitParam(name = "tableName", value = "表名", paramType = "path")
|
||||||
@ -100,4 +111,16 @@ public class DynamicDataController extends AbstractController {
|
|||||||
return dynamicDataService.getDynamicData(tableName, id);
|
return dynamicDataService.getDynamicData(tableName, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "动态数据(链接)详情", notes = "动态数据(链接)详情接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "tableName", value = "表名", paramType = "path"),
|
||||||
|
@ApiImplicitParam(name = "joinKey", value = "链接键名", paramType = "path"),
|
||||||
|
@ApiImplicitParam(name = "joinId", value = "链接键值", paramType = "path")
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@GetMapping("getdynamicjoindata/{tableName}/{joinKey}/{joinId}")
|
||||||
|
public Map<String, Object> getDynamicJoinData(@PathVariable("tableName") String tableName, @PathVariable("joinKey") String joinKey, @PathVariable("joinId") String joinId) {
|
||||||
|
return dynamicDataService.getDynamicJoinData(tableName, joinKey, joinId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ public class DynamicFormRouteController extends AbstractController {
|
|||||||
return mv;
|
return mv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "动态表单列表页面", notes = "动态表单列表页面接口")
|
@ApiOperation(value = "动态表单更新页面", notes = "动态表单列表更新接口")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "tableName", value = "表名", paramType = "path"),
|
@ApiImplicitParam(name = "tableName", value = "表名", paramType = "path"),
|
||||||
@ApiImplicitParam(name = "uuidValue", value = "id值", paramType = "path")
|
@ApiImplicitParam(name = "uuidValue", value = "id值", paramType = "path")
|
||||||
@ -72,6 +72,24 @@ public class DynamicFormRouteController extends AbstractController {
|
|||||||
return mv;
|
return mv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "动态表单更新(链接)页面", notes = "动态表单更新(链接)页面接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "tableName", value = "表名", paramType = "path"),
|
||||||
|
@ApiImplicitParam(name = "joinId", value = "链接id值", paramType = "path")
|
||||||
|
})
|
||||||
|
@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");
|
||||||
|
mv.addObject("tableName", tableName);
|
||||||
|
mv.addObject("joinKey", joinKey);
|
||||||
|
mv.addObject("joinId", joinId);
|
||||||
|
|
||||||
|
List<DynamicFormFormShowFieldDTO> dynamicFormFormShowFieldDTOs = dynamicFormService.listFormShowFieldOfPage(tableName);
|
||||||
|
mv.addObject("dynamicFormFormShowFieldDTOList", dynamicFormFormShowFieldDTOs);
|
||||||
|
setDynamicFieldData(mv, dynamicFormFormShowFieldDTOs);
|
||||||
|
return mv;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置动态表单字段
|
* 设置动态表单字段
|
||||||
*
|
*
|
||||||
|
@ -5,6 +5,7 @@ import com.cm.common.exception.SaveException;
|
|||||||
import com.cm.common.exception.SearchException;
|
import com.cm.common.exception.SearchException;
|
||||||
import com.cm.common.exception.UpdateException;
|
import com.cm.common.exception.UpdateException;
|
||||||
import com.cm.common.result.SuccessResult;
|
import com.cm.common.result.SuccessResult;
|
||||||
|
import net.sf.jsqlparser.statement.update.Update;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -49,6 +50,14 @@ public interface IDynamicDataDao {
|
|||||||
*/
|
*/
|
||||||
void updateDynamicData(Map<String, Object> params) throws UpdateException;
|
void updateDynamicData(Map<String, Object> params) throws UpdateException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改动态数据(链接)
|
||||||
|
*
|
||||||
|
* @param params
|
||||||
|
* @throws UpdateException
|
||||||
|
*/
|
||||||
|
void updateDynamicJoinData(Map<String, Object> params) throws UpdateException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 动态数据列表
|
* 动态数据列表
|
||||||
*
|
*
|
||||||
@ -66,4 +75,13 @@ public interface IDynamicDataDao {
|
|||||||
* @throws SearchException
|
* @throws SearchException
|
||||||
*/
|
*/
|
||||||
Map<String, Object> getDynamicData(Map<String, Object> params) throws SearchException;
|
Map<String, Object> getDynamicData(Map<String, Object> params) throws SearchException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动态数据(链接)详情
|
||||||
|
*
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
* @throws SearchException
|
||||||
|
*/
|
||||||
|
Map<String, Object> getDynamicJoinData(Map<String, Object> params) throws SearchException;
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,11 @@ public enum FieldTypeEnum {
|
|||||||
/**
|
/**
|
||||||
* 文件
|
* 文件
|
||||||
*/
|
*/
|
||||||
FILE("file");
|
FILE("file"),
|
||||||
|
/**
|
||||||
|
* 外联
|
||||||
|
*/
|
||||||
|
JOIN("join");
|
||||||
|
|
||||||
private String value;
|
private String value;
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ public class DynamicFormFieldVO {
|
|||||||
@CheckEmptyAnnotation(name = "字段说明")
|
@CheckEmptyAnnotation(name = "字段说明")
|
||||||
private String fieldExplain;
|
private String fieldExplain;
|
||||||
@ApiModelProperty(name = "fieldType", value = "字段类型")
|
@ApiModelProperty(name = "fieldType", value = "字段类型")
|
||||||
@CheckEmptyAnnotation(name = "字段类型", types = {"string", "datetime", "date", "number", "double", "textarea", "richText", "select", "checkbox", "radio", "selectUser", "selectDepartment"})
|
@CheckEmptyAnnotation(name = "字段类型", types = {"string", "datetime", "date", "number", "double", "textarea", "richText", "select", "checkbox", "radio", "selectUser", "selectDepartment", "file", "join"})
|
||||||
private String fieldType;
|
private String fieldType;
|
||||||
@ApiModelProperty(name = "fieldDefault", value = "字段默认值")
|
@ApiModelProperty(name = "fieldDefault", value = "字段默认值")
|
||||||
private String fieldDefault;
|
private String fieldDefault;
|
||||||
|
@ -28,7 +28,7 @@ public class DynamicConfigFormVO {
|
|||||||
@CheckEmptyAnnotation(name = "字段说明")
|
@CheckEmptyAnnotation(name = "字段说明")
|
||||||
private String fieldExplain;
|
private String fieldExplain;
|
||||||
@ApiModelProperty(name = "fieldType", value = "字段类型")
|
@ApiModelProperty(name = "fieldType", value = "字段类型")
|
||||||
@CheckEmptyAnnotation(name = "字段类型", types = {"string", "datetime", "date", "number", "double", "textarea", "richText", "select", "checkbox", "radio", "selectUser", "selectDepartment", "file"})
|
@CheckEmptyAnnotation(name = "字段类型", types = {"string", "datetime", "date", "number", "double", "textarea", "richText", "select", "checkbox", "radio", "selectUser", "selectDepartment", "file", "join"})
|
||||||
private String fieldType;
|
private String fieldType;
|
||||||
@ApiModelProperty(name = "fieldDefault", value = "字段默认值")
|
@ApiModelProperty(name = "fieldDefault", value = "字段默认值")
|
||||||
private String fieldDefault;
|
private String fieldDefault;
|
||||||
|
@ -55,6 +55,16 @@ public interface IDynamicDataService {
|
|||||||
*/
|
*/
|
||||||
SuccessResult updateDynamicData(String tableName, String id, Map<String, Object> params) throws UpdateException;
|
SuccessResult updateDynamicData(String tableName, String id, Map<String, Object> params) throws UpdateException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改动态数据(链接)
|
||||||
|
* @param tableName
|
||||||
|
* @param joinKey
|
||||||
|
* @param joinId
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
SuccessResult updateDynamicJoinData(String tableName, String joinKey, String joinId, Map<String, Object> params);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 动态数据列表
|
* 动态数据列表
|
||||||
*
|
*
|
||||||
@ -84,4 +94,15 @@ public interface IDynamicDataService {
|
|||||||
*/
|
*/
|
||||||
Map<String, Object> getDynamicData(String tableName, String id) throws SearchException;
|
Map<String, Object> getDynamicData(String tableName, String id) throws SearchException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动态数据(链接)详情
|
||||||
|
*
|
||||||
|
* @param tableName
|
||||||
|
* @param joinKey
|
||||||
|
* @param joinId
|
||||||
|
* @return
|
||||||
|
* @throws SearchException
|
||||||
|
*/
|
||||||
|
Map<String, Object> getDynamicJoinData(String tableName, String joinKey, String joinId) throws SearchException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -78,6 +78,37 @@ public class DynamicDataServiceImpl extends AbstractService implements IDynamicD
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SuccessResult updateDynamicData(String tableName, String id, Map<String, Object> params) throws UpdateException {
|
public SuccessResult updateDynamicData(String tableName, String id, Map<String, Object> params) throws UpdateException {
|
||||||
|
List<KeyValue> updateFieldValueList = listUpdateFieldValueList(tableName, params);
|
||||||
|
params.clear();
|
||||||
|
setUpdateBaseInfo(tableName, params);
|
||||||
|
params.put("uuidValue", id);
|
||||||
|
params.put("updateFieldValueList", updateFieldValueList);
|
||||||
|
setUpdateInfo(params);
|
||||||
|
dynamicDataDao.updateDynamicData(params);
|
||||||
|
return new SuccessResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SuccessResult updateDynamicJoinData(String tableName, String joinKey, String joinId, Map<String, Object> params) {
|
||||||
|
List<KeyValue> updateFieldValueList = listUpdateFieldValueList(tableName, params);
|
||||||
|
params.clear();
|
||||||
|
setUpdateBaseInfo(tableName, params);
|
||||||
|
params.put("joinKey", WStringUtil.lowerUpper2UnderLine(joinKey));
|
||||||
|
params.put("joinId", joinId);
|
||||||
|
params.put("updateFieldValueList", updateFieldValueList);
|
||||||
|
setUpdateInfo(params);
|
||||||
|
dynamicDataDao.updateDynamicJoinData(params);
|
||||||
|
return new SuccessResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新字段列表
|
||||||
|
*
|
||||||
|
* @param tableName
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private List<KeyValue> listUpdateFieldValueList(String tableName, Map<String, Object> params) {
|
||||||
List<DynamicFormDTO> dynamicFormDTOs = dynamicFormService.listDynamicForm(tableName);
|
List<DynamicFormDTO> dynamicFormDTOs = dynamicFormService.listDynamicForm(tableName);
|
||||||
LOG.debug("校验参数");
|
LOG.debug("校验参数");
|
||||||
requireData(params, dynamicFormDTOs);
|
requireData(params, dynamicFormDTOs);
|
||||||
@ -86,13 +117,7 @@ public class DynamicDataServiceImpl extends AbstractService implements IDynamicD
|
|||||||
for (DynamicFormDTO dynamicFormDTO : dynamicFormDTOs) {
|
for (DynamicFormDTO dynamicFormDTO : dynamicFormDTOs) {
|
||||||
updateFieldValueList.add(new DefaultKeyValue(WStringUtil.lowerUpper2UnderLine(dynamicFormDTO.getFieldName()), params.get(dynamicFormDTO.getFieldName())));
|
updateFieldValueList.add(new DefaultKeyValue(WStringUtil.lowerUpper2UnderLine(dynamicFormDTO.getFieldName()), params.get(dynamicFormDTO.getFieldName())));
|
||||||
}
|
}
|
||||||
params.clear();
|
return updateFieldValueList;
|
||||||
setUpdateBaseInfo(tableName, params);
|
|
||||||
params.put("uuidValue", id);
|
|
||||||
params.put("updateFieldValueList", updateFieldValueList);
|
|
||||||
setUpdateInfo(params);
|
|
||||||
dynamicDataDao.updateDynamicData(params);
|
|
||||||
return new SuccessResult();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -123,6 +148,20 @@ public class DynamicDataServiceImpl extends AbstractService implements IDynamicD
|
|||||||
return dynamicData;
|
return dynamicData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> getDynamicJoinData(String tableName, String joinKey, String joinId) throws SearchException {
|
||||||
|
Map<String, Object> params = getHashMap(0);
|
||||||
|
setSearchBaseGetInfo(tableName, params);
|
||||||
|
params.put("joinKey", WStringUtil.lowerUpper2UnderLine(joinKey));
|
||||||
|
params.put("joinId", joinId);
|
||||||
|
Map<String, Object> dynamicData = dynamicDataDao.getDynamicJoinData(params);
|
||||||
|
if (Objects.isNull(dynamicData)) {
|
||||||
|
dynamicData = new HashMap<>();
|
||||||
|
}
|
||||||
|
resetDynamicDataKey2LowerUpper(dynamicData);
|
||||||
|
return dynamicData;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置查询列表基础信息
|
* 设置查询列表基础信息
|
||||||
*
|
*
|
||||||
|
@ -262,6 +262,8 @@ public class DynamicFormServiceImpl extends AbstractService implements IDynamicF
|
|||||||
return true;
|
return true;
|
||||||
} else if (StringUtils.equals(FieldTypeEnum.FILE.getValue(), fieldType) && StringUtils.equals(ColumnDataTypeEnum.TEXT.getDataType(), dataType)) {
|
} else if (StringUtils.equals(FieldTypeEnum.FILE.getValue(), fieldType) && StringUtils.equals(ColumnDataTypeEnum.TEXT.getDataType(), dataType)) {
|
||||||
return true;
|
return true;
|
||||||
|
} else if (StringUtils.equals(FieldTypeEnum.JOIN.getValue(), fieldType) && StringUtils.equals(ColumnDataTypeEnum.CHAR.getDataType(), dataType)) {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -309,6 +311,9 @@ public class DynamicFormServiceImpl extends AbstractService implements IDynamicF
|
|||||||
tableColumnVO.setDataType(ColumnDataTypeEnum.TEXT.getDataType());
|
tableColumnVO.setDataType(ColumnDataTypeEnum.TEXT.getDataType());
|
||||||
} else if (StringUtils.equals(FieldTypeEnum.FILE.getValue(), dynamicFormFieldVO.getFieldType())) {
|
} else if (StringUtils.equals(FieldTypeEnum.FILE.getValue(), dynamicFormFieldVO.getFieldType())) {
|
||||||
tableColumnVO.setDataType(ColumnDataTypeEnum.TEXT.getDataType());
|
tableColumnVO.setDataType(ColumnDataTypeEnum.TEXT.getDataType());
|
||||||
|
} else if (StringUtils.equals(FieldTypeEnum.JOIN.getValue(), dynamicFormFieldVO.getFieldType())) {
|
||||||
|
tableColumnVO.setDataType(ColumnDataTypeEnum.CHAR.getDataType());
|
||||||
|
tableColumnVO.setColumnLength(36);
|
||||||
}
|
}
|
||||||
return tableColumnVO;
|
return tableColumnVO;
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,22 @@
|
|||||||
${uuidField} = #{uuidValue}
|
${uuidField} = #{uuidValue}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<!-- 修改动态数据(链接) -->
|
||||||
|
<update id="updateDynamicJoinData">
|
||||||
|
UPDATE
|
||||||
|
${tableName}
|
||||||
|
SET
|
||||||
|
<foreach collection="updateFieldValueList" item="item">
|
||||||
|
<if test="item.value != null">
|
||||||
|
${item.key} = #{item.value},
|
||||||
|
</if>
|
||||||
|
</foreach>
|
||||||
|
modifier = #{modifier},
|
||||||
|
gmt_modified = #{gmtModified}
|
||||||
|
WHERE
|
||||||
|
${joinKey} = #{joinId}
|
||||||
|
</update>
|
||||||
|
|
||||||
<!-- 动态数据列表 -->
|
<!-- 动态数据列表 -->
|
||||||
<select id="listDynamicData" parameterType="map" resultType="map">
|
<select id="listDynamicData" parameterType="map" resultType="map">
|
||||||
SELECT
|
SELECT
|
||||||
@ -106,4 +122,19 @@
|
|||||||
${uuidField} = #{uuidValue}
|
${uuidField} = #{uuidValue}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- 动态数据详情 -->
|
||||||
|
<select id="getDynamicJoinData" parameterType="map" resultType="map">
|
||||||
|
SELECT
|
||||||
|
${uuidField}
|
||||||
|
<foreach collection="formShowFieldList" item="item" open="," separator="," close="">
|
||||||
|
${item}
|
||||||
|
</foreach>
|
||||||
|
FROM
|
||||||
|
${tableName}
|
||||||
|
WHERE
|
||||||
|
is_delete = 0
|
||||||
|
AND
|
||||||
|
${joinKey} = #{joinId}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
@ -89,7 +89,6 @@
|
|||||||
[
|
[
|
||||||
{type:'checkbox', fixed: 'left'},
|
{type:'checkbox', fixed: 'left'},
|
||||||
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
|
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
|
||||||
// {field:'tableName', width:120, title: '表名', align:'center', fixed: 'left'},
|
|
||||||
{field:'fieldName', width:120, title: '字段名称', align:'center', fixed: 'left'},
|
{field:'fieldName', width:120, title: '字段名称', align:'center', fixed: 'left'},
|
||||||
{field:'fieldExplain', width: 160, title: '字段说明', align:'center'},
|
{field:'fieldExplain', width: 160, title: '字段说明', align:'center'},
|
||||||
{field:'fieldType', width:100, title: '字段类型', align:'center',
|
{field:'fieldType', width:100, title: '字段类型', align:'center',
|
||||||
@ -129,6 +128,12 @@
|
|||||||
case 'selectDepartment':
|
case 'selectDepartment':
|
||||||
value = '选择部门';
|
value = '选择部门';
|
||||||
break;
|
break;
|
||||||
|
case 'file':
|
||||||
|
value = '文件';
|
||||||
|
break;
|
||||||
|
case 'join':
|
||||||
|
value = '外联';
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
value = '文本';
|
value = '文本';
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,7 @@
|
|||||||
<option value="selectUser">选择人员</option>
|
<option value="selectUser">选择人员</option>
|
||||||
<option value="selectDepartment">选择部门</option>
|
<option value="selectDepartment">选择部门</option>
|
||||||
<option value="file">文件</option>
|
<option value="file">文件</option>
|
||||||
|
<option value="join">外联</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -56,6 +56,7 @@
|
|||||||
<option value="selectUser">选择人员</option>
|
<option value="selectUser">选择人员</option>
|
||||||
<option value="selectDepartment">选择部门</option>
|
<option value="selectDepartment">选择部门</option>
|
||||||
<option value="file">文件</option>
|
<option value="file">文件</option>
|
||||||
|
<option value="join">外联</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
<div class="layui-card-body" style="padding: 15px;">
|
<div class="layui-card-body" style="padding: 15px;">
|
||||||
<form class="layui-form layui-form-pane" lay-filter="dataForm">
|
<form class="layui-form layui-form-pane" lay-filter="dataForm">
|
||||||
<div th:each="dynamicFormFormShowFieldDTO, state: ${dynamicFormFormShowFieldDTOList}">
|
<div th:each="dynamicFormFormShowFieldDTO, state: ${dynamicFormFormShowFieldDTOList}">
|
||||||
|
<input type="hidden" th:if="${dynamicFormFormShowFieldDTO.fieldType eq 'join'}" th:id="${dynamicFormFormShowFieldDTO.fieldName}" th:name="${dynamicFormFormShowFieldDTO.fieldName}" lay-verify="required">
|
||||||
<div class="layui-form-item" th:if="${dynamicFormFormShowFieldDTO.fieldType eq 'string'}">
|
<div class="layui-form-item" th:if="${dynamicFormFormShowFieldDTO.fieldType eq 'string'}">
|
||||||
<label class="layui-form-label" th:text="${dynamicFormFormShowFieldDTO.fieldExplain}"></label>
|
<label class="layui-form-label" th:text="${dynamicFormFormShowFieldDTO.fieldExplain}"></label>
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
@ -150,6 +151,7 @@
|
|||||||
var wangEditorArray = [];
|
var wangEditorArray = [];
|
||||||
var formFieldList = [[${dynamicFormFormShowFieldDTOList}]];
|
var formFieldList = [[${dynamicFormFormShowFieldDTOList}]];
|
||||||
|
|
||||||
|
|
||||||
function closeBox() {
|
function closeBox() {
|
||||||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
<div class="layui-card-body" style="padding: 15px;">
|
<div class="layui-card-body" style="padding: 15px;">
|
||||||
<form class="layui-form layui-form-pane" lay-filter="dataForm">
|
<form class="layui-form layui-form-pane" lay-filter="dataForm">
|
||||||
<div th:each="dynamicFormFormShowFieldDTO, state: ${dynamicFormFormShowFieldDTOList}">
|
<div th:each="dynamicFormFormShowFieldDTO, state: ${dynamicFormFormShowFieldDTOList}">
|
||||||
|
<input type="hidden" th:if="${dynamicFormFormShowFieldDTO.fieldType eq 'join'}" th:id="${dynamicFormFormShowFieldDTO.fieldName}" th:name="${dynamicFormFormShowFieldDTO.fieldName}" lay-verify="required">
|
||||||
<div class="layui-form-item" th:if="${dynamicFormFormShowFieldDTO.fieldType eq 'string'}">
|
<div class="layui-form-item" th:if="${dynamicFormFormShowFieldDTO.fieldType eq 'string'}">
|
||||||
<label class="layui-form-label" th:text="${dynamicFormFormShowFieldDTO.fieldExplain}"></label>
|
<label class="layui-form-label" th:text="${dynamicFormFormShowFieldDTO.fieldExplain}"></label>
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
|
@ -0,0 +1,482 @@
|
|||||||
|
<!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/fonts/font-awesome/css/font-awesome.css"/>
|
||||||
|
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||||
|
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="layui-fluid layui-anim layui-anim-fadein" style="padding: 0;">
|
||||||
|
<div class="layui-card">
|
||||||
|
<div class="layui-card-body" style="padding: 15px;">
|
||||||
|
<form class="layui-form layui-form-pane" lay-filter="dataForm">
|
||||||
|
<input type="hidden" id="join" th:name="${joinKey}" th:value="${joinId}"/>
|
||||||
|
<div th:each="dynamicFormFormShowFieldDTO, state: ${dynamicFormFormShowFieldDTOList}">
|
||||||
|
<div class="layui-form-item" th:if="${dynamicFormFormShowFieldDTO.fieldType eq 'string'}">
|
||||||
|
<label class="layui-form-label" th:text="${dynamicFormFormShowFieldDTO.fieldExplain}"></label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input type="text" th:id="${dynamicFormFormShowFieldDTO.fieldName}" th:name="${dynamicFormFormShowFieldDTO.fieldName}" class="layui-input" th:value="${dynamicFormFormShowFieldDTO.fieldDefault}" th:placeholder="${'请输入'+ dynamicFormFormShowFieldDTO.fieldExplain}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item" th:if="${dynamicFormFormShowFieldDTO.fieldType eq 'datetime' or dynamicFormFormShowFieldDTO.fieldType eq 'date'}">
|
||||||
|
<label class="layui-form-label" th:text="${dynamicFormFormShowFieldDTO.fieldExplain}"></label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input type="text" th:id="${dynamicFormFormShowFieldDTO.fieldName}" th:name="${dynamicFormFormShowFieldDTO.fieldName}" class="layui-input" th:value="${dynamicFormFormShowFieldDTO.fieldDefault}" th:placeholder="${'请选择'+ dynamicFormFormShowFieldDTO.fieldExplain}" lay-verify="required" readonly style="cursor: pointer;">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item" th:if="${dynamicFormFormShowFieldDTO.fieldType eq 'number'}">
|
||||||
|
<label class="layui-form-label" th:text="${dynamicFormFormShowFieldDTO.fieldExplain}"></label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input type="number" th:id="${dynamicFormFormShowFieldDTO.fieldName}" th:name="${dynamicFormFormShowFieldDTO.fieldName}" class="layui-input" th:value="${dynamicFormFormShowFieldDTO.fieldDefault}" th:placeholder="${'请输入'+ dynamicFormFormShowFieldDTO.fieldExplain}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item" th:if="${dynamicFormFormShowFieldDTO.fieldType eq 'double'}">
|
||||||
|
<label class="layui-form-label" th:text="${dynamicFormFormShowFieldDTO.fieldExplain}"></label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input type="number" step="0.01" th:id="${dynamicFormFormShowFieldDTO.fieldName}" th:name="${dynamicFormFormShowFieldDTO.fieldName}" class="layui-input" th:value="${dynamicFormFormShowFieldDTO.fieldDefault}" th:placeholder="${'请输入'+ dynamicFormFormShowFieldDTO.fieldExplain}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item layui-form-text" th:if="${dynamicFormFormShowFieldDTO.fieldType eq 'textarea'}">
|
||||||
|
<label class="layui-form-label" th:text="${dynamicFormFormShowFieldDTO.fieldExplain}"></label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<textarea th:id="${dynamicFormFormShowFieldDTO.fieldName}" th:name="${dynamicFormFormShowFieldDTO.fieldName}" class="layui-textarea" th:placeholder="${'请输入'+ dynamicFormFormShowFieldDTO.fieldExplain}"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item layui-form-text" th:if="${dynamicFormFormShowFieldDTO.fieldType eq 'richText'}">
|
||||||
|
<label class="layui-form-label" th:text="${dynamicFormFormShowFieldDTO.fieldExplain}"></label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<div th:id="${dynamicFormFormShowFieldDTO.fieldName}"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item" th:if="${dynamicFormFormShowFieldDTO.fieldType eq 'select'}">
|
||||||
|
<label class="layui-form-label" th:text="${dynamicFormFormShowFieldDTO.fieldExplain}"></label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<select th:each="selectMap: ${selectMapList}" th:if="${selectMap.name eq dynamicFormFormShowFieldDTO.fieldName}" th:id="${dynamicFormFormShowFieldDTO.fieldName}" th:name="${dynamicFormFormShowFieldDTO.fieldName}">
|
||||||
|
<option value="">请选择</option>
|
||||||
|
<option th:each="select: ${selectMap.list}" th:value="${select.dictionaryId}" th:text="${select.dictionaryName}"></option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item" th:if="${dynamicFormFormShowFieldDTO.fieldType eq 'checkbox'}" pane>
|
||||||
|
<label class="layui-form-label" th:text="${dynamicFormFormShowFieldDTO.fieldExplain}"></label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<div th:each="checkboxMap: ${checkboxMapList}" th:if="${checkboxMap.name eq dynamicFormFormShowFieldDTO.fieldName}">
|
||||||
|
<input type="checkbox" th:each="checkbox: ${checkboxMap.list}" th:name="${dynamicFormFormShowFieldDTO.fieldName +'['+ checkbox.dictionaryId +']'}" th:title="${checkbox.dictionaryName}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item" th:if="${dynamicFormFormShowFieldDTO.fieldType eq 'radio'}" pane>
|
||||||
|
<label class="layui-form-label" th:text="${dynamicFormFormShowFieldDTO.fieldExplain}"></label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<div th:each="radioMap: ${radioMapList}" th:if="${radioMap.name eq dynamicFormFormShowFieldDTO.fieldName}">
|
||||||
|
<input type="radio" th:each="radio: ${radioMap.list}" th:name="${dynamicFormFormShowFieldDTO.fieldName}" th:value="${radio.dictionaryId}" th:title="${radio.dictionaryName}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item" th:if="${dynamicFormFormShowFieldDTO.fieldType eq 'file'}">
|
||||||
|
<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}">
|
||||||
|
<button type="button" class="layui-btn" lay-form-button th:attr="data-explain=${dynamicFormFormShowFieldDTO.fieldExplain},data-name=${dynamicFormFormShowFieldDTO.fieldName},lay-filter=${dynamicFormFormShowFieldDTO.fieldName +'UploadFile'}">
|
||||||
|
<i class="fa fa-cloud-upload"></i> <span th:text="${'上传'+ dynamicFormFormShowFieldDTO.fieldExplain}"></span>
|
||||||
|
</button>
|
||||||
|
<div class="layui-btn-container" th:id="${dynamicFormFormShowFieldDTO.fieldName +'FileBox'}"></div>
|
||||||
|
<script th:id="${dynamicFormFormShowFieldDTO.fieldName +'FileDownload'}" type="text/html" th:inline="javascript">
|
||||||
|
{{# var fieldName = [[${dynamicFormFormShowFieldDTO.fieldName}]]; }}
|
||||||
|
{{# if(d[fieldName] != '') { }}
|
||||||
|
{{# var files = d[fieldName].split(',');}}
|
||||||
|
{{# for(var i = 0, item = files[i]; item = files[i++];) {}}
|
||||||
|
<span class="layui-btn-group">
|
||||||
|
<a class="layui-btn layui-btn-normal" href="route/file/downloadfile/false/{{item}}">点击下载此文件</a>
|
||||||
|
<a class="layui-btn layui-btn-danger text-danger" href="javascript:void(0);" lay-form-button data-id="{{item}}" th:attr="data-name=${dynamicFormFormShowFieldDTO.fieldName},lay-filter=${dynamicFormFormShowFieldDTO.fieldName +'RemoveFile'}">删除</a>
|
||||||
|
</span>
|
||||||
|
{{# } }}
|
||||||
|
{{# } }}
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item" th:if="${dynamicFormFormShowFieldDTO.fieldType eq 'selectUser'}">
|
||||||
|
<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}" th:value="${dynamicFormFormShowFieldDTO.fieldDefault}">
|
||||||
|
<input type="text" th:id="${dynamicFormFormShowFieldDTO.fieldName +'SelectUser'}" class="layui-input" th:placeholder="${'请选择'+ dynamicFormFormShowFieldDTO.fieldExplain}" th:attr="data-name=${dynamicFormFormShowFieldDTO.fieldName}" readonly style="cursor:pointer;">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item" th:if="${dynamicFormFormShowFieldDTO.fieldType eq 'selectDepartment'}">
|
||||||
|
<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}" th:value="${dynamicFormFormShowFieldDTO.fieldDefault}">
|
||||||
|
<input type="text" th:id="${dynamicFormFormShowFieldDTO.fieldName +'SelectDepartment'}" class="layui-input" th:placeholder="${'请选择'+ dynamicFormFormShowFieldDTO.fieldExplain}" th:attr="data-name=${dynamicFormFormShowFieldDTO.fieldName}" readonly style="cursor:pointer;">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item layui-layout-admin">
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<div class="layui-footer" style="left: 0;">
|
||||||
|
<button type="button" class="layui-btn" lay-submit lay-filter="submitForm">提交编辑</button>
|
||||||
|
<button type="button" class="layui-btn layui-btn-primary close">返回上级</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<input type="hidden" id="tableName" th:value="${tableName}"/>
|
||||||
|
<input type="hidden" id="joinKey" th:value="${joinKey}"/>
|
||||||
|
<input type="hidden" id="joinId" th:value="${joinId}"/>
|
||||||
|
<script src="assets/js/vendor/wangEditor/wangEditor.min.js"></script>
|
||||||
|
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||||
|
<script th:inline="javascript">
|
||||||
|
layui.config({
|
||||||
|
base: 'assets/layuiadmin/' //静态资源所在路径
|
||||||
|
}).extend({
|
||||||
|
index: 'lib/index' //主入口模块
|
||||||
|
}).use(['index', 'form', 'laydate', 'laytpl'], function(){
|
||||||
|
var $ = layui.$;
|
||||||
|
var form = layui.form;
|
||||||
|
var laytpl = layui.laytpl;
|
||||||
|
var laydate = layui.laydate;
|
||||||
|
var saveOrEdit = 'save';
|
||||||
|
var wangEditor = window.wangEditor;
|
||||||
|
var wangEditorArray = [];
|
||||||
|
var formFieldList = [[${dynamicFormFormShowFieldDTOList}]];
|
||||||
|
|
||||||
|
function closeBox() {
|
||||||
|
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||||
|
}
|
||||||
|
|
||||||
|
function refreshDownloadTemplet(fileName, file) {
|
||||||
|
var dataForm = {};
|
||||||
|
dataForm[fileName] = file;
|
||||||
|
form.val('dataForm', dataForm);
|
||||||
|
|
||||||
|
var dataRander = {};
|
||||||
|
dataRander[fileName] = $('#'+ fileName).val();
|
||||||
|
|
||||||
|
laytpl(document.getElementById(fileName +'FileDownload').innerHTML).render(dataRander, function(html) {
|
||||||
|
document.getElementById(fileName +'FileBox').innerHTML = html;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始化
|
||||||
|
function initData() {
|
||||||
|
var loadLayerIndex;
|
||||||
|
top.restAjax.get(top.restAjax.path('api/dynamicdata/getdynamicjoindata/{tableName}/{joinKey}/{joinId}', [$('#tableName').val(), $('#joinKey').val(), $('#joinId').val()]), {}, null, function(code, data) {
|
||||||
|
if(Object.keys(data).length > 0) {
|
||||||
|
saveOrEdit = 'update'
|
||||||
|
}
|
||||||
|
// 处理返回内容
|
||||||
|
var dataFormData = {}
|
||||||
|
for(var i in data) {
|
||||||
|
dataFormData[i] = data[i];
|
||||||
|
}
|
||||||
|
form.val('dataForm', dataFormData);
|
||||||
|
// 处理checkbox
|
||||||
|
for(var i = 0, item = formFieldList[i]; item = formFieldList[i++];) {
|
||||||
|
if(item.fieldType === 'checkbox') {
|
||||||
|
if(typeof(data[item.fieldName]) === 'undefined') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
var checkboxValue = data[item.fieldName].split(',');
|
||||||
|
var checkboxObj = {};
|
||||||
|
for(var j = 0, checkbox = checkboxValue[j]; checkbox = checkboxValue[j++];) {
|
||||||
|
checkboxObj[item.fieldName +'['+ checkbox +']'] = true;
|
||||||
|
form.val('dataForm', checkboxObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
form.render(null, 'dataForm');
|
||||||
|
for(var i = 0, item = formFieldList[i]; item = formFieldList[i++];) {
|
||||||
|
if(item.fieldType === 'date') {
|
||||||
|
laydate.render({
|
||||||
|
elem: '#'+ item.fieldName,
|
||||||
|
type: 'date',
|
||||||
|
value: new Date(),
|
||||||
|
trigger: 'click'
|
||||||
|
});
|
||||||
|
} else if(item.fieldType === 'datetime') {
|
||||||
|
laydate.render({
|
||||||
|
elem: '#'+ item.fieldName,
|
||||||
|
type: 'datetime',
|
||||||
|
value: new Date(),
|
||||||
|
trigger: 'click'
|
||||||
|
});
|
||||||
|
} else if(item.fieldType === 'richText') {
|
||||||
|
var editor = new wangEditor('#'+ item.fieldName);
|
||||||
|
editor.customConfig.zIndex = 1000;
|
||||||
|
editor.customConfig.uploadImgMaxSize = 5 * 1024 * 1024;
|
||||||
|
editor.customConfig.uploadImgMaxLength = 1;
|
||||||
|
editor.customConfig.uploadFileName = 'image';
|
||||||
|
editor.customConfig.uploadImgServer = 'api/file/wangeditorimage';
|
||||||
|
editor.customConfig.uploadImgHooks = {
|
||||||
|
fail: function (xhr, editor, result) {
|
||||||
|
top.dialog.msg('系统错误,图片上传失败');
|
||||||
|
},
|
||||||
|
error: function (xhr, editor) {
|
||||||
|
top.dialog.msg('网络异常');
|
||||||
|
},
|
||||||
|
timeout: function (xhr, editor) {
|
||||||
|
top.dialog.msg('网络请求超时');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
editor.create();
|
||||||
|
editor.txt.html(dataFormData[item.fieldName]);
|
||||||
|
var wangEditorObj = {};
|
||||||
|
wangEditorObj[item.fieldName] = editor;
|
||||||
|
wangEditorArray.push(wangEditorObj);
|
||||||
|
} else if(item.fieldType === 'file') {
|
||||||
|
var files = $('#'+ item.fieldName).val().split(',');
|
||||||
|
var showFiles = '';
|
||||||
|
for(var fileIndex = 0, file = files[fileIndex]; file = files[fileIndex++];) {
|
||||||
|
if(showFiles.length > 0) {
|
||||||
|
showFiles += ',';
|
||||||
|
}
|
||||||
|
showFiles += file;
|
||||||
|
}
|
||||||
|
refreshDownloadTemplet(item.fieldName, showFiles);
|
||||||
|
|
||||||
|
form.on('button('+ item.fieldName +'UploadFile)', function(obj) {
|
||||||
|
var name = this.dataset.name;
|
||||||
|
var explain = this.dataset.explain;
|
||||||
|
top.dialog.file({
|
||||||
|
type: 'file',
|
||||||
|
title: '上传'+ explain,
|
||||||
|
width: '400px',
|
||||||
|
height: '420px',
|
||||||
|
maxFileCount: '1',
|
||||||
|
onClose: function() {
|
||||||
|
var uploadFileArray = top.dialog.dialogData.uploadFileArray;
|
||||||
|
if(typeof(uploadFileArray) != 'undefined' && uploadFileArray.length > 0) {
|
||||||
|
var files = $('#'+ name).val();
|
||||||
|
for(var j = 0, file = uploadFileArray[j]; file = uploadFileArray[j++];) {
|
||||||
|
if(files.length > 0) {
|
||||||
|
files += ',';
|
||||||
|
}
|
||||||
|
files += file.data;
|
||||||
|
}
|
||||||
|
refreshDownloadTemplet(name, files);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
form.on('button('+ item.fieldName +'RemoveFile)', function(obj) {
|
||||||
|
var name = this.dataset.name;
|
||||||
|
var id = this.dataset.id;
|
||||||
|
var files = $('#'+ name).val().replace(id, '');
|
||||||
|
files = files.replace(/\,+/g, ',');
|
||||||
|
if(files.charAt(0) == ',') {
|
||||||
|
files = files.substring(1);
|
||||||
|
}
|
||||||
|
if(files.charAt(files.length - 1) == ',') {
|
||||||
|
files = files.substring(0, files.length - 2);
|
||||||
|
}
|
||||||
|
refreshDownloadTemplet(name, files);
|
||||||
|
});
|
||||||
|
} else if(item.fieldType === 'selectUser') {
|
||||||
|
var showSelectedUsersVal = '';
|
||||||
|
var selectDepartmentUser = $('#'+ item.fieldName).val().split(',');
|
||||||
|
for(var selectDepartmentUserIndex = 0, selectDepartmentUserItem = selectDepartmentUser[selectDepartmentUserIndex]; selectDepartmentUserItem = selectDepartmentUser[selectDepartmentUserIndex++];) {
|
||||||
|
var userInfo = selectDepartmentUserItem.split('|');
|
||||||
|
if(showSelectedUsersVal.length > 0) {
|
||||||
|
showSelectedUsersVal += ',';
|
||||||
|
}
|
||||||
|
showSelectedUsersVal += userInfo[2];
|
||||||
|
}
|
||||||
|
$('#'+ item.fieldName +'SelectUser').val(showSelectedUsersVal);
|
||||||
|
//----//
|
||||||
|
$(document.body).on('click', '#'+ item.fieldName +'SelectUser', function() {
|
||||||
|
var name = this.dataset.name;
|
||||||
|
var selectedUsers = [];
|
||||||
|
var selectDepartmentUser = $('#'+ name).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: top.restAjax.path('route/tree/treeuser', []),
|
||||||
|
title: '选择组织部门人员',
|
||||||
|
width: '500px',
|
||||||
|
height: '500px',
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
$('#'+ name).val(selectedUsersVal);
|
||||||
|
$('#'+ name +'SelectUser').val(showSelectedUsersVal);
|
||||||
|
} else {
|
||||||
|
$('#'+ name).val('');
|
||||||
|
$('#'+ name +'SelectUser').val('');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else if(item.fieldType === 'selectDepartment') {
|
||||||
|
var showSelectedDepartmentsVal = '';
|
||||||
|
var selectDepartment = $('#'+ item.fieldName).val().split(',');
|
||||||
|
for(var selectDepartmentIndex = 0, selectDepartmentItem = selectDepartment[selectDepartmentIndex]; selectDepartmentItem = selectDepartment[selectDepartmentIndex++];) {
|
||||||
|
var departmentInfo = selectDepartmentItem.split('|');
|
||||||
|
if(showSelectedDepartmentsVal.length > 0) {
|
||||||
|
showSelectedDepartmentsVal += ',';
|
||||||
|
}
|
||||||
|
showSelectedDepartmentsVal += departmentInfo[1];
|
||||||
|
}
|
||||||
|
$('#'+ item.fieldName +'SelectDepartment').val(showSelectedDepartmentsVal);
|
||||||
|
//----//
|
||||||
|
$(document.body).on('click', '#'+ item.fieldName +'SelectDepartment', function() {
|
||||||
|
var name = this.dataset.name;
|
||||||
|
var selectedNodes = [];
|
||||||
|
var selectDepartment = $('#'+ name).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: top.restAjax.path('api/department/listztreedepartment', []),
|
||||||
|
width: '250px',
|
||||||
|
height: '400px',
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
$('#'+ name).val(selectedDepartmentVal);
|
||||||
|
$('#'+ name +'SelectDepartment').val(showSelectedDepartmentsVal);
|
||||||
|
} else {
|
||||||
|
$('#'+ name).val('');
|
||||||
|
$('#'+ name +'SelectDepartment').val('');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, function(code, data) {
|
||||||
|
top.dialog.msg(data.msg);
|
||||||
|
}, function() {
|
||||||
|
loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3});
|
||||||
|
}, function() {
|
||||||
|
top.dialog.close(loadLayerIndex);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
initData();
|
||||||
|
|
||||||
|
// 提交表单
|
||||||
|
form.on('submit(submitForm)', function(formData) {
|
||||||
|
top.dialog.confirm(top.dataMessage.commit, function(index) {
|
||||||
|
top.dialog.close(index);
|
||||||
|
var loadLayerIndex;
|
||||||
|
// 处理富文本
|
||||||
|
for(var i = 0, item = wangEditorArray[i]; item = wangEditorArray[i++];) {
|
||||||
|
for(var j in item) {
|
||||||
|
formData.field[j] = item[j].txt.html();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 处理checkbox
|
||||||
|
for(var i = 0, item = formFieldList[i]; item = formFieldList[i++];) {
|
||||||
|
if(item.fieldType === 'checkbox') {
|
||||||
|
var checkboxValue = top.restAjax.checkBoxToString(formData.field, item.fieldName);
|
||||||
|
formData.field[item.fieldName] = checkboxValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(saveOrEdit === 'save') {
|
||||||
|
top.restAjax.post(top.restAjax.path('api/dynamicdata/savedynamicdata/{tableName}', [$('#tableName').val()]), formData.field, null, function(code, data) {
|
||||||
|
var layerIndex = top.dialog.msg(top.dataMessage.commitSuccess, {
|
||||||
|
time: 0,
|
||||||
|
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
|
||||||
|
shade: 0.3,
|
||||||
|
yes: function(index) {
|
||||||
|
top.dialog.close(index);
|
||||||
|
window.location.reload();
|
||||||
|
},
|
||||||
|
btn2: function() {
|
||||||
|
closeBox();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, function(code, data) {
|
||||||
|
top.dialog.msg(data.msg);
|
||||||
|
}, function() {
|
||||||
|
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
|
||||||
|
}, function() {
|
||||||
|
top.dialog.close(loadLayerIndex);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
top.restAjax.put(top.restAjax.path('api/dynamicdata/updatedynamicjoindata/{tableName}/{joinKey}/{joinId}', [$('#tableName').val(), $('#joinKey').val(), $('#joinId').val()]), formData.field, null, function(code, data) {
|
||||||
|
var layerIndex = top.dialog.msg(top.dataMessage.commitSuccess, {
|
||||||
|
time: 0,
|
||||||
|
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
|
||||||
|
shade: 0.3,
|
||||||
|
yes: function(index) {
|
||||||
|
top.dialog.close(index);
|
||||||
|
window.location.reload();
|
||||||
|
},
|
||||||
|
btn2: function() {
|
||||||
|
closeBox();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, function(code, data) {
|
||||||
|
top.dialog.msg(data.msg);
|
||||||
|
}, function() {
|
||||||
|
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
|
||||||
|
}, function() {
|
||||||
|
top.dialog.close(loadLayerIndex);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
$('.close').on('click', function() {
|
||||||
|
closeBox();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -6,7 +6,12 @@
|
|||||||
<meta charset="UTF-8"/>
|
<meta charset="UTF-8"/>
|
||||||
<link rel="stylesheet" type="text/css" href="assets/js/vendor/bootstrap/css/bootstrap.min.css"/>
|
<link rel="stylesheet" type="text/css" href="assets/js/vendor/bootstrap/css/bootstrap.min.css"/>
|
||||||
<link rel="stylesheet" type="text/css" href="assets/js/vendor/bootstrap-fileupload/css/fileinput.min.css"/>
|
<link rel="stylesheet" type="text/css" href="assets/js/vendor/bootstrap-fileupload/css/fileinput.min.css"/>
|
||||||
<style></style>
|
<style>
|
||||||
|
.krajee-default.file-preview-frame .kv-file-content {height: 150px !important;}
|
||||||
|
.krajee-default.file-preview-frame .file-thumbnail-footer {height: 70px !important;;}
|
||||||
|
.krajee-default .file-footer-caption {margin-bottom:30px !important;}
|
||||||
|
.krajee-default .file-thumb-progress .progress, .krajee-default .file-thumb-progress .progress-bar {height: 20px !important;}
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="content" class="edit-content" style="padding: 5px;">
|
<div id="content" class="edit-content" style="padding: 5px;">
|
||||||
|
Loading…
Reference in New Issue
Block a user