|  | @@ -35,10 +35,15 @@
 | 
	
		
			
				|  |  |                                  >
 | 
	
		
			
				|  |  |                                  <div class="tr_btn" v-hasPermi="['sys:user:export']">导入成员</div>
 | 
	
		
			
				|  |  |                              </el-upload> 
 | 
	
		
			
				|  |  | -                            <div class="tr_btn" @click="handleAddUser" v-hasPermi="['sys:user:add']">添加成员</div>
 | 
	
		
			
				|  |  | +                            <div class="tr_btn tb2" @click="handleAddUser" v-hasPermi="['sys:user:add']">添加成员</div>
 | 
	
		
			
				|  |  | +                            <div class="tr_btn tb2" @click="handleSendEmail">发送邮件</div>
 | 
	
		
			
				|  |  |                          </div>
 | 
	
		
			
				|  |  |                      </div>
 | 
	
		
			
				|  |  | -                    <el-table :data="userList" border cell-class-name="vertical-top-cell" v-loading="loading" empty-text="暂无人员" max-height="578px" style="margin-top: 16px;">
 | 
	
		
			
				|  |  | +                    <el-table ref="multipleTable" @selection-change="handleSelectionChange":data="userList" border cell-class-name="vertical-top-cell" v-loading="loading" empty-text="暂无人员" max-height="578px" style="margin-top: 16px;">
 | 
	
		
			
				|  |  | +                        <el-table-column
 | 
	
		
			
				|  |  | +                            type="selection"
 | 
	
		
			
				|  |  | +                            width="55">
 | 
	
		
			
				|  |  | +                        </el-table-column>
 | 
	
		
			
				|  |  |                          <el-table-column label="序号" width="50">
 | 
	
		
			
				|  |  |                              <template #default="scope">
 | 
	
		
			
				|  |  |                                  {{ scope.$index + 1 }}
 | 
	
	
		
			
				|  | @@ -53,10 +58,11 @@
 | 
	
		
			
				|  |  |                          </el-table-column>
 | 
	
		
			
				|  |  |                          <el-table-column label="人物简介" prop="introduction" width="400" show-overflow-tooltip></el-table-column>
 | 
	
		
			
				|  |  |                          <el-table-column label="人物故事" prop="userStory" width="400" show-overflow-tooltip></el-table-column>
 | 
	
		
			
				|  |  | -                        <el-table-column label="操作" width="150">
 | 
	
		
			
				|  |  | +                        <el-table-column label="操作" width="180">
 | 
	
		
			
				|  |  |                              <template #default="scope">
 | 
	
		
			
				|  |  |                                  <el-button link type="text" size="mini" @click="handleEdit(scope.row)" v-hasPermi="['sys:user:update']">编辑</el-button>
 | 
	
		
			
				|  |  |                                  <el-button link type="text" size="mini" @click="handleDelete(scope.row)" v-hasPermi="['sys:user:delete']">删除</el-button>
 | 
	
		
			
				|  |  | +                                <el-button link type="text" size="mini" @click="handleSend(scope.row)" v-hasPermi="['sys:user:delete']">发送邮件</el-button>
 | 
	
		
			
				|  |  |                              </template>
 | 
	
		
			
				|  |  |                          </el-table-column>
 | 
	
		
			
				|  |  |                      </el-table>
 | 
	
	
		
			
				|  | @@ -163,6 +169,19 @@
 | 
	
		
			
				|  |  |                  <el-button @click="cancel2" style="margin-right: 5%;">取 消</el-button>
 | 
	
		
			
				|  |  |              </div>
 | 
	
		
			
				|  |  |          </el-drawer>
 | 
	
		
			
				|  |  | +        <el-dialog width="30%" :visible.sync="emailShow" title="选择邮件模板" @close="emailCancel">
 | 
	
		
			
				|  |  | +            <el-form ref="emailRef" :model="emailForm" :rules="emailRules" label-width="100px" style="width: 90%;margin: 0 auto;">
 | 
	
		
			
				|  |  | +                <el-form-item label="邮件模板" prop="tempId">
 | 
	
		
			
				|  |  | +                    <el-select v-model="emailForm.tempId" placeholder="请选择邮件模板" style="width: 100%;">
 | 
	
		
			
				|  |  | +                        <el-option v-for="item in useAgentStore().emailModelList" :label="item.name" :value="item.id"></el-option>
 | 
	
		
			
				|  |  | +                    </el-select>
 | 
	
		
			
				|  |  | +                </el-form-item>
 | 
	
		
			
				|  |  | +            </el-form>
 | 
	
		
			
				|  |  | +            <div class="demo-drawer__footer" style="display: flex;justify-content: end;">
 | 
	
		
			
				|  |  | +                <el-button :loading="emailButtonLoading" type="primary" @click="emailSubmitForm">发 送</el-button>
 | 
	
		
			
				|  |  | +                <el-button @click="emailCancel" style="margin-right: 5%;">取 消</el-button>
 | 
	
		
			
				|  |  | +            </div>
 | 
	
		
			
				|  |  | +        </el-dialog>
 | 
	
		
			
				|  |  |      </div>
 | 
	
		
			
				|  |  |  </template>
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -172,6 +191,7 @@
 | 
	
		
			
				|  |  |      const { proxy } = getCurrentInstance();
 | 
	
		
			
				|  |  |      import {useAgentStore} from "@/store_v3/modules/agent";
 | 
	
		
			
				|  |  |      useAgentStore().getCompanyData();
 | 
	
		
			
				|  |  | +    useAgentStore().getEmailModelData();
 | 
	
		
			
				|  |  |      import { 
 | 
	
		
			
				|  |  |          getCoachList,
 | 
	
		
			
				|  |  |          updateCoach,
 | 
	
	
		
			
				|  | @@ -179,6 +199,7 @@
 | 
	
		
			
				|  |  |          deleteCoach,
 | 
	
		
			
				|  |  |          addCoach,
 | 
	
		
			
				|  |  |          getTeamListById,
 | 
	
		
			
				|  |  | +        sendEmailToUser
 | 
	
		
			
				|  |  |      } from '@/api/agent/index.js'
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      const uploadUrl = `${window.SITE_CONFIG["apiURL"]}/sys/user/import`
 | 
	
	
		
			
				|  | @@ -270,6 +291,50 @@
 | 
	
		
			
				|  |  |              { pattern: /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/, message: '请输入正确的邮箱', trigger: 'blur' }
 | 
	
		
			
				|  |  |          ]
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  | +    const multipleSelection = ref([])
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    const emailShow = ref(false);
 | 
	
		
			
				|  |  | +    const emailRef = ref(null);
 | 
	
		
			
				|  |  | +    const emailButtonLoading = ref(false);
 | 
	
		
			
				|  |  | +    const emailForm = ref({
 | 
	
		
			
				|  |  | +        tempId:null,
 | 
	
		
			
				|  |  | +        userIdList:[]
 | 
	
		
			
				|  |  | +    });
 | 
	
		
			
				|  |  | +    const emailRules = ref({
 | 
	
		
			
				|  |  | +        tempId: [
 | 
	
		
			
				|  |  | +            { required: true, message: '请选择邮件模板', trigger: 'change' }
 | 
	
		
			
				|  |  | +        ]
 | 
	
		
			
				|  |  | +    });
 | 
	
		
			
				|  |  | +    const currentUserId = ref(null);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    const emailSubmitForm = async () => {
 | 
	
		
			
				|  |  | +        proxy.$refs.emailRef.validate((valid) => {
 | 
	
		
			
				|  |  | +            if (valid) {
 | 
	
		
			
				|  |  | +                emailButtonLoading.value = true;
 | 
	
		
			
				|  |  | +                emailForm.value.userIdList =  multipleSelection.value.length>0?multipleSelection.value.map(item=>item.id):[currentUserId.value];
 | 
	
		
			
				|  |  | +                sendEmailToUser(emailForm.value).then(res=>{
 | 
	
		
			
				|  |  | +                    if(res.code!==0) return proxy.$message.error(res.msg);
 | 
	
		
			
				|  |  | +                    proxy?.$modal.msgSuccess('发送成功!')
 | 
	
		
			
				|  |  | +                }).finally(()=>{emailButtonLoading.value=false;emailShow.value = false;})
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +                return false;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +    };
 | 
	
		
			
				|  |  | +    const emailCancel = () => {
 | 
	
		
			
				|  |  | +        emailShow.value = false;
 | 
	
		
			
				|  |  | +        emailButtonLoading.value = false;
 | 
	
		
			
				|  |  | +        currentUserId.value = null;
 | 
	
		
			
				|  |  | +        emailForm.value = {
 | 
	
		
			
				|  |  | +            tempId:null,
 | 
	
		
			
				|  |  | +            userIdList:[]
 | 
	
		
			
				|  |  | +        };
 | 
	
		
			
				|  |  | +    };
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    const handleSelectionChange = (val) => {
 | 
	
		
			
				|  |  | +        multipleSelection.value = val;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      const handleBack = () => {
 | 
	
		
			
				|  |  |          proxy.$router.back()
 | 
	
	
		
			
				|  | @@ -350,6 +415,18 @@
 | 
	
		
			
				|  |  |          userTitle.value = "新增成员详情";
 | 
	
		
			
				|  |  |          userShow.value = true;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    const handleSendEmail = async () => {
 | 
	
		
			
				|  |  | +        if(multipleSelection.value.length === 0) return proxy.$message.error('请选择要发送邮件的成员!');
 | 
	
		
			
				|  |  | +        emailShow.value = true;
 | 
	
		
			
				|  |  | +        // await proxy.$modal.confirm('确定要发送邮件给选中的成员吗?', '提示').finally(()=>{})
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    const handleSend = async row => {
 | 
	
		
			
				|  |  | +        emailShow.value = true;
 | 
	
		
			
				|  |  | +        currentUserId.value = row.id;
 | 
	
		
			
				|  |  | +        // await proxy.$modal.confirm('确定要发送邮件给成员【'+row.realName+'】吗?', '提示').finally(()=>{})
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |      
 | 
	
		
			
				|  |  |      const reset = () => {
 | 
	
		
			
				|  |  |          userForm.value = {
 | 
	
	
		
			
				|  | @@ -378,7 +455,7 @@
 | 
	
		
			
				|  |  |          proxy.$refs.userRef.validate((valid) => {
 | 
	
		
			
				|  |  |              if (valid) {
 | 
	
		
			
				|  |  |                  buttonLoading2.value = true;
 | 
	
		
			
				|  |  | -                userForm.value.username = userForm.value.mobile;
 | 
	
		
			
				|  |  | +                // userForm.value.username = userForm.value.mobile;
 | 
	
		
			
				|  |  |                  userForm.value.enterpriseId = programid.value;
 | 
	
		
			
				|  |  |                  userForm.value.teamId = teamid.value;
 | 
	
		
			
				|  |  |                  if(userForm.value.id){
 | 
	
	
		
			
				|  | @@ -542,7 +619,7 @@
 | 
	
		
			
				|  |  |                              display: flex;
 | 
	
		
			
				|  |  |                              align-items: center;
 | 
	
		
			
				|  |  |                              justify-content: center;
 | 
	
		
			
				|  |  | -                            &:last-child{
 | 
	
		
			
				|  |  | +                            &.tb2{
 | 
	
		
			
				|  |  |                                  background: #761E6A;
 | 
	
		
			
				|  |  |                                  color: #FFFFFF;
 | 
	
		
			
				|  |  |                              }
 |