index.vue 11 KB

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