WINDOWS-7IFQK7E\EDY 2 years ago
parent
commit
6cd57a7e69
1 changed files with 148 additions and 63 deletions
  1. 148 63
      src/views/xtgl/zzjg/index.vue

+ 148 - 63
src/views/xtgl/zzjg/index.vue

@@ -41,88 +41,130 @@
                 style="display: inline-block; margin: 0 10px"
               >
                 <el-button type="primary">批量导入用户</el-button>
-              </el-upload>
-              <el-button type="primary" @click="showDialog('add')"
+              </el-upload>-->
+              <!-- <el-button type="primary" @click="showDialog('add')"
                 >新增用户</el-button
               > -->
-              <el-button type="primary" @click="hdlxglDialogShow" style="position: absolute; top: 0px; right: 0px">
-                设为活动管理</el-button>
+              <el-button
+                type="primary"
+                @click="hdlxglDialogShow"
+                style="position: absolute; top: 0px; right: 0px"
+              >
+                设为活动管理</el-button
+              >
               <!-- <el-button type="danger" @click="delUser">批量删除</el-button> -->
             </el-row>
             <el-row style="margin-top: 45px; margin-bottom: 15px">
-              <el-input placeholder="请输入搜索关键字" v-model="searchText" clearable @clear="tableParams.keyword = searchText"
-                style="width: 300px; margin-right: 10px"></el-input>
-              <el-button type="primary" @click="tableParams.keyword = searchText">搜索</el-button>
+              <el-input
+                placeholder="请输入搜索关键字"
+                v-model="searchText"
+                clearable
+                @clear="tableParams.keyword = searchText"
+                style="width: 300px; margin-right: 10px"
+              ></el-input>
+              <el-button
+                type="primary"
+                @click="tableParams.keyword = searchText"
+                >搜索</el-button
+              >
             </el-row>
-            <el-table ref="multipleTable" :data="tableData" tooltip-effect="dark" style="width: 100%"
-              @selection-change="changeChecked">
+            <el-table
+              ref="multipleTable"
+              :data="tableData"
+              tooltip-effect="dark"
+              style="width: 100%"
+              @selection-change="changeChecked"
+            >
               <el-table-column type="selection" width="55"></el-table-column>
               <el-table-column label="用户名">
                 <template slot-scope="scope">{{
-                    scope.row.user_name
+                  scope.row.user_name
                 }}</template>
               </el-table-column>
               <el-table-column label="姓名">
                 <template slot-scope="scope">{{
-                    scope.row.user_realname
+                  scope.row.user_realname
                 }}</template>
               </el-table-column>
               <el-table-column label="部门">
                 <template slot-scope="scope">
                   {{
-                      scope.row.org_info.dept_full.reduce(function (path, data) {
-                        return (path += "/" + data.dept_name || "");
-                      }, "")
+                    scope.row.org_info.dept_full.reduce(function (path, data) {
+                      return (path += "/" + data.dept_name || "");
+                    }, "")
                   }}
                 </template>
               </el-table-column>
               <el-table-column label="角色">
                 <template slot-scope="scope">{{
-                    scope.row.user_role_name
+                  scope.row.user_role_name
                 }}</template>
               </el-table-column>
-              <el-table-column label="管理活动类型" width="200" :show-overflow-tooltip="true">
+              <el-table-column
+                label="管理活动类型"
+                width="200"
+                :show-overflow-tooltip="true"
+              >
                 <template slot-scope="scope">
                   {{
-                      scope.row.my_cates.hh_ids_full.reduce(function (
-                        result,
-                        item
-                      ) {
-                        return (result += item.hh_name + ",");
-                      },
-                        "")
+                    scope.row.my_cates.hh_ids_full.reduce(function (
+                      result,
+                      item
+                    ) {
+                      return (result += item.hh_name + ",");
+                    },
+                    "")
                   }}
                 </template>
               </el-table-column>
               <el-table-column label="账号类型">
                 <template slot-scope="scope">{{
-                    scope.row.user_level === "1" ? "普通账号" : "临时账号"
+                  scope.row.user_level === "1" ? "普通账号" : "临时账号"
                 }}</template>
               </el-table-column>
               <el-table-column label="操作" width="120">
                 <template slot-scope="scope">
