index.vue 20.3 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
<template>
  <div class="app-container">
    <div v-if="-2 == $store.state.user.enterpriseId">
      <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
        <el-form-item label="企业名称" prop="enterpriseName">
          <el-input
            v-model="queryParams.enterpriseName"
            placeholder="请输入企业名称"
            clearable
            size="small"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
      <el-form-item label="上报时间">
        <el-date-picker
          v-model="dateRange"
          size="small"
耿迪迪's avatar
耿迪迪 committed
18
          type="datetimerange"
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 46 47 48 49 50
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          value-format="yyyy-MM-dd HH:mm:ss"
          @change="timeChange"
        ></el-date-picker>
      </el-form-item>
      <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="['system:sup: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"
        >修改</el-button>
耿迪迪's avatar
耿迪迪 committed
51
      </el-col>
52 53 54 55 56 57 58 59 60
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
        >删除</el-button>
耿迪迪's avatar
耿迪迪 committed
61
      </el-col>-->
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
		      :loading="exportLoading"
          @click="handleExport"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="supList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
耿迪迪's avatar
耿迪迪 committed
77
      <el-table-column label="企业名称" align="center" prop="enterpriseName" :show-overflow-tooltip="true"/>
耿迪迪's avatar
耿迪迪 committed
78 79 80 81
      <el-table-column label="计划量/wm³" align="center" prop="fPlanQuan" />
      <el-table-column label="批复量/wm³" align="center" prop="fApprQuan" />
      <el-table-column label="供气量/wm³" align="center" prop="fSupGasVol" />
      <el-table-column label="存储量/wm³" align="center" prop="fStorageVol" />
82
      <el-table-column label="监管气量日期" align="center" prop="fSupDate" />
83
      <el-table-column label="上报省厅状态" align="center" prop="fGovUploadStatus">
84
        <template slot-scope="scope">
耿迪迪's avatar
耿迪迪 committed
85 86
          <span v-if="scope.row.fGovUploadStatus == '0'">未上报</span>
          <span v-else-if="scope.row.fGovUploadStatus == '1'">已上报</span>
87 88 89
          <span v-else>-</span>
        </template>
      </el-table-column>
90
      <el-table-column label="上报省厅时间" align="center" prop="fGovUploadTime" width="180">
91
        <template slot-scope="scope">
