JX.Li 1 سال پیش
والد
کامیت
3d7ac41973
4فایلهای تغییر یافته به همراه175 افزوده شده و 48 حذف شده
  1. 14 1
      src/api/gas/area.js
  2. 136 18
      src/views/gas/area/index.vue
  3. 13 17
      src/views/gas/building/index.vue
  4. 12 12
      src/views/gas/unit/index.vue

+ 14 - 1
src/api/gas/area.js

@@ -7,7 +7,20 @@ export function getAreaList() {
     method: 'get',
   })
 }
-
+// 小区导入滚动条监控接口
+export function flushProgress() {
+  return request({
+    url: '/gas/area/flushProgress',
+    method: 'get',
+  })
+}
+// 小区导入滚动条停止监控接口
+export function clearFlushProgress() {
+  return request({
+    url: '/gas/area/clearFlushProgress',
+    method: 'get',
+  })
+}
 //释放
 export function releaseIs(id) {
   return request({

+ 136 - 18
src/views/gas/area/index.vue

@@ -72,6 +72,17 @@
       </el-col>
       <el-col :span="1.5">
         <el-button
+          type="info"
+          plain
+          icon="el-icon-upload2"
+          size="mini"
+          @click="handleImport"
+          v-hasPermi="['system:user:import']"
+        >导入小区
+        </el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
           type="warning"
           plain
           icon="el-icon-download"
@@ -90,16 +101,16 @@
       <el-table-column label="主键id" align="center" prop="id" v-if="true"/>
       <el-table-column label="小区名" align="center" prop="name"/>
       <el-table-column label="负责工长" align="center" prop="userName">
-<!--        <template slot-scope="scope">-->
-<!--          {{ getUserName(scope.row.userId) }}-->
-<!--        </template>-->
+        <!--        <template slot-scope="scope">-->
+        <!--          {{ getUserName(scope.row.userId) }}-->
+        <!--        </template>-->
       </el-table-column>
-<!--      <el-table-column label="是否释放" align="center" prop="releaseIs">-->
-<!--        <template slot-scope="scope">-->
-<!--          <dict-tag :options="dict.type.release_status" :value="scope.row.releaseIs"/>-->
-<!--        </template>-->
-<!--      </el-table-column>-->
-<!--      <el-table-column label="释放人" align="center" prop="releaseBy"/>-->
+      <!--      <el-table-column label="是否释放" align="center" prop="releaseIs">-->
+      <!--        <template slot-scope="scope">-->
+      <!--          <dict-tag :options="dict.type.release_status" :value="scope.row.releaseIs"/>-->
+      <!--        </template>-->
+      <!--      </el-table-column>-->
+      <!--      <el-table-column label="释放人" align="center" prop="releaseBy"/>-->
       <el-table-column label="行政区" align="center" prop="district">
         <template slot-scope="scope">
           <dict-tag :options="dict.type.district" :value="scope.row.district"/>
@@ -116,14 +127,14 @@
             v-hasPermi="['gas:area:edit']"
           >修改
           </el-button>
-<!--          <el-button-->
-<!--            size="mini"-->
-<!--            type="text"-->
-<!--            icon="el-icon-edit"-->
-<!--            @click="handleRelease(scope.row)"-->
-<!--            v-hasPermi="['gas:area:edit']"-->
-<!--          >释放-->
-<!--          </el-button>-->
+          <!--          <el-button-->
+          <!--            size="mini"-->
+          <!--            type="text"-->
+          <!--            icon="el-icon-edit"-->
+          <!--            @click="handleRelease(scope.row)"-->
+          <!--            v-hasPermi="['gas:area:edit']"-->
+          <!--          >释放-->
+          <!--          </el-button>-->
           <el-button
             size="mini"
             type="text"
@@ -143,6 +154,45 @@
       :limit.sync="queryParams.pageSize"
       @pagination="getList"
     />
+    <!-- 用户导入对话框 -->
+    <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">
+          <!--<div class="el-upload__tip" slot="tip">-->
+          <!--<el-checkbox v-model="upload.updateSupport"/>-->
+          <!--是否更新已经存在的用户数据-->
+          <!--</div>-->
+          <span>仅允许导入xls、xlsx格式文件。</span>
+          <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;"
+                   @click="importTemplate"
+          >下载模板
+          </el-link>
+        </div>
+      </el-upload>
+      <div style="padding-top: 15px;line-height: 25px;font-size: 14px;">
+        完成度:{{ bfb }}%
+        <progress max="100" :value="bfb" style="width: 200px;height: 18px;"></progress>
+        <br>
+        导入结果:{{ jdtMsg }}
+      </div>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitFileForm">确 定</el-button>
+        <el-button @click="upload.open = false;bfb='0';jdtMsg=''">取 消</el-button>
+      </div>
+    </el-dialog>
 
     <!-- 添加或修改小区对话框 -->
     <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
@@ -184,15 +234,44 @@
 </template>
 
 <script>
-import {listArea, getArea, delArea, addArea, updateArea, releaseIs} from "@/api/gas/area";
+import {
+  listArea,
+  getArea,
+  delArea,
+  addArea,
+  updateArea,
+  releaseIs,
+  flushProgress,
+  clearFlushProgress
+} from "@/api/gas/area";
 import {getWorker} from "@/api/gas/user";
 import el from "element-ui/src/locale/lang/el";
+import {getToken} from "@/utils/auth";
 
 export default {
   name: "Area",
   dicts: ['release_status', 'district', 'district'],
   data() {
     return {
+      //进度条
+      timeInterval: null,
+      bfb: '0',
+      jdtMsg: '',
+      // 用户导入参数
+      upload: {
+        // 是否显示弹出层(用户导入)
+        open: false,
+        // 弹出层标题(用户导入)
+        title: '',
+        // 是否禁用上传
+        isUploading: false,
+        // 是否更新已经存在的用户数据
+        updateSupport: 0,
+        // 设置上传的请求头部
+        headers: { Authorization: 'Bearer ' + getToken() },
+        // 上传的地址
+        url: process.env.VUE_APP_BASE_API + '/gas/area/importData'
+      },
       // 按钮loading
       buttonLoading: false,
       // 遮罩层
@@ -249,6 +328,45 @@ export default {
     this.getList();
   },
   methods: {
+    // 文件上传中处理
+    handleFileUploadProgress(event, file, fileList) {
+      this.upload.isUploading = true
+    },
+    // 文件上传成功处理
+    handleFileSuccess(response, file, fileList) {
+      this.upload.isUploading = false
+      this.$refs.upload.clearFiles()
+      this.getList()
+    },
+    /** 下载模板操作 */
+    importTemplate() {
+      this.$download.excel('/gas/area/importTemplate')
+    },
+    // 提交上传文件
+    submitFileForm() {
+      const ther = this
+      this.timeInterval = setInterval(function() {
+        ther.flushProgress()
+      }, 1500)
+      this.$refs.upload.submit()
+    },
+    // 提交上传文件
+    flushProgress() {
+      flushProgress().then(response => {
+        this.bfb = parseInt(response.data.bfb) >= 100 ? 100 : response.data.bfb
+        this.jdtMsg = response.data.message
+        if (response.data.message != null && response.data.message != '') {
+          clearFlushProgress().then(response => {
+          })
+          clearInterval(this.timeInterval)
+        }
+      })
+    },
+    /** 导入按钮操作 */
+    handleImport() {
+      this.upload.title = '用户导入'
+      this.upload.open = true
+    },
     //释放
     handleRelease(row) {
       this.$modal.confirm('请确认照片是否下载!释放过程不可逆!是否释放?').then(() => {

+ 13 - 17
src/views/gas/building/index.vue

@@ -60,29 +60,25 @@
         >删除
         </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="['gas:building:export']"
-        >导出
-        </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="['gas:building:export']"-->
+<!--        >导出-->
+<!--        </el-button>-->
+<!--      </el-col>-->
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
     <el-table v-loading="loading" :data="buildingList" @selection-change="handleSelectionChange">
       <el-table-column type="selection" width="55" align="center"/>
       <el-table-column label="id" align="center" prop="id" v-if="true"/>
-      <el-table-column label="所属小区" align="center" prop="areaId">
-        <template slot-scope="scope">
-          {{ getAreaName(scope.row.areaId) }}
-        </template>
-      </el-table-column>
+      <el-table-column label="所属小区" align="center" prop="areaName"/>
       <el-table-column label="楼宇名" align="center" prop="name"/>
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">

+ 12 - 12
src/views/gas/unit/index.vue

@@ -69,18 +69,18 @@
         >删除
         </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="['gas:unit:export']"
-        >导出
-        </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="['gas:unit:export']"-->
+<!--        >导出-->
+<!--        </el-button>-->
+<!--      </el-col>-->
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>