艺术家
2025-06-04 772190e7b2e3f6ef0695ba54d9209324acdcb30a
ÏîÄ¿´úÂë/ÉìËõ¸Ë/client/src/views/tts/UserManagement/Usermanagement.vue
@@ -14,6 +14,18 @@
        >
          ç”¨æˆ·è§’色
        </div>
        <div
          :class="['item', isactive == 3 ? 'isactive' : '']"
          @click="changeactive(3)"
        >
          ç”¨æˆ·ç­ç»„
        </div>
        <div
          :class="['item', isactive == 4 ? 'isactive' : '']"
          @click="changeactive(4)"
        >
          ç”¨æˆ·å•位
        </div>
      </div>
      <div class="serch">
        <div class="time_box">
@@ -31,6 +43,7 @@
              height: 2rem;
              border-left: 0;
            "
            class="time_picker"
            format="YYYY-MM-DD HH:mm:ss"
            type="datetimerange"
            range-separator="~"
@@ -46,6 +59,7 @@
              placeholder="请选择"
              size="small"
              style="width: 100%; font-size: 0.15rem"
              class="select"
            >
              <el-option
                v-for="item in selectoptions"
@@ -65,10 +79,15 @@
          @click="handleQuery"
          type="primary"
          size="small"
          style="margin-left: 0.98rem; height: 2rem"
          style="margin-left: 0.98rem; height: 2.5rem"
          class="text_btn"
          >查询</el-button
        >
        <el-button size="small" style="height: 2rem" @click="resetQuery"
        <el-button
          size="small"
          style="height: 2.5rem"
          class="text_btn"
          @click="resetQuery"
          >重置</el-button
        >
      </div>
@@ -87,6 +106,7 @@
              display: flex;
              align-items: center;
            "
            class="text_btn"
            ><el-icon style="margin-right: 0.2rem"> <Plus /> </el-icon
            >新建</el-button
          >
@@ -103,6 +123,41 @@
              display: flex;
              align-items: center;
            "
            class="text_btn"
            ><el-icon style="margin-right: 0.2rem"> <Plus /> </el-icon
            >新建</el-button
          >
          <!-- ç”¨æˆ·ç­ç»„新建 -->
          <el-button
            v-if="isactive == 3"
            type="primary"
            size="small"
            @click="AddGroup"
            style="
              width: 5.5rem;
              height: 2rem;
              font-size: 0.88rem;
              display: flex;
              align-items: center;
            "
            class="text_btn"
            ><el-icon style="margin-right: 0.2rem"> <Plus /> </el-icon
            >新建</el-button
          >
          <!-- ç”¨æˆ·å•位新建 -->
          <el-button
            v-if="isactive == 4"
            type="primary"
            size="small"
            @click="AddUnit"
            style="
              width: 5.5rem;
              height: 2rem;
              font-size: 0.88rem;
              display: flex;
              align-items: center;
            "
            class="text_btn"
            ><el-icon style="margin-right: 0.2rem"> <Plus /> </el-icon
            >新建</el-button
          >
@@ -110,12 +165,14 @@
            size="small"
            style="width: 5.5rem; height: 2rem; font-size: 0.88rem"
            @click="printExcel"
            class="text_btn"
            >批量导出</el-button
          >
          <el-button
            @click="deleteAll"
            size="small"
            style="width: 5.5rem; height: 2rem; font-size: 0.88rem"
            class="text_btn"
            >批量删除</el-button
          >
        </div>
@@ -124,22 +181,40 @@
        <!-- ç”¨æˆ·åˆ—表 -->
        <el-table
          empty-text="暂无数据"
          height="450"
          :height="isMin ? '950' : '450'"
          v-if="isactive == 1"
          :data="tableData"
          style="width: 100%"
          :header-cell-style="{
            background: 'rgba(250,250,250,1)',
            color: '#101010',
            fontSize: '0.88rem',
            height: '3rem',
            border: 'none',
          }"
          :row-style="{
            color: '#101010',
            fontSize: '0.88rem',
            height: '3rem',
          }"
          :header-cell-style="
            isMin
              ? {
                  background: 'rgba(250,250,250,1)',
                  color: '#101010',
                  fontSize: '1.5rem',
                  height: '3rem',
                  border: 'none',
                }
              : {
                  background: 'rgba(250,250,250,1)',
                  color: '#101010',
                  fontSize: '0.88rem',
                  height: '3rem',
                  border: 'none',
                }
          "
          :row-style="
            isMin
              ? {
                  color: '#101010',
                  fontSize: '2rem',
                  height: '3rem',
                }
              : {
                  color: '#101010',
                  fontSize: '0.88rem',
                  height: '3rem',
                }
          "
          @selection-change="UserSelectionChange"
        >
          <el-table-column type="selection" align="center" min-width="1%" />
@@ -162,14 +237,25 @@
            min-width="3%"
          />
          <el-table-column
            prop="userteam"
            label="用户分组"
            prop="isLeader"
            label="用户类型"
            align="center"
            min-width="2%"
          >
            <template #default="scope">
              <span v-if="scope.row.isLeader == 0">组员</span>
              <span v-else-if="scope.row.isLeader == 1">组长</span>
            </template>
          </el-table-column>
          <el-table-column
            prop="unit"
            label="单位"
            align="center"
            min-width="3%"
          />
          <el-table-column
            prop="roleName"
            label="用户角色"
            prop="userteam"
            label="班组"
            align="center"
            min-width="3%"
          />
