zt пре 1 година
родитељ
комит
2ed2f39cd8

+ 12 - 5
nngkxxdp/src/main/resources/static/page/index.html

@@ -293,7 +293,7 @@
         }
 
         .layui-form-label {
-            width: 110px;
+            width: 150px;
         }
 
         #web_sitesms {
@@ -1744,22 +1744,28 @@
         <input type="hidden" id="ly-type2">
 		<div class="layui-form-item">
 		    <label class="layui-form-label">已有联系人:</label>
-		    <div class="layui-input-block">
+		    <div class="layui-input-block" style="margin-left:150px">
 		        <div id="ly-sms-phones"></div>
 		    </div>
 		</div>
         <div class="layui-form-item">
-            <label class="layui-form-label">手机号:</label>
-            <div class="layui-input-block">
+            <label class="layui-form-label">自定义手机号:</label>
+            <div class="layui-input-block" style="margin-left:150px">
 				<div id="ly-sms-phone"></div>
             </div>
         </div>
         <div class="layui-form-item">
             <label class="layui-form-label">短信内容:</label>
-            <div class="layui-input-block">
+            <div class="layui-input-block" style="margin-left:150px">
                 <textarea id="ly-sms-remark" placeholder="请输入内容" class="layui-textarea" maxlength="500"></textarea>
             </div>
         </div>
+        <div class="layui-form-item">
+            <label class="layui-form-label">已选择联系人:</label>
+            <div class="layui-input-block tags" style="margin-left:150px">
+               
+            </div>
+        </div>
         <!-- <div class="layui-form-item">
             <div class="layui-input-block">
                 <button id="ly-ljbtn-sms" type="button" class="layui-btn">发送</button>
@@ -1769,6 +1775,7 @@
     </form>
 </div>
 </body>
+
 <script type="text/html" id="query_bar" class="">
     <a class="  layui-btn-xs " lay-event="del" style="color: #0970D8;">提醒</a>
 </script>

+ 58 - 16
nngkxxdp/src/main/resources/static/page/js/base/fbtx.item.js

