Bladeren bron

工单维修

lmc 2 jaren geleden
bovenliggende
commit
e97edd5584
8 gewijzigde bestanden met toevoegingen van 384 en 400 verwijderingen
  1. 1 0
      src/main.js
  2. 3 3
      src/router/index.js
  3. 15 0
      src/utils/api.js
  4. 251 0
      src/views/deviceAlarm.vue
  5. 0 307
      src/views/deviceError.vue
  6. 22 36
      src/views/home.vue
  7. 83 53
      src/views/repairDetail.vue
  8. 9 1
      src/views/repairList.vue

+ 1 - 0
src/main.js

@@ -7,6 +7,7 @@ import { vant } from './utils/vant.config';
 import 'vant/es/toast/style';//无法自动按需引入这两个的样式,需要手动引入
 import 'vant/es/notify/style';
 import 'vant/es/dialog/style';
+import 'vant/es/image-preview/style';
 
 if (process.env.NODE_ENV !== "production") {
     new VConsole({ theme: 'dark' });

+ 3 - 3
src/router/index.js

@@ -54,9 +54,9 @@ const routes = [
     },
   },
   {
-    name: 'deviceError',
-    path: '/deviceError',
-    component: () => import('../views/deviceError'),
+    name: 'deviceAlarm',
+    path: '/deviceAlarm',
+    component: () => import('../views/deviceAlarm'),
     meta: {
       title: '设备异常',
     },

+ 15 - 0
src/utils/api.js

@@ -14,6 +14,7 @@ export default {
     // 首页信息
     homedata: (params) => service.get("/app/home/homedata", params),
 
+
     //上传图片
     uploadFile: (params) => service.post("/app/uploadFile", params, { header: { "Content-Type": "multipart/form-data" } }),
 
@@ -22,4 +23,18 @@ export default {
 
     //工单维修--分页查询
     repairInfoQuery: (params) => service.get("/app/repairorder/page", { params: params }),
+
+    //工单维修--详情
+    repairInfoDetail: (id) => service.get(`/app/repairorder/${id}`),
+
+    //工单维修--联系人列表
+    repairInfoUser: (params) => service.get('/app/user/list', { params: params }),
+
+    //工单维修--指派
+    repairInfoDispatch: (params) => service.put('/app/repairorder', { params: params }),
+
+    // 设备异常列表
+    deviceAlarmInfoQuery: (params) => service.get("/app/home/actualAlertList", params),
+
+
 }

+ 251 - 0
src/views/deviceAlarm.vue

@@ -0,0 +1,251 @@
+<template>
+  <van-nav-bar title="设备异常" safe-area-inset-top>
+    <template #left>
+      <van-icon
+        :name="require('@/assets/arrow-left.svg')"
+        size="24"
+        @click="backPath"
+      />
+    </template>
+  </van-nav-bar>
+  <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
+    <div class="page_info">
+      <van-row align="center" class="position_pannel">
+        <van-col>
+          <van-image
+            :src="require('@/assets/position.svg')"
+            width="16"
+            height="16"
+            fit="contain"
+          />
+          <van-col>{{ name }}</van-col>
+          <van-image
+            :src="require('@/assets/arrow-right.svg')"
+            width="24"
+            height="24"
+            fit="contain"
+          />
+        </van-col>
+        <van-col @click="toPath('/userInfo', 'account')">
+          <van-image
+            :src="require('@/assets/user.svg')"
+            width="16"
+            height="16"
+            fit="contain"
+          />
+        </van-col>
+      </van-row>
+      <!-- <div class="drop_down">
+      <van-dropdown-menu active-color="#1989fa">
+        <van-dropdown-item
+          v-model="checkType"
+          @change="handelChange('checkType', checkType)"
+          :title="checkTypeTitle"
+          :options="checkTypeList"
+        />
+        <van-dropdown-item
+          v-model="checkPerson"
+          @change="handelChange('checkPerson', checkPerson)"
+          :title="checkPersonTitle"
+          :options="checkPersonList"
+        />
+      </van-dropdown-menu>
+    </div> -->
+      <van-row align="center" class="list_total">
+        <van-col>共有</van-col>
+        <v-count-up
+          :end-val="dataList.length"
+          class="count_up"
+          options="{ separator: ',' }"
+        />
+        <van-col>条记录</van-col>
+      </van-row>
+      <div class="info_list">
+        <van-list
+          v-model:loading="loading"
+          :finished="finished"
+          :error="error"
+          error-text="请求失败,点击重新加载"
+          finished-text="没有更多了"
+          @load="onLoad"
+        >
+          <div v-for="item in dataList" :key="item.id" class="list_item">
+            <span class="header">{{ item.name }}</span>
+            <span>空间信息:{{ item.position }}</span>
+            <span>设备编号:{{ item.deviceNo }}</span>
+            <span style="color: #fa5555">告警原因:{{ item.reason }}</span>
+            <span>告警内容:{{ item.content }}</span>
+          </div>
+        </van-list>
+      </div>
+    </div>
+  </van-pull-refresh>
+</template>
+<script>
+import Api from "../utils/api";
+import VCountUp from "./CountUp";
+export default {
+  components: {
+    "v-count-up": VCountUp,
+  },
+  data() {
+    return {
+      name: "电商园四期-B座",
+      dataList: [],
+      loading: false,
+      refreshing: false,
+      finished: false,
+    };
+  },
+
+  methods: {
+    onLoad() {
+      setTimeout(async () => {
+        if (this.refreshing) {
+          this.dataList = [];
+          this.refreshing = false;
+        }
+        await this.getDataList();
+      }, 100);
+    },
+    onRefresh() {
+      // 清空列表数据
+      this.finished = false;
+      // 重新加载数据
+      // 将 loading 设置为 true,表示处于加载状态
+      this.loading = true;
+      this.onLoad();
+    },
+    // 获取列表数据方法
+    getDataList() {
+      Api.deviceAlarmInfoQuery({
+        buildingId: "",
+        storeyId: "",
+      }).then((res) => {
+        if (res.code == 0) {
+          if (res.data) {
+            if (res.data.list.length == 0) {
+              // 判断获取数据条数若等于0
+              this.dataList = []; // 清空数组
+              this.finished = true; // 停止加载
+            }
+            // 若数据条数不等于0
+            this.dataList.push(...res.data.list); // 将数据放入list中
+            this.loading = false; // 加载状态结束
+
+            // 如果list长度大于等于总数据条数,数据全部加载完成
+            if (this.dataList.length >= res.data.total) {
+              this.finished = true; // 结束加载状态
+            }
+          } else {
+            // 判断获取数据条数若等于0
+            this.dataList = []; // 清空数组
+            this.finished = true; // 停止加载
+          }
+        } else {
+          this.loading = false; // 加载状态结束
+          this.finished = true; // 停止加载
+        }
+      });
+    },
+    backPath() {
+      this.$router.back();
+    },
+  },
+};
+</script>
+<style lang="scss" scoped>
+.page_info {
+  height: 100%;
+  .position_pannel {
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+    padding: 10px 16px;
+    background: #5c8fff;
+    box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.04);
+    .van-col {
+      height: 24px;
+      font-size: 16px;
+      color: #ffffff;
+      line-height: 24px;
+      text-indent: 4px;
+      text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.04);
+      display: flex;
+      align-items: center;
+      letter-spacing: 2px;
+    }
+  }
+  .list_total {
+    padding: 0 16px;
+    margin: 8px 0;
+    display: flex;
+    text-align: left;
+    .van-col {
+      height: 16px;
+      font-size: 12px;
+      font-weight: 400;
+      color: #999999;
+      line-height: 16px;
+    }
+    .count_up {
+      font-size: 16px;
+      font-weight: 500;
+      color: #fa5555;
+      margin: 0 2px;
+    }
+  }
+
+  .info_list {
+    padding: 0 16px;
+    .list_item {
+      background: #ffffff;
+      box-shadow: 0px 0px 10px 0px rgba(153, 153, 153, 0.15);
+      border-radius: 4px;
+      margin-bottom: 12px;
+      padding: 12px 16px;
+      display: flex;
+      flex-direction: column;
+      align-items: flex-start;
+      position: relative;
+      &:nth-last-child(1) {
+        margin-bottom: 0;
+      }
+      .header {
+        height: 22px;
+        font-size: 16px;
+        font-weight: 600;
+        color: #313836;
+        line-height: 22px;
+        margin-bottom: 8px;
+      }
+      span {
+        height: 18px;
+        font-size: 14px;
+        font-weight: 400;
+        color: #999999;
+        line-height: 18px;
+        margin-bottom: 4px;
+        &:nth-last-child(1) {
+          margin-bottom: 0;
+        }
+      }
+      .reduce_type {
+        position: absolute;
+        top: 0;
+        right: 0;
+        width: 48px;
+        height: 24px;
+        border-radius: 0px 4px 0px 10px;
+        span {
+          height: 16px;
+          font-size: 12px;
+          font-weight: 400;
+          color: #ffffff;
+          line-height: 16px;
+        }
+      }
+    }
+  }
+}
+</style>

