index.vue 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144
  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. });
  853. // 监听连接关闭
  854. sseClient.on('close', () => {
  855. isOption.value = false;
  856. console.log('POST SSE 连接关闭');
  857. });
  858. // 建立连接
  859. sseClient.connect();
  860. };
  861. const initSignatureAndWitInfo = () => {
  862. (data.recorderInfo.length === 0 || !data.recorderInfo) &&
  863. (data.recorderInfo = [...recorderInfoType, recorderInfoType[4]]);
  864. (data.signatureInfo.length === 0 || !data.signatureInfo) &&
  865. Array.from(new Array(signatureInfoNum)).forEach(() => {
  866. data.signatureInfo.push({
  867. unit: "",
  868. job: "",
  869. });
  870. });
  871. (data.witnessInfo.length === 0 || !data.witnessInfo) &&
  872. Array.from(new Array(witnessInfoNum)).forEach(() => {
  873. data.witnessInfo.push({
  874. sex: 0,
  875. birthday: "",
  876. address: "",
  877. });
  878. });
  879. };
  880. onMounted(() => {
  881. // listModels().then((res) => {
  882. // console.log("listModels", res);
  883. // });
  884. initInfo();
  885. });
  886. const addRecorderInfo = () => {
  887. recorderInfoDialogShow.value = false;
  888. if (recorderInfoDialogSelect.value || recorderInfoDialogSelect.value === 0) {
  889. const newCrew = recorderInfoType.find(
  890. (i) => i.type === recorderInfoDialogSelect.value
  891. );
  892. data.recorderInfo.push({
  893. ...newCrew,
  894. job: "",
  895. name: "",
  896. unit: "",
  897. });
  898. // debugger;
  899. }
  900. };
  901. const removeRecorderInfo = async (index) => {
  902. if (await confirm("确定要删除此数据?")) {
  903. data.recorderInfo.splice(index, 1);
  904. }
  905. };
  906. const addSignatureInfo = async () => {
  907. if (await confirm("确定要添加新的现场勘验人员?")) {
  908. data.signatureInfo.push({
  909. unit: "",
  910. job: "",
  911. });
  912. }
  913. };
  914. const removeSignatureInfo = async (index) => {
  915. if (await confirm("确定要删除此数据?")) {
  916. data.signatureInfo.splice(index, 1);
  917. }
  918. };
  919. const addWitnessInfo = async () => {
  920. if (await confirm("确定要添加新的现场勘验见证人?")) {
  921. data.witnessInfo.push({
  922. sex: 0,
  923. birthday: "",
  924. address: "",
  925. });
  926. }
  927. };
  928. const backPageHandler = () => {
  929. router.back();
  930. };
  931. const removeWitnessInfo = async (index) => {
  932. if (await confirm("确定要删除此数据?")) {
  933. data.witnessInfo.splice(index, 1);
  934. }
  935. };
  936. const handleSave = async () => {
  937. console.log("data", data);
  938. for (var k in data) {
  939. if (data && data.hasOwnProperty(k)) {
  940. // console.log("Key is " + k);
  941. if (Array.isArray(data[k])) {
  942. data[k] = data[k].sort((a, b) => a - b);
  943. }
  944. }
  945. }
  946. let inquestFileId = fileId.value == -1 ? "" : fileId.value;
  947. let params = { ...data, caseId: caseId.value, inquestFileId };
  948. const res = await saveCaseInquestInfo(params);
  949. initInfo(res.data.inquestFileId);
  950. console.log("saveCaseInquestInfo", res);
  951. if (fileId.value == -1) {
  952. router.replace({
  953. name: RouteName.records,
  954. params: { caseId: caseId.value, fileId: res.data?.inquestFileId },
  955. });
  956. return;
  957. }
  958. if (res.code === 0) {
  959. ElMessage.success("保存成功!");
  960. }
  961. };
  962. const handleExport = async () => {
  963. let inquestFileId = fileId.value == -1 ? "" : fileId.value;
  964. let params = { ...data, caseId: caseId.value, inquestFileId };
  965. await saveCaseInquestInfo(params);
  966. const res = await exportCaseInquestInfo(fileId.value);
  967. console.log("res", res);
  968. saveAs(res, `勘验笔录.docx`);
  969. };
  970. </script>
  971. <style lang="scss" scoped>
  972. .el-popper {
  973. max-width: 100% !important;
  974. }
  975. .records {
  976. max-width: 1024px;
  977. margin: 0 auto;
  978. padding: 64px 48px;
  979. position: relative;
  980. background: #fff;
  981. .header {
  982. display: flex;
  983. justify-content: flex-endTime;
  984. position: sticky;
  985. top: 10px;
  986. z-index: 1000;
  987. background-color: white;
  988. }
  989. .input {
  990. height: 32px;
  991. line-height: 32px;
  992. margin: 0 8px;
  993. }
  994. .textarea {
  995. margin-right: 8px;
  996. margin-bottom: 20px;
  997. span {
  998. padding: 10px 0;
  999. display: inline-block;
  1000. }
  1001. // margin: 0 8px;
  1002. }
  1003. .line {
  1004. display: inline-flex;
  1005. width: 100%;
  1006. flex-direction: row;
  1007. align-items: center;
  1008. margin-bottom: 24px;
  1009. line-height: 38px;
  1010. span {
  1011. white-space: nowrap;
  1012. }
  1013. }
  1014. }
  1015. .title {
  1016. text-align: center;
  1017. margin-bottom: 30px;
  1018. font-size: 24px;
  1019. color: rgba(0,0,0,0.85);
  1020. line-height: 24px;
  1021. }
  1022. .sub-tit {
  1023. display: inline-block;
  1024. padding-bottom: 20px;
  1025. }
  1026. .info {
  1027. display: block;
  1028. .inner {
  1029. display: flex;
  1030. flex-direction: row;
  1031. width: 100%;
  1032. .input {
  1033. flex: 1;
  1034. }
  1035. .sec {
  1036. flex: 1;
  1037. display: inline-flex;
  1038. align-items: center;
  1039. justify-content: center;
  1040. }
  1041. }
  1042. }
  1043. .witnessInfo {
  1044. background: #f5f5f5;
  1045. padding: 15px;
  1046. margin-top: 20px;
  1047. margin-right: 8px;
  1048. }
  1049. .gap {
  1050. margin: 15px 0;
  1051. }
  1052. .btn-container {
  1053. padding: 20px 0;
  1054. .btn {
  1055. color: #26559b;
  1056. width: 100%;
  1057. &:hover {
  1058. background: #f5f5f5;
  1059. border-color: #dcdfe6;
  1060. }
  1061. }
  1062. }
  1063. .info {
  1064. .del-btn {
  1065. display: none;
  1066. }
  1067. &:hover {
  1068. .del-btn {
  1069. display: block;
  1070. }
  1071. }
  1072. }
  1073. .recordsContent{
  1074. .headertop{
  1075. background: #fff;
  1076. padding: 40px 40px 24px 40px;
  1077. margin-bottom: 20px;
  1078. .headerTitle{
  1079. display: flex;
  1080. font-weight: 400;
  1081. line-height: 32px;
  1082. font-size: 32px;
  1083. color: rgba(0,0,0,0.85);
  1084. text-align: left;
  1085. font-style: normal;
  1086. .edit {
  1087. margin: 0 12px 0 0px;
  1088. padding: 0 12px 0 0px;
  1089. border-right: 1px solid #ECECEC;
  1090. }
  1091. }
  1092. }
  1093. }
  1094. </style>