index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" size="small">
  4. <template v-if="!checkRole(['entAdmin','entUser'])">
  5. <el-form-item label="省" prop="provinceId">
  6. <el-select v-model="queryParams.provinceId" placeholder="请选择省" @change="getCityData" filterable style="width: 200px;">
  7. <el-option v-for="(item,index) in provinceDataList" :key="index" :label="item.name" :value="item.id"></el-option>
  8. </el-select>
  9. </el-form-item>
  10. <el-form-item label="市" prop="cityId">
  11. <el-select v-model="queryParams.cityId" placeholder="请选择市" @change="getDistrictData" filterable style="width: 200px;">
  12. <el-option v-for="(item, index) in cityDataList" :key="index" :label="item.name" :value="item.id"></el-option>
  13. </el-select>
  14. </el-form-item>
  15. <el-form-item label="区" prop="districtId">
  16. <el-select v-model="queryParams.districtId" placeholder="请选择区" filterable style="width: 200px;">
  17. <el-option v-for="(item, index) in districtDataList" :key="index" :label="item.name" :value="item.id"></el-option>
  18. </el-select>
  19. </el-form-item>
  20. <el-form-item label="年份" prop="year">
  21. <el-date-picker v-model="years" type="years" placeholder="选择一个或多个年份" style="width: 200px;" value-format="yyyy"></el-date-picker>
  22. </el-form-item>
  23. <el-form-item label="企业名称" prop="entName">
  24. <el-input v-model="queryParams.entName" clearable style="width: 200px;" placeholder="请输入企业名称"></el-input>
  25. </el-form-item>
  26. <el-form-item label="社会信用代码" prop="license">
  27. <el-input v-model="queryParams.license" style="width: 200px;" placeholder="请输入社会信用代码"></el-input>
  28. </el-form-item>
  29. </template>
  30. <el-form-item label="项目编号" prop="projectNo">
  31. <el-input v-model="queryParams.projectNo" style="width: 200px;" placeholder="请输入项目编号"></el-input>
  32. </el-form-item>
  33. <el-form-item label="项目名称" prop="projectName">
  34. <el-input v-model="queryParams.projectName" style="width: 200px;" placeholder="请输入项目名称"></el-input>
  35. </el-form-item>
  36. <el-form-item>
  37. <el-button type="primary" @click="handleQuery">搜索</el-button>
  38. <el-button @click="resetQuery">重置</el-button>
  39. </el-form-item>
  40. </el-form>
  41. <h3 class="toolbar">
  42. <span class="title">列表</span>
  43. <div class="tool">
  44. <el-button type="primary" plain icon="el-icon-delete" size="mini" @click="handleBatchDel" v-if="roleType == 'entAdmin' || roleType == 'entUser' || roleType == 'manager'">批量删除</el-button>
  45. <el-button type="primary" plain icon="el-icon-download" size="mini" @click="handleDownloadBatch">下载</el-button>
  46. </div>
  47. </h3>
  48. <el-table v-loading="loading" :data="list" border @selection-change="handleSelectionChange" style="width: 100%">
  49. <el-table-column type="selection" width="55" align="center" />
  50. <el-table-column label="项目编号" prop="projectNo" align="center" />
  51. <el-table-column label="项目名称" prop="projectName" align="center"></el-table-column>
  52. <el-table-column label="企业名称" prop="entName" align="center"/>
  53. <el-table-column label="社会信用代码" prop="license" align="center"/>
  54. <el-table-column label="项目年份" prop="projectYear" align="center"/>
  55. <el-table-column label="项目跨年" prop="overYearFlag" align="center" :formatter="fmtOverYear"></el-table-column>
  56. <el-table-column label="创建时间" align="center" prop="createTime" width="160"></el-table-column>
  57. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180" fixed="right">
  58. <template slot-scope="scope">
  59. <el-button type="text" @click="handleView(scope.row)">查看</el-button>
  60. <el-button type="text" @click="handleDelete(scope.row)">删除</el-button>
  61. <template v-if="scope.row.attachCnt != 0">
  62. <el-button type="text" @click="handleDownload(scope.row)">下载</el-button>
  63. </template>
  64. </template>
  65. </el-table-column>
  66. </el-table>
  67. <pagination
  68. v-show="total>0"
  69. :total="total"
  70. :page.sync="queryParams.pageNum"
  71. :limit.sync="queryParams.pageSize"
  72. @pagination="getList"
  73. />
  74. </div>
  75. </template>
  76. <!-- 科德管理员、企业角色、税务角色都有项目申报角色 -->
  77. <script>
  78. import {getProvinceDataApi,getRegionChildrenApi} from "@/api/common/common"
  79. import {listDeclareApi,listDeclareCommonApi,projectBackApi} from '@/api/enterprise/declare/declare'
  80. import {entStateOptions, getLabel, authStateOptions,yesOrNoOptions} from '@/utils/dataFormat'
  81. import { downLoadZip } from "@/utils/zipdownload";
  82. import { checkRole } from "@/utils/permission"; // 权限判断函数
  83. export default {
  84. data () {
  85. return {
  86. years: [],
  87. loading: false,
  88. provinceDataList: [],
  89. cityDataList: [],
  90. districtDataList: [],
  91. ids: [],
  92. selectCount: '',
  93. entStateOptions: entStateOptions,
  94. authStateOptions: authStateOptions,
  95. yesOrNoOptions: yesOrNoOptions,
  96. roleType: '',
  97. queryParams: {
  98. pageNum: 1,
  99. pageSize: 10,
  100. provinceId: undefined,
  101. cityId: undefined,
  102. districtId: undefined,
  103. year: '',
  104. entName: '',
  105. license: '',
  106. projectNo: '',
  107. projectName: ''
  108. },
  109. list: [],
  110. total: 0,
  111. open: false,
  112. openInfo: false,
  113. }
  114. },
  115. created() {
  116. this.roleType = this.roles.join(',')
  117. this.getList()
  118. if(this.userType == 'GOV_PROV' || this.userType == 'GOV_CITY') {
  119. this.getAreaData()
  120. }
  121. if(this.roleType != 'gov') {
  122. this.getProvinceData()
  123. }
  124. },
  125. computed: {
  126. roles() {
  127. return this.$store.state.user.roles
  128. },
  129. scopeId() {
  130. return this.$store.state.user.scopeId
  131. },
  132. userType() {
  133. return this.$store.state.user.userType
  134. }
  135. },
  136. methods: {
  137. checkRole,
  138. handleDownloadBatch() {
  139. if(this.selectCount <= 0) {
  140. this.$message.error('请选择要下载的项目');
  141. return
  142. }
  143. const delIds = this.ids.join(',')
  144. downLoadZip('/project/download/' +delIds, "项目附件")
  145. },
  146. // 多选框选中数据
  147. handleSelectionChange(selection) {
  148. this.ids = selection.map(item => item.id)
  149. this.selectCount = selection.length;
  150. },
  151. handleBatchDel() {
  152. if(this.selectCount <= 0) {
  153. this.$message.error('请选择要删除的数据');
  154. return
  155. }
  156. const delIds = this.ids.join(',')
  157. this.$confirm('是否确认删除该数据?', "警告", {
  158. confirmButtonText: "确定",
  159. cancelButtonText: "取消",
  160. type: "warning"
  161. }).then(function() {
  162. return projectBackApi(delIds);
  163. }).then(() => {
  164. this.queryParams.pageNum = 1;
  165. this.getList();
  166. this.$message({
  167. message: '删除成功',
  168. type: 'success'
  169. });
  170. })
  171. },
  172. getAreaData() {
  173. getRegionChildrenApi(this.scopeId).then(res => {
  174. if(res.code == 200) {
  175. if(this.userType == 'GOV_PROV') {
  176. this.cityDataList = res.data
  177. }else if(this.userType == 'GOV_CITY') {
  178. this.districtDataList = res.data
  179. }
  180. }
  181. })
  182. },
  183. //选择省份
  184. getCityData() {
  185. this.queryParams.cityId = ''
  186. this.queryParams.districtId = ''
  187. getRegionChildrenApi(this.queryParams.provinceId).then(res => {
  188. if(res.code == 200) {
  189. this.cityDataList = res.data
  190. }
  191. })
  192. },
  193. //选择市
  194. getDistrictData() {
  195. this.queryParams.districtId = ''
  196. getRegionChildrenApi(this.queryParams.cityId).then(res => {
  197. if(res.code == 200) {
  198. this.districtDataList = res.data
  199. }
  200. })
  201. },
  202. getProvinceData() {
  203. getProvinceDataApi().then(res => {
  204. if(res.code == 200) {
  205. this.provinceDataList = res.data
  206. }
  207. })
  208. },
  209. getList() {
  210. this.loading = true;
  211. this.queryParams.year = this.years.join(',')
  212. listDeclareCommonApi(this.queryParams).then(response => {
  213. this.list = response.data.records;
  214. this.total = response.data.total;
  215. this.loading = false;
  216. });
  217. },
  218. handleDownload(row) {
  219. downLoadZip('/project/download/' +row.id, "项目附件")
  220. },
  221. // 查看
  222. handleView(row) {
  223. this.$router.push("/declare/info/"+row.id)
  224. },
  225. handleDelete(row) {
  226. const id = row.id;
  227. this.$confirm('是否确认删除该数据?', "警告", {
  228. confirmButtonText: "确定",
  229. cancelButtonText: "取消",
  230. type: "warning"
  231. }).then(function() {
  232. return projectBackApi(id);
  233. }).then(() => {
  234. this.queryParams.pageNum = 1;
  235. this.getList();
  236. this.$message({
  237. message: '删除成功',
  238. type: 'success'
  239. });
  240. })
  241. },
  242. // 重置
  243. resetQuery() {
  244. this.years = [];
  245. this.resetForm("queryForm");
  246. this.handleQuery();
  247. },
  248. // 搜索
  249. handleQuery() {
  250. this.queryParams.pageNum = 1;
  251. this.getList();
  252. },
  253. statusFormat(row, col, val, index) {
  254. return getLabel(accessStatus, val)
  255. },
  256. entSateFormat(row, col, val, index) {
  257. return getLabel(entStateOptions, val)
  258. },
  259. authStateFormat(row, col, val, index) {
  260. return getLabel(authStateOptions, val)
  261. },
  262. fmtOverYear(row, col, val, index) {
  263. return getLabel(yesOrNoOptions, val)
  264. }
  265. }
  266. }
  267. </script>
  268. <style>
  269. </style>