index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  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;" clearable>
  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;" clearable>
  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;" clearable>
  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
  22. type="years"
  23. v-model="years"
  24. placeholder="选择一个或多个年份" value-format="yyyy">
  25. </el-date-picker>
  26. </el-form-item>
  27. <el-form-item label="企业名称" prop="entName">
  28. <el-input v-model="queryParams.entName" clearable style="width: 200px;" placeholder="请填入企业名称"></el-input>
  29. </el-form-item>
  30. <el-form-item label="社会信用代码" prop="license">
  31. <el-input v-model="queryParams.license" style="width: 200px;" placeholder="请输入社会信用代码" clearable></el-input>
  32. </el-form-item>
  33. </template>
  34. <el-form-item label="项目编号" prop="projectNo">
  35. <el-input v-model="queryParams.projectNo" style="width: 200px;" placeholder="请输入项目编号" clearable></el-input>
  36. </el-form-item>
  37. <el-form-item label="项目名称" prop="projectName">
  38. <el-input v-model="queryParams.projectName" style="width: 200px;" placeholder="请输入项目名称" clearable></el-input>
  39. </el-form-item>
  40. <el-form-item label="申报状态" prop="reportState">
  41. <el-select v-model="queryParams.reportState" filterable style="width: 200px;" clearable>
  42. <el-option value="1" label="待补充">待补充</el-option>
  43. <el-option value="2" label="待申报">待申报</el-option>
  44. <el-option value="3" label="待审核">待审核</el-option>
  45. <el-option value="4" label="已申报">已申报</el-option>
  46. </el-select>
  47. </el-form-item>
  48. <el-form-item>
  49. <el-button type="primary" @click="handleQuery">搜索</el-button>
  50. <el-button @click="resetQuery">重置</el-button>
  51. </el-form-item>
  52. </el-form>
  53. <h3 class="toolbar">
  54. <span class="title">列表</span>
  55. <div class="tool">
  56. <el-button type="primary" plain icon="el-icon-download" size="mini" @click="handleDownloadBatch">下载</el-button>
  57. <el-button type="primary" plain icon="el-icon-delete" size="mini" @click="handleBatchDel">批量删除</el-button>
  58. </div>
  59. </h3>
  60. <el-table v-loading="loading" :data="list" border @selection-change="handleSelectionChange">
  61. <el-table-column type="selection" width="55" align="center" />
  62. <el-table-column type="index" width="80" label="序号" align="center"></el-table-column>
  63. <el-table-column label="加计扣除年度" prop="projectYear" align="center" width="120"></el-table-column>
  64. <el-table-column label="项目名称" prop="projectName" align="center" width="180"></el-table-column>
  65. <el-table-column label="企业名称" prop="entName" align="center" width="180"/>
  66. <el-table-column label="统一社会信用代码" prop="creditCode" align="center" width="180" />
  67. <el-table-column label="是否跨年项目" prop="overYearFlag" :formatter="overYearFormat" align="center"></el-table-column>
  68. <!-- <el-table-column label="跨年申报"></el-table-column> -->
  69. <el-table-column label="是否追溯项目" prop="backFlag" :formatter="flagFormat" align="center"></el-table-column>
  70. <el-table-column label="项目起止时间" align="center" width="200">
  71. <template slot-scope="scope">
  72. <span>{{scope.row.projectStartDate}} - {{scope.row.projectEndDate}}</span>
  73. </template>
  74. </el-table-column>
  75. <el-table-column label="资料完善度" prop="linkEmail" align="center" width="220">
  76. <template slot-scope="scope">
  77. <span>技术 {{scope.row.techRate}} 财务 {{scope.row.finRate}}</span>
  78. </template>
  79. </el-table-column>
  80. <el-table-column label="申报状态" prop="reportState" align="center" width="100" :formatter="reportStateFormat"></el-table-column>
  81. <el-table-column label="操作" align="center" width="160" class-name="small-padding fixed-width" fixed="right">
  82. <template slot-scope="scope">
  83. <el-button type="text" @click="handleDownload(scope.row)">下载</el-button>
  84. <el-button type="text" @click="handleEdit(scope.row)">编辑</el-button>
  85. <el-button type="text" @click="handleDelete(scope.row)">删除</el-button>
  86. <el-button type="text" @click="handleAuditAdmin(scope.row)" v-if="scope.row.reportState == 3">审核</el-button>
  87. </template>
  88. </el-table-column>
  89. </el-table>
  90. <pagination
  91. v-show="total>0"
  92. :total="total"
  93. :page.sync="queryParams.pageNum"
  94. :limit.sync="queryParams.pageSize"
  95. @pagination="getList"/>
  96. <audit-project v-if="auditVisible" ref="auditProject" @refreshData="getList()"></audit-project>
  97. </div>
  98. </template>
  99. <script>
  100. import {getProvinceDataApi,getRegionChildrenApi,downloadProjectByIDApi} from "@/api/common/common"
  101. import {deleteProjectApi,listProjectApi} from '@/api/enterprise/project/project'
  102. import {projectAuditApi} from '@/api/admin/project/project'
  103. import {listProjectAdminApi} from '@/api/admin/project/project'
  104. import {entStateOptions, getLabel, authStateOptions, reportStateOptions,booleanOptions} from '@/utils/dataFormat'
  105. import AuditProject from '../../enterprise/project/components/audit.vue'
  106. import { downLoadZip } from "@/utils/zipdownload";
  107. import { checkRole } from "@/utils/permission"; // 权限判断函数
  108. export default {
  109. components: {
  110. AuditProject
  111. },
  112. data () {
  113. return {
  114. years: [],
  115. loading: false,
  116. auditVisible: false,
  117. ids: [],
  118. selectCount: '',
  119. provinceDataList: [],
  120. cityDataList: [],
  121. districtDataList: [],
  122. entStateOptions: entStateOptions,
  123. authStateOptions: authStateOptions,
  124. queryParams: {
  125. pageNum: 1,
  126. pageSize: 10,
  127. provinceId: undefined,
  128. cityId: undefined,
  129. districtId: undefined,
  130. entName: '',
  131. year: '',
  132. license: '',
  133. projectNo: '',
  134. projectName: ''
  135. },
  136. list: [],
  137. total: 0,
  138. open: false,
  139. openInfo: false,
  140. }
  141. },
  142. created() {
  143. this.getList()
  144. this.getProvinceData()
  145. },
  146. watch:{
  147. $route(){
  148. this.getList()
  149. this.getProvinceData()
  150. }
  151. },
  152. methods: {
  153. checkRole,
  154. getList() {
  155. this.loading = true;
  156. this.queryParams.year = this.years.join(',')
  157. listProjectApi(this.queryParams).then(response => {
  158. this.list = response.data.records;
  159. this.total = response.data.total;
  160. this.loading = false;
  161. });
  162. },
  163. // 多选框选中数据
  164. handleSelectionChange(selection) {
  165. this.ids = selection.map(item => item.id)
  166. this.selectCount = selection.length;
  167. },
  168. handleBatchDel() {
  169. if(this.selectCount <= 0) {
  170. this.$message.error('请选择要删除的数据');
  171. return
  172. }
  173. const delIds = this.ids.join(',')
  174. this.$confirm('是否确认删除该数据?', "警告", {
  175. confirmButtonText: "确定",
  176. cancelButtonText: "取消",
  177. type: "warning"
  178. }).then(function() {
  179. return deleteProjectApi(delIds);
  180. }).then(() => {
  181. this.queryParams.pageNum = 1;
  182. this.getList();
  183. this.$message({
  184. message: '删除成功',
  185. type: 'success'
  186. });
  187. })
  188. },
  189. //选择省份
  190. getCityData() {
  191. this.queryParams.cityId = ''
  192. this.queryParams.districtId = ''
  193. getRegionChildrenApi(this.queryParams.provinceId).then(res => {
  194. if(res.code == 200) {
  195. this.cityDataList = res.data
  196. }
  197. })
  198. },
  199. //选择市
  200. getDistrictData() {
  201. this.queryParams.districtId = ''
  202. getRegionChildrenApi(this.queryParams.cityId).then(res => {
  203. if(res.code == 200) {
  204. this.districtDataList = res.data
  205. }
  206. })
  207. },
  208. getProvinceData() {
  209. getProvinceDataApi().then(res => {
  210. if(res.code == 200) {
  211. this.provinceDataList = res.data
  212. }
  213. })
  214. },
  215. handleDownload(row) {
  216. downLoadZip('/project/download/' +row.id, "项目附件")
  217. },
  218. handleDownloadBatch() {
  219. if(this.selectCount <= 0) {
  220. this.$message.error('请选择要下载的项目');
  221. return
  222. }
  223. const delIds = this.ids.join(',')
  224. downLoadZip('/project/download/' +delIds, "项目附件")
  225. },
  226. //编辑
  227. handleEdit(row) {
  228. this.$router.push({name: 'editProject', query: {id: row.id, entId: row.entId, type: 'update', activeName: '2'}})
  229. },
  230. // 审核
  231. handleAudit(row) {
  232. const projectId = row.id;
  233. const authState = '2'
  234. this.$confirm('是否确认提交审核该数据?', "警告", {
  235. confirmButtonText: "确定",
  236. cancelButtonText: "取消",
  237. type: "warning"
  238. }).then(function() {
  239. return projectAuditApi(projectId,authState);
  240. }).then(() => {
  241. this.queryParams.pageNum = 1;
  242. this.getList();
  243. this.$message({
  244. message: '提交成功',
  245. type: 'success'
  246. });
  247. })
  248. },
  249. handleAuditAdmin(row) {
  250. this.$router.push({name: 'editProject', query: {id: row.id, entId: row.entId, type: 'view', oper: 'audit'}})
  251. // this.auditVisible = true
  252. // this.$nextTick(() => {
  253. // this.$refs.auditProject.init(row.id)
  254. // })
  255. },
  256. handleDelete(row) {
  257. const id = row.id;
  258. this.$confirm('是否确认删除该数据?', "警告", {
  259. confirmButtonText: "确定",
  260. cancelButtonText: "取消",
  261. type: "warning"
  262. }).then(function() {
  263. return deleteProjectApi(id);
  264. }).then(() => {
  265. this.queryParams.pageNum = 1;
  266. this.getList();
  267. this.$message({
  268. message: '删除成功',
  269. type: 'success'
  270. });
  271. })
  272. },
  273. // 重置
  274. resetQuery() {
  275. this.years = [];
  276. this.resetForm("queryForm");
  277. this.handleQuery();
  278. },
  279. // 搜索
  280. handleQuery() {
  281. this.queryParams.pageNum = 1;
  282. this.getList();
  283. },
  284. reportStateFormat(row, col, val, index) {
  285. return getLabel(reportStateOptions, val)
  286. },
  287. flagFormat(row, col, val, index) {
  288. return getLabel(booleanOptions, val)
  289. },
  290. overYearFormat(row, col, val, index) {
  291. return getLabel(booleanOptions, val)
  292. }
  293. }
  294. }
  295. </script>
  296. <style>
  297. </style>