-                  <el-link type="primary" @click="showAccessDialog(scope.row)">权限</el-link>
-                  <!--<span style="color: #409eff; margin: 0 10px">|</span>
-                 <el-link type="primary" @click="showDialog('edit', scope.row)"
+                  <el-link type="primary" @click="showAccessDialog(scope.row)"
+                    >权限</el-link
+                  >
+                  <span style="color: #409eff; margin: 0 10px">|</span>
+                  <el-link type="primary" @click="showDialog('edit', scope.row)"
                     >编辑</el-link
-                  > -->
+                  >
                 </template>
               </el-table-column>
             </el-table>
           </el-main>
           <el-footer style="text-align: right">
-            <el-pagination background hide-on-single-page layout="prev, pager, next" :page-size="tableParams.limit"
-              :total="total_rows" @current-change="pageChange"></el-pagination>
+            <el-pagination
+              background
+              hide-on-single-page
+              layout="prev, pager, next"
+              :page-size="tableParams.limit"
+              :total="total_rows"
+              @current-change="pageChange"
+            ></el-pagination>
           </el-footer>
         </el-container>
       </el-col>
     </el-row>
     <!--  用户信息  -->
-    <el-dialog :title="dialogType === 'add' ? '新增用户' : '编辑用户'" v-if="userDialogVisible"
-      :visible.sync="userDialogVisible" :close-on-click-modal="false" @closed="resetDialog('user_main')" width="700px">
-      <el-form ref="user_main" :model="user_main" :rules="form_rules" label-width="120px">
+    <el-dialog
+      :title="dialogType === 'add' ? '新增用户' : '编辑用户'"
+      v-if="userDialogVisible"
+      :visible.sync="userDialogVisible"
+      :close-on-click-modal="false"
+      @closed="resetDialog('user_main')"
+      width="700px"
+    >
+      <el-form
+        ref="user_main"
+        :model="user_main"
+        :rules="form_rules"
+        label-width="120px"
+      >
         <el-row>
-          <el-col :span="12">
+          <!-- <el-col :span="12">
             <el-form-item label="用户名" prop="user_name">
               <el-input v-model="user_main.user_name"></el-input>
             </el-form-item>
@@ -144,14 +186,19 @@
                 <el-option label="普通账号" value="1"></el-option>
               </el-select>
             </el-form-item>
-          </el-col>
+          </el-col> -->
           <el-col :span="24">
             <el-form-item label="部门" prop="dept_id">
-              <el-cascader :options="deptOptions" :props="{ checkStrictly: true, emitPath: false }" clearable filterable
-                v-model="user_main.dept_id"></el-cascader>
+              <el-cascader
+                :options="deptOptions"
+                :props="{ checkStrictly: true, emitPath: false }"
+                clearable
+                filterable
+                v-model="user_main.dept_id"
+              ></el-cascader>
             </el-form-item>
           </el-col>
-          <el-col :span="12">
+          <!-- <el-col :span="12">
             <el-form-item label="手机号" prop="user_phone">
               <el-input v-model="user_main.user_phone"></el-input>
             </el-form-item>
@@ -159,14 +206,21 @@
           <el-col :span="12">
             <el-form-item label="用户角色" prop="user_role_id">
               <el-select v-model="user_main.user_role_id" placeholder="请选择">
-                <el-option v-for="role in roleList" :key="role.role_id" :label="role.role_name" :value="role.role_id">
+                <el-option
+                  v-for="role in roleList"
+                  :key="role.role_id"
+                  :label="role.role_name"
+                  :value="role.role_id"
+                >
                 </el-option>
               </el-select>
             </el-form-item>
-          </el-col>
+          </el-col> -->
           <el-col :span="24">
             <el-form-item>
-              <el-button type="primary" @click="onSubmit('user_main')">提交</el-button>
+              <el-button type="primary" @click="onSubmit('user_main')"
+                >提交</el-button
+              >
               <el-button @click="onReset('user_main')">重置</el-button>
             </el-form-item>
           </el-col>
@@ -174,8 +228,14 @@
       </el-form>
     </el-dialog>
     <!--  权限信息  -->
