<%@ page language="java" 	pageEncoding="utf-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>发布邮件</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
<!-- bootstrap 3.0.2 -->
<link href="<c:url value='/scripts/lib/layui/layui.css'/>" rel="stylesheet" type="text/css" />
<link media="screen" type="text/css" href="<c:url value='/scripts/lib/ueditor/themes/default/css/ueditor.min.css'/>" rel="stylesheet"/>

<!-- Theme style -->
<link href="<c:url value='/styles/AdminLTE.css'/>" rel="stylesheet" type="text/css" />
<link href="<c:url value='/styles/notice/noticeEmailPublish.css?v=666666'/>" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<c:url value='/scripts/lib/jquery-1.8.2.min.js'/>"></script>
<script type="text/javascript" src="<c:url value='/scripts/lib/layui/layui.js'/>"></script>
<%-- <script type="text/javascript" src="<c:url value='/scripts/lib/layDate/laydate.dev.js'/>"></script> --%>
<script type="text/javascript" src="<c:url value='/scripts/lib/ueditor/ueditor.config.js'/>"></script>
<script type="text/javascript" src="<c:url value='/scripts/lib/ueditor/ueditor.all.js'/>"></script>
<script type="text/javascript" src="${ctx}/scripts/jquery/ajaxfileupload.js"></script>
<script type="text/javascript" src="<c:url value='/scripts/lib/template-native.js'/>"></script>


<script src="<c:url value='/scripts/admin/notice/element/vue.js?v=1234'/>"></script>
	<link rel="stylesheet" href="//superdesk.avic-s.com/avicfile/theme/theme-chalk.css">
<script src="<c:url value='/scripts/admin/notice/element/element.js?v=1234'/>"></script>
<!-- <script src = "//cdn.polyfill.io/v2/polyfill.min.js"></script> -->
 <script src="<c:url value='/scripts/admin/notice/element/polyfill.js?v=12345555'/>"></script>
<style type="text/css">
	.email-send-pass{
		display: flex !important;
    	margin-bottom: 20px;
	}
	.radio-top-content{
		display: flex !important;
		margin-top: 13px;
	}
	.radio-bottom-content{
		display: flex !important;
		margin-top: 20px;
	}
	.radio-inner-choose-dep{
		display: flex;
	}
	.btn-blue-stp{
		padding: 0;
		height: 40px;
		line-height: 40px;
		width: 120px;
		text-align: center;
		border: 1px solid #158DF6;
		color: #158DF6!important;
		background: #fff;
		border-radius: 4px;
		font-size: 14px;
		cursor: pointer;
		margin-left: 40px;
		margin-top: -12px;
	}
	.wx-tips{
		font-size: 15px;
   		 color: #333;
    	font-weight: 600;
	}
	.radio-title-name{
		font-size: 15px;
		color: #333;
		font-weight: 600;
		margin-top: 2px;
	}
	.el-radio__inner{
		width: 20px !important;
		height: 20px !important;
	}
	.dialog-pop{
        display: none;
      }
    .el-radio__input.is-checked .el-radio__inner::after {
      content: "";
      width: 10px;
      height: 5px;
      border: 2px solid white;
      border-top: transparent;
      border-right: transparent;
      text-align: center;
      display: block;
      position: absolute;
	  top: 4px;
      left: 3px;
      vertical-align: middle;
      transform: rotate(-45deg);
      border-radius: 0px;
      background: none;
  }
  	.img-sup-icon{
        width: 20px;
        height: 20px;
        margin-right: 10px;
      }
	  .custom-tree-node{
        width: 100%;
        display: flex;
      }
      .el-tree-node-name{
        flex: 1;
		padding: 6px 0;
      }
	  .tag-css{
        margin: 5px;
      }

	  .el-checkbox__input.is-checked + .el-checkbox__label{
        color: #333 !important;
      }
      .cell-box{
        padding: 12px 0;
        font-size: 15px;
        color: #333;
        border-bottom: 1px solid #ddd;
      }
      .el-menu-item.is-active {
		color: #409EFF !important;
		font-size: 16px;
		font-weight: 600;
      }
      .tag-size{
        display: flex !important;
      }
      .sub-item-name{
        flex: 1;
      }
      .icon-check-item{
        font-size: 20px;
        color: #409EFF;
        font-weight: 600;
        margin-right: 20px;
      }
	  .tv-choose-content{
         margin-top:5px;
         color: #333;
        font-size: 15px;
        max-width: 600px;
        word-break:break-all;       
        word-wrap:break-word; 
        line-height: 25px;   
       }
	     /*文件夹图标*/
		.span-button.ico_open {
			background-position: -110px -16px;
		}

		/*文件图标*/
		.span-button.ico_docu {
			background-position: -110px -32px;
		}
		/*按钮图片组*/
		.span-button {
			line-height: 0;
			margin: 0;
			width: 16px;
			height: 16px;
			display: inline-block;
			vertical-align: middle;
			border: 0 none;
			cursor: pointer;
			outline: none;
			background-color: transparent;
			background-repeat: no-repeat;
			background-attachment: scroll;
			background-image: url("http://wx.palmnest.com/avicfile/2019/ysf/zTreeStandard.png");
		}
		.search-rs-title{
        margin-top: 15px;
        font-size: 15px;
        color: #333;
        background: #eee;
        padding: 8px 10px;
      }


	
