su
su1124
2023-09-13 ba6e43f9c2b2c4724b961e584de89546b4b21f32
src/views/system/user/index.vue
@@ -650,6 +650,27 @@
        <el-button @click="upload.open = false">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 重置密码对话框 -->
    <el-dialog
      title="提示"
      :visible.sync="dialogVisible1"
      width="30%"
      :before-close="handleClose">
      <el-form>
        <span>请输入“{{row.userName}}”的新密码</span>
        <el-form-item>
          <el-input v-model="password" :type="type" auto-complete="off" placeholder="密码" ref="barcodeMsg">
            <svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
            <i slot="suffix" class="icon-style" :class="elIcon" autocomplete="auto" @click="flag = !flag" /></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="tijiao">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>
@@ -694,6 +715,10 @@
  components: { Treeselect },
  data() {
    return {
      row:[],
      flag: false,
      password:"",
      dialogVisible1:false,
      nums: "",
      userInfoList: [],
      hospList: [],
@@ -840,6 +865,14 @@
    deptName(val) {
      this.$refs.tree.filter(val);
    },
  },
  computed: {
    type() {
      return this.flag ? "text" : "password";
    },
    elIcon() {
      return this.flag ? "el-icon-minus" : "el-icon-view";
    }
  },
  created() {
    this.getList();
@@ -1073,19 +1106,37 @@
    },
    /** 重置密码按钮操作 */
    handleResetPwd(row) {
      this.$prompt('请输入"' + row.userName + '"的新密码', "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        closeOnClickModal: false,
        inputPattern: /^.{5,20}$/,
        inputErrorMessage: "用户密码长度必须介于 5 和 20 之间",
      console.log(row);
      this.dialogVisible1 = true;
      this.row = row;
      // this.$prompt('请输入"' + row.userName + '"的新密码', "提示", {
      //   confirmButtonText: "确定",
      //   cancelButtonText: "取消",
      //   closeOnClickModal: false,
      //   inputPattern: /^.{5,20}$/,
      //   inputErrorMessage: "用户密码长度必须介于 5 和 20 之间",
      //   inputType:'password'
      // })
      //   .then(({ value }) => {
      //     resetUserPwd(row.userId, value).then((response) => {
      //       this.$modal.msgSuccess("修改成功");
      //       // ,新密码是:" + value
      //     });
      //   })
      //   .catch(() => { });
    },
    tijiao(){
      let data = {
        password:this.password,
        userId:this.row.userId,
      }
      resetUserPwd(data).then(res=>{
        console.log(res);
        if(res.code == 200){
          this.$modal.msgSuccess("修改成功");
          this.dialogVisible1 = false;
        }
      })
        .then(({ value }) => {
          resetUserPwd(row.userId, value).then((response) => {
            this.$modal.msgSuccess("修改成功,新密码是:" + value);
          });
        })
        .catch(() => { });
    },
    /** 分配角色操作 */
    handleAuthRole: function (row) {