lihongxiao 2 лет назад
Родитель
Сommit
a81a47bde4

+ 2 - 2
src/components/TemplateTable/index.vue

@@ -72,8 +72,8 @@
               <el-option
                 v-for="(s, i) in f.options"
                 :key="i"
-                :label="s.label || s.dictTag"
-                :value="s.value || s.dictValue"
+                :label="s.label || s.dictTag || s.name"
+                :value="s.value || s.dictValue ||s.id"
               ></el-option>
             </el-select>
           </template>

+ 36 - 0
src/http/moudules/insCompany.js

@@ -690,3 +690,39 @@ export const getUserInfo = () => {
     method: "get",
   })
 }
+
+export const agencyAdd = (data) => {
+  return axios({
+    url: '/agency/add',
+    method: "post",
+    data
+  })
+}
+export const agencyQueryPage = (data) => {
+  return axios({
+    url: '/agency/queryPage',
+    method: "post",
+    data
+  })
+}
+export const agencyEdit = (data) => {
+  return axios({
+    url: '/agency/edit',
+    method: "post",
+    data
+  })
+}
+
+export const agencyQueryById = (id) => {
+  return axios({
+    url: '/agency/queryById/'+id,
+    method: "get",
+  })
+}
+
+export const agencydel = (id) => {
+  return axios({
+    url: '/agency/del/'+id,
+    method: "get",
+  })
+}

+ 121 - 62
src/views/PeopleManage/Institutional.vue

@@ -12,6 +12,11 @@
             @handleSearchList="handleSearchList"
             :pagination="pageData"
           >
+          <template slot="source" slot-scope="scope">
+              <span>
+                    {{ statMaps(scope.row.source) }}</span
+                  >
+            </template>
           </templateTable>
     </div>
 
@@ -28,7 +33,7 @@
           <el-form
             :model="formData"
             :rules="rules"
-            ref="formDataDetail"
+            ref="formData"
             :inline="true"
             label-width="110px"
             size="small"
@@ -62,7 +67,7 @@
               </el-col>
               <el-col :span="12">
                 <el-form-item label="抽成比例" prop="proportional">
-                  <el-input v-model="formData.proportional" ></el-input>
+                  <el-input v-model="formData.proportional" placeholder="请输入抽成比例"></el-input>
                 </el-form-item>
               </el-col>
               <el-col :span="12">
@@ -72,14 +77,15 @@
               </el-col>
               <el-col :span="12">
                 <el-form-item label="业务来源" prop="source">
-                  <el-select v-model="formData.source" clearable filterable  placeholder="选择业务来源" @change="deptChange">
+                  <el-select v-model="formData.source" multiple clearable  placeholder="请选择业务来源">
                     <el-option