</style>
</head>
<body>
	<div  id="app">
		<div class="bread-wp">
					公告通知 >  发布公告消息  > 邮件消息
		</div>
	<div class="right-content">
	<input type="hidden" value="${ctx}" id="contextPath">
		 <ul class="third-tabs">
	          <li class="third-tab ">
	            <a href="noticeAppPublish">公告</a>
	          </li>
	          <li class="third-tab ">
	            <a href="wxPublish">微信模板消息</a>
	          </li>
	          <li class="third-tab">
	            <a href="msgPublish">短信消息</a>
	          </li>
	          <li class="third-tab active">
	            <a href="emailPublish">邮件消息</a>
	          </li>
        </ul>
		<div class="main-content-mode-wp clearfloat email-publish-wp ">
		 	<div class="email-con-left">
		 		<div class="email-send-wp ">
					<c:if test="${fn:length(orgs) > 1}">
			 		<span class="e-tips-wp">项目：</span>
			 		<select class="select-width180 orgId" name="orgId" id="orgId" >
					<option value="">请选择项目</option>
					<c:forEach items="${orgs }"  var="org">
					<option value="${org.id }">${org.name }</option>
					</c:forEach>
				</select>
					</c:if>
					<c:if test="${fn:length(orgs) == 1}">
						<input type="hidden" name="orgId" id="orgId" value="${orgs[0].id}">
					</c:if>
		 		</div>
		 		<br/>
				  <div class="email-send-pass">
					<div>
						<span class="e-tips-wp">发件邮箱：</span>
		 			<select class="send-email-num select-width180">
		 				<option value="">选择发件邮箱</option>
		 			</select>
					</div>
					
					<div class="approvalStyle">
					<span class="e-tips-wp">审核类型:</span>
					<select name="city" class="small-input select-width180" id="approvalType">
						<option value="">请选择审核类型</option>
					</select>
					</div>
				  </div>
		 			
					<div class="email-theme-wp clearfloat">
						<span class="e-tips-wp">邮件主题</span>
						<input class="email-theme-input" type="text"/>
					</div>
					<div class="email-inform-wp clearfloat">
						<span class="e-tips-wp">邮件正文</span>
						<div class="email-inform-con">
							<div class="email-inform" id="myeditor"></div>
							<div class="add-attach-wp">
								<div class="add-attach-btn">
									<button class="btn-white-width90 btn">添加附件</button>
									<input type="file" class="file-input" id="attach_File" name="uploadfile"/>
								</div>
								<div class="attach-list clearfloat">
								</div>
							</div>
						
						</div>
					</div>
					<div class="email-operate-wp">
						<button class="e-sure-btn btn-red-width90" @click="submitEmail">确定发送</button>
						<button class="c-clear-btn btn-white-width90">清空</button>
					</div>
		 	</div>
		 	<div class="email-con-right">
				<span class="wx-tips">发送对象</span>
				<div>
					<el-radio-group v-model="checkRadio" @change="changeValue">
						<el-radio :label="1" class="radio-top-content p-t-1">
							<div class="radio-title-name">邮箱发送</div>
							<div class="email-number-wp clearfloat">
								<span class="e-tips-wp">目标邮箱：<span class="tip">（每行一个）</span></span>
								<div class="email-list-wp">
									<textarea  class="email-list"></textarea>
									<div class="m-white-btns">
										<button class="filter-btn btn-white-width90">重号过滤</button>
										<button class="clear-btn btn-white-width90">清空</button>
										<button class="export-btn btn-red-width90">导入</button>
									</div>
								</div>
							</div>
						</el-radio>
						<el-radio :label="2" class="radio-bottom-content p-t-2">
							<div class="radio-inner-choose-dep">
								<div class="radio-title-name">部门分组发送 </div>
								<button class="btn-blue-stp choose-dep-stp" @click="chooseDep">选择部门/分组</button>
							  </div>  
						</el-radio>
					
					  </el-radio-group>
					  <div class="tv-choose-content" v-if="checkRadio==2">
						<el-tag
						class="tag-css tag-top"
						v-for="(item, index) in chooseDepList"  :key="index"
						closable
						:disable-transitions="false"
						  @close="deleteResultDepHandler(item, index)">
						{{item.name}}
					  </el-tag>
					  </div>
				</div>
		 	</div>
		</div>
	</div>
	<div class="dialog-pop">
		<el-dialog
		:title="titleName"
		:close-on-click-modal="false"
		width="800px"
		:visible.sync="isDislagVisable"
		>
    <div style="float: left">
      <div style="float:left;width: 480px;height: 500px;">
        <div style="display: flex">
          <el-input
            class="search-input"
            placeholder="请输入部门、分组名称搜索"
            prefix-icon="el-icon-search" clearable  @change="changeInput"
            v-model="searchText">
          </el-input>
          <el-button slot="append" icon="el-icon-search" @click="searchDeptOrSup"></el-button>
        </div>
		<div class="search-data-wrap" v-show="false">
            <div style="overflow-y: scroll;height: 440px;">
              <div v-if=" searchDataList.deptList && searchDataList.deptList.length>0">
              <div class="search-rs-title">部门</div>
              <div class="list-box click-cursor" v-for="(item, index) in searchDataList.deptList" :key="item.id" 
                :class="{'line-top': index != 0}">
                <div class="cell-box">
                  <div class="tag-size" v-on:click="searchDataHandler(item)">
                    <img src="http://wx.palmnest.com/avicfile/2019/ysf/img_docum.png" class="img-sup-icon"/>
                    <span class="sub-item-name">{{item.name}}</span>
                <span v-if="backSelectedHandler(item.id)" class="radio-icon el-icon-check icon-check-item"></span>
                  </div>
                </div>
              </div>
            </div>
              <div v-if="searchDataList.groupList&&searchDataList.groupList.length>0">
              <div class="search-rs-title" >分组</div>
              <div class="list-box click-cursor" v-for="(item, index) in searchDataList.groupList" :key="item.id" 
                :class="{'line-top': index != 0}">
                <div class="cell-box">
                  <div class="tag-size" v-on:click="searchDataHandler(item)">
                    <img src="../../../../super_service/images/admin/tag-icon.png" class="img-sup-icon"/>
                    <span class="sub-item-name">{{item.name}}</span>
                <span v-if="backSelectedHandler(item.id)" class="radio-icon el-icon-check icon-check-item"></span>
                  </div>
                </div>
              </div>
            </div>
            </div>
          </div>
		<div class="default-data-wrap" v-show="true"> 
        <div class="tree-group-box box-top10 box-right15">
          <el-menu :default-active="activeIndex" mode="horizontal" @select="handleSelect">
            <el-menu-item index="1" v-if="indexType == 1||indexType == 0">部门</el-menu-item>
            <el-menu-item index="2" v-if="indexType == 2||indexType == 0">分组</el-menu-item>
          </el-menu>
        </div>
        <div style="overflow-y: scroll;height: 400px;padding-top: 10px;" v-if="activeIndex == 1">
		 <el-tree :data="dataTree"  default-expand-all node-key="id" @node-click="handleNodeClick"
		 :filter-node-method="filterNodeHandler"   :expand-on-click-node="false"
             ref="tree" highlight-current  :props="defaultProps"> 
			 <span class="custom-tree-node" slot-scope="{node, data}">
			 <span @mouseover="showTip(data.id)" @mouseout="hideTip"  class="el-tree-node-name">
				<span v-if="data.childList&&data.childList.length>0||data.levels==0"
					  class="span-button ico_open"></span>
				<span v-else class="span-button ico_docu"></span>
				<span>{{node.label}}</span>
			  </span>
        <span v-if="backSelectedDepHandler(data.id)" class="radio-icon el-icon-check icon-check-item"></span> 
			</span>
			</el-tree>
        </div>
        <div style="overflow-y: scroll;height: 385px;" v-if="activeIndex == 2">
          <div class="list-box click-cursor" v-for="(item, index) in tagList" :key="item.id" 
		  :class="{'line-top': index != 0}">
            <div class="cell-box">
              <div class="tag-size" v-on:click="tagBtnHandler(item)">
                <img src="../../../../super_service/images/admin/tag-icon.png" class="img-sup-icon"/>
                <span class="sub-item-name">{{item.name}}</span>
				    <span v-if="backSelectedHandler(item.id)" class="radio-icon el-icon-check icon-check-item"></span>
              </div>
            </div>
          </div>
        </div>
		</div>  
      </div>
      <div style="margin-left:10px;float: left;width: 1px;height: 480px; background: #F3F3F3"></div>
      <div style="margin-left:10px;float:left;width: 250px;">
        <div style="width: 100%">已选择</div>
        <div style="width: 100%;height: 460px;overflow-y: scroll;">
          <el-tag
            class="tag-css tag-top"
            v-for="(item, index) in identityList"  :key="index"
            closable
            :disable-transitions="false"
		    	@close="deleteTagHandler(item, index)">
            {{item.name}}
          </el-tag>
        </div>
      </div>
    </div>
    <span slot="footer" class="dialog-footer">
        <el-button size="small" @click="isDislagVisable = false">返回</el-button>
        <el-button size="small" type="primary" @click="chooseDataSubmit">确定</el-button>
      </span>
     </el-dialog>
	</div>
