MenuCheck.vue 16 KB

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