xqjy.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. <template>
  2. <div class="xqjy-page">
  3. <div v-if="commonFunction.getUserConfig($store.state.userOwnMenus,300).available" class="xqjy-task_panel">
  4. <xqjyTaskList ref="xqjyTk" @select="isShow"></xqjyTaskList>
  5. <div class="xqjy-page_btn">
  6. <el-button v-if="commonFunction.getUserConfig($store.state.userOwnMenus,3001).available" size="small" type="primary"
  7. @click="addPlan">筹划
  8. </el-button>
  9. </div>
  10. </div>
  11. <div v-if="commonFunction.getUserConfig($store.state.userOwnMenus,301).available" v-show="windowShow"
  12. class="xqjy-analysisResult_panel">
  13. <i class="el-icon-close" @click="closeWindow"></i>
  14. <xqjyAnalysisResult ref="xqjyAr" @add="addStrip" @delete="deleteStrip"></xqjyAnalysisResult>
  15. <div class="xqjy-page_btn">
  16. <el-button v-if="commonFunction.getUserConfig($store.state.userOwnMenus,3002).available" size="small" type="primary"
  17. @click="showWindowList">确认
  18. </el-button>
  19. </div>
  20. </div>
  21. </div>
  22. </template>
  23. <script>
  24. import xqjyTaskList from './xqjyTaskList';
  25. import xqjyAnalysisResult from './xqjyAnalysisResult';
  26. import {confirmWindowInfo, addPlanList} from "@/api/xqjyApi";
  27. import cesiumEntityUtils from "@/utils/cesiumEntityUtils";
  28. export default {
  29. name: "xqjyPage",
  30. components: {xqjyTaskList, xqjyAnalysisResult},
  31. data() {
  32. return {
  33. windowShow: false,
  34. windowList: [],
  35. windowSelParentIds: [],
  36. windowSelParentId: '',
  37. windowRate: null,
  38. loading: null,
  39. }
  40. },
  41. methods: {
  42. isShow(data) {
  43. this.windowRate = data.rate
  44. this.windowSelParentId = data.parentId;
  45. this.windowShow = true;
  46. let targetData = null;
  47. let type = 'point'
  48. if (data.pointDTOList.length === 1) {
  49. targetData = {
  50. id: data.id,
  51. name: data.targetName,
  52. size: 20,
  53. outlineColor: Cesium.Color.fromCssColorString('#f10808'),
  54. outlineWidth: 2,
  55. color: Cesium.Color.fromCssColorString('#edf50b'),
  56. lon: data.pointDTOList[0].lng,
  57. lat: data.pointDTOList[0].lat,
  58. zIndex: 2
  59. };
  60. } else {
  61. type = 'polygon'
  62. let polygon = [];
  63. data.pointDTOList.forEach(py => {
  64. polygon.push(py.lng)
  65. polygon.push(py.lat)
  66. })
  67. targetData = {
  68. id: data.id,
  69. name: data.targetName,
  70. isRhumb: true,
  71. polygon: polygon,
  72. material: Cesium.Color.fromCssColorString('rgba(255,0,0,0.5)')
  73. }
  74. }
  75. this.$events.$emit("xqjy-target", {
  76. data: targetData,
  77. type: type
  78. });
  79. },
  80. closeWindow() {
  81. this.windowShow = false;
  82. this.$events.$emit("xqjy-target", {
  83. data: null,
  84. type: null
  85. });
  86. this.$refs.xqjyTk.selectId = null;
  87. },
  88. showWindowList() {
  89. if (typeof this.windowRate !== 'number') {
  90. this.$message.error('条带频次出错')
  91. return
  92. }
  93. let datas = this.$refs.xqjyAr.tableDatas
  94. let stripList = [];
  95. datas.forEach((item) => {
  96. if (item.select) {
  97. item.params.some(sub => {
  98. if (sub.select) {
  99. stripList.push({
  100. stripId: sub.id,
  101. isSelected: 2
  102. });
  103. }
  104. })
  105. }
  106. // else {
  107. // if (item.params.length > 0) {
  108. // stripList.push({
  109. // stripId: item.params[0].id,
  110. // isSelected: 2
  111. // });
  112. // }
  113. // }
  114. })
  115. if (this.windowRate !== stripList.length) {
  116. this.$message.warning(`条带频次为:${this.windowRate},请选择${this.windowRate}个条带`)
  117. return
  118. }
  119. confirmWindowInfo(stripList).then(response => {
  120. if (response.code === 200) {
  121. this.$message.success("确认成功!");
  122. // 所有确认成功的parentId
  123. if (!this.windowSelParentIds.includes(this.windowSelParentId)) {
  124. this.windowSelParentIds.push(this.windowSelParentId);
  125. }
  126. } else {
  127. console.log(response.data)
  128. }
  129. })
  130. },
  131. addPlan() {
  132. let datas = this.$refs.xqjyTk.selections
  133. let param = {
  134. demandType: 0,
  135. }
  136. let parentIds = [];
  137. if (datas.length < 1) {
  138. param.demandType = 1
  139. parentIds.push(this.$refs.xqjyTk.tableDatas[0])
  140. } else {
  141. datas.forEach(item => {
  142. parentIds.push(item.parentId)
  143. })
  144. }
  145. param.parentIds = parentIds;
  146. // const isEqual = this.strArrAllEqual(param.parentIds, this.windowSelParentIds);
  147. // if (!isEqual) {
  148. // this.$message.error("选择的筹划任务存在未分析的任务。")
  149. // return
  150. // }
  151. this.loading = this.$loading({
  152. lock: true,
  153. text: "筹划计算中",
  154. spinner: 'el-icon-loading',
  155. background: 'rgba(0,0,0,0.8)'
  156. });
  157. addPlanList(param).then(response => {
  158. console.log(response)
  159. if (response.code === 200) {
  160. this.loading.close();
  161. this.$message.success("提交筹划成功")
  162. this.$router.push({name: "xqchPage"});
  163. }
  164. })
  165. },
  166. strArrAllEqual(arr1, arr2) {
  167. if (arr1.length != arr2.length) {
  168. return false;
  169. }
  170. if (arr1.length === 0) {
  171. return false;
  172. }
  173. const tempArr = arr1.filter(i => arr2.includes(i));
  174. return tempArr.length === arr1.length;
  175. },
  176. addStrip(strips) {
  177. let lines = []
  178. if (strips.length > 0) {
  179. strips.forEach(item => {
  180. if (item.pointDTOList && item.pointDTOList.length > 0) {
  181. let polygon = [];
  182. item.pointDTOList.forEach(py => {
  183. polygon.push(py.longitude)
  184. polygon.push(py.latitude)
  185. })
  186. lines.push({
  187. id: item.id,
  188. material: Cesium.Color.fromCssColorString('rgba(237,245,11,0.5)'),
  189. isRhumb: false,
  190. polygon: polygon
  191. })
  192. }
  193. })
  194. }
  195. this.$events.$emit("xqjy-addwindow", lines);
  196. },
  197. deleteStrip(data) {
  198. this.$events.$emit("xqjy-deletewindow", data);
  199. }
  200. },
  201. mounted() {
  202. },
  203. };
  204. </script>
  205. <style lang='scss' scoped>
  206. .xqjy-page {
  207. color: #fff;
  208. height: calc(100% - 64px);
  209. .xqjy-task_panel, .xqjy-analysisResult_panel {
  210. position: absolute;
  211. }
  212. .xqjy-task_panel {
  213. height: 680px;
  214. top: 44px;
  215. left: -30px;
  216. width: 580px;
  217. background: url("@/assets/ClipImage/biaoti/xqrwlb.png") no-repeat;
  218. }
  219. .xqjy-analysisResult_panel {
  220. height: 660px;
  221. right: 0;
  222. width: 580px;
  223. background: url("@/assets/ClipImage/biaoti/fxjg.png") no-repeat;
  224. .el-icon-close {
  225. float: right;
  226. margin: 6px 21px;
  227. cursor: pointer;
  228. }
  229. }
  230. .xqjy-page_btn {
  231. width: 24px;
  232. margin: 22px auto 5px;
  233. .el-button {
  234. padding: 5px 10px;
  235. font-family: 'SourceHanSansCN-Regular';
  236. font-size: 16px;
  237. }
  238. }
  239. }
  240. </style>