userCenterMyProject.vue 22 KB

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