</div>
<script type="text/javascript">
	// 在页面加载好后就初始化vue实例,也可以在外面直接初始化
	$(document).ready(function(){
		const vm = new Vue({
			el:'#app',
			data(){
				return {
					isOpenApprove:0,
					dataForm:{
						orgId:'',
					},
					ifShowSearch:false,
					searchDataList:{},
					editId:'',
					checkRadio:0,
					titleName: '请选择部门和分组',
					searchNote: '',
					activeIndex: '1',
					indexType: '0',
					isDislagVisable: false,
					identityList:[],
					chooseDepList:[],//选中的数据
					dataTree: [],
					tagList: [],
					selectedId: '',
					searchText: '',
					contextBasePath:'',
					defaultProps: {
						children: 'childList',
						label: 'nameinfo'
          			},
				}
			},
			   //监听搜索框的查询参数变化，然后进行过滤
			   watch:{
					searchText(val) {
						if(this.activeIndex==1){
						setTimeout(() => {
							this.$refs.tree.filter(val)
						}, 1000);
						}else{
						this.getSubgroupList(val)
						}
						}
					},
			methods:{
				filterNodeHandler(value, data, node) {
						if (!value) {
							return true
						}
						let level = node.level
						let _array = [] //这里使用数组存储 只是为了存储值。
						this.getReturnNode(node, _array, value)
						let result = false
						_array.forEach(item => {
							result = result || item
						})
						return result
				},
				 getReturnNode(node, _array, value) {
						let isHasData = node.data && node.data.nameinfo && node.data.nameinfo.indexOf(value) !== -1
						isHasData ? _array.push(isHasData) : ''
						if (!isHasData && node.level != 1 && node.parent) {
							this.getReturnNode(node.parent, _array, value)
						}
					},

				deleteResultDepHandler(data, index){
					this.chooseDepList.splice(index, 1);
      			  },
				changeInput(value){
				if(value){
					this.ifShowSearch=true
				}else{
					this.ifShowSearch=false
				}
				},
				//弹框搜索
				searchDeptOrSup(){
					let _this = this;
					if(_this.activeIndex==2 ){
						_this.getSubgroupList(_this.searchText)
					}	

				},
				 //搜索选中的情况下
				 searchDataHandler(data){
					if (this.backSelectedHandler(data.id)) {
					let indexRow = this.backSelectedHandler(data.id, true);
					if (indexRow != -1) {
						this.identityList.splice(indexRow, 1);
					}
					} else {
						let newArr=[]
					let resultObj={}
					resultObj['id']=data.id
					resultObj['name']=data.name
					resultObj['type']=3
					newArr.push(resultObj)
			          this.identityList=[...this.identityList,...newArr]
					}
				},		
				submitEmail: function () {
					let _this=this
					//邮件消息id
					var id = _this.editId
					//项目id
					var orgId = $("#orgId").val()
					if (!orgId) {
						_this.$message({message: '请选择项目!', type: 'error'});
						return false;
					};
					//发件人邮箱id
					var emailaccount_id = $(".send-email-num").val();
					//主题
					var email_theme = $(".email-theme-input").val();
					//收件箱
					var recipient_email = $(".email-list").val().split('\n').join(";");
					//邮箱内容
					var ue = UE.getEditor('myeditor');
					var email_centent = ue.getContent();
					var contentTxt = ue.getContentTxt();;
					console.log("邮箱内容",contentTxt)
					//附件地址
					var urlList = [];
					$(".attach-item").each(function (index, ele) {
						var str = $(ele).data("url")
						urlList.push(str)
					})
					var attach_ment = urlList.join(",");
					if (!emailaccount_id) {
						_this.$message({message: '请选择发件人邮箱!', type: 'error'});
						return false;
					}
					var approvedata=$("#approvalType").val()
					if (this.isOpenApprove==1 && !approvedata) {
						_this.$message({message: '请选择审核类型!', type: 'error'});
						return false;
					}
					if (!email_theme) {
						_this.$message({message: '请输入邮件主题!', type: 'error'});
						return false;
					};
					
					if (!email_centent) {
						_this.$message({message: '请输入邮箱内容!', type: 'error'});
						return false;
					}
					
					let deptGroupJson=''
					if(_this.checkRadio==2){
							if(_this.identityList.length>0){
								deptGroupJson=JSON.stringify(_this.chooseDepList)
								}else {
								_this.$message({message: '请选择部门或者分组！', type: 'error'});
								return false;
							}
						}else if(_this.checkRadio==1){
							if (!recipient_email) {
								_this.$message({message: '请输入目标邮箱!', type: 'error'});
						       return false;
					    }
						}else{
							_this.$message({message: '请选择发送对象!', type: 'error'});
						       return false;
						}
					$.ajax({
						type: "post",
						url:  "/super_service/notice/emailSend/saveOrUpdate",
						data: {
							"email_theme": email_theme,
							"recipient_email": recipient_email,
							"email_centent": email_centent,
							"attach_ment": attach_ment,
							"emailaccount_id": emailaccount_id,
							"id": !!id ? id : '',
							"orgId": orgId,
							"approvalType" : $("#approvalType").val()? $("#approvalType").val():'',
							contentTxt: contentTxt,
							receiveType:_this.checkRadio,
							deptGroupJson:deptGroupJson

						},
						success: function (data) {
							if (data.code == '200') {
								if (!!id) {
									_this.$message({message: '编辑成功！', type: 'success'});
									window.location.href = '/super_service/notice/audit/noticeEmailVerify';
								} else {
									ue.setContent('');
									$(".email-list,.email-theme-input,.send-email-num").val("");
									$(".attach-list").html("");
									_this.$message({message: '提交发送成功！', type: 'success'});
									window.location.href = '/super_service/notice/audit/noticeEmailVerify';
								}

							} else {
								_this.$message({message:data.msg, type: 'error'});
							}
							$(".e-sure-btn").attr("disabled", false)
						},
						error: function (error) {
							$(".e-sure-btn").attr("disabled", false)
						}
					});

				},
		// 		handleNodeClick(data,node,inde){
		// 		console.log("handleNodeClick",data)
		// 		if (this.backSelectedDepHandler(data.id)) {
		//           let indexRow = this.backSelectedDepHandler(data.id, true);
		//           if (indexRow != -1) {
		//             this.identityList.splice(indexRow, 1);
		//           }
		//           } else {
		// 				let newArr=[]
		// 				let resultObj={}
		// 				resultObj['id']=data.id
		// 				resultObj['name']=data.nameinfo
		// 				if(data.levels==0){
		// 					resultObj['type']=1
		// 				}else{
		// 					resultObj['type']=2
		// 				}
				
		// 			newArr.push(resultObj)
		//           this.identityList=[...this.identityList,...newArr]
		//           }
       	// 		 },
		         // 数据根据id去重
				 unique(arr) {
					const res = new Map();
					return arr.filter((arr) => !res.has(arr.id) && res.set(arr.id, 1));
     			 },
			   // 递归获取所有节点数据
				getAllNodeId (expandedKeys, moduleDataList) {
					for (let i = 0; i < moduleDataList.length; i++) {
					expandedKeys.push({
						id: moduleDataList[i].id,
						levels: moduleDataList[i].levels,
						nameinfo: moduleDataList[i].nameinfo,
						orgInfo: moduleDataList[i].orgInfo,
						parentid: moduleDataList[i].parentid,
						rank: moduleDataList[i].rank,
						visible: moduleDataList[i].visible,
						childList: [],
					});
					if (moduleDataList[i].childList) {
						expandedKeys = this.getAllNodeId(expandedKeys, moduleDataList[i].childList)
					}
					}
					return expandedKeys
			},
         // 处理选中数据
				processSelectedData(data, backData) {
					let dataList = [];
					if (data.id) {
					dataList = this.getAllNodeId(dataList, [data]);
					backData(dataList)
					} else {
					backData([])
					}
			},

        handleNodeClick(data,node,inde){
          this.processSelectedData(data, backData => {
            console.log('backData', backData);
            if (this.backSelectedDepHandler(data.id)) {
              backData.forEach(item => {
                let indexRow = this.backSelectedDepHandler(item.id, true);
                this.identityList.splice(indexRow, 1);
              })
            } else {
              this.identityList = this.unique(this.identityList.concat(backData))
            }
            console.log("最后选中的列表",this.identityList)

            let newArr=[]
          for (const data of this.identityList) {
            let resultObj={}
           resultObj['id']=data.id
		   resultObj['name']= data.name?data.name:data.nameinfo
           if(data.levels==0){
            resultObj['type']=1
           }else{
            resultObj['type']=2
           }
           newArr.push(resultObj)
          }
           this.identityList=[...newArr]
           
          console.log("最后选中11111",this.identityList)
     
          });
        },
				backSelectedDepHandler(id, isIndex = false){
					let isYN = false;
					let seleIndex = -1;
					this.identityList.every((item, index) => {
					if (item.id == id) {
						seleIndex = index;
						isYN = true;
						return false;
					} else {
						return true;
					}
					})
					if (isIndex) {
					return seleIndex;
					} else {
					return isYN;
					}
       		 } ,  
				getDeptTreeList(){
                var _this = this;
			 console.log("项目Id",$("#orgId").val())
              if (!_this.dataForm.orgId) {
                _this.$message({message: '请选择项目!', type: 'error'});
                return false;
              };
            $.ajax({
				// url: "http://wx.palmnest.com/super_cloud/api/organisation/department/getDeptTree",
              url:   '/super_cloud/api/organisation/department/getDeptTree',
              type: "POST",
              dataType: "json",
              data: {
                orgId:_this.dataForm.orgId,//项目Id 
                virtId: _this.inputUser,//
              },
              success: function (data) {
                console.log("部门返回",data)
                if(data.code == 200 && data.data){
                  _this.dataTree=data.data
                }else{
                  _this.dataTree=[]
                }
              },
              error: function(err){

              }
            });
        },
        //分组数据
        getSubgroupList(val){
              var _this = this;
            if (!_this.dataForm.orgId) {
              _this.$message({message: '请选择项目!', type: 'error'});
              return false;
            };
          $.ajax({
            // url:  'http://wx.palmnest.com/super_cloud/api/organisation/subgroup/getAll',
            url:  '/super_cloud/api/organisation/subgroup/getAll',
            type: "POST",
            dataType: "json",
            data: {
              pageSize:1,
              pageNo:100,
              "conditions['orgId']":_this.dataForm.orgId,//项目Id 以逗号分隔 最后面不要带逗号
              "conditions['name']": val,//姓名、手机号、项目名 模糊搜索，默认传""
            },
            success: function (data) {
              console.log("分组返回",data)
              if(data.code == 200 && data.data){
                _this.tagList=data.data
              }else{
                _this.tagList=[]
              }
            },
            error: function(err){

            }
          });
        },
				changeValue(val){
					this.checkRadio=val
					if(val==1){
						this.identityList=[]
					}else{
						$(".email-list").val("");
					}
				},
				chooseDep(){
					if(this.checkRadio==2){
						this.dataForm.orgId=$("#orgId").val()
						if (!this.dataForm.orgId) {
							this.$message({message: '请选择项目!', type: 'error'})
							return false
						}
						this.isDislagVisable=true
						this.searchText=""
						$(".dialog-pop").show();
						this.getDeptTreeList();
						this.getSubgroupList("");

						let newArr=[]
						if(this.chooseDepList && this.chooseDepList.length>0){
						for (const key in this.chooseDepList) {
						newArr.push(this.chooseDepList[key])
						 }
						}
           				 this.identityList=newArr
					}
					
				},
				getCheckedKeys() {
					console.log(this.$refs.tree.getCheckedKeys());
				  },
				  setCheckedKeys() {
						this.$refs.tree.setCheckedKeys([3]);
				  },

					//鼠标经过树节点时触发
				showTip() {
				},
				//鼠标离开树节点时触发
				hideTip() {
				},
				chooseDataSubmit(){
					console.log("已选中的数据",this.identityList)
					this.isDislagVisable=false
					let newArr=[]
					if(this.identityList.length>0){
						for (const key in this.identityList) {
						newArr.push(this.identityList[key])
						}
					}
					this.chooseDepList=newArr
				},
				
				deleteTagHandler(data, index){
					this.identityList.splice(index, 1);
				},
				handleSelect(val) {
					this.activeIndex = val;
					if(this.activeIndex==1){
						setTimeout(() => {
							this.$refs.tree.filter(this.searchText)
						}, 1000);
						}else{
						this.getSubgroupList(this.searchText)
						}	
				  },
				backSelectedHandler(id, isIndex = false) {
				let isYN = false;
				let seleIndex = -1;
				this.identityList.every((item, index) => {
				if (item.id == id) {
					seleIndex = index;
					isYN = true;
					return false;
				} else {
					return true;
				}
				})
				if (isIndex) {
				return seleIndex;
				} else {
				return isYN;
				}
			},  
			 // 点击选中项
			 tagBtnHandler(data) {
				if (this.backSelectedHandler(data.id)) {
				let indexRow = this.backSelectedHandler(data.id, true);
				if (indexRow != -1) {
					this.identityList.splice(indexRow, 1);
				}
				} else {
				let newArr=[]
				let resultObj={}
				resultObj['id']=data.id
				resultObj['name']=data.name
				resultObj['type']=3
				newArr.push(resultObj)
		          this.identityList=[...this.identityList,...newArr]
				}
			},
		//判断是否开启了审核
		getApproveTypeIsOpen(orgId){
			var _this=this
			$.ajax({
				type: "post",
				url: "/super_service/notice/approval/getApprovalSetDto",
				data: {
					"orgId": orgId
				},
				success: function (data) {
					if (data.code == 200) {
						if(data.data.isOpen==1){
							_this.isOpenApprove=1
							$(".approvalStyle").show();
						}else {
							_this.isOpenApprove=2
							$(".approvalStyle").hide();
						}
					} else {
					}
				},
				error: function (error) {
				}
			});
		},
		getQueryString: function (name) {
						var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
						var r = window.location.search.substr(1).match(reg);
						if (r != null) return unescape(r[2]);
						return null;
					},
	getIfCanApproval(orgId){
       var  _this=this
			$.ajax({
				type: "post",
				url:  "/super_service/notice/approval/getSetByOrgId",
				data: {
					"orgId":  orgId
				},
				success: function (data) {
					if (data.code == 200) {
						if(data.data.isOpen==1){//显示审核下拉列表
							_this.getApproveTypeIsOpen(orgId)
						}else{////不显示审核下拉列表
							$(".approvalStyle").hide();
						}
					} else {
					}
				},
				error: function (error) {
				}
			});
		},
		getProjectList: function () {
			var _this=this
			$.ajax({
				type: "post",
				url:   "/super_service/admin/templ/getOrgList",
				success: function (data) {
					if (data.code == '200') {
						orgList = data.data;
						if(data.data.length==1){
							_this.getIfCanApproval(data.data[0].id)
						}
					}
				},
				error: function () {}
			});
		},
				
			},
			created(){
			let org=$("#orgId").val()
			console.log("org",org)
			this.getProjectList();
			this.dataForm.orgId=org

			 this.contextBasePath = $("#contextPath").val().split("super_service")[0]+"super_cloud"
			 if(this.contextBasePath=='/super_cloud'){
				this.contextBasePath="http://wx.palmnest.com/super_cloud"
			 }
			var id = this.getQueryString("id")
			this.editId=id
			console.log("org",id)
			if (!!id) {
				this.ajaxDetail(id)
			}

				
			},
		})
	})
</script>
<script type="text/javascript" src="<c:url value='/scripts/admin/notice/noticeEmailPublish.js?v=12121'/>"></script>
</body>
</html>