index.vue 13 KB
Newer Older
1 2
<template>
  <div class="app-container">
3
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="120px">
4
      <el-form-item label="生产(制造)单位" prop="makeInfo">
5
        <el-input
6
          v-model="queryParams.makeInfo"
7
          placeholder="请输入生产(制造)单位"
8 9 10 11
          clearable
          size="small"
        />
      </el-form-item>
12

13
      <el-form-item label="气瓶条码" prop="qrcode">
14
        <el-input
15
          v-model="queryParams.qrcode"
16 17 18 19 20 21
          placeholder="请输入气瓶条码"
          clearable
          size="small"
        />
      </el-form-item>

22
      <!-- <el-form-item label="钢瓶状态" prop="fState"> 2024-09-13 wh 去掉,感觉监管不需要
23
        <el-select v-model="queryParams.state" placeholder="请选择钢瓶状态" clearable>
24
          <el-option
25
            v-for="item in stateOptions"
26 27 28 29 30
            :key="item.value"
            :label="item.label"
            :value="item.value">
          </el-option>
        </el-select>
31
      </el-form-item> -->
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
      <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="warning"
          plain
          icon="el-icon-download"
          size="mini"
		  :loading="exportLoading"
          @click="handleExport"
          v-hasPermi="['system:files:export']"
        >导出</el-button>
49
        
50
      </el-col>
51 52 53 54 55 56 57 58 59 60
      
      <el-col :span="1.5">
        <el-button
          type="info"
          icon="el-icon-upload2"
          size="mini"
          @click="handleImport">导入</el-button>
      </el-col> 
      

61 62 63 64 65
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="filesList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
66
      <el-table-column label="燃气企业" align="center" prop="enterpriseName" :show-overflow-tooltip="true"/>
67
      <el-table-column label="生产(制造)单位" align="center" prop="makeInfo" :show-overflow-tooltip="true"/>
68
      <el-table-column label="气瓶条码" align="center" prop="qrcode" :show-overflow-tooltip="true"/>
69 70
      <el-table-column label="钢瓶规格名称" align="center" prop="botSpecName" :show-overflow-tooltip="true"/>
      <el-table-column label="钢瓶型号" align="center" prop="bottleType" :show-overflow-tooltip="true"/>
71
      <el-table-column label="上检日期" align="center" prop="pchkDate">
72
        <template slot-scope="scope">
73
          <span>{{ parseTime(scope.row.pchkDate, '{y}-{m}-{d}') }}</span>
74 75
        </template>
      </el-table-column>
76
      <el-table-column label="下检日期" align="center" prop="nchkDate">
77
        <template slot-scope="scope">
78
          <span>{{ parseTime(scope.row.nchkDate, '{y}-{m}-{d}') }}</span>
79 80
        </template>
      </el-table-column>
81
      <el-table-column label="生产日期" align="center" prop="productDate">
82
        <template slot-scope="scope">
83
          <span>{{ parseTime(scope.row.productDate, '{y}-{m}-{d}') }}</span>
84 85
        </template>
      </el-table-column>
86
      <el-table-column label="报废日期" align="center" prop="discardDate">
87
        <template slot-scope="scope">
88
          <span>{{ parseTime(scope.row.discardDate, '{y}-{m}-{d}') }}</span>
89 90
        </template>
      </el-table-column>
91
      <el-table-column label="安全评定日期" align="center" prop="safeJudgeDate">
92
        <template slot-scope="scope">
93
          <span>{{ parseTime(scope.row.safeJudgeDate, '{y}-{m}-{d}') }}</span>
94 95
        </template>
      </el-table-column>
96
      <el-table-column label="已检验次数" align="center" prop="inspectedTimes"/>
97
      <!-- <el-table-column label="钢瓶状态" align="center"  prop="state"/> 2024-09-13 wh 去掉,感觉监管不需要 -->
wanghao's avatar
wanghao committed
98
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-document"
            @click="handleDetail(scope.row)"
          >详情</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"
    />
    <!-- 详情 -->
    <DetailInfo ref="detail"/>
119 120 121 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
    
    <!-- 用户导入对话框 -->
    <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
      <el-upload
        ref="upload"
        :limit="1"
        accept=".xlsx, .xls"
        :headers="upload.headers"
        :action="upload.url + '?updateSupport=' + upload.updateSupport"
        :disabled="upload.isUploading"
        :on-progress="handleFileUploadProgress"
        :on-success="handleFileSuccess"
        :auto-upload="false"
        drag
      >
        <i class="el-icon-upload"></i>
        <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
        <div class="el-upload__tip text-center" slot="tip">
          <span>仅允许导入xlsxlsx格式文件。</span>
          <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate">下载模板</el-link>

          <br> 
        </div>
      </el-upload>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFileForm"> </el-button>
        <el-button @click="upload.open = false"> </el-button>
      </div>
    </el-dialog>


150 151 152 153
  </div>
</template>

<script>
154
import { listFiles, getFiles, delFiles, addFiles, updateFiles, exportFiles,importTemplate } from "@/api/lpgRegulation/files";
155 156
import ImageUpload from '@/components/ImageUpload';
import DetailInfo from "./components/indexInfo";
157
import { getToken } from "@/utils/auth"; 
158 159 160 161 162 163 164 165

