userCenterMyProjectIntention.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. <template>
  2. <div style="width: 100%;background: #fff;min-height: 700px;color: #666;" class="userCenterMyProject">
  3. <div style="padding:20px 0 0 0;background: #f2f2f2;margin-left: 0px;margin-top: 5px;border: 1px solid #ccc;">
  4. <el-form :inline="true" :model="params" class="demo-form-inline" style="padding:0 40px">
  5. <el-row>
  6. <el-form-item :label="$t('common.ProjectType') + ':'">
  7. <el-checkbox-group v-model="params.technicalCategories" :placeholder="$t('common.SelectType')">
  8. <el-col :span="6" v-for="item in technicalCategoriesDicts" >
  9. <el-checkbox :key="item.value" :label="item.value">{{item.label}}</el-checkbox>
  10. </el-col>
  11. </el-checkbox-group>
  12. </el-form-item>
  13. </el-row>
  14. <el-row>
  15. <el-col>
  16. <el-form-item :label="$t('common.technicalScope') + ':'">
  17. <el-checkbox-group v-model="params.technicalScope" :placeholder="$t('common.SelectTechnicalScope')">
  18. <el-col :span="5" v-for="item in technicalScopeDicts" >
  19. <el-checkbox :key="item.value" :label="item.value">{{item.label}}</el-checkbox>
  20. </el-col>
  21. </el-checkbox-group>
  22. </el-form-item>
  23. </el-col>
  24. </el-row>
  25. <el-row>
  26. <el-col>
  27. <el-form-item :label="$t('common.projectPhase') + ':'">
  28. <el-checkbox-group v-model="params.phaseType" :placeholder="$t('common.EnterPhase')">
  29. <el-col :span="5" v-for="item in phaseTypeDicts" >
  30. <el-checkbox :key="item.value" :label="item.value">{{item.label}}</el-checkbox>
  31. </el-col>
  32. </el-checkbox-group>
  33. </el-form-item>
  34. </el-col>
  35. </el-row>
  36. <el-row style="padding-bottom: 20px;">
  37. <el-col :span="3" style="float: right;">
  38. <el-button @click="saveData" type="primary" style="width:70px">{{$t('common.Save')}}</el-button>
  39. <!-- <el-button type="info">{{$t('common.reset')}}</el-button> -->
  40. </el-col>
  41. <el-col :span="3" style="float: right;">
  42. <!-- <el-button type="primary">{{$t('common.query')}}</el-button> -->
  43. <el-button @click="reset" type="info" style="width:70px">{{$t('common.reset')}}</el-button>
  44. </el-col>
  45. </el-row>
  46. </el-form>
  47. </div>
  48. </div>
  49. </template>
  50. <script>
  51. import Base from "@/views/base/Base";
  52. import {getDicts} from '@/api/dict';
  53. import {getBaseProjectIntentionsByPortal,saveOrUpdateByPortal} from '@/api/project/baseProjectIntention'
  54. export default {
  55. name: 'userCenterMyProjectIntention',
  56. extends: Base,
  57. data () {
  58. return {
  59. language:this.$i18n.locale.toUpperCase(),
  60. num: 0,
  61. formInline: {
  62. user: '',
  63. region: ''
  64. },
  65. params: {
  66. pageNo: 1,
  67. pageSize: 10,
  68. technicalCategories: [],
  69. technicalScope:[],
  70. phaseType:[],
  71. createBy: "",
  72. projectName:"",
  73. publishingChannels:"1",
  74. approveStatus:"",
  75. language:""
  76. },
  77. baseProjectIntention: {
  78. id: null,
  79. intentionConfig: '',
  80. status: '',
  81. createBy: '',
  82. createDate: '',
  83. updateBy: '',
  84. updateDate: '',
  85. reserveOne: '',
  86. reserveTwo: '',
  87. reserveThree: '',
  88. reserveFour: '',
  89. reserveFive: '',
  90. },
  91. tableData: [],
  92. technicalScopeDicts: [],
  93. phaseTypeDicts: [],
  94. technicalCategoriesDicts:[],
  95. projectReleaseStatus: [],
  96. projectApproveStatus: [],
  97. }
  98. },
  99. mounted() {
  100. this.toInitData();
  101. // this.getRecommended();
  102. this.toDate=Date.parse(new Date());
  103. },
  104. watch:{
  105. '$i18n.locale'(){
  106. this.toInitData();
  107. this.language = this.$i18n.locale.toUpperCase();
  108. // this.getBaseProject();
  109. }
  110. },
  111. methods:{
  112. reset: function() {
  113. var params = {
  114. pageNo: 1,
  115. pageSize: 10,
  116. technicalCategories: [],
  117. technicalScope:[],
  118. phaseType:[],
  119. createBy: "",
  120. projectName:"",
  121. publishingChannels:"1",
  122. approveStatus:"",
  123. language:""
  124. }
  125. this.params = params;
  126. this.toInitData();
  127. },
  128. toInitData: function() {
  129. let that = this;
  130. this.params.language = this.$i18n.locale.toUpperCase();
  131. this.resetToken();
  132. this.submitHandler((token) => {
  133. getBaseProjectIntentionsByPortal(this.params, token).then((result) => {
  134. // console.log(this.params);
  135. var data = result.data;
  136. // console.log(data.baseProjectViews,'----------------------------------------------')
  137. if (data.baseProjectIntentions) {
  138. that.baseProjectIntention = data.baseProjectIntentions[0];
  139. let config = JSON.parse(that.baseProjectIntention.intentionConfig);
  140. that.params.technicalCategories = config.technicalCategories;
  141. that.params.phaseType = config.phaseType;
  142. that.params.technicalScope = config.technicalScope;
  143. }
  144. if (this.$i18n.locale.toUpperCase() == 'ZH') {
  145. getDicts(
  146. "PROJECT_APPROVE_STATUS_DICT,RELEASE_STATUS_DICT,TECHNICAL_SCOPE_DICT,PHASE_TYPE_DICT,PROJECT_CATEGORIES_DICT"
  147. ).then(result => {
  148. if (result.data) {
  149. this.projectApproveStatus = result.data[0];
  150. this.projectReleaseStatus = result.data[1];
  151. this.technicalScopeDicts = result.data[2] || [];
  152. this.phaseTypeDicts = result.data[3] || [];
  153. this.technicalCategoriesDicts = result.data[4] || [];
  154. this.tableData.forEach((i) => {
  155. this.technicalScopeDicts.forEach((v) => {
  156. if (i.technicalScope == v.value) {
  157. i.technicalScope = v.label;
  158. }
  159. })
  160. this.phaseTypeDicts.forEach((v) => {
  161. if (i.phaseType == v.value) {
  162. i.phaseType = v.label;
  163. }
  164. })
  165. this.projectApproveStatus.forEach((v) => {
  166. if (i.approveStatus == v.value) {
  167. i.approveStatus = v.label;
  168. }
  169. })
  170. this.projectReleaseStatus.forEach((v) => {
  171. if (i.releaseStatus == v.value) {
  172. i.releaseStatus = v.label;
  173. }
  174. })
  175. })
  176. }
  177. });
  178. } else if (this.$i18n.locale.toUpperCase() == 'EN') {
  179. getDicts(
  180. "PROJECT_APPROVE_STATUS_DICT_EN,RELEASE_STATUS_DICT_EN,TECHNICAL_SCOPE_DICT_EN,PHASE_TYPE_DICT_EN,PROJECT_CATEGORIES_DICT_EN"
  181. ).then(result => {
  182. if (result.data) {
  183. this.projectApproveStatus = result.data[0];
  184. this.projectReleaseStatus = result.data[1];
  185. this.technicalScopeDicts = result.data[2] || [];
  186. this.phaseTypeDicts = result.data[3] || [];
  187. this.technicalCategoriesDicts = result.data[4] || [];
  188. this.tableData.forEach((i) => {
  189. this.technicalScopeDicts.forEach((v) => {
  190. if (i.technicalScope == v.value) {
  191. i.technicalScope = v.label;
  192. }
  193. })
  194. this.phaseTypeDicts.forEach((v) => {
  195. if (i.phaseType == v.value) {
  196. i.phaseType = v.label;
  197. }
  198. })
  199. this.projectApproveStatus.forEach((v) => {
  200. if (i.approveStatus == v.value) {
  201. i.approveStatus = v.label;
  202. }
  203. })
  204. this.projectReleaseStatus.forEach((v) => {
  205. if (i.releaseStatus == v.value) {
  206. i.releaseStatus = v.label;
  207. }
  208. })
  209. })
  210. }
  211. });
  212. }
  213. }).catch((error) => {
  214. // 此处你的业务代码
  215. console.log(error)
  216. this.resetToken();
  217. });
  218. })
  219. },
  220. // 发布
  221. saveData:function() {
  222. let config = {
  223. technicalCategories:[],
  224. technicalScope:[],
  225. phaseType:[],
  226. }
  227. config.technicalCategories = this.params.technicalCategories;
  228. config.phaseType = this.params.phaseType;
  229. config.technicalScope = this.params.technicalScope;
  230. this.baseProjectIntention.intentionConfig = JSON.stringify(config);
  231. this.resetToken();
  232. this.submitHandler((token) => {
  233. saveOrUpdateByPortal(JSON.stringify(this.baseProjectIntention), token,this.language).then((result) => {
  234. alert(result.msg)
  235. }).catch((error) => {
  236. // 此处你的业务代码
  237. console.log(error)
  238. this.resetToken();
  239. });
  240. });
  241. },
  242. handleSizeChange(val) {
  243. console.log(`每页 ${val} 条`);
  244. },
  245. handleCurrentChange(val) {
  246. this.param.pageNo=val;
  247. this.toInitData()
  248. }
  249. }
  250. }
  251. </script>
  252. <style scoped>
  253. .el-input {
  254. width: 200px ;
  255. }
  256. .el-form-item__content,.el-select {
  257. width: 200px !important;
  258. }
  259. .el-table thead {
  260. background: #eee;
  261. }
  262. .userCenterMyProject >>> .el-pagination .el-pager li,
  263. .userCenterMyProject >>> .el-pagination .btn-next,
  264. .userCenterMyProject >>> .el-pagination .btn-prev{
  265. width: 35px;
  266. height: 35px;
  267. line-height: 35px;
  268. }
  269. .userCenterMyProject >>> .el-pagination.is-background .el-pager li:not(.disabled).active {
  270. background: #0050d8;
  271. }
  272. .userCenterMyProject >>> .el-form-item__label{
  273. font-weight: 700;
  274. font-size: 15px;
  275. }
  276. .userCenterMyProject >>>.el-form--inline .el-form-item__content{
  277. display: block;
  278. }
  279. </style>