-    <el-dialog :title="activeUserName + '的权限修改'" :visible.sync="accessDialogVisible" v-if="accessDialogVisible"
-      :destroy-on-close="true" width="360px" @close="renderTable">
+    <el-dialog
+      :title="activeUserName + '的权限修改'"
+      :visible.sync="accessDialogVisible"
+      v-if="accessDialogVisible"
+      :destroy-on-close="true"
+      width="360px"
+      @close="renderTable"
+    >
       <!-- <el-switch v-model="accessForm.activity" @change="changeAccess($event, 'activity')" active-text="活动管理员"
         class="accessContle" :active-value="1" :inactive-value="0"></el-switch>
       <el-switch v-model="accessForm.dept_master" @change="changeAccess($event, 'dept_master')" active-text="系统管理员"
@@ -183,8 +243,17 @@
       <el-switch v-model="accessForm.readonly" @change="changeAccess($event, 'readonly')" active-text="领导"
         class="accessContle" :active-value="1" :inactive-value="0"></el-switch> -->
 
-      <el-radio-group v-model="accessValue" @change="handleChangeAccess" size="medium"
-        :style="{ display: 'flex', 'flex-direction': 'column', 'justify-content': 'space-between', height: '110px' }">
+      <el-radio-group
+        v-model="accessValue"
+        @change="handleChangeAccess"
+        size="medium"
+        :style="{
+          display: 'flex',
+          'flex-direction': 'column',
+          'justify-content': 'space-between',
+          height: '110px',
+        }"
+      >
         <el-radio label="activity">活动管理员</el-radio>
         <el-radio label="dept_master">系统管理员</el-radio>
         <el-radio label="readonly">领导</el-radio>
@@ -192,9 +261,20 @@
       </el-radio-group>
     </el-dialog>
     <!--  活动类型选择  -->
-    <el-dialog title="活动类型选择" :visible.sync="hdlxxzDialogVisible" width="700px" :close-on-click-modal="false">
-      <el-cascader :options="hdlxOptions" :props="{ checkStrictly: true }" placeholder="请选择活动类型" clearable filterable
-        v-model="hdlxCheckedId"></el-cascader>
+    <el-dialog
+      title="活动类型选择"
+      :visible.sync="hdlxxzDialogVisible"
+      width="700px"
+      :close-on-click-modal="false"
+    >
+      <el-cascader
+        :options="hdlxOptions"
+        :props="{ checkStrictly: true }"
+        placeholder="请选择活动类型"
+        clearable
+        filterable
+        v-model="hdlxCheckedId"
+      ></el-cascader>
       <el-divider></el-divider>
       <el-button type="primary" @click="addHdlxAdmin">提交设置</el-button>
     </el-dialog>
@@ -246,9 +326,9 @@ export default {
       accessForm: {
         activity: 0,
         dept_master: 0,
-        readonly: 0
+        readonly: 0,
       },
-      accessValue: 'none',
+      accessValue: "none",
       user_main: {
         user_name: "",
         user_password: "",
@@ -374,25 +454,30 @@ export default {
       // this.accessForm.activity = row.power.activity * 1
       // this.accessForm.readonly = row.power.readonly * 1
 
-      this.accessValue = row.power.dept_master * 1 ? 'dept_master' : row.power.activity * 1 ? 'activity' : row.power.readonly * 1 ? 'readonly' : 'none'
-      this.accessDialogVisible = true
+      this.accessValue =
+        row.power.dept_master * 1
+          ? "dept_master"
+          : row.power.activity * 1
+          ? "activity"
+          : row.power.readonly * 1
+          ? "readonly"
+          : "none";
+      this.accessDialogVisible = true;
     },
     /**权限控制*/
     handleChangeAccess(val) {
-      user_set_access(
-        {
-          user_id: this.activeUserId,
-          access:
+      user_set_access({
+        user_id: this.activeUserId,
+        access:
           // val === 'none'
           //   ? {
           //     announce: 0
           //   }
-          //   : 
+          //   :
           {
-            [val]: 1
-          }
-        }
-      ).then((res) => {
+            [val]: 1,
+          },
+      }).then((res) => {
         if (res.code === "1") {
           this.$message.success(res.msg);
           // this.renderTable();
@@ -407,7 +492,7 @@ export default {
           // activity: 0,
           // dept_master: 0,
           // readonly: 0
-        }
+        },
       };
       // this.accessForm
       // data.user_id = this.activeUserId;
@@ -428,7 +513,7 @@ export default {
       //     };
       //     break;
       // }
-      data.access[mark] = $event
+      data.access[mark] = $event;
       user_set_access(data).then((res) => {
         if (res.code === "1") {
           this.$message.success(res.msg);