export default {
  name: "Files",
  components: {
    ImageUpload,DetailInfo
  },
  data() {
    return {
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182
      
      upload: {
        // 是否显示弹出层(用户导入)
        open: false,
        // 弹出层标题(用户导入)
        title: "",
        // 是否禁用上传
        isUploading: false,
        // 是否更新已经存在的用户数据
        updateSupport: 0,
        // 设置上传的请求头部
        headers: { Authorization: "Bearer " + getToken() },
        // 上传的地址
        url: process.env.VUE_APP_BASE_API + "/lpg/gasbottlefiles/importData"
      },  

      stateOptions:[
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
        {
          value: 1,
          label: '新增'
        },
        {
          value: 2,
          label: '修改'
        },
        {
          value: -1,
          label: '删除'
        },
      ],
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 液化石油气-气瓶档案表格数据
      filesList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
220
        cChkDate: null,
221
        nchkDate: null,
222 223 224
        productDate: null,
        discardDate: null,
        safeJudgeDate: null,
225 226
        gpressure: null,
        wpressure: null,
227 228 229 230 231
        selfWeight: null,
        permitNo: null,
        valveName: null,
        state: null,
        makeInfo: null
232 233 234 235 236 237 238 239 240 241 242 243
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265
    
    /** 下载模板操作 */
    importTemplate() {
      importTemplate().then(response => {
          this.download(response.msg);
      });
    }, 

    handleImport(){
      this.upload.title = "气瓶档案导入"; // todo
      this.upload.open = true;
    },
    // 文件上传处理中
    handleFileUploadProgress(event,file,fileList) {
      this.upload.isUploading = true;
      this.$showLoading.show();
    },

    // 文件上传成功处理
    handleFileSuccess(response, file, fileList) {
      this.upload.open = false;
      this.upload.isUploading = false;
266
      this.$refs.upload.clearFiles();        
267
      this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + "成功:" + response.data.successNum + "条,失败:" + response.data.errorNum + "条" + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
268 269 270 271 272 273 274 275 276
      this.getList();
      this.$showLoading.hide();
    },

    // 提交上传文件
    submitFileForm() {
      this.$refs.upload.submit(); 
    },

277 278 279

    // 是否下发 0-不下发 1 - 下发字典翻译
    fStateFormat(row, column ) {
280
      if (row.state === 1) {
281
          return "新增"
282
      } else if(row.state  === 2) {
283
          return "修改"
284
      } else if(row.state  === -1) {
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305
          return "删除"
      }
    },

    /** 查询液化石油气-气瓶档案列表 */
    getList() {
      this.loading = true;
      listFiles(this.queryParams).then(response => {
        this.filesList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
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
        gasBottleFilesId: null,
        stationId: null,
        regId: null,
        regCode: null,
        equNo: null,
        equTypeCode: null,
        equType: null,
        mediumCode: null,
        medium: null,
        makeDate: null,
        makeInfo: null,
        selfId: null,
        number: null,
        allowedFillingWeight: null,
        wayCard: null,
        provinceCode: null,
        provinceName: null,
        cityCode: null,
        cityName: null,
        countryCode: null,
        countryName: null,
        pressure: null,
        volume: null,
        volumeUnit: null,
        checkId: null,
        checkReportNo: null,
        isCard: null,
        departmentId: null,
        checkDeptCode: null,
        checkDeptName: null,
        checkDate: null,
        nextCheckDate: null,
        scrapId: null,
        scrapDate: null,
        scrapNo: null,
        bottleStatus: "0",
        reportStatus: 0,
        changeStatus: 0,
        status: "0",
        sbCode: null,
        cardRecId: null,
        appId: null,
348
        qrcode: null,
349 350 351 352 353 354 355 356 357
        cardSendMan: null,
        cardSendDeptCode: null,
        cardSendDeptName: null,
        cardSendTime: null,
        buildUserId: null,
        buildUser: null,
        bak0: null,
        bak1: null,
        bak2: null,
358 359
        pchkDate: null,
        nchkDate: null,
360 361 362
        productDate: null,
        discardDate: null,
        safeJudgeDate: null,
363 364
        gpressure: null,
        wpressure: null,
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
        selfWeight: null,
        thickness: null,
        permitNo: null,
        valveType: null,
        valveName: null,
        imageList: null,
        payImage: null,
        batchImage: null,
        deviceImage: null,
        checkImage: null,
        equNoImage: null,
        selfIdImage: null,
        botImage: null,
        botSpecType: null,
        botSpecName: null,
        bottleType: null,
        inspectedTimes: null,
        isSpecialized: null,
        valveManuFacturer: null,
        inspectionLabel: null,
        thirdPartyLabel: null,
        holeCode: null,
        bottleStorageType: null,
        sourceFrom: null,
        rowVersion: null,
        state: null,
        optId: null,
        optName: null,
        addTime: null,
        upTime: null,
        upOptId: null,
        upOptName: null
397 398 399 400 401 402 403 404 405 406 407 408 409 410 411
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
412
      this.ids = selection.map(item => item.gasBottleFilesId)
413 414 415 416 417
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    //详情
    handleDetail(row){
418
      this.$refs.detail.getDetailInfo(row.gasBottleFilesId);
419 420 421 422 423 424 425 426 427
    },
    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams;
      this.$confirm('是否确认导出所有液化石油气-气瓶档案数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(() => {
428
          this.$showLoading.show();
429 430 431 432 433
          this.exportLoading = true;
          return exportFiles(queryParams);
        }).then(response => {
          this.download(response.msg);
          this.exportLoading = false;
434
          this.$showLoading.hide();
435 436 437 438 439
        }).catch(() => {});
    }
  }
};
</script>