index.vue 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916
  1. <!--
  2. * @Title:
  3. * @Description:
  4. * @Author: swp
  5. * @Date: 2022-08-24 10:49:21
  6. * @LastEditors:
  7. * @LastEditTime: 2022-08-24 10:49:21
  8. -->
  9. <template>
  10. <div>
  11. <el-row>
  12. <el-col :span="4">
  13. <div class="box">
  14. <el-scrollbar>
  15. <basic-container>
  16. <avue-tree :option="treeOption" :data="treeData" @node-click="nodeClick">
  17. <span class="el-tree-node__label" slot-scope="{ node, data }">
  18. <span>
  19. <i class="el-icon-office-building"></i>
  20. {{ (node || {}).label }}
  21. </span>
  22. </span>
  23. </avue-tree>
  24. </basic-container>
  25. </el-scrollbar>
  26. </div>
  27. </el-col>
  28. <el-col :span="20">
  29. <basic-container>
  30. <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page"
  31. :before-open="beforeOpen" ref="crud" v-model="form" :permission="permissionList" @row-del="rowDel"
  32. @row-update="rowUpdate" @row-save="rowSave" @search-change="searchChange"
  33. @search-reset="searchReset" @selection-change="selectionChange" @current-change="currentChange"
  34. @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad"
  35. @before-open="beforeOpen" @select-change="selectChange">
  36. <!-- <template slot-scope="scope" slot="menuLeft">
  37. <el-button v-if="permissionList.importBtn" type="primary" icon="el-icon-upload2" size="small"
  38. @click="toRtuImpoartHandler">导入测站</el-button>
  39. <el-button v-if="permissionList.importBtn" type="primary" icon="el-icon-finished" size="small"
  40. @click="toRtuImportHistoryHandler">测站导入历史</el-button>
  41. <el-button v-if="permissionList.importBtn" type="primary" icon="el-icon-download" size="small"
  42. @click="downloadTemplate">测站信息模板下载</el-button> -->
  43. <!-- <el-button v-if="permissionList.videoSiteAdd" type="primary" icon="el-icon-plus" size="small"
  44. @click="toAddVideoSite">添加视频站</el-button> -->
  45. <!-- </template> -->
  46. <template slot-scope="{ row, index }" slot="menu">
  47. <el-button type="text" size="small" icon="el-icon-link" @click="toBindProject(row)">项目绑定
  48. </el-button>
  49. </template>
  50. </avue-crud>
  51. </basic-container>
  52. </el-col>
  53. </el-row>
  54. <!-- <el-drawer :visible.sync="rtuImportHistoryDialog" v-if="rtuImportHistoryDialog" title="测站导入操作记录" direction="rtl"
  55. size="60%" append-to-body="true">
  56. <rtuImportHistoryView ref="rtuImportHistoryView"></rtuImportHistoryView>
  57. </el-drawer>
  58. <el-dialog title="测站导入向导" :visible.sync="rtuImportDialog" width="60%" height="60%" :close-on-click-modal="false"
  59. append-to-body :v-loading="importLoading" v-if="rtuImportDialog">
  60. <rtuImportView :importLoading="importLoading" :visible.sync="rtuImportDialog" ref="rtuImportView">
  61. </rtuImportView>
  62. </el-dialog> -->
  63. <!-- <el-dialog title="添加视频站" :visible.sync="videoSiteAddDialog" width="60%" height="60%" :close-on-click-modal="false"
  64. append-to-body :v-loading="importLoading" v-if="videoSiteAddDialog">
  65. <videositeadd :importLoading="importLoading" :visible.sync="videoSiteAddDialog" ref="videositeadd"
  66. @fevent="update_table">
  67. </videositeadd>
  68. </el-dialog> -->
  69. <el-dialog title="项目配置" :visible.sync="bindProjectDialog" v-if="bindProjectDialog" width="600px"
  70. :before-close="handleClose" :close-on-click-modal="false" append-to-body>
  71. <avue-form :option="bindProjectOption" v-model="bindProjectEditForm" @submit="bindProjectSubmit"
  72. @reset-change="bindProjectReset"></avue-form>
  73. <!-- <el-form label-width="120px">
  74. <el-form-item label="预警总开关">
  75. <el-switch v-model="warningConfig.configSw" active-color="#13ce66" inactive-color="#ff4949"
  76. active-text="开" inactive-text="关">
  77. </el-switch>
  78. </el-form-item>
  79. <el-form-item label="延时配置">
  80. <el-input placeholder="请输入延时时长" v-model="warningConfig.delayTime">
  81. <template slot="append">单位分钟</template>
  82. </el-input>
  83. </el-form-item>
  84. <el-form-item label="">
  85. <label>延时时长用于测站离线预警监测,当超过配置的时长时触发预警,默认2小时</label>
  86. </el-form-item>
  87. </el-form>
  88. <span slot="footer" class="dialog-footer">
  89. <el-button @click="bindProjectDialog = false" size="small">取 消</el-button>
  90. <el-button type="primary" @click="bindProjectOkClick" size="small">确 定</el-button>
  91. </span> -->
  92. </el-dialog>
  93. </div>
  94. </template>
  95. <script>
  96. import { getPage, getDetail, add, update, remove, bindProject } from "@/api/baseinfo/rtu.js";
  97. import { getTree } from "@/api/baseinfo/project.js";
  98. // import { getTree } from "@/api/baseinfo/region.js";
  99. // import { getStore } from '@/util/store.js';
  100. import { mapGetters } from "vuex";
  101. // import rtuImportHistoryView from './rtuimport.vue';
  102. // import rtuImportView from './rtuImportProcess.vue';
  103. // import videositeadd from './videositeadd.vue';
  104. export default {
  105. components: {
  106. // rtuImportView,
  107. // rtuImportHistoryView,
  108. // videositeadd
  109. },
  110. data() {
  111. return {
  112. importLoading: false,
  113. rtuImportDialog: false,
  114. rtuImportHistoryDialog: false,
  115. videoSiteAddDialog: false,
  116. id: "",
  117. post_code: '0',
  118. form: {},
  119. selectionList: [],
  120. query: {},
  121. loading: true,
  122. page: {
  123. pageSize: 10,
  124. currentPage: 1,
  125. total: 0,
  126. },
  127. bindProjectEditForm: {
  128. id: '',
  129. projectId: ''
  130. },
  131. bindProjectOption: {
  132. column: [
  133. {
  134. label: '所属项目',
  135. prop: 'projectId',
  136. type: 'select',
  137. span: 24,
  138. props: {
  139. label: 'projectName',
  140. value: 'id'
  141. },
  142. dicUrl: 'api/galaxy-business/base/project/org/list',
  143. rules: [
  144. {
  145. required: true,
  146. message: "请选择项目",
  147. trigger: "click",
  148. },
  149. ],
  150. }
  151. ]
  152. },
  153. bindProjectDialog: false,
  154. treeCode: '',
  155. treeParentCode: '',
  156. treeData: [],
  157. treeOption: {
  158. nodeKey: "id",
  159. defaultExpandedKeys: [],
  160. lazy: false,
  161. // treeLoad: function (node, resolve) {
  162. // const parentCode = (node.level === 0) ? "00" : node.data.value;
  163. // getLazyTree(parentCode).then(res => {
  164. // resolve(res.data.data.map(item => {
  165. // return {
  166. // ...item,
  167. // leaf: !item.hasChildren
  168. // }
  169. // }))
  170. // });
  171. // },
  172. addBtn: false,
  173. menu: true,
  174. size: "small",
  175. props: {
  176. labelText: "标题",
  177. label: "title",
  178. value: "value",
  179. children: "children",
  180. },
  181. },
  182. option: {
  183. labelWidth: 140,
  184. viewLabelWidth: 140,
  185. searchLabelWidth: 140,
  186. height: "auto",
  187. calcHeight: 80,
  188. align: "center",
  189. headerAlign: "center",
  190. lazy: false,
  191. tip: false,
  192. simplePage: true,
  193. searchShow: true,
  194. searchMenuSpan: 6,
  195. tree: true,
  196. border: true,
  197. index: true,
  198. selection: false,
  199. viewBtn: true,
  200. viewTitle: "测站信息",
  201. editBtn: true,
  202. delBtn: true,
  203. addBtn: true,
  204. addBtnText: "添加测站",
  205. menuWidth: 220,
  206. dialogType: "drawer",
  207. dialogClickModal: false,
  208. columnBtn: false,
  209. column: [
  210. {
  211. label: "站点编码",
  212. prop: "rtuCode",
  213. search: true,
  214. span: 24,
  215. width: 120,
  216. // tip: '*编码仅支持字母+数字的编码组合,长度为20个字符',
  217. rules: [
  218. {
  219. required: true,
  220. message: "请录入站点编码",
  221. trigger: "click",
  222. },
  223. ],
  224. },
  225. {
  226. label: "站点名称",
  227. prop: "rtuName",
  228. search: true,
  229. span: 24,
  230. rules: [
  231. {
  232. required: true,
  233. message: "请录入站点名称",
  234. trigger: "click",
  235. },
  236. ],
  237. },
  238. // {
  239. // label: "测站类型",
  240. // prop: "rtuKindDesc",
  241. // span: 24,
  242. // editDisplay: false,
  243. // addDisplay: false,
  244. // display: false,
  245. // },
  246. // {
  247. // label: '测站类型',
  248. // prop: 'rtuKind',
  249. // type: 'select',
  250. // hide: true,
  251. // editDisplay: false,
  252. // addDisplay: false,
  253. // display: false,
  254. // search: true,
  255. // props: {
  256. // label: 'name',
  257. // value: 'code'
  258. // },
  259. // span: 6,
  260. // dicData: [{
  261. // name: '雨量站',
  262. // code: 1
  263. // }, {
  264. // name: '水位站',
  265. // code: 2
  266. // }, {
  267. // name: '墒情站',
  268. // code: 3
  269. // }, {
  270. // name: '视频站',
  271. // code: 4
  272. // }],
  273. // },
  274. // {
  275. // label: '测站类型',
  276. // prop: 'siteKind',
  277. // type: 'checkbox',
  278. // hide: true,
  279. // props: {
  280. // label: 'name',
  281. // value: 'code'
  282. // },
  283. // span: 24,
  284. // dicData: [{
  285. // name: '雨量站',
  286. // code: "1"
  287. // }, {
  288. // name: '河道水位站',
  289. // code: "2"
  290. // }, {
  291. // name: '水库水位站',
  292. // code: "3"
  293. // }, {
  294. // name: '墒情站',
  295. // code: "4"
  296. // }, {
  297. // name: '视频站',
  298. // code: "5"
  299. // }],
  300. // rules: [
  301. // {
  302. // message: "请选择站点类型",
  303. // trigger: "click",
  304. // required: true,
  305. // },
  306. // ],
  307. // },
  308. // {
  309. // label: "盟市",
  310. // prop: "adCity",
  311. // span: 24,
  312. // editDisplay: false,
  313. // addDisplay: false,
  314. // },
  315. // {
  316. // label: "盟市",
  317. // prop: "adCityCode",
  318. // span: 24,
  319. // hide: true,
  320. // type: 'select',
  321. // props: {
  322. // label: 'adnm',
  323. // value: 'adcd'
  324. // },
  325. // cascader: ['adCode'],
  326. // dicUrl: `api/galaxy-business/baseinfo/region/children/list`,
  327. // rules: [
  328. // {
  329. // required: true,
  330. // message: "请录入盟市名称",
  331. // trigger: "click",
  332. // },
  333. // ],
  334. // },
  335. // {
  336. // label: "旗县区",
  337. // prop: "adDist",
  338. // span: 24,
  339. // editDisplay: false,
  340. // addDisplay: false,
  341. // },
  342. // {
  343. // label: "旗县区",
  344. // prop: "adCode",
  345. // span: 24,
  346. // hide: true,
  347. // type: 'select',
  348. // props: {
  349. // label: 'adnm',
  350. // value: 'adcd'
  351. // },
  352. // dicUrl: `api/galaxy-business/baseinfo/region/children/list/{{adCityCode}}`,
  353. // rules: [
  354. // {
  355. // required: true,
  356. // message: "请录入旗县区",
  357. // trigger: "click",
  358. // },
  359. // ],
  360. // },
  361. // {
  362. // label: "运维单位",
  363. // prop: "manageCompany",
  364. // span: 24,
  365. // },
  366. {
  367. label: "所属项目",
  368. prop: "projectName",
  369. span: 24,
  370. addDisplay: false,
  371. editDisplay: false,
  372. viewDisplay: false
  373. },
  374. {
  375. label: '所属项目',
  376. prop: 'projectId',
  377. type: 'select',
  378. span: 24,
  379. props: {
  380. label: 'projectName',
  381. value: 'id'
  382. },
  383. dicUrl: 'api/galaxy-business/base/project/org/list',
  384. rules: [
  385. {
  386. required: true,
  387. message: "请选择项目",
  388. trigger: "click",
  389. },
  390. ],
  391. hide: true,
  392. },
  393. {
  394. label: "经度",
  395. prop: "lng",
  396. span: 24,
  397. hide: true,
  398. },
  399. {
  400. label: "纬度",
  401. prop: "lat",
  402. span: 24,
  403. hide: true,
  404. },
  405. {
  406. label: "测站位置",
  407. prop: "locationDesc",
  408. span: 24,
  409. hide: true,
  410. },
  411. {
  412. label: "行政区划编码",
  413. prop: "adCode",
  414. span: 24,
  415. tip: "请录入县级行政区划编码",
  416. },
  417. {
  418. label: "证照编号",
  419. prop: "siteCertId",
  420. span: 24,
  421. },
  422. {
  423. label: '站点建设来源类型',
  424. prop: 'siteOwner',
  425. type: 'select',
  426. props: {
  427. label: 'name',
  428. value: 'code'
  429. },
  430. span: 24,
  431. dicData: [{
  432. name: '国控转计量',
  433. code: '1'
  434. }, {
  435. name: '用户安装的计量设施',
  436. code: '2'
  437. }, {
  438. name: '中央专项资金',
  439. code: '3'
  440. }],
  441. }, {
  442. label: '是否同步到金水',
  443. prop: 'dataShareActive',
  444. type: 'radio',
  445. props: {
  446. label: 'name',
  447. value: 'code'
  448. },
  449. span: 24,
  450. dicData: [{
  451. name: '否',
  452. code: 1
  453. }, {
  454. name: '同步',
  455. code: 2
  456. }],
  457. },
  458. // {
  459. // label: "RTU品牌",
  460. // prop: "rtuBrand",
  461. // span: 24,
  462. // hide: true,
  463. // },
  464. // {
  465. // label: "RTU型号",
  466. // prop: "rtuModel",
  467. // span: 24,
  468. // hide: true,
  469. // },
  470. // {
  471. // label: "RTU更换时间",
  472. // prop: "rtuReplaceDate",
  473. // span: 24,
  474. // hide: true,
  475. // type: "date",
  476. // valueFormat: 'yyyy-MM-dd',
  477. // },
  478. // {
  479. // label: "雨量传感器品牌",
  480. // prop: "rainSensorBrand",
  481. // span: 24,
  482. // hide: true,
  483. // },
  484. // {
  485. // label: "雨量传感器型号",
  486. // prop: "rainSensorModel",
  487. // span: 24,
  488. // hide: true,
  489. // },
  490. // {
  491. // label: "雨量传感器更换时间",
  492. // prop: "rainSensorReplaceDate",
  493. // span: 24,
  494. // hide: true,
  495. // type: "date",
  496. // valueFormat: 'yyyy-MM-dd',
  497. // },
  498. // {
  499. // label: "水位计传感器品牌",
  500. // prop: "waterSensorBrand",
  501. // span: 24,
  502. // hide: true,
  503. // },
  504. // {
  505. // label: "水位计传感器型号",
  506. // prop: "waterSensorModel",
  507. // span: 24,
  508. // hide: true,
  509. // },
  510. // {
  511. // label: "水位计传感器类型",
  512. // prop: "waterSensorType",
  513. // span: 24,
  514. // hide: true,
  515. // type: 'radio',
  516. // // dicData: [{
  517. // // label: '雷达',
  518. // // value: 1
  519. // // }, {
  520. // // label: '超声波',
  521. // // value: 2
  522. // // }],
  523. // props: {
  524. // label: 'dictValue',
  525. // value: 'id'
  526. // },
  527. // dicUrl: '/api/galaxy-system/dict-biz/dictionary?code=water_level_sensor_type',
  528. // },
  529. // {
  530. // label: "水位计传感器更换时间",
  531. // prop: "waterSensorReplaceDate",
  532. // span: 24,
  533. // hide: true,
  534. // type: "date",
  535. // valueFormat: 'yyyy-MM-dd',
  536. // },
  537. // {
  538. // label: "墒情传感器品牌",
  539. // prop: "groundSensorBrand",
  540. // span: 24,
  541. // hide: true,
  542. // },
  543. // {
  544. // label: "墒情传感器型号",
  545. // prop: "groundSensorModel",
  546. // span: 24,
  547. // hide: true,
  548. // },
  549. // {
  550. // label: "墒情传感器类型",
  551. // prop: "groundSensorType",
  552. // span: 24,
  553. // hide: true,
  554. // type: 'radio',
  555. // props: {
  556. // label: 'dictValue',
  557. // value: 'id'
  558. // },
  559. // dicUrl: '/api/galaxy-system/dict-biz/dictionary?code=ground_water_sensor_type',
  560. // },
  561. // {
  562. // label: "墒情传感器更换时间",
  563. // prop: "groundSensorReplaceDate",
  564. // span: 24,
  565. // hide: true,
  566. // type: "date",
  567. // valueFormat: 'yyyy-MM-dd',
  568. // },
  569. // {
  570. // label: "供电系统电池型号",
  571. // prop: "batteryModel",
  572. // span: 24,
  573. // hide: true,
  574. // },
  575. // {
  576. // label: "供电系统电池更换时间",
  577. // prop: "batteryReplaceDate",
  578. // span: 24,
  579. // hide: true,
  580. // type: "date",
  581. // valueFormat: 'yyyy-MM-dd',
  582. // },
  583. // {
  584. // label: "太阳能板型号",
  585. // prop: "sunPowerModel",
  586. // span: 24,
  587. // hide: true,
  588. // },
  589. // {
  590. // label: "太阳能控制器品牌",
  591. // prop: "sunPowerControllerBrand",
  592. // span: 24,
  593. // hide: true,
  594. // },
  595. // {
  596. // label: "太阳能控制器型号",
  597. // prop: "sunPowerControllerModel",
  598. // span: 24,
  599. // hide: true,
  600. // },
  601. // {
  602. // label: "SIN卡号",
  603. // prop: "networkSimId",
  604. // span: 24,
  605. // hide: true,
  606. // },
  607. // {
  608. // label: "开卡单位",
  609. // prop: "networkPayer",
  610. // span: 24,
  611. // hide: true,
  612. // },
  613. // {
  614. // label: "缴费截止时间",
  615. // prop: "networkPayEndDate",
  616. // span: 24,
  617. // hide: true,
  618. // type: "date",
  619. // valueFormat: 'yyyy-MM-dd',
  620. // },
  621. // {
  622. // label: "是否北斗通信",
  623. // prop: "isSatellite",
  624. // span: 24,
  625. // hide: true,
  626. // type: 'radio',
  627. // dicData: [{
  628. // label: '否',
  629. // value: 0
  630. // }, {
  631. // label: '是',
  632. // value: 1
  633. // }],
  634. // },
  635. // {
  636. // label: "北斗通讯类型",
  637. // prop: "satelliteModel",
  638. // span: 24,
  639. // hide: true,
  640. // type: 'radio',
  641. // props: {
  642. // label: 'dictValue',
  643. // value: 'id'
  644. // },
  645. // dicUrl: '/api/galaxy-system/dict-biz/dictionary?code=satellite_model',
  646. // },
  647. {
  648. label: "备注说明",
  649. prop: "remark",
  650. span: 24,
  651. type: "textarea",
  652. hide: true
  653. },
  654. ],
  655. },
  656. data: [],
  657. };
  658. },
  659. computed: {
  660. ...mapGetters(["userInfo", "permission"]),
  661. permissionList() {
  662. // if (this.post_code == '0') {
  663. // return {
  664. // addBtn: this.vaildData(this.permission.rtu_add, false),
  665. // viewBtn: this.vaildData(this.permission.rtu_view, false),
  666. // delBtn: this.vaildData(this.permission.rtu_del, false),
  667. // editBtn: this.vaildData(this.permission.rtu_edit, false),
  668. // importBtn: this.vaildData(this.permission.rtu_import, false),
  669. // videoSiteAdd: this.vaildData(this.permission.video_site_add, false),
  670. // };
  671. // } else {
  672. return {
  673. // addBtn: false,
  674. // viewBtn: true,
  675. // delBtn: false,
  676. // editBtn: false,
  677. // importBtn: false,
  678. // videoSiteAdd: false
  679. };
  680. // }
  681. },
  682. },
  683. created() {
  684. // let u = getStore({ name: 'userInfo' });
  685. // console.log(JSON.stringify(u));
  686. // if (u.post_id == this.website.nm_post_code_sysadmin_id) {
  687. // this.post_code = this.website.nm_post_code_sysadmin_code;
  688. // } else if (u.post_id == this.website.nm_post_code_office_personnel_id) {
  689. // this.post_code = this.website.nm_post_code_office_personnel_code;
  690. // }
  691. this.initTree();
  692. },
  693. methods: {
  694. initTree() {
  695. this.treeData = [];
  696. getTree().then(res => {
  697. this.treeData = res.data.data.map(item => {
  698. return {
  699. ...item,
  700. leaf: !item.hasChildren
  701. }
  702. })
  703. this.treeOption.defaultExpandedKeys.push(this.treeData[0].id);
  704. this.treeCode = this.treeData[0].id;
  705. });
  706. },
  707. update_table() {
  708. this.onLoad(this.page, this.query);
  709. },
  710. toBindProject(row) {
  711. this.bindProjectDialog = true;
  712. this.bindProjectEditForm.id = row.id;
  713. this.bindProjectEditForm.projectId = row.projectId;
  714. },
  715. bindProjectSubmit(form, done) {
  716. console.log(JSON.stringify(form))
  717. // this.$message({
  718. // type: "success",
  719. // message: JSON.stringify(form),
  720. // });
  721. bindProject(form).then(
  722. () => {
  723. this.onLoad(this.page);
  724. this.$message({
  725. type: "success",
  726. message: "操作成功!",
  727. });
  728. this.bindProjectDialog = false;
  729. done();
  730. },
  731. (error) => {
  732. window.console.log(error);
  733. }
  734. );
  735. },
  736. bindProjectReset() {
  737. this.bindProjectEditForm.id = '';
  738. this.bindProjectEditForm.projectId = '';
  739. },
  740. // toRtuImpoartHandler() {
  741. // this.rtuImportDialog = true;
  742. // },
  743. // toRtuImportHistoryHandler() {
  744. // this.rtuImportHistoryDialog = true;
  745. // },
  746. // toAddVideoSite() {
  747. // this.videoSiteAddDialog = true;
  748. // this.$nextTick(() => {
  749. // this.$refs["videositeadd"].init();
  750. // });
  751. // },
  752. // downloadTemplate() {
  753. // window.open('/file/download/template/站点信息记录表模板.xlsx')
  754. // },
  755. nodeClick(data) {
  756. this.treeCode = data.id;
  757. this.treeParentCode = data.parentId;
  758. this.query = {};
  759. this.query['projectId'] = this.treeCode;
  760. this.page.currentPage = 1;
  761. var params = {};
  762. this.onLoad(this.page, params);
  763. },
  764. searchReset() {
  765. this.query = {};
  766. this.query['projectId'] = this.treeCode;
  767. this.page.currentPage = 1;
  768. this.onLoad(this.page);
  769. },
  770. searchChange(params, done) {
  771. this.query = params;
  772. this.query['projectId'] = this.treeCode;
  773. this.page.currentPage = 1;
  774. this.onLoad(this.page, params);
  775. done();
  776. },
  777. currentChange(currentPage) {
  778. console.log("currentPage " + currentPage);
  779. this.page.currentPage = currentPage;
  780. },
  781. sizeChange(pageSize) {
  782. this.page.pageSize = pageSize;
  783. },
  784. refreshChange() {
  785. var params = {};
  786. this.onLoad(this.page, params);
  787. },
  788. selectionChange(list) {
  789. this.selectionList = list;
  790. },
  791. selectChange(item) {
  792. console.log(JSON.stringify(item));
  793. },
  794. selectionClear() {
  795. this.selectionList = [];
  796. this.$refs.crud.toggleSelection();
  797. },
  798. rowSave(row, done, loading) {
  799. console.log(JSON.stringify(row))
  800. add(row).then(
  801. () => {
  802. this.onLoad(this.page);
  803. this.$message({
  804. type: "success",
  805. message: "操作成功!",
  806. });
  807. done();
  808. },
  809. (error) => {
  810. window.console.log(error);
  811. loading();
  812. }
  813. );
  814. },
  815. rowUpdate(row, index, done, loading) {
  816. update(row).then(
  817. () => {
  818. this.onLoad(this.page);
  819. this.$message({
  820. type: "success",
  821. message: "操作成功!",
  822. });
  823. done();
  824. },
  825. (error) => {
  826. window.console.log(error);
  827. loading();
  828. }
  829. );
  830. },
  831. rowDel(row) {
  832. this.$confirm("确定将选择数据删除?", {
  833. confirmButtonText: "确定",
  834. cancelButtonText: "取消",
  835. type: "warning",
  836. })
  837. .then(() => {
  838. return remove(row.id);
  839. })
  840. .then(() => {
  841. this.onLoad(this.page);
  842. this.$message({
  843. type: "success",
  844. message: "操作成功!",
  845. });
  846. });
  847. },
  848. handleDelete() {
  849. if (this.selectionList.length === 0) {
  850. this.$message.warning("请选择至少一条数据");
  851. return;
  852. }
  853. this.$confirm("确定将选择数据删除?", {
  854. confirmButtonText: "确定",
  855. cancelButtonText: "取消",
  856. type: "warning",
  857. })
  858. .then(() => {
  859. return remove(this.ids);
  860. })
  861. .then(() => {
  862. this.onLoad(this.page);
  863. this.$message({
  864. type: "success",
  865. message: "操作成功!",
  866. });
  867. this.$refs.crud.toggleSelection();
  868. });
  869. },
  870. beforeOpen(done, type) {
  871. if (["edit", "view"].includes(type)) {
  872. getDetail(this.form.id).then((res) => {
  873. this.form = res.data.data;
  874. });
  875. }
  876. done();
  877. },
  878. onLoad(page, params = {}) {
  879. this.loading = true;
  880. getPage(
  881. page.currentPage,
  882. page.pageSize,
  883. Object.assign(params, this.query)
  884. ).then((res) => {
  885. const data = res.data.data;
  886. this.page.total = data.total;
  887. this.data = data.records;
  888. this.loading = false;
  889. this.selectionClear();
  890. });
  891. },
  892. },
  893. };
  894. </script>
  895. <style>
  896. .box {
  897. height: 800px;
  898. }
  899. .el-scrollbar {
  900. height: 100%;
  901. }
  902. .box .el-scrollbar__wrap {
  903. overflow: scroll;
  904. }
  905. </style>