index.vue 17 KB
Newer Older
耿迪迪's avatar
耿迪迪 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
<template>
  <div class="app-container">

    <!-- 添加或修改企业基础信息管理对话框 -->
    <el-row :gutter="10" class="mb8">
      <el-col :span="14">
        <el-form ref="form" :model="form" label-width="150px">
          <table>
          <tr>
            <th>
              企业名称
            </th>
            <td>
              <span>{{form.unitName}}</span>
            </td>
            <th>
              社会统一信用代码
            </th>
            <td>
              {{form.orgCode}}
            </td>
          </tr>
          <tr>
            <th>
              安全监管分类
            </th>
            <td>
              <span v-if="form.regulationType == '1'">危险化学品</span>
              <span v-if="form.regulationType == '2'">冶金</span>
              <span v-if="form.regulationType == '3'">建材</span>
              <span v-if="form.regulationType == '4'">有色</span>
              <span v-if="form.regulationType == '5'">机械</span>
              <span v-if="form.regulationType == '6'">其他</span>
            </td>
            <th>
              成立日期
            </th>
            <td>
              {{form.regDate}}
            </td>
          </tr>
          <tr>
            <th>
              经营范围
            </th>
46
            <td colspan="3">
耿迪迪's avatar
耿迪迪 committed
47 48
              {{form.businessScope}}
            </td>
49 50
          </tr>
          <tr>
耿迪迪's avatar
耿迪迪 committed
51 52 53 54 55 56
            <th>
              营业期限
            </th>
            <td>
              {{form.businessTerm}}
            </td>
57 58 59 60 61 62
            <th>
              值班电话
            </th>
            <td>
              {{form.dutyPhone}}
            </td>
耿迪迪's avatar
耿迪迪 committed
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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
          </tr>
          <tr>
            <th>
              法定代表人
            </th>
            <td>
              <span v-if="form.legalPerson != null && form.legalPerson != ''">{{form.legalPerson}}</span>
              <span v-else>-</span>
            </td>
            <th>
              法定代表人手机
            </th>
            <td>
              <span v-if="form.legalPersonPhone != null && form.legalPersonPhone != ''">{{form.legalPersonPhone}}</span>
              <span v-else>-</span>
            </td>
          </tr>
          <tr>
            <th>
              主要负责人
            </th>
            <td>
              <span v-if="form.keyPerson != null && form.keyPerson != ''">{{form.keyPerson}}</span>
              <span v-else>-</span>
            </td>
            <th>
              主要负责人手机
            </th>
            <td>
              <span v-if="form.keyPersonPhone != null && form.keyPersonPhone != ''">{{form.keyPersonPhone}}</span>
              <span v-else>-</span>
            </td>
          </tr>
          <tr>
            <th>
              安全负责人
            </th>
            <td>
              <span v-if="form.safetyPerson != null && form.safetyPerson != ''">{{form.safetyPerson}}</span>
              <span v-else>-</span>
            </td>
            <th>
              安全负责人手机
            </th>
            <td>
              <span v-if="form.safetyPersonPhone != null && form.safetyPersonPhone != ''">{{form.safetyPersonPhone}}</span>
              <span v-else>-</span>
            </td>
          </tr>
112 113 114 115 116 117 118 119 120 121 122 123 124 125
          <tr>
            <th>
              经度
            </th>
            <td>
              {{form.longitude}}
            </td>
            <th>
              纬度
            </th>
            <td>
              {{form.latitude}}
            </td>
          </tr>
耿迪迪's avatar
耿迪迪 committed
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212
          <tr>
            <th>
              生产经营地址
            </th>
            <td colspan="3">
              {{form.runAddress}}
            </td>
          </tr>
          <tr>
            <th>
              注册地址
            </th>
            <td colspan="3">
              {{form.regAddress}}
            </td>
          </tr>
          <tr>
            <th>
              备注信息
            </th>
            <td colspan="3">
              <span v-if="form.remarks != null && form.remarks != ''">{{form.remarks}}</span>
              <span v-else>-</span>
            </td>
          </tr>

          </table>
        </el-form>
      </el-col>

      <el-col :span="9">
        <div style="width: 100%;height: 480px; border: 1px solid rgb(218, 213, 213);margin-bottom: 10px;">
          <div style="width: 100%;height: 100%" id="enterpriseContainer"></div>
        </div>
      </el-col>
    </el-row>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5" style="margin-left: 50%">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="normal"
          @click="handleUpdate(form)"
        >编辑</el-button>
      </el-col>
    </el-row>

    <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="150px">
        <el-row>
          <el-col :span="11">
            <el-form-item label="企业名称" prop="unitName">
              <el-input v-model="form.unitName" placeholder="请输入企业名称" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="社会统一信用代码" prop="orgCode">
              <el-input v-model="form.orgCode" placeholder="请输入社会统一信用代码" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="11">
            <el-form-item label="安全监管分类" prop="regulationType">
              <el-select v-model="form.regulationType" placeholder="请选择安全监管分类" style="width: 100%">
                <el-option v-for="dict in regulationOptions"
                           :key="dict.dictValue"
                           :label="dict.dictLabel"
                           :value="dict.dictValue"/>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="成立日期" prop="regDate">
              <el-date-picker clearable size="small"
                              v-model="form.regDate"
                              type="date"
                              value-format="yyyy-MM-dd"
                              placeholder="选择成立日期"
                              style="width: 100%">
              </el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
