collaborativeCreate_CL.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722
  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 style="background-color: rgb(22, 45, 85)" class="relative max-w-md mx-auto p-6 bg-opacity-20 backdrop-blur-lg border-gray-50 rounded-xl">
  18. <div class="flex items-center border-blue-400 border-b mb-4">
  19. <h3 class="text-lg font-bold" style="color: #4fc2f7">任务信息</h3>
  20. </div>
  21. <div class="p-4 mb-4 bg-black bg-opacity-20 rounded-md">
  22. <el-card shadow="hover" class="p-3 mb-2 text-white bg-gray-100 bg-opacity-20 border-l-8 border-blue-400">
  23. <div class="flex justify-between items-center mb-2">
  24. <span class="text-blue-300 font-blod">任务名称</span>
  25. </div>
  26. <div class="flex text-sm mt-2">
  27. <span>{{ planInfo.taskName }}</span>
  28. </div>
  29. </el-card>
  30. <el-card shadow="hover" class="p-3 mb-2 text-white bg-gray-100 bg-opacity-20 border-l-8 border-blue-400">
  31. <div class="flex justify-between items-center mb-2">
  32. <span class="text-blue-300 font-blod">任务类型</span>
  33. </div>
  34. <div class="flex text-sm mt-2">
  35. <span>{{ $getDictNameByValue('task_type',planInfo.taskType+'') || "-" }}</span>
  36. </div>
  37. </el-card>
  38. <el-card shadow="hover" class="p-3 mb-2 text-white bg-gray-100 bg-opacity-20 border-l-8 border-blue-400">
  39. <div class="flex justify-between items-center mb-2">
  40. <span class="text-blue-300 font-blod">布设算法</span>
  41. </div>
  42. <div class="flex text-sm mt-2">
  43. <span>{{ activeTab }}</span>
  44. </div>
  45. </el-card>
  46. <el-card shadow="hover" class="p-3 text-white bg-gray-100 bg-opacity-20 border-l-8 border-blue-400">
  47. <div class="flex justify-between items-center mb-2">
  48. <span class="text-blue-300 font-blod">设备数量</span>
  49. </div>
  50. <div class="flex text-sm mt-2">
  51. <span>{{ algorithmParams.eqNumber1 }}</span>
  52. </div>
  53. </el-card>
  54. </div>
  55. <!-- 方案模板 -->
  56. <div class="flex items-center border-blue-400 border-b mb-4">
  57. <h3 class="text-lg font-bold" style="color: #4fc2f7">方案模板</h3>
  58. </div>
  59. <!-- 搜索栏 -->
  60. <div class="mb-4">
  61. <el-input
  62. v-model="templateSearch"
  63. placeholder="搜索模板..."
  64. prefix-icon="el-icon-search"
  65. size="small"
  66. class="bg-gray-800 bg-opacity-50 border-gray-600 text-white"
  67. ></el-input>
  68. </div>
  69. <!-- 模板表格 -->
  70. <el-table
  71. :data="filteredTemplates"
  72. border
  73. size="small"
  74. highlight-current-row
  75. @row-click="selectTemplate"
  76. class="mb-4 bg-gray-800 bg-opacity-30 border-gray-600"
  77. >
  78. <el-table-column
  79. prop="name"
  80. label="模板名称"
  81. width="140"
  82. show-overflow-tooltip
  83. >
  84. </el-table-column>
  85. <el-table-column
  86. prop="description"
  87. show-overflow-tooltip
  88. label="描述">
  89. </el-table-column>
  90. <el-table-column label="操作" width="80" align="center">
  91. <template #default="scope">
  92. <!-- 使用按钮 -->
  93. <el-button
  94. type="primary"
  95. size="small"
  96. @click="handleUse(scope.row)"
  97. >
  98. 应用
  99. </el-button>
  100. </template>
  101. </el-table-column>
  102. </el-table>
  103. <!--<div-->
  104. <!-- class="flex flex-col p-4 mb-4 align-center justify-center rounded-md bg-gray-400 bg-opacity-30 border-none cursor-pointer hover:bg-opacity-40 transition-all">-->
  105. <!-- <span class="flex justify-center mb-2 text-lg font-bold">标准模板</span>-->
  106. <!-- <span class="flex justify-center text-sm">常用于常规试验</span>-->
  107. <!--</div>-->
  108. <!--<div-->
  109. <!-- class="flex flex-col p-4 mb-4 align-center justify-center rounded-md bg-gray-400 bg-opacity-30 border-none cursor-pointer hover:bg-opacity-40 transition-all">-->
  110. <!-- <span class="flex justify-center mb-2 text-lg font-bold">高密度模板</span>-->
  111. <!-- <span class="flex justify-center text-sm">常用于密集目标</span>-->
  112. <!--</div>-->
  113. <!--<div-->
  114. <!-- class="flex flex-col p-4 mb-4 align-center justify-center rounded-md bg-gray-400 bg-opacity-30 border-none cursor-pointer hover:bg-opacity-40 transition-all">-->
  115. <!-- <span class="flex justify-center mb-2 text-lg font-bold">分散式模板</span>-->
  116. <!-- <span class="flex justify-center text-sm">常用于分散目标</span>-->
  117. <!--</div>-->
  118. <!--<div class="flex flex-col p-4 mb-4 align-center justify-center rounded-md bg-gray-400 bg-opacity-30 border-none cursor-pointer hover:bg-opacity-40 transition-all">-->
  119. <!-- <span class="flex justify-center mb-2 text-lg font-bold">自定义模板</span>-->
  120. <!-- <span class="flex justify-center text-sm">手动配置参数</span>-->
  121. <!--</div>-->
  122. <!-- 布设算法 -->
  123. <div class="flex items-center border-blue-400 border-b mb-4">
  124. <h3 class="text-lg font-bold" style="color: #4fc2f7">布设算法</h3>
  125. </div>
  126. <el-tabs type="card" stretch v-model="activeTab" class="mb-6">
  127. <el-tab-pane label="随机布设" name="随机布设">
  128. <div class="bg-gray-400 bg-opacity-30 p-4 rounded">
  129. <h2 class="text-lg font-semibold mb-4">随机布设参数</h2>
  130. <el-form :model="algorithmParams" :disabled="!isEdit" label-width="120px">
  131. <el-form-item label="随机种子">
  132. <el-input v-model="algorithmParams.randomSeed" placeholder="请输入随机种子"></el-input>
  133. </el-form-item>
  134. <el-form-item label="布设密度">
  135. <el-select v-model="algorithmParams.layoutDensity" placeholder="请选择布设密度">
  136. <el-option label="低等密度" value="low"></el-option>
  137. <el-option label="中等密度" value="medium"></el-option>
  138. <el-option label="高等密度" value="high"></el-option>
  139. </el-select>
  140. </el-form-item>
  141. <el-form-item label="最小间距(m)">
  142. <el-input v-model.number="algorithmParams.minSpacing1" placeholder="请输入最小间距"></el-input>
  143. </el-form-item>
  144. <div style="border-top: 1px solid #737877;margin-bottom: 10px"></div>
  145. <el-form-item label="装备数量">
  146. <el-input v-model.number="algorithmParams.eqNumber1"></el-input>
  147. </el-form-item>
  148. <el-form-item label="装备类型">
  149. <el-input v-model="algorithmParams.eqType1"></el-input>
  150. </el-form-item>
  151. </el-form>
  152. </div>
  153. </el-tab-pane>
  154. <el-tab-pane label="网格布设" name="网格布设">
  155. <div class="bg-gray-400 bg-opacity-30 p-4 rounded">
  156. <h2 class="text-lg font-semibold mb-4">网格布设参数</h2>
  157. <!-- 可根据需求添加网格布设相关表单元素 -->
  158. <el-form :model="algorithmParams" :disabled="!isEdit" label-width="120px">
  159. <el-form-item label="布设密度">
  160. <el-select v-model="algorithmParams.layoutDensity2" placeholder="请选择布设密度">
  161. <el-option label="低等密度" value="low"></el-option>
  162. <el-option label="中等密度" value="medium"></el-option>
  163. <el-option label="高等密度" value="high"></el-option>
  164. </el-select>
  165. </el-form-item>
  166. <el-form-item label="网格间距(m)">
  167. <el-input v-model.number="algorithmParams.minSpacing2" ></el-input>
  168. </el-form-item>
  169. <div style="border-top: 1px solid #737877;margin-bottom: 10px"></div>
  170. <el-form-item label="装备数量">
  171. <el-input v-model.number="algorithmParams.eqNumber2" ></el-input>
  172. </el-form-item>
  173. <el-form-item label="装备类型">
  174. <el-input v-model="algorithmParams.eqType2"></el-input>
  175. </el-form-item>
  176. </el-form>
  177. </div>
  178. </el-tab-pane>
  179. <el-tab-pane label="聚类布设" name="聚类布设">
  180. <div class="bg-gray-400 bg-opacity-30 p-4 rounded">
  181. <h2 class="text-lg font-semibold mb-4">聚类布设参数</h2>
  182. <!-- 可根据需求添加聚类布设相关表单元素 -->
  183. <el-form :model="algorithmParams" :disabled="!isEdit" label-width="120px">
  184. <el-form-item label="聚类中心">
  185. <el-input v-model="algorithmParams.randomCenter" placeholder="请输入聚类中心"></el-input>
  186. </el-form-item>
  187. <el-form-item label="聚类半径(m)">
  188. <el-input v-model.number="algorithmParams.minSpacing3" ></el-input>
  189. </el-form-item>
  190. <div style="border-top: 1px solid #737877;margin-bottom: 10px"></div>
  191. <el-form-item label="装备数量">
  192. <el-input v-model.number="algorithmParams.eqNumber3" ></el-input>
  193. </el-form-item>
  194. <el-form-item label="装备类型">
  195. <el-input v-model="algorithmParams.eqType3" ></el-input>
  196. </el-form-item>
  197. </el-form>
  198. </div>
  199. </el-tab-pane>
  200. </el-tabs>
  201. <!--<el-tabs type="card" stretch v-model="activeTab" class="mb-6">-->
  202. <!-- <el-tab-pane label="视场覆盖" name="random">-->
  203. <!-- <div class="bg-gray-400 bg-opacity-30 p-4 rounded">-->
  204. <!-- <h2 class="text-lg font-semibold mb-4">视场覆盖参数</h2>-->
  205. <!-- <el-form :model="randomParams" label-width="120px">-->
  206. <!-- <el-form-item label="随机种子">-->
  207. <!-- <el-input v-model="randomParams.randomSeed" placeholder="请输入随机种子"></el-input>-->
  208. <!-- </el-form-item>-->
  209. <!-- <el-form-item label="布设密度">-->
  210. <!-- <el-select v-model="randomParams.layoutDensity" placeholder="请选择布设密度">-->
  211. <!-- <el-option label="低等密度" value="low"></el-option>-->
  212. <!-- <el-option label="中等密度" value="medium"></el-option>-->
  213. <!-- <el-option label="高等密度" value="high"></el-option>-->
  214. <!-- </el-select>-->
  215. <!-- </el-form-item>-->
  216. <!-- <el-form-item label="最小间距(m)">-->
  217. <!-- <el-input v-model.number="randomParams.minSpacing" placeholder="请输入最小间距"></el-input>-->
  218. <!-- </el-form-item>-->
  219. <!-- </el-form>-->
  220. <!-- </div>-->
  221. <!-- </el-tab-pane>-->
  222. <!-- <el-tab-pane label="路径追踪" name="grid">-->
  223. <!-- <div class="bg-gray-400 bg-opacity-30 p-4 rounded">-->
  224. <!-- <h2 class="text-lg font-semibold mb-4">路径追踪参数</h2>-->
  225. <!-- &lt;!&ndash; 可根据需求添加网格布设相关表单元素 &ndash;&gt;-->
  226. <!-- <el-form :model="randomParams" label-width="120px">-->
  227. <!-- <el-form-item label="布设密度">-->
  228. <!-- <el-select v-model="randomParams.layoutDensity" placeholder="请选择布设密度">-->
  229. <!-- <el-option label="低等密度" value="low"></el-option>-->
  230. <!-- <el-option label="中等密度" value="medium"></el-option>-->
  231. <!-- <el-option label="高等密度" value="high"></el-option>-->
  232. <!-- </el-select>-->
  233. <!-- </el-form-item>-->
  234. <!-- <el-form-item label="网格间距(m)">-->
  235. <!-- <el-input v-model.number="randomParams.minSpacing" placeholder="请输入最小间距"></el-input>-->
  236. <!-- </el-form-item>-->
  237. <!-- </el-form>-->
  238. <!-- </div>-->
  239. <!-- </el-tab-pane>-->
  240. <!-- <el-tab-pane label="多传感器融合布设" name="cluster">-->
  241. <!-- <div class="bg-gray-400 bg-opacity-30 p-4 rounded">-->
  242. <!-- <h2 class="text-lg font-semibold mb-4">多传感器融合布设参数</h2>-->
  243. <!-- &lt;!&ndash; 可根据需求添加聚类布设相关表单元素 &ndash;&gt;-->
  244. <!-- <el-form :model="randomParams" label-width="120px">-->
  245. <!-- <el-form-item label="聚类中心">-->
  246. <!-- <el-input v-model="randomParams.randomCenter" placeholder="请输入聚类中心"></el-input>-->
  247. <!-- </el-form-item>-->
  248. <!-- <el-form-item label="聚类半径(m)">-->
  249. <!-- <el-input v-model.number="randomParams.minSpacing" placeholder="请输入最小间距"></el-input>-->
  250. <!-- </el-form-item>-->
  251. <!-- </el-form>-->
  252. <!-- </div>-->
  253. <!-- </el-tab-pane>-->
  254. <!-- <el-tab-pane label="动态调整" name="auto">-->
  255. <!-- <div class="bg-gray-400 bg-opacity-30 p-4 rounded">-->
  256. <!-- <h2 class="text-lg font-semibold mb-4">动态调整参数</h2>-->
  257. <!-- &lt;!&ndash; 可根据需求添加聚类布设相关表单元素 &ndash;&gt;-->
  258. <!-- <el-form :model="randomParams" label-width="120px">-->
  259. <!-- <el-form-item label="聚类中心">-->
  260. <!-- <el-input v-model="randomParams.randomCenter" placeholder="请输入聚类中心"></el-input>-->
  261. <!-- </el-form-item>-->
  262. <!-- <el-form-item label="聚类半径(m)">-->
  263. <!-- <el-input v-model.number="randomParams.minSpacing" placeholder="请输入最小间距"></el-input>-->
  264. <!-- </el-form-item>-->
  265. <!-- </el-form>-->
  266. <!-- </div>-->
  267. <!-- </el-tab-pane>-->
  268. <!--</el-tabs>-->
  269. <!--&lt;!&ndash; BB装备配置 &ndash;&gt;-->
  270. <!--<el-card class="bg-gray-400 bg-opacity-30 border-none">-->
  271. <!-- <div class="text-lg font-bold mb-2">装备配置</div>-->
  272. <!-- <el-form label-position="top" size="small" label-width="60px">-->
  273. <!-- <el-form-item label="装备数量">-->
  274. <!-- <el-input value="12"></el-input>-->
  275. <!-- </el-form-item>-->
  276. <!-- <el-form-item label="装备类型">-->
  277. <!-- <el-select placeholder="请选择" style="width: 100%">-->
  278. <!-- <el-option-->
  279. <!-- v-for="type in equipmentTypes"-->
  280. <!-- :key="type"-->
  281. <!-- :label="type"-->
  282. <!-- :value="type"-->
  283. <!-- ></el-option>-->
  284. <!-- </el-select>-->
  285. <!-- </el-form-item>-->
  286. <!-- </el-form>-->
  287. <!--</el-card>-->
  288. <!-- 操作控制 -->
  289. <div v-if="isEdit" class="space-y-2 mt-4">
  290. <el-button type="success" size="small" @click="back">完成编制</el-button>
  291. <el-button type="warning" size="small" @click="back">保存草稿</el-button>
  292. <!--<el-button type="danger" size="small" @click="back">清空布设</el-button>-->
  293. </div>
  294. </div>
  295. <!-- 右侧主内容区 -->
  296. <div style="background-color: rgb(22, 45, 85)" class="flex-1 space-y-4 p-6 bg-opacity-20 backdrop-blur-lg border-gray-50 rounded-xl">
  297. <div class="flex items-center mb-4">
  298. <h3 class="text-lg font-bold" style="color: #4fc2f7">方案信息</h3>
  299. </div>
  300. <div class="flex p-4 mb-4 bg-black bg-opacity-20 rounded-md">
  301. <span class="mr-4">{{ schemeInfo.measurementRequirements }}</span>
  302. </div>
  303. <!-- 图例 -->
  304. <div class="flex items-center text-base mb-2">
  305. <span class="inline-block w-3 h-3 bg-orange-500 rounded-full mr-1"></span>
  306. <span class="mr-4">测量装备</span>
  307. <span class="inline-block w-3 h-3 bg-blue-500 rounded-full mr-1"></span>
  308. <span class="mr-4">选中状态</span>
  309. <span class="inline-block w-3 h-3 bg-purple-500 rounded-full mr-1"></span>
  310. <span class="mr-4">聚类中心</span>
  311. <span class="inline-block w-3 h-3 bg-green-500 rounded-full mr-1"></span>
  312. <span>判别线</span>
  313. </div>
  314. <!-- 网格画布(模拟) -->
  315. <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">
  316. <!--<span class="text-blue-400">网格画布区域(可结合Canvas等实现交互)</span>-->
  317. <!--<img src="@/assets/plan_images/观测方案.jpg" class="w-full h-full" />-->
  318. <DrawioEmbed ref="drawioRef" />
  319. <!--<img v-else :src="" class="w-full h-full" />-->
  320. </div>
  321. <!--<div class="text-sm bg-blue-400 bg-opacity-20 rounded-md p-4 mt-2">-->
  322. <!-- 操作提示: 点击BB区位可选中,拖拽可调整位置,双击可查看详情,使用右侧配置区设置参数后点击"生成方案"按钮。-->
  323. <!--</div>-->
  324. <!-- 方案信息 -->
  325. <WangEditor
  326. v-model="content"
  327. :height="400"
  328. style="max-width: 1350px"
  329. :disabled="!isEdit"
  330. @change="handleContentChange"
  331. />
  332. <!-- 筛选框 -->
  333. <div style="margin-bottom: 10px;">
  334. <el-input
  335. v-model="searchKeyword"
  336. placeholder="请输入关键词(装备名称、位置、任务描述)"
  337. clearable
  338. style="width: 300px;"
  339. />
  340. </div>
  341. <!-- 表格 -->
  342. <el-table
  343. :data="filteredZbInfoList"
  344. style="width: 100%"
  345. border
  346. height="400"
  347. :header-cell-style="{ 'text-align': 'center' }"
  348. :cell-style="{ 'text-align': 'center' }"
  349. >
  350. <el-table-column label="序号" width="55" type="index"></el-table-column>
  351. <el-table-column label="装备名称" prop="zbName"></el-table-column>
  352. <el-table-column label="位置" prop="positionDescription">
  353. <template slot-scope="scope">
  354. {{ scope.row.positionDescription ? scope.row.positionDescription : scope.row.equipPositionX + ',' + scope.row.equipPositionY }}
  355. </template>
  356. </el-table-column>
  357. <el-table-column label="任务描述" prop="taskRemark"></el-table-column>
  358. </el-table>
  359. </div>
  360. </div>
  361. </div>
  362. <!-- 可拖动悬浮球 -->
  363. <div
  364. class="floating-button"
  365. :style="{ top: floatTop + 'px', left: floatLeft + 'px' }"
  366. @mousedown="startDrag"
  367. @click="toggleDrawer"
  368. >
  369. <i class="el-icon-s-opportunity text-2xl"></i>
  370. </div>
  371. <!-- 抽屉组件 -->
  372. <el-drawer
  373. title="AI助手"
  374. :with-header="false"
  375. :z-index="9999999"
  376. :visible.sync="drawerVisible"
  377. :direction="drawerDirection"
  378. style="z-index: 100;color:white;font-size: 16px"
  379. size="40%"
  380. >
  381. <div class="h-full w-full">
  382. <QAChat :messages="qaMessages" @question="handleQuestion" />
  383. </div>
  384. </el-drawer>
  385. </div>
  386. </template>
  387. <script>
  388. import WangEditor from "@/components/Components/WangEditor.vue";
  389. import QAChat from "@/components/Components/QAChat.vue"
  390. import DrawioEmbed from "@/components/DrawioEmbed/index.vue";
  391. import {getSynergismScheme, planningSchemeUpdate} from "@/api/planningScheme";
  392. import {getSubPlanZbZbList} from "@/api/subPlanZb";
  393. export default {
  394. components:{
  395. DrawioEmbed,
  396. WangEditor,
  397. QAChat
  398. },
  399. data() {
  400. return {
  401. // 装备表格
  402. zbInfoList: [],
  403. searchKeyword: '', // 搜索关键词
  404. dist:{},
  405. content:'',
  406. selectedTemplate: null,
  407. templateSearch: '',
  408. templates: [
  409. {
  410. name: '标准模板',
  411. description: '系统默认标准配置',
  412. applicableScenario: '常规试验'
  413. },
  414. {
  415. name: '高密度模板',
  416. description: '高密度部署配置方案',
  417. applicableScenario: '密集目标'
  418. },
  419. {
  420. name: '分散式模板',
  421. description: '大范围分散部署',
  422. applicableScenario: '分散目标'
  423. },
  424. {
  425. name: '自定义模板',
  426. description: '用户自定义配置',
  427. applicableScenario: '特殊需求'
  428. },
  429. {
  430. name: '快速部署模板',
  431. description: '快速临时部署方案',
  432. applicableScenario: '应急测试'
  433. },
  434. {
  435. name: '高精度模板',
  436. description: '高精度测量配置',
  437. applicableScenario: '精密试验'
  438. }
  439. ],
  440. equipmentTypes: [
  441. '陆地模拟蓝军B系统',
  442. '发烟罐模拟蓝军模拟系统',
  443. '无人机蓝军系统',
  444. '大气状态分析仪'
  445. ],
  446. planInfo: JSON.parse(this.$route.query.plan),
  447. isEdit:this.$route.query.isEdit === 'true' ? true : false,
  448. activeTab: '随机布设',
  449. algorithmParams: {
  450. randomCenter: '1,1,1',
  451. randomSeed: '12345',
  452. layoutDensity: 'medium',
  453. layoutDensity2: 'medium',
  454. minSpacing1: 50,
  455. minSpacing2: 50,
  456. minSpacing3: 50,
  457. eqNumber1:5,
  458. eqNumber2:5,
  459. eqNumber3:5,
  460. eqType1:'',
  461. eqType2:'',
  462. eqType3:'',
  463. },
  464. // 悬浮球相关
  465. floatTop: 200,
  466. floatLeft: window.innerWidth - 80,
  467. isDragging: false,
  468. startX: 0,
  469. startY: 0,
  470. // 抽屉相关
  471. drawerVisible: false,
  472. drawerDirection: 'rtl', // 从右侧滑出
  473. // 历史记录数据
  474. historyData: [
  475. { time: '2025-08-20 11:05', operation: '创建方案', user: '张三' },
  476. { time: '2025-08-20 11:10', operation: '修改随机参数', user: '张三' },
  477. { time: '2025-08-20 11:15', operation: '保存草稿', user: '张三' }
  478. ],
  479. schemeInfo:{},
  480. };
  481. },
  482. computed: {
  483. filteredZbInfoList() {
  484. const keyword = this.searchKeyword.trim().toLowerCase();
  485. if (!keyword) {
  486. return this.zbInfoList; // 无关键词,显示全部
  487. }
  488. // 在 zbName、positionDescription、taskRemark 中搜索
  489. return this.zbInfoList.filter(item =>
  490. item.zbName?.toLowerCase().includes(keyword) ||
  491. item.positionDescription?.toLowerCase().includes(keyword) ||
  492. item.taskRemark?.toLowerCase().includes(keyword)
  493. );
  494. },
  495. // 过滤模板数据
  496. filteredTemplates() {
  497. if (!this.templateSearch) {
  498. return this.templates;
  499. }
  500. const searchStr = this.templateSearch.toLowerCase();
  501. return this.templates.filter(template =>
  502. template.name.toLowerCase().includes(searchStr) ||
  503. template.description.toLowerCase().includes(searchStr) ||
  504. template.applicableScenario.toLowerCase().includes(searchStr)
  505. );
  506. }
  507. },
  508. methods: {
  509. handleQuestion(){
  510. },
  511. qaMessages(){
  512. },
  513. async fetchData(){
  514. let res = await getSynergismScheme({id:this.planInfo.id,IsDef:this.$route.query.IsDel})
  515. this.schemeInfo = res.data;
  516. if(res.data.schemeContent){
  517. const data = JSON.parse(res.data.schemeContent)
  518. console.log(data)
  519. this.$nextTick(()=>{
  520. this.content = data;
  521. })
  522. }
  523. if (res.data.schemeSubPlan) {
  524. const data = JSON.parse(res.data.schemeSubPlan)
  525. console.log(data)
  526. this.algorithmParams = data.algorithmJson;
  527. this.loadDefaultData(data.xml.xmlData);
  528. }
  529. await getSubPlanZbZbList({schemeId_EQ:this.planInfo.id,pageNo:1,pageSize:9999}).then((res)=>{
  530. this.zbInfoList = res.data.rows
  531. })
  532. },
  533. async loadDefaultData(xml) {
  534. try {
  535. await this.$refs.drawioRef.setData(xml)
  536. console.log('数据加载成功')
  537. } catch (err) {
  538. console.error('加载失败:', err)
  539. }
  540. },
  541. async getXmlData() {
  542. try {
  543. const data = await this.$refs.drawioRef.getData()
  544. console.log('获取数据成功:', data)
  545. return data
  546. } catch (err) {
  547. console.error('获取失败:', err)
  548. }
  549. },
  550. selectTemplate(){
  551. },
  552. handleUse(plan) {
  553. // 执行“使用”逻辑
  554. console.log('正在使用方案:', plan.planName);
  555. // 或:弹出提示
  556. this.$message({
  557. type: 'success',
  558. message: `已应用模板:${plan.name}`
  559. });
  560. },
  561. handleContentChange(html) {
  562. console.log('编辑器内容变化:', html)
  563. // 可以在这里处理内容,如实时保存等
  564. },
  565. async back(){
  566. const xml = await this.getXmlData()
  567. const planJson = JSON.stringify({
  568. algorithmJson:this.algorithmParams, // 布设算法
  569. textJson: this.content, // 富文本
  570. xml: xml
  571. })
  572. await planningSchemeUpdate({id:this.schemeInfo.id,schemeContent:planJson,version:this.schemeInfo.version})
  573. this.$message.success('操作成功')
  574. this.$router.push({ path: '/scheme/collaborative' })
  575. },
  576. // 悬浮球拖动相关方法
  577. startDrag(e) {
  578. // 阻止事件冒泡,避免点击事件触发
  579. e.stopPropagation();
  580. this.isDragging = true;
  581. this.startX = e.clientX;
  582. this.startY = e.clientY;
  583. // 添加鼠标移动和释放事件监听
  584. document.addEventListener('mousemove', this.handleDrag);
  585. document.addEventListener('mouseup', this.stopDrag);
  586. },
  587. handleDrag(e) {
  588. if (!this.isDragging) return;
  589. // 计算移动距离
  590. const deltaX = e.clientX - this.startX;
  591. const deltaY = e.clientY - this.startY;
  592. // 更新位置,限制在窗口内
  593. let newLeft = this.floatLeft + deltaX;
  594. let newTop = this.floatTop + deltaY;
  595. // 限制在窗口范围内
  596. newLeft = Math.max(20, Math.min(newLeft, window.innerWidth - 80));
  597. newTop = Math.max(20, Math.min(newTop, window.innerHeight - 80));
  598. this.floatLeft = newLeft;
  599. this.floatTop = newTop;
  600. // 更新起始位置
  601. this.startX = e.clientX;
  602. this.startY = e.clientY;
  603. },
  604. stopDrag() {
  605. this.isDragging = false;
  606. // 移除事件监听
  607. document.removeEventListener('mousemove', this.handleDrag);
  608. document.removeEventListener('mouseup', this.stopDrag);
  609. },
  610. // 切换抽屉显示/隐藏
  611. toggleDrawer() {
  612. if (!this.isDragging) { // 只有在非拖动状态下才切换抽屉
  613. this.drawerVisible = !this.drawerVisible;
  614. }
  615. }
  616. },
  617. // 监听窗口大小变化,调整悬浮球位置
  618. mounted() {
  619. console.log(this.$route.query.isEdit)
  620. this.fetchData()
  621. window.addEventListener('resize', () => {
  622. this.floatLeft = Math.min(this.floatLeft, window.innerWidth - 80);
  623. });
  624. },
  625. beforeDestroy() {
  626. window.removeEventListener('resize', () => {
  627. this.floatLeft = Math.min(this.floatLeft, window.innerWidth - 80);
  628. });
  629. }
  630. };
  631. </script>
  632. <style scoped>
  633. .bb-layout-page {
  634. font-size: 16px;
  635. background-color: #030d1e;
  636. position: relative; /* 确保悬浮球相对于此容器定位 */
  637. min-height: calc(100vh - 64px); /* 减去顶部栏高度 */
  638. }
  639. .el-card {
  640. border-radius: 4px;
  641. }
  642. /* 悬浮球样式 */
  643. .floating-button {
  644. position: fixed;
  645. width: 60px;
  646. height: 60px;
  647. border-radius: 50%;
  648. background-color: #4fc2f7;
  649. color: white;
  650. display: flex;
  651. align-items: center;
  652. justify-content: center;
  653. font-size: 24px;
  654. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  655. cursor: move;
  656. z-index: 1000;
  657. transition: all 0.3s ease;
  658. }
  659. .floating-button:hover {
  660. transform: scale(1.1);
  661. background-color: #3ba8e0;
  662. }
  663. /* 抽屉样式调整 */
  664. ::v-deep .el-drawer__header {
  665. border-bottom: 1px solid #4fc2f7;
  666. padding-bottom: 10px;
  667. margin-bottom: 0px;
  668. }
  669. ::v-deep .el-drawer__body {
  670. padding: 0;
  671. display: flex;
  672. }
  673. ::v-deep .el-card__header {
  674. background-color: rgba(79, 194, 247, 0.1);
  675. border-bottom: 1px solid rgba(79, 194, 247, 0.3);
  676. }
  677. ::v-deep .el-tabs__nav-wrap{
  678. background: #09264c;
  679. }
  680. </style>