EnterprisesMg.vue 7.97 KB
Newer Older
yaqizhang's avatar
yaqizhang committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246
<template>
  <div class="EnseList">
    <el-row class="topBar">
      <el-col>
        <el-form :inline="true" :model="searchData">
          <el-form-item>
            <el-input v-model="searchData.unitName" placeholder="请输入企业名称"></el-input>
          </el-form-item>
          <el-form-item>
            <el-input v-model="searchData.userName" placeholder="请输入用户名"></el-input>
          </el-form-item>
          <el-form-item>
            <el-input v-model="searchData.orgCode" placeholder="请输入统一社会信用代码"></el-input>
          </el-form-item>
          <!-- <el-form-item>
            <City @changeFun="changeFun" :valueqv="cityval"></City>
          </el-form-item> -->
          <el-form-item>
            <el-button type="primary" @click="searchFun()">
              <i class="el-icon-search"></i> 搜索
            </el-button>
            <el-button type="primary" @click="resetFun()">
              <i class="el-icon-refresh"></i> 重置
            </el-button>
          </el-form-item>
        </el-form>
      </el-col>
    </el-row>
    <el-table :data="tableData.pageData" stripe border style="width:100%;" :loading="loading">
      <el-table-column width="50" type="index" label="序号"></el-table-column>
      <el-table-column prop="unitName" label="企业名称"></el-table-column>
      <el-table-column width="100" prop="legalPerson" label="企业法人"></el-table-column>
      <el-table-column prop="orgCode" label="统一社会信用代码"></el-table-column>
      <el-table-column prop="legalPersonEmail" label="法人邮箱"></el-table-column>
      <el-table-column prop="userName" label="管理员名称"></el-table-column>
      <el-table-column prop="account" label="管理员账号"></el-table-column>
      <el-table-column width="120" prop="status" label="账号状态">
        <template slot-scope="scope">
          <font v-if="scope.row.accountStatus === '0'" class="colorM">
            <i class="iconfont iconzhengchang"></i> 正常
          </font>
          <font v-else-if="scope.row.accountStatus == 2" class="colorP">
            <i class="iconfont iconsuoding"></i> 已锁定
          </font>
          <font v-else-if="scope.row.accountStatus == 1" class="colorR">
            <i class="iconfont iconicon_huabanfuben"></i> 已删除
          </font>
          <font v-else-if="scope.row.accountStatus == 3" class="colorP">
            <i class="iconfont iconshenhe"></i> 审核中
          </font>
          <font v-else-if="scope.row.accountStatus == 4" class="colorR">
            <i class="iconfont iconweitongguo"></i> 审核未通过
          </font>
        </template>
      </el-table-column>
      <el-table-column label="操作" width="240" align="center">
        <template slot-scope="scope">
          <!-- <el-button type="success" size="small" @click="verrifyFun(scope.row)">
            <i class="el-icon-key"></i>审核/查看
          </el-button> -->
          <el-button type="warning" size="small" @click="resetPw(scope.row)" v-if="scope.row.accountStatus === '0'">
            <i class="el-icon-star-off"></i>重置密码
          </el-button>
          <el-button type="danger" size="small" @click="setLock(scope.row)" v-if="scope.row.accountStatus === '0'">
            <i class="el-icon-lock"></i>注销
          </el-button>
		  <el-button type="success" size="small" @click="setEnable(scope.row)" v-if="scope.row.accountStatus === '2'">
		    <i class="el-icon-unlock"></i>启用
		  </el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      background
      layout="total,sizes, prev, pager, next, jumper"
      :total="tableData.total"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="PAGE.page"
      :page-size="PAGE.size"
    ></el-pagination>
    <EnterprisesMgEdit
      v-if="dialogVisible"
      :dialogVisible="dialogVisible"
      :editFormA="formData"
      @dialogFun="closeDialog"
      @refreshTableData="getTableData"
      :key="zjKey"
    ></EnterprisesMgEdit>
  </div>
