index.vue 33 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148
  1. <template>
  2. <div class="recordsContent">
  3. <div class="headertop flex justify-between" style="align-items: center">
  4. <div class="header left flex content-center" style="align-items: center;flex-direction: row-reverse">
  5. <div class="headerTitle">
  6. <div
  7. class="edit"
  8. style="white-space: nowrap; text-overflow: ellipsis"
  9. >
  10. 勘 验 笔 录
  11. </div>
  12. <div class="span" :title="caseInfo.caseTitle">
  13. {{ caseInfo.caseTitle }}
  14. </div>
  15. </div>
  16. <!-- <el-icon style="margin: 0 40px" size="40px"><Download /></el-icon> -->
  17. <el-icon title="返回" style="margin-right: 10px; cursor: pointer;" size="24px" @click="backPageHandler"><ArrowLeftBold /></el-icon>
  18. <!-- <el-button @click="backPageHandler">返回</el-button>
  19. <el-button style="margin: 0px 10px" type="primary" @click="handleSave"
  20. >保存</el-button
  21. >
  22. <el-button :disabled="isDisableExport" @click="handleExport"
  23. >导出</el-button
  24. > -->
  25. </div>
  26. <div class="headerRight flex" style="align-items: center">
  27. <div
  28. @click="handleShowAi"
  29. style="
  30. color: #26559b;
  31. cursor: pointer;
  32. font-size: 24px;
  33. font-weight: bold;
  34. margin-right: 20px;
  35. "
  36. >AI</div
  37. >
  38. <el-icon title="下载" v-if="!isDisableExport" @click="handleExport" style="cursor: pointer; margin: 0 40px" size="24px"><Download /></el-icon>
  39. <el-button style="margin: 0px 10px 0px 0px" type="primary" @click="handleSave"
  40. >保存</el-button
  41. >
  42. </div>
  43. </div>
  44. <div class="records">
  45. <h3 class="title">现 场 勘 验 笔 录</h3>
  46. <div class="content">
  47. <div class="line" style="flex-direction: row-reverse">
  48. <el-input
  49. class="input"
  50. v-model="data.inquestNum"
  51. placeholder=""
  52. style="width: 280px"
  53. />
  54. <span>现场勘验号:</span>
  55. </div>
  56. <div class="line">
  57. <span>现场勘验单位:</span>
  58. <el-input
  59. class="input"
  60. v-model="data.deptName"
  61. placeholder=""
  62. style="width: 100%"
  63. />
  64. </div>
  65. <div class="line">
  66. <span>指派/报告单位:</span>
  67. <el-input
  68. class="input"
  69. v-model="data.reportDept"
  70. placeholder=""
  71. style="width: 100%"
  72. />
  73. </div>
  74. <div class="line">
  75. <span>勘验时间: &nbsp; </span>
  76. <div>
  77. <el-date-picker
  78. class="input"
  79. v-model="data.inquestTime"
  80. type="datetime"
  81. placeholder="勘验时间"
  82. value-format="YYYY-MM-DD HH:mm:ss"
  83. style="width: 200px"
  84. />
  85. </div>
  86. </div>
  87. <div class="textarea">
  88. <span>勘验事由: </span>
  89. <el-input
  90. type="textarea"
  91. :rows="6"
  92. v-model="data.inquestResource"
  93. placeholder="报警人:xxx(性别:xxx 电话:xxx)报警称:xxx发生一起:xxx案,现场需勘察。接报后技术科科长:xxx带领技术员:xxx、法医:xxx立即赶赴现场进行勘察."
  94. style="width: 100%"
  95. />
  96. </div>
  97. <div class="line">
  98. <span>现场勘验时间: &nbsp; </span>
  99. <div>
  100. <el-date-picker
  101. class="input"
  102. v-model="data.times"
  103. type="datetimerange"
  104. range-separator="至"
  105. start-placeholder="现场勘验开始时间"
  106. end-placeholder="现场勘验结束时间"
  107. />
  108. </div>
  109. </div>
  110. <div class="line">
  111. <span>现场地点:</span>
  112. <el-input
  113. class="input"
  114. type="text"
  115. v-model="data.address"
  116. placeholder=""
  117. style="width: 100%"
  118. />
  119. </div>
  120. <div class="line">
  121. <span>现场保护情况:</span>
  122. <el-input
  123. class="input"
  124. type="text"
  125. v-model="data.protectionSituation"
  126. placeholder=""
  127. style="width: 100%"
  128. />
  129. </div>
  130. <div class="line">
  131. <span>现场保护人: &nbsp;&nbsp; &nbsp;</span>
  132. <span>姓名</span>
  133. <!-- 单位 XX派出所 职务 一级警长 -->
  134. <el-input
  135. class="input"
  136. type="text"
  137. v-model="data.protector.name"
  138. placeholder=""
  139. style="width: 180px"
  140. />
  141. <span>单位</span>
  142. <el-input
  143. class="input"
  144. type="text"
  145. v-model="data.protector.unit"
  146. placeholder=""
  147. style="width: 200px"
  148. />
  149. <span>职务</span>
  150. <el-input
  151. class="input"
  152. type="text"
  153. v-model="data.protector.job"
  154. placeholder=""
  155. style="width: 200px"
  156. />
  157. </div>
  158. <!-- protectionMeasures -->
  159. <div class="line">
  160. <span>保护措施:&nbsp; </span>
  161. <el-checkbox-group v-model="data.protectionMeasures">
  162. <el-checkbox :value="0" label="专人看护现场,防止他人进入" />
  163. <el-checkbox :value="1" checked label="设立警戒带,划定禁行区域" />
  164. <el-checkbox :value="2" label="其他措施" />
  165. </el-checkbox-group>
  166. </div>
  167. <div class="line">
  168. <span>现场情况: &nbsp; </span>
  169. <el-checkbox-group v-model="data.situation">
  170. <el-checkbox :value="0" label="原始现场" />
  171. <el-checkbox :value="1" checked label="变动现场" />
  172. </el-checkbox-group>
  173. </div>
  174. <!-- changeReason -->
  175. <div class="line">
  176. <span>变动原因: &nbsp; </span>
  177. <el-checkbox-group v-model="data.changeReason">
  178. <el-checkbox
  179. v-for="reason in ChangeReasonType"
  180. :value="reason.id"
  181. :label="reason.name"
  182. >
  183. </el-checkbox>
  184. <!-- <el-checkbox :value="0" label="事主进入" />
  185. <el-checkbox :value="1" label="报案人进入" />
  186. <el-checkbox :value="2" label="其他" /> -->
  187. </el-checkbox-group>
  188. <el-input
  189. class="input"
  190. v-model="data.changeReasonOtherValue"
  191. :disabled="!data.changeReason.includes(2)"
  192. style="margin-left: 20px; width: 200px"
  193. />
  194. </div>
  195. <div class="line">
  196. <span>天气: &nbsp; </span>
  197. <el-checkbox-group v-model="data.weatherInfo.type">
  198. <el-checkbox :value="0" label="阴" />
  199. <el-checkbox :value="1" label="晴" />
  200. <el-checkbox :value="2" label="雨" />
  201. <el-checkbox :value="3" label="雾" />
  202. </el-checkbox-group>
  203. <span style="margin-left: 20px; font-size: 12px">温度: &nbsp;</span>
  204. <el-input
  205. class="input"
  206. v-model="data.weatherInfo.temperature"
  207. style="width: 80px"
  208. /><span>℃</span>
  209. <span style="margin-left: 20px; font-size: 12px">湿度: &nbsp;</span>
  210. <el-input
  211. class="input"
  212. v-model="data.weatherInfo.humidity"
  213. style="width: 80px"
  214. /><span>%</span>
  215. <span style="margin-left: 20px; font-size: 12px">风向: &nbsp;</span>
  216. <el-input
  217. class="input"
  218. v-model="data.weatherInfo.windDirection"
  219. style="width: 80px"
  220. />
  221. </div>
  222. <div class="line">
  223. <span>现场勘验利用的光线: &nbsp; </span>
  224. <el-checkbox-group v-model="data.light">
  225. <el-checkbox :value="0" checked label="自然光" />
  226. <el-checkbox :value="1" checked label="灯光" />
  227. <el-checkbox :value="2" label="特种光" />
  228. </el-checkbox-group>
  229. </div>
  230. <div class="line">
  231. <span>现场勘验指挥人: &nbsp;&nbsp; </span>
  232. <span>姓名</span>
  233. <!-- 单位 XX派出所 职务 一级警长 -->
  234. <el-input
  235. class="input"
  236. type="text"
  237. v-model="data.inquestCommander.name"
  238. placeholder=""
  239. style="width: 180px"
  240. />
  241. <span>单位</span>
  242. <el-input
  243. class="input"
  244. type="text"
  245. v-model="data.inquestCommander.unit"
  246. placeholder=""
  247. style="width: 200px"
  248. />
  249. <span>职务</span>
  250. <el-input
  251. class="input"
  252. type="text"
  253. v-model="data.inquestCommander.job"
  254. placeholder=""
  255. style="width: 200px"
  256. />
  257. </div>
  258. <div class="textarea">
  259. <div>
  260. <span>现场勘验情况 :</span>
  261. <!-- <span @click="handleShowAi" style="color:#26559B;cursor: pointer;float: right;font-weight: bold;">AI</span> -->
  262. </div>
  263. <el-input
  264. type="textarea"
  265. :rows="6"
  266. v-model="data.inquestSituation"
  267. placeholder=""
  268. style="width: 100%"
  269. />
  270. </div>
  271. <div class="line">
  272. <span>现场勘验制图&nbsp; </span>
  273. <el-input-number
  274. class="input"
  275. controls-position="right"
  276. v-model="data.imageNum"
  277. style="width: 130px"
  278. />
  279. <span>张; &nbsp;&nbsp;</span>
  280. <span>照相</span>
  281. <el-input-number
  282. class="input"
  283. controls-position="right"
  284. v-model="data.photographNum"
  285. style="width: 130px"
  286. />
  287. <span>张;&nbsp;&nbsp;</span>
  288. <span>摄像</span>
  289. <el-input-number
  290. class="input"
  291. controls-position="right"
  292. v-model="data.photographyMinNum"
  293. style="width: 130px"
  294. />
  295. <span>分</span>
  296. <el-input-number
  297. class="input"
  298. controls-position="right"
  299. v-model="data.photographySecNum"
  300. style="width: 130px"
  301. />
  302. <span>秒</span>
  303. <span style="margin-left: 10px">录音</span>
  304. <el-input-number
  305. class="input"
  306. controls-position="right"
  307. v-model="data.recordingMinNum"
  308. style="width: 130px"
  309. />
  310. <span>分</span>
  311. <el-input-number
  312. class="input"
  313. controls-position="right"
  314. v-model="data.recordingSecNum"
  315. style="width: 130px"
  316. />
  317. <span>秒</span>
  318. </div>
  319. <div class="line">
  320. 现场勘验记录人员:
  321. <el-button link @click="recorderInfoDialogShow = true"
  322. ><el-icon :size="18"><CirclePlus /> </el-icon>
  323. </el-button>
  324. </div>
  325. <!-- 现场勘验记录人员 -->
  326. <template v-for="(info, index) in data.recorderInfo">
  327. <div class="line info">
  328. <span>{{ info.typeLabel }}: &nbsp;&nbsp; </span>
  329. <span>姓名</span>
  330. <!-- 单位 XX派出所 职务 一级警长 -->
  331. <el-input
  332. class="input"
  333. type="text"
  334. v-model="info.name"
  335. placeholder=""
  336. style="width: 180px"
  337. />
  338. <span>单位</span>
  339. <el-input
  340. class="input"
  341. type="text"
  342. v-model="info.unit"
  343. placeholder=""
  344. style="width: 200px"
  345. />
  346. <span>职务</span>
  347. <el-input
  348. class="input"
  349. type="text"
  350. v-model="info.job"
  351. placeholder=""
  352. style="width: 200px"
  353. />
  354. <el-button
  355. link
  356. class="del-btn"
  357. type="danger"
  358. @click="removeRecorderInfo(index)"
  359. ><el-icon :size="18"><CircleClose /> </el-icon>
  360. </el-button>
  361. </div>
  362. </template>
  363. <div class="line">
  364. 现场勘验人员:
  365. <el-button link @click="addSignatureInfo"
  366. ><el-icon :size="18"><CirclePlus /> </el-icon>
  367. </el-button>
  368. </div>
  369. <template v-for="(sign, index) of data.signatureInfo">
  370. <div class="line info">
  371. <span>本人签名: &nbsp;&nbsp; </span>
  372. <span>_______________ &nbsp;&nbsp;</span>
  373. <span>单位</span>
  374. <el-input
  375. class="input"
  376. type="text"
  377. v-model="sign.unit"
  378. placeholder=""
  379. style="width: 200px"
  380. />
  381. <span>职务</span>
  382. <el-input
  383. class="input"
  384. type="text"
  385. v-model="sign.job"
  386. placeholder=""
  387. style="width: 200px"
  388. />
  389. <el-button
  390. class="del-btn"
  391. link
  392. type="danger"
  393. @click="removeSignatureInfo(index)"
  394. ><el-icon :size="18"><CircleClose /> </el-icon>
  395. </el-button>
  396. </div>
  397. </template>
  398. <div class="line">
  399. 现场勘验见证人:
  400. <el-button link @click="addWitnessInfo"
  401. ><el-icon :size="18"><CirclePlus /> </el-icon>
  402. </el-button>
  403. </div>
  404. <template v-for="(witness, index) of data.witnessInfo">
  405. <div class="line info">
  406. <span>本人签名: &nbsp;&nbsp; </span>
  407. <span>_______________ &nbsp;&nbsp;</span>
  408. <span>性别</span>
  409. <el-select
  410. class="input"
  411. v-model="witness.sex"
  412. placeholder="性别"
  413. style="width: 140px"
  414. >
  415. <el-option :value="0" label="男" />
  416. <el-option :value="1" label="女" />
  417. </el-select>
  418. <span>出生日期</span>
  419. <el-date-picker
  420. class="input"
  421. v-model="witness.birthday"
  422. type="date"
  423. placeholder="出生日期"
  424. style="width: 180px"
  425. />
  426. <!-- <el-input
  427. class="input"
  428. type="text"
  429. v-model="witness.birthday"
  430. placeholder=""
  431. style="width: 200px"
  432. /> -->
  433. <span>住址</span>
  434. <el-input
  435. class="input"
  436. type="text"
  437. v-model="witness.address"
  438. placeholder=""
  439. style="width: 260px"
  440. />
  441. <el-button
  442. link
  443. class="del-btn"
  444. type="danger"
  445. @click="removeWitnessInfo(index)"
  446. ><el-icon :size="18"><CircleClose /> </el-icon>
  447. </el-button>
  448. </div>
  449. </template>
  450. <div class="textarea">
  451. <span>备注:</span>
  452. <el-input
  453. type="textarea"
  454. :rows="6"
  455. v-model="data.remark"
  456. placeholder=""
  457. style="width: 100%"
  458. />
  459. </div>
  460. <div></div>
  461. </div>
  462. <el-dialog
  463. v-model="recorderInfoDialogShow"
  464. title="增加现场勘验记录人员"
  465. width="500"
  466. align-center
  467. @close="recorderInfoDialogSelect = null"
  468. >
  469. <div
  470. class="border"
  471. style="
  472. width: 500px;
  473. height: 1px;
  474. margin-bottom: 20px;
  475. border-bottom: none;
  476. position: relative;
  477. left: -16px;
  478. "
  479. ></div>
  480. <div style="width: 80%; margin: 30px auto">
  481. <el-select
  482. v-model="recorderInfoDialogSelect"
  483. placeholder="请选择现场勘验记录人员"
  484. size="large"
  485. >
  486. <el-option
  487. v-for="item in recorderInfoType"
  488. :key="item.type"
  489. :label="item.typeLabel"
  490. :value="item.type"
  491. />
  492. </el-select>
  493. </div>
  494. <template #footer>
  495. <div class="dialog-footer">
  496. <el-button type="primary" @click="addRecorderInfo">
  497. 确定
  498. </el-button>
  499. </div>
  500. </template>
  501. </el-dialog>
  502. <el-dialog
  503. v-model="aiImgShow"
  504. title="AI识别平面图"
  505. width="1300px"
  506. align-center
  507. @close="aiImgData.result = null"
  508. >
  509. <div
  510. class="border"
  511. style="
  512. width: 1300px;
  513. height: 1px;
  514. margin-bottom: 20px;
  515. border-bottom: none;
  516. position: relative;
  517. left: -16px;
  518. "
  519. ></div>
  520. <div
  521. class="flex space-x-4 items-center content-center justify-center text-center"
  522. >
  523. <div class="flex-1" style="width: 80%">
  524. <el-select
  525. v-model="aiImgData.src"
  526. placeholder="请选择平面图"
  527. :disabled="isOption"
  528. style="display: block"
  529. @change="handleSelect"
  530. size="large"
  531. >
  532. <el-option
  533. v-for="item in aiImgData.list"
  534. :key="item.num"
  535. :label="item.title"
  536. :value="item.url"
  537. />
  538. </el-select>
  539. <div
  540. class="viewImg mt-4 text-center"
  541. style="
  542. height: 400px;
  543. line-height: 400px;
  544. border-radius: 0px 0px 0px 0px;
  545. border: 1px solid #d9d9d9;
  546. "
  547. >
  548. <img
  549. class="w-full h-full object-cover"
  550. v-if="aiImgData.src"
  551. :src="aiImgData.src"
  552. alt=""
  553. />
  554. <span v-else>预览选中的平面图</span>
  555. </div>
  556. </div>
  557. <div
  558. class="flex-1 text-center content-start"
  559. style="
  560. border-radius: 0px 0px 0px 0px;
  561. border: 1px solid #d9d9d9;
  562. min-height: 450px;
  563. "
  564. >
  565. <span style="line-height: 450px" v-if="aiImgData.loading"
  566. >识别中,请稍后...</span
  567. >
  568. <span style="line-height: 450px" v-else-if="!aiImgData.result"
  569. >请点击【识别】获取结果</span
  570. >
  571. <div
  572. class="text-left"
  573. style="
  574. height: 450px;
  575. padding: 10px;
  576. overflow: auto;
  577. white-space: pre-wrap;
  578. "
  579. v-else
  580. v-html="aiImgData.result"
  581. ></div>
  582. </div>
  583. </div>
  584. <template #footer>
  585. <div class="dialog-footer text-center flex">
  586. <div style="width: 50%">
  587. <el-button
  588. type="primary"
  589. :disabled="isOption || !aiImgData.src || aiImgData.loading"
  590. @click="handleAI"
  591. >
  592. 识别
  593. </el-button>
  594. </div>
  595. <div style="width: 50%">
  596. <el-button
  597. :disabled="isOption || !aiImgData.result"
  598. @click="handleCopy"
  599. >
  600. 复制
  601. </el-button>
  602. </div>
  603. </div>
  604. </template>
  605. </el-dialog>
  606. </div>
  607. </div>
  608. </template>
  609. <script setup>
  610. import { onMounted, ref, watch, h, computed } from "vue";
  611. import { reactive } from "vue";
  612. import { router, RouteName } from "@/router";
  613. import {
  614. getCaseInquestInfo,
  615. saveCaseInquestInfo,
  616. exportCaseInquestInfo,
  617. getCaseInquestInfoOld,
  618. getAiByImage,
  619. getCaseInfoData,
  620. getFloorList,
  621. } from "@/store/case";
  622. import { ElMessage, ElMessageBox } from "element-plus";
  623. import saveAs from "@/util/file-serve";
  624. import { CirclePlus, CircleClose, MagicStick, Download } from "@element-plus/icons-vue";
  625. import { recorderInfoType, ChangeReasonType } from "./formData.ts";
  626. import { confirm } from "@/helper/message";
  627. import { chat, abort, listModels } from "@/util/ollama";
  628. import { createSSEPostClient } from "@/util/ssePost";
  629. import { copyTextToClipboard } from "@/util/index";
  630. const props = defineProps({ caseId: Number, title: String });
  631. let sseClient = null;
  632. console.log("router.currentRoute", router.currentRoute.value?.params);
  633. const fileId = computed(() => router.currentRoute.value?.params?.fileId);
  634. const caseId = computed(() => router.currentRoute.value?.params?.caseId);
  635. const isDisableExport = ref(false);
  636. const aiImgShow = ref(false);
  637. const isOption = ref(false);
  638. const aiImgData = ref({
  639. src: "",
  640. Aisrc: "",
  641. result: ``,
  642. loading: false,
  643. list: [],
  644. });
  645. const caseInfo = computed(() => getCaseInfoData());
  646. const messages = ref([])
  647. const isConnected = ref();
  648. const data = reactive({
  649. title: "",
  650. inquestNum: "", //现场勘验号
  651. deptName: "", //单位名称
  652. sendDept: "", //发送单位
  653. issuanceCount: "", // 份数
  654. makeTime: "", //制作时间
  655. recorder: "", // 笔录人
  656. issuanceOpinion: "", //签发意见
  657. reportDept: "", //报告单位
  658. times: [], // startTime ,endTime
  659. address: "", // 勘验地址
  660. inquestTime: "", //勘验时间
  661. inquestResource:
  662. "x年x月x日x单位接到报警称;x年x月x日x地点发生一起什么案事件,需要勘验现场, 接通知后,技术员xx,xx前往现场考察", //勘验范围
  663. protector: {
  664. name: "",
  665. unit: "",
  666. job: "",
  667. }, // 现场保护人
  668. protectionSituation: "", // 现场保护情况
  669. situation: [], //现场情况
  670. changeReason: [],
  671. changeReasonOtherValue: "",
  672. protectionMeasures: [], //保护措施
  673. weatherInfo: {
  674. type: [],
  675. temperature: "",
  676. humidity: "",
  677. windDirection: "",
  678. }, //天气情况
  679. light: [], //光线
  680. painter: "",
  681. photographer: "",
  682. inquestCommander: {
  683. name: "",
  684. unit: "",
  685. job: "",
  686. }, //现场勘验指挥人
  687. inquestSituation:
  688. "案发现场以XXX小区为中心,东侧为XXX路,西侧是XXX街,北侧为XXX路,南侧是XXX路。", //现场勘验情况
  689. imageNum: 0, //现场勘验制图数量
  690. photographNum: 0, //照相数量
  691. photographyMinNum: 0, //摄影数量
  692. photographySecNum: 0, //摄影数量
  693. recordingMinNum: "",
  694. recordingSecNum: "",
  695. recorderInfo: JSON.parse(JSON.stringify(recorderInfoType)),
  696. signatureInfo: [], //现场勘验人员
  697. witnessInfo: [],
  698. remark: "",
  699. });
  700. const signatureInfoNum = 4;
  701. const witnessInfoNum = 2;
  702. const recorderInfoDialogShow = ref(false);
  703. const recorderInfoDialogSelect = ref();
  704. const initInfo = async (inquestFileId) => {
  705. const res = await getCaseInquestInfoOld(inquestFileId || fileId.value);
  706. console.log("initInfo", res);
  707. if (!res.data) {
  708. isDisableExport.value = true;
  709. } else {
  710. isDisableExport.value = false;
  711. }
  712. for (var k in data) {
  713. if (res.data && res.data.hasOwnProperty(k)) {
  714. // console.log("Key is " + k);
  715. if (res.data[k]) {
  716. data[k] = res.data[k];
  717. }
  718. }
  719. }
  720. console.log("data", data, res.data);
  721. setTimeout(() => {
  722. initSignatureAndWitInfo();
  723. }, 500);
  724. };
  725. const handleCopy = () => {
  726. copyTextToClipboard(aiImgData.value.result);
  727. ElMessage.success("复制成功!");
  728. };
  729. const handleShowAi = async () => {
  730. const list = await getFloorList(caseId.value);
  731. aiImgData.value.list = list.filter((i) => i.url);
  732. aiImgData.value.src = aiImgData.value.src
  733. ? aiImgData.value.src
  734. : list[0]?.url;
  735. aiImgData.value.Aisrc = list[0]?.freeSpaceUrl
  736. aiImgData.value.loading = false;
  737. aiImgShow.value = true;
  738. isOption.value = false;
  739. };
  740. //判断是否deepseek
  741. let isThink = ref(false);
  742. let testRegex = /deepseek/;
  743. const handleAI = async () => {
  744. aiImgData.value.loading = true;
  745. aiImgData.value.result = "";
  746. isOption.value = true;
  747. // const item = aiImgData.value.list.find((i) => i.url == aiImgData.value.src);
  748. initSSE(aiImgData.value.Aisrc || aiImgData.value.src)
  749. // try {
  750. // const res = await getAiByImage({imageUrl: imageUrl})
  751. // chat("", item.params + item.paramContent).then(async (stream) => {
  752. // if (!aiImgShow.value) {
  753. // abort();
  754. // }
  755. // for await (const part of stream) {
  756. // // chatHistory.value.at(idx).text += part.message.content;
  757. // let tep_mesg = part.message.content;
  758. // console.log("isThinktep", tep_mesg);
  759. // //判断是否是deepseek模型
  760. // // if (testRegex.test(agentInfo.value.model)) {
  761. // if (tep_mesg == "\u003c/think\u003e") {
  762. // // isThink.value = true;
  763. // aiImgData.value.loading = false;
  764. // }
  765. // if (!aiImgData.value.loading) {
  766. // //清除think
  767. // if (
  768. // tep_mesg == "\u003cthink\u003e" ||
  769. // tep_mesg == "\u003c/think\u003e"
  770. // ) {
  771. // // chatHistory.value.at(idx).think += "";
  772. // } else {
  773. // console.log("isThinktep_mesg", tep_mesg);
  774. // aiImgData.value.result += tep_mesg;
  775. // // chatHistory.value.at(idx).think += tep_mesg;
  776. // }
  777. // //如果结尾标签则停止拼接
  778. // if (tep_mesg == "\u003c/think\u003e") {
  779. // // isThink.value = false;
  780. // }
  781. // } else {
  782. // // aiImgData.value.result += tep_mesg;
  783. // // chatHistory.value.at(idx).text += tep_mesg;
  784. // }
  785. // // } else {
  786. // // // chatHistory.value.at(idx).text += tep_mesg;
  787. // // aiImgData.value.result += tep_mesg;
  788. // // }
  789. // // autoScrollSwitch.value && scrollToBottom(true);
  790. // }
  791. // isOption.value = false;
  792. // console.log("handleAI完成", aiImgData.value.result);
  793. // });
  794. // // console.log("handleAI", res)
  795. // // aiImgData.value.result = res
  796. // // aiImgData.value.loading = false
  797. // } catch (error) {
  798. // console.log("handleAI", error);
  799. // aiImgData.value.loading = false;
  800. // }
  801. };
  802. const handleSelect = (val, itme) => {
  803. aiImgData.value.result = false;
  804. aiImgData.value.result = ''
  805. }
  806. const initSSE = (url) => {
  807. // 销毁旧连接(避免重复连接)
  808. if (sseClient) {
  809. sseClient.close();
  810. }
  811. sseClient = createSSEPostClient({
  812. // headers: {
  813. // Authorization: `Bearer ${localStorage.getItem('token')}`, // 认证 Token
  814. // },
  815. body: {
  816. "inputs": {
  817. "img": {
  818. "type": "image",
  819. "transfer_method": "remote_url",
  820. "url": window.location.origin + url
  821. }
  822. },
  823. "response_mode": "streaming",
  824. "user": "web-4dage"
  825. }
  826. });
  827. // 监听连接成功
  828. sseClient.on('open', () => {
  829. isConnected.value = true;
  830. console.log('POST SSE 连接成功');
  831. });
  832. // 监听默认消息事件(服务器未指定 event 时)
  833. sseClient.on('message', ({data, outputs}) => {
  834. console.log('message连接成功', data);
  835. if(data && data.text){
  836. aiImgData.value.result += data.text
  837. }
  838. if(outputs && outputs.text){
  839. aiImgData.value.result = outputs.text
  840. }
  841. aiImgData.value.loading = false
  842. });
  843. // // 监听自定义事件(服务器指定 event: customEvent)
  844. // sseClient.on('customEvent', (data) => {
  845. // messages.value.push({ type: '自定义事件', data });
  846. // });
  847. // 监听错误
  848. sseClient.on('error', (err) => {
  849. isOption.value = false;
  850. messages.value.push({ type: '错误', data: err.message });
  851. console.error('POST SSE 错误:', err);
  852. ElMessage.error("AI服务未开通,该功能暂不可用");
  853. aiImgData.value.loading = false
  854. aiImgData.value.result = false;
  855. aiImgData.value.result = ''
  856. });
  857. // 监听连接关闭
  858. sseClient.on('close', () => {
  859. isOption.value = false;
  860. console.log('POST SSE 连接关闭');
  861. });
  862. // 建立连接
  863. sseClient.connect();
  864. };
  865. const initSignatureAndWitInfo = () => {
  866. (data.recorderInfo.length === 0 || !data.recorderInfo) &&
  867. (data.recorderInfo = [...recorderInfoType, recorderInfoType[4]]);
  868. (data.signatureInfo.length === 0 || !data.signatureInfo) &&
  869. Array.from(new Array(signatureInfoNum)).forEach(() => {
  870. data.signatureInfo.push({
  871. unit: "",
  872. job: "",
  873. });
  874. });
  875. (data.witnessInfo.length === 0 || !data.witnessInfo) &&
  876. Array.from(new Array(witnessInfoNum)).forEach(() => {
  877. data.witnessInfo.push({
  878. sex: 0,
  879. birthday: "",
  880. address: "",
  881. });
  882. });
  883. };
  884. onMounted(() => {
  885. // listModels().then((res) => {
  886. // console.log("listModels", res);
  887. // });
  888. initInfo();
  889. });
  890. const addRecorderInfo = () => {
  891. recorderInfoDialogShow.value = false;
  892. if (recorderInfoDialogSelect.value || recorderInfoDialogSelect.value === 0) {
  893. const newCrew = recorderInfoType.find(
  894. (i) => i.type === recorderInfoDialogSelect.value
  895. );
  896. data.recorderInfo.push({
  897. ...newCrew,
  898. job: "",
  899. name: "",
  900. unit: "",
  901. });
  902. // debugger;
  903. }
  904. };
  905. const removeRecorderInfo = async (index) => {
  906. if (await confirm("确定要删除此数据?")) {
  907. data.recorderInfo.splice(index, 1);
  908. }
  909. };
  910. const addSignatureInfo = async () => {
  911. if (await confirm("确定要添加新的现场勘验人员?")) {
  912. data.signatureInfo.push({
  913. unit: "",
  914. job: "",
  915. });
  916. }
  917. };
  918. const removeSignatureInfo = async (index) => {
  919. if (await confirm("确定要删除此数据?")) {
  920. data.signatureInfo.splice(index, 1);
  921. }
  922. };
  923. const addWitnessInfo = async () => {
  924. if (await confirm("确定要添加新的现场勘验见证人?")) {
  925. data.witnessInfo.push({
  926. sex: 0,
  927. birthday: "",
  928. address: "",
  929. });
  930. }
  931. };
  932. const backPageHandler = () => {
  933. router.back();
  934. };
  935. const removeWitnessInfo = async (index) => {
  936. if (await confirm("确定要删除此数据?")) {
  937. data.witnessInfo.splice(index, 1);
  938. }
  939. };
  940. const handleSave = async () => {
  941. console.log("data", data);
  942. for (var k in data) {
  943. if (data && data.hasOwnProperty(k)) {
  944. // console.log("Key is " + k);
  945. if (Array.isArray(data[k])) {
  946. data[k] = data[k].sort((a, b) => a - b);
  947. }
  948. }
  949. }
  950. let inquestFileId = fileId.value == -1 ? "" : fileId.value;
  951. let params = { ...data, caseId: caseId.value, inquestFileId };
  952. const res = await saveCaseInquestInfo(params);
  953. initInfo(res.data.inquestFileId);
  954. console.log("saveCaseInquestInfo", res);
  955. if (fileId.value == -1) {
  956. router.replace({
  957. name: RouteName.records,
  958. params: { caseId: caseId.value, fileId: res.data?.inquestFileId },
  959. });
  960. return;
  961. }
  962. if (res.code === 0) {
  963. ElMessage.success("保存成功!");
  964. }
  965. };
  966. const handleExport = async () => {
  967. let inquestFileId = fileId.value == -1 ? "" : fileId.value;
  968. let params = { ...data, caseId: caseId.value, inquestFileId };
  969. await saveCaseInquestInfo(params);
  970. const res = await exportCaseInquestInfo(fileId.value);
  971. console.log("res", res);
  972. saveAs(res, `勘验笔录.docx`);
  973. };
  974. </script>
  975. <style lang="scss" scoped>
  976. .el-popper {
  977. max-width: 100% !important;
  978. }
  979. .records {
  980. max-width: 1024px;
  981. margin: 0 auto;
  982. padding: 64px 48px;
  983. position: relative;
  984. background: #fff;
  985. .header {
  986. display: flex;
  987. justify-content: flex-endTime;
  988. position: sticky;
  989. top: 10px;
  990. z-index: 1000;
  991. background-color: white;
  992. }
  993. .input {
  994. height: 32px;
  995. line-height: 32px;
  996. margin: 0 8px;
  997. }
  998. .textarea {
  999. margin-right: 8px;
  1000. margin-bottom: 20px;
  1001. span {
  1002. padding: 10px 0;
  1003. display: inline-block;
  1004. }
  1005. // margin: 0 8px;
  1006. }
  1007. .line {
  1008. display: inline-flex;
  1009. width: 100%;
  1010. flex-direction: row;
  1011. align-items: center;
  1012. margin-bottom: 24px;
  1013. line-height: 38px;
  1014. span {
  1015. white-space: nowrap;
  1016. }
  1017. }
  1018. }
  1019. .title {
  1020. text-align: center;
  1021. margin-bottom: 30px;
  1022. font-size: 24px;
  1023. color: rgba(0,0,0,0.85);
  1024. line-height: 24px;
  1025. }
  1026. .sub-tit {
  1027. display: inline-block;
  1028. padding-bottom: 20px;
  1029. }
  1030. .info {
  1031. display: block;
  1032. .inner {
  1033. display: flex;
  1034. flex-direction: row;
  1035. width: 100%;
  1036. .input {
  1037. flex: 1;
  1038. }
  1039. .sec {
  1040. flex: 1;
  1041. display: inline-flex;
  1042. align-items: center;
  1043. justify-content: center;
  1044. }
  1045. }
  1046. }
  1047. .witnessInfo {
  1048. background: #f5f5f5;
  1049. padding: 15px;
  1050. margin-top: 20px;
  1051. margin-right: 8px;
  1052. }
  1053. .gap {
  1054. margin: 15px 0;
  1055. }
  1056. .btn-container {
  1057. padding: 20px 0;
  1058. .btn {
  1059. color: #26559b;
  1060. width: 100%;
  1061. &:hover {
  1062. background: #f5f5f5;
  1063. border-color: #dcdfe6;
  1064. }
  1065. }
  1066. }
  1067. .info {
  1068. .del-btn {
  1069. display: none;
  1070. }
  1071. &:hover {
  1072. .del-btn {
  1073. display: block;
  1074. }
  1075. }
  1076. }
  1077. .recordsContent{
  1078. .headertop{
  1079. background: #fff;
  1080. padding: 40px 40px 24px 40px;
  1081. margin-bottom: 20px;
  1082. .headerTitle{
  1083. display: flex;
  1084. font-weight: 400;
  1085. line-height: 32px;
  1086. font-size: 32px;
  1087. color: rgba(0,0,0,0.85);
  1088. text-align: left;
  1089. font-style: normal;
  1090. .edit {
  1091. margin: 0 12px 0 0px;
  1092. padding: 0 12px 0 0px;
  1093. border-right: 1px solid #ECECEC;
  1094. }
  1095. }
  1096. }
  1097. }
  1098. </style>