耿迪迪's avatar
耿迪迪 committed
92 93
          <span v-if="scope.row.fGovUploadTime">{{ parseTime(scope.row.fGovUploadTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
          <span v-else>-</span>
94 95 96 97 98 99 100 101 102
        </template>
      </el-table-column>
      <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)"
耿迪迪's avatar
耿迪迪 committed
103 104 105 106 107 108 109 110
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
          >删除</el-button>
          -->
耿迪迪's avatar
耿迪迪 committed
111 112 113 114 115 116
          <el-button
            size="mini"
            type="text"
            icon="el-icon-document"
            @click="handleDetail(scope.row)"
          >详情</el-button>
117 118 119
          <el-button
            size="mini"
            type="text"
耿迪迪's avatar
耿迪迪 committed
120 121
            @click="handleReport(scope.row)"
          >上报</el-button>
122 123 124 125 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 213 214 215 216 217 218 219 220
        </template>
      </el-table-column>
    </el-table>

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

    <!-- 添加或修改气量监管对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="900px" append-to-body destroy-on-close :close-on-click-modal="false">
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="企业uuid" prop="fCompanyInfoId">
          <el-input v-model="form.fCompanyInfoId" placeholder="请输入企业uuid" />
        </el-form-item>
        <el-form-item label="计划量" prop="fPlanQuan">
          <el-input v-model="form.fPlanQuan" placeholder="请输入计划量" />
        </el-form-item>
        <el-form-item label="批复量" prop="fApprQuan">
          <el-input v-model="form.fApprQuan" placeholder="请输入批复量" />
        </el-form-item>
        <el-form-item label="供气量" prop="fSupGasVol">
          <el-input v-model="form.fSupGasVol" placeholder="请输入供气量" />
        </el-form-item>
        <el-form-item label="存储量" prop="fStorageVol">
          <el-input v-model="form.fStorageVol" placeholder="请输入存储量" />
        </el-form-item>
        <el-form-item label="监管气量日期" prop="fSupDate">
          <el-input v-model="form.fSupDate" placeholder="请输入监管气量日期" />
        </el-form-item>
        <el-form-item label="上报状态 0-未上报,1-已上报" prop="fRepStatus">
          <el-select v-model="form.fRepStatus" placeholder="请选择上报状态 0-未上报,1-已上报">
            <el-option label="请选择字典生成" value="" />
          </el-select>
        </el-form-item>
        <el-form-item label="上报日期" prop="fRepDate">
          <el-date-picker clearable size="small"
            v-model="form.fRepDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="选择上报日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="是否删除(0正常,1删除)" prop="isDel">
          <el-input v-model="form.isDel" placeholder="请输入是否删除(0正常,1删除)" />
        </el-form-item>
        <el-form-item label="备注" prop="remarks">
          <el-input v-model="form.remarks" placeholder="请输入备注" />
        </el-form-item>
      </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 v-if="-2 != $store.state.user.enterpriseId" class="report-content">
      <el-row style="margin-left: -3.5px;margin-right: -3.5px">
        <el-col :span="12" style="padding: 0px 3.5px 0px 3.5px">
          <div class="report-title">
            <div class="title">上报记录</div>
          </div>
          <div class="content">
            <!-- 日历 -->
            <Calendar
              width="100%"
              v-model="reportDate"
              :scheduleData="scheduleData"
              @dateChange="dateChange"
            />
          </div>
        </el-col>

        <el-col :span="12" style="padding: 0px 3.5px 0px 3.5px">
          <div class="report-title flex-between">
            <div class="title">上报情况</div>
            <el-button
              type="primary"
              size="small"
              @click="reportInfo"
            >
              上报
            </el-button>
          </div>
          <div class="content">
            <div class="state-warp">
              <el-row>
                <el-col :span="13">
                  <div class="label-warp">状态</div>
                  <div class="value-warp">
                    <span v-if="reportForm.fRepStatus == '1'">已上报</span>
                    <span v-else>未上报</span>
                  </div>
                </el-col>
耿迪迪's avatar
耿迪迪 committed
221
                <el-col :span="11" style="padding-left: 45px">
222 223 224 225 226 227 228 229 230
                  <div class="label-warp">上报时间</div>
                  <div class="value-warp">
                    <span v-if="reportForm.fRepDate">{{ reportForm.fRepDate }}</span>
                    <span v-else>暂无</span>
                  </div>
                </el-col>
              </el-row>
            </div>

耿迪迪's avatar
耿迪迪 committed
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253
            <el-form :rules="rules" label-position="top" label-width="80px" :model="reportForm">
              <el-form-item label="计划量" prop="fPlanQuan">
                <el-input v-model="reportForm.fPlanQuan">
                  <template slot="append">万立方</template>
                </el-input>
              </el-form-item>
              <el-form-item label="批复量" prop="fApprQuan">
                <el-input v-model="reportForm.fApprQuan">
                  <template slot="append">万立方</template>
                </el-input>
              </el-form-item>
              <el-form-item label="供气量" prop="fSupGasVol">
                <el-input v-model="reportForm.fSupGasVol">
                  <template slot="append">万立方</template>
                </el-input>
              </el-form-item>
              <el-form-item label="存储量" prop="fStorageVol">
                <el-input v-model="reportForm.fStorageVol">
                  <template slot="append">万立方</template>
                </el-input>
              </el-form-item>
            </el-form>
          </div>
254 255 256 257 258
        </el-col>
      </el-row>

    </div>

耿迪迪's avatar
耿迪迪 committed
259 260
    <!-- 详情 -->
    <DetailInfo ref="detail"/>
261 262 263 264
  </div>
</template>

<script>
耿迪迪's avatar
耿迪迪 committed
265
import { listSup, getSup, delSup, addSup, updateSup, exportSup, getReportInfoByCompany, reportInfoList, reportSupBalGasSupRecInfo } from "@/api/supplybalance/gas";
266 267
import Calendar from "@/components/Calendar";
import moment from "moment";
耿迪迪's avatar
耿迪迪 committed
268
import DetailInfo from "./components/DetailInfo";
269 270 271
export default {
  name: "Sup",
  components: {
耿迪迪's avatar
耿迪迪 committed
272 273
    Calendar,
    DetailInfo
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
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 气量监管表格数据
      supList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        fCompanyInfoId: null,
        fPlanQuan: null,
        fApprQuan: null,
        fSupGasVol: null,
        fStorageVol: null,
        fRepStatus: '1',
        beginRepDate: null,
        endRepDate: null,
        enterpriseName: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
耿迪迪's avatar
耿迪迪 committed
315 316
        fPlanQuan: [
          { required: true, message: "计划量不能为空", trigger: "blur" }
317
        ],
耿迪迪's avatar
耿迪迪 committed
318 319 320 321 322 323 324 325
        fApprQuan: [
          { required: true, message: "批复量不能为空", trigger: "blur" }
        ],
        fSupGasVol: [
          { required: true, message: "供气量不能为空", trigger: "blur" }
        ],
        fStorageVol: [
          { required: true, message: "存储量不能为空", trigger: "blur" }
326 327 328 329 330 331 332 333 334 335 336 337 338 339
        ],
      },
      reportDate: moment().format('YYYY-MM-DD'),
      scheduleData:[
        {date:'2024-06-19',content:'已上报'},
        {date:'2024-06-17',content:'未上报'},
        {date:'2024-06-15',content:'已上报'},
        {date:'2024-06-14',content:'已上报'}
      ],
      reportForm:{},
      dateRange: []
    };
  },
  created() {
耿迪迪's avatar
耿迪迪 committed
340 341 342 343
    if(-2 == this.$store.state.user.enterpriseId){
      this.getList();
      return;
    }
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 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
    const moment = require('moment');
    // 获取当月开始时间
    const startOfMonth = moment().startOf('month').format('YYYY-MM-DD HH:mm:ss');
    // 获取当月结束时间
    const endOfMonth = moment().endOf('month').format('YYYY-MM-DD HH:mm:ss');
    this.currentMonthReportInfo(startOfMonth,endOfMonth);
  },
  mounted(){
    this.getReportInfo();
  },
  methods: {
    /** 查询气量监管列表 */
    getList() {
      this.loading = true;
      listSup(this.queryParams).then(response => {
        this.supList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        fGasSupId: null,
        fCompanyInfoId: null,
        fPlanQuan: null,
        fApprQuan: null,
        fSupGasVol: null,
        fStorageVol: null,
        fSupDate: null,
        fRepStatus: null,
        fRepDate: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        isDel: null,
        remarks: null
      };
      this.resetForm("form");
    },
    // 表单重置
    resetReportForm() {
      this.reportForm = {
        fGasSupId: null,
        fCompanyInfoId: null,
        fPlanQuan: null,
        fApprQuan: null,
        fSupGasVol: null,
        fStorageVol: null,
        fSupDate: null,
        fRepStatus: null,
        fRepDate: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        isDel: null,
        remarks: null
      };
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.dateRange = [];
      this.queryParams.beginRepDate = null;
      this.queryParams.endRepDate = null;
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.fGasSupId)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加气量监管";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const fGasSupId = row.fGasSupId || this.ids
      getSup(fGasSupId).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改气量监管";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.fGasSupId != null) {
            updateSup(this.form).then(response => {
              this.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addSup(this.form).then(response => {
              this.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const fGasSupIds = row.fGasSupId || this.ids;
      this.$confirm('是否确认删除气量监管编号为"' + fGasSupIds + '"的数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return delSup(fGasSupIds);
        }).then(() => {
          this.getList();
          this.msgSuccess("删除成功");
        }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams;
      this.$confirm('是否确认导出所有气量监管数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(() => {
          this.exportLoading = true;
          return exportSup(queryParams);
        }).then(response => {
          this.download(response.msg);
          this.exportLoading = false;
        }).catch(() => {});
    },
    //日期切换
    dateChange(val){
      this.resetReportForm();
      this.getReportInfo();
      if(val == 0){
        const startOfMonth = moment(this.reportDate).startOf('month').format('YYYY-MM-DD HH:mm:ss');
        // 获取当月结束时间
        const endOfMonth = moment(this.reportDate).endOf('month').format('YYYY-MM-DD HH:mm:ss');
        this.currentMonthReportInfo(startOfMonth,endOfMonth);
      }
    },
    getReportInfo(){
耿迪迪's avatar
耿迪迪 committed
506
      getReportInfoByCompany({companyId:this.$store.state.user.enterpriseId,calendarDate:this.reportDate}).then(res =>{
507 508 509 510 511 512 513 514
        if(res.code && res.data){
          this.reportForm = res.data;
        }
      })
    },
    //上报
    reportInfo(){
      if (this.reportForm.fGasSupId != null) {
耿迪迪's avatar
耿迪迪 committed
515 516 517 518 519 520 521 522 523 524 525 526 527 528
        let that = this;
        this.$confirm('当前已上报,是否确认再次上报?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          that.reportForm.fRepDate =  moment().format('YYYY-MM-DD HH:mm:ss');
          that.reportForm.calendarDate = that.reportDate;
          that.reportForm.fRepStatus = '1';
          return updateSup(that.reportForm);
        }).then(() => {
          that.getReportInfo();
          that.msgSuccess("上报成功");
        }).catch(() => {});
529
      } else {
耿迪迪's avatar
耿迪迪 committed
530 531 532
        this.reportForm.fRepDate =  moment().format('YYYY-MM-DD HH:mm:ss');
        this.reportForm.calendarDate = this.reportDate;
        this.reportForm.fRepStatus = '1';
533 534
        addSup(this.reportForm).then(response => {
          this.msgSuccess("上报成功");
耿迪迪's avatar
耿迪迪 committed
535 536 537 538
          const startOfMonth = moment(this.reportDate).startOf('month').format('YYYY-MM-DD HH:mm:ss');
          // 获取当月结束时间
          const endOfMonth = moment(this.reportDate).endOf('month').format('YYYY-MM-DD HH:mm:ss');
          this.currentMonthReportInfo(startOfMonth,endOfMonth);
539
          this.getReportInfo();
540 541 542
        });
      }
    },
耿迪迪's avatar
耿迪迪 committed
543 544
    currentMonthReportInfo(beginCurrentMonthDate,endCurrentMonthDate){
      reportInfoList({fCompanyInfoId:this.$store.state.user.enterpriseId,beginCurrentMonthDate:beginCurrentMonthDate,endCurrentMonthDate:endCurrentMonthDate}).then(res =>{
545 546 547
        if(res.code == 200 && res.data){
          this.scheduleData = [];
          res.data.forEach(item =>{
耿迪迪's avatar
耿迪迪 committed
548
            this.scheduleData.push({date:item.calendarDate,content:item.fRepStatus == '1'?"已上报":"未上报"})
549 550 551 552 553 554 555 556
          })

        }
      })
    },
    timeChange(val){
      this.queryParams.beginRepDate = val[0];
      this.queryParams.endRepDate = val[1];
耿迪迪's avatar
耿迪迪 committed
557 558 559 560 561
    },
    //详情
    handleDetail(row){
      this.$refs.detail.getDetailInfo(row.fGasSupId);
    },
耿迪迪's avatar
耿迪迪 committed
562 563 564 565 566 567 568 569 570 571 572
    //上传
    handleReport(row) {
      this.$confirm('是否确认上报气量监管编号为"' + row.fGasSupId + '"的数据项?', "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(function() {
        return reportSupBalGasSupRecInfo({fGasSupId : row.fGasSupId});
      }).then(() => {
        this.getList();
        this.msgSuccess("上报成功");
耿迪迪's avatar
耿迪迪 committed
573
      }).catch(() => {});
耿迪迪's avatar
耿迪迪 committed
574
    },
575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631
  }
};
</script>
<style scoped lang="scss">
  .report-content{
    //border: 1px solid;
    margin: auto;
    max-width: 1200px;
    padding: 30px
  }

  .report-title{
    background: rgb(241, 241, 242);
    padding: 20px 30px;
    border-radius: 3px;
  }

  .report-title .title{
    line-height: 32px;
    font-weight: 500;
  }

  .content{
    background: var(--custom-background-soft);
    box-shadow: 0 3px 14px #a9aaab80;
    border-radius: 3px;
    padding: 32px 48px;
    height: 525px;
  }

  .state-warp{
    border-bottom: 1px solid #d4d4d4;
    height: 54px;
    margin-top: -10px;
    padding-bottom: 8px;
    margin-bottom: 24px;
    color: var(--custom-main-text-color);
  }
  .label-warp{
    font-size: 14px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: rgba(24, 31, 67, .5);
    line-height: 20px;
  }

  .value-warp{
    font-weight: 500;
    font-size: 18px;
    line-height: 25px;
  }

  .flex-between{
    display: flex;
    justify-content: space-between;
  }
</style>