@@ -182,7 +268,7 @@
            <template #default="scope">
              <el-image
                style="width: 5rem; height: 5rem"
                :src="'http://192.168.2.103:9093' + scope.row.headImageUrl"
                :src="'http://192.168.1.103:9093' + scope.row.headImageUrl"
                show-progress
                :initial-index="4"
                fit="cover"
@@ -242,22 +328,40 @@
        <!-- ç”¨æˆ·è§’色 -->
        <el-table
          empty-text="暂无数据"
          height="450"
          :height="isMin ? '950' : '450'"
          v-if="isactive == 2"
          :data="grideData"
          style="width: 100%"
          :header-cell-style="{
            background: 'rgba(250,250,250,1)',
            color: '#101010',
            fontSize: '0.88rem',
            height: '3rem',
            border: 'none',
          }"
          :row-style="{
            color: '#101010',
            fontSize: '0.88rem',
            height: '3rem',
          }"
          :header-cell-style="
            isMin
              ? {
                  background: 'rgba(250,250,250,1)',
                  color: '#101010',
                  fontSize: '1.5rem',
                  height: '3rem',
                  border: 'none',
                }
              : {
                  background: 'rgba(250,250,250,1)',
                  color: '#101010',
                  fontSize: '0.88rem',
                  height: '3rem',
                  border: 'none',
                }
          "
          :row-style="
            isMin
              ? {
                  color: '#101010',
                  fontSize: '1.88rem',
                  height: '3rem',
                }
              : {
                  color: '#101010',
                  fontSize: '0.88rem',
                  height: '3rem',
                }
          "
          @selection-change="RoleSelectionChange"
        >
          <el-table-column type="selection" align="center" />
@@ -276,6 +380,12 @@
                style="color: #4386ff; cursor: pointer"
                >管理</span
              >
            </template>
          </el-table-column>
          <el-table-column prop="isLeader" label="组员类型" align="center">
            <template #default="scope">
              <span v-if="scope.row.isLeader == 0">组员</span>
              <span v-else-if="scope.row.isLeader == 1">组长</span>
            </template>
          </el-table-column>
          <el-table-column prop="deptName" label="备注" align="center" />
@@ -303,8 +413,142 @@
                      scope.row.user_Id == '1' ||
                      scope.row.userName != userInfo.userName)
                "
                style="color: blue; font-size: 0.88rem; cursor: pointer"
                :style="{
                  color: 'blue',
                  fontSize: isMin ? '1.88rem' : '0.88rem',
                  cursor: 'pointer',
                }"
                @click="EditRole(scope.row)"
                >编辑</span
              >
            </template></el-table-column
          >
        </el-table>
        <!-- ç”¨æˆ·ç­ç»„ -->
        <el-table
          empty-text="暂无数据"
          :height="isMin ? '950' : '450'"
          v-if="isactive == 3"
          :data="departmentData"
          style="width: 100%"
          :header-cell-style="
            isMin
              ? {
                  background: 'rgba(250,250,250,1)',
                  color: '#101010',
                  fontSize: '1.5rem',
                  height: '3rem',
                  border: 'none',
                }
              : {
                  background: 'rgba(250,250,250,1)',
                  color: '#101010',
                  fontSize: '0.88rem',
                  height: '3rem',
                  border: 'none',
                }
          "
          :row-style="
            isMin
              ? {
                  color: '#101010',
                  fontSize: '1.88rem',
                  height: '3rem',
                }
              : {
                  color: '#101010',
                  fontSize: '0.88rem',
                  height: '3rem',
                }
          "
          @selection-change="TreamSelectionChange"
        >
          <el-table-column type="selection" align="center" />
          <el-table-column prop="teamName" label="班组名称" align="center" />
          <el-table-column prop="creater" label="创建者" align="center" />
          <el-table-column prop="createDate" label="创建时间" align="center" />
          <el-table-column label="操作" align="center">
            <template #default="scope">
              <span
                v-if="
                  !(userInfo.userName == 'admin' || userInfo.roleId == '1'
                    ? scope.row.userName == 'admin' || scope.row.user_Id == '1'
                    : scope.row.userName == 'admin' ||
                      scope.row.user_Id == '1' ||
                      scope.row.userName != userInfo.userName)
                "
                :style="{
                  color: 'blue',
                  fontSize: isMin ? '1.88rem' : '0.88rem',
                  cursor: 'pointer',
                }"
                @click="EditTream(scope.row)"
                >编辑</span
              >
            </template></el-table-column
          >
        </el-table>
        <!-- ç”¨æˆ·å•位 -->
        <el-table
          empty-text="暂无数据"
          :height="isMin ? '950' : '450'"
          v-if="isactive == 4"
          :data="unitData"
          style="width: 100%"
          :header-cell-style="
            isMin
              ? {
                  background: 'rgba(250,250,250,1)',
                  color: '#101010',
                  fontSize: '1.5rem',
                  height: '3rem',
                  border: 'none',
                }
              : {
                  background: 'rgba(250,250,250,1)',
                  color: '#101010',
                  fontSize: '0.88rem',
                  height: '3rem',
                  border: 'none',
                }
          "
          :row-style="
            isMin
              ? {
                  color: '#101010',
                  fontSize: '1.88rem',
                  height: '3rem',
                }
              : {
                  color: '#101010',
                  fontSize: '0.88rem',
                  height: '3rem',
                }
          "
          @selection-change="UnitSelectionChange"
        >
          <el-table-column type="selection" align="center" />
          <el-table-column prop="unitName" label="单位名称" align="center" />
          <el-table-column prop="creater" label="创建者" align="center" />
          <el-table-column prop="createDate" label="创建日期" align="center" />
          <el-table-column label="操作" align="center">
            <template #default="scope">
              <span
                v-if="
                  !(userInfo.userName == 'admin' || userInfo.roleId == '1'
                    ? scope.row.userName == 'admin' || scope.row.user_Id == '1'
                    : scope.row.userName == 'admin' ||
                      scope.row.user_Id == '1' ||
                      scope.row.userName != userInfo.userName)
                "
                :style="{
                  color: 'blue',
                  fontSize: isMin ? '1.88rem' : '0.88rem',
                  cursor: 'pointer',
                }"
                @click="EditUnit(scope.row)"
                >编辑</span
              >
            </template></el-table-column
