人员培训修改提交

pg_adapter
dshclm 8 months ago
parent eeeebc8d62
commit 28ce6f9588

@ -3,10 +3,12 @@
<head>
<th:block th:include="include :: header('新增涉密人员培训')" />
<th:block th:include="include :: datetimepicker-css" />
<th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content" id="app">
<form class="form-horizontal m" id="form-train-add">
<input name="deptId" type="hidden" id="treeId"/>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
@ -38,13 +40,11 @@
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required">人员姓名</label>
<label class="col-sm-4 control-label is-required">培训对象</label>
<div class="col-sm-8">
<select id="User" name="USERNAME" required @change="getDept()" v-model="dept" class="form-control m-b">
<select id="trainSubject" name="trainSubject" required class="form-control m-b" th:with="type=${@dict.getType('sys_usertrain_obj')}">
<option value="">---请选择---</option>
<option v-for="option in userList" :value="option.userId" :key="option.userId">
{{ option.userName }}
</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
@ -53,29 +53,39 @@
<div class="form-group">
<label class="col-sm-4 control-label is-required ">所属单位:</label>
<div class="col-sm-8">
<input placeholder="请输入单位名称" v-model="deptObj.deptName" required class="form-control m-b" type="text">
<input name="deptName" v-model="deptObj.deptId" type=hidden>
<div class="input-group">
<input name="deptName" required onclick="selectDeptTree()" id="treeName" type="text" placeholder="请选择所属单位" class="form-control m-b">
<span class="input-group-addon"><i class="fa fa-search"></i></span>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<!-- <div class="form-group">-->
<!-- <label class="col-sm-4 control-label is-required">部门:</label>-->
<!-- <div class="col-sm-8">-->
<!-- <input name="PART" required placeholder="请输入部门" class="form-control" type="text">-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="col-sm-4 control-label is-required">培训对象:</label>
<div class="form-group" v-if="trainSubject == '0'">
<label class="col-sm-4 control-label is-required">人员姓名:</label>
<div class="col-sm-8">
<select name="trainSubject" required class="form-control m-b" th:with="type=${@dict.getType('sys_usertrain_obj')}">
<select id="User" name="USERNAME" required class="form-control m-b">
<option value="">---请选择---</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
<option v-for="option in userList" :value="option.userId" :key="option.userId">
{{ option.userName }}
</option>
</select>
</div>
</div>
<div class="form-group" v-if="trainSubject == '1'">
<label class="col-sm-4 control-label is-required">人员姓名:</label>
<div class="col-sm-8">
<input name="USERNAME" required placeholder="请输入人员姓名" class="form-control" type="text">
</div>
</div>
<div class="form-group" v-if="trainSubject == '2'">
<label class="col-sm-4 control-label is-required">人员姓名:</label>
<div class="col-sm-8">
<input name="USERNAME" readonly th:value="'全体人员'" placeholder="全体人员" class="form-control" type="text">
</div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
@ -129,11 +139,45 @@
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: select2-js" />
<script th:inline="javascript">
var prefix = ctx + "system/train"
$("#form-train-add").validate({
focusCleanup: true
});
$(document).ready(function() {
$('#City').select2().on('change', function() {
// 更新 Vue 数据
const vueInstance = document.querySelector('#app').__vue__;
vueInstance.City = $(this).val();
vueInstance.getAreaList();
});
$('#trainSubject').select2().on('change', function() {
// 更新 Vue 数据
const vueInstance = document.querySelector('#app').__vue__;
vueInstance.trainSubject = $(this).val();
})
});
/* 用户管理-新增-选择部门树 */
function selectDeptTree() {
var treeId = $("#treeId").val();
var deptId = $.common.isEmpty(treeId) ? "100" : $("#treeId").val();
var url = ctx + "system/user/selectDeptTree/" + deptId;
var options = {
title: '选择部门',
width: "380",
url: url,
callBack: doSubmit
};
$.modal.openOptions(options);
}
function doSubmit(index, layero){
var body = $.modal.getChildFrame(index);
$("#treeId").val(body.find('#treeId').val());
$("#treeName").val(body.find('#treeName').val());
$.modal.close(index);
}
var app = new Vue({
el: '#app',
data: {
@ -142,12 +186,18 @@
userList:[],
City:'',
Area:'',
dept:'',
params:{
parentId:'',
},
userPost:"system/user/list",
deptObj:{}
userPost:"system/user/userList",
trainSubject:'0'
},
watch: {
trainSubject() {
this.$nextTick(() => {
$('#User').select2(); // 重新初始化 Select2
});
}
},
mounted(){
// 初始化地市列表
@ -158,27 +208,12 @@
this.getUserList()
},
methods:{
getDept(){
if (this.dept !== ''){
$.ajax({
url: ctx + this.userPost,
data:{userId:this.dept},
type: 'POST',
success:((res)=>{
this.deptObj = res.rows[0].dept
}) ,
});
}else{
this.deptObj ={}
}
},
getUserList(){
$.ajax({
url: ctx + this.userPost,
type: 'POST',
success:((res)=>{
this.userList = res.rows
this.userList = res.data
}) ,
});
},

@ -1,21 +1,22 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('涉密人员培训详情')" />
<th:block th:include="include :: jsonview-css" />
<th:block th:include="include :: header('修改涉密人员培训')" />
<th:block th:include="include :: datetimepicker-css" />
<th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content" id="app">
<form class="form-horizontal m" id="form-train-edit" th:object="${tdTrain}">
<input name="ID" th:field="*{ID}" type="hidden">
<!-- <input name="deptId" type="hidden" th:field="*{deptId}" id="treeId">-->
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required">所属地市:</label>
<label class="col-sm-4 control-label is- ">所属地市:</label>
<div class="col-sm-8">
<select id="City" name="AREAID" disabled required @change="getAreaList()" v-model="City" class="form-control m-b">
<option value="">请选择</option>
<select id="City" name="AREAID" disabled @change="getAreaList()" v-model="City" class="form-control m-b">
<option value="">---请选择---</option>
<option v-for="option in CityList" :value="option.id" :key="option.id">
{{ option.name }}
</option>
@ -25,10 +26,10 @@
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label">所属区县:</label>
<label class="col-sm-4 control-label is- ">所属区县:</label>
<div class="col-sm-8">
<select id="Area" name="FRAMEWORK" disabled v-model="Area" class="form-control m-b">
<option value="">请选择</option>
<select id="Area" name="FRAMEWORK" disabled v-model="Area" class="form-control m-b">
<option value="">---请选择---</option>
<option v-for="option in AreaList" :value="option.id" :key="option.id">
{{ option.name }}
</option>
@ -37,47 +38,63 @@
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label">人员姓名</label>
<label class="col-sm-4 control-label is- ">培训对象</label>
<div class="col-sm-8">
<select id="User" name="USERNAME" disabled required @change="getDept()" v-model="userName" class="form-control m-b">
<select id="trainSubject" disabled v-model="trainSubject" name="trainSubject" class="form-control m-b" th:with="type=${@dict.getType('sys_usertrain_obj')}">
<option value="">---请选择---</option>
<option v-for="option in userList" :value="option.userId" :key="option.userId">
{{ option.userName }}
</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required ">所属单位:</label>
<label class="col-sm-4 control-label is- ">所属单位:</label>
<div class="col-sm-8">
<input placeholder="请输入单位名称" disabled v-model="deptObj.deptName" required class="form-control m-b" type="text">
<div class="input-group">
<input class="form-control" disabled type="text" name="deptName" onclick="selectDeptTree()" id="treeName" th:field="*{deptName}">
<span class="input-group-addon"><i class="fa fa-search"></i></span>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label">培训类型</label>
<div class="form-group" v-if="trainSubject == '0'">
<label class="col-sm-4 control-label is- ">人员姓名</label>
<div class="col-sm-8">
<select name="trainType" disabled class="form-control m-b" th:with="type=${@dict.getType('sys_usertrain_typer')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{trainType}"></option>
<select id="User" disabled v-model="userName" name="USERNAME" class="form-control m-b">
<option value="">---请选择---</option>
<option v-for="option in userList" :value="option.userId" :key="option.userId">
{{ option.userName }}
</option>
</select>
</div>
</div>
<div class="form-group" v-if="trainSubject == '1'">
<label class="col-sm-4 control-label is- ">人员姓名:</label>
<div class="col-sm-8">
<input name="USERNAME" disabled th:field="*{USERNAME}" placeholder="请输入人员姓名" class="form-control" type="text">
</div>
</div>
<div class="form-group" v-if="trainSubject == '2'">
<label class="col-sm-4 control-label is- ">人员姓名:</label>
<div class="col-sm-8">
<input name="USERNAME" readonly th:value="'全体人员'" placeholder="全体人员" class="form-control" type="text">
</div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label">培训对象:</label>
<label class="col-sm-4 control-label is- ">培训类型</label>
<div class="col-sm-8">
<select name="trainSubject" disabled class="form-control m-b" th:with="type=${@dict.getType('sys_usertrain_obj')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{trainSubject}"></option>
<select name="trainType" disabled class="form-control m-b" th:with="type=${@dict.getType('sys_usertrain_typer')}">
<option value="">---请选择---</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{trainType}"></option>
</select>
</div>
</div>
@ -86,17 +103,17 @@
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label">培训地点</label>
<label class="col-sm-4 control-label is- ">培训人员</label>
<div class="col-sm-8">
<textarea name="trainAddress" disabled class="form-control">[[*{trainAddress}]]</textarea>
<input name="trainName" disabled th:field="*{trainName}" class="form-control m-b" type="text">
</div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label">培训人员</label>
<label class="col-sm-4 control-label is- ">培训地点</label>
<div class="col-sm-8">
<input name="trainName" disabled th:field="*{trainName}" class="form-control" type="text">
<textarea name="trainAddress" disabled class="form-control">[[*{trainAddress}]]</textarea>
</div>
</div>
</div>
@ -104,7 +121,7 @@
<div class="row">
<div class="col-sm-12">
<div class="form-group">
<label class="col-sm-2 control-label is-required">培训日期:</label>
<label class="col-sm-2 control-label is- ">培训日期:</label>
<div class="col-sm-10">
<div class="input-daterange input-group">
<input type="text" class="input-sm form-control" disabled th:value="${#dates.format(tdTrain.trainDate, 'yyyy-MM-dd')}" name="trainDate" id="laydate-startTime" placeholder="开始日期"/>
@ -120,7 +137,7 @@
<div class="form-group">
<label class="col-sm-4 control-label">培训状态:</label>
<div class="col-sm-8">
<select name="trainState" disabled required class="form-control m-b" th:with="type=${@dict.getType('sys_examine_state')}">
<select name="trainState" disabled class="form-control m-b" th:with="type=${@dict.getType('sys_examine_state')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{trainState}"></option>
</select>
</div>
@ -148,16 +165,58 @@
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: jsonview-js" />
<th:block th:include="include :: datetimepicker-css" />
<th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: bootstrap-select-js" />
<th:block th:include="include :: select2-js" />
<script th:inline="javascript">
var trainStateDatas = [[${@dict.getType('sys_examine_state')}]];
var trainStateText = $("input[name='trainState']").val()
trainStateDatas.forEach((item)=>{
if(trainStateText === item.dictValue){
$("input[name='trainState']").val(item.dictLabel);
}
})
var prefix = ctx + "system/train";
$("#form-train-edit").validate({
focusCleanup: true
});
$(document).ready(function() {
$('#City').select2().on('change', function() {
// 更新 Vue 数据
const vueInstance = document.querySelector('#app').__vue__;
vueInstance.City = $(this).val();
vueInstance.getAreaList();
});
$('#trainSubject').select2().on('change', function() {
// 更新 Vue 数据
const vueInstance = document.querySelector('#app').__vue__;
vueInstance.trainSubject = $(this).val();
vueInstance.$nextTick(() => {
vueInstance.$forceUpdate(); // 强制更新 Vue 实例
});
})
$('#User').select2().on('change', function() {
// 更新 Vue 数据
const vueInstance = document.querySelector('#app').__vue__;
vueInstance.userName = ''
vueInstance.userName = $(this).val();
vueInstance.$nextTick(() => {
vueInstance.$forceUpdate(); // 强制更新 Vue 实例
});
})
});
/* 用户管理-修改-选择部门树 */
function selectDeptTree() {
var deptId = $.common.isEmpty($("#treeId").val()) ? "100" : $("#treeId").val();
var url = ctx + "system/user/selectDeptTree/" + deptId;
var options = {
title: '选择部门',
width: "380",
url: url,
callBack: doSubmit
};
$.modal.openOptions(options);
}
function doSubmit(index, layero){
var body = $.modal.getChildFrame(index);
$("#treeId").val(body.find('#treeId').val());
$("#treeName").val(body.find('#treeName').val());
$.modal.close(index);
}
var app = new Vue({
el: '#app',
data: {
@ -170,8 +229,8 @@
params:{
parentId:'',
},
userPost:"system/user/list",
deptObj:{}
userPost:"system/user/userList",
trainSubject:[[${tdTrain.trainSubject}]],
},
mounted(){
// 初始化地市列表
@ -180,29 +239,21 @@
this.getAreaList()
}
this.getUserList()
this.getDept()
},
watch: {
trainSubject() {
this.$nextTick(() => {
$('#User').select2(); // 重新初始化 Select2
});
}
},
methods:{
getDept(){
if (this.userName !== ''){
$.ajax({
url: ctx + this.userPost,
data:{userId:this.userName},
type: 'POST',
success:((res)=>{
this.deptObj = res.rows[0].dept
}) ,
});
}else{
this.deptObj ={}
}
},
getUserList(){
$.ajax({
url: ctx + this.userPost,
type: 'POST',
success:((res)=>{
this.userList = res.rows
this.userList = res.data
}) ,
});
},
@ -230,11 +281,6 @@
}
})
$("input[name='trainDate']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$("input[name='createDate']").datetimepicker({
format: "yyyy-mm-dd",
@ -247,12 +293,6 @@
minView: "month",
autoclose: true
});
$("input[name='trainTimeend']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
</script>
</body>
</html>

@ -3,11 +3,13 @@
<head>
<th:block th:include="include :: header('修改涉密人员培训')" />
<th:block th:include="include :: datetimepicker-css" />
<th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content" id="app">
<form class="form-horizontal m" id="form-train-edit" th:object="${tdTrain}">
<input name="ID" th:field="*{ID}" type="hidden">
<!-- <input name="deptId" type="hidden" th:field="*{deptId}" id="treeId">-->
<div class="row">
<div class="col-sm-6">
<div class="form-group">
@ -39,13 +41,11 @@
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required">人员姓名</label>
<label class="col-sm-4 control-label is-required">培训对象</label>
<div class="col-sm-8">
<select id="User" name="USERNAME" required @change="getDept()" v-model="userName" class="form-control m-b">
<select id="trainSubject" v-model="trainSubject" name="trainSubject" required class="form-control m-b" th:with="type=${@dict.getType('sys_usertrain_obj')}">
<option value="">---请选择---</option>
<option v-for="option in userList" :value="option.userId" :key="option.userId">
{{ option.userName }}
</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
@ -54,31 +54,47 @@
<div class="form-group">
<label class="col-sm-4 control-label is-required ">所属单位:</label>
<div class="col-sm-8">
<input placeholder="请输入单位名称" v-model="deptObj.deptName" required class="form-control m-b" type="text">
<input name="deptName" v-model="deptObj.deptId" type=hidden>
<div class="input-group">
<input class="form-control" required type="text" name="deptName" onclick="selectDeptTree()" id="treeName" th:field="*{deptName}">
<span class="input-group-addon"><i class="fa fa-search"></i></span>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required">培训类型</label>
<div class="form-group" v-if="trainSubject == '0'">
<label class="col-sm-4 control-label is-required">人员姓名</label>
<div class="col-sm-8">
<select name="trainType" required class="form-control m-b" th:with="type=${@dict.getType('sys_usertrain_typer')}">
<select id="User" v-model="userName" name="USERNAME" required class="form-control m-b">
<option value="">---请选择---</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{trainType}"></option>
<option v-for="option in userList" :value="option.userId" :key="option.userId">
{{ option.userName }}
</option>
</select>
</div>
</div>
<div class="form-group" v-if="trainSubject == '1'">
<label class="col-sm-4 control-label is-required">人员姓名:</label>
<div class="col-sm-8">
<input name="USERNAME" th:field="*{USERNAME}" required placeholder="请输入人员姓名" class="form-control" type="text">
</div>
</div>
<div class="form-group" v-if="trainSubject == '2'">
<label class="col-sm-4 control-label is-required">人员姓名:</label>
<div class="col-sm-8">
<input name="USERNAME" readonly th:value="'全体人员'" placeholder="全体人员" class="form-control" type="text">
</div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required">培训对象:</label>
<label class="col-sm-4 control-label is-required">培训类型</label>
<div class="col-sm-8">
<select name="trainSubject" required class="form-control m-b" th:with="type=${@dict.getType('sys_usertrain_obj')}">
<select name="trainType" required class="form-control m-b" th:with="type=${@dict.getType('sys_usertrain_typer')}">
<option value="">---请选择---</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{trainSubject}"></option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{trainType}"></option>
</select>
</div>
</div>
@ -126,11 +142,56 @@
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: bootstrap-select-js" />
<th:block th:include="include :: select2-js" />
<script th:inline="javascript">
var prefix = ctx + "system/train";
$("#form-train-edit").validate({
focusCleanup: true
});
$(document).ready(function() {
$('#City').select2().on('change', function() {
// 更新 Vue 数据
const vueInstance = document.querySelector('#app').__vue__;
vueInstance.City = $(this).val();
vueInstance.getAreaList();
});
$('#trainSubject').select2().on('change', function() {
// 更新 Vue 数据
const vueInstance = document.querySelector('#app').__vue__;
vueInstance.trainSubject = $(this).val();
vueInstance.$nextTick(() => {
vueInstance.$forceUpdate(); // 强制更新 Vue 实例
});
})
$('#User').select2().on('change', function() {
// 更新 Vue 数据
const vueInstance = document.querySelector('#app').__vue__;
vueInstance.userName = ''
vueInstance.userName = $(this).val();
vueInstance.$nextTick(() => {
vueInstance.$forceUpdate(); // 强制更新 Vue 实例
});
})
});
/* 用户管理-修改-选择部门树 */
function selectDeptTree() {
var deptId = $.common.isEmpty($("#treeId").val()) ? "100" : $("#treeId").val();
var url = ctx + "system/user/selectDeptTree/" + deptId;
var options = {
title: '选择部门',
width: "380",
url: url,
callBack: doSubmit
};
$.modal.openOptions(options);
}
function doSubmit(index, layero){
var body = $.modal.getChildFrame(index);
$("#treeId").val(body.find('#treeId').val());
$("#treeName").val(body.find('#treeName').val());
$.modal.close(index);
}
var app = new Vue({
el: '#app',
data: {
@ -143,8 +204,8 @@
params:{
parentId:'',
},
userPost:"system/user/list",
deptObj:{}
userPost:"system/user/userList",
trainSubject:[[${tdTrain.trainSubject}]],
},
mounted(){
// 初始化地市列表
@ -153,29 +214,21 @@
this.getAreaList()
}
this.getUserList()
this.getDept()
},
watch: {
trainSubject() {
this.$nextTick(() => {
$('#User').select2(); // 重新初始化 Select2
});
}
},
methods:{
getDept(){
if (this.userName !== ''){
$.ajax({
url: ctx + this.userPost,
data:{userId:this.userName},
type: 'POST',
success:((res)=>{
this.deptObj = res.rows[0].dept
}) ,
});
}else{
this.deptObj ={}
}
},
getUserList(){
$.ajax({
url: ctx + this.userPost,
type: 'POST',
success:((res)=>{
this.userList = res.rows
this.userList = res.data
}) ,
});
},

@ -4,6 +4,7 @@
<th:block th:include="include :: header('涉密人员培训审核')" />
<th:block th:include="include :: jsonview-css" />
<th:block th:include="include :: datetimepicker-css" />
<th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content" id="app">
@ -12,10 +13,10 @@
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required">所属地市:</label>
<label class="col-sm-4 control-label is- ">所属地市:</label>
<div class="col-sm-8">
<select id="City" name="AREAID" required disabled @change="getAreaList()" v-model="City" class="form-control m-b">
<option value="">请选择</option>
<select id="City" name="AREAID" disabled @change="getAreaList()" v-model="City" class="form-control m-b">
<option value="">---请选择---</option>
<option v-for="option in CityList" :value="option.id" :key="option.id">
{{ option.name }}
</option>
@ -25,10 +26,10 @@
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label">所属区县:</label>
<label class="col-sm-4 control-label is- ">所属区县:</label>
<div class="col-sm-8">
<select id="Area" name="FRAMEWORK" disabled v-model="Area" class="form-control m-b">
<option value="">请选择</option>
<select id="Area" name="FRAMEWORK" disabled v-model="Area" class="form-control m-b">
<option value="">---请选择---</option>
<option v-for="option in AreaList" :value="option.id" :key="option.id">
{{ option.name }}
</option>
@ -40,43 +41,60 @@
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label">人员姓名</label>
<label class="col-sm-4 control-label is- ">培训对象</label>
<div class="col-sm-8">
<select id="User" name="USERNAME" disabled required @change="getDept()" v-model="userName" class="form-control m-b">
<select id="trainSubject" disabled v-model="trainSubject" name="trainSubject" class="form-control m-b" th:with="type=${@dict.getType('sys_usertrain_obj')}">
<option value="">---请选择---</option>
<option v-for="option in userList" :value="option.userId" :key="option.userId">
{{ option.userName }}
</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required ">所属单位:</label>
<label class="col-sm-4 control-label is- ">所属单位:</label>
<div class="col-sm-8">
<input placeholder="请输入单位名称" disabled v-model="deptObj.deptName" required class="form-control m-b" type="text">
<div class="input-group">
<input class="form-control" disabled type="text" name="deptName" onclick="selectDeptTree()" id="treeName" th:field="*{deptName}">
<span class="input-group-addon"><i class="fa fa-search"></i></span>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label">培训类型</label>
<div class="form-group" v-if="trainSubject == '0'">
<label class="col-sm-4 control-label is- ">人员姓名</label>
<div class="col-sm-8">
<select name="trainType" disabled class="form-control m-b" th:with="type=${@dict.getType('sys_usertrain_typer')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{trainType}"></option>
<select id="User" disabled v-model="userName" name="USERNAME" class="form-control m-b">
<option value="">---请选择---</option>
<option v-for="option in userList" :value="option.userId" :key="option.userId">
{{ option.userName }}
</option>
</select>
</div>
</div>
<div class="form-group" v-if="trainSubject == '1'">
<label class="col-sm-4 control-label is- ">人员姓名:</label>
<div class="col-sm-8">
<input name="USERNAME" disabled th:field="*{USERNAME}" placeholder="请输入人员姓名" class="form-control" type="text">
</div>
</div>
<div class="form-group" v-if="trainSubject == '2'">
<label class="col-sm-4 control-label is- ">人员姓名:</label>
<div class="col-sm-8">
<input name="USERNAME" readonly th:value="'全体人员'" placeholder="全体人员" class="form-control" type="text">
</div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label">培训对象:</label>
<label class="col-sm-4 control-label is- ">培训类型</label>
<div class="col-sm-8">
<select name="trainSubject" disabled class="form-control m-b" th:with="type=${@dict.getType('sys_usertrain_obj')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{trainSubject}"></option>
<select name="trainType" disabled class="form-control m-b" th:with="type=${@dict.getType('sys_usertrain_typer')}">
<option value="">---请选择---</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{trainType}"></option>
</select>
</div>
</div>
@ -85,17 +103,17 @@
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label">培训人员:</label>
<label class="col-sm-4 control-label is- ">培训人员:</label>
<div class="col-sm-8">
<input name="trainName" disabled th:field="*{trainName}" class="form-control" type="text">
<input name="trainName" disabled th:field="*{trainName}" class="form-control m-b" type="text">
</div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required">审核人员</label>
<label class="col-sm-4 control-label is- ">培训地点</label>
<div class="col-sm-8">
<input name="updateStaffid" readonly th:field="*{updateStaffid}" class="form-control" type="text">
<textarea name="trainAddress" disabled class="form-control">[[*{trainAddress}]]</textarea>
</div>
</div>
</div>
@ -103,7 +121,7 @@
<div class="row">
<div class="col-sm-12">
<div class="form-group">
<label class="col-sm-2 control-label">培训日期:</label>
<label class="col-sm-2 control-label is- ">培训日期:</label>
<div class="col-sm-10">
<div class="input-daterange input-group">
<input type="text" class="input-sm form-control" disabled th:value="${#dates.format(tdTrain.trainDate, 'yyyy-MM-dd')}" name="trainDate" id="laydate-startTime" placeholder="开始日期"/>
@ -114,16 +132,6 @@
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="form-group">
<label class="col-sm-2 control-label">培训地点:</label>
<div class="col-sm-10">
<textarea name="trainAddress" disabled class="form-control">[[*{trainAddress}]]</textarea>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
@ -153,6 +161,7 @@
<th:block th:include="include :: footer" />
<th:block th:include="include :: jsonview-js" />
<th:block th:include="include :: datetimepicker-css" />
<th:block th:include="include :: select2-js" />
<script th:inline="javascript">
var trainStateDatas = [[${@dict.getType('sys_examine_state')}]];
var trainStateText = $("input[name='trainState']").val()
@ -161,6 +170,54 @@
$("input[name='trainState']").val(item.dictLabel);
}
})
var prefix = ctx + "system/train";
$("#form-train-edit").validate({
focusCleanup: true
});
$(document).ready(function() {
$('#City').select2().on('change', function() {
// 更新 Vue 数据
const vueInstance = document.querySelector('#app').__vue__;
vueInstance.City = $(this).val();
vueInstance.getAreaList();
});
$('#trainSubject').select2().on('change', function() {
// 更新 Vue 数据
const vueInstance = document.querySelector('#app').__vue__;
vueInstance.trainSubject = $(this).val();
vueInstance.$nextTick(() => {
vueInstance.$forceUpdate(); // 强制更新 Vue 实例
});
})
$('#User').select2().on('change', function() {
// 更新 Vue 数据
const vueInstance = document.querySelector('#app').__vue__;
vueInstance.userName = ''
vueInstance.userName = $(this).val();
vueInstance.$nextTick(() => {
vueInstance.$forceUpdate(); // 强制更新 Vue 实例
});
})
});
/* 用户管理-修改-选择部门树 */
function selectDeptTree() {
var deptId = $.common.isEmpty($("#treeId").val()) ? "100" : $("#treeId").val();
var url = ctx + "system/user/selectDeptTree/" + deptId;
var options = {
title: '选择部门',
width: "380",
url: url,
callBack: doSubmit
};
$.modal.openOptions(options);
}
function doSubmit(index, layero){
var body = $.modal.getChildFrame(index);
$("#treeId").val(body.find('#treeId').val());
$("#treeName").val(body.find('#treeName').val());
$.modal.close(index);
}
var app = new Vue({
el: '#app',
data: {
@ -173,8 +230,8 @@
params:{
parentId:'',
},
userPost:"system/user/list",
deptObj:{}
userPost:"system/user/userList",
trainSubject:[[${tdTrain.trainSubject}]],
},
mounted(){
// 初始化地市列表
@ -183,29 +240,21 @@
this.getAreaList()
}
this.getUserList()
this.getDept()
},
watch: {
trainSubject() {
this.$nextTick(() => {
$('#User').select2(); // 重新初始化 Select2
});
}
},
methods:{
getDept(){
if (this.userName !== ''){
$.ajax({
url: ctx + this.userPost,
data:{userId:this.userName},
type: 'POST',
success:((res)=>{
this.deptObj = res.rows[0].dept
}) ,
});
}else{
this.deptObj ={}
}
},
getUserList(){
$.ajax({
url: ctx + this.userPost,
type: 'POST',
success:((res)=>{
this.userList = res.rows
this.userList = res.data
}) ,
});
},
@ -232,53 +281,6 @@
}
}
})
var prefix = ctx + "system/train";
$("#form-train-examine").validate({
focusCleanup: true
});
layui.use('laydate', function(){
var laydate = layui.laydate;
var startDate = laydate.render({
elem: '#laydate-startTime',
theme: 'molv',
trigger: 'click',
done: function(value, date) {
// 结束时间大于开始时间
if (value !== '') {
endDate.config.min.year = date.year;
endDate.config.min.month = date.month - 1;
endDate.config.min.date = date.date;
} else {
endDate.config.min.year = '';
endDate.config.min.month = '';
endDate.config.min.date = '';
}
}
});
var endDate = laydate.render({
elem: '#laydate-endTime',
theme: 'molv',
trigger: 'click',
done: function(value, date) {
// Start date cannot be after end date
if (value !== '') {
startDate.config.max = {
year: date.year,
month: date.month - 1,
date: date.date
};
} else {
startDate.config.max = {
year: '',
month: '',
date: ''
};
}
}
});
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/examine", $('#form-train-examine').serialize());

@ -84,10 +84,10 @@
});
let userList = []
$.ajax({
url: ctx + "system/user/list",
url: ctx + "system/user/userList",
type: 'POST',
success:((res)=>{
userList = res.rows
userList = res.data
}) ,
});
$(function() {

Loading…
Cancel
Save