list.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <template>
  2. <basic-container>
  3. <div>
  4. <div class="pd-b-20 border-grey-b">
  5. <span class="mg-r-10">选择项目名称</span>
  6. <el-select v-model="projectId" @change="projectChange" placeholder="请选择">
  7. <el-option v-for="item in projectList" :key="item.id" :label="item.projectName" :value="item.id"></el-option>
  8. </el-select>
  9. </div>
  10. <div class="pd-t-20">
  11. <el-row :gutter="20" style="height:calc(100vh - 290px)">
  12. <el-col :span="6" v-for="(item,index) in projectPageList" :key="item.id" style="height:20%;" class="mg-b-20 box-size-bb">
  13. <el-card @click.native="projectClick(item)" class="box-card h-100p flex flex-center project_name" :class="getBg(index)">
  14. {{item.projectAlias}}
  15. </el-card>
  16. </el-col>
  17. </el-row>
  18. </div>
  19. <div>
  20. <el-pagination
  21. layout="prev, pager, next" class="text-align-c"
  22. @current-change="handleCurrentChange"
  23. :current-page.sync="page.currentPage"
  24. :total="page.total" :page-size="page.pageSize">
  25. </el-pagination>
  26. </div>
  27. </div>
  28. <el-dialog title="项目信息" :visible.sync="projectVisible" width="800px" append-to-body>
  29. <div class="flex jc-sb pd-b-10">
  30. <span>{{curProjiect.projectName}}</span>
  31. <div>
  32. <el-button size="small" type="success">WBS树管理</el-button>
  33. <el-button size="small" type="primary">编辑项目信息</el-button>
  34. <el-button size="small" type="info">创建新合同段</el-button>
  35. <el-button size="small" @click="projectVisible = false">返回</el-button>
  36. </div>
  37. </div>
  38. <div style="height:400px;overflow: auto;" v-if="contractList.length > 0">
  39. <el-card shadow="never" v-for="(item) in contractList" :key="item.id">
  40. <div class="flex jc-sb">
  41. <div class="flex jc-al-c">
  42. <el-avatar :size="50" :class="getAvatarBg(item.contractType)">{{getFont(item.contractType)}}</el-avatar>
  43. <span class="mg-l-10">{{item.contractName}}</span>
  44. </div>
  45. <div class="flex jc-al-c">
  46. <el-link type="primary" >编辑合同段信息</el-link>
  47. <el-link type="primary" class="mg-l-10">分配WBS</el-link>
  48. <el-link type="primary" class="mg-l-10">分配项目人员</el-link>
  49. <el-link type="primary" class="mg-l-10">删除</el-link>
  50. </div>
  51. </div>
  52. </el-card>
  53. </div>
  54. <div class="text-align-c pd-t-20" v-else>
  55. 暂无合同段,请先创建合同段
  56. </div>
  57. </el-dialog>
  58. </basic-container>
  59. </template>
  60. <script>
  61. import {getProjectList} from "@/api/manager/projectinfo";
  62. import {findContractByProjectId} from "@/api/manager/contractinfo";
  63. import {getDictionary} from "@/api/system/dict";
  64. import {mapGetters} from "vuex";
  65. export default {
  66. data() {
  67. return {
  68. projectId:'',
  69. curProjiect:{},
  70. projectList:[],
  71. projectPageList:[],
  72. projectVisible:false,
  73. contractList:[],
  74. page:{
  75. currentPage:1,
  76. pageSize:16,
  77. total:0
  78. }
  79. }
  80. },
  81. computed: {
  82. ...mapGetters(["userInfo"]),
  83. },
  84. created() {
  85. this.init();
  86. //console.log(this.userInfo)
  87. },
  88. methods: {
  89. init(){
  90. this.getProjectList();
  91. this.getProjectPageList();
  92. },
  93. getProjectList(){
  94. getProjectList(1,999).then((res)=>{
  95. this.projectList = res.data.data.records;
  96. })
  97. },
  98. getProjectPageList(){
  99. getProjectList(this.page.currentPage,this.page.pageSize).then((res)=>{
  100. this.projectPageList = res.data.data.records;
  101. this.page.total = res.data.data.total;
  102. })
  103. },
  104. projectClick(item){
  105. this.curProjiect = item;
  106. findContractByProjectId(this.curProjiect.id).then((res)=>{
  107. this.contractList = res.data.data;
  108. })
  109. this.projectVisible = true;
  110. },
  111. handleCurrentChange(val){
  112. this.getProjectPageList();
  113. this.page.currentPage = val;
  114. },
  115. projectChange(id){
  116. for (let i = 0; i < this.projectList.length; i++) {
  117. if(id == this.projectList[i].id){
  118. this.curProjiect = this.projectList[i];
  119. findContractByProjectId(this.curProjiect.id).then((res)=>{
  120. this.contractList = res.data.data;
  121. })
  122. this.projectVisible = true;
  123. return;
  124. }
  125. }
  126. },
  127. getFont(type){
  128. if(type == 1){
  129. return '施';
  130. }else if(type == 2){
  131. return '监';
  132. }else if(type == 3){
  133. return '业';
  134. }
  135. return '';
  136. },
  137. getAvatarBg(type){
  138. if(type == 1){
  139. return {'abg1':true};
  140. }else if(type == 2){
  141. return {'abg2':true};
  142. }else if(type == 3){
  143. return {'abg3':true};
  144. }
  145. return {};
  146. },
  147. getBg(index){
  148. let num = Math.trunc(index/4);
  149. if((num%2)===0){//判定条件余数为0时为偶数
  150. return{
  151. 'bg1':true
  152. }
  153. }else{
  154. return{
  155. 'bg2':true
  156. }
  157. }
  158. }
  159. }
  160. };
  161. </script>
  162. <style scoped lang="scss">
  163. .project_name{
  164. font-size: 20px;
  165. cursor: pointer;
  166. }
  167. .bg1{
  168. background-color: rgb(127, 164, 221);
  169. border-color: rgb(187, 187, 187);
  170. box-shadow: rgba(0, 0, 0, .4) 0px 2px 6px 0px;
  171. }
  172. .bg2{
  173. background-color: rgb(239, 240, 229);
  174. border-color: rgb(187, 187, 187);
  175. box-shadow: rgba(0, 0, 0, .4) 0px 2px 6px 0px;
  176. }
  177. .abg1{
  178. background-color: rgb(42, 155, 121);
  179. }
  180. .abg2{
  181. background-color: rgb(155, 108, 42);
  182. }
  183. .abg3{
  184. background-color: rgb(42, 53, 155);
  185. }
  186. </style>