@@ -354,6 +598,7 @@
        >
          <span
            style="color: rgb(16, 16, 16); font-size: 1rem; font-weight: bold"
            class="font-title"
            >用户信息</span
          >
        </div>
@@ -374,6 +619,7 @@
                  <span style="color: red; margin-right: 0.2rem">*</span>
                  <span
                    style="font-size: 0.88rem; color: black; font-weight: bold"
                    class="from_title"
                    >登录账号</span
                  >
                </div>
@@ -392,6 +638,7 @@
                  <span style="color: red; margin-right: 0.2rem">*</span>
                  <span
                    style="font-size: 0.88rem; color: black; font-weight: bold"
                    class="from_title"
                    >真实姓名</span
                  >
                </div>
@@ -410,6 +657,7 @@
                  <span style="color: red; margin-right: 0.2rem">*</span>
                  <span
                    style="font-size: 0.88rem; color: black; font-weight: bold"
                    class="from_title"
                    >联系电话</span
                  >
                </div>
@@ -430,6 +678,7 @@
                  <span style="color: red; margin-right: 0.2rem">*</span>
                  <span
                    style="font-size: 0.88rem; color: black; font-weight: bold"
                    class="from_title"
                    >用户角色
                  </span>
                </div>
@@ -438,6 +687,7 @@
                v-model="formUser.roleid"
                placeholder="请选择"
                size="small"
                @change="handleRoleChange"
              >
                <el-option
                  :disabled="item.roleId == 1"
@@ -450,26 +700,27 @@
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item prop="rolename">
            <el-form-item prop="userunit">
              <template #label>
                <div style="display: flex; align-items: flex-end">
                  <span style="color: red; margin-right: 0.2rem">*</span>
                  <span
                    style="font-size: 0.88rem; color: black; font-weight: bold"
                    >用户类型
                  </span>
                    class="from_title"
                    >单位</span
                  >
                </div>
              </template>
              <el-select
                v-model="formUser.rolename"
                v-model="formUser.userunit"
                placeholder="请选择"
                size="small"
              >
                <el-option
                  v-for="item in roleNameList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                  v-for="item in unitData"
                  :key="item.id"
                  :label="item.unitName"
                  :value="item.unitName"
                />
              </el-select>
            </el-form-item>
@@ -481,6 +732,7 @@
                  <span style="color: red; margin-right: 0.2rem">*</span>
                  <span
                    style="font-size: 0.88rem; color: black; font-weight: bold"
                    class="from_title"
                    >是否启用</span
                  >
                </div>
@@ -502,68 +754,31 @@
        </el-row>
        <el-row :gutter="20">
          <el-col :span="8">
            <el-form-item prop="dept_Id">
            <el-form-item prop="userteam">
              <template #label>
                <div style="display: flex; align-items: flex-end">
                  <span style="color: red; margin-right: 0.2rem">*</span>
                  <span
                    style="font-size: 0.88rem; color: black; font-weight: bold"
                    >轨道站</span
                    class="from_title"
                    >班组</span
                  >
                </div>
              </template>
              <el-select
                v-model="formUser.dept_Id"
                v-model="formUser.userteam"
                placeholder="请选择"
                size="small"
              >
                <el-option
                  v-for="item in departmentOptions"
                  v-for="item in departmentData"
                  :key="item.id"
                  :label="item.departmentName"
                  :value="item.id"
                  :label="item.teamName"
                  :value="item.teamName"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item prop="dept_Id">
              <template #label>
                <div style="display: flex; align-items: flex-end">
                  <span style="color: red; margin-right: 0.2rem">*</span>
                  <span
                    style="font-size: 0.88rem; color: black; font-weight: bold"
                    >组</span
                  >
                </div>
              </template>
              <el-input
                size="small"
                v-model="formUser.userteam"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item prop="dept_Id">
              <template #label>
                <div style="display: flex; align-items: flex-end">
                  <span style="color: red; margin-right: 0.2rem">*</span>
                  <span
                    style="font-size: 0.88rem; color: black; font-weight: bold"
                    >卡号</span
                  >
                </div>
              </template>
              <el-input
                size="small"
                v-model="formUser.carnuber"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="8">
            <el-form-item>
              <template #label>
@@ -571,23 +786,16 @@
                  <span style="color: red; margin-right: 0.2rem">*</span>
                  <span
                    style="font-size: 0.88rem; color: black; font-weight: bold"
                    class="from_title"
                    >人脸图片</span
                  >
                  <!-- <span
                    style="
                      color: rgba(255, 0, 0, 1);
                      font-size: 0.75rem;
                      margin-left: 0.5rem;
                    "
                    >注:最多可上传三张,图片需要正规的人像证件照</span
                  > -->
                </div>
              </template>
              <el-upload
                ref="uploadRef"
                name="files"
                class="avatar-uploader"
                action="http://192.168.2.103:9093/api/User/SaveFiles"
                action="http://192.168.1.103:9093/api/User/SaveFiles"
                list-type="picture-card"
                limit="1"
                :auto-upload="true"