-                  v-for="val in organizationSourceoptions"
-                  :key="val.dictValue"
-                  :label="val.dictTag"
-                  :value="val.dictValue"
-                ></el-option>
-              </el-select>
+                      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>
@@ -103,33 +109,34 @@ export default {
   data() {
     return {
       formList: [
+        // {
+        //   label: "工号",
+        //   prop: "userId",
+        //   type: "input",
+        // },
         {
-          label: "工号",
+          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")),
+          options:[]
         },
+        // {
+        //   label: "机构id",
+        //   prop: "deptId",
+        //   type: "input",
+        // },
         {
-          label: "领导人",
-          prop: "leaderId",
-          type: "selectDept",
-          options: [],
+          label: "机构名称",
+          prop: "deptId",
+          type: "select",
+          options:[]
         },
+        // {
+        //   label: "业务来源",
+        //   prop: "source",
+        //   type: "select",
+        //   options:[]
+        // },
       ],
       btnGroup: [
         {
@@ -159,7 +166,7 @@ export default {
             label: "机构等级",
             type: "text",
           },
-          { prop: "source", label: "业务来源", type: "text" },
+          { name: "source", label: "业务来源", type: "slot" },
         ],
         loading: true,
         isPaginationShow: true,
@@ -174,9 +181,27 @@ export default {
               return this.handleTableEdit(row);
             },
           },
+          {
+            type: "primary",
+            label: "删除",
+            icon: "el-icon-delete",
+            click: (row, index) => {
+              return this.handleTableDeleteFlag(row);
+            },
+          },
         ],
       },
-      rules:[],
+      rules:{
+        proportional: [
+            { required: true, message: '请输入抽成比例', trigger: 'blur' },
+          ],
+          userName: [
+            { required: true, message: '请选择名称', trigger: 'change' }
+          ],
+          deptName: [
+            { required: true, message: '请选择机构名称', trigger: 'change' }
+          ],
+      },
       pageData: {
         pageNum: 1,
         pageSize: 10,
@@ -189,21 +214,40 @@ export default {
       pageResult: [],
       dialogTitle: "",
       dialogVisible: false, // 新增编辑界面是否显示
-      dialogPassword: true, //密码是否显示明文
     };
   },
   created() {
     this.findPage();
     this.$api.insCompany.getDeptInfo().then(res=>{
       if(res.code==200){
-        this.useroption=res.data
+        this.formList.forEach(e=>{
+          if(e.prop=='deptId'){
+            e.options=res.data
+          }
+        })
+        this.deptoption=res.data
       }
     })
     this.$api.insCompany.getUserInfo().then(res=>{
       if(res.code==200){
-        this.deptoption=res.data
+        this.formList.forEach(e=>{
+          if(e.prop=='userId'){
+            e.options=res.data
+          }
+        })
+        this.useroption=res.data
       }
     })
+    this.$api.insCompany.dicType('organizationSource').then((res) => {
+        if (res.code == 200) {
+          this.formList.forEach(e=>{
+          if(e.prop=='source'){
+            e.options=res.data.ddList
+          }
+        })
+          this.organizationSourceoptions = res.data.ddList;
+        }
+      });
   },
   methods: {
     userChange(val){
@@ -217,8 +261,10 @@ export default {
     deptChange(val){
       if(val){
         this.formData.deptId= this.deptoption.find(e=>e.name==val).id
+        this.formData.comlevel= this.deptoption.find(e=>e.name==val).comlevel
       }
       else{
+        this.formData.comlevel=''
         this.formData.deptId=''
       }
     },
@@ -231,32 +277,53 @@ export default {
     // 右侧列表的方法Start
     findPage(data) {
       this.tableConfig.loading = true;
-      this.$api.user
-        .findUserList({
+      this.$api.insCompany
+        .agencyQueryPage({
           ...this.pageData,
-          dto: { ...data, roleId: "20", agentFlag: "2" },
+          ...data,
         })
         .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;
+          this.pageResult = res.data.content;
+          this.pageData.pageNum = res.data.pageNum;
+          this.pageData.pageSize = res.data.pageSize;
+          this.pageData.totalSize = res.data.totalSize;
         });
     },
-   
+    statMaps(val) {
+      if (!val) return '-';
+      let arr = [];
+      val.forEach(item1=>{
+        this.organizationSourceoptions.forEach((item) => {
+        if(item.dictValue==item1){
+           arr.push(item.dictTag)
+        }
+      });
+      })
+      return arr.join(',')
+
+    },
     handleSearchList(data) {
       this.findPage(data);
     },
     //编辑
     async handleTableEdit(params) {
-      this.dialogPassword = false;
+      this.$api.insCompany
+        .agencyQueryById(params.id)
+        .then((res) => {
+          if(res.code==200){
+            this.dialogTitle = "编辑";
+            this.dialogVisible= true
+            this.formData=res.data
+          }
+
+        });
     },
     // 删除单个人员
     handleTableDeleteFlag(data) {
       this.$confirm("确认删除?")
         .then(() => {
-          this.$api.user.getDeleteBatch([data.row.userId]).then((res) => {
+          this.$api.insCompany.agencydel(data.id ).then((res) => {
             if (res.code == 200) {
               this.$message({
                 message: "删除成功",
@@ -273,7 +340,11 @@ export default {
     //添加人员
     handleAddButton() {
       this.dialogTitle = "新增";
+      this.formData={}
       this.dialogVisible = true;
+      if(this.$refs["formData"]){
+        this.$refs["formData"].resetFields();
+      }
     },
     handleDialogBefore(done) {
       // 退出对话框之前确认提示
@@ -290,16 +361,12 @@ export default {
     },
     // 提交
     submitForm() {
-      this.$refs.formDataDetail.validate((valid) => {
+      this.$refs.formData.validate((valid) => {
         if (valid) {
           this.$confirm("确认提交吗?", "提示", {}).then(() => {
             if (this.dialogTitle == "新增") {
-              this.$api.user
-                .saveUserInfo({
-                  esmUserImageVo: this.imagesIdList,
-                  sysUser: this.formData,
-                  sysUserInfo: this.formDataDetail,
-                })
+              this.$api.insCompany
+                .agencyAdd(this.formData)
                 .then((res) => {
                   if (res.code == 200) {
                     this.$message({
@@ -308,8 +375,6 @@ export default {
                     });
                     this.dialogVisible = false;
                     this.$refs["formData"].resetFields();
-                    this.$refs["formDataDetail"].resetFields();
-                    this.activeName = "1";
                     this.findPage();
                   } else {
                     this.$message({
@@ -319,12 +384,8 @@ export default {
                   }
                 });
             } else {
-              this.$api.user
-                .updateUserInfo(this.formData.id, {
-                  esmUserImageVo: this.imagesIdList,
-                  sysUser: this.formData,
-                  sysUserInfo: this.formDataDetail,
-                })
+              this.$api.insCompany
+                .agencyEdit(this.formData)
                 .then((res) => {
                   if (res.code == 200) {
                     this.$message({
@@ -333,8 +394,6 @@ export default {
                     });
                     this.dialogVisible = false;
                     this.$refs["formData"].resetFields();
-                    this.$refs["formDataDetail"].resetFields();
-                    this.activeName = "1";
                     this.findPage();
                   } else {
                     this.$message({