浏览代码

Merge branch 'liuqiang'

liuQiang 1 年之前
父节点
当前提交
f9007cc83f
共有 1 个文件被更改,包括 163 次插入51 次删除
  1. 163 51
      src/views/backend/fpdDetection/index.vue

+ 163 - 51
src/views/backend/fpdDetection/index.vue

@@ -1,20 +1,45 @@
 <template>
   <div class="app-container">
-
     <!-- 搜索工作栏 -->
-    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
+    <el-form
+      :model="queryParams"
+      ref="queryForm"
+      size="small"
+      :inline="true"
+      v-show="showSearch"
+      label-width="100px"
+    >
       <el-form-item label="预计检测时间" prop="detdate">
-        <el-date-picker v-model="queryParams.detdate" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
-                        range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
+        <el-date-picker
+          v-model="queryParams.detdate"
+          style="width: 240px"
+          value-format="yyyy-MM-dd HH:mm:ss"
+          type="daterange"
+          range-separator="-"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+          :default-time="['00:00:00', '23:59:59']"
+        />
       </el-form-item>
       <el-form-item label="检测维保结果" prop="detresult">
-        <el-select v-model="queryParams.detresult" placeholder="请选择检测维保结果" clearable size="small">
-          <el-option v-for="dict in this.getDictDatas(DICT_TYPE.BACKEND_DET_RESULT)"
-                       :key="dict.value" :label="dict.label" :value="dict.value"/>
+        <el-select
+          v-model="queryParams.detresult"
+          placeholder="请选择检测维保结果"
+          clearable
+          size="small"
+        >
+          <el-option
+            v-for="dict in this.getDictDatas(DICT_TYPE.BACKEND_DET_RESULT)"
+            :key="dict.value"
+            :label="dict.label"
+            :value="dict.label"
+          />
         </el-select>
       </el-form-item>
       <el-form-item>
-        <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
+        <el-button type="primary" icon="el-icon-search" @click="handleQuery"
+          >搜索</el-button
+        >
         <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
       </el-form-item>
     </el-form>
@@ -26,57 +51,117 @@
                    v-hasPermi="['backend:fpd-detection:create']">新增</el-button>
       </el-col> -->
       <el-col :span="1.5">
-        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
-                   v-hasPermi="['backend:fpd-detection:export']">导出</el-button>
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          @click="handleExport"
+          :loading="exportLoading"
+          v-hasPermi="['backend:fpd-detection:export']"
+          >导出</el-button
+        >
       </el-col>
-      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+      <right-toolbar
+        :showSearch.sync="showSearch"
+        @queryTable="getList"
+      ></right-toolbar>
     </el-row>
 
     <!-- 列表 -->
     <el-table v-loading="loading" :data="list">
       <el-table-column label="ID" align="center" prop="id" />
       <el-table-column label="所属单位" align="center" prop="orgId" />
-      <el-table-column label="预计检测时间" align="center" prop="detdate" width="180">
+      <el-table-column
+        label="预计检测时间"
+        align="center"
+        prop="detdate"
+        width="180"
+      >
         <template v-slot="scope">
           <span>{{ parseTime(scope.row.detdate) }}</span>
         </template>
       </el-table-column>
       <el-table-column label="检测项目" align="center" prop="detinspect" />
       <el-table-column label="检测维保结果" align="center" prop="detresult">
-        <template v-slot="scope">
-          <dict-tag :type="DICT_TYPE.SYSTEM_LOGIN_RESULT" :value="scope.row.detresult" />
-        </template>
+        <!-- <template v-slot="scope">
+          <dict-tag
+            :type="DICT_TYPE.SYSTEM_LOGIN_RESULT"
+            :value="scope.row.detresult"
+          />
+        </template> -->
       </el-table-column>
       <el-table-column label="资料附件" align="center" prop="att" />
-      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+      <el-table-column
+        label="操作"
+        align="center"
+        class-name="small-padding fixed-width"
+      >
         <template v-slot="scope">
-          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
-                     v-hasPermi="['backend:fpd-detection:update']">修改</el-button>
-          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
-                     v-hasPermi="['backend:fpd-detection:delete']">删除</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['backend:fpd-detection:update']"
+            >修改</el-button
+          >
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['backend:fpd-detection:delete']"
+            >删除</el-button
+          >
         </template>
       </el-table-column>
     </el-table>
     <!-- 分页组件 -->
-    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
-                @pagination="getList"/>
+    <pagination
+      v-show="total > 0"
+      :total="total"
+      :page.sync="queryParams.pageNo"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
 
     <!-- 对话框(添加 / 修改) -->
-    <el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body>
+    <el-dialog
+      :title="title"
+      :visible.sync="open"
+      width="500px"
+      v-dialogDrag
+      append-to-body
+    >
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
         <el-form-item label="所属单位" prop="orgId">
           <el-input v-model="form.orgId" placeholder="请输入所属单位" />
         </el-form-item>
         <el-form-item label="预计检测时间" prop="detdate">
-          <el-date-picker clearable v-model="form.detdate" type="date" value-format="timestamp" placeholder="选择预计检测时间" />
+          <el-date-picker
+            clearable
+            v-model="form.detdate"
+            type="date"
+            value-format="timestamp"
+            placeholder="选择预计检测时间"
+          />
         </el-form-item>
         <el-form-item label="检测项目" prop="detinspect">