@@ -660,7 +868,7 @@
      </template>
    </el-dialog>
    <!-- ç”¨æˆ·ä¿¡æ¯ä¿®æ”¹å¯†ç å¼¹å‡ºæ¡† -->
    <!-- ç”¨æˆ·ä¿®æ”¹å¯†ç å¼¹å‡ºæ¡† -->
    <el-dialog
      v-model="dialogVisible1"
      title=""
@@ -703,9 +911,11 @@
                border-radius: 0.25rem;
              "
            >
              <span style="color: #51b820; font-size: 1rem"
              <span style="color: #51b820; font-size: 1rem" class="formpassword"
                >账号:{{ formpassword.userName }}</span
              ><span style="color: #51b820; font-size: 1rem; margin-left: 2rem"
              ><span
                style="color: #51b820; font-size: 1rem; margin-left: 2rem"
                class="formpassword"
                >用户:{{ formpassword.roleName }}</span
              >
            </div>
@@ -760,7 +970,11 @@
          "
        >
          <span
            style="color: rgb(16, 16, 16); font-size: 1rem; font-weight: bold"
            :style="{
              color: 'rgb(16, 16, 16)',
              fontSize: isMin ? '2rem' : '1rem',
              fontWeight: 'bold',
            }"
            >用户角色</span
          >
        </div>
@@ -776,8 +990,20 @@
        <el-form-item prop="roleName">
          <template #label>
            <div style="display: flex; align-items: flex-end">
              <span style="color: red; margin-right: 0.2rem">*</span>
              <span style="font-size: 0.88rem; color: black; font-weight: bold"
              <span
                :style="{
                  color: 'red',
                  marginRight: '0.2rem',
                  fontSize: '2rem',
                }"
                >*</span
              >
              <span
                :style="{
                  fontSize: isMin ? '2rem' : '0.88rem',
                  color: 'black',
                  fontWeight: bold,
                }"
                >角色名称</span
              >
            </div>
@@ -789,10 +1015,49 @@
            placeholder="请输入"
          />
        </el-form-item>
        <el-form-item prop="isLeader">
          <template #label>
            <div style="display: flex; align-items: flex-end">
              <span
                :style="{
                  color: 'red',
                  marginRight: '0.2rem',
                  fontSize: '2rem',
                }"
                >*</span
              >
              <span
                :style="{
                  fontSize: isMin ? '2rem' : '0.88rem',
                  color: 'black',
                  fontWeight: bold,
                }"
                >组员类型</span
              >
            </div>
          </template>
          <el-select
            v-model="formRole.isLeader"
            placeholder="请选择"
            size="small"
          >
            <el-option
              v-for="item in rolekey"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            />
          </el-select>
        </el-form-item>
        <el-form-item>
          <template #label>
            <div style="display: flex; align-items: flex-end">
              <span style="font-size: 0.88rem; color: black; font-weight: bold"
              <span
                :style="{
                  fontSize: isMin ? '2rem' : '0.88rem',
                  color: 'black',
                  fontWeight: 'bold',
                }"
                >备注</span
              >
            </div>
