futureTwelveMonths.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. <template>
  2. <div>
  3. <boxBorder title="未来12月项目预计签约金额/预计成交金额分析" class1="20px 20px" :height="height + 'px'" :titleTip="true">
  4. <template slot="select">
  5. <div>
  6. <label class="search__label">{{$t(`项目阶段`)}}:</label>
  7. <el-select ref="selectRef" v-model="stagename" multiple :placeholder="$t(`请选择`)" size="small" @focus="getStage" @change="selectStage" filterable >
  8. <el-option
  9. v-for="item in stagenameList"
  10. :key="item.stagename"
  11. :label="item.stagename"
  12. :value="item.stagename">
  13. </el-option>
  14. </el-select>
  15. </div>
  16. </template>
  17. <template slot="content">
  18. <div style="clear: both;">
  19. <div class="previous-border-class" v-for="item in dataBoxData" :key="item.index">
  20. <div class="previous-style-padding">
  21. <div class="justify-div-position">
  22. <div class="previous-style-circle" :style="{borderColor:item.color}"></div>
  23. <div class="previous-style-font1">{{$t(item.title)}}</div>
  24. <el-tooltip effect="dark" placement="top-start" style="margin-top: 3px">
  25. <div slot="content" style="white-space: pre">
  26. {{
  27. $t(
  28. item.description
  29. )
  30. }}
  31. </div>
  32. <!-- <i class="el-icon-question" style="color: #afb0be;float: right"></i>-->
  33. <img
  34. width="14px"
  35. height="14px"
  36. src="../../../assets/icons/prompt_icon.svg"
  37. />
  38. </el-tooltip>
  39. </div>
  40. <div class="previous-style-font2">
  41. <div v-if="item.title1">
  42. <span class="font-color-style-gray previous-style-font4 previous-right-5">{{$t(item.title1)}}</span>
  43. <span class="font-color-style-green previous-style-font3 font-class-bold">{{item.value1}}</span>
  44. <span class="font-color-style-green previous-style-font4 font-class-bold">{{$t(item.unit1)}}</span>
  45. <span class="font-color-style-gray previous-style-font4 previous-left-26 previous-right-5">{{$t(item.title2)}}</span>
  46. <span class="font-color-style-green previous-style-font3 font-class-bold">{{item.value2}}</span>
  47. <span class="font-color-style-green previous-style-font4 font-class-bold">{{$t(item.unit2)}}</span>
  48. </div>
  49. <div v-else>
  50. <span class="font-color-style-green previous-style-font3 font-class-bold">{{item.value}}</span>
  51. <span class="font-color-style-green previous-style-font4 font-class-bold">{{$t(item.unit)}}</span>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. </div>
  57. </template>
  58. <template slot="charts">
  59. <div style="clear: both;">
  60. <div ref="chartRef" style="height: 220px;">
  61. </div>
  62. </div>
  63. </template>
  64. </boxBorder>
  65. </div>
  66. </template>
  67. <script>
  68. import boxBorder from './boxBorder'
  69. import {Column} from "@antv/g2plot";
  70. export default {
  71. name: "futureTwelveMonths",
  72. props:['dataBoxData'],
  73. components:{
  74. boxBorder
  75. },
  76. data(){
  77. return {
  78. chartMap:[],
  79. chartMapData:[],
  80. stagename:[],
  81. stagenameList:[],
  82. selectHeight:null,
  83. height:282
  84. }
  85. },
  86. methods:{
  87. chartData(init,data){
  88. let index = 0
  89. let indexNew = 0
  90. data.forEach((item,num) =>{
  91. if (num == index){
  92. this.chartMapData[indexNew] = {
  93. "signdate_due":item.signdate_due,
  94. "value":Math.round(this.tool.unitConversion(item.signamount_due,10000)*100)/100,
  95. "name":this.$t('预计签约金额')+ this.$t('(万)')
  96. }
  97. indexNew = indexNew + 1
  98. this.chartMapData[indexNew] = {
  99. "signdate_due":item.signdate_due,
  100. "value":Math.round(this.tool.unitConversion(item.dealamount_due,10000)*100)/100,
  101. "name":this.$t('预计成交金额') + this.$t('(万)')
  102. }
  103. indexNew = indexNew + 1
  104. index = index + 1
  105. }
  106. })
  107. console.log(this.chartMapData,'chartMapData')
  108. console.log(this.$refs.selectRef.$el.clientHeight,'高度&&&&&&&高度')
  109. this.height = 352
  110. this.height = this.height + (this.$refs.selectRef.$el.clientHeight -32)
  111. if (init){
  112. this.chartMap = new Column(this.$refs.chartRef,{
  113. color:['#3874F6','#F29C37'],
  114. data:this.chartMapData,
  115. isGroup: true,
  116. xField: 'signdate_due',
  117. yField: 'value',
  118. seriesField: 'name',
  119. /** 设置颜色 */
  120. //color: ['#1ca9e6', '#f88c24'],
  121. /** 设置间距 */
  122. // marginRatio: 0.1,
  123. label: {
  124. // 可手动配置 label 数据标签位置
  125. position: 'top', // 'top', 'middle', 'bottom'
  126. offsetY:12,
  127. // 可配置附加的布局方法
  128. layout: [
  129. // 数据标签防遮挡
  130. { type: 'interval-hide-overlap' },
  131. ],
  132. style: {
  133. fill: '#444444',
  134. opacity: 0.9,
  135. fontSize:12
  136. },
  137. formatter: (datum) =>{
  138. console.log(datum.value)
  139. return '¥' + this.tool.formatAmount(datum.value,2)
  140. }
  141. },
  142. tooltip: {
  143. formatter: (datum) => {
  144. console.log(datum.value)
  145. return {
  146. name:datum.name,
  147. value:'¥' + this.tool.formatAmount(datum.value,2)
  148. }
  149. }
  150. },
  151. interactions: [{ type: 'element-highlight-by-x' }],
  152. });
  153. this.chartMap.on('element:click',(evt) => {
  154. this.$emit('clickChart',evt.data.data.signdate_due)
  155. })
  156. this.chartMap.render()
  157. }else {
  158. this.chartMap.changeData(this.chartMapData)
  159. }
  160. },
  161. /*获取项目阶段*/
  162. async getStage(){
  163. if (this.stagenameList.length == 0){
  164. const res = await this.$api.requested({
  165. "id": 20221128143604,
  166. "content": {
  167. "pageNumber": 1,
  168. "pageSize": 99,
  169. "where": {
  170. "condition": "",
  171. "allprojecttype":"",
  172. "projecttype":""
  173. }
  174. }
  175. })
  176. this.stagenameList = res.data
  177. }
  178. },
  179. selectStage(){
  180. console.log(this.stagename,'阶段名称')
  181. this.$emit('selectStage',this.stagename)
  182. },
  183. },
  184. }
  185. </script>
  186. <style scoped>
  187. .previous-border-class{
  188. width: 28%;
  189. height: 68px;
  190. float: left;
  191. margin-right: 40px;
  192. }
  193. .previous-style-padding{
  194. padding: 10px 20px;
  195. }
  196. .previous-style-circle{
  197. width: 5px;
  198. height: 5px;
  199. background: #FFFFFF;
  200. border: 2px solid;
  201. line-height: 19px;
  202. border-radius: 8px;
  203. margin-top: 5px;
  204. margin-right: 5px;
  205. }
  206. .previous-style-font1{
  207. font-family: Microsoft YaHei, Microsoft YaHei;
  208. font-weight: 400;
  209. font-size: 14px;
  210. color: #888888;
  211. line-height: 19px;
  212. text-align: left;
  213. font-style: normal;
  214. text-transform: none;
  215. margin-right: 5px;
  216. }
  217. .previous-style-font2{
  218. margin-top: 5px;
  219. margin-left: 15px;
  220. }
  221. .previous-style-font3{
  222. font-size: 18px;
  223. }
  224. .previous-style-font4{
  225. font-size: 14px;
  226. }
  227. .previous-right-5{
  228. margin-right: 5px;
  229. }
  230. .previous-left-26{
  231. margin-left: 26px;
  232. }
  233. </style>