pro_left.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <template>
  2. <div>
  3. <div class="white-bg top full-height flex flex-col hide-scrollbar" style='overflow-y: auto;'>
  4. <div class="flex flex-col flex-center mt-15 padding">
  5. <span class='font-15 bold mb-10'>{{ data.name }}</span>
  6. <span class="font-15 bold mt-5" style="color:#787C90;">项目总投资额</span>
  7. <span class="mt-5 font-15 bold main-color">{{
  8. data.totalAmount ? data.totalAmount.toLocaleString() : '0'
  9. }}万元</span>
  10. <div class="flex flex-center mt-10">
  11. <!-- <span class="bold mr-15" style="color:#787C90;">{{ currentSituation.dictValue }}</span>-->
  12. <el-select
  13. v-model="keyWords"
  14. class='bold'
  15. :placeholder="currentSituation.dictValue"
  16. size="small"
  17. @change="result"
  18. >
  19. <el-option
  20. v-for="item in dicList"
  21. :key="item.dictKey"
  22. :label="item.dictValue"
  23. :value="item.dictKey">
  24. </el-option>
  25. </el-select>
  26. </div>
  27. <el-divider></el-divider>
  28. <div class="flex flex-center full-width">
  29. <span class="title pointer" @click="showRelation = !showRelation">已关联子项目<span
  30. class="bold blue font-16">{{ data.lot }}</span>个</span>
  31. </div>
  32. </div>
  33. <div class="flex flex-center flex-justify-between flex-col mt-15 hide-scrollbar"
  34. style="height: 50vh;overflow-x: auto;">
  35. <div class="flex flex-center grey-9 font-15 bold pointer"
  36. :class="active === index ? 'box-s' : 'box'"
  37. v-for="(item,index) in dicList1" :key="item.id" @click="change(index)">{{
  38. item.dictValue
  39. }}
  40. </div>
  41. <div>
  42. </div>
  43. </div>
  44. </div>
  45. <pro-relation :showRelation="showRelation" :projectId="data.id" @close="showRelation = false"/>
  46. </div>
  47. </template>
  48. <script>
  49. import proRelation from '@/views/home/component/pro_relation.vue'
  50. export default {
  51. name: 'pro_left',
  52. components: {proRelation},
  53. props: {
  54. data: Object,
  55. code: {
  56. type: String,
  57. default: 'params_type'
  58. }
  59. },
  60. watch: {
  61. data: {
  62. handler(val) {
  63. if (val) {
  64. this.getDic('project-situation')
  65. }
  66. },
  67. immediate: false
  68. },
  69. code: {
  70. handler(val) {
  71. if (val) {
  72. this.getDic(val)
  73. }
  74. },
  75. immediate: false
  76. }
  77. },
  78. data() {
  79. return {
  80. height: 0,
  81. dicList: [],
  82. dicList1: [],
  83. currentSituation: '',
  84. active: 0,
  85. showRelation: false,
  86. projectId: '',
  87. resultList: []
  88. }
  89. },
  90. created() {
  91. this.getDic(this.code)
  92. this.onScroll()
  93. },
  94. methods: {
  95. onScroll(event) {
  96. this.$bus.on('scorll', (e) => {
  97. const scrollTop = e.target.scrollTop
  98. const index = this.scorllTopList.findIndex(e => scrollTop >= e.start && scrollTop < e.end)
  99. this.active = index
  100. if (e.target.scrollTop === 0) {
  101. this.active = 0
  102. }
  103. })
  104. },
  105. getDic(code) {
  106. this.$api.common.dicList({code}).then(res => {
  107. if (res.code === 200) {
  108. if (code === 'project-situation') {
  109. this.dicList = res.data
  110. const local = this.dicList.filter(e => e.dictKey === this.data.projectStage + '')
  111. if (local.length > 0) {
  112. this.currentSituation = local[0]
  113. }
  114. } else {
  115. this.dicList1 = res.data
  116. this.resultList = this.dicList1
  117. this.$emit('success', this.resultList)
  118. this.scorllTopList = []
  119. setTimeout(() => {
  120. for (let i = 0; i < this.resultList.length; i++) {
  121. const start = i === 0 ? 0 : document.getElementById('header' + i).offsetTop
  122. const end = document.getElementById('header' + (i + 1)).offsetTop
  123. const data = {
  124. index: i, start, end
  125. }
  126. this.scorllTopList.push(data)
  127. }
  128. }, 500)
  129. }
  130. }
  131. })
  132. },
  133. proInfo() {
  134. this.$emit('typeChange')
  135. },
  136. record() {
  137. this.$emit('typeChange1')
  138. },
  139. result(item) {
  140. const data = {id: this.data.id, projectStage: item}
  141. this.$api.project.proUpdate(data).then(res => {
  142. if (res.code === 200) {
  143. this.$message.success(res.msg)
  144. const local = this.dicList.findIndex(e => e.dictKey === item)
  145. this.currentSituation = this.dicList[local]
  146. } else {
  147. this.$message.error(res.msg)
  148. }
  149. })
  150. },
  151. change(index) {
  152. this.active = index
  153. this.$emit('change', index)
  154. }
  155. }
  156. }
  157. </script>
  158. <style lang="scss" scoped>
  159. .top {
  160. width: 300px;
  161. position: fixed;
  162. background-color: #FAF9FA
  163. }
  164. .down {
  165. width: 300px;
  166. position: fixed;
  167. bottom: 0;
  168. padding-bottom: 20px;
  169. background-color: #FAF9FA
  170. }
  171. .tip {
  172. border-radius: 10px;
  173. background-color: #F4F4F1;
  174. height: 75px;
  175. width: 240px
  176. }
  177. .middle {
  178. width: 270px;
  179. position: fixed;
  180. bottom: 175px;
  181. top: 280px;
  182. padding-left: 30px;
  183. background-color: #FAF9FA
  184. }
  185. .title {
  186. color: #ECAB56;
  187. font-size: 16px;
  188. font-weight: 500;
  189. }
  190. .box {
  191. border-bottom: 1px dashed #AFAFAF;
  192. width: 180px;
  193. padding-top: 32px;
  194. padding-bottom: 32px;
  195. }
  196. .box-s {
  197. background-image: url("../../../assets/svg/box.svg");
  198. background-size: 100% 100%;
  199. width: 180px;
  200. color: white;
  201. padding-top: 32px;
  202. padding-bottom: 32px
  203. }
  204. </style>