userCenterMyProjectRecommendation.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514
  1. <template>
  2. <div style="width: 100%;background: #fff;min-height: 700px;color: #666;margin-top: 15px;" class="userCenterMyProject">
  3. <!-- <div style="width: 880px;padding:20px 0 0 0;background: #f2f2f2;margin-left: 30px;height: 175px;margin-top: 5px;">-->
  4. <!-- <el-form :inline="true" :model="params" class="demo-form-inline" style="padding:0 40px">-->
  5. <!-- <el-row>-->
  6. <!-- <el-col :span="10">-->
  7. <!-- <el-form-item :label="$t('common.projectName')">-->
  8. <!-- <el-input v-model="params.projectName" :placeholder="$t('common.EnterName')" maxlength="10"></el-input>-->
  9. <!-- </el-form-item>-->
  10. <!-- </el-col>-->
  11. <!-- <el-col :span="10">-->
  12. <!-- <el-form-item :label="$t('common.ProjectType')">-->
  13. <!-- <el-select v-model="params.technicalCategories" :placeholder="$t('common.SelectType')">-->
  14. <!-- <el-option-->
  15. <!-- v-for="item in technicalCategoriesDicts"-->
  16. <!-- :key="item.value"-->
  17. <!-- :label="item.label"-->
  18. <!-- :value="item.value"-->
  19. <!-- :disabled="false">-->
  20. <!-- </el-option>-->
  21. <!-- </el-select>-->
  22. <!-- </el-form-item>-->
  23. <!-- </el-col>-->
  24. <!-- <el-col :span="4">-->
  25. <!-- <el-button @click="toInitData" type="primary" style="width:70px">{{$t('common.uquery')}}</el-button>-->
  26. <!-- &lt;!&ndash; <el-button type="info">{{$t('common.reset')}}</el-button> &ndash;&gt;-->
  27. <!-- </el-col>-->
  28. <!-- </el-row>-->
  29. <!-- <el-row>-->
  30. <!-- <el-col :span="10">-->
  31. <!-- <el-form-item :label="$t('common.projectPhase')">-->
  32. <!-- <el-select v-model="params.phaseType" :placeholder="$t('common.EnterPhase')">-->
  33. <!-- <el-option-->
  34. <!-- v-for="item in phaseTypeDicts"-->
  35. <!-- :key="item.value"-->
  36. <!-- :label="item.label"-->
  37. <!-- :value="item.value"-->
  38. <!-- :disabled="false">-->
  39. <!-- </el-option>-->
  40. <!-- </el-select>-->
  41. <!-- </el-form-item>-->
  42. <!-- </el-col>-->
  43. <!-- <el-col :span="10">-->
  44. <!-- <el-form-item :label="$t('common.technicalScope')">-->
  45. <!-- <el-select v-model="params.technicalScope" :placeholder="$t('common.SelectTechnicalScope')">-->
  46. <!-- <el-option-->
  47. <!-- v-for="item in technicalScopeDicts"-->
  48. <!-- :key="item.value"-->
  49. <!-- :label="item.label"-->
  50. <!-- :value="item.value"-->
  51. <!-- :disabled="false">-->
  52. <!-- </el-option>-->
  53. <!-- </el-select>-->
  54. <!-- </el-form-item>-->
  55. <!-- </el-col>-->
  56. <!-- <el-col :span="2">-->
  57. <!-- &lt;!&ndash; <el-button type="primary">{{$t('common.query')}}</el-button> &ndash;&gt;-->
  58. <!-- <el-button @click="reset" type="info" style="width:70px">{{$t('common.reset')}}</el-button>-->
  59. <!-- </el-col>-->
  60. <!-- </el-row>-->
  61. <!-- </el-form>-->
  62. <!-- </div>-->
  63. <!-- <div style="height: 50px;line-height: 50px;">-->
  64. <!-- <el-button type="primary" style="float: right;margin-right: 90px;margin-top: 10px;" @click="toView('addMyProject','')">{{$t('common.CreateProject')}}</el-button>-->
  65. <!-- </div>-->
  66. <div style="margin-left: 30px;">
  67. <el-table
  68. :data="tableData"
  69. stripe
  70. highlight-current-row
  71. @cell-click="projectToView"
  72. style="width: 100%" >
  73. <template slot="empty">
  74. {{$t('common.UserNoData')}}
  75. </template>
  76. <el-table-column style="color: red" fixed :label="$t('common.projectName')" prop="projectName" width="300" > </el-table-column>
  77. <el-table-column prop="technicalScope" :label="$t('common.RangeTechnology')" width="250"> </el-table-column>
  78. <el-table-column prop="phaseType" :label="$t('common.projectPhase')" width="250"></el-table-column>
  79. <!-- <el-table-column prop="approveStatus" :label="$t('common.ReviewState')" width="150"> </el-table-column>-->
  80. <!-- <el-table-column prop="releaseStatus" :label="$t('common.ReleaseState')" width="150"> </el-table-column>-->
  81. <el-table-column prop="createDate" :label="$t('common.CreationTime')" width="160"> </el-table-column>
  82. <!-- <el-table-column fixed="right" prop="address5" :label="$t('common.Option')" width="210">-->
  83. <!-- <template slot-scope="scope">-->
  84. <!-- <el-button-->
  85. <!-- @click.native.prevent="change(scope.$index, tableData)"-->
  86. <!-- type="text"-->
  87. <!-- size="small">-->
  88. <!-- {{$t('common.Edit')}}-->
  89. <!-- </el-button>-->
  90. <!-- <el-button-->
  91. <!-- @click.native.prevent="release(scope.$index, tableData)"-->
  92. <!-- type="text"-->
  93. <!-- size="small">-->
  94. <!-- {{$t('common.Submit')}}-->
  95. <!-- </el-button>-->
  96. <!-- <el-button-->
  97. <!-- @click.native.prevent="withdraw(scope.$index, tableData)"-->
  98. <!-- type="text"-->
  99. <!-- size="small">-->
  100. <!-- {{$t('common.Withdraw')}}-->
  101. <!-- </el-button>-->
  102. <!-- <el-button-->
  103. <!-- @click.native.prevent="deleteRow(scope.$index, tableData)"-->
  104. <!-- type="text"-->
  105. <!-- size="small">-->
  106. <!-- {{$t('common.Delete')}}-->
  107. <!-- </el-button>-->
  108. <!-- </template>-->
  109. <!-- </el-table-column>-->
  110. </el-table>
  111. </div>
  112. <div style="width: 100%;text-align: center;">
  113. <el-pagination
  114. style="margin-top: 50px;height: 80px;"
  115. background
  116. layout="prev, pager, next"
  117. :total= num @size-change="handleSizeChange"
  118. @current-change="handleCurrentChange">
  119. </el-pagination>
  120. </div>
  121. </div>
  122. </template>
  123. <script>
  124. import Base from "@/views/base/Base";
  125. import {getDicts} from '@/api/dict';
  126. import {getsByPortal} from '@/api/project/baseProjectRecommend'
  127. import { formatDate } from "@/utils/formatUtils";
  128. import { getToken } from '@/utils/auth'
  129. import Bus from "@/api/bus";
  130. export default {
  131. name: 'userCenterMyProjectRecommendation',
  132. extends: Base,
  133. data () {
  134. return {
  135. num: 0,
  136. formInline: {
  137. user: '',
  138. region: ''
  139. },
  140. params: {
  141. pageNo: 1,
  142. pageSize: 10,
  143. technicalCategories: "",
  144. technicalScope:"",
  145. phaseType:"",
  146. createBy: "",
  147. projectName:"",
  148. publishingChannels:"1",
  149. approveStatus:"",
  150. language:""
  151. },
  152. tableData: [],
  153. technicalScopeDicts: [],
  154. phaseTypeDicts: [],
  155. technicalCategoriesDicts:[],
  156. projectReleaseStatus: [],
  157. projectApproveStatus: [],
  158. }
  159. },
  160. mounted() {
  161. this.toInitData();
  162. // this.getRecommended();
  163. this.toDate=Date.parse(new Date());
  164. },
  165. watch:{
  166. '$i18n.locale'(){
  167. this.toInitData();
  168. // this.getBaseProject();
  169. }
  170. },
  171. methods:{
  172. toproejctView(router, json) {
  173. var index = this.params.descStatus;
  174. var dataIndex = this.params;
  175. var cruPage = this.params.pageNo;
  176. window.localStorage.setItem('router', router);
  177. this.$store.commit('modify', router);
  178. Bus.$emit("router", router); //存 Bus.$emit
  179. const { href } =this.$router.resolve({
  180. name: router,
  181. query: {
  182. key: json,
  183. screenId:index,
  184. dataIndex:index,
  185. cruPage:cruPage
  186. }
  187. });
  188. window.open(href, '_blank');
  189. },
  190. projectToView(row,column,event,cell) {
  191. if(column.property=='projectName'){
  192. this.toproejctView('projectPresentationDetails',row.projectId)
  193. }
  194. },
  195. reset: function() {
  196. var params = {
  197. pageNo: 1,
  198. pageSize: 10,
  199. technicalCategories: "",
  200. technicalScope:"",
  201. phaseType:"",
  202. createBy: "",
  203. projectName:"",
  204. publishingChannels:"1",
  205. approveStatus:"",
  206. language:""
  207. }
  208. this.params = params;
  209. this.toInitData();
  210. },
  211. toInitData: function() {
  212. let token = getToken();
  213. this.params.language = this.$i18n.locale.toUpperCase();
  214. getsByPortal(this.params,token).then((result) => {
  215. // console.log(this.params);
  216. var data = result.data;
  217. // console.log(data.baseProjectViews,'----------------------------------------------')
  218. if (data.baseProjectViewList) {
  219. this.num = parseInt(data.page.totalCount);
  220. this.tableData = data.baseProjectViewList;
  221. this.tableData.forEach((i) => {
  222. i.createDate = i.createDate
  223. ? formatDate(i.createDate, "YYYY-MM-DD")
  224. : "";
  225. })
  226. }else {
  227. this.tableData = [];
  228. this.num = ""
  229. }
  230. if (this.$i18n.locale.toUpperCase() == 'ZH') {
  231. getDicts(
  232. "PROJECT_APPROVE_STATUS_DICT,RELEASE_STATUS_DICT,TECHNICAL_SCOPE_DICT,PHASE_TYPE_DICT,PROJECT_CATEGORIES_DICT"
  233. ).then(result => {
  234. if (result.data) {
  235. this.projectApproveStatus = result.data[0];
  236. this.projectReleaseStatus = result.data[1];
  237. this.technicalScopeDicts = result.data[2] || [];
  238. this.phaseTypeDicts = result.data[3] || [];
  239. this.technicalCategoriesDicts = result.data[4] || [];
  240. this.tableData.forEach((i) => {
  241. this.technicalScopeDicts.forEach((v) => {
  242. if (i.technicalScope == v.value) {
  243. i.technicalScope = v.label;
  244. }
  245. })
  246. this.phaseTypeDicts.forEach((v) => {
  247. if (i.phaseType == v.value) {
  248. i.phaseType = v.label;
  249. }
  250. })
  251. this.projectApproveStatus.forEach((v) => {
  252. if (i.approveStatus == v.value) {
  253. i.approveStatus = v.label;
  254. }
  255. })
  256. this.projectReleaseStatus.forEach((v) => {
  257. if (i.releaseStatus == v.value) {
  258. i.releaseStatus = v.label;
  259. }
  260. })
  261. })
  262. }
  263. });
  264. } else if (this.$i18n.locale.toUpperCase() == 'EN') {
  265. getDicts(
  266. "PROJECT_APPROVE_STATUS_DICT_EN,RELEASE_STATUS_DICT_EN,TECHNICAL_SCOPE_DICT_EN,PHASE_TYPE_DICT_EN,PROJECT_CATEGORIES_DICT_EN"
  267. ).then(result => {
  268. if (result.data) {
  269. this.projectApproveStatus = result.data[0];
  270. this.projectReleaseStatus = result.data[1];
  271. this.technicalScopeDicts = result.data[2] || [];
  272. this.phaseTypeDicts = result.data[3] || [];
  273. this.technicalCategoriesDicts = result.data[4] || [];
  274. this.tableData.forEach((i) => {
  275. this.technicalScopeDicts.forEach((v) => {
  276. if (i.technicalScope == v.value) {
  277. i.technicalScope = v.label;
  278. }
  279. })
  280. this.phaseTypeDicts.forEach((v) => {
  281. if (i.phaseType == v.value) {
  282. i.phaseType = v.label;
  283. }
  284. })
  285. this.projectApproveStatus.forEach((v) => {
  286. if (i.approveStatus == v.value) {
  287. i.approveStatus = v.label;
  288. }
  289. })
  290. this.projectReleaseStatus.forEach((v) => {
  291. if (i.releaseStatus == v.value) {
  292. i.releaseStatus = v.label;
  293. }
  294. })
  295. })
  296. }
  297. });
  298. }
  299. })
  300. },
  301. toView(router,json){
  302. this.$router.push({name:router,params:{key:json}})
  303. },
  304. // 发布
  305. release(index, rows) {
  306. if (this.$i18n.locale.toUpperCase() == "ZH") {
  307. this.$confirm('此操作将发布此项目, 是否继续?', '提示', {
  308. confirmButtonText: '确定',
  309. cancelButtonText: '取消',
  310. type: 'warning'
  311. }).then(() => {
  312. commit(rows[index].id).then(res=>{
  313. this.$message({
  314. message: '发布成功',
  315. type: 'success'
  316. });
  317. this.toInitData();
  318. }).catch((error) => {
  319. this.$message.error(res.msg);
  320. })
  321. }).catch(() => {
  322. this.$message({
  323. type: 'info',
  324. message: '已取消发布'
  325. });
  326. });
  327. } else {
  328. this.$confirm('This operation will publish this item. Do you want to continue?', 'Tips', {
  329. confirmButtonText: 'Determine',
  330. cancelButtonText: 'Cancel',
  331. type: 'warning'
  332. }).then(() => {
  333. commit(rows[index].id).then(res=>{
  334. this.$message({
  335. message: 'Published Successfully',
  336. type: 'success'
  337. });
  338. this.toInitData();
  339. }).catch((error) => {
  340. this.$message.error(res.msg);
  341. })
  342. }).catch(() => {
  343. this.$message({
  344. type: 'info',
  345. message: 'Unpublished'
  346. });
  347. });
  348. }
  349. },
  350. // 编辑
  351. change(index, rows) {
  352. console.log(index, rows[index].id)
  353. this.toView('addMyProject',rows[index].id)
  354. },
  355. // 删除
  356. deleteRow(index, rows) {
  357. if (this.$i18n.locale.toUpperCase() == "ZH") {
  358. this.$confirm(this.$t('common.Thisoperationwillpermanently'), this.$t('common.Tips'), {
  359. confirmButtonText: this.$t('common.OK'),
  360. cancelButtonText: this.$t('common.cancel'),
  361. type: 'warning'
  362. }).then(() => {
  363. del(rows[index].id).then(res=>{
  364. this.$message({
  365. message: res.msg,
  366. type: 'success'
  367. });
  368. this.toInitData();
  369. }).catch((error) => {
  370. this.$message.error(res.msg);
  371. })
  372. }).catch(() => {
  373. this.$message({
  374. type: 'info',
  375. message: this.$i18n.locale === 'zh' ? '已取消删除' : 'Deletion canceled',
  376. });
  377. });
  378. } else {
  379. this.$confirm('This operation will permanently delete the message. Do you want to continue?', 'Tips', {
  380. confirmButtonText: 'Determine',
  381. cancelButtonText: 'Cancel',
  382. type: 'warning'
  383. }).then(() => {
  384. del(rows[index].id).then(res=>{
  385. this.$message({
  386. message: res.msg,
  387. type: 'success'
  388. });
  389. this.toInitData();
  390. }).catch((error) => {
  391. this.$message.error(res.msg);
  392. })
  393. }).catch(() => {
  394. this.$message({
  395. type: 'info',
  396. message: 'Deletion Cancelled'
  397. });
  398. });
  399. }
  400. },
  401. // 撤回
  402. withdraw(index,rows) {
  403. if (this.$i18n.locale.toUpperCase() == "ZH") {
  404. this.$confirm('此操作将撤回此项目, 是否继续?', '提示', {
  405. confirmButtonText: '确定',
  406. cancelButtonText: '取消',
  407. type: 'warning'
  408. }).then(() => {
  409. bak(rows[index].id).then(res=>{
  410. this.$message({
  411. message: res.msg,
  412. type: 'success'
  413. });
  414. this.toInitData();
  415. }).catch((error) => {
  416. this.$message.error(res.msg);
  417. })
  418. }).catch(() => {
  419. this.$message({
  420. type: 'info',
  421. message: '已取消撤回'
  422. });
  423. });
  424. } else {
  425. this.$confirm('This operation will recall this item. Do you want to continue?', 'Tips', {
  426. confirmButtonText: 'Determine',
  427. cancelButtonText: 'Cancel',
  428. type: 'warning'
  429. }).then(() => {
  430. bak(rows[index].id).then(res=>{
  431. this.$message({
  432. message: res.msg,
  433. type: 'success'
  434. });
  435. this.toInitData();
  436. }).catch((error) => {
  437. this.$message.error(res.msg);
  438. })
  439. }).catch(() => {
  440. this.$message({
  441. type: 'info',
  442. message: 'Recall Cancelled'
  443. });
  444. });
  445. }
  446. },
  447. handleSizeChange(val) {
  448. console.log(`每页 ${val} 条`);
  449. },
  450. handleCurrentChange(val) {
  451. this.params.pageNo=val;
  452. this.toInitData()
  453. }
  454. }
  455. }
  456. </script>
  457. <style scoped>
  458. .el-input {
  459. width: 200px;
  460. }
  461. .el-form-item__content,
  462. .el-select {
  463. width: 200px !important;
  464. }
  465. .el-table thead {
  466. background: #eee;
  467. }
  468. .userCenterMyProject >>> .el-pagination .el-pager li,
  469. .userCenterMyProject >>> .el-pagination .btn-next,
  470. .userCenterMyProject >>> .el-pagination .btn-prev {
  471. width: 35px;
  472. height: 35px;
  473. line-height: 35px;
  474. }
  475. .userCenterMyProject
  476. >>> .el-pagination.is-background
  477. .el-pager
  478. li:not(.disabled).active {
  479. background: #0050d8;
  480. }
  481. .taberPhone1 {
  482. border-bottom: 2px solid #0c5afa;
  483. color: #0c5afa;
  484. }
  485. .el-table_body{
  486. color: red;
  487. }
  488. .userCenterMyProject >>> .el-table__row td:nth-of-type(1){
  489. color: #0a0000af !important;
  490. }
  491. .userCenterMyProject >>> .hover-row td:nth-of-type(1){
  492. color: #0079ef !important;
  493. }
  494. /* .projectName >>> .el-table__row td:nth-of-type(2){
  495. color: red ;
  496. } */
  497. .userCenterMyProject >>> .el-table__row td:nth-of-type(1) .cell{
  498. cursor: pointer;
  499. }
  500. </style>