MenuCheck.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536
  1. <template>
  2. <div class=" bou tablebk">
  3. <div class="common-layout" style="margin: 0">
  4. <el-aside
  5. width="357px"
  6. class="L_aside L_aside1 asideg asidegbg leftbgimg1"
  7. v-show="sendialogVisible"
  8. >
  9. <div class="demo-collapse">
  10. <el-collapse v-model="coolactiveName1" accordion>
  11. <el-collapse-item name="1" class="imgneon">
  12. <template #title>
  13. <el-icon class="iconimg Frame3" fit="contain"></el-icon>
  14. 监测点<el-icon class="header-icon"> </el-icon>
  15. </template>
  16. <div class="l_Dialog">
  17. <div class="classtab">
  18. <div class="asides_content">
  19. <div class="jc_content tablecolor jc_content">
  20. <div class="font12 my_content1">
  21. <div class="btncolor tablefocus bmar">
  22. <el-table :data="tableData" style="width:480px" :max-height="tableHeight"
  23. :highlight-current-row="currentrow" :row-class-name="tableRowClassName"
  24. @row-click="handleDelete($event)"
  25. :header-cell-style="{ 'background': 'rgba(13, 22, 57, 0) ' }">
  26. <template v-slot:empty>
  27. <p>暂无数据</p>
  28. </template>
  29. <el-table-column type="index" label="编号" width="70" />
  30. <!-- <el-table-column prop="chcode" label="监测点编号" width="100" /> -->
  31. <el-table-column prop="chname" label="监测点名称" />
  32. <el-table-column prop="pname" label="所在巷道" />
  33. <el-table-column prop="site" label="相对位置" />
  34. </el-table>
  35. </div>
  36. </div>
  37. <div class="dialog-footer footer_div l_btn">
  38. <div class="footerbtn flex1">
  39. <div class="borderimg"><el-button @click="addsg();sdialog.dianadddialog=true">添加</el-button></div>
  40. </div>
  41. <div class="footerbtn flex1">
  42. <div class="borderimg"><el-button @click="amend()">
  43. 修改
  44. </el-button></div>
  45. </div>
  46. <div class="footerbtn flex1">
  47. <div class="borderimg"><el-button @click="shanchu()">
  48. 删除
  49. </el-button></div>
  50. </div>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. </el-collapse-item>
  57. </el-collapse>
  58. <!-- 删除 -->
  59. <el-dialog v-model="dialogsgdelect" draggable :modal="false" modal-class="summary-dlg" align-center :append-to-body="true" width="400" class="dialog_class bgcolor tianjia">
  60. <template #header="{ titleId, titleClass }">
  61. <div class="my-header ">
  62. <el-image :src="icon" fit="contain"></el-image>
  63. <h4 :id="titleId" :class="titleClass">删除框</h4>
  64. </div>
  65. </template>
  66. <h4 class="delecttitle"> 是否确认删除 <span class="spanclad">{{ zqname }}</span></h4>
  67. <div class="dialog-footer footer_div l_btn">
  68. <div class="footerbtn flex1">
  69. <div class="borderimg"><el-button @click="dialogsgdelect = false">取消</el-button></div>
  70. </div>
  71. <div class="footerbtn flex1">
  72. <div class="borderimg"><el-button @click="fundeledata(); dialogsgdelect = false">
  73. 确定
  74. </el-button></div>
  75. </div>
  76. </div>
  77. </el-dialog>
  78. <!-- 添加 -->
  79. <el-dialog v-model="sdialog.dianadddialog" draggable :modal="false"
  80. modal-class="summary-dlg" align-center :append-to-body="true"
  81. @close="clearvtk"
  82. width="500px" class="dialog_class bgcolor tianjia">
  83. <template #header="{titleId, titleClass }">
  84. <div class="my-header ">
  85. <el-image :src="icon" fit="contain" ></el-image>
  86. <h4 :id="titleId" :class="titleClass">{{add}}</h4>
  87. </div>
  88. </template>
  89. <el-form-item label="监测点编号:" :label-width="formLabelWidth5">
  90. <el-input v-model="source.chcode" maxlength="10" oninput ="value=value.replace(/[^\w\\/]/ig,'')"
  91. class="w-50 m-2"
  92. placeholder="请输入" />
  93. </el-form-item>
  94. <el-form-item label="监测点名称:" :label-width="formLabelWidth5">
  95. <el-input v-model="source.chname"
  96. maxlength="10"
  97. class="w-50 m-2"
  98. placeholder="请输入" />
  99. </el-form-item>
  100. <div class="demo-input-suffix firsttitle magintop guand_1">
  101. <el-form-item label="巷道名称" :label-width="formLabelWidth5">
  102. <el-input v-model="source.selectstr" disabled
  103. class="w-50 m-2 text-disabled"
  104. placeholder="请选择巷道" />
  105. </el-form-item>
  106. <div class="btn2">
  107. <el-button type="primary" @click="fireclick();sdialog.dialogVisiblenode=true">选择巷道</el-button></div>
  108. </div>
  109. <div class="input">
  110. <el-form-item label="相对位置" :label-width="formLabelWidth5">
  111. <el-input-number v-model="source.site" :min="0" :max="1"
  112. :precision="2" :step="0.1"
  113. controls-position="right"
  114. class="w-50 m-2"
  115. placeholder="相对位置"
  116. @change="inputnumberChange"
  117. />
  118. </el-form-item>
  119. </div>
  120. <div class="dialog-footer footer_div l_btn">
  121. <div class="footerbtn flex1"><div class="borderimg"><el-button @click="clearvtk();sdialog.dianadddialog=false">取消</el-button></div></div>
  122. <div class="footerbtn flex1"><div class="borderimg"><el-button @click="addEditaip(); ">
  123. 确定
  124. </el-button></div></div>
  125. </div>
  126. </el-dialog>
  127. <!-- 选择管道 -->
  128. <el-dialog
  129. v-model="sdialog.dialogVisiblenode"
  130. align-center :append-to-body="true"
  131. width="600"
  132. class="dialog_class bgcolor tianjia asideg asidegbg leftbgimg"
  133. >
  134. <template #header="{titleId, titleClass }">
  135. <div class="my-header ">
  136. <el-image :src="icon" fit="contain" ></el-image>
  137. <h4 :id="titleId" :class="titleClass"> 选择巷道</h4>
  138. </div>
  139. </template>
  140. <div class="demo-input-suffix firsttitle leftbgimg2 my_content1">
  141. <div class="guand_1">
  142. <el-form-item label="巷道选择" :label-width="formLabelWidth5">
  143. <el-input v-model="searchtaggd"
  144. class="w-50 m-2"
  145. placeholder="巷道"
  146. />
  147. </el-form-item>
  148. <div class="asdis_btn">
  149. <div class="flex_a"><div class="btns" @click="searchgd"><span class="spantext">搜索</span></div></div>
  150. </div>
  151. </div>
  152. <el-table
  153. :row-class-name="tableRowClassName"
  154. :max-height="tableHeight"
  155. ref="multipleTableRef"
  156. :data="tableData2"
  157. style="width: 100%"
  158. @select="projectsSelectionSelect"
  159. :header-cell-style="{'background':'rgba(13, 22, 57, 0) '}"
  160. >
  161. <template v-slot:empty>
  162. <p>暂无数据</p>
  163. </template>
  164. <el-table-column type="selection" width="55" />
  165. <!-- <el-table-column property="snId" label="开始节点"/>
  166. <el-table-column property="enId" label="结束节点"/> -->
  167. <el-table-column property="id" label="编号" width="70"/>
  168. <el-table-column property="name" label="名称" width="70"/>
  169. <el-table-column property="sectionType" label="截面类型" width="120"/>
  170. <el-table-column property="roughCoe" label="粗糙系数"/>
  171. <!-- <el-table-column property="sectionPara1" label="截面参数1" width="90"/>
  172. <el-table-column property="sectionPara2" label="截面参数2" width="90" />
  173. <el-table-column property="sectionPara3" label="截面参数3" width="90"/>
  174. <el-table-column property="sectionPara4" label="截面参数4" width="90"/>
  175. <el-table-column property="sectionPara5" label="截面参数5" width="90"/> -->
  176. </el-table>
  177. <div class="demo-pagination-block" style="margin-top: 20px;">
  178. <el-config-provider :locale="zhCn">
  179. <el-pagination
  180. v-model:current-page="currentPage4"
  181. v-model:page-size="pageSize4"
  182. small
  183. background
  184. layout="prev, total,pager, next, jumpe,"
  185. :total="parseInt(total)"
  186. class="mt-4"
  187. @current-change="handleCurrentChange"
  188. />
  189. </el-config-provider>
  190. </div>
  191. <div class="dialog-footer footer_div l_btn">
  192. <div class="footerbtn flex1"><div class="borderimg"><el-button @click="sdialog.dialogVisiblenode = false">取消</el-button></div></div>
  193. <div class="footerbtn flex1"><div class="borderimg"><el-button @click="queding();sdialog.dialogVisiblenode = false">
  194. 确定
  195. </el-button></div></div>
  196. </div>
  197. </div>
  198. </el-dialog>
  199. </div>
  200. </el-aside>
  201. </div>
  202. </div>
  203. </template>
  204. <script setup>
  205. import { computed, ref, onMounted, reactive, toRef } from "vue";
  206. import { request, uploadFile } from "@/utils/request";
  207. import { ElMessage, ElButton, ElDialog, ElSelect,ElConfigProvider } from 'element-plus'
  208. import { message } from '@/utils/message';
  209. import zhCn from 'element-plus/es/locale/lang/zh-cn'
  210. import icon from "@/assets/img/icon.png";
  211. import { timestampToTime } from '@/js/lindex.js'
  212. import { vtkmodel } from "@/control/vtkModel.js";
  213. import emitter from "@/utils/emitter";
  214. let sendialogVisible = ref(false);
  215. let currentrow=ref(true);
  216. let addVisible = ref(false);
  217. let dialogsgdelect = ref(false)
  218. let classradio1 = ref('Fire');
  219. const formLabelWidth6 = ref(100);
  220. const formLabelWidth5=ref(90);
  221. const multipleTableRef = ref()
  222. const multipleSelection = ref([])
  223. let tishi=ref();
  224. let add = ref("");
  225. let tableData2=ref([]);
  226. let sdialog=ref({
  227. dianadddialog:false,
  228. dialogVisiblenode:false,
  229. })
  230. // const statusMap = {
  231. // 'CIRCULAR': '圆形',
  232. // 'RECTANGLE': '矩形',
  233. // 'SEMICIRCULAR': '半椭圆形',
  234. // 'SEMIELLIPTICAL': '半圆形',
  235. // 'EGG': '蛋形',
  236. // 'GOTHIC': '哥特形',
  237. // 'MODBASKETHANDLE': '更正蓝形',
  238. // 'ARCH': '拱形',
  239. // 'RECT_ROUND': '弧底矩形',
  240. // 'BASKETHANDLE': '蓝形',
  241. // 'HORSESHOE': '马蹄形',
  242. // 'RECT_TRIANGULAR': '三角底矩形',
  243. // 'VERT_ELLIPSE': '竖向椭圆',
  244. // 'HORZI_ELLIPSE': '水平椭圆',
  245. // 'CATENARY': '悬链式',
  246. // };
  247. const statusMap = {
  248. 'halfarch_1': '1-1断面',
  249. 'halfarch_2': '2-2断面',
  250. 'halfarch_3': '3-3断面',
  251. 'halfarch_4': '4-4断面',
  252. 'halfarch_5': '5-5断面',
  253. 'halfarch_6': '6-6断面',
  254. 'halfarch_7': '7-7断面',
  255. 'halfarch_8': '8-8断面',
  256. 'section9': '9-9断面',
  257. 'section10': '10-10断面',
  258. 'halfarch_11': '11-11断面',
  259. 'halfarch_12': '12-12断面',
  260. 'halfarch_13': '13-13断面',
  261. 'halfarch_14': '14-14断面',
  262. 'halfarch_15': '15-15断面',
  263. 'halfarch_16': '16-16断面',
  264. 'halfarch_17': '17-17断面',
  265. 'halfarch_18': '18-18断面',
  266. 'halfarch_19': '19-19断面',
  267. 'halfarch_20': '20-20断面',
  268. };
  269. let coolactiveName1 = ref(["1", "2"]);
  270. let total = ref(1);
  271. let searchtaggd = ref("");
  272. const currentPage4 = ref(1);
  273. const pageSize4 = ref(5)
  274. let cid=ref("");
  275. let source=ref({
  276. selectstr:'',
  277. site:0,
  278. chname:'',
  279. chcode:''
  280. })
  281. let firepid=ref("")
  282. const resultactiveName = ref("first");
  283. let tableHeight = ref(200);
  284. let tableData = ref([]);
  285. let tableobj = ref({});
  286. let zqname = ref();
  287. let senobj = ref({
  288. pid: 0,
  289. seid: 0,
  290. site: 0,
  291. type: "温度传感器"
  292. })
  293. const tableRowClassName = ({ row, rowIndex }) => {
  294. if (rowIndex % 2 != 0) {
  295. return 'evenRow';
  296. }
  297. return 'oddRow';
  298. }
  299. // 选中一行
  300. const handleDelete = (val) => {
  301. currentrow.value=true;
  302. tableobj.value = val;
  303. cid.value=val.cid
  304. console.log( tableobj.value );
  305. // vtkmodel.clearJgAddMode();
  306. vtkmodel.delAll();
  307. vtkmodel.selectByJCId(val.cid)
  308. }
  309. // 删除
  310. const shanchu = () => {
  311. if (JSON.stringify(tableobj.value) == '{}') {
  312. message.error("你还没有选中删除的项目")
  313. } else {
  314. zqname.value = tableobj.value.chname;
  315. dialogsgdelect.value = true;
  316. }
  317. }
  318. const fundeledata=()=>{
  319. const params = {
  320. transCode: 'D10006',
  321. cid: cid.value
  322. }
  323. request(params)
  324. .then((res) => {
  325. message.success({
  326. message: '删除监测点成功'
  327. })
  328. getsensor();
  329. // 更新vtk模型
  330. emitter.emit("RefreshVtkmodel")
  331. })
  332. .catch((err) => {
  333. message.error(err.returnMsg)
  334. console.error('报错',err)
  335. })
  336. }
  337. onMounted(() => {
  338. getsensor();
  339. });
  340. // 查询
  341. const getsensor = () => {
  342. const params = {
  343. transCode: 'D10004',
  344. }
  345. request(params)
  346. .then((res) => {
  347. tableData.value = res.rows;
  348. tableobj.value={};
  349. })
  350. .catch((err) => {
  351. message.error(err.returnMsg)
  352. })
  353. }
  354. //添加
  355. const addsg = () => {
  356. add.value = "添加";
  357. tishi.value=add.value;
  358. addVisible.value = true;
  359. currentrow.value=false;
  360. source.value.selectstr='';
  361. source.value.site=0;
  362. source.value.chname='';
  363. source.value.chcode='';
  364. firepid.value='';
  365. cid.value='';
  366. tableobj.value={};
  367. vtkmodel.delAll();
  368. }
  369. // 添加修改的接口
  370. const addEditaip=()=>{
  371. const params = {
  372. transCode: 'D10005',
  373. cid:cid.value,
  374. pid:firepid.value,
  375. site:source.value.site,
  376. chname:source.value.chname,
  377. chcode:source.value.chcode
  378. }
  379. request(params)
  380. .then((res) => {
  381. sdialog.value.dianadddialog=false;
  382. message.success({
  383. message: tishi.value+'监测点成功'
  384. })
  385. tableData.value = res.rows;
  386. getsensor();
  387. clearvtk();
  388. // 更新vtk模型
  389. emitter.emit("RefreshVtkmodel")
  390. })
  391. .catch((err) => {
  392. // const regex = /字段\d*/g;
  393. // let Msg=err.returnMsg.replace(regex, '');
  394. // message.error(Msg)
  395. console.error('报错',err)
  396. })
  397. }
  398. //修改
  399. const amend = () => {
  400. add.value = "修改";
  401. tishi.value=add.value;
  402. if (JSON.stringify(tableobj.value) == '{}') {
  403. message.error("你还没有选中修改的项目")
  404. } else {
  405. sdialog.value.dianadddialog= true;
  406. cid.value = tableobj.value.cid;
  407. source.value.chname = tableobj.value.chname;
  408. source.value.chcode = tableobj.value.chcode;
  409. source.value.site = tableobj.value.site;
  410. source.value.selectstr=tableobj.value.pname;
  411. firepid.value=tableobj.value.pid;
  412. vtkmodel.clearJgAddMode();
  413. //选中指定管道
  414. vtkmodel.selectByPipeId(tableobj.value.pid);
  415. vtkmodel.addpipjc(tableobj.value.pid, tableobj.value.site);
  416. }
  417. }
  418. // 选择巷道
  419. const fireclick = () => {
  420. searchtaggd.value='';
  421. pipelinedata('');
  422. }
  423. // 节点搜索
  424. function searchgd() {
  425. pipelinedata(searchtaggd.value);
  426. }
  427. // 节点分页查询
  428. const handleCurrentChange = (val) => {
  429. pipelinedata(searchtaggd.value)
  430. }
  431. //节点数据查询
  432. const pipelinedata = (searchtag) => {
  433. const params = {
  434. transCode: 'D00001',
  435. count: pageSize4.value,
  436. page: currentPage4.value,
  437. searchtag: searchtag,
  438. }
  439. request(params)
  440. .then((res) => {
  441. tableData2.value = res.rows.map(item => {
  442. return {
  443. ...item,
  444. sectionType: statusMap[item.sectionType] || '未知' // 如果状态不存在,默认设置为'未知'
  445. };
  446. });
  447. total.value = res.total;
  448. })
  449. .catch((err) => {
  450. message.error(err.returnMsg)
  451. })
  452. }
  453. //选中项
  454. const projectsSelectionSelect=(selection, row)=>{
  455. if(selection.length>1){
  456. multipleTableRef.value.clearSelection();
  457. multipleTableRef.value.toggleRowSelection(row,true);
  458. let arrp=[];
  459. arrp.push(selection[1])
  460. multipleSelection.value = arrp;
  461. return;
  462. }
  463. if(selection.length==1){
  464. multipleSelection.value=selection;
  465. }else if(selection.length==0){
  466. }
  467. }
  468. const selectfun=()=>{
  469. source.value.selectstr='';
  470. currentPage4.value=1;
  471. // console.log("选中项",multipleSelection.value)
  472. if(multipleSelection.value.length!=0){
  473. firepid.value=multipleSelection.value[0].id;
  474. source.value.selectstr=multipleSelection.value[0].name;
  475. console.log(multipleSelection.value[0])
  476. tableobj.value.pid = multipleSelection.value[0].id;
  477. vtkmodel.clearJgAddMode();
  478. //选中指定管道
  479. vtkmodel.selectByPipeId(multipleSelection.value[0].id);
  480. vtkmodel.addpipjc(multipleSelection.value[0].id,source.value.site || 0.0);
  481. }else{
  482. // selectstr.value='';
  483. }
  484. }
  485. // 确定
  486. const queding=()=>{
  487. selectfun();
  488. }
  489. const inputnumberChange = (val) => {
  490. console.log("tableobj.value",tableobj.value)
  491. vtkmodel.addpipjc(tableobj.value.pid, val);
  492. }
  493. const clearvtk = () => {
  494. vtkmodel.clearpipjc();
  495. vtkmodel.selectNoting();
  496. }
  497. defineExpose({ sendialogVisible, });
  498. </script>