213 214 215 216 217
          <el-col :span="23">
            <el-form-item label="经营范围" prop="businessScope">
              <el-input v-model="form.businessScope" placeholder="请输入经营范围" />
            </el-form-item>
          </el-col>
耿迪迪's avatar
耿迪迪 committed
218 219
        </el-row>
        <el-row>
220 221 222 223 224 225 226 227 228 229
          <el-col :span="11">
            <el-form-item label="营业期限" prop="businessTerm">
              <el-input v-model="form.businessTerm" placeholder="请输入营业期限" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="值班电话" prop="dutyPhone">
              <el-input v-model="form.dutyPhone" placeholder="请输入值班电话" />
            </el-form-item>
          </el-col>
耿迪迪's avatar
耿迪迪 committed
230 231
        </el-row>
        <el-row>
232 233 234 235 236 237 238 239 240 241 242 243
          <el-col :span="23">
            <el-form-item label="生产经营地址" prop="runAddress">
              <el-input v-model="form.runAddress" placeholder="请输入生产经营地址" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="23">
            <el-form-item label="注册地址" prop="regAddress">
              <el-input v-model="form.regAddress" placeholder="请输入注册地址" />
            </el-form-item>
          </el-col>
耿迪迪's avatar
耿迪迪 committed
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 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
        </el-row>
        <el-row>
        <el-col :span="23">
          <el-form-item label="经纬度坐标" prop="longitude">
            <el-col :span="9">
              <el-input v-model="form.longitude" placeholder="请输入经度" />
            </el-col>
            <el-col :span="9" style="margin-left: 15px">
              <el-input v-model="form.latitude" placeholder="请输入纬度"/>
            </el-col>
            <el-col :span="3" style="margin-left: 30px">
              <el-button type="primary" plain @click="MapdialogFun">选择经纬度</el-button>
            </el-col>
          </el-form-item>
        </el-col>
        </el-row>
        <el-row>
        <el-col :span="11">
          <el-form-item label="法定代表人" prop="legalPerson">
            <el-input v-model="form.legalPerson" placeholder="请输入法定代表人" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="法定代表人手机" prop="legalPersonPhone">
            <el-input v-model="form.legalPersonPhone" placeholder="请输入法定代表人手机" />
          </el-form-item>
        </el-col>
        </el-row>
        <el-row>
        <el-col :span="11">
          <el-form-item label="主要负责人" prop="keyPerson">
            <el-input v-model="form.keyPerson" placeholder="请输入主要负责人" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="主要负责人手机" prop="keyPersonPhone">
            <el-input v-model="form.keyPersonPhone" placeholder="请输入主要负责人手机" />
          </el-form-item>
        </el-col>
        </el-row>
        <el-row>
        <el-col :span="11">
          <el-form-item label="安全负责人" prop="safetyPerson">
            <el-input v-model="form.safetyPerson" placeholder="请输入安全负责人" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="安全负责人手机" prop="safetyPersonPhone">
            <el-input v-model="form.safetyPersonPhone" placeholder="请输入安全负责人手机" />
          </el-form-item>
        </el-col>
        </el-row>
        <el-row>
        <el-col :span="23">
          <el-form-item label="备注信息" prop="remarks">
            <el-input v-model="form.remarks" placeholder="请输入备注" />
          </el-form-item>
        </el-col>
        </el-row>
      </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>

    <GetPos
      :dialogVisible.sync="dialogTableVisible"
      device=""
      :devicePos="devicePos"
      @close="dialogcancelFun"
      @getPath="getPath"
    />
  </div>
</template>

<script>
import { listEnterpriseInfo, getEnterpriseInfo, delEnterpriseInfo, addEnterpriseInfo, updateEnterpriseInfo, exportEnterpriseInfo } from "@/api/safetyManagement/enterpriseInfo";
import GetPos from '@/components/GetPos';
import { EditorMap } from "@/utils/mapClass/getPath.js";