@@ -673,16 +673,17 @@ $('#smsSend').on('click', function () {
         },
 		btn1: function() {
 			let phones = []
-			let arr = smsView.phoneSelect.getValue()
-			for (let i = 0; i < arr.length; i++) {
-				const p = arr[i].value.replace(/\s/g, "")
-				if (!phones.includes(p)) {
-					phones.push(p)
-				}
-			}
-			let arr2 = $("#ly-sms-phone .layui-btn")
+			// let arr = smsView.phoneSelect.getValue()
+			// for (let i = 0; i < arr.length; i++) {
+			// 	const p = arr[i].value.replace(/\s/g, "")
+			// 	if (!phones.includes(p)) {
+			// 		phones.push(p)
+			// 	}
+			// }
+			let arr2 = $(".tags .layui-btn")
+           
 			for (let i = 0; i < arr2.length; i++) {
-				const p = $(arr2[i]).text().replace(/\s/g, "")
+				const p = parseFloat($(arr2[i]).text().replace(/\s/g, ""))
 				if (!phones.includes(p)) {
 					phones.push(p)
 				}
@@ -1114,20 +1115,23 @@ const smsView = {
 					for (let i = 0; i < json.data.length; i++) {
 						if (json.data[i].leaderphone) {
 							arr.push({
-								name: json.data[i].leaderphone + '(' + json.data[i].deptname + ':' + json.data[i].leaderperson + ')',
-								value: json.data[i].leaderphone
+								name: json.data[i].leaderphone + '(' + json.data[i].leaderperson+':'+json.data[i].deptname +  '分管领导' +  ')',
+								value: json.data[i].leaderphone,
+                                id:json.data[i].deptid+Math.random()
 							})
 						}
 						if (json.data[i].mainLeaderPhone) {
 							arr.push({
-								name: json.data[i].mainLeaderPhone + '(' + json.data[i].deptname + ':' + json.data[i].mainLeader + ')',
-								value: json.data[i].mainLeaderPhone
+								name: json.data[i].mainLeaderPhone + '(' +json.data[i].mainLeader+':'+ json.data[i].deptname  + '主要领导' + ')',
+								value: json.data[i].mainLeaderPhone,
+                                id:json.data[i].deptid+Math.random()
 							})
 						}
 						if (json.data[i].workphone) {
 							arr.push({
-								name: json.data[i].workphone + '(' + json.data[i].deptname + ':' + json.data[i].workperson + ')',
-								value: json.data[i].workphone
+								name: json.data[i].workphone + '(' + json.data[i].workperson+':'+json.data[i].deptname +  '工作人员'  + ')',
+								value: json.data[i].workphone,
+                                id:json.data[i].deptid+Math.random()
 							})
 						}
 					}
@@ -1135,13 +1139,51 @@ const smsView = {
 						el: '#ly-sms-phones',
 						language: 'zn',
 						filterable: true,
-						data: arr
+                        theme: {
+                            color: '#1E9FFF',
+                        },
+						data: arr,
+                        on:function(data){
+                            if(data.isAdd){
+                                var _html = '<div class="layui-btn layui-btn-normal {0} none-transition" id="{2}" ng-index="{3}" ng-color="{0}">{1}<i class="layui-icon layui-icon-close"></i></div>'
+                                    .format('', data.change[0].name,data.change[0].id, data.change[0].id);
+                                    $('.tags').append(_html);
+                                    let child=$('.tags').children()
+                                    for (let i = 0; i < child.length; i++) {
+                                        const item = child[i];
+                                        item.addEventListener('click',function(e){
+                                            if(e.target.tagName==='I'){
+                                                let arr1 = smsView.phoneSelect.getValue()
+                                                let index= arr1.findIndex(o=>{
+                                                return o.id===Number($(item).attr('id'))
+                                                })
+                                                if(index!=-1){
+                                                    arr1.splice(index,1)
+                                                    smsView.phoneSelect.setValue(arr1)
+                                                    $(item).remove()
+                                                }
+                                            }
+                                        })
+                                    }
+                            }else{
+                                let child=$('.tags').children()
+                                for (let i = 0; i < child.length; i++) {
+                                    const item = child[i];
+                                    if($(item).text()===data.change[0].name){
+                                       $(item).remove()
+                                    }
+                                }
+                            }
+                        }
 					})
+                   
 				}
 		        
 		    }
 		});
 	},