@@ -818,6 +1083,178 @@
            size="small"
            type="primary"
            @click="saveRole(formRoleRef)"
            style="height: 2rem; font-size: 0.88rem"
          >
            ä¿å­˜
          </el-button>
        </div>
      </template>
    </el-dialog>
    <!-- ç”¨æˆ·ç­ç»„新建/编辑 -->
    <el-dialog
      v-model="TreamdialogVisible"
      title=""
      width="20%"
      :before-close="handleClose"
      :show-close="false"
      :align-center="true"
      @close="resetForm2(formTreamdRef)"
    >
      <template #title>
        <div
          style="
            height: 3.63rem;
            display: flex;
            border-bottom: 1px solid #e6e6e6;
          "
        >
          <span
            :style="{
              color: 'rgb(16, 16, 16)',
              fontSize: isMin ? '2rem' : '1rem',
              fontWeight: 'bold',
            }"
            >用户班组</span
          >
        </div>
      </template>
      <el-form
        :model="formTeam"
        label-width="auto"
        label-position="top"
        ref="formTreamdRef"
        :rules="roleRules"
        :hide-required-asterisk="true"
      >
        <el-form-item prop="teamName">
          <template #label>
            <div style="display: flex; align-items: flex-end">
              <span
                :style="{
                  color: 'red',
                  marginRight: '0.2rem',
                  fontSize: '2rem',
                }"
                >*</span
              >
              <span
                :style="{
                  fontSize: isMin ? '2rem' : '0.88rem',
                  color: 'black',
                  fontWeight: bold,
                }"
                >班组名称</span
              >
            </div>
          </template>
          <el-input
            style="height: 2rem"
            size="small"
            v-model="formTeam.teamName"
            placeholder="请输入"
          />
        </el-form-item>
      </el-form>
      <template #footer>
        <div class="dialog-footer" style="text-align: center">
          <el-button
            size="small"
            @click="TreamdialogVisible = false"
            style="height: 2rem; font-size: 0.88rem"
            >取消</el-button
          >
          <el-button
            size="small"
            type="primary"
            @click="saveTream(formTreamdRef)"
            style="height: 2rem; font-size: 0.88rem"
          >
            ä¿å­˜
          </el-button>
        </div>
      </template>
    </el-dialog>
    <!-- ç”¨æˆ·å•位新建/编辑 -->
    <el-dialog
      v-model="UnitdialogVisible"
      title=""
      width="20%"
      :before-close="handleClose"
      :show-close="false"
      :align-center="true"
      @close="resetForm3(formUnitRef)"
    >
      <template #title>
        <div
          style="
            height: 3.63rem;
            display: flex;
            border-bottom: 1px solid #e6e6e6;
          "
        >
          <span
            :style="{
              color: 'rgb(16, 16, 16)',
              fontSize: isMin ? '2rem' : '1rem',
              fontWeight: 'bold',
            }"
            >用户单位</span
          >
        </div>
      </template>
      <el-form
        :model="formUnit"
        label-width="auto"
        label-position="top"
        ref="formUnitRef"
        :rules="roleRules"
        :hide-required-asterisk="true"
      >
        <el-form-item prop="unitName">
          <template #label>
            <div style="display: flex; align-items: flex-end">
              <span
                :style="{
                  color: 'red',
                  marginRight: '0.2rem',
                  fontSize: '2rem',
                }"
                >*</span
              >
              <span
                :style="{
                  fontSize: isMin ? '2rem' : '0.88rem',
                  color: 'black',
                  fontWeight: bold,
                }"
                >单位名称</span
              >
            </div>
          </template>
          <el-input
            style="height: 2rem"
            size="small"
            v-model="formUnit.unitName"
            placeholder="请输入"
          />
        </el-form-item>
      </el-form>
      <template #footer>
        <div class="dialog-footer" style="text-align: center">
          <el-button
            size="small"
            @click="UnitdialogVisible = false"
            style="height: 2rem; font-size: 0.88rem"
            >取消</el-button
          >
          <el-button
            size="small"
            type="primary"
            @click="saveUnit(formUnitRef)"
            style="height: 2rem; font-size: 0.88rem"
          >
            ä¿å­˜
