index.vue 15.5 KB
Newer Older
1 2
<template>
  <div class="app-container">
wuqinghua's avatar
wuqinghua committed
3 4 5 6 7 8 9 10
    <GetPos
      :dialogVisible.sync="dialogVisible"
      device="pipe"
      @close="dialogVisible=false"
      @getPath="getPath"
      :pipePath="this.coordinateslist"
    />

11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="管道长度" prop="pipeLength">
        <el-input
          v-model="queryParams.pipeLength"
          placeholder="请输入管道长度"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="管径" prop="pipeDiameter">
        <el-input
          v-model="queryParams.pipeDiameter"
          placeholder="请输入管径"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
wuqinghua's avatar
wuqinghua committed
30 31 32 33 34 35 36 37 38
<!--      <el-form-item label="压力" prop="pipePressure">-->
<!--        <el-input-->
<!--          v-model="queryParams.pipePressure"-->
<!--          placeholder="请输入压力"-->
<!--          clearable-->
<!--          size="small"-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94

      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['supervise:pipe:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['supervise:pipe:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['supervise:pipe:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
		  :loading="exportLoading"
          @click="handleExport"
          v-hasPermi="['supervise:pipe:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="pipeList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
wuqinghua's avatar
wuqinghua committed
95
      <el-table-column label="管道长度(米)" align="center" prop="pipeLength" />
96
      <el-table-column label="走向" align="center" prop="pipeTrend" />
wuqinghua's avatar
wuqinghua committed
97
      <el-table-column label="管径(厘米)" align="center" prop="pipeDiameter" />
98
      <el-table-column label="压力" align="center" prop="pipePressure" />
wuqinghua's avatar
wuqinghua committed
99
<!--      <el-table-column label="人员类型" align="center" prop="peopleOccupation" />-->
100 101
      <el-table-column label="建设年代" align="center" prop="buildDate" />
      <el-table-column label="建设单位" align="center" prop="buildUnit" />
102
      <el-table-column label="权属单位" align="center" prop="beyondEnterpriseName" />
wuqinghua's avatar
wuqinghua committed
103
<!--      <el-table-column label="坐标" align="center" prop="coordinates" />-->
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
      <el-table-column label="备注" align="center" prop="remarks" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['supervise:pipe:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['supervise:pipe:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改管道信息对话框 -->
134
    <el-dialog :title="title" :visible.sync="open" width="780px" append-to-body>
135
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
136 137 138 139


        <el-row>
          <el-col :span="11">
140
        <el-form-item label="管道长度" prop="pipeLength">
wuqinghua's avatar
wuqinghua committed
141 142 143
          <el-input v-model="form.pipeLength" placeholder="请输入管道长度" >
            <template slot="append"></template>
          </el-input>
144
        </el-form-item>
145 146
          </el-col>
          <el-col :span="11">
147
        <el-form-item label="管径" prop="pipeDiameter">
wuqinghua's avatar
wuqinghua committed
148 149 150
          <el-input v-model="form.pipeDiameter" placeholder="请输入管径" >
          <template slot="append">厘米</template>
          </el-input>
151
        </el-form-item>
152 153 154 155 156
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="11">
157 158 159
        <el-form-item label="压力" prop="pipePressure">
          <el-input v-model="form.pipePressure" placeholder="请输入压力" />
        </el-form-item>
160 161 162
          </el-col>

          <el-col :span="11">
wuqinghua's avatar
wuqinghua committed
163 164
            <el-form-item label="走向" prop="pipeTrend">
              <el-input v-model="form.pipeTrend" placeholder="请输入走向" />
165 166 167 168 169 170
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="11">
171 172 173
        <el-form-item label="埋深" prop="buriedDepth">
          <el-input v-model="form.buriedDepth" placeholder="请输入埋深" />
        </el-form-item>
174
          </el-col>
175

176 177 178 179 180 181
          <el-col :span="11">
            <el-form-item label="材质" prop="pipeMaterial">
              <el-input v-model="form.pipeMaterial" placeholder="请输入材质" />
            </el-form-item>
          </el-col>
        </el-row>
wuqinghua's avatar
wuqinghua committed
182

183 184 185 186 187 188
        <el-row>
          <el-col :span="11">
            <el-form-item label="建设单位" prop="buildUnit">
              <el-input v-model="form.buildUnit" placeholder="请输入建设单位" />
            </el-form-item>
          </el-col>
wuqinghua's avatar
wuqinghua committed
189

wuqinghua's avatar
wuqinghua committed
190

191
          <el-col :span="11">
wuqinghua's avatar
wuqinghua committed
192 193 194 195 196 197 198 199 200
            <el-form-item label="建设年代" prop="buildDate" >
              <el-date-picker
                v-model="form.buildDate"
                type="date"
                placeholder="请选择建设年代"
                format="yyyy 年 MM 月 dd 日"
                value-format="yyyy-MM-dd"
                style="width: 100%">
              </el-date-picker>
201 202 203
            </el-form-item>
          </el-col>
        </el-row>
wuqinghua's avatar
wuqinghua committed
204

205
        <el-row>
wuqinghua's avatar
wuqinghua committed
206 207 208 209 210 211 212 213
<!--          <el-col :span="11">-->
<!--            <el-form-item label="人员类型" prop="peopleOccupation">-->
<!--              <el-select v-model="form.peopleOccupation" placeholder="请选择人员类型">-->
<!--                <el-option label="运行维护人员" value="1" />-->
<!--                <el-option label="抢修人员" value="2" />-->
<!--              </el-select>-->
<!--            </el-form-item>-->
<!--          </el-col>-->
214 215

          <el-col :span="11">
wuqinghua's avatar
wuqinghua committed
216
        <el-form-item label="权属单位" prop="beyondEnterpriseName">
wuqinghua's avatar
wuqinghua committed
217
          <el-select style="width: 230%" v-model="form.beyondEnterpriseId"  placeholder="请在下拉框中选择权属单位" maxlength="255" :disabled="false" clearable>
wuqinghua's avatar
wuqinghua committed
218 219 220
            <el-option v-for="item in test" :key="item.enterpriseId" :label="item.enterpriseName" :value="item.enterpriseId">
            </el-option>
          </el-select>
221
        </el-form-item>
222 223
          </el-col>
        </el-row>
wuqinghua's avatar
wuqinghua committed
224 225


226
        <el-row>
wuqinghua's avatar
wuqinghua committed
227
          <el-col :span="18">
228
        <el-form-item label="坐标" prop="coordinates">
wuqinghua's avatar
wuqinghua committed
229
          <el-input v-model="form.coordinates"   type="textarea" placeholder="请输入坐标" />
230
        </el-form-item>
231
          </el-col>
wuqinghua's avatar
wuqinghua committed
232 233 234
          <el-col :span="3" style="margin-left: 30px">
            <el-button type="primary" plain @click="MapdialogFun">选择坐标</el-button>
          </el-col>
235
        </el-row>
wuqinghua's avatar
wuqinghua committed
236 237 238



239 240
        <el-row>
          <el-col :span="22">
241
        <el-form-item label="备注" prop="remarks">
242
          <el-input v-model="form.remarks" type="textarea" placeholder="请输入备注" />
243
        </el-form-item>
244 245 246 247
          </el-col>
        </el-row>


248 249 250 251 252 253 254 255 256 257
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
wuqinghua's avatar
wuqinghua committed
258
import { listPipe, getPipe, delPipe, addPipe, updatePipe, exportPipe, selectTEnterprise} from "@/api/regulation/pipe";
wuqinghua's avatar
wuqinghua committed
259
import GetPos from '@/components/GetPos';
260 261 262
export default {
  name: "Pipe",
  components: {
wuqinghua's avatar
wuqinghua committed
263
    GetPos
264 265 266
  },
  data() {
    return {
wuqinghua's avatar
wuqinghua committed
267 268 269
      dialogVisible:false,
      //地图管径回显数据
      coordinateslist:null,
270 271
      // 遮罩层
      loading: true,
272 273

      pipeList:[],
274 275 276 277 278 279 280 281 282 283 284 285 286
      // 导出遮罩层
      exportLoading: false,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 管道信息表格数据
287
      infoList: [],
288 289 290 291
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
wuqinghua's avatar
wuqinghua committed
292 293
      //下拉框数据
      test:{},
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        pipeLength: null,
        pipeDiameter: null,
        pipePressure: null,
        pipeMaterial: null,
        buriedDepth: null,
        pipeTrend: null,
        peopleOccupation: null,
        buildDate: null,
        buildUnit: null,
        beyondEnterpriseId: null,
        beyondEnterpriseName: null,
        coordinates: null,
        isDel: null,
        remarks: null
wuqinghua's avatar
wuqinghua committed
312

313 314 315
      },
      // 表单参数
      form: {},
wuqinghua's avatar
wuqinghua committed
316 317
      //下拉列表数据
      test: {},
318 319
      // 表单校验
      rules: {
320 321
        pipeLength: [
          { required: true, message: "请输入管道长度", trigger: "blur" },
322
          // { min: 0, max: 10, message: "长度10位", trigger: "blur" },
323 324 325
        ],
        pipeDiameter: [
          { required: true, message: "请输入管径", trigger: "blur" },
326
          // { min: 0, max: 15, message: "长度15位", trigger: "blur" },
327 328 329
        ],
        pipePressure: [
          { required: true, message: "请输入压力", trigger: "blur" },
330
          // { min: 0, max: 10, message: "长度10位", trigger: "blur" },
331 332 333 334 335 336
        ],
        buildDate: [
          { required: true, message: "请选择建设年代", trigger: "blur" },
        ],
        pipeMaterial: [
          { required: true, message: "请输入材质", trigger: "blur" },
337
          // { min: 0, max: 10, message: "长度10位", trigger: "blur" },
338 339 340
        ],
        buriedDepth:[
          { required: true, message: "请输入埋深", trigger: "blur" },
341
          // { min: 0, max: 10, message: "长度10位", trigger: "blur" },
342
        ],
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询管道信息列表 */
    getList() {
      this.loading = true;
      listPipe(this.queryParams).then(response => {
        this.pipeList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        pipeId: null,
        pipeLength: null,
        pipeDiameter: null,
        pipePressure: null,
        pipeMaterial: null,
        buriedDepth: null,
        pipeTrend: null,
        peopleOccupation: null,
        buildDate: null,
        buildUnit: null,
        beyondEnterpriseId: null,
        beyondEnterpriseName: null,
        coordinates: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        isDel: null,
        remarks: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.pipeId)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
wuqinghua's avatar
wuqinghua committed
407 408 409 410
      //查询企业名称下拉框数据
      selectTEnterprise().then(response => {
        this.test = response.data;
      });
wuqinghua's avatar
wuqinghua committed
411
      this.coordinateslist+=JSON.parse(null);
412 413 414 415 416 417
      this.reset();
      this.open = true;
      this.title = "添加管道信息";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
wuqinghua's avatar
wuqinghua committed
418 419 420 421
      //查询企业名称下拉框数据
      selectTEnterprise().then(response => {
        this.test = response.data;
      });
422 423 424 425
      this.reset();
      const pipeId = row.pipeId || this.ids
      getPipe(pipeId).then(response => {
        this.form = response.data;
wuqinghua's avatar
wuqinghua committed
426 427 428 429
        const text=this.form.coordinates
        console.log(text)
        this.coordinateslist=JSON.parse(text);

430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481
        this.open = true;
        this.title = "修改管道信息";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.pipeId != null) {
            updatePipe(this.form).then(response => {
              this.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addPipe(this.form).then(response => {
              this.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const pipeIds = row.pipeId || this.ids;
      this.$confirm('是否确认删除管道信息编号为"' + pipeIds + '"的数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return delPipe(pipeIds);
        }).then(() => {
          this.getList();
          this.msgSuccess("删除成功");
        }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams;
      this.$confirm('是否确认导出所有管道信息数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(() => {
          this.exportLoading = true;
          return exportPipe(queryParams);
        }).then(response => {
          this.download(response.msg);
          this.exportLoading = false;
        }).catch(() => {});
wuqinghua's avatar
wuqinghua committed
482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502
    },
    /**管道信息 选择管道提交数据方法*/
    getPath(e){
      // for (let i=0;i<e.length;i++){
      //   console.log(e[i])
      //   coordinates.push(e[i])
      // }
      var a = '['
      for (var i in e) {
        if (i == e.length - 1) {
          a += '[' + e[i].toString()+']'
        } else {
          a += '[' + e[i].toString()+'],'
        }
      }
      a += ']'
     this.form.coordinates=a;
    },
    /** 管道打开方法*/
    MapdialogFun(){
      this.dialogVisible=true;
503 504 505 506
    }
  }
};
</script>