You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.vue 13 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. <template>
  2. <div>
  3. <TopHeader :menu="'admin_view'"></TopHeader>
  4. <div class="ui container">
  5. <div class="top-container">
  6. <el-checkbox class="check-toggle" v-model="allChecked" @change="allSelectChange">全选/全不选</el-checkbox>
  7. <el-button class="btn-agree" @click="batchOperate(true)">批量同意展示</el-button>
  8. <el-button class="btn-cancel" @click="batchOperate(false)">批量取消展示</el-button>
  9. </div>
  10. <div class="table-container">
  11. <div class="table-title">2030科技项目管理</div>
  12. <div class="table-wrap">
  13. <el-table ref="tableRef" border :data="tableData" style="width:100%;" v-loading="loading" stripe row-key="id">
  14. <el-table-column label="" align="center" header-align="center" width="40" fixed>
  15. <template slot-scope="scope">
  16. <el-checkbox v-model="scope.row.checked" @change="rowSelectChange(scope.row)"></el-checkbox>
  17. </template>
  18. </el-table-column>
  19. <el-table-column label="启智项目名称" align="center" header-align="center" fixed min-width="150">
  20. <template slot-scope="scope">
  21. <a target="_blank" :href="`/${scope.row.repo_owner_name}/${scope.row.repo_name}`">{{
  22. `${scope.row.repo_owner_name}/${scope.row.repo_name}` }}</a>
  23. </template>
  24. </el-table-column>
  25. <el-table-column prop="name" label="科技项目名称" align="center" header-align="center" fixed
  26. min-width="200"></el-table-column>
  27. <el-table-column prop="status" label="展示状态" align="center" header-align="center" fixed>
  28. <template slot-scope="scope">
  29. <span style="color:rgb(255, 37, 37)"
  30. :style="scope.row.status == 1 ? { color: 'rgb(56, 158, 13)' } : ''">{{
  31. statusMap[scope.row.status] }}</span>
  32. </template>
  33. </el-table-column>
  34. <el-table-column prop="no" label="项目立项编号" align="center" header-align="center"
  35. min-width="120"></el-table-column>
  36. <el-table-column prop="institution" label="项目承担单位" align="center" header-align="center"
  37. min-width="160"></el-table-column>
  38. <el-table-column prop="province" label="所属省(省市)" align="center" header-align="center"
  39. min-width="100"></el-table-column>
  40. <el-table-column prop="category" label="单位性质" align="center" header-align="center"
  41. min-width="120"></el-table-column>
  42. <el-table-column prop="recommend" label="推荐单位" align="center" header-align="center"
  43. min-width="120"></el-table-column>
  44. <el-table-column prop="owner" label="项目负责人" align="center" header-align="center"
  45. min-width="100"></el-table-column>
  46. <el-table-column prop="phone" label="负责人电话" align="center" header-align="center"
  47. min-width="120"></el-table-column>
  48. <el-table-column prop="email" label="负责人邮箱" align="center" header-align="center"
  49. min-width="150"></el-table-column>
  50. <el-table-column prop="contact" label="项目联系人" align="center" header-align="center"
  51. min-width="100"></el-table-column>
  52. <el-table-column prop="contact_phone" label="联系人电话" align="center" header-align="center"
  53. min-width="120"></el-table-column>
  54. <el-table-column prop="contact_email" label="联系人邮箱" align="center" header-align="center"
  55. min-width="150"></el-table-column>
  56. <el-table-column prop="apply_year" label="申报年度" align="center" header-align="center"
  57. min-width="80"></el-table-column>
  58. <el-table-column prop="execute_month" label="执行周期(月)" align="center" header-align="center"
  59. min-width="120"></el-table-column>
  60. <el-table-column prop="execute_period" label="执行期限" align="center" header-align="center"
  61. min-width="120"></el-table-column>
  62. <el-table-column prop="type" label="项目类型" align="center" header-align="center"
  63. min-width="100"></el-table-column>
  64. <el-table-column prop="start_up" label="启动会时间" align="center" header-align="center"
  65. min-width="100"></el-table-column>
  66. <el-table-column prop="number_topic" label="课题数量" align="center" header-align="center"
  67. min-width="80"></el-table-column>
  68. <el-table-column prop="topic1" label="课题一级名称及承担单位" align="center" header-align="center"
  69. min-width="200"></el-table-column>
  70. <el-table-column prop="topic2" label="课题二级名称及承担单位" align="center" header-align="center"
  71. min-width="200"></el-table-column>
  72. <el-table-column prop="topic3" label="课题三级名称及承担单位" align="center" header-align="center"
  73. min-width="200"></el-table-column>
  74. <el-table-column prop="topic4" label="课题四级名称及承担单位" align="center" header-align="center"
  75. min-width="200"></el-table-column>
  76. <el-table-column prop="topic5" label="课题五级名称及承担单位" align="center" header-align="center"
  77. min-width="200"></el-table-column>
  78. <el-table-column prop="all_institution" label="所有参与单位" align="center" header-align="center"
  79. min-width="300"></el-table-column>
  80. <el-table-column prop="contribution_institution" label="成果贡献单位" align="center" header-align="center"
  81. min-width="300"></el-table-column>
  82. <el-table-column prop="user_name" label="申请账号" align="center" header-align="center" width="120">
  83. <template slot-scope="scope">
  84. <a target="_blank" :href="`/${scope.row.user_name}`">{{
  85. `${scope.row.user_name}` }}</a>
  86. </template>
  87. </el-table-column>
  88. <el-table-column prop="" label="操作" align="center" header-align="center" fixed="right" width="100">
  89. <template slot-scope="scope">
  90. <span v-if="scope.row.status == 2" class="op-btn agree" @click="toggleStatus(scope.row)">
  91. <i class="el-icon-check"></i>
  92. <span>同意展示</span>
  93. </span>
  94. <span v-if="scope.row.status == 1" class="op-btn cancel" @click="toggleStatus(scope.row)">
  95. <i class="el-icon-close"></i>
  96. <span>取消展示</span>
  97. </span>
  98. </template>
  99. </el-table-column>
  100. </el-table>
  101. </div>
  102. <div class="op-tips">
  103. <i class="el-icon-info"></i>
  104. 提示:批量操作只会对【展示状态】为 “未展示” 或 “已展示” 的数据生效。
  105. </div>
  106. <div class="center">
  107. <el-pagination ref="paginationRef" background @current-change="currentChange" @size-change="sizeChange"
  108. :current-page.sync="page" :page-sizes="pageSizes" :page-size.sync="pageSize"
  109. layout="total, sizes, prev, pager, next, jumper" :total="total">
  110. </el-pagination>
  111. </div>
  112. </div>
  113. </div>
  114. </div>
  115. </template>
  116. <script>
  117. import TopHeader from '../components/TopHeader.vue';
  118. import { getTechAdminList, setTechAdminOperation } from '~/apis/modules/tech';
  119. export default {
  120. data() {
  121. return {
  122. allChecked: false,
  123. loading: false,
  124. tableData: [],
  125. page: 1,
  126. pageSizes: [15, 30, 50, 100],
  127. pageSize: 50,
  128. total: 0,
  129. statusMap: {
  130. '1': '已展示',
  131. '2': '未展示',
  132. '3': '项目迁移中',
  133. '4': '项目迁移失败',
  134. '5': '项目不存在',
  135. },
  136. };
  137. },
  138. components: { TopHeader },
  139. methods: {
  140. getData() {
  141. this.loading = true;
  142. getTechAdminList({
  143. page: this.page,
  144. pageSize: this.pageSize,
  145. }).then(res => {
  146. this.loading = false;
  147. const { total, data } = res.data;
  148. this.tableData = data.map((item, index) => {
  149. return {
  150. checked: false,
  151. ...item,
  152. }
  153. });
  154. this.allChecked = false;
  155. this.total = total;
  156. }).catch(err => {
  157. this.loading = false;
  158. console.log(err);
  159. });
  160. },
  161. allSelectChange() {
  162. for (let i = 0, iLen = this.tableData.length; i < iLen; i++) {
  163. this.tableData[i].checked = this.allChecked;
  164. }
  165. this.tableData.splice(1, 0);
  166. },
  167. rowSelectChange(row) {
  168. if (row.checked == false) {
  169. this.allChecked = false;
  170. } else {
  171. if (this.tableData.filter((item) => item.checked).length == this.tableData.length) {
  172. this.allChecked = true;
  173. }
  174. }
  175. this.tableData.splice(1, 0);
  176. },
  177. currentChange(page) {
  178. this.page = page;
  179. this.getData();
  180. },
  181. sizeChange(pageSize) {
  182. this.pageSize = pageSize;
  183. this.getData();
  184. },
  185. toggleStatus(row) {
  186. if (row.status != 1 && row.status != 2) return;
  187. setTechAdminOperation({
  188. type: row.status == 1 ? 'hide' : 'show',
  189. id: [row.id],
  190. }).then(res => {
  191. res = res.data;
  192. if (res.Code == 0) {
  193. this.$message({
  194. type: 'success',
  195. message: this.$t('submittedSuccessfully'),
  196. });
  197. row.status = row.status == 1 ? 2 : 1;
  198. } else {
  199. this.$message({
  200. type: 'error',
  201. message: this.$t('submittedFailed'),
  202. });
  203. }
  204. }).catch(err => {
  205. console.log(err);
  206. this.$message({
  207. type: 'error',
  208. message: this.$t('submittedFailed'),
  209. });
  210. });
  211. },
  212. batchOperate(showOr) {
  213. const selectedData = this.tableData.filter((item) => {
  214. return item.checked && item.status == (showOr ? 2 : 1);
  215. });
  216. if (!selectedData.length) {
  217. this.$message({
  218. type: 'info',
  219. message: '请选择符合条件的数据进行操作!',
  220. });
  221. return;
  222. }
  223. setTechAdminOperation({
  224. type: showOr ? 'show' : 'hide',
  225. id: selectedData.map(item => item.id),
  226. }).then(res => {
  227. res = res.data;
  228. if (res.Code == 0) {
  229. this.$message({
  230. type: 'success',
  231. message: this.$t('submittedSuccessfully'),
  232. });
  233. this.getData();
  234. } else {
  235. this.$message({
  236. type: 'error',
  237. message: this.$t('submittedFailed'),
  238. });
  239. }
  240. }).catch(err => {
  241. console.log(err);
  242. this.$message({
  243. type: 'error',
  244. message: this.$t('submittedFailed'),
  245. });
  246. });
  247. },
  248. },
  249. beforeMount() {
  250. this.getData();
  251. },
  252. mounted() { },
  253. beforeDestroy() { },
  254. };
  255. </script>
  256. <style scoped lang="less">
  257. .top-container {
  258. display: flex;
  259. align-items: center;
  260. margin: 30px 0 15px 0;
  261. .check-toggle {
  262. margin-right: 20px;
  263. }
  264. .btn-agree {
  265. margin-right: 10px;
  266. background: rgb(50, 145, 248);
  267. color: rgb(255, 255, 255);
  268. &:hover {
  269. opacity: 0.9;
  270. }
  271. &:active {
  272. opacity: 0.8;
  273. }
  274. }
  275. .btn-cancel {
  276. margin-right: 10px;
  277. background: rgb(250, 140, 22);
  278. color: rgb(255, 255, 255);
  279. &:hover {
  280. opacity: 0.9;
  281. }
  282. &:active {
  283. opacity: 0.8;
  284. }
  285. }
  286. }
  287. .table-container {
  288. .table-title {
  289. height: 43px;
  290. font-size: 16px;
  291. font-weight: 700;
  292. padding: 15px;
  293. color: rgb(16, 16, 16);
  294. border-color: rgb(212, 212, 213);
  295. border-width: 1px;
  296. border-style: solid;
  297. border-radius: 5px 5px 0px 0px;
  298. background: rgb(240, 240, 240);
  299. display: flex;
  300. align-items: center;
  301. }
  302. .table-wrap {
  303. overflow-x: auto;
  304. /deep/ .el-table__header {
  305. th {
  306. background: rgb(249, 249, 249);
  307. font-size: 12px;
  308. color: rgb(136, 136, 136);
  309. font-weight: normal;
  310. }
  311. }
  312. /deep/ .el-table__body {
  313. td {
  314. font-size: 12px;
  315. }
  316. }
  317. /deep/ .el-radio__label {
  318. display: none;
  319. }
  320. }
  321. }
  322. .op-tips {
  323. margin: 10px 0 10px 0;
  324. color: #606266;
  325. font-size: 12px;
  326. i {
  327. margin-right: 4px;
  328. }
  329. }
  330. .op-btn {
  331. cursor: pointer;
  332. &.agree {
  333. color: rgb(56, 158, 13);
  334. }
  335. &.cancel {
  336. color: rgb(50, 145, 248);
  337. }
  338. }
  339. </style>