index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" size="small" label-width="100px">
  4. <template v-if="roleType == 'gov'">
  5. <el-form-item label="市" prop="cityId" v-if="userType == 'GOV_PROV'">
  6. <el-select v-model="queryParams.cityId" placeholder="请选择市" @change="getDistrictData" filterable style="width: 200px;">
  7. <el-option v-for="(item, index) in cityDataList" :key="index" :label="item.name" :value="item.id"></el-option>
  8. </el-select>
  9. </el-form-item>
  10. <el-form-item label="区" prop="districtId" v-if="userType == 'GOV_PROV' || userType == 'GOV_CITY'">
  11. <el-select v-model="queryParams.districtId" placeholder="请选择区" filterable style="width: 200px;">
  12. <el-option v-for="(item, index) in districtDataList" :key="index" :label="item.name" :value="item.id"></el-option>
  13. </el-select>
  14. </el-form-item>
  15. </template>
  16. <template v-else>
  17. <el-form-item label="省" prop="provinceId">
  18. <el-select v-model="queryParams.provinceId" placeholder="请选择省" @change="getCityData" filterable style="width: 200px;">
  19. <el-option v-for="(item,index) in provinceDataList" :key="index" :label="item.name" :value="item.id"></el-option>
  20. </el-select>
  21. </el-form-item>
  22. <el-form-item label="市" prop="cityId">
  23. <el-select v-model="queryParams.cityId" placeholder="请选择市" @change="getDistrictData" filterable style="width: 200px;">
  24. <el-option v-for="(item, index) in cityDataList" :key="index" :label="item.name" :value="item.id"></el-option>
  25. </el-select>
  26. </el-form-item>
  27. <el-form-item label="区" prop="districtId">
  28. <el-select v-model="queryParams.districtId" placeholder="请选择区" filterable style="width: 200px;">
  29. <el-option v-for="(item, index) in districtDataList" :key="index" :label="item.name" :value="item.id"></el-option>
  30. </el-select>
  31. </el-form-item>
  32. </template>
  33. <el-form-item label="企业名称" prop="entName">
  34. <el-input v-model="queryParams.entName" clearable style="width: 200px;" placeholder="请输入企业名称"></el-input>
  35. </el-form-item>
  36. <el-form-item label="社会信用代码" prop="license">
  37. <el-input v-model="queryParams.license" style="width: 200px;" placeholder="请输入社会信用代码"></el-input>
  38. </el-form-item>
  39. <el-form-item label="服务状态" prop="entState">
  40. <el-select v-model="queryParams.entState" style="width: 200px;" placeholder="请选择">
  41. <el-option v-for="(item, index) in entStateOptions" :key="index" :label="item.dictLabel" :value="item.dictValue"></el-option>
  42. </el-select>
  43. </el-form-item>
  44. <el-form-item>
  45. <el-button type="primary" @click="handleQuery">搜索</el-button>
  46. <el-button @click="resetQuery">重置</el-button>
  47. </el-form-item>
  48. </el-form>
  49. <h3 class="toolbar">
  50. <span class="title">列表</span>
  51. <div class="tool">
  52. <el-button
  53. type="primary"
  54. plain
  55. icon="el-icon-plus"
  56. size="mini"
  57. @click="handleAdd" v-if="roleType =='manager'">新增企业</el-button>
  58. </div>
  59. </h3>
  60. <el-table v-loading="loading" :data="list" border>
  61. <el-table-column label="账户" prop="userName" width="120" align="center" />
  62. <el-table-column label="企业名称" prop="entName" align="center" width="120"></el-table-column>
  63. <el-table-column label="省" prop="provinceName" align="center" width="120"/>
  64. <el-table-column label="市" prop="cityName" align="center" width="120" />
  65. <el-table-column label="区" prop="districtName" align="center" width="120" />
  66. <el-table-column label="社会信用代码" prop="license" align="center" width="160"></el-table-column>
  67. <el-table-column label="联系人" align="center" prop="linkName" width="150"></el-table-column>
  68. <el-table-column label="联系人手机号" prop="linkMobile" align="center" width="160"></el-table-column>
  69. <el-table-column label="联系人邮箱" prop="linkEmail" align="center" width="180"></el-table-column>
  70. <el-table-column label="创建时间" prop="createTime" align="center" width="160"></el-table-column>
  71. <el-table-column label="服务时间" align="center" width="180">
  72. <template slot-scope="scope">
  73. <template v-if="scope.row.entState == '1'">
  74. <span>--</span>
  75. </template>
  76. <template v-else-if="scope.row.entState == '2'">
  77. <span>{{scope.row.startDate}}-{{scope.row.endDate}}</span>
  78. </template>
  79. <template v-else>
  80. <span>已到期</span>
  81. </template>
  82. </template>
  83. </el-table-column>
  84. <el-table-column label="服务状态" prop="entState" align="center" width="120" :formatter="entSateFormat"></el-table-column>
  85. <el-table-column label="审核状态" prop="authState" align="center" width="120" :formatter="authStateFormat"></el-table-column>
  86. <el-table-column label="操作" align="center" width="180" class-name="small-padding fixed-width">
  87. <template slot-scope="scope">
  88. <el-button type="text" @click="handleView(scope.row)">查看</el-button>
  89. <!-- 只有科德管理员才可以有以下操作 -->
  90. <template v-if="roleType =='manager'">
  91. <el-button type="text" @click="handleRePwd(scope.row)">重置密码</el-button>
  92. <el-button type="text" @click="handleAudit(scope.row)" v-if="scope.row.authState == '1'">审核</el-button>
  93. <!-- 只有审核通过 authState才可以修改 -->
  94. <el-button type="text" @click="handleUpdate(scope.row)" v-if="scope.row.authState == '2'">修改</el-button>
  95. <!-- 只有服务中且审核状态为已通过才可以停用 -->
  96. <el-button type="text" @click="handleStop(scope.row)" v-if="scope.row.entState == '2' || scope.row.authState == '2'">停用</el-button>
  97. <!-- 只有服务状态为已到期才可以提醒 -->
  98. <el-button type="text" @click="handleRemind(scope.row)" v-if="scope.row.entState == '3'">提醒</el-button>
  99. <!-- 审核状态为已驳回不可以删除 -->
  100. <el-button type="text" @click="handleDelete(scope.row)" v-if="scope.row.authState != '3'">删除</el-button>
  101. </template>
  102. </template>
  103. </el-table-column>
  104. </el-table>
  105. <pagination
  106. v-show="total>0"
  107. :total="total"
  108. :page.sync="queryParams.pageNum"
  109. :limit.sync="queryParams.pageSize"
  110. @pagination="getList"
  111. />
  112. </div>
  113. </template>
  114. <!-- 企业管理模块只有科德管理员和税务人员 -->
  115. <script>
  116. import {getProvinceDataApi,getRegionChildrenApi} from "@/api/common/common"
  117. import {listEntApi, deleteEntApi, resetPwdApi, remindUserApi, stopEntUserApi} from '@/api/admin/ent/ent'
  118. import {entStateOptions, getLabel, authStateOptions} from '@/utils/dataFormat'
  119. import {listEntTaxApi} from '@/api/gov/gov'
  120. export default {
  121. data () {
  122. return {
  123. loading: false,
  124. provinceDataList: [],
  125. cityDataList: [],
  126. districtDataList: [],
  127. entStateOptions: entStateOptions,
  128. authStateOptions: authStateOptions,
  129. dateRange: [],
  130. roleType: '',
  131. queryParams: {
  132. pageNum: 1,
  133. pageSize: 10,
  134. provinceId: undefined,
  135. cityId: undefined,
  136. districtId: undefined,
  137. entName: '',
  138. license: '',
  139. entState: ''
  140. },
  141. list: [],
  142. total: 0,
  143. open: false,
  144. openInfo: false,
  145. }
  146. },
  147. created() {
  148. this.roleType = this.roles.join(',')
  149. this.getList()
  150. if(this.userType == 'GOV_PROV' || this.userType == 'GOV_CITY') {
  151. this.getAreaData()
  152. }
  153. if(this.roleType != 'gov') {
  154. this.getProvinceData()
  155. }
  156. },
  157. computed: {
  158. roles() {
  159. return this.$store.state.user.roles
  160. },
  161. scopeId() {
  162. return this.$store.state.user.scopeId
  163. },
  164. userType() {
  165. return this.$store.state.user.userType
  166. }
  167. },
  168. methods: {
  169. getAreaData() {
  170. getRegionChildrenApi(this.scopeId).then(res => {
  171. if(res.code == 200) {
  172. if(this.userType == 'GOV_PROV') {
  173. this.cityDataList = res.data
  174. }else if(this.userType == 'GOV_CITY') {
  175. this.districtDataList = res.data
  176. }
  177. }
  178. })
  179. },
  180. //选择省份
  181. getCityData() {
  182. this.queryParams.cityId = ''
  183. this.queryParams.districtId = ''
  184. getRegionChildrenApi(this.queryParams.provinceId).then(res => {
  185. if(res.code == 200) {
  186. this.cityDataList = res.data
  187. }
  188. })
  189. },
  190. //选择市
  191. getDistrictData() {
  192. this.queryParams.districtId = ''
  193. getRegionChildrenApi(this.queryParams.cityId).then(res => {
  194. if(res.code == 200) {
  195. this.districtDataList = res.data
  196. }
  197. })
  198. },
  199. getProvinceData() {
  200. getProvinceDataApi().then(res => {
  201. if(res.code == 200) {
  202. this.provinceDataList = res.data
  203. }
  204. })
  205. },
  206. //列表数据区分科德管理员还是税务人员
  207. getList() {
  208. this.loading = true;
  209. if(this.roleType == 'manager') {
  210. listEntApi(this.queryParams).then(response => {
  211. this.list = response.data.records;
  212. this.total = response.data.total;
  213. this.loading = false;
  214. });
  215. }else if(this.roleType == 'gov') {
  216. listEntTaxApi(this.queryParams).then(response => {
  217. this.list = response.data.records;
  218. this.total = response.data.total;
  219. this.loading = false;
  220. });
  221. }
  222. },
  223. handleAdd() {
  224. this.$router.push("/ent/add"+'?type=add')
  225. },
  226. handleUpdate(row) {
  227. this.$router.push("/ent/edit/"+row.id+'?type=update')
  228. },
  229. // 审核
  230. handleAudit(row) {
  231. this.$router.push("/ent/info/"+row.id+'?type=audit')
  232. },
  233. // 查看
  234. handleView(row) {
  235. this.$router.push("/ent/info/"+row.id+'?type=view')
  236. },
  237. //重置密码
  238. handleRePwd(row) {
  239. this.$confirm('是否确认重置密码?', "警告", {
  240. confirmButtonText: "确定",
  241. cancelButtonText: "取消",
  242. type: "warning"
  243. }).then(function() {
  244. return resetPwdApi(row.id);
  245. }).then(() => {
  246. this.queryParams.pageNum = 1;
  247. this.getList();
  248. this.$message({
  249. message: '密码重置成功',
  250. type: 'success'
  251. });
  252. })
  253. },
  254. handleRemind(row) {
  255. this.$confirm('是否确认提醒用户服务时间到期?', "警告", {
  256. confirmButtonText: "确定",
  257. cancelButtonText: "取消",
  258. type: "warning"
  259. }).then(function() {
  260. return remindUserApi(row.id);
  261. }).then(() => {
  262. this.queryParams.pageNum = 1;
  263. this.getList();
  264. this.$message({
  265. message: '提醒成功',
  266. type: 'success'
  267. });
  268. })
  269. },
  270. handleStop(row) {
  271. this.$confirm('是否确认停用该企业账号?', "警告", {
  272. confirmButtonText: "确定",
  273. cancelButtonText: "取消",
  274. type: "warning"
  275. }).then(function() {
  276. return stopEntUserApi(row.id);
  277. }).then(() => {
  278. this.queryParams.pageNum = 1;
  279. this.getList();
  280. this.$message({
  281. message: '停用成功',
  282. type: 'success'
  283. });
  284. })
  285. },
  286. handleDelete(row) {
  287. const id = row.id;
  288. this.$confirm('是否确认删除该数据?', "警告", {
  289. confirmButtonText: "确定",
  290. cancelButtonText: "取消",
  291. type: "warning"
  292. }).then(function() {
  293. return deleteEntApi(id);
  294. }).then(() => {
  295. this.queryParams.pageNum = 1;
  296. this.getList();
  297. this.$message({
  298. message: '删除成功',
  299. type: 'success'
  300. });
  301. })
  302. },
  303. // 重置
  304. resetQuery() {
  305. this.dateRange = [];
  306. this.resetForm("queryForm");
  307. this.handleQuery();
  308. },
  309. // 搜索
  310. handleQuery() {
  311. this.queryParams.pageNum = 1;
  312. this.getList();
  313. },
  314. statusFormat(row, col, val, index) {
  315. return getLabel(accessStatus, val)
  316. },
  317. entSateFormat(row, col, val, index) {
  318. return getLabel(entStateOptions, val)
  319. },
  320. authStateFormat(row, col, val, index) {
  321. return getLabel(authStateOptions, val)
  322. }
  323. }
  324. }
  325. </script>
  326. <style>
  327. </style>