+ 0 - 307
src/views/deviceError.vue

@@ -1,307 +0,0 @@
-<template>
-  <van-nav-bar
-    title="设备异常"
-    left-arrow
-    @click-left="onClickLeft"
-    safe-area-inset-top
-  />
-  <div class="page_check">
-    <div class="search_pannel">
-      <div class="pannel_left">
-        <van-image
-          :src="require('@/assets/position.svg')"
-          width="16"
-          height="16"
-          fit="contain"
-        />
-        <span>{{ name }}</span>
-        <van-image
-          :src="require('@/assets/arrow-right.svg')"
-          width="24"
-          height="24"
-          fit="contain"
-        />
-      </div>
-      <div class="pannel_right" @click="toPath">
-        <van-image
-          :src="require('@/assets/search.svg')"
-          width="16"
-          height="16"
-          fit="contain"
-        />
-      </div>
-    </div>
-    <div class="drop_down">
-      <van-dropdown-menu active-color="#1989fa">
-        <van-dropdown-item
-          v-model="checkType"
-          @change="handelChange('checkType', checkType)"
-          :title="checkTypeTitle"
-          :options="checkTypeList"
-        />
-        <van-dropdown-item
-          v-model="checkPerson"
-          @change="handelChange('checkPerson', checkPerson)"
-          :title="checkPersonTitle"
-          :options="checkPersonList"
-        />
-      </van-dropdown-menu>
-    </div>
-    <div class="list_total">
-      <span>共有</span>
-      <v-count-up
-        :end-val="total"
-        class="count_up"
-        options="{ separator: ',' }"
-      />
-      <span>条记录</span>
-    </div>
-    <div class="check_info">
-      <div class="info_list">
-        <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
-          <van-list
-            v-model:loading="loading"
-            :finished="finished"
-            :error="error"
-            error-text="请求失败,点击重新加载"
-            finished-text="没有更多了"
-            @load="onLoad"
-          >
-            <div v-for="item in list" :key="item.id" class="list_item">
-              <span class="header">{{ item.name }}</span>
-              <span>空间信息:{{ item.position }}</span>
-              <span>设备编号:{{ item.deviceNo }}</span>
-              <span style="color: #fa5555">告警原因:{{ item.reason }}</span>
-              <span>告警内容:{{ item.content }}</span>
-            </div>
-          </van-list>
-        </van-pull-refresh>
-      </div>
-    </div>
-  </div>
-</template>
-<script>
-import { isEmpty } from "@/utils/index.js";
-import VCountUp from "./CountUp";
-export default {
-  components: {
-    "v-count-up": VCountUp,
-  },
-  data() {
-    return {
-      loading: false,
-      name: "电商园四期-B座",
-      checkType: "",
-      checkPerson: "",
-      checkTypeTitle: "巡检类型",
-      checkPersonTitle: "巡检人员",
-      checkTypeList: [
-        { text: "安保", value: 1 },
-        { text: "保洁", value: 2 },
-      ],
-      checkPersonList: [
-        { text: "张三", value: 1 },
-        { text: "李四", value: 2 },
-      ],
-      total: 3,
-      list: [
-        {
-          name: "B座13楼女卫生间电表",
-          position: "电商园四期-B座-13层",
-          deviceNo: "A32445",
-          reason: "温度≥ 40℃",
-          content: "实时温度 52℃",
-        },
-      ],
-      loading: false,
-      refreshing: false,
-      finished: false,
-    };
-  },
-
-  methods: {
-    reduceType_filter(val) {
-      if (isEmpty(val)) {
-        return {};
-      }
-      if (val == 1) {
-        return { label: "预存", color: "#30D3A2" };
-      }
-      if (val == 2) {
-        return { label: "补助", color: "#09C700" };
-      }
-      if (val == 3) {
-        return { label: "退费", color: "#FA5555" };
-      }
-      if (val == 4) {
-        return { label: "核缴(水)", color: "#FF9C27" };
-      }
-      if (val == 4) {
-        return { label: "核缴(电)", color: "#FF9C27" };
-      }
-      if (val == 4) {
-        return { label: "核缴(物业)", color: "#FF9C27" };
-      }
-    },
-    onLoad() {
-      setTimeout(() => {
-        if (this.refreshing) {
-          this.list = [];
-          this.refreshing = false;
-        }
-
-        for (let i = 0; i < 10; i++) {
-          this.list.push(this.list.length + 1);
-        }
-        this.loading = false;
-
-        if (this.list.length >= 40) {
-          this.finished = true;
-        }
-      }, 1000);
-    },
-
-    onRefresh() {
-      // 清空列表数据
-      this.finished = false;
-
-      // 重新加载数据
-      // 将 loading 设置为 true,表示处于加载状态
-      this.loading = true;
-      this.onLoad();
-    },
-    // change事件可以拿到的是value
-    handelChange(type, val) {
-      console.log(type, val);
-      if (type == "checkType") {
-        // 这里打印出来的值就是我们想要的text
-        this.checkTypeTitle = this.checkTypeList.filter(
-          (item) => item.value === val
-        )[0].text;
-      }
-      if (type == "checkPerson") {
-        // 这里打印出来的值就是我们想要的text
-        this.checkPersonTitle = this.checkPersonList.filter(
-          (item) => item.value === val
-        )[0].text;
-      }
-    },
-    onClickLeft() {},
-  },
-};
-</script>
-<style lang="scss" scoped>
-.page_check {
-  height: 100%;
-  .search_pannel {
-    padding: 10px 16px;
-    background: #5c8fff;
-    box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.04);
-    display: flex;
-    align-items: center;
-    .pannel_left {
-      display: flex;
-      align-items: center;
-      span {
-        height: 24px;
-        font-size: 16px;
-        font-weight: 400;
-        color: #ffffff;
-        line-height: 24px;
-        text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.04);
-        text-indent: 4px;
-      }
-    }
-    .pannel_left,
-    .pannel_right {
-      flex: 1;
-    }
-    .pannel_right {
-      text-align: right;
-    }
-  }
-  .drop_down {
-    /deep/ {
-      --van-gray-4: #999999;
-      --van-dropdown-menu-title-text-color: #0c1935;
-    }
-  }
-  .list_total {
-    padding: 0 16px;
-    margin: 8px 0;
-    display: flex;
-    text-align: left;
-    span {
-      height: 16px;
-      font-size: 12px;
-      font-weight: 400;
-      color: #999999;
-      line-height: 16px;
-    }
-    .count_up {
-      font-size: 16px;
-      font-weight: 500;
-      color: #fa5555;
-      margin: 0 2px;
-    }
-  }
-  .check_info {
-    padding: 0 16px;
-    height: calc(
-      100% - var(--van-nav-bar-height) - var(--van-dropdown-menu-height) - 76px
-    );
-    .info_list {
-      height: 100%;
-      overflow-y: auto;
-      .list_item {
-        background: #ffffff;
-        box-shadow: 0px 0px 10px 0px rgba(153, 153, 153, 0.15);
-        border-radius: 4px;
-        margin-bottom: 12px;
-        padding: 12px 16px;
-        display: flex;
-        flex-direction: column;
-        align-items: flex-start;
-        position: relative;
-        &:nth-last-child(1) {
-          margin-bottom: 0;
-        }
-        .header {
-          height: 22px;
-          font-size: 16px;
-          font-weight: 600;
-          color: #313836;
-          line-height: 22px;
-          margin-bottom: 8px;
-        }
-        span {
-          height: 18px;
-          font-size: 14px;
-          font-weight: 400;
-          color: #999999;
-          line-height: 18px;
-          margin-bottom: 4px;
-          &:nth-last-child(1) {
-            margin-bottom: 0;
-          }
-        }
-        .reduce_type {
-          position: absolute;
-          top: 0;
-          right: 0;
-          width: 48px;
-          height: 24px;
-          border-radius: 0px 4px 0px 10px;
-          span {
-            height: 16px;
-            font-size: 12px;
-            font-weight: 400;
-            color: #ffffff;
-            line-height: 16px;
-          }
-        }
-      }
-    }
-  }
-}
-</style>

