|
|
@@ -0,0 +1,389 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <div>
|
|
|
+
|
|
|
+ <templateTable
|
|
|
+ :formList="formList"
|
|
|
+ :searchData.sync="queryFrom"
|
|
|
+ :tableConfig="tableConfig"
|
|
|
+ :btnGroup="btnGroup"
|
|
|
+ :data="pageResult"
|
|
|
+ @getList="findPage"
|
|
|
+ @handleSearchList="handleSearchList"
|
|
|
+ :pagination="pageData"
|
|
|
+ >
|
|
|
+ </templateTable>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 新增修改界面 -->
|
|
|
+ <el-dialog
|
|
|
+ :title="dialogTitle"
|
|
|
+ width="40%"
|
|
|
+ :visible.sync="dialogVisible"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ :before-close="handleDialogBefore"
|
|
|
+ @close="closeDialog"
|
|
|
+ v-dialogDrag
|
|
|
+ >
|
|
|
+ <el-form
|
|
|
+ :model="formData"
|
|
|
+ :rules="rules"
|
|
|
+ ref="formDataDetail"
|
|
|
+ :inline="true"
|
|
|
+ label-width="110px"
|
|
|
+ size="small"
|
|
|
+ >
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="工号" prop="userId">
|
|
|
+ <el-input v-model="formData.userId" disabled></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="名称" prop="userName">
|
|
|
+ <el-select v-model="formData.userName" clearable filterable placeholder="选择名称" @change="userChange">
|
|
|
+ <el-option v-for="(item, index) in useroption" :key="index" :label="item.name"
|
|
|
+ :value="item.name"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="机构id" prop="deptId">
|
|
|
+ <el-input v-model="formData.deptId" disabled></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="机构名称" prop="deptName">
|
|
|
+ <el-select v-model="formData.deptName" clearable filterable placeholder="选择机构名称" @change="deptChange">
|
|
|
+ <el-option v-for="(item, index) in deptoption" :key="index" :label="item.name"
|
|
|
+ :value="item.name"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="抽成比例" prop="proportional">
|
|
|
+ <el-input v-model="formData.proportional" ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="机构等级" prop="deptId">
|
|
|
+ <el-input v-model="formData.comlevel" disabled></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="业务来源" prop="source">
|
|
|
+ <el-select v-model="formData.source" clearable filterable placeholder="选择业务来源" @change="deptChange">
|
|
|
+ <el-option
|
|
|
+ v-for="val in organizationSourceoptions"
|
|
|
+ :key="val.dictValue"
|
|
|
+ :label="val.dictTag"
|
|
|
+ :value="val.dictValue"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button size="small" @click="dialogVisible = false">取 消</el-button>
|
|
|
+ <el-button type="primary" size="small" @click="submitForm">提交</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import KtButton from "@/views/Core/KtButton"; // 按钮权限组件
|
|
|
+import templateTable from "../../components/TemplateTable/index.vue";
|
|
|
+export default {
|
|
|
+ components: {
|
|
|
+ KtButton,
|
|
|
+ templateTable,
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ formList: [
|
|
|
+ {
|
|
|
+ label: "工号",
|
|
|
+ prop: "userId",
|
|
|
+ type: "input",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "姓名",
|
|
|
+ prop: "name",
|
|
|
+ type: "input",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "手机号",
|
|
|
+ prop: "mobile",
|
|
|
+ type: "input",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "状态",
|
|
|
+ prop: "status",
|
|
|
+ type: "select",
|
|
|
+ options: JSON.parse(localStorage.getItem("user_statusoptions")),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "领导人",
|
|
|
+ prop: "leaderId",
|
|
|
+ type: "selectDept",
|
|
|
+ options: [],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ btnGroup: [
|
|
|
+ {
|
|
|
+ name: "新增",
|
|
|
+ click: (row, index) => { return this.handleAddButton() },
|
|
|
+
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ useroption:[],
|
|
|
+ deptoption:[],
|
|
|
+ organizationSourceoptions:[],
|
|
|
+ tableConfig: {
|
|
|
+ columns: [
|
|
|
+ // 数据列
|
|
|
+ { prop: "userId", label: "工号", type: "text" },
|
|
|
+ {
|
|
|
+ prop: "userName",
|
|
|
+ label: "名称",
|
|
|
+ type: "text",
|
|
|
+ },
|
|
|
+ { prop: "deptId", label: "机构id", type: "text" },
|
|
|
+
|
|
|
+ { prop: "deptName", label: "机构名称", type: "text" },
|
|
|
+ { prop: "proportional", label: "抽成比例", type: "text" },
|
|
|
+ {
|
|
|
+ prop: "comlevel",
|
|
|
+ label: "机构等级",
|
|
|
+ type: "text",
|
|
|
+ },
|
|
|
+ { prop: "source", label: "业务来源", type: "text" },
|
|
|
+ ],
|
|
|
+ loading: true,
|
|
|
+ isPaginationShow: true,
|
|
|
+ isShowIndex: true,
|
|
|
+ optBtns: [
|
|
|
+ {
|
|
|
+ type: "primary",
|
|
|
+ label: "编辑",
|
|
|
+ perm: "sys:agent:edit",
|
|
|
+ icon: "fa fa-edit",
|
|
|
+ click: (row, index) => {
|
|
|
+ return this.handleTableEdit(row);
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ rules:[],
|
|
|
+ pageData: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ totalSize: 0,
|
|
|
+ },
|
|
|
+ formData: {
|
|
|
+ roleId: "20",
|
|
|
+ },
|
|
|
+ queryFrom: {},
|
|
|
+ pageResult: [],
|
|
|
+ dialogTitle: "",
|
|
|
+ dialogVisible: false, // 新增编辑界面是否显示
|
|
|
+ dialogPassword: true, //密码是否显示明文
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.findPage();
|
|
|
+ this.$api.insCompany.getDeptInfo().then(res=>{
|
|
|
+ if(res.code==200){
|
|
|
+ this.useroption=res.data
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.$api.insCompany.getUserInfo().then(res=>{
|
|
|
+ if(res.code==200){
|
|
|
+ this.deptoption=res.data
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ userChange(val){
|
|
|
+ if(val){
|
|
|
+ this.formData.userId= this.useroption.find(e=>e.name==val).id
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ this.formData.userId=''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ deptChange(val){
|
|
|
+ if(val){
|
|
|
+ this.formData.deptId= this.deptoption.find(e=>e.name==val).id
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ this.formData.deptId=''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 查询Start
|
|
|
+ queryStaffInfo() {
|
|
|
+ this.findPage();
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ // 右侧列表的方法Start
|
|
|
+ findPage(data) {
|
|
|
+ this.tableConfig.loading = true;
|
|
|
+ this.$api.user
|
|
|
+ .findUserList({
|
|
|
+ ...this.pageData,
|
|
|
+ dto: { ...data, roleId: "20", agentFlag: "2" },
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ this.tableConfig.loading = false;
|
|
|
+ this.pageResult = res.data.records;
|
|
|
+ this.pageData.pageNum = res.data.current;
|
|
|
+ this.pageData.pageSize = res.data.size;
|
|
|
+ this.pageData.totalSize = res.data.total;
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ handleSearchList(data) {
|
|
|
+ this.findPage(data);
|
|
|
+ },
|
|
|
+ //编辑
|
|
|
+ async handleTableEdit(params) {
|
|
|
+ this.dialogPassword = false;
|
|
|
+ },
|
|
|
+ // 删除单个人员
|
|
|
+ handleTableDeleteFlag(data) {
|
|
|
+ this.$confirm("确认删除?")
|
|
|
+ .then(() => {
|
|
|
+ this.$api.user.getDeleteBatch([data.row.userId]).then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message({
|
|
|
+ message: "删除成功",
|
|
|
+ type: "success",
|
|
|
+ });
|
|
|
+ this.findPage();
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.msg);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ },
|
|
|
+ //添加人员
|
|
|
+ handleAddButton() {
|
|
|
+ this.dialogTitle = "新增";
|
|
|
+ this.dialogVisible = true;
|
|
|
+ },
|
|
|
+ handleDialogBefore(done) {
|
|
|
+ // 退出对话框之前确认提示
|
|
|
+ this.$confirm("确认关闭?")
|
|
|
+ .then((_) => {
|
|
|
+ done();
|
|
|
+ })
|
|
|
+ .catch((_) => {});
|
|
|
+ },
|
|
|
+ closeDialog() {
|
|
|
+ // 清空数据
|
|
|
+ this.deptInfo = {};
|
|
|
+ this.dialogVisible = false;
|
|
|
+ },
|
|
|
+ // 提交
|
|
|
+ submitForm() {
|
|
|
+ this.$refs.formDataDetail.validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ this.$confirm("确认提交吗?", "提示", {}).then(() => {
|
|
|
+ if (this.dialogTitle == "新增") {
|
|
|
+ this.$api.user
|
|
|
+ .saveUserInfo({
|
|
|
+ esmUserImageVo: this.imagesIdList,
|
|
|
+ sysUser: this.formData,
|
|
|
+ sysUserInfo: this.formDataDetail,
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message({
|
|
|
+ message: "保存成功",
|
|
|
+ type: "success",
|
|
|
+ });
|
|
|
+ this.dialogVisible = false;
|
|
|
+ this.$refs["formData"].resetFields();
|
|
|
+ this.$refs["formDataDetail"].resetFields();
|
|
|
+ this.activeName = "1";
|
|
|
+ this.findPage();
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: `保存失败,请重新添加,(${res.msg})`,
|
|
|
+ type: "error",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$api.user
|
|
|
+ .updateUserInfo(this.formData.id, {
|
|
|
+ esmUserImageVo: this.imagesIdList,
|
|
|
+ sysUser: this.formData,
|
|
|
+ sysUserInfo: this.formDataDetail,
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message({
|
|
|
+ message: "编辑成功",
|
|
|
+ type: "success",
|
|
|
+ });
|
|
|
+ this.dialogVisible = false;
|
|
|
+ this.$refs["formData"].resetFields();
|
|
|
+ this.$refs["formDataDetail"].resetFields();
|
|
|
+ this.activeName = "1";
|
|
|
+ this.findPage();
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: `编辑失败,请重新添加,(${res.msg})`,
|
|
|
+ type: "error",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 下一步
|
|
|
+
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+.el-divider--horizontal {
|
|
|
+ margin: 4px 0;
|
|
|
+}
|
|
|
+
|
|
|
+/* 顶部查询条件样式Start */
|
|
|
+.queryFrom .el-row {
|
|
|
+ margin: 10px 0px;
|
|
|
+}
|
|
|
+
|
|
|
+.queryFrom .el-form-item {
|
|
|
+ margin-bottom: 0px;
|
|
|
+}
|
|
|
+
|
|
|
+.queryFrom .queryButton .el-form-item__content {
|
|
|
+ margin-left: 0px !important;
|
|
|
+}
|
|
|
+.disc {
|
|
|
+ -webkit-text-security: disc;
|
|
|
+ position: relative;
|
|
|
+}
|
|
|
+.none {
|
|
|
+ -webkit-text-security: none;
|
|
|
+ position: relative;
|
|
|
+}
|
|
|
+.icon {
|
|
|
+ color: #ccc;
|
|
|
+ position: absolute;
|
|
|
+ right: 0;
|
|
|
+ top: 10px;
|
|
|
+ text-align: center;
|
|
|
+}
|
|
|
+</style>
|