| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333 | <template>  <div class="app-container">    <el-form :model="queryParams" ref="queryForm" :inline="true" size="small" label-width="100px">      <template v-if="roleType == 'gov'">        <el-form-item label="市" prop="cityId" v-if="userType == 'GOV_PROV'">          <el-select v-model="queryParams.cityId" placeholder="请选择市" @change="getDistrictData" filterable style="width: 200px;">            <el-option v-for="(item, index) in cityDataList" :key="index" :label="item.name" :value="item.id"></el-option>          </el-select>        </el-form-item>        <el-form-item label="区" prop="districtId" v-if="userType == 'GOV_PROV' || userType == 'GOV_CITY'">          <el-select v-model="queryParams.districtId" placeholder="请选择区" filterable style="width: 200px;">            <el-option v-for="(item, index) in districtDataList" :key="index" :label="item.name" :value="item.id"></el-option>          </el-select>        </el-form-item>      </template>      <template v-else>        <el-form-item label="省" prop="provinceId">          <el-select v-model="queryParams.provinceId" placeholder="请选择省" @change="getCityData" filterable style="width: 200px;">            <el-option v-for="(item,index) in provinceDataList" :key="index" :label="item.name" :value="item.id"></el-option>          </el-select>        </el-form-item>        <el-form-item label="市" prop="cityId">          <el-select v-model="queryParams.cityId" placeholder="请选择市" @change="getDistrictData" filterable style="width: 200px;">            <el-option v-for="(item, index) in cityDataList" :key="index" :label="item.name" :value="item.id"></el-option>          </el-select>        </el-form-item>        <el-form-item label="区" prop="districtId">          <el-select v-model="queryParams.districtId" placeholder="请选择区" filterable style="width: 200px;">            <el-option v-for="(item, index) in districtDataList" :key="index" :label="item.name" :value="item.id"></el-option>          </el-select>        </el-form-item>      </template>      <el-form-item label="企业名称" prop="entName">        <el-input v-model="queryParams.entName" clearable style="width: 200px;" placeholder="请输入企业名称"></el-input>      </el-form-item>      <el-form-item label="社会信用代码" prop="license">        <el-input v-model="queryParams.license" style="width: 200px;" placeholder="请输入社会信用代码"></el-input>      </el-form-item>      <el-form-item label="服务状态" prop="entState">        <el-select v-model="queryParams.entState" style="width: 200px;" placeholder="请选择">          <el-option v-for="(item, index) in entStateOptions" :key="index" :label="item.dictLabel" :value="item.dictValue"></el-option>        </el-select>      </el-form-item>      <el-form-item>        <el-button type="primary" @click="handleQuery">搜索</el-button>        <el-button @click="resetQuery">重置</el-button>      </el-form-item>    </el-form>    <h3 class="toolbar">      <span class="title">列表</span>      <div class="tool">        <el-button          type="primary"          plain          icon="el-icon-plus"          size="mini"          @click="handleAdd" v-if="roleType =='manager'">新增企业</el-button>      </div>    </h3>    <el-table v-loading="loading" :data="list" border>      <el-table-column label="账户" prop="userName" width="120" align="center" />      <el-table-column label="企业名称" prop="entName" align="center" width="120"></el-table-column>      <el-table-column label="省" prop="provinceName" align="center" width="120"/>      <el-table-column label="市" prop="cityName" align="center" width="120" />      <el-table-column label="区" prop="districtName" align="center" width="120" />      <el-table-column label="社会信用代码" prop="license" align="center" width="160"></el-table-column>      <el-table-column label="联系人" align="center" prop="linkName" width="150"></el-table-column>      <el-table-column label="联系人手机号" prop="linkMobile" align="center" width="160"></el-table-column>      <el-table-column label="联系人邮箱" prop="linkEmail" align="center" width="180"></el-table-column>      <el-table-column label="创建时间" prop="createTime" align="center" width="160"></el-table-column>      <el-table-column label="服务时间" align="center" width="180">        <template slot-scope="scope">          <template v-if="scope.row.entState == '1'">            <span>--</span>          </template>          <template v-else-if="scope.row.entState == '2'">            <span>{{scope.row.startDate}}-{{scope.row.endDate}}</span>          </template>          <template v-else>            <span>已到期</span>          </template>        </template>      </el-table-column>      <el-table-column label="服务状态" prop="entState" align="center" width="120" :formatter="entSateFormat"></el-table-column>      <el-table-column label="审核状态" prop="authState" align="center" width="120" :formatter="authStateFormat"></el-table-column>      <el-table-column label="操作" align="center" width="180" class-name="small-padding fixed-width">        <template slot-scope="scope">          <el-button type="text" @click="handleView(scope.row)">查看</el-button>          <!-- 只有科德管理员才可以有以下操作 -->          <template v-if="roleType =='manager'">            <el-button type="text" @click="handleRePwd(scope.row)">重置密码</el-button>            <el-button type="text" @click="handleAudit(scope.row)" v-if="scope.row.authState == '1'">审核</el-button>            <!-- 只有审核通过 authState才可以修改 -->            <el-button type="text" @click="handleUpdate(scope.row)" v-if="scope.row.authState == '2'">修改</el-button>            <!-- 只有服务中且审核状态为已通过才可以停用 -->            <el-button type="text" @click="handleStop(scope.row)" v-if="scope.row.entState == '2' || scope.row.authState == '2'">停用</el-button>            <!-- 只有服务状态为已到期才可以提醒 -->            <el-button type="text" @click="handleRemind(scope.row)" v-if="scope.row.entState == '3'">提醒</el-button>            <!-- 审核状态为已驳回不可以删除 -->            <el-button type="text" @click="handleDelete(scope.row)" v-if="scope.row.authState != '3'">删除</el-button>          </template>        </template>      </el-table-column>    </el-table>    <pagination      v-show="total>0"      :total="total"      :page.sync="queryParams.pageNum"      :limit.sync="queryParams.pageSize"      @pagination="getList"    />  </div></template><!-- 企业管理模块只有科德管理员和税务人员 --><script>  import {getProvinceDataApi,getRegionChildrenApi} from "@/api/common/common"  import {listEntApi, deleteEntApi, resetPwdApi, remindUserApi, stopEntUserApi} from '@/api/admin/ent/ent'  import {entStateOptions, getLabel, authStateOptions} from '@/utils/dataFormat'  import {listEntTaxApi} from '@/api/gov/gov'  export default {    data () {      return {        loading: false,        provinceDataList: [],        cityDataList: [],        districtDataList: [],        entStateOptions: entStateOptions,        authStateOptions: authStateOptions,        dateRange: [],        roleType: '',        queryParams: {          pageNum: 1,          pageSize: 10,          provinceId: undefined,          cityId: undefined,          districtId: undefined,          entName: '',          license: '',          entState: ''        },        list: [],        total: 0,        open: false,        openInfo: false,      }    },    created() {      this.roleType = this.roles.join(',')      this.getList()      if(this.userType == 'GOV_PROV' || this.userType == 'GOV_CITY') {        this.getAreaData()      }      if(this.roleType != 'gov') {        this.getProvinceData()      }    },    computed: {      roles() {        return this.$store.state.user.roles      },      scopeId() {        return this.$store.state.user.scopeId      },      userType() {        return this.$store.state.user.userType      }    },    methods: {      getAreaData() {        getRegionChildrenApi(this.scopeId).then(res => {          if(res.code == 200) {            if(this.userType == 'GOV_PROV') {              this.cityDataList = res.data            }else if(this.userType == 'GOV_CITY') {              this.districtDataList = res.data            }          }        })      },      //选择省份      getCityData() {        this.queryParams.cityId = ''        this.queryParams.districtId = ''        getRegionChildrenApi(this.queryParams.provinceId).then(res => {          if(res.code == 200) {            this.cityDataList = res.data          }        })      },      //选择市      getDistrictData() {        this.queryParams.districtId = ''        getRegionChildrenApi(this.queryParams.cityId).then(res => {          if(res.code == 200) {            this.districtDataList = res.data          }        })      },      getProvinceData() {        getProvinceDataApi().then(res => {          if(res.code == 200) {            this.provinceDataList = res.data          }        })      },      //列表数据区分科德管理员还是税务人员      getList() {        this.loading = true;        if(this.roleType == 'manager') {          listEntApi(this.queryParams).then(response => {            this.list = response.data.records;            this.total = response.data.total;            this.loading = false;          });        }else if(this.roleType == 'gov') {          listEntTaxApi(this.queryParams).then(response => {            this.list = response.data.records;            this.total = response.data.total;            this.loading = false;          });        }      },      handleAdd() {        this.$router.push("/ent/add"+'?type=add')      },      handleUpdate(row) {        this.$router.push("/ent/edit/"+row.id+'?type=update')      },      // 审核      handleAudit(row) {        this.$router.push("/ent/info/"+row.id+'?type=audit')      },      // 查看      handleView(row) {        this.$router.push("/ent/info/"+row.id+'?type=view')      },      //重置密码      handleRePwd(row) {        this.$confirm('是否确认重置密码?', "警告", {            confirmButtonText: "确定",            cancelButtonText: "取消",            type: "warning"          }).then(function() {            return resetPwdApi(row.id);          }).then(() => {            this.queryParams.pageNum = 1;            this.getList();            this.$message({              message: '密码重置成功',              type: 'success'            });          })      },      handleRemind(row) {        this.$confirm('是否确认提醒用户服务时间到期?', "警告", {            confirmButtonText: "确定",            cancelButtonText: "取消",            type: "warning"          }).then(function() {            return remindUserApi(row.id);          }).then(() => {            this.queryParams.pageNum = 1;            this.getList();            this.$message({              message: '提醒成功',              type: 'success'            });          })      },      handleStop(row) {        this.$confirm('是否确认停用该企业账号?', "警告", {            confirmButtonText: "确定",            cancelButtonText: "取消",            type: "warning"          }).then(function() {            return stopEntUserApi(row.id);          }).then(() => {            this.queryParams.pageNum = 1;            this.getList();            this.$message({              message: '停用成功',              type: 'success'            });          })      },      handleDelete(row) {        const id = row.id;        this.$confirm('是否确认删除该数据?', "警告", {            confirmButtonText: "确定",            cancelButtonText: "取消",            type: "warning"          }).then(function() {            return deleteEntApi(id);          }).then(() => {            this.queryParams.pageNum = 1;            this.getList();            this.$message({              message: '删除成功',              type: 'success'            });          })      },      // 重置      resetQuery() {        this.dateRange = [];        this.resetForm("queryForm");        this.handleQuery();      },      // 搜索      handleQuery() {        this.queryParams.pageNum = 1;        this.getList();      },      statusFormat(row, col, val, index) {        return getLabel(accessStatus, val)      },      entSateFormat(row, col, val, index) {        return getLabel(entStateOptions, val)      },      authStateFormat(row, col, val, index) {        return getLabel(authStateOptions, val)      }    }  }</script><style></style>
 |