index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="阀井名称" prop="valveWellName">
  5. <el-input
  6. v-model="queryParams.valveWellName"
  7. placeholder="请输入阀井名称"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="位置" prop="position">
  14. <el-input
  15. v-model="queryParams.position"
  16. placeholder="请输入位置"
  17. clearable
  18. size="small"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item>
  23. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  24. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  25. </el-form-item>
  26. </el-form>
  27. <el-row :gutter="10" class="mb8">
  28. <el-col :span="1.5">
  29. <el-button
  30. type="primary"
  31. plain
  32. icon="el-icon-plus"
  33. size="mini"
  34. @click="handleAdd"
  35. v-hasPermi="['gas:valveWellPosition:add']"
  36. >新增</el-button>
  37. </el-col>
  38. <el-col :span="1.5">
  39. <el-button
  40. type="success"
  41. plain
  42. icon="el-icon-edit"
  43. size="mini"
  44. :disabled="single"
  45. @click="handleUpdate"
  46. v-hasPermi="['gas:valveWellPosition:edit']"
  47. >修改</el-button>
  48. </el-col>
  49. <el-col :span="1.5">
  50. <el-button
  51. type="danger"
  52. plain
  53. icon="el-icon-delete"
  54. size="mini"
  55. :disabled="multiple"
  56. @click="handleDelete"
  57. v-hasPermi="['gas:valveWellPosition:remove']"
  58. >删除</el-button>
  59. </el-col>
  60. <el-col :span="1.5">
  61. <el-button
  62. type="info"
  63. plain
  64. icon="el-icon-upload2"
  65. size="mini"
  66. @click="handleImport"
  67. v-hasPermi="['system:user:import']"
  68. >导入
  69. </el-button>
  70. </el-col>
  71. <el-col :span="1.5">
  72. <el-button
  73. type="warning"
  74. plain
  75. icon="el-icon-download"
  76. size="mini"
  77. :loading="exportLoading"
  78. @click="handleExport"
  79. v-hasPermi="['gas:valveWellPosition:export']"
  80. >导出</el-button>
  81. </el-col>
  82. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  83. </el-row>
  84. <el-table v-loading="loading" :data="valveWellPositionList" @selection-change="handleSelectionChange">
  85. <el-table-column type="selection" width="55" align="center" />
  86. <el-table-column label="" align="center" prop="id" v-if="false"/>
  87. <el-table-column label="序列" width="70">
  88. <template slot-scope="scope">
  89. {{(queryParams.pageNum-1)*queryParams.pageSize+scope.$index+1}}
  90. </template>
  91. </el-table-column>
  92. <el-table-column label="阀井名称" align="center" prop="valveWellName" />
  93. <el-table-column label="位置" align="center" prop="position" />
  94. <el-table-column label="经度" align="center" prop="longitude" />
  95. <el-table-column label="纬度" align="center" prop="latitude" />
  96. <el-table-column label="控制区域" align="center" prop="remark" />
  97. <el-table-column label="行政区" align="center" prop="district" >
  98. <template slot-scope="scope">
  99. <dict-tag :options="dict.type.district" :value="scope.row.district"/>
  100. </template>
  101. </el-table-column>
  102. <el-table-column label="队伍" align="center" prop="team" />
  103. <el-table-column label="阀头形状" align="center" prop="valveHeadShape" />
  104. <el-table-column label="阀井深度(米)" align="center" prop="valveWellDepth" />
  105. <el-table-column label="井盖代别" align="center" prop="manholeCoverInstead" />
  106. <el-table-column label="积水情况" align="center" prop="waterCondition" />
  107. <el-table-column label="压力等级" align="center" prop="pressureRating" />
  108. <el-table-column label="是否需要下井才能开关阀门" align="center" prop="isXyxjcnkg" />
  109. <el-table-column label="备注" align="center" prop="remarks" />
  110. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  111. <template slot-scope="scope">
  112. <el-button
  113. size="mini"
  114. type="text"
  115. icon="el-icon-edit"
  116. @click="handleUpdate(scope.row)"
  117. v-hasPermi="['gas:valveWellPosition:edit']"
  118. >修改</el-button>
  119. <el-button
  120. size="mini"
  121. type="text"
  122. icon="el-icon-delete"
  123. @click="handleDelete(scope.row)"
  124. v-hasPermi="['gas:valveWellPosition:remove']"
  125. >删除</el-button>
  126. </template>
  127. </el-table-column>
  128. </el-table>
  129. <!-- 用户导入对话框 -->
  130. <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  131. <el-upload
  132. ref="upload"
  133. :limit="1"
  134. accept=".xlsx, .xls"
  135. :headers="upload.headers"
  136. :action="upload.url + '?updateSupport=' + upload.updateSupport"
  137. :disabled="upload.isUploading"
  138. :on-progress="handleFileUploadProgress"
  139. :on-success="handleFileSuccess"
  140. :auto-upload="false"
  141. drag
  142. >
  143. <i class="el-icon-upload"></i>
  144. <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
  145. <div class="el-upload__tip text-center" slot="tip">
  146. <!--<div class="el-upload__tip" slot="tip">-->
  147. <!--<el-checkbox v-model="upload.updateSupport"/>-->
  148. <!--是否更新已经存在的用户数据-->
  149. <!--</div>-->
  150. <span>仅允许导入xls、xlsx格式文件。</span>
  151. <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;"
  152. @click="importTemplate"
  153. >下载模板
  154. </el-link>
  155. </div>
  156. </el-upload>
  157. <div style="padding-top: 15px;line-height: 25px;font-size: 14px;">
  158. 完成度:{{ bfb }}%
  159. <progress max="100" :value="bfb" style="width: 200px;height: 18px;"></progress>
  160. <br>
  161. 导入结果:{{ jdtMsg }}
  162. </div>
  163. <div slot="footer" class="dialog-footer">
  164. <el-button type="primary" @click="submitFileForm">确 定</el-button>
  165. <el-button @click="upload.open = false;bfb='0';jdtMsg=''">取 消</el-button>
  166. </div>
  167. </el-dialog>
  168. <pagination
  169. v-show="total>0"
  170. :total="total"
  171. :page.sync="queryParams.pageNum"
  172. :limit.sync="queryParams.pageSize"
  173. @pagination="getList"
  174. />
  175. <!-- 添加或修改阀井位置对话框 -->
  176. <el-dialog :title="title" :visible.sync="open" width="850px" append-to-body>
  177. <el-form ref="form" :model="form" :rules="rules" label-width="180px" :inline="true">
  178. <el-form-item label="阀井名称" prop="valveWellName">
  179. <el-input v-model="form.valveWellName" placeholder="请输入阀井名称" />
  180. </el-form-item>
  181. <el-form-item label="位置" prop="position">
  182. <el-input v-model="form.position" placeholder="请输入位置" />
  183. </el-form-item>
  184. <el-form-item label="经度" prop="longitude">
  185. <el-input v-model="form.longitude" placeholder="请输入经度" />
  186. </el-form-item>
  187. <el-form-item label="纬度" prop="latitude">
  188. <el-input v-model="form.latitude" placeholder="请输入纬度" />
  189. </el-form-item>
  190. <el-form-item label="控制区域" prop="remark">
  191. <el-input v-model="form.remark" placeholder="请输入内容"/>
  192. </el-form-item>
  193. <el-form-item label="行政区" prop="district">
  194. <el-select v-model="form.district" placeholder="请选择行政区" style="width: 202px">
  195. <el-option
  196. v-for="dict in dict.type.district"
  197. :key="dict.value"
  198. :label="dict.label"
  199. :value="dict.value"
  200. ></el-option>
  201. </el-select>
  202. </el-form-item>
  203. <el-form-item label="阀头形状" prop="valveHeadShape">
  204. <el-input v-model="form.valveHeadShape" placeholder="请输入内容" />
  205. </el-form-item>
  206. <el-form-item label="队伍" prop="team">
  207. <el-select v-model="form.team" clearable placeholder="请选择队伍" style="width: 202px">
  208. <el-option
  209. v-for="item in postOptions"
  210. :key="item.postName"
  211. :label="item.postName"
  212. :value="item.postName"
  213. ></el-option>
  214. </el-select>
  215. </el-form-item>
  216. <el-form-item label="阀井深度(米)" prop="valveWellDepth">
  217. <el-input v-model="form.valveWellDepth" placeholder="请输入内容" />
  218. </el-form-item>
  219. <el-form-item label="井盖代别" prop="manholeCoverInstead" >
  220. <el-input v-model="form.manholeCoverInstead" placeholder="请输入内容" />
  221. </el-form-item>
  222. <el-form-item label="积水情况" prop="waterCondition">
  223. <el-input v-model="form.waterCondition" placeholder="请输入内容" />
  224. </el-form-item>
  225. <el-form-item label="压力等级" prop="pressureRating">
  226. <el-input v-model="form.pressureRating" placeholder="请输入内容" />
  227. </el-form-item>
  228. <el-form-item label="是否需要下井才能开关阀门" prop="isXyxjcnkg">
  229. <el-input v-model="form.isXyxjcnkg" placeholder="请输入内容" />
  230. </el-form-item>
  231. <el-form-item label="备注" prop="remarks">
  232. <el-input v-model="form.remarks" placeholder="请输入内容" />
  233. </el-form-item>
  234. </el-form>
  235. <div slot="footer" class="dialog-footer">
  236. <el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
  237. <el-button @click="cancel">取 消</el-button>
  238. </div>
  239. </el-dialog>
  240. </div>
  241. </template>
  242. <script>
  243. import { listValveWellPosition, getValveWellPosition, delValveWellPosition, addValveWellPosition, updateValveWellPosition } from "@/api/gas/valveWellPosition";
  244. import {listPostAll} from "@/api/system/post";
  245. import {getToken} from "@/utils/auth";
  246. import {clearFlushProgress, clearFlushProgressA, flushProgress, flushProgressA} from "@/api/gas/area";
  247. export default {
  248. name: "ValveWellPosition",
  249. dicts: ['district'],
  250. data() {
  251. return {
  252. //进度条
  253. timeInterval: null,
  254. bfb: '0',
  255. jdtMsg: '',
  256. // 按钮loading
  257. buttonLoading: false,
  258. // 遮罩层
  259. loading: true,
  260. // 导出遮罩层
  261. exportLoading: false,
  262. // 岗位选项
  263. postOptions: [],
  264. // 选中数组
  265. ids: [],
  266. // 非单个禁用
  267. single: true,
  268. // 非多个禁用
  269. multiple: true,
  270. // 显示搜索条件
  271. showSearch: true,
  272. // 总条数
  273. total: 0,
  274. // 阀井位置表格数据
  275. valveWellPositionList: [],
  276. // 弹出层标题
  277. title: "",
  278. // 是否显示弹出层
  279. open: false,
  280. // 查询参数
  281. queryParams: {
  282. pageNum: 1,
  283. pageSize: 10,
  284. valveWellName: undefined,
  285. position: undefined,
  286. longitude: undefined,
  287. latitude: undefined,
  288. },
  289. // 表单参数
  290. form: {},
  291. // 用户导入参数
  292. upload: {
  293. // 是否显示弹出层(用户导入)
  294. open: false,
  295. // 弹出层标题(用户导入)
  296. title: '',
  297. // 是否禁用上传
  298. isUploading: false,
  299. // 是否更新已经存在的用户数据
  300. updateSupport: 0,
  301. // 设置上传的请求头部
  302. headers: { Authorization: 'Bearer ' + getToken() },
  303. // 上传的地址
  304. url: process.env.VUE_APP_BASE_API + '/gas/valveWellPosition/importData'
  305. },
  306. // 表单校验
  307. rules: {
  308. id: [
  309. { required: true, message: "不能为空", trigger: "blur" }
  310. ],
  311. valveWellName: [
  312. { required: true, message: "阀井名称不能为空", trigger: "blur" }
  313. ],
  314. position: [
  315. { required: true, message: "位置不能为空", trigger: "blur" }
  316. ],
  317. longitude: [
  318. { required: true, message: "经度不能为空", trigger: "blur" }
  319. ],
  320. latitude: [
  321. { required: true, message: "纬度不能为空", trigger: "blur" }
  322. ],
  323. }
  324. };
  325. },
  326. created() {
  327. this.getPostList();
  328. this.getList();
  329. },
  330. methods: {
  331. /** 下载模板操作 */
  332. importTemplate() {
  333. this.$download.excel('/gas/valveWellPosition/importTemplate')
  334. },
  335. // 提交上传文件
  336. submitFileForm() {
  337. const ther = this
  338. this.timeInterval = setInterval(function() {
  339. ther.flushProgress()
  340. }, 1500)
  341. this.$refs.upload.submit()
  342. },
  343. // 提交上传文件
  344. flushProgress() {
  345. flushProgressA().then(response => {
  346. this.bfb = parseInt(response.data.bfb) >= 100 ? 100 : response.data.bfb
  347. this.jdtMsg = response.data.message
  348. if (response.data.message != null && response.data.message != '') {
  349. clearFlushProgressA().then(response => {
  350. })
  351. clearInterval(this.timeInterval)
  352. }
  353. })
  354. },
  355. // 文件上传中处理
  356. handleFileUploadProgress(event, file, fileList) {
  357. this.upload.isUploading = true
  358. },
  359. // 文件上传成功处理
  360. handleFileSuccess(response, file, fileList) {
  361. this.upload.isUploading = false
  362. this.$refs.upload.clearFiles()
  363. this.getList()
  364. },
  365. /** 导入按钮操作 */
  366. handleImport() {
  367. this.upload.title = '导入'
  368. this.upload.open = true
  369. },
  370. getPostList(){
  371. listPostAll({remark:'ranks'}).then(response => {
  372. this.postOptions = response.data;
  373. });
  374. },
  375. /** 查询阀井位置列表 */
  376. getList() {
  377. this.loading = true;
  378. listValveWellPosition(this.queryParams).then(response => {
  379. this.valveWellPositionList = response.rows;
  380. this.total = response.total;
  381. this.loading = false;
  382. });
  383. },
  384. // 取消按钮
  385. cancel() {
  386. this.open = false;
  387. this.reset();
  388. },
  389. // 表单重置
  390. reset() {
  391. this.form = {
  392. id: undefined,
  393. valveWellName: undefined,
  394. position: undefined,
  395. longitude: undefined,
  396. latitude: undefined,
  397. remark: undefined,
  398. delFlag: undefined,
  399. createBy: undefined,
  400. createTime: undefined,
  401. updateBy: undefined,
  402. updateTime: undefined
  403. };
  404. this.resetForm("form");
  405. },
  406. /** 搜索按钮操作 */
  407. handleQuery() {
  408. this.queryParams.pageNum = 1;
  409. this.getList();
  410. },
  411. /** 重置按钮操作 */
  412. resetQuery() {
  413. this.resetForm("queryForm");
  414. this.handleQuery();
  415. },
  416. // 多选框选中数据
  417. handleSelectionChange(selection) {
  418. this.ids = selection.map(item => item.id)
  419. this.single = selection.length!==1
  420. this.multiple = !selection.length
  421. },
  422. /** 新增按钮操作 */
  423. handleAdd() {
  424. this.reset();
  425. this.open = true;
  426. this.title = "添加阀井位置";
  427. },
  428. /** 修改按钮操作 */
  429. handleUpdate(row) {
  430. this.loading = true;
  431. this.reset();
  432. const id = row.id || this.ids
  433. getValveWellPosition(id).then(response => {
  434. this.loading = false;
  435. this.form = response.data;
  436. this.open = true;
  437. this.title = "修改阀井位置";
  438. });
  439. },
  440. /** 提交按钮 */
  441. submitForm() {
  442. this.$refs["form"].validate(valid => {
  443. if (valid) {
  444. this.buttonLoading = true;
  445. if (this.form.id != null) {
  446. updateValveWellPosition(this.form).then(response => {
  447. this.$modal.msgSuccess("修改成功");
  448. this.open = false;
  449. this.getList();
  450. }).finally(() => {
  451. this.buttonLoading = false;
  452. });
  453. } else {
  454. addValveWellPosition(this.form).then(response => {
  455. this.$modal.msgSuccess("新增成功");
  456. this.open = false;
  457. this.getList();
  458. }).finally(() => {
  459. this.buttonLoading = false;
  460. });
  461. }
  462. }
  463. });
  464. },
  465. /** 删除按钮操作 */
  466. handleDelete(row) {
  467. const ids = row.id || this.ids;
  468. this.$modal.confirm('是否确认删除阀井位置数据项?').then(() => {
  469. this.loading = true;
  470. return delValveWellPosition(ids);
  471. }).then(() => {
  472. this.loading = false;
  473. this.getList();
  474. this.$modal.msgSuccess("删除成功");
  475. }).finally(() => {
  476. this.loading = false;
  477. });
  478. },
  479. /** 导出按钮操作 */
  480. handleExport() {
  481. this.$download.excel('/gas/valveWellPosition/export', this.queryParams);
  482. }
  483. }
  484. };
  485. </script>
  486. <style>
  487. .ftzt-class{
  488. ::v-deep .el-form-item--medium .el-form-item__label{
  489. width: 165px !important;
  490. }
  491. }
  492. </style>