|
@@ -73,9 +73,37 @@
|
|
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="所属公司" prop="companyName">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.companyName"
|
|
|
+ placeholder="请输入所属公司"
|
|
|
+ clearable
|
|
|
+ size="small"
|
|
|
+ @keyup.enter.native="handleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="所属销售" prop="companyUserNickName">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.companyUserNickName"
|
|
|
+ placeholder="请输入所属销售"
|
|
|
+ clearable
|
|
|
+ size="small"
|
|
|
+ @keyup.enter.native="handleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
</el-form>
|
|
|
|
|
|
<el-row :gutter="10" class="mb8">
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-user"
|
|
|
+ size="mini"
|
|
|
+ @click="handleChangeCompanyUser"
|
|
|
+ :disabled="multiple"
|
|
|
+ v-hasPermi="['company:companyUser:change']"
|
|
|
+ >更换会员归属</el-button>
|
|
|
+ </el-col>
|
|
|
<el-col :span="1.5">
|
|
|
<el-button
|
|
|
type="warning"
|
|
@@ -110,7 +138,8 @@
|
|
|
<dict-tag :options="userOptions" :value="scope.row.status"/>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
-
|
|
|
+ <el-table-column label="所属公司" align="center" prop="companyName" />
|
|
|
+ <el-table-column label="所属销售" align="center" prop="companyUserNickName" />
|
|
|
<el-table-column label="上级昵称" align="center" prop="tuiName" />
|
|
|
<el-table-column label="app来源" align="center" prop="source" />
|
|
|
<el-table-column label="登陆设备" align="center" prop="loginDevice" />
|
|
@@ -186,18 +215,68 @@
|
|
|
<userDetails ref="userDetails" />
|
|
|
</el-drawer>
|
|
|
|
|
|
-
|
|
|
+ <!-- 更换会员归属对话框 -->
|
|
|
+ <el-dialog title="更换会员归属" :visible.sync="changeCompanyUserOpen" width="500px" append-to-body>
|
|
|
+ <el-form ref="changeCompanyUserForm" :model="changeCompanyUserForm" :rules="changeCompanyUserRules" label-width="100px">
|
|
|
+ <el-form-item label="选择公司" prop="companyId">
|
|
|
+ <el-select v-model="changeCompanyUserForm.companyId" placeholder="请选择公司" style="width: 100%" @change="handleCompanyChange">
|
|
|
+ <el-option
|
|
|
+ v-for="item in companyOptions"
|
|
|
+ :key="item.companyId"
|
|
|
+ :label="item.companyName"
|
|
|
+ :value="item.companyId"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="选择销售" prop="companyUserId">
|
|
|
+ <el-select v-model="changeCompanyUserForm.companyUserId" placeholder="请选择销售" style="width: 100%" @change="handleCompanyUserChange">
|
|
|
+ <el-option
|
|
|
+ v-for="item in companyUserOptions"
|
|
|
+ :key="item.userId"
|
|
|
+ :label="item.nickName + '_' + item.userName"
|
|
|
+ :value="item.userId"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button type="primary" @click="submitChangeCompanyUserForm">确 定</el-button>
|
|
|
+ <el-button @click="cancelChangeCompanyUser">取 消</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import { listUser, getUser, delUser, addUser, updateUser, exportUser } from "@/api/his/user";
|
|
|
+import { getCompanyUserList, changeCompanyUser, getCompanyList } from '@/api/company/companyUser';
|
|
|
import userDetails from '../../components/his/userDetails.vue';
|
|
|
export default {
|
|
|
name: "User",
|
|
|
components: {userDetails},
|
|
|
data() {
|
|
|
return {
|
|
|
+ companyName: null,
|
|
|
+ companyUserNickName: null,
|
|
|
+ // 更换会员归属表单校验
|
|
|
+ changeCompanyUserRules: {
|
|
|
+ companyId: [
|
|
|
+ { required: true, message: '请选择公司', trigger: 'change' }
|
|
|
+ ],
|
|
|
+ companyUserId: [
|
|
|
+ { required: true, message: '请选择销售', trigger: 'change' }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ companyOptions: [],
|
|
|
+ companyUserOptions: [],
|
|
|
+ // 更换会员归属对话框
|
|
|
+ changeCompanyUserOpen: false,
|
|
|
+ // 更换会员归属表单
|
|
|
+ changeCompanyUserForm: {
|
|
|
+ companyId: null,
|
|
|
+ companyUserId: null,
|
|
|
+ userIds: []
|
|
|
+ },
|
|
|
show:{
|
|
|
title:"用户详情",
|
|
|
open:false,
|
|
@@ -276,6 +355,14 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
methods: {
|
|
|
+ /** 销售选择变化 */
|
|
|
+ handleCompanyUserChange(userId) {
|
|
|
+ if (!this.changeCompanyUserForm.companyId) {
|
|
|
+ this.$message.warning('请先选择公司');
|
|
|
+ this.changeCompanyUserForm.companyUserId = null;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ },
|
|
|
change(){
|
|
|
if(this.createTime!=null){
|
|
|
this.queryParams.sTime=this.createTime[0];
|
|
@@ -291,6 +378,26 @@ export default {
|
|
|
this.$refs.userDetails.getDetails(row.userId);
|
|
|
}, 1);
|
|
|
},
|
|
|
+ handleCompanyChange(companyId) {
|
|
|
+ // 清空已选择的销售
|
|
|
+ this.changeCompanyUserForm.companyUserId = null;
|
|
|
+ // 根据公司ID获取对应的销售列表
|
|
|
+ if (companyId) {
|
|
|
+ getCompanyUserList({ companyId: companyId }).then(response => {
|
|
|
+ if (response.code === 200) {
|
|
|
+ this.companyUserOptions = response.data;
|
|
|
+ } else {
|
|
|
+ this.$message.error(response.msg || '获取销售列表失败');
|
|
|
+ this.companyUserOptions = [];
|
|
|
+ }
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message.error('获取销售列表失败');
|
|
|
+ this.companyUserOptions = [];
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.companyUserOptions = [];
|
|
|
+ }
|
|
|
+ },
|
|
|
/** 查询用户列表 */
|
|
|
getList() {
|
|
|
this.loading = true;
|
|
@@ -341,6 +448,8 @@ export default {
|
|
|
this.createTime=null;
|
|
|
this.queryParams.sTime=null;
|
|
|
this.queryParams.eTime=null;
|
|
|
+ this.queryParams.companyName = null;
|
|
|
+ this.queryParams.companyUserNickName = null;
|
|
|
this.handleQuery();
|
|
|
},
|
|
|
// 多选框选中数据
|
|
@@ -414,6 +523,66 @@ export default {
|
|
|
this.download(response.msg);
|
|
|
this.exportLoading = false;
|
|
|
}).catch(() => {});
|
|
|
+ },
|
|
|
+ /** 更换会员归属按钮操作 */
|
|
|
+ handleChangeCompanyUser() {
|
|
|
+ // 获取公司下拉列表
|
|
|
+ getCompanyList().then(response => {
|
|
|
+ if (response.code === 200) {
|
|
|
+ this.companyOptions = response.data;
|
|
|
+ // 重置表单和销售列表
|
|
|
+ this.resetCompanyUserForm();
|
|
|
+ this.companyUserOptions = [];
|
|
|
+ this.changeCompanyUserOpen = true;
|
|
|
+ } else {
|
|
|
+ this.$message.error(response.msg || '获取公司列表失败');
|
|
|
+ }
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message.error('获取公司列表失败');
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ /** 取消更换会员归属 */
|
|
|
+ cancelChangeCompanyUser() {
|
|
|
+ this.changeCompanyUserOpen = false;
|
|
|
+ this.resetCompanyUserForm();
|
|
|
+ },
|
|
|
+ /** 重置更换会员归属表单 */
|
|
|
+ resetCompanyUserForm() {
|
|
|
+ this.changeCompanyUserForm = {
|
|
|
+ companyId: null,
|
|
|
+ companyUserId: null,
|
|
|
+ userIds: []
|
|
|
+ };
|
|
|
+ this.resetForm("changeCompanyUserForm");
|
|
|
+ },
|
|
|
+ /** 提交更换会员归属 */
|
|
|
+ submitChangeCompanyUserForm() {
|
|
|
+ this.$refs["changeCompanyUserForm"].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ // 调用更换会员归属接口
|
|
|
+ // 检查companyId是否已设置
|
|
|
+ if (!this.changeCompanyUserForm.companyId) {
|
|
|
+ this.$message.error('请选择公司');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ changeCompanyUser(this.ids, {
|
|
|
+ companyUserId: this.changeCompanyUserForm.companyUserId,
|
|
|
+ companyId: this.changeCompanyUserForm.companyId
|
|
|
+ }).then(response => {
|
|
|
+ if (response.code === 200) {
|
|
|
+ this.msgSuccess("操作成功");
|
|
|
+ this.changeCompanyUserOpen = false;
|
|
|
+ this.getList();
|
|
|
+ } else {
|
|
|
+ this.$message.error(response.msg || '操作失败');
|
|
|
+ }
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message.error('操作失败');
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
};
|