@@ -858,6 +1295,15 @@
  ExportApi1,
  UpdatePwd,
  DeleteUserData,
  GetDepartment,
  GetUserTeam,
  AddUserTeam,
  EditUserTeam,
  DeleteUserTeam,
  GetUserUnit,
  AddUserUnit,
  EditUserUnit,
  DeleteUserUnit,
} from "@/api/user";
import { useRouter } from "vue-router";
import { formatTime } from "@/utils/index.js";
@@ -868,7 +1314,6 @@
  UpdateRoleApi,
  DeleteRoleApi,
} from "@/api/role";
import { GetDepartment } from "@/api/user";
let obj = {
  selectName: "",
  selectTime: [], // æ—¶é—´èŒƒå›´
@@ -880,10 +1325,12 @@
const tableData = ref([]);
const grideData = ref([]);
//用户班组
const departmentData = ref([]);
//用户单位
const unitData = ref([]);
//新建用户ref
const formUserRef = ref();
const options = ref([]);
const props = { multiple: true };
const userInfo = ref();
const isoptins = ref([
  {
@@ -892,13 +1339,13 @@
  },
  { value: 1, label: "是" },
]);
//分组
//角色
const groupOptions = ref([]);
const formUser = ref({
  id: undefined,
  username: "",
  phoneno: "",
  roleid: 2,
  roleid: null,
  rolename: "",
  enable: 1,
  path: "",
@@ -906,14 +1353,16 @@
  dept_Id: 1,
  carnuber: null,
  userteam: "",
  isLeader: 0,
  userunit: "",
});
const rules = reactive({
  userName: {
  username: {
    required: true,
    message: "请输入用户名",
    trigger: "blur",
  },
  role_Id: {
  roleid: {
    required: true,
    message: "请选择角色",
    trigger: "change",
@@ -930,12 +1379,12 @@
    message: "请输入姓名",
    trigger: "blur",
  },
  phoneNo: {
  phoneno: {
    required: true,
    message: "请输入手机号",
    trigger: "blur",
  },
  userTrueName: {
  usertruename: {
    required: true,
    message: "请输入真实姓名",
    trigger: "blur",
@@ -945,13 +1394,12 @@
    message: "请输入组",
    trigger: "blur",
  },
  carnuber: {
  userunit: {
    required: true,
    message: "请输入卡号",
    message: "请选择单位",
    trigger: "blur",
  },
});
const formpasswordRef = ref();
const isactive = ref(1);
const dialogVisible = ref(false);
@@ -977,21 +1425,26 @@
  },
];
const fileList = ref([]);
const roleNameList = ref([
  { value: "电气质检", label: "电气质检" },
  { value: "机械质检", label: "机械质检" },
  { value: "地沟质检", label: "地沟质检" },
  { value: "电气力矩", label: "电气力矩" },
  { value: "电气辅助", label: "电气辅助" },
  { value: "机械力矩", label: "机械力矩" },
  { value: "机械辅助", label: "机械辅助" },
  { value: "地沟力矩", label: "地沟力矩" },
  { value: "地沟辅助", label: "地沟辅助" },
const rolekey = ref([
  { value: 1, label: "组长" },
  { value: 0, label: "组员" },
]);
const roleOptions = [
  {
    value: "roleName",
    label: "角色名称",
  },
];
const treamOptions = [
  {
    value: "teamName",
    label: "班组名称",
  },
];
const unitOptions = [
  {
    value: "unitName",
    label: "单位名称",
  },
];
const selectoptions = ref([]);
@@ -1016,12 +1469,53 @@
    },
  ],
});
const uploadRef = ref();
const showUpload = ref(false);
const pageTotal = ref(0);
const isMin = ref(false);
const newRole = ref({});
//获取部门
const departmentOptions = ref([]);
const initData = () => {
  // æŸ¥è¯¢æ¡ä»¶
  const startTime = formatTime(queryForm.value.selectTime[0]);
  const endTime = formatTime(queryForm.value.selectTime[1]);
  const filter = [
    {
      name: queryForm.value.selectType,
      value: queryForm.value.selectInput,
      displayType: "like",
    },
    { name: "createDate", value: startTime, displayType: "ThanOrEqual" },
    { name: "createDate", value: endTime, displayType: "LessOrEqual" },
  ];
  GetUserList({
    pageIndex: 1,
    pageSize: 10,
    searchKeyword: "",
    startDate: formatTime(queryForm.value.selectTime[0]),
    endDate: formatTime(queryForm.value.selectTime[1]),
    status: 0,
    sortField: "",
    sortOrder: "",
    account: "",
  }).then((res) => {
    tableData.value = res.data.items.map((item) => {
      return {
        ...item,
        isdisabled:
          userInfo.value.userName == "admin" || userInfo.value.roleId == "1"
            ? item.userName == "admin" || item.user_Id == "1"
            : item.userName == "admin" ||
              item.user_Id == "1" ||
              item.userName != userInfo.value.userName,
      };
    });
    pageTotal.value = res.data.totalCount;
  });
  getDepartment();
};
const getDepartment = () => {
  GetDepartment({
    page: 1,
@@ -1043,40 +1537,6 @@
  }).then((res) => {
    departmentOptions.value = res.rows;
  });
};
//登录记录
const initData = () => {
  // æŸ¥è¯¢æ¡ä»¶
  const startTime = formatTime(queryForm.value.selectTime[0]);
  const endTime = formatTime(queryForm.value.selectTime[1]);
  const filter = [
    {
      name: queryForm.value.selectType,
      value: queryForm.value.selectInput,
      displayType: "like",
    },
    { name: "createDate", value: startTime, displayType: "ThanOrEqual" },
    { name: "createDate", value: endTime, displayType: "LessOrEqual" },
  ];
  GetUserList({
    ...pageQuery.value,
    filter,
  }).then((res) => {
    tableData.value = res.rows.map((item) => {
      return {
        ...item,
        isdisabled:
          userInfo.value.userName == "admin" || userInfo.value.roleId == "1"
            ? item.userName == "admin" || item.user_Id == "1"
            : item.userName == "admin" ||
              item.user_Id == "1" ||
              item.userName != userInfo.value.userName,
      };
    });
    pageTotal.value = res.total;
  });
  getDepartment();
};
//分页请求参数
const pageQuery = ref({
@@ -1138,13 +1598,14 @@
  formUser.value = {
    username: "",
    phoneno: "",
    roleid: 20,
    roleid: null,
    rolename: "",
    enable: 1,
    path: "",
    user_Id: undefined,
    userteam: "",
    carnuber: null,
    isLeader: 0,
  };
  fileList.value = [];
};
@@ -1154,6 +1615,20 @@
  formRole.value = {
    roleName: "",
    description: "",
  };
};
const resetForm2 = (formEl) => {
  if (!formEl) return;
  formEl.resetFields();
  formTeam.value = {
    teamName: "",
  };
};
const resetForm3 = (formEl) => {
  if (!formEl) return;
  formEl.resetFields();
  formUnit.value = {
    unitName: "",
  };
};
@@ -1172,19 +1647,33 @@
const beforeAvatarUpload = (val) => {
  console.log(val);
};
const handleRoleChange = (val) => {
  groupOptions.value.find((item) => {
    if (item.roleId == val) {
      newRole.value = item;
    }
  });
};
//新建用户账号
const saveObj = async (formEl) => {
  // submitUpload();
  if (!formEl) return;
  await formEl.validate((valid, fields) => {
    if (valid) {
      if (formUser.value.id != undefined) {
        // if (!formUser.value.userteam.includes("组")) {
        //   formUser.value.userteam = formUser.value.userteam + "组";
        // }
        formUser.value.isLeader = newRole.value.isLeader;
        UpdateUser(formUser.value).then((res) => {
          ElMessage({ message: "修改成功", type: "success" });
          dialogVisible.value = false;
          initData();
        });
      } else {
        // if (!formUser.value.userteam.includes("组")) {
        //   formUser.value.userteam = formUser.value.userteam + "组";
        // }
        formUser.value.isLeader = newRole.value.isLeader;
        AddUser(formUser.value).then((res) => {
          ElMessage({ message: "提交成功", type: "success" });
          dialogVisible.value = false;
@@ -1234,6 +1723,8 @@
    usertruename: val.userTrueName,
    cardNumber: val.cardNumber,
    userteam: val.userteam,
    userunit: val.unit,
    dept_Id: val.dept_Id,
  };
  UpdateUser(data).then((res) => {
    ElMessage({ message: "修改成功", type: "success" });
@@ -1266,6 +1757,8 @@
    carnuber: val.cardNumber,
    userteam: val.userteam,
    dept_Id: val.dept_Id,
    isLeader: val.isLeader,
    userunit: val.unit,
  };
  formUser.value = {
    ...obj,
@@ -1274,7 +1767,7 @@
    fileList.value = [
      {
        name: "1",
        url: "http://192.168.2.103:9093" + obj.headImageUrl,
        url: "http://192.168.1.103:9093" + obj.headImageUrl,
      },
    ];
  }
@@ -1324,6 +1817,16 @@
    message: "请输入角色描述",
    trigger: "blur",
  },
  teamName: {
    required: true,
    message: "请输入班组名称",
    trigger: "blur",
  },
  unitName: {
    required: true,
    message: "请输入单位名称",
    trigger: "blur",
  },
});
const formRole = ref({
  roleName: "",
@@ -1367,6 +1870,20 @@
  let obj = Object.assign({}, val);
  formRole.value = obj;
  dialogVisible2.value = true;
};
//编辑班组
const EditTream = (val) => {
  Treamtype.value = "修改";
  let obj = Object.assign({}, val);
  formTeam.value = obj;
  TreamdialogVisible.value = true;
};
//编辑单位
const EditUnit = (val) => {
  Unittype.value = "修改";
  let obj = Object.assign({}, val);
  formUnit.value = obj;
  UnitdialogVisible.value = true;
};
//获取角色
const getRole = () => {
@@ -1419,15 +1936,119 @@
    });
  }
};
//获取用户班组
const getGroup = () => {
  const startTime = formatTime(queryForm.value.selectTime[0]);
  const endTime = formatTime(queryForm.value.selectTime[1]);
  const filter = [
    {
      name: queryForm.value.selectType,
      value: queryForm.value.selectInput,
      displayType: "like",
    },
    { name: "createDate", value: startTime, displayType: "ThanOrEqual" },
    { name: "createDate", value: endTime, displayType: "LessOrEqual" },
  ];
  GetUserTeam({ ...pageQuery.value, filter }).then((res) => {
    departmentData.value = res.rows;
    pageTotal.value = res.total;
  });
};
const formTeam = ref({});
const TreamdialogVisible = ref(false);
//新建用户班组
const AddGroup = () => {
  Treamtype.value = "新建";
  TreamdialogVisible.value = true;
};
const Treamtype = ref("新建");
const formTreamdRef = ref(null);
const saveTream = async (formEl) => {
  if (!formEl) return;
  await formEl.validate((valid, fields) => {
    if (valid) {
      if (Treamtype.value == "修改") {
        EditUserTeam(formTeam.value).then((res) => {
          ElMessage({ message: "修改成功", type: "success" });
          TreamdialogVisible.value = false;
          getGroup();
        });
      } else {
        AddUserTeam(formTeam.value).then((res) => {
          ElMessage({ message: "添加成功", type: "success" });
          TreamdialogVisible.value = false;
          getGroup();
        });
      }
    } else {
      console.log("error submit!", fields);
    }
  });
};
const formUnit = ref({});
const UnitdialogVisible = ref(false);
const Unittype = ref("新建");
const formUnitRef = ref(null);
const AddUnit = () => {
  Unittype.value = "新建";
  UnitdialogVisible.value = true;
};
//获取用户单位
const getUnit = () => {
  const startTime = formatTime(queryForm.value.selectTime[0]);
  const endTime = formatTime(queryForm.value.selectTime[1]);
  const filter = [
    {
      name: queryForm.value.selectType,
      value: queryForm.value.selectInput,
      displayType: "like",
    },
    { name: "createDate", value: startTime, displayType: "ThanOrEqual" },
    { name: "createDate", value: endTime, displayType: "LessOrEqual" },
  ];
  GetUserUnit({ ...pageQuery.value, filter }).then((res) => {
    unitData.value = res.rows;
    pageTotal.value = res.total;
  });
};
//保存单位
const saveUnit = async (formEl) => {
  if (!formEl) return;
  await formEl.validate((valid, fields) => {
    if (valid) {
      if (Unittype.value == "修改") {
        EditUserUnit(formUnit.value).then((res) => {
          ElMessage({ message: "修改成功", type: "success" });
          UnitdialogVisible.value = false;
          getUnit();
        });
      } else {
        AddUserUnit(formUnit.value).then((res) => {
          ElMessage({ message: "添加成功", type: "success" });
          UnitdialogVisible.value = false;
          getUnit();
        });
      }
    } else {
      console.log("error submit!", fields);
    }
  });
};
//切换页面
const changeactive = (index) => {
  isactive.value = index;
  if (isactive.value == 1) {
    selectoptions.value = userOptions;
    initData();
  } else {
  } else if (isactive.value == 2) {
    selectoptions.value = roleOptions;
    getRole();
  } else if (isactive.value == 3) {
    selectoptions.value = treamOptions;
    getGroup();
  } else if (isactive.value == 4) {
    selectoptions.value = unitOptions;
    getUnit();
  }
};
@@ -1441,6 +2062,14 @@
const RoleSelectionChange = (val) => {
  ids.value = [];
  ids.value = val.map((item) => item.roleId);
};
const TreamSelectionChange = (val) => {
  ids.value = [];
  ids.value = val.map((item) => item.id);
};
const UnitSelectionChange = (val) => {
  ids.value = [];
  ids.value = val.map((item) => item.id);
};
const deleteAll = () => {
  if (ids.value.includes(1)) {
@@ -1456,22 +2085,37 @@
      ElMessage({ message: "删除成功", type: "success" });
      initData();
    });
  } else {
  } else if (isactive.value == 2) {
    DeleteRoleApi(ids.value).then((res) => {
      ElMessage({ message: "删除成功", type: "success" });
      getRole();
    });
  } else if (isactive.value == 3) {
    DeleteUserTeam(ids.value).then((res) => {
      ElMessage({ message: "删除成功", type: "success" });
      getGroup();
    });
  } else if (isactive.value == 4) {
    DeleteUserUnit(ids.value).then((res) => {
      ElMessage({ message: "删除成功", type: "success" });
      getUnit();
    });
  }
};
//管理
//路由跳转
// ç®¡ç† è·¯ç”±è·³è½¬
const toDetail = (row) => {
  router.push({ name: "permission", state: { info: JSON.stringify(row) } });
};
onMounted(() => {
  if (window.innerWidth <= 1080) {
    isMin.value = true;
  }
  //打印当前屏幕宽度
  initData();
  getRole();
  getUnit();
  getGroup();
  userInfo.value = JSON.parse(localStorage.getItem("user"));
});
</script>
@@ -1486,7 +2130,7 @@
    flex-direction: column;
    .checkbox {
      width: 11rem;
      width: 25rem;
      display: flex;
      justify-content: space-between;
      margin-top: 1rem;
@@ -1618,6 +2262,194 @@
    text-align: center;
  }
}
@media screen and (max-width: 1080px) {
  .Usermanagement {
    display: flex;
    background-color: #fff;
    .content {
      width: 100%;
      display: flex;
      flex-direction: column;
      .checkbox {
        width: 35rem;
        display: flex;
        justify-content: space-between;
        margin-top: 1rem;
        margin-left: 1.31rem;
        .item {
          width: 8rem;
          height: 2.88rem;
          border-radius: 0.25rem;
          background-color: rgba(190, 199, 209, 1);
          color: rgba(255, 255, 255, 1);
          font-size: 1.25rem;
          text-align: center;
          line-height: 2.88rem;
          cursor: pointer;
        }
        .isactive {
          background-color: rgba(16, 16, 16, 1);
          color: rgba(255, 255, 255, 1);
        }
      }
      .serch {
        display: flex;
        margin-top: 1.31rem;
        align-items: center;
        .time_box {
          display: flex;
          align-items: center;
          text-align: center;
          margin-left: 0.98rem;
          .time {
            box-sizing: border-box;
            width: 6.88rem;
            height: 3rem;
            text-align: center;
            border: 0.06rem solid rgba(222, 222, 222, 1);
            border-radius: 0.25rem 0 0 0.25rem;
            font-size: 1.25rem;
            display: flex;
            align-items: center;
            justify-content: center;
          }
          :deep(.el-input__wrapper) {
            height: 3rem !important;
            font-size: 1.25rem !important;
          }
        }
        .serch_box {
          display: flex;
          align-items: center;
          text-align: center;
          margin-left: 0.98rem;
          border-radius: 0.38rem;
          .serchb {
            box-sizing: border-box;
            width: 9rem;
            height: 3rem !important;
            text-align: center;
            font-size: 2rem !important;
            display: flex;
            align-items: center;
            justify-content: center;
            .select {
              height: 3rem !important;
              :deep(.el-select__wrapper) {
                height: 3rem !important;
                font-size: 1.5rem !important;
              }
            }
          }
          input {
            box-sizing: border-box;
            outline: none;
            width: 19rem;
            height: 3rem;
            border: 0.06rem solid rgba(222, 222, 222, 1);
            border-radius: 0 0.25rem 0.25rem 0;
            padding-left: 0.3125rem;
            font-size: 2rem;
          }
        }
        .text_btn {
          width: 10rem !important;
          height: 3.5rem !important;
          font-size: 2rem !important;
          display: flex;
          align-items: center;
        }
      }
      .btns {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-top: 1.31rem;
        margin-left: 1.13rem;
        padding-right: 2rem;
        box-sizing: border-box;
        .text_btn {
          width: 10rem !important;
          height: 3.5rem !important;
          font-size: 2rem !important;
          display: flex;
          align-items: center;
        }
      }
    }
    .formpassword {
      font-size: 1.5rem !important;
    }
    .my-header {
      height: 3.84rem;
      display: flex;
      justify-content: space-between;
      border-bottom: 0.06rem solid rgba(233, 233, 233, 1);
    }
    .avatar-uploader .avatar {
      width: 7rem;
      height: 7rem;
      display: block;
    }
    :deep(.avatar-uploader .el-upload) {
      width: 7rem;
      height: 7rem;
      border: 0.0625rem dashed var(--el-border-color);
      border-radius: 0.0375rem;
      cursor: pointer;
      position: relative;
      overflow: hidden;
      transition: var(--el-transition-duration-fast);
    }
    :deep(.el-upload-list__item) {
      width: 7rem;
      height: 7rem;
    }
    .avatar-uploader .el-upload:hover {
      border-color: var(--el-color-primary);
    }
    .el-icon .avatar-uploader-icon {
      font-size: 0.5rem;
      color: #8c939d;
      width: 0.81rem;
      height: 0.81rem;
      text-align: center;
    }
    .font-title {
      font-size: 2rem !important;
    }
    .from_title {
      font-size: 2rem !important;
    }
    .el-form-item__content {
      .el-input {
        height: 3rem !important;
        font-size: 2rem !important;
      }
      .el-select--small :deep(.el-select__wrapper) {
        font-size: 2rem;
        line-height: 3rem;
        min-height: 3rem;
      }
    }
  }
}
</style>
<style>
.confirmButtonClass {