+ 22 - 36
src/views/home.vue

@@ -10,7 +10,7 @@
       class="info_bg"
       :style="{ 'margin-bottom': role == 'repair' ? 0 : '42px' }"
     >
-      <van-row align="center" class="title">
+      <van-row align="center" class="position_pannel">
         <van-col>
           <van-image
             :src="require('@/assets/position.svg')"
@@ -135,7 +135,7 @@
       <template v-if="role && role != 'rent'">
         <van-row align="center" justify="space-between" class="sub_title">
           <van-col class="title">设备异常</van-col>
-          <van-col class="function_btn">
+          <van-col class="function_btn" @click="toPath('/deviceAlarm')">
             <van-col>立即查看</van-col>
             <van-image
               :src="require('@/assets/btn-arrow-right.svg')"
@@ -198,7 +198,7 @@
             class="table_body"
           >
             <van-col span="8" style="color: #999999; font-size: 12px">{{
-              item.payType
+             `${payType_filter(item.payType)}` 
             }}</van-col>
             <van-col span="8">{{ item.arrearageNum }}</van-col>
             <van-col span="8">{{ item.arrearageAmount }}</van-col>
@@ -283,6 +283,7 @@
   </van-tabbar>
 </template>
 <script>
+import { isEmpty } from "@/utils/index.js";
 import api from "../utils/api";
 import VCountUp from "./CountUp";
 export default {
@@ -291,7 +292,7 @@ export default {
   },
   data() {
     return {
-      role: "admin",
+      role: "",
       name: "电商园四期-B座",
       activeTabBar: "home",
       functionList: [
@@ -330,9 +331,7 @@ export default {
           },
         },
       ],
-      billPaymentList: [
-        { id: 1, payType: "电费", arrearageNum: 3000, arrearageAmount: 900000 },
-      ],
+      billPaymentList: [],
       abnormalNum: { label: "异常总数", count: "" },
       workList: [
         {
@@ -357,9 +356,23 @@ export default {
   },
   created() {
     this.getHomeData();
-    // this.role = localStorage.getItem("role");
+    this.role = localStorage.getItem("role");
   },
   methods: {
+    payType_filter(val) {
+      if (isEmpty(val)) {
+        return "";
+      }
+      if (val == "Water") {
+        return "水费";
+      }
+      if (val == "Elec") {
+        return "电费";
+      }
+      if (val == 3) {
+        return "物业相关";
+      }
+    },
     getHomeData() {
       api.homedata().then((res) => {
         if (res.code == 0) {
@@ -383,32 +396,6 @@ export default {
         }
       });
     },
-    onLoad() {
-      setTimeout(() => {
-        if (this.refreshing.value) {
-          this.list.value = [];
-          this.refreshing.value = false;
-        }
-
-        for (let i = 0; i < 10; i++) {
-          this.list.value.push(this.list.value.length + 1);
-        }
-        this.loading.value = false;
-
-        if (this.list.value.length >= 40) {
-          this.finished.value = true;
-        }
-      }, 1000);
-    },
-    onRefresh() {
-      // 清空列表数据
-      this.finished.value = false;
-
-      // 重新加载数据
-      // 将 loading 设置为 true,表示处于加载状态
-      this.loading.value = true;
-      this.onLoad();
-    },
     toPath(path, val) {
       this.$router.push({
         path: path,
@@ -434,7 +421,7 @@ export default {
     padding-top: 12px;
     margin-bottom: 42px;
     box-sizing: border-box;
-    .title {
+    .position_pannel {
       display: flex;
       align-items: center;
       justify-content: space-between;
@@ -442,7 +429,6 @@ export default {
       .van-col {
         height: 24px;
         font-size: 16px;
-        font-weight: 600;
         color: #ffffff;
         line-height: 24px;
         text-indent: 4px;

+ 83 - 53
src/views/repairDetail.vue

@@ -1,20 +1,25 @@
 <template>
-  <van-nav-bar
-    :title="title"
-    left-arrow
-    @click-left="onClickLeft"
-    safe-area-inset-top
-  />
+  <van-nav-bar :title="title" safe-area-inset-top>
+    <template #left>
+      <van-icon
+        :name="require('@/assets/arrow-left.svg')"
+        size="24"
+        @click="backPath"
+      />
+    </template>
+  </van-nav-bar>
   <div class="page_info">
     <div class="info_list">
       <van-cell-group class="cell_title_icon">
         <van-cell
           title="报修信息"
           :icon="require('@/assets/line.svg')"
-          v-if="dataForm.repairStatus == 2 || dataForm.repairStatus == 3"
+          v-if="
+            role == 'admin' && (dataForm.status == 2 || dataForm.status == 3)
+          "
         />
-        <van-cell title="报修时间" :value="dataForm.repairTime" />
-        <van-cell title="报修位置" :value="dataForm.repairPositionName" />
+        <van-cell title="报修时间" :value="dataForm.createDate" />
+        <van-cell title="报修位置" :value="dataForm.repairPosition" />
         <van-cell
           title="报修区域"
           :value="`${repairRegion_filter(dataForm.repairRegion)}`"
@@ -34,21 +39,13 @@
               :src="item"
               v-for="(item, index) in imagesList"
               :key="item + '_' + index"
-              @click="showImgPreview = true"
             />
-            <van-image-preview
-              v-model:show="showImgPreview"
-              :images="imagesList"
-              v-if="showImgPreview"
-            >
-            </van-image-preview>
           </template>
         </van-cell>
       </van-cell-group>
-
       <van-cell-group
         class="cell_title_icon"
-        v-if="dataForm.repairStatus == 2 || dataForm.repairStatus == 3"
+        v-if="role == 'admin' && (dataForm.status == 2 || dataForm.status == 3)"
       >
         <van-cell title="维修信息" :icon="require('@/assets/line.svg')" />
         <van-cell
@@ -56,11 +53,11 @@
           :value="`${urgency_filter(dataForm.urgency)}`"
         />
         <van-cell title="维修人员" :value="dataForm.repairPersonName" />
-        <van-cell title="联系电话" :value="dataForm.repairPerson" />
+        <van-cell title="联系电话" :value="dataForm.repairPersonId" />
         <van-cell
           title="维修完成时间"
           :value="dataForm.repairFinishTime"
-          v-if="dataForm.repairStatus == 3"
+          v-if="dataForm.status == 3"
         />
       </van-cell-group>
     </div>
@@ -78,7 +75,7 @@
         维修完成
       </van-button>
     </template>
-    <template v-if="role == 1">
+    <template v-if="role == 'admin' && dataForm.status == 1">
       <van-button
         block
         type="primary"
@@ -126,7 +123,7 @@
             @cancel="showRepairPersonPicker = false"
             @confirm="
               (value) => {
-                dataForm.repairPerson = value.value;
+                dataForm.repairPersonId = value.value;
                 dataForm.repairPersonName = value.text;
                 showRepairPersonPicker = false;
               }
@@ -173,6 +170,7 @@
   </van-popup>
 </template>
 <script>
+import Api from "../utils/api";
 import { isEmpty } from "@/utils/index.js";
 import VCountUp from "./CountUp";
 export default {
@@ -181,7 +179,7 @@ export default {
   },
   data() {
     return {
-      role: 3,
+      role: "",
       loading: false,
       title: "",
       showImgPreview: false,
@@ -197,32 +195,28 @@ export default {
         { text: "普通", value: 3 },
       ],
       dataForm: {
-        repairPerson: "15394820234",
-        repairPersonName: "王旭",
+        id: "",
+        repairPersonId: "",
+        repairPersonName: "",
         urgency: "",
         urgencyName: "",
-        repairTime: "2022/05/24 13:32:22",
-        repairFinishTime: "2022/05/24 13:32:22",
-        repairPositionName: "B座13楼1301",
-        repairRegion: 1,
-        repairStatus: 1,
-        repairType: 1,
-        contactPerson: "张浩",
-        contactPhone: "13682307574",
-        faultDes: "女卫生间水龙头一直滴水,关不上,请尽快处理谢谢",
-        faultPics:
-          "https://fastly.jsdelivr.net/npm/@vant/assets/apple-1.jpeg,https://fastly.jsdelivr.net/npm/@vant/assets/apple-2.jpeg",
+        repairTime: "",
+        repairFinishTime: "",
+        repairPositionName: "",
+        repairRegion: "",
+        status: "",
+        repairType: "",
+        contactPerson: "",
+        contactPhone: "",
+        faultDes: "",
+        faultPics: "",
       },
     };
   },
-
   created() {
-    this.imagesList = this.dataForm.faultPics.split(",");
-    if (this.dataForm.repairStatus == 2 || this.dataForm.repairStatus == 3) {
-      this.title = "报修详情";
-    } else {
-      this.title = "工单详情";
-    }
+    this.role = localStorage.getItem("role");
+    this.getDataDetail();
+    this.getUserList();
   },
   methods: {
     repairType_filter(val) {
@@ -250,7 +244,6 @@ export default {
         return "室内";
       }
     },
-
     urgency_filter(val) {
       if (isEmpty(val)) {
         return "";
@@ -265,6 +258,31 @@ export default {
         return "普通";
       }
     },
+    //获取维修人员
+    getUserList() {
+      Api.repairInfoUser({
+        page: 1,
+        limit: 100,
+      }).then((res) => {
+        if (res.code == 0) {
+          this.repairPersonList = res.data.list;
+        }
+      });
+    },
+    getDataDetail() {
+      Api.repairInfoDetail(this.$route.query.id).then((res) => {
+        if (res.code == 0) {
+          this.dataForm = res.data;
+          this.imagesList = this.dataForm.faultPics.split(",");
+          if (this.dataForm.status == 2 || this.dataForm.status == 3) {
+            this.title = "报修详情";
+          } else {
+            this.title = "工单详情";
+          }
+        } else {
+        }
+      });
+    },
     handleClick(type) {
       if (type == "finish") {
         this.$dialog
@@ -290,13 +308,27 @@ export default {
       }
     },
     onSubmit() {
-      this.loading = true;
-      setTimeout(() => {
-        this.loading = false;
-        this.showPopup = false;
-      }, 2000);
+      this.$toast.loading({
+        message: "保存中...",
+        forbidClick: true,
+      });
+      Api.repairInfoDispatch({
+        id: this.dataForm.id,
+        repairPersonId: this.dataForm.repairPersonId,
+        urgency: this.dataForm.urgency,
+      }).then((res) => {
+        if (res.code == 0) {
+          this.$toast.success("保存成功");
+          this.showPopup = false;
+          this.getDataDetail();
+        } else {
+          this.$toast.fail("保存失败");
+        }
+      });
+    },
+    backPath() {
+      this.$router.back();
     },
-    onClickLeft() {},
   },
 };
 </script>
@@ -308,11 +340,9 @@ export default {
         .van-cell__title {
           flex: unset;
         }
-        .van-cell__value {
-          text-align: center;
-        }
         .van-image {
           margin-left: 8px;
+          margin-bottom: 8px;
         }
       }
       .cell_title_icon {

+ 9 - 1
src/views/repairList.vue

@@ -64,7 +64,15 @@
             <van-col
               >报修类型:{{ `${repairType_filter(item.repairType)}` }}</van-col
             >
-            <van-col>维修完成时间:{{ item.repairFinishTime }}</van-col>
+            <template v-if="item.status == 1">
+              <van-col>报修时间:{{ item.createDate }}</van-col>
+            </template>
+            <template v-if="item.status == 2">
+              <van-col>指派时间:{{ item.updateDate }}</van-col>
+            </template>
+            <template v-if="item.status == 3">
+              <van-col>维修完成时间:{{ item.repairFinishTime }}</van-col>
+            </template>
           </div>
         </van-list>
       </div>