-          <el-input v-model="form.detinspect" type="textarea" placeholder="请输入内容" />
+          <el-input
+            v-model="form.detinspect"
+            type="textarea"
+            placeholder="请输入内容"
+          />
         </el-form-item>
         <el-form-item label="检测维保结果" prop="detresult">
           <el-select v-model="form.detresult" placeholder="请选择检测维保结果">
-            <el-option v-for="dict in this.getDictDatas(DICT_TYPE.SYSTEM_LOGIN_RESULT)"
-                       :key="dict.value" :label="dict.label" :value="dict.value" />
+            <el-option
+              v-for="dict in this.getDictDatas(DICT_TYPE.SYSTEM_LOGIN_RESULT)"
+              :key="dict.value"
+              :label="dict.label"
+              :value="dict.value"
+            />
           </el-select>
         </el-form-item>
         <el-form-item label="资料附件" prop="att">
@@ -92,12 +177,18 @@
 </template>
 
 <script>
-import { createFpdDetection, updateFpdDetection, deleteFpdDetection, getFpdDetection, getFpdDetectionPage, exportFpdDetectionExcel } from "@/api/backend/fpdDetection";
+import {
+  createFpdDetection,
+  updateFpdDetection,
+  deleteFpdDetection,
+  getFpdDetection,
+  getFpdDetectionPage,
+  exportFpdDetectionExcel,
+} from "@/api/backend/fpdDetection";
 
 export default {
   name: "FpdDetection",
-  components: {
-  },
+  components: {},
   data() {
     return {
       // 遮罩层
@@ -126,8 +217,10 @@ export default {
       form: {},
       // 表单校验
       rules: {
-        orgId: [{ required: true, message: "所属单位不能为空", trigger: "blur" }],
-      }
+        orgId: [
+          { required: true, message: "所属单位不能为空", trigger: "blur" },
+        ],
+      },
     };
   },
   created() {
@@ -138,11 +231,20 @@ export default {
     getList() {
       this.loading = true;
       // 执行查询
-      getFpdDetectionPage(this.queryParams).then(response => {
-        this.list = response.data.list;
-        this.total = response.data.total;
-        this.loading = false;
-      });
+      getFpdDetectionPage(this.queryParams)
+        .then((response) => {
+          if (response.data) {
+            this.list = response.data.list;
+            this.total = response.data.total;
+          } else {
+            this.list = [];
+            this.total = 0;
+          }
+          this.loading = false;
+        })
+        .catch((err) => {
+          this.loading = false;
+        });
     },
     /** 取消按钮 */
     cancel() {
@@ -181,7 +283,7 @@ export default {
     handleUpdate(row) {
       this.reset();
       const id = row.id;
-      getFpdDetection(id).then(response => {
+      getFpdDetection(id).then((response) => {
         this.form = response.data;
         this.open = true;
         this.title = "修改消防设备维护和检测台账";
@@ -189,13 +291,13 @@ export default {
     },
     /** 提交按钮 */
     submitForm() {
-      this.$refs["form"].validate(valid => {
+      this.$refs["form"].validate((valid) => {
         if (!valid) {
           return;
         }
         // 修改的提交
         if (this.form.id != null) {
-          updateFpdDetection(this.form).then(response => {
+          updateFpdDetection(this.form).then((response) => {
             this.$modal.msgSuccess("修改成功");
             this.open = false;
             this.getList();
@@ -203,7 +305,7 @@ export default {
           return;
         }
         // 添加的提交
-        createFpdDetection(this.form).then(response => {
+        createFpdDetection(this.form).then((response) => {
           this.$modal.msgSuccess("新增成功");
           this.open = false;
           this.getList();
@@ -213,27 +315,37 @@ export default {
     /** 删除按钮操作 */
     handleDelete(row) {
       const id = row.id;
-      this.$modal.confirm('是否确认删除消防设备维护和检测台账编号为"' + id + '"的数据项?').then(function() {
+      this.$modal
+        .confirm(
+          '是否确认删除消防设备维护和检测台账编号为"' + id + '"的数据项?'
+        )
+        .then(function () {
           return deleteFpdDetection(id);
-        }).then(() => {
+        })
+        .then(() => {
           this.getList();
           this.$modal.msgSuccess("删除成功");
-        }).catch(() => {});
+        })
+        .catch(() => {});
     },
     /** 导出按钮操作 */
     handleExport() {
       // 处理查询参数
-      let params = {...this.queryParams};
+      let params = { ...this.queryParams };
       params.pageNo = undefined;
       params.pageSize = undefined;
-      this.$modal.confirm('是否确认导出所有消防设备维护和检测台账数据项?').then(() => {
+      this.$modal
+        .confirm("是否确认导出所有消防设备维护和检测台账数据项?")
+        .then(() => {
           this.exportLoading = true;
           return exportFpdDetectionExcel(params);
-        }).then(response => {
-          this.$download.excel(response, '消防设备维护和检测台账.xls');
+        })
+        .then((response) => {
+          this.$download.excel(response, "消防设备维护和检测台账.xls");
           this.exportLoading = false;
-        }).catch(() => {});
-    }
-  }
+        })
+        .catch(() => {});
+    },
+  },
 };
 </script>