index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. <!--
  2. * @Descripttion: 地球-浙江
  3. * @Author: sujunling
  4. * @Date: 2025-05-19 09:10:25
  5. -->
  6. <template>
  7. <div class="widget-constructionProgressSimulation">
  8. <LeftBox ref="LeftBox" />
  9. <RightBox ref="RightBox" />
  10. <BottomBox ref="BottomBox" />
  11. <div class="modelListDiv">
  12. <i>大公桥调蓄池施工进度模拟</i>
  13. <b @click="start"><span class="el-icon-loading" v-if="startType"></span>{{ title }}</b>
  14. </div>
  15. </div>
  16. </template>
  17. <script>
  18. import LeftBox from './LeftBox.vue'
  19. import RightBox from './RightBox.vue'
  20. import BottomBox from './BottomBox.vue'
  21. import { getResultList } from 'staticPub/config'
  22. import CesiumDraw from '@/views/pipelineDefect/common/cesiumDraw'
  23. export default {
  24. name: 'constructionProgressSimulation',
  25. components: { LeftBox, RightBox, BottomBox },
  26. data() {
  27. return {
  28. title: '开始模拟',
  29. startType: false,
  30. data: {
  31. c_puct: Math.sqrt(2),
  32. n_playout: 2000,
  33. start_date: '2025-05-21T05:41:33.376Z',
  34. conversion_date: '2025-05-21T05:41:33.376Z',
  35. rain_intervals: []
  36. }
  37. }
  38. },
  39. mounted() {
  40. this.changeDom()
  41. this.addFile()
  42. window.init = () => {
  43. var data = {
  44. c_puct: 1.4142135623730951,
  45. n_playout: 2000,
  46. start_date: '2025-05-01 00:00:00',
  47. conversion_date: '2025-05-05 00:00:00',
  48. rain_intervals: [
  49. { start: '2025-05-01 00:00:00', end: '2025-05-02 00:00:00' },
  50. { start: '2025-05-07 00:00:00', end: '2025-05-08 00:00:00' }
  51. ]
  52. }
  53. this.getData(data)
  54. }
  55. },
  56. methods: {
  57. start() {
  58. var l = this.$refs.LeftBox.stopDateList
  59. if (l && l.length) {
  60. l.map((i) => {
  61. if (i && i.value) {
  62. this.data.rain_intervals.push({
  63. start: i.value[0],
  64. end: i.value[1]
  65. })
  66. }
  67. })
  68. } else {
  69. return this.$message.error('请填写完整的计划时间!')
  70. }
  71. var l1 = this.$refs.RightBox.planDateList
  72. if (l1 && l1.length && l1.length == 2) {
  73. l1.map((i, k) => {
  74. if (i && i.value && !k) {
  75. if (i.file) {
  76. this.data.start_date = i.value
  77. } else {
  78. return this.$message.error('请上传施工计划表格!')
  79. }
  80. } else if (i && i.value && k) {
  81. if (i.file) {
  82. this.data.conversion_date = i.value
  83. } else {
  84. return this.$message.error('请上传施工调整计划表格!')
  85. }
  86. }
  87. })
  88. } else {
  89. return this.$message.error('请填写完整的开始计划时间和调整计划时间!')
  90. }
  91. this.title = '分析中请等待'
  92. this.startType = true
  93. this.getData(this.data)
  94. },
  95. getData(data) {
  96. fetch(getResultList.sgjdmn_analysis, {
  97. method: 'POST',
  98. headers: {
  99. 'Content-Type': 'application/json'
  100. },
  101. body: JSON.stringify(data)
  102. })
  103. .then((e) => {
  104. return e.json()
  105. })
  106. .then((r) => {
  107. console.log('分析结果:', r)
  108. this.startType = false
  109. this.title = '开始模拟'
  110. if (r && r.all_results && r.all_results.length) {
  111. this.$refs.BottomBox.changeTable(r.all_results, r.best_schedule)
  112. }
  113. })
  114. },
  115. /**
  116. *添加时间段
  117. */
  118. addPlanDate() {
  119. const item = {
  120. value: ''
  121. }
  122. this.planDateList.push(item)
  123. },
  124. changeDom() {
  125. var dom = document.querySelector('.widget-SectorToolbar')
  126. if (dom) {
  127. dom.style.display = 'block'
  128. }
  129. var dom2 = document.querySelector('.widget-Legend')
  130. if (dom2) {
  131. dom2.style.display = 'block'
  132. }
  133. },
  134. addFile() {
  135. fetch(getResultList.sgjdmn_init)
  136. .then((e) => {
  137. return e.json()
  138. })
  139. .then((r) => {
  140. console.log('分析结果:', r)
  141. if (r.code == 1) {
  142. if (r.result.outcome && r.result.outcome.all_results && r.result.outcome.all_results.length) {
  143. this.$refs.BottomBox.changeTable(r.result.outcome.all_results, r.result.outcome.best_schedule)
  144. }
  145. if (r.result.request) {
  146. this.$refs.RightBox.changeTable(r.result.request)
  147. }
  148. if (r.result.request && r.result.request.rain_intervals && r.result.request.rain_intervals.length) {
  149. this.$refs.LeftBox.changeTable(r.result.request.rain_intervals)
  150. }
  151. }
  152. })
  153. },
  154. changeTable(r) {},
  155. }
  156. }
  157. </script>
  158. </script>
  159. <style scoped>
  160. .modelListDiv b {
  161. font-weight: bold;
  162. font-size: 16px;
  163. color: #feffff;
  164. width: 114px;
  165. height: 34px;
  166. background: #2187d3;
  167. border-radius: 4px;
  168. opacity: 0.9;
  169. line-height: 34px;
  170. position: absolute;
  171. left: 280px;
  172. top: 62px;
  173. text-align: center;
  174. display: inline-block;
  175. cursor: pointer;
  176. }
  177. .modelListDiv {
  178. position: fixed;
  179. top: 70px;
  180. left: 42%;
  181. z-index: 9;
  182. }
  183. .modelListDiv i {
  184. font-weight: bold;
  185. font-size: 20px;
  186. color: #feffff;
  187. width: 395px;
  188. height: 38px;
  189. line-height: 38px;
  190. background: url('~@/assets/images/jczc/title.png') no-repeat center;
  191. background-size: 395px 38px;
  192. position: absolute;
  193. left: -72px;
  194. top: 60px;
  195. text-align: center;
  196. display: inline-block;
  197. }
  198. </style>