|
@@ -12,7 +12,7 @@
|
|
|
<div class="form-group">
|
|
|
<label class="col-sm-3 control-label">弹框内容:</label>
|
|
|
<div class="col-sm-8">
|
|
|
- <textarea name="alertContent" class="form-control">[[*{alertContent}]]</textarea>
|
|
|
+ <textarea id="alertContent" name="alertContent" class="form-control">[[*{alertContent}]]</textarea>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
@@ -21,7 +21,7 @@
|
|
|
<div class="col-sm-8">
|
|
|
<div class="input-group date">
|
|
|
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
|
|
- <input name="alertStartTime" th:value="${#dates.format(alertConfiguration.alertStartTime, 'yyyy-MM-dd hh:mm')}" class="form-control" placeholder="yyyy-MM-dd hh:mm" type="text">
|
|
|
+ <input id="alertStartTime" name="alertStartTime" th:value="${#dates.format(alertConfiguration.alertStartTime, 'yyyy-MM-dd hh:mm')}" class="form-control" placeholder="yyyy-MM-dd hh:mm" type="text">
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -30,7 +30,7 @@
|
|
|
<div class="col-sm-8">
|
|
|
<div class="input-group date">
|
|
|
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
|
|
- <input name="alertEndTime" th:value="${#dates.format(alertConfiguration.alertEndTime, 'yyyy-MM-dd hh:mm')}" class="form-control" placeholder="yyyy-MM-dd hh:mm" type="text">
|
|
|
+ <input id="alertEndTime" name="alertEndTime" th:value="${#dates.format(alertConfiguration.alertEndTime, 'yyyy-MM-dd hh:mm')}" class="form-control" placeholder="yyyy-MM-dd hh:mm" type="text">
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -48,6 +48,28 @@
|
|
|
</select>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <div class="form-group">
|
|
|
+ <input name="alertId" th:field="*{alertId}" style="display: none;">
|
|
|
+ <input name="salesLevel" th:field="*{salesLevel}" style="display: none;">
|
|
|
+ <input name="orgCode" th:field="*{orgCode}" style="display: none;">
|
|
|
+ <input name="orgName" th:field="*{orgName}" style="display: none;">
|
|
|
+ <input name="userTypeStr" th:field="*{userType}" style="display: none;">
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label class="col-sm-3 control-label">部门类型:</label>
|
|
|
+ <div class="col-sm-3">
|
|
|
+ <select title="请选择公司" id="deptType1" class="form-control m-b selectpicker">
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ <div class="col-sm-3">
|
|
|
+ <select title="请选择大区" id="deptType2" class="form-control m-b selectpicker">
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ <div class="col-sm-3">
|
|
|
+ <select title="请选择销售部" id="deptType3" class="form-control m-b selectpicker">
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
<!-- <div class="form-group">
|
|
|
<label class="col-sm-3 control-label">是否启动:</label>
|
|
|
<div class="col-sm-8">
|
|
@@ -58,17 +80,6 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>-->
|
|
|
- <!--<div class="form-group"> -->
|
|
|
- <!--<label class="col-sm-3 control-label">是否启动:</label>-->
|
|
|
- <!--<div class="col-sm-8">-->
|
|
|
- <!--<label class="radio-box">-->
|
|
|
- <!--<input type="radio" name="alertStatus" value="0">未启动-->
|
|
|
- <!--</label>-->
|
|
|
- <!--<label class="radio-box">-->
|
|
|
- <!--<input type="radio" name="alertStatus" value="1">启动-->
|
|
|
- <!--</label>-->
|
|
|
- <!--</div>-->
|
|
|
- <!--</div>-->
|
|
|
</form>
|
|
|
</div>
|
|
|
<th:block th:include="include :: footer" />
|
|
@@ -76,14 +87,176 @@
|
|
|
<th:block th:include="include :: bootstrap-select-js" />
|
|
|
<script type="text/javascript">
|
|
|
var prefix = ctx + "system/configuration";
|
|
|
+ var getCompanyListPrefix = "http://localhost:10001/wxportal-api/sysuser/searchOrg";
|
|
|
+ // var getCompanyListPrefix = "http://suishenbangtest.nipponpaint.com.cn/wxportal-api/sysuser/searchOrg";
|
|
|
+
|
|
|
+ $(document).ready(function () {
|
|
|
+ var formArray = $('#form-configuration-edit').serializeArray();
|
|
|
+ var formData = {};
|
|
|
+ $(formArray ).each(function(index, obj){
|
|
|
+ formData[obj.name] = obj.value;
|
|
|
+ });
|
|
|
+ $("#userType").selectpicker('val',formData.userType.split(','));
|
|
|
+ if (formData.salesLevel == 'company_level'){
|
|
|
+ var objhx1 = {
|
|
|
+ parType: 'company_level',
|
|
|
+ parValue: formData.orgCode
|
|
|
+ }
|
|
|
+ var confighuixian1 = {
|
|
|
+ url: getCompanyListPrefix,
|
|
|
+ type: "post",
|
|
|
+ dataType: "json",
|
|
|
+ data: objhx1,
|
|
|
+ beforeSend: function () {
|
|
|
+ $.modal.loading("正在处理中,请稍后...");
|
|
|
+ },
|
|
|
+ success: function(result) {
|
|
|
+ $.modal.closeLoading();
|
|
|
+ var objList = {
|
|
|
+ parType: 'diy_level',
|
|
|
+ parValue: ''
|
|
|
+ }
|
|
|
+ getCompanyList(objList,result.levelInfo.company_code);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $.ajax(confighuixian1)
|
|
|
+ }else if (formData.salesLevel == 'office_level') {
|
|
|
+ var objhx1 = {
|
|
|
+ parType: 'office_level',
|
|
|
+ parValue: formData.orgCode
|
|
|
+ }
|
|
|
+ var confighuixian1 = {
|
|
|
+ url: getCompanyListPrefix,
|
|
|
+ type: "post",
|
|
|
+ dataType: "json",
|
|
|
+ data: objhx1,
|
|
|
+ beforeSend: function () {
|
|
|
+ $.modal.loading("正在处理中,请稍后...");
|
|
|
+ },
|
|
|
+ success: function(result) {
|
|
|
+ $.modal.closeLoading();
|
|
|
+ var objList = {
|
|
|
+ parType: 'diy_level',
|
|
|
+ parValue: ''
|
|
|
+ }
|
|
|
+ getCompanyList(objList,result.levelInfo.company_code);
|
|
|
+ var objList1 = {
|
|
|
+ parType: 'company_level',
|
|
|
+ parValue: result.levelInfo.company_code
|
|
|
+ }
|
|
|
+ getCompanyList(objList1,result.levelInfo.office_code);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $.ajax(confighuixian1)
|
|
|
+ }else if (formData.salesLevel == 'suboffice_level') {
|
|
|
+ var objhx1 = {
|
|
|
+ parType: 'suboffice_level',
|
|
|
+ parValue: formData.orgCode
|
|
|
+ }
|
|
|
+ var confighuixian1 = {
|
|
|
+ url: getCompanyListPrefix,
|
|
|
+ type: "post",
|
|
|
+ dataType: "json",
|
|
|
+ data: objhx1,
|
|
|
+ beforeSend: function () {
|
|
|
+ $.modal.loading("正在处理中,请稍后...");
|
|
|
+ },
|
|
|
+ success: function(result) {
|
|
|
+ $.modal.closeLoading();
|
|
|
+ var objList = {
|
|
|
+ parType: 'diy_level',
|
|
|
+ parValue: ''
|
|
|
+ }
|
|
|
+ getCompanyList(objList,result.levelInfo.company_code);
|
|
|
+ var objList1 = {
|
|
|
+ parType: 'company_level',
|
|
|
+ parValue: result.levelInfo.company_code
|
|
|
+ }
|
|
|
+ getCompanyList(objList1,result.levelInfo.office_code);
|
|
|
+ var objList2 = {
|
|
|
+ parType: 'office_level',
|
|
|
+ parValue: result.levelInfo.office_code
|
|
|
+ }
|
|
|
+ getCompanyList(objList2,result.levelInfo.suboffice_code);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $.ajax(confighuixian1)
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
$("#form-configuration-edit").validate({
|
|
|
- focusCleanup: true
|
|
|
+ focusCleanup: true,
|
|
|
+ rules:{
|
|
|
+ alertContent:{
|
|
|
+ required:true
|
|
|
+ },
|
|
|
+ alertStartTime:{
|
|
|
+ required:true
|
|
|
+ },
|
|
|
+ alertEndTime:{
|
|
|
+ required:true
|
|
|
+ },
|
|
|
+ alertNum: {
|
|
|
+ required:true
|
|
|
+ },
|
|
|
+ userType: {
|
|
|
+ required:true
|
|
|
+ }
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
function submitHandler() {
|
|
|
if ($.validate.form()) {
|
|
|
- $.operate.save(prefix + "/edit", $('#form-configuration-edit').serialize());
|
|
|
+ var alertId = $('#alertId').val();
|
|
|
+ var contentVal = $('#alertContent').val();
|
|
|
+ var startTime = $('#alertStartTime').val();
|
|
|
+ var endTime = $('#alertEndTime').val();
|
|
|
+ var alertNum = $('#alertNum').val();
|
|
|
+ var userType = $('#userType').val().join();
|
|
|
+ var objSubmit = {
|
|
|
+ alertId:alertId,
|
|
|
+ alertContent:contentVal,
|
|
|
+ alertStartTime:startTime,
|
|
|
+ alertEndTime:endTime,
|
|
|
+ alertNum:alertNum,
|
|
|
+ userType:userType,
|
|
|
+ alertStatus:'0'
|
|
|
+ }
|
|
|
+ if ($('#deptType3').val() != "") {
|
|
|
+ objSubmit.salesLevel = 'suboffice_level';
|
|
|
+ objSubmit.orgCode = $('#deptType3').val();
|
|
|
+ objSubmit.orgName = $('#deptType3').find("option:selected")[0].label
|
|
|
+ }
|
|
|
+ if ($('#deptType2').val() != "" && $('#deptType3').val() == "") {
|
|
|
+ objSubmit.salesLevel = 'office_level';
|
|
|
+ objSubmit.orgCode = $('#deptType2').val();
|
|
|
+ objSubmit.orgName = $('#deptType2').find("option:selected")[0].label
|
|
|
+ }
|
|
|
+ if ($('#deptType1').val() != "" && $('#deptType2').val() == "" && $('#deptType3').val() == "") {
|
|
|
+ objSubmit.salesLevel = 'company_level';
|
|
|
+ objSubmit.orgCode = $('#deptType1').val();
|
|
|
+ objSubmit.orgName = $('#deptType1').find("option:selected")[0].label
|
|
|
+ }
|
|
|
+ if ($('#deptType1').val() == "" && $('#deptType2').val() == "" && $('#deptType3').val() == "") {
|
|
|
+ objSubmit.salesLevel = 'diy_level';
|
|
|
+ }
|
|
|
+ console.log('objSubmit', objSubmit);
|
|
|
+ var configSubmit = {
|
|
|
+ url: prefix + "/edit",
|
|
|
+ type: "post",
|
|
|
+ dataType: "json",
|
|
|
+ data: objSubmit,
|
|
|
+ beforeSend: function () {
|
|
|
+ $.modal.loading("正在处理中,请稍后...");
|
|
|
+ },
|
|
|
+ success:function (result) {
|
|
|
+ $.modal.closeLoading();
|
|
|
+ $.operate.successCallback(result);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $.ajax(configSubmit)
|
|
|
}
|
|
|
+ // $.operate.save(prefix + "/edit", $('#form-configuration-edit').serialize());
|
|
|
}
|
|
|
|
|
|
$("input[name='alertStartTime']").datetimepicker({
|
|
@@ -95,6 +268,87 @@
|
|
|
format: "yyyy-mm-dd hh:ii",
|
|
|
autoclose: true
|
|
|
});
|
|
|
+
|
|
|
+ $("#deptType1").on('change',function () {
|
|
|
+ if ($(this).val() != -1){
|
|
|
+ var obj1 = {
|
|
|
+ parType: "company_level",
|
|
|
+ parValue: $(this).val()
|
|
|
+ }
|
|
|
+ $("#deptType2").empty().append("");
|
|
|
+ $("#deptType2").selectpicker('refresh');
|
|
|
+ $("#deptType3").empty().append("");
|
|
|
+ $("#deptType3").selectpicker('refresh');
|
|
|
+ getCompanyList(obj1,"");
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ $("#deptType2").on('change',function () {
|
|
|
+ if ($(this).val() != -1){
|
|
|
+ var obj2 = {
|
|
|
+ parType: "office_level",
|
|
|
+ parValue: $(this).val()
|
|
|
+ }
|
|
|
+ $("#deptType3").empty().append("");
|
|
|
+ $("#deptType3").selectpicker('refresh');
|
|
|
+ getCompanyList(obj2,"");
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ /* 获取公司列表 */
|
|
|
+ function getCompanyList(obj,chooseId) {
|
|
|
+ var config = {
|
|
|
+ url: getCompanyListPrefix,
|
|
|
+ type: "post",
|
|
|
+ dataType: "json",
|
|
|
+ data: obj,
|
|
|
+ beforeSend: function () {
|
|
|
+ $.modal.loading("正在处理中,请稍后...");
|
|
|
+ },
|
|
|
+ success: function(result) {
|
|
|
+ $.modal.closeLoading();
|
|
|
+ var companyList = result.dataList;
|
|
|
+ if (companyList && companyList.length != 0){
|
|
|
+ var options = '';
|
|
|
+ if (obj.parType == 'diy_level'){
|
|
|
+ companyList.forEach(item=>{
|
|
|
+ if(item.company_code == chooseId){
|
|
|
+ options += "<option value='" + item.company_code + "' selected='selected'>" + item.company_name + "</option>"
|
|
|
+ }else{
|
|
|
+ options += "<option value='" + item.company_code + "'>" + item.company_name + "</option>"
|
|
|
+ }
|
|
|
+ })
|
|
|
+ $("#deptType1").append(options);
|
|
|
+ $("#deptType1").selectpicker('refresh');
|
|
|
+ $("#deptType1").selectpicker('render');
|
|
|
+ } else if (obj.parType == 'company_level') {
|
|
|
+ companyList.forEach(item=>{
|
|
|
+ if(item.office_code == chooseId){
|
|
|
+ options += "<option value='" + item.office_code + "' selected='selected'>" + item.office_name + "</option>"
|
|
|
+ }else{
|
|
|
+ options += "<option value='" + item.office_code + "'>" + item.office_name + "</option>"
|
|
|
+ }
|
|
|
+ })
|
|
|
+ $("#deptType2").append(options);
|
|
|
+ $("#deptType2").selectpicker('refresh');
|
|
|
+ $("#deptType2").selectpicker('render');
|
|
|
+ }else {
|
|
|
+ companyList.forEach(item=>{
|
|
|
+ if(item.suboffice_code == chooseId){
|
|
|
+ options += "<option value='" + item.suboffice_code + "' selected='selected'>" + item.suboffice_name + "</option>"
|
|
|
+ }else{
|
|
|
+ options += "<option value='" + item.suboffice_code + "'>" + item.suboffice_name + "</option>"
|
|
|
+ }
|
|
|
+ })
|
|
|
+ $("#deptType3").append(options);
|
|
|
+ $("#deptType3").selectpicker('refresh');
|
|
|
+ $("#deptType3").selectpicker('render');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+ $.ajax(config)
|
|
|
+ }
|
|
|
</script>
|
|
|
</body>
|
|
|
</html>
|