autoPlanCreate.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. <template>
  2. <div>
  3. <div class="w-full p-4" style="background-color: #162d55">
  4. <!-- 顶部信息栏 -->
  5. <div class="flex justify-end items-center text-sm text-blue-200">
  6. <span class="flex flex-1 text-2xl font-bold">
  7. 自动筹划
  8. </span>
  9. <!-- <span class="mr-4">任务编号: TASK-2024-001</span>-->
  10. <!-- <span class="mr-4">任务名称: 综合试验任务</span>-->
  11. <!-- <span>当前状态: 方案编制中</span>-->
  12. </div>
  13. </div>
  14. <div class="bb-layout-page text-white min-h-screen p-4">
  15. <div class="flex gap-4">
  16. <!-- 右侧主内容区 -->
  17. <div class="flex-1 space-y-4 p-6 bg-gray-400 bg-opacity-20 backdrop-blur-lg border-gray-50 rounded-xl">
  18. <!-- 布设状态 -->
  19. <div class="flex items-center mb-4">
  20. <h3 class="text-lg font-bold" style="color: #4fc2f7">布设状态</h3>
  21. </div>
  22. <div class="flex flex-col p-4 bg-black bg-opacity-20 mb-2">
  23. <div class="">
  24. <p>已布设BB数量: <span class="text-blue-300">0</span></p>
  25. <p>当前算法: <span class="text-blue-300">随机布设</span></p>
  26. <p>布设密度: <span class="text-blue-300">中等</span></p>
  27. <p>覆盖面积: <span class="text-blue-300">0%</span></p>
  28. </div>
  29. </div>
  30. <div class="flex items-center mb-4">
  31. <h3 class="text-lg font-bold" style="color: #4fc2f7">方案信息</h3>
  32. </div>
  33. <div class="grid gap-4 grid-cols-4 p-4 mb-4 bg-black bg-opacity-20 rounded-md">
  34. <el-card shadow="hover" class="p-3 text-white bg-gray-100 bg-opacity-20 border-l-8 border-blue-400">
  35. <div class="flex justify-between items-center mb-2">
  36. <span class="text-blue-300 font-blod">方案名称</span>
  37. </div>
  38. <div class="flex text-sm mt-2">
  39. <span>BB布设方案-001</span>
  40. </div>
  41. </el-card>
  42. <el-card shadow="hover" class="p-3 text-white bg-gray-100 bg-opacity-20 border-l-8 border-blue-400">
  43. <div class="flex justify-between items-center mb-2">
  44. <span class="text-blue-300 font-blod">创建时间</span>
  45. </div>
  46. <div class="flex text-sm mt-2">
  47. <span>2025-08-20 11:05:30</span>
  48. </div>
  49. </el-card>
  50. <el-card shadow="hover" class="p-3 text-white bg-gray-100 bg-opacity-20 border-l-8 border-blue-400">
  51. <div class="flex justify-between items-center mb-2">
  52. <span class="text-blue-300 font-blod">方案状态</span>
  53. </div>
  54. <div class="flex text-sm mt-2">
  55. <span>编制中</span>
  56. </div>
  57. </el-card>
  58. <el-card shadow="hover" class="p-3 text-white bg-gray-100 bg-opacity-20 border-l-8 border-blue-400">
  59. <div class="flex justify-between items-center mb-2">
  60. <span class="text-blue-300 font-blod">编制人员</span>
  61. </div>
  62. <div class="flex text-sm mt-2">
  63. <span>张三</span>
  64. </div>
  65. </el-card>
  66. </div>
  67. <!-- 图例 -->
  68. <div class="flex items-center text-base mb-2">
  69. <span class="inline-block w-3 h-3 bg-orange-500 rounded-full mr-1"></span>
  70. <span class="mr-4">BB装备</span>
  71. <span class="inline-block w-3 h-3 bg-blue-500 rounded-full mr-1"></span>
  72. <span class="mr-4">选中状态</span>
  73. <span class="inline-block w-3 h-3 bg-purple-500 rounded-full mr-1"></span>
  74. <span class="mr-4">聚类中心</span>
  75. <span class="inline-block w-3 h-3 bg-green-500 rounded-full mr-1"></span>
  76. <span>判别线</span>
  77. </div>
  78. <!-- 网格画布(模拟) -->
  79. <div class="w-full bg-black bg-opacity-20 bg-blue-850 border border-blue-700 flex items-center justify-center" style="min-height: 400px;">
  80. <!--<span class="text-blue-400">网格画布区域(可结合Canvas等实现交互)</span>-->
  81. <!--<img src="@/assets/plan_images/靶标.jpg" class="max-w-full max-h-full object-contain" style="max-height: 500px" />-->
  82. <iframe
  83. src="/CherryMarkdown/CherryMarkdown/drawio_demo.html"
  84. class="border-none"
  85. style="height: 700px;width: 100%"
  86. frameborder="0"
  87. allowfullscreen
  88. ></iframe>
  89. </div>
  90. <div class="text-sm bg-blue-400 bg-opacity-20 rounded-md p-4 mt-2">
  91. 操作提示: 点击BB区位可选中,拖拽可调整位置,双击可查看详情,使用右侧配置区设置参数后点击"生成方案"按钮。
  92. </div>
  93. <!-- 方案信息 -->
  94. <WangEditor
  95. v-model="content"
  96. :height="400"
  97. style="max-width: 1350px"
  98. :disabled="false"
  99. @change="handleContentChange"
  100. />
  101. </div>
  102. </div>
  103. </div>
  104. <!-- 可拖动悬浮球 -->
  105. <div
  106. class="floating-button"
  107. :style="{ top: floatTop + 'px', left: floatLeft + 'px' }"
  108. @mousedown="startDrag"
  109. @click="toggleDrawer"
  110. >
  111. <i class="el-icon-s-opportunity text-2xl"></i>
  112. </div>
  113. <!-- 抽屉组件 -->
  114. <el-drawer
  115. title="AI助手"
  116. :with-header="false"
  117. :z-index="9999999"
  118. :visible.sync="drawerVisible"
  119. :direction="drawerDirection"
  120. style="z-index: 100;color:white;font-size: 16px"
  121. size="40%"
  122. >
  123. <div class="h-full w-full">
  124. <QAChat :messages="qaMessages" @question="handleQuestion" />
  125. </div>
  126. </el-drawer>
  127. </div>
  128. </template>
  129. <script>
  130. import WangEditor from "@/components/Components/WangEditor.vue";
  131. import QAChat from "@/components/Components/QAChat.vue"
  132. export default {
  133. components:{
  134. WangEditor,
  135. QAChat
  136. },
  137. data() {
  138. return {
  139. content:'',
  140. selectedTemplate: null,
  141. templateSearch: '',
  142. templates: [
  143. {
  144. name: '标准模板',
  145. description: '系统默认标准配置',
  146. applicableScenario: '常规试验'
  147. },
  148. {
  149. name: '高密度模板',
  150. description: '高密度部署配置方案',
  151. applicableScenario: '密集目标'
  152. },
  153. {
  154. name: '分散式模板',
  155. description: '大范围分散部署',
  156. applicableScenario: '分散目标'
  157. },
  158. {
  159. name: '自定义模板',
  160. description: '用户自定义配置',
  161. applicableScenario: '特殊需求'
  162. },
  163. {
  164. name: '快速部署模板',
  165. description: '快速临时部署方案',
  166. applicableScenario: '应急测试'
  167. },
  168. {
  169. name: '高精度模板',
  170. description: '高精度测量配置',
  171. applicableScenario: '精密试验'
  172. }
  173. ],
  174. selectedAlgorithm: 'random',
  175. equipmentTypes: [
  176. '陆地模拟蓝军B系统',
  177. '发烟罐模拟蓝军模拟系统',
  178. '无人机蓝军系统',
  179. '大气状态分析仪'
  180. ],
  181. planInfo: [
  182. {
  183. name: 'BB布设方案-001',
  184. createTime: '2024-01-15 14:30',
  185. status: '编制中',
  186. editor: '张三'
  187. }
  188. ],
  189. activeTab: 'random',
  190. randomParams: {
  191. randomCenter: '1,1,1',
  192. randomSeed: '12345',
  193. layoutDensity: 'medium',
  194. minSpacing: 50,
  195. },
  196. // 悬浮球相关
  197. floatTop: 200,
  198. floatLeft: window.innerWidth - 80,
  199. isDragging: false,
  200. startX: 0,
  201. startY: 0,
  202. // 抽屉相关
  203. drawerVisible: false,
  204. drawerDirection: 'rtl', // 从右侧滑出
  205. // 历史记录数据
  206. historyData: [
  207. { time: '2025-08-20 11:05', operation: '创建方案', user: '张三' },
  208. { time: '2025-08-20 11:10', operation: '修改随机参数', user: '张三' },
  209. { time: '2025-08-20 11:15', operation: '保存草稿', user: '张三' }
  210. ]
  211. };
  212. },
  213. computed: {
  214. // 过滤模板数据
  215. filteredTemplates() {
  216. if (!this.templateSearch) {
  217. return this.templates;
  218. }
  219. const searchStr = this.templateSearch.toLowerCase();
  220. return this.templates.filter(template =>
  221. template.name.toLowerCase().includes(searchStr) ||
  222. template.description.toLowerCase().includes(searchStr) ||
  223. template.applicableScenario.toLowerCase().includes(searchStr)
  224. );
  225. }
  226. },
  227. methods: {
  228. handleUse(plan) {
  229. // 执行“使用”逻辑
  230. console.log('正在使用方案:', plan.planName);
  231. // 或:弹出提示
  232. this.$message({
  233. type: 'success',
  234. message: `已应用模板:${plan.name}`
  235. });
  236. },
  237. handleContentChange(html) {
  238. console.log('编辑器内容变化:', html)
  239. // 可以在这里处理内容,如实时保存等
  240. },
  241. back(){
  242. this.$message.success('操作成功')
  243. this.$router.push({ path: '/scheme/collaborative' })
  244. },
  245. // 悬浮球拖动相关方法
  246. startDrag(e) {
  247. // 阻止事件冒泡,避免点击事件触发
  248. e.stopPropagation();
  249. this.isDragging = true;
  250. this.startX = e.clientX;
  251. this.startY = e.clientY;
  252. // 添加鼠标移动和释放事件监听
  253. document.addEventListener('mousemove', this.handleDrag);
  254. document.addEventListener('mouseup', this.stopDrag);
  255. },
  256. handleDrag(e) {
  257. if (!this.isDragging) return;
  258. // 计算移动距离
  259. const deltaX = e.clientX - this.startX;
  260. const deltaY = e.clientY - this.startY;
  261. // 更新位置,限制在窗口内
  262. let newLeft = this.floatLeft + deltaX;
  263. let newTop = this.floatTop + deltaY;
  264. // 限制在窗口范围内
  265. newLeft = Math.max(20, Math.min(newLeft, window.innerWidth - 80));
  266. newTop = Math.max(20, Math.min(newTop, window.innerHeight - 80));
  267. this.floatLeft = newLeft;
  268. this.floatTop = newTop;
  269. // 更新起始位置
  270. this.startX = e.clientX;
  271. this.startY = e.clientY;
  272. },
  273. stopDrag() {
  274. this.isDragging = false;
  275. // 移除事件监听
  276. document.removeEventListener('mousemove', this.handleDrag);
  277. document.removeEventListener('mouseup', this.stopDrag);
  278. },
  279. // 切换抽屉显示/隐藏
  280. toggleDrawer() {
  281. if (!this.isDragging) { // 只有在非拖动状态下才切换抽屉
  282. this.drawerVisible = !this.drawerVisible;
  283. }
  284. }
  285. },
  286. // 监听窗口大小变化,调整悬浮球位置
  287. mounted() {
  288. window.addEventListener('resize', () => {
  289. this.floatLeft = Math.min(this.floatLeft, window.innerWidth - 80);
  290. });
  291. },
  292. beforeDestroy() {
  293. window.removeEventListener('resize', () => {
  294. this.floatLeft = Math.min(this.floatLeft, window.innerWidth - 80);
  295. });
  296. }
  297. };
  298. </script>
  299. <style scoped>
  300. .bb-layout-page {
  301. font-size: 16px;
  302. background-color: #030d1e;
  303. position: relative; /* 确保悬浮球相对于此容器定位 */
  304. min-height: calc(100vh - 64px); /* 减去顶部栏高度 */
  305. }
  306. .el-card {
  307. border-radius: 4px;
  308. }
  309. /* 悬浮球样式 */
  310. .floating-button {
  311. position: fixed;
  312. width: 60px;
  313. height: 60px;
  314. border-radius: 50%;
  315. background-color: #4fc2f7;
  316. color: white;
  317. display: flex;
  318. align-items: center;
  319. justify-content: center;
  320. font-size: 24px;
  321. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  322. cursor: move;
  323. z-index: 1000;
  324. transition: all 0.3s ease;
  325. }
  326. .floating-button:hover {
  327. transform: scale(1.1);
  328. background-color: #3ba8e0;
  329. }
  330. /* 抽屉样式调整 */
  331. ::v-deep .el-drawer__header {
  332. border-bottom: 1px solid #4fc2f7;
  333. padding-bottom: 10px;
  334. margin-bottom: 0px;
  335. }
  336. ::v-deep .el-drawer__body {
  337. padding: 0;
  338. display: flex;
  339. }
  340. ::v-deep .el-card__header {
  341. background-color: rgba(79, 194, 247, 0.1);
  342. border-bottom: 1px solid rgba(79, 194, 247, 0.3);
  343. }
  344. ::v-deep .el-tabs__nav-wrap{
  345. background: #09264c;
  346. }
  347. </style>