index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" size="small">
  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 label="审核状态" prop="authState">
  45. <el-select v-model="queryParams.authState" style="width: 200px;" placeholder="请选择">
  46. <el-option v-for="(item, index) in authStateEntOptions" :key="index" :label="item.dictLabel" :value="item.dictValue"></el-option>
  47. </el-select>
  48. </el-form-item>
  49. <el-form-item>
  50. <el-button type="primary" @click="handleQuery">搜索</el-button>
  51. <el-button @click="resetQuery">重置</el-button>
  52. </el-form-item>
  53. </el-form>
  54. <h3 class="toolbar">
  55. <span class="title">列表</span>
  56. <div class="tool">
  57. <el-button
  58. type="primary"
  59. plain
  60. icon="el-icon-plus"
  61. size="mini"
  62. @click="handleAdd" v-if="roleType =='manager'">新增企业</el-button>
  63. </div>
  64. </h3>
  65. <el-table v-loading="loading" :data="list" border>
  66. <el-table-column label="账户" prop="userName" width="240" align="center" />
  67. <el-table-column label="企业名称" prop="entName" align="center" width="240"></el-table-column>
  68. <el-table-column label="省市区" prop="provinceName" align="center" width="240">
  69. <template slot-scope="scope">
  70. <span>{{scope.row.provinceName}}{{scope.row.cityName}}{{scope.row.districtName}}</span>
  71. </template>
  72. </el-table-column>
  73. <!-- <el-table-column label="社会信用代码" prop="license" align="center" width="240"></el-table-column> -->
  74. <el-table-column label="联系人" align="center" prop="linkName" width="240"></el-table-column>
  75. <el-table-column label="联系人手机号" prop="linkMobile" align="center" width="240"></el-table-column>
  76. <!-- <el-table-column label="联系人邮箱" prop="linkEmail" align="center" width="240"></el-table-column> -->
  77. <el-table-column label="创建时间" prop="createTime" align="center" width="240"></el-table-column>
  78. <el-table-column label="服务时间" align="center" width="240">
  79. <template slot-scope="scope">
  80. <template v-if="scope.row.entState == '1'">
  81. <div>--</div>
  82. </template>
  83. <template v-else-if="scope.row.entState == '2'">
  84. <div>{{scope.row.startDate}} - {{scope.row.endDate}}</div>
  85. <el-button @click="handleEdit(scope.row)" type="text" size="small">修改服务时间</el-button>
  86. <el-button @click="handleRecord(scope.row)" type="text" size="small">修改记录</el-button>
  87. </template>
  88. <template v-else>
  89. <div>已到期</div>
  90. <el-button @click="handleEdit(scope.row)" type="text" size="small">修改服务时间</el-button>
  91. <el-button @click="handleRecord(scope.row)" type="text" size="small">修改记录</el-button>
  92. </template>
  93. </template>
  94. </el-table-column>
  95. <el-table-column label="服务状态" prop="entState" align="center" width="120" :formatter="entSateFormat">
  96. <template slot-scope="scope">
  97. <template v-if="scope.row.authState == '3'">
  98. <span>驳回</span>
  99. </template>
  100. <template v-else>
  101. <span>{{scope.row.entState | entStateMode}}</span>
  102. </template>
  103. </template>
  104. </el-table-column>
  105. <el-table-column label="审核状态" prop="authState" align="center" width="120" :formatter="authStateFormat"></el-table-column>
  106. <el-table-column label="操作" align="center" width="300" class-name="small-padding fixed-width" fixed="right">
  107. <template slot-scope="scope">
  108. <el-button type="text" @click="handleView(scope.row)">查看</el-button>
  109. <!-- 只有科德管理员才可以有以下操作 -->
  110. <template v-if="roleType =='manager'">
  111. <el-button type="text" @click="handleResetPwd(scope.row)">重置密码</el-button>
  112. <el-button type="text" @click="handleAudit(scope.row)" v-if="scope.row.authState == '1'">审核</el-button>
  113. <!-- 只有审核通过 authState才可以修改 -->
  114. <el-button type="text" @click="handleUpdate(scope.row)" v-if="scope.row.authState == '2'">修改</el-button>
  115. <!-- 只有服务中且审核状态为已通过才可以停用 -->
  116. <el-button type="text" @click="handleStop(scope.row)" v-if="scope.row.entState == '2' && scope.row.authState == '2'">停用</el-button>
  117. <el-button type="text" @click="handleEnable(scope.row)" v-if="scope.row.entState == '4' && scope.row.authState == '2'">启用</el-button>
  118. <!-- 只有服务状态为已到期才可以提醒 -->
  119. <el-button type="text" @click="handleRemind(scope.row)" v-if="scope.row.entState == '3'">提醒</el-button>
  120. <!-- 审核状态为已驳回不可以删除 -->
  121. <!-- <el-button type="text" @click="handleDelete(scope.row)" v-if="scope.row.authState != '3'">删除</el-button> -->
  122. </template>
  123. </template>
  124. </el-table-column>
  125. </el-table>
  126. <pagination
  127. v-show="total>0"
  128. :total="total"
  129. :page.sync="queryParams.pageNum"
  130. :limit.sync="queryParams.pageSize"
  131. @pagination="getList"/>
  132. <audit-ent v-if="auditEntVisible" ref="auditEnt" @refreshData="getList()"></audit-ent>
  133. <record v-if="recordVisible" ref="record" @refreshData="getList()"></record>
  134. </div>
  135. </template>
  136. <!-- 企业管理模块只有科德管理员和税务人员 -->
  137. <script>
  138. import {getProvinceDataApi,getRegionChildrenApi} from "@/api/common/common"
  139. import {listEntApi, deleteEntApi, resetPwdApi, remindUserApi, stopEntUserApi,enableEntUserApi} from '@/api/admin/ent/ent'
  140. import {entStateOptions, getLabel, authStateEntOptions} from '@/utils/dataFormat'
  141. import {listEntTaxApi} from '@/api/gov/gov'
  142. import { resetUserPwd } from "@/api/system/user";
  143. import AuditEnt from "./components/service"
  144. import Record from "./components/record"
  145. export default {
  146. components: {
  147. AuditEnt,
  148. Record
  149. },
  150. data () {
  151. return {
  152. auditEntVisible: false,
  153. loading: false,
  154. provinceDataList: [],
  155. cityDataList: [],
  156. districtDataList: [],
  157. recordVisible: false,
  158. entStateOptions: entStateOptions,
  159. authStateEntOptions: authStateEntOptions,
  160. dateRange: [],
  161. roleType: '',
  162. queryParams: {
  163. pageNum: 1,
  164. pageSize: 10,
  165. provinceId: undefined,
  166. cityId: undefined,
  167. districtId: undefined,
  168. entName: '',
  169. license: '',
  170. entState: '',
  171. authState: '',
  172. },
  173. list: [],
  174. total: 0,
  175. open: false,
  176. openInfo: false,
  177. }
  178. },
  179. created() {
  180. this.roleType = this.roles.join(',')
  181. this.getList()
  182. if(this.userType == 'GOV_PROV' || this.userType == 'GOV_CITY') {
  183. this.getAreaData()
  184. }
  185. if(this.roleType != 'gov') {
  186. this.getProvinceData()
  187. }
  188. },
  189. computed: {
  190. roles() {
  191. return this.$store.state.user.roles
  192. },
  193. scopeId() {
  194. return this.$store.state.user.scopeId
  195. },
  196. userType() {
  197. return this.$store.state.user.userType
  198. }
  199. },
  200. filters: {
  201. entStateMode(val) {
  202. switch(val) {
  203. case 1:
  204. return '待审核';
  205. case 2:
  206. return '服务中';
  207. case 3:
  208. return '已过期';
  209. case 4:
  210. return '冻结';
  211. default:
  212. return "";
  213. }
  214. }
  215. },
  216. methods: {
  217. /** 修改服务时间 */
  218. handleEdit(row){
  219. this.auditEntVisible = true
  220. this.$nextTick(() => {
  221. this.$refs.auditEnt.init(row.id)
  222. })
  223. },
  224. handleRecord(row) {
  225. this.recordVisible = true
  226. this.$nextTick(() => {
  227. this.$refs.record.init(row.id)
  228. })
  229. },
  230. getAreaData() {
  231. getRegionChildrenApi(this.scopeId).then(res => {
  232. if(res.code == 200) {
  233. if(this.userType == 'GOV_PROV') {
  234. this.cityDataList = res.data
  235. }else if(this.userType == 'GOV_CITY') {
  236. this.districtDataList = res.data
  237. }
  238. }
  239. })
  240. },
  241. //选择省份
  242. getCityData() {
  243. this.queryParams.cityId = ''
  244. this.queryParams.districtId = ''
  245. getRegionChildrenApi(this.queryParams.provinceId).then(res => {
  246. if(res.code == 200) {
  247. this.cityDataList = res.data
  248. }
  249. })
  250. },
  251. //选择市
  252. getDistrictData() {
  253. this.queryParams.districtId = ''
  254. getRegionChildrenApi(this.queryParams.cityId).then(res => {
  255. if(res.code == 200) {
  256. this.districtDataList = res.data
  257. }
  258. })
  259. },
  260. getProvinceData() {
  261. getProvinceDataApi().then(res => {
  262. if(res.code == 200) {
  263. this.provinceDataList = res.data
  264. }
  265. })
  266. },
  267. //列表数据区分科德管理员还是税务人员
  268. getList() {
  269. this.loading = true;
  270. if(this.roleType == 'manager') {
  271. listEntApi(this.queryParams).then(response => {
  272. this.list = response.data.records;
  273. this.total = response.data.total;
  274. this.loading = false;
  275. });
  276. }else if(this.roleType == 'gov') {
  277. listEntTaxApi(this.queryParams).then(response => {
  278. this.list = response.data.records;
  279. this.total = response.data.total;
  280. this.loading = false;
  281. });
  282. }
  283. },
  284. handleAdd() {
  285. this.$router.push("/ent/add"+'?type=add')
  286. },
  287. handleUpdate(row) {
  288. this.$router.push("/ent/edit/"+row.id+'?type=update')
  289. },
  290. // 审核
  291. handleAudit(row) {
  292. this.$router.push("/ent/info/"+row.id+'?type=audit')
  293. },
  294. // 查看
  295. handleView(row) {
  296. this.$router.push("/ent/info/"+row.id+'?type=view')
  297. },
  298. // //重置密码
  299. handleResetPwd(row) {
  300. this.$confirm('是否确认重置密码?', "警告", {
  301. confirmButtonText: "确定",
  302. cancelButtonText: "取消",
  303. type: "warning"
  304. }).then(function() {
  305. return resetPwdApi(row.id);
  306. }).then(() => {
  307. this.queryParams.pageNum = 1;
  308. this.getList();
  309. setTimeout(() => { // 加延时
  310. this.$modal.msgSuccess("重置密码成功,新密码是:123456");
  311. }, 500);
  312. })
  313. },
  314. handleRemind(row) {
  315. this.$confirm('是否确认提醒用户服务时间到期?', "警告", {
  316. confirmButtonText: "确定",
  317. cancelButtonText: "取消",
  318. type: "warning"
  319. }).then(function() {
  320. return remindUserApi(row.id);
  321. }).then(() => {
  322. this.queryParams.pageNum = 1;
  323. this.getList();
  324. this.$message({
  325. message: '提醒成功',
  326. type: 'success'
  327. });
  328. })
  329. },
  330. handleStop(row) {
  331. this.$confirm('是否确认停用该企业账号?', "警告", {
  332. confirmButtonText: "确定",
  333. cancelButtonText: "取消",
  334. type: "warning"
  335. }).then(function() {
  336. return stopEntUserApi(row.id);
  337. }).then(() => {
  338. this.queryParams.pageNum = 1;
  339. this.getList();
  340. this.$message({
  341. message: '停用成功',
  342. type: 'success'
  343. });
  344. })
  345. },
  346. handleEnable(row) {
  347. this.$confirm('是否确认启用该企业账号?', "警告", {
  348. confirmButtonText: "确定",
  349. cancelButtonText: "取消",
  350. type: "warning"
  351. }).then(function() {
  352. return enableEntUserApi(row.id);
  353. }).then(() => {
  354. this.queryParams.pageNum = 1;
  355. this.getList();
  356. this.$message({
  357. message: '启用成功',
  358. type: 'success'
  359. });
  360. })
  361. },
  362. handleDelete(row) {
  363. const id = row.id;
  364. this.$confirm('是否确认删除该数据?', "警告", {
  365. confirmButtonText: "确定",
  366. cancelButtonText: "取消",
  367. type: "warning"
  368. }).then(function() {
  369. return deleteEntApi(id);
  370. }).then(() => {
  371. this.queryParams.pageNum = 1;
  372. this.getList();
  373. this.$message({
  374. message: '删除成功',
  375. type: 'success'
  376. });
  377. })
  378. },
  379. // 重置
  380. resetQuery() {
  381. this.dateRange = [];
  382. this.resetForm("queryForm");
  383. this.handleQuery();
  384. },
  385. // 搜索
  386. handleQuery() {
  387. this.queryParams.pageNum = 1;
  388. this.getList();
  389. },
  390. statusFormat(row, col, val, index) {
  391. return getLabel(accessStatus, val)
  392. },
  393. entSateFormat(row, col, val, index) {
  394. return getLabel(entStateOptions, val)
  395. },
  396. authStateFormat(row, col, val, index) {
  397. return getLabel(authStateEntOptions, val)
  398. }
  399. }
  400. }
  401. </script>
  402. <style>
  403. </style>