export default {
  name: "EnterpriseInfo",
  components: {
    GetPos
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 总条数
      total: 0,
      // 企业基础信息管理表格数据
      enterpriseInfoList: [],
      regulationOptions: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 地图
      dialogTableVisible: false,
      devicePos: [],
      map: null,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        unitName: null,
        orgCode: null,
        runAddress: null,
        regAddress: null,
        regulationType: null,
        regDate: null,
        businessTerm: null,
        longitude: null,
        latitude: null,
        businessScope: null,
        employeeNum: null,
        legalPerson: null,
        legalPersonPhone: null,
        keyPerson: null,
        keyPersonPhone: null,
        safetyPerson: null,
        safetyPersonPhone: null,
        createUserId: null,
        updateUserId: null,
        remarks: null
      },
      // 表单参数
      form: {
      },
      // 表单校验
      rules: {
        unitName: [
          { required: true, message: "请输入企业名称", trigger: "blur" }
        ],
        orgCode: [
          { required: true, message: "请输入社会统一信用代码", trigger: "blur" }
        ],
        regulationType: [
          { required: true, message: "请选择安全监管分类", trigger: "blur" }
        ],
        regDate: [
          { required: true, message: "请选择成立日期", trigger: "blur" }
        ],
        businessScope: [
          { required: true, message: "请输入经营范围", trigger: "blur" }
        ],
        businessTerm: [
          { required: true, message: "请输入营业期限", trigger: "blur" }
        ],
397 398 399
        dutyPhone: [
          { required: true, message: "请输入值班电话", trigger: "blur" }
        ],
耿迪迪's avatar
耿迪迪 committed
400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 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 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562
        runAddress: [
          { required: true, message: "请输入生产经营地址", trigger: "blur" }
        ],
        regAddress: [
          { required: true, message: "请输入注册地址", trigger: "blur" }
        ],
        phonenumber: [
          {
            pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
            message: "请输入正确的手机号码",
            trigger: "blur"
          }
        ],
        longitude: [
          { required: true, message: "请输入经纬度", trigger: "blur" }
        ],
      }
    };
  },
  created() {
    this.getList();
    this.getDicts("t_regulation_type").then(response => {
      this.regulationOptions = response.data;
    });
  },
  methods: {
    /** 查询企业基础信息管理列表 */
    getList() {
      this.loading = true;
      listEnterpriseInfo(this.queryParams).then(response => {
        this.enterpriseInfoList = response.rows;
        this.form = this.enterpriseInfoList[0];
        console.log("this.form.longitude", this.form.longitude);
        this.total = response.total;
        this.loading = false;

        this.$nextTick(() => {
          const path = eval(this.$store.state.user.systemSetting.map_center);
          this.map = new EditorMap("enterpriseContainer", {center: path}, this);
          if(this.form.longitude != null){
            this.devicePos = [this.form.longitude, this.form.latitude];
            this.map.addDevice({ path: this.devicePos });
          }
          this.map.nowMouseTarget = null;
          this.map.mousetoolClose(false);
        });
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
      this.getList();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        unitName: null,
        orgCode: null,
        runAddress: null,
        regAddress: null,
        regulationType: null,
        regDate: null,
        businessTerm: null,
        longitude: null,
        latitude: null,
        businessScope: null,
        employeeNum: null,
        legalPerson: null,
        legalPersonPhone: null,
        keyPerson: null,
        keyPersonPhone: null,
        safetyPerson: null,
        safetyPersonPhone: null,
        createUserId: null,
        updateUserId: null,
        updateTime: null,
        createTime: null,
        remarks: null
      };
      this.resetForm("form");
      this.devicePos = [];
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      if(row != null){
        getEnterpriseInfo(row.id).then(response => {
          this.form = response.data;
          if(this.form.longitude != null){
            this.devicePos = [this.form.longitude, this.form.latitude];
          }
          console.log("this.devicePos", this.devicePos)
        });
      }
      this.open = true;
      this.title = "编辑企业基础信息";
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            console.log("longitude",this.form.longitude)
            updateEnterpriseInfo(this.form).then(response => {
              this.msgSuccess("编辑成功");
              this.open = false;
              this.getList();
            });
          } else {
            addEnterpriseInfo(this.form).then(response => {
              this.msgSuccess("编辑成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    MapdialogFun() {
      this.dialogTableVisible = true;
    },
    dialogcancelFun() {
      this.dialogTableVisible = false;
    },
    getPath(res){
      console.log("res", res);
      console.log(this.form.longitude, this.form.latitude);
      //确认选择经纬度
      this.form.longitude = res[0];
      this.form.latitude = res[1];
    }
  }
};
</script>
<style lang="scss" scoped>
  table {
    width: 100%;
    line-height: 30px;
    border-collapse: collapse;
  }
  table, table tr th, table tr td {
    border: solid 1px rgb(218, 213, 213) !important;
  }
  th {
    background-color: #e6ebf5;
    color: #515a6e;
    font-size: 15px;
    width: 100px;
    height: 50px;
    text-align: left;
    padding-left: 5px;
  }
  td {
    color: #606266;
    width: 200px;
    height: 50px;
    line-height: 50px;
    text-align: left;
    padding-left: 5px;
  }
</style>