+
+
 	initPhoneInput: function() {
 		$('#ly-sms-phone').empty()
 		layui.labelGeneration.render({

+ 62 - 9
nngkxxdp/src/main/resources/static/page/layui/labelGeneration.js

@@ -70,12 +70,13 @@ layui.define(['form'], function (exports) {
     Class.prototype.components = {
         label: {
             render: function (json,options) {
-                var _html = '<blockquote class="layui-elem-quote">';
-                _html += '<div class="layui-form layui-form-pane layui-form-item">';
-                _html += '<label class="layui-form-label">输入手机号</label>';
-                _html += '<div class="layui-input-inline">';
+                // var _html = '<blockquote class="layui-elem-quote">';
+                var _html = ''
+                _html += '<div class="layui-form layui-form-pane layui-form-item" style="clear:none">';
+                // _html += '<label class="layui-form-label">输入手机号</label>';
+                _html += '<div class="layui-input-inline" >';
 				if (options.isEnter) {
-                _html += '<input type="text" id="{0}" lay-verify="required" placeholder="按回车生成手机号" autocomplete="off" class="layui-input">'
+                _html += '<input type="text" id="{0}" lay-verify="required" placeholder="请输入手机号 按回车生成" autocomplete="off" class="layui-input">'
                     .format(json.id);
 				} else {
 					_html += '<input type="text" id="{0}" lay-verify="required" placeholder="通过按钮生成标签" autocomplete="off" class="layui-input">'
@@ -85,6 +86,9 @@ layui.define(['form'], function (exports) {
                 if (!options.isEnter) {
                     _html += '<button type="button" id="{0}-button" class="layui-btn layui-btn-normal">确定</button>'.format(json.id);
                 }
+                  _html += '<div class="layui-input-inline">';
+                  _html += '<div class=" generate" style="margin:0;line-height:38px;width:60px;text-align:center;    border-color: #1E9FFF;background-color: #1E9FFF;color: #fff;cursor:pointer">确定</div>';
+                  _html += '</div>';
                 // _html += '<label class="layui-form-label">颜色选择</label>';
                 // _html += '<div class="layui-input-inline">';
                 // _html += '<select lay-filter="{0}-switchTest">'.format(json.id);
@@ -97,7 +101,7 @@ layui.define(['form'], function (exports) {
                 // _html += '</div>';
                 _html += '</div>';
                 _html += '<div id="{0}-content"></div>'.format(json.id);
-                _html += '</blockquote>';
+                // _html += '</blockquote>';
                 return _html;
             },
             update: function (json) {
@@ -179,19 +183,68 @@ layui.define(['form'], function (exports) {
 							return
 						}
 					}
-					
+                    // let arr1 = smsView.phoneSelect.getValue()
+                    // arr1.push({
+                    //     children:undefined,
+                    //     name:_value,
+                    //     selected:false,
+                    //     value:_value
+                    // })
+                    // smsView.phoneSelect.setValue(arr1)
                     index = index + 1;
-                    var _html = '<div class="layui-btn {0} none-transition" id="{2}" ng-index="{3}" ng-color="{0}">{1}<i class="layui-icon layui-icon-close"></i></div>'
+                    var _html = '<div class="layui-btn layui-btn-normal {0} none-transition" id="{2}"  ng-index="{3}" ng-color="{0}">{1}<i class="layui-icon layui-icon-close"></i></div>'
                         .format(colorClass, _value, _json.id + index, index);
-                    $("#" + _json.id + "-content").append(_html);
+                        $('.tags').append(_html);
+                    // $("#" + _json.id + "-content").append(_html);
 					 $("#" + _json.id).val('');
                     options.data.push({"ngColor": colorClass, "value": _value});
+                    
                     $("#" + _json.id + index + " .layui-icon-close").click(function () {
+                        // let arr1 = smsView.phoneSelect.getValue()
+                        // arr1.splice(arr1.findIndex(item=>{
+                        //     return item.value===$(this).parent().text()
+                        // }),1)
+                        // smsView.phoneSelect.setValue(arr1)
                         that.deleteValue($(this).parent().text(), $(this).parent().attr("ng-color"));
                         $(this).parent().remove();
                     });
                 }
             });
+            $('.generate').click(function(){
+                var _value = $("#" + _json.id).val();
+					if (!_value) {
+						layer.msg('请输入手机号!')
+						return;
+					}
+					if (!/^1[3456789]\d{9}$/.test(_value)) {
+						layer.msg('手机号格式错误!')
+						return;
+					}
+					let arr = $("#" + _json.id + "-content .layui-btn")
+					for (let i = 0; i < arr.length; i++) {
+						if ($(arr[i]).text().trim() == _value) {
+							layer.msg('输入手机号重复!')
+							return
+						}
+					}
+                    index = index + 1;
+                    var _html = '<div class="layui-btn layui-btn-normal {0} none-transition" id="{2}" ng-index="{3}" ng-color="{0}">{1}<i class="layui-icon layui-icon-close"></i></div>'
+                        .format(colorClass, _value, _json.id + index, index);
+                        $('.tags').append(_html);
+                    // $("#" + _json.id + "-content").append(_html);
+					 $("#" + _json.id).val('');
+                    options.data.push({"ngColor": colorClass, "value": _value});
+                    
+                    $("#" + _json.id + index + " .layui-icon-close").click(function () {
+                        // let arr1 = smsView.phoneSelect.getValue()
+                        // arr1.splice(arr1.findIndex(item=>{
+                        //     return item.value===$(this).parent().text()
+                        // }),1)
+                        // smsView.phoneSelect.setValue(arr1)
+                        that.deleteValue($(this).parent().text(), $(this).parent().attr("ng-color"));
+                        $(this).parent().remove();
+                    });
+            })
         } else {
             $("#" + _json.id + "-button").click(function (event) {
                 var _value = $("#" + _json.id).val();