</template>
<script lang="ts">
import { Component, Vue, Provide } from "vue-property-decorator";
import EnterprisesMgEdit from "./EnterprisesMgEdit.vue";
import City from "@/components/city.vue";
import METHOD from "@/utils/methods";
@Component({
  components: { EnterprisesMgEdit, City }
})
export default class EnterprisesMg extends Vue {
  @Provide() tableData: Object = { pageData: [], total: 0 };
  @Provide() PAGE: any = { page: 1, size: 10 };
  @Provide() searchData: any = {};
  @Provide() loading: Boolean = false;
  @Provide() cityval: any = [];
  //编辑组件
  @Provide() dialogVisible: Boolean = false;
  @Provide() formData: any = { dataType: "", enterpriseId: "" };
  @Provide() zjKey: any = 0;

  getTableData() {
    let that = this,
      param = Object.assign({}, that.PAGE, that.searchData);
    that.loading = true;
    METHOD.axiosPost(
      that,
      `/enterpriseInfo/queryEnterpriseInfo`,
      param,
      function(res: any) {
        that.loading = false;
        if (res.code == 0) {
          that.tableData = res.data;
        }
      }
    );
  }
  searchFun() {
    this.PAGE = { page: 1, size: 10 };
    this.getTableData();
  }
  resetFun() {
    this.PAGE = { page: 1, size: 10 };
    this.searchData = { unitName: "" };
    this.getTableData();
    this.cityval = [];
  }
  handleSizeChange(val: any) {
    this.PAGE.size = val;
    this.getTableData();
  }
  handleCurrentChange(val: any) {
    this.PAGE.page = val;
    this.getTableData();
  }
  closeDialog() {
    //关闭窗口
    this.dialogVisible = false;
    this.formData = {};
  }
  selectChange(val: any) {
    this.searchData.dataType = val;
    this.getTableData();
  }
  verrifyFun(row: any) {
    this.formData = Object.assign({}, row);
    this.zjKey++;
    this.dialogVisible = true;
  }
  setLock(row: any) {
    let that = this;
    that
      .$confirm(`确定锁定企业 ${row.unitName} 吗?`, "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
      .then(() => {
        METHOD.axiosPost(
          that,
          `/enterpriseInfo/cancelEnterpriseInfoById/${row.enterpriseId}`,
          { remarks: "" },
          function(res: any) {
            if (res.code == 0) {
              (that as any).$message({
                type: "success",
                message: "注销成功!"
              });
              that.getTableData();
            }
          }
        );
      });
  }
  setEnable(row: any){
    let that = this;
    that.$confirm(`确定启用企业 ${row.unitName} 吗?`, "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
    })
    .then(() => {
      METHOD.axiosGet(
        that,
        `/enterpriseInfo/enableEnterpriseInfoById/${row.enterpriseId}`,
        function(res: any) {
          if (res.code == 0) {
            (that as any).$message({
              type: "success",
              message: "启用成功!"
            });
            that.getTableData();
          }
        }
      );
    });
  }
  /*选择城市*/
  changeFun(v: any) {
    this.searchData.provinceId = v[0];
    this.searchData.cityId = v[1];
    this.searchData.countyId = v[2];
  }
  resetPw(row: any) {
    let that = this;
    (that as any)
      .$confirm("确定重置用户 "+ row.userName +" 的密码 为 66668888 吗?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
      .then(() => {
        METHOD.axiosGet(that, `/user/resetUserPwd/${row.userId}`, function(
          res: any
        ) {
          if (res.code == 0) {
            (that as any).$message({
              type: "success",
              message: "重置成功!"
            });
          }
        });
      });
  }
  created() {
    this.getTableData();
  }
}
</script>
<style lang="scss" scoped>
@import "@/utils/public.scss";
@media screen and (max-width: 1350px) {
  main > div .el-table {
    height: calc(100% - 180px);
  }
}
</style>