Commit 5309d8b2ff4061b0fa3724a3cf1c042cb276fbc1
1 parent
71f53348
报修管理
Showing
14 changed files
with
744 additions
and
28 deletions
src/api/notify/repair.ts
0 → 100644
| 1 | +import request from '../request'; | |
| 2 | +import { deleteEmptyParam } from '@/utils/tool'; | |
| 3 | + | |
| 4 | +/** | |
| 5 | + * @description 工单列表 | |
| 6 | + * @function repairList | |
| 7 | + */ | |
| 8 | +export const repairList = async ( params: any ) => { | |
| 9 | + let res: any = await request({ | |
| 10 | + method: 'get', | |
| 11 | + url: '/repair/list', | |
| 12 | + params: deleteEmptyParam(params) | |
| 13 | + }) | |
| 14 | + return res | |
| 15 | +} | |
| 16 | + | |
| 17 | +/** | |
| 18 | + * @description 新增报修 | |
| 19 | + * @function repairAdd | |
| 20 | + */ | |
| 21 | +export function repairAdd (data) { | |
| 22 | + return request({ | |
| 23 | + method: 'post', | |
| 24 | + url: '/repair/add', | |
| 25 | + data: data | |
| 26 | + }) | |
| 27 | +} | |
| 28 | + | |
| 29 | +/** | |
| 30 | + * @description 工单详情 | |
| 31 | + * @function repairDetail | |
| 32 | + */ | |
| 33 | +export const repairDetail = async ( params: any ) => { | |
| 34 | + let res: any = await request.get( '/repair/getRepairOrder', params ) | |
| 35 | + return res | |
| 36 | +} | |
| 0 | 37 | \ No newline at end of file | ... | ... |
src/api/property/channel.ts
0 → 100644
| 1 | +import request from '../request' | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * @description 栏目列表 | |
| 5 | + * @function columnList | |
| 6 | + */ | |
| 7 | +export const columnList = async ( params: any ) => { | |
| 8 | + let res: any = await request.get( '/column/list', { params } ) | |
| 9 | + return res | |
| 10 | +} | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * @description 新增栏目 | |
| 14 | + * @function columnAdd | |
| 15 | + */ | |
| 16 | +export function columnAdd (data) { | |
| 17 | + return request({ | |
| 18 | + method: 'post', | |
| 19 | + url: '/column/add', | |
| 20 | + data: data | |
| 21 | + }) | |
| 22 | +} | |
| 23 | + | |
| 24 | +/** | |
| 25 | + * @description 修改栏目状态 | |
| 26 | + * @function columnStatus | |
| 27 | + */ | |
| 28 | +export const columnStatus = async ( params: any ) => { | |
| 29 | + let res: any = await request.put( '/column/status', params ) | |
| 30 | + return res | |
| 31 | +} | |
| 32 | + | |
| 33 | +/** | |
| 34 | + * @description 修改栏目 | |
| 35 | + * @function columnEdit | |
| 36 | + */ | |
| 37 | + export const columnEdit = async ( data: any ) => { | |
| 38 | + let res: any = await request.post( '/column/edit', data ) | |
| 39 | + return res | |
| 40 | +} | |
| 41 | + | |
| 42 | + | |
| 43 | +/** | |
| 44 | + * @description 栏目排序 | |
| 45 | + * @function columnSort | |
| 46 | + */ | |
| 47 | + export const columnSort = async ( params: any ) => { | |
| 48 | + let res: any = await request.put( '/column/sort', params ) | |
| 49 | + return res | |
| 50 | +} | |
| 0 | 51 | \ No newline at end of file | ... | ... |
src/layout/enter.vue
| ... | ... | @@ -3,15 +3,17 @@ |
| 3 | 3 | * 公共布局入口组件 |
| 4 | 4 | * @module Enter |
| 5 | 5 | */ |
| 6 | -import { onMounted, reactive } from "vue"; | |
| 6 | +import { onMounted, reactive, computed } from "vue"; | |
| 7 | 7 | import Header from "./header.vue"; |
| 8 | 8 | import Menu from "./menu.vue"; |
| 9 | 9 | import * as store from "@/pinia/index"; |
| 10 | 10 | let asyncData = reactive({ |
| 11 | - isCollapse: null | |
| 12 | -}) | |
| 11 | + isCollapse: null, | |
| 12 | +}); | |
| 13 | 13 | onMounted(() => { |
| 14 | - asyncData.isCollapse = store.family.appStore().isCollapse | |
| 14 | + asyncData.isCollapse = computed (() => { | |
| 15 | + return store.family.appStore().isCollapse | |
| 16 | + }) | |
| 15 | 17 | }); |
| 16 | 18 | </script> |
| 17 | 19 | |
| ... | ... | @@ -30,24 +32,17 @@ onMounted(() => { |
| 30 | 32 | class="view-container" |
| 31 | 33 | :class="asyncData.isCollapse ? 'thinMenu' : 'fatMenu'" |
| 32 | 34 | > |
| 33 | - <router-view v-slot="{ Component, route }"> | |
| 34 | - <transition :name="route.name"> | |
| 35 | - <keep-alive v-if="route?.meta?.keepAlive"> | |
| 36 | - <component :is="Component" /> | |
| 37 | - </keep-alive> | |
| 38 | - <component :is="Component" v-else /> | |
| 39 | - </transition> | |
| 40 | - </router-view> | |
| 35 | + <div> | |
| 36 | + <router-view v-slot="{ Component, route }"> | |
| 37 | + <transition :name="route.name"> | |
| 38 | + <keep-alive v-if="route?.meta?.keepAlive"> | |
| 39 | + <component :is="Component" /> | |
| 40 | + </keep-alive> | |
| 41 | + <component :is="Component" v-else /> | |
| 42 | + </transition> | |
| 43 | + </router-view> | |
| 44 | + </div> | |
| 41 | 45 | </div> |
| 42 | 46 | <!-- TIP 右侧具体页面内容结束 --> |
| 43 | 47 | </div> |
| 44 | 48 | </template> |
| 45 | - | |
| 46 | -<style scoped lang="scss"> | |
| 47 | -.fatMenu { | |
| 48 | - margin-left: $sideBarWidth !important; | |
| 49 | -} | |
| 50 | -.thinMenu { | |
| 51 | - margin-left: $sideBarWidthThin !important; | |
| 52 | -} | |
| 53 | -</style> | ... | ... |
src/layout/header.vue
| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | * 公共布局头部组件 |
| 4 | 4 | * @module Header |
| 5 | 5 | */ |
| 6 | -import { getCurrentInstance, onMounted, reactive } from "vue"; | |
| 6 | +import { getCurrentInstance, onMounted, reactive, computed } from "vue"; | |
| 7 | 7 | import * as store from "@/pinia/index"; |
| 8 | 8 | import { ElMessageBox, ElMessage } from "element-plus"; |
| 9 | 9 | import { Fold, Expand } from "@element-plus/icons-vue"; |
| ... | ... | @@ -45,8 +45,9 @@ let asyncData = reactive({ |
| 45 | 45 | onMounted(() => { |
| 46 | 46 | asyncData.userInfo = store.family.loginStore().userName; |
| 47 | 47 | asyncData.organizationLogo = store.family.loginStore().organizationLogo; |
| 48 | - // 去除控制台警告,这么写就不报警告,写成computed return的形式就报警告,暂未找到原因(view中v-if、:class原因已排除、别的页面同样参数同样用法不会报警告) | |
| 49 | - asyncData.isCollapse = store.family.appStore().isCollapse; | |
| 48 | + asyncData.isCollapse = computed (() => { | |
| 49 | + return store.family.appStore().isCollapse | |
| 50 | + }) | |
| 50 | 51 | }); |
| 51 | 52 | </script> |
| 52 | 53 | |
| ... | ... | @@ -72,8 +73,8 @@ onMounted(() => { |
| 72 | 73 | <!-- TIP logo结束 --> |
| 73 | 74 | <!-- TIP 控制菜单collapse的按钮 --> |
| 74 | 75 | <div class="menu-collapse-button" @click="toggleMenu"> |
| 75 | - <Expand class="font-style" v-if="asyncData.isCollapse" /> | |
| 76 | - <Fold class="font-style" v-if="!asyncData.isCollapse" /> | |
| 76 | + <Expand class="font-style" v-show="asyncData.isCollapse" /> | |
| 77 | + <Fold class="font-style" v-show="!asyncData.isCollapse" /> | |
| 77 | 78 | </div> |
| 78 | 79 | <!-- TIP 控制菜单collapse的按钮结束 --> |
| 79 | 80 | <!-- TIP 功能键 --> | ... | ... |
src/layout/menu.vue
| ... | ... | @@ -18,7 +18,10 @@ let asyncData = reactive({ |
| 18 | 18 | }); |
| 19 | 19 | onMounted(() => { |
| 20 | 20 | asyncData.menuData = store.family.loginStore().menuList; |
| 21 | - asyncData.isCollapse = store.family.appStore().isCollapse | |
| 21 | + // asyncData.isCollapse = store.family.appStore().isCollapse | |
| 22 | + asyncData.isCollapse = computed (() => { | |
| 23 | + return store.family.appStore().isCollapse | |
| 24 | + }) | |
| 22 | 25 | }); |
| 23 | 26 | </script> |
| 24 | 27 | ... | ... |
src/router/index.ts
| 1 | 1 | import { createRouter, createWebHashHistory } from 'vue-router' |
| 2 | +import Repair from './modules/repair' | |
| 2 | 3 | import Notify from './modules/notify' |
| 3 | 4 | import System from './modules/system' |
| 4 | 5 | import Permission from './modules/permission' |
| ... | ... | @@ -27,6 +28,7 @@ const routes: Array<any> = [ |
| 27 | 28 | meta: { title: '欢迎访问' } |
| 28 | 29 | }] |
| 29 | 30 | }, |
| 31 | + Repair, | |
| 30 | 32 | Notify, |
| 31 | 33 | System, |
| 32 | 34 | Permission, | ... | ... |
src/router/modules/property.ts
| ... | ... | @@ -13,6 +13,16 @@ const property= { |
| 13 | 13 | name: 'edit', |
| 14 | 14 | component: () => import('@/views/property/edit.vue'), |
| 15 | 15 | meta: { title: '物业编辑' } |
| 16 | + }, { | |
| 17 | + path: '/property/column', | |
| 18 | + name: 'column', | |
| 19 | + component: () => import('@/views/column/index.vue'), | |
| 20 | + meta: { title: '栏目管理' } | |
| 21 | + }, { | |
| 22 | + path: '/property/column/edit', | |
| 23 | + name: 'columnEdit', | |
| 24 | + component: () => import('@/views/column/edit.vue'), | |
| 25 | + meta: { title: '栏目编辑' } | |
| 16 | 26 | }] |
| 17 | 27 | } |
| 18 | 28 | ... | ... |
src/router/modules/repair.ts
0 → 100644
| 1 | +import Layout from '@/layout/enter.vue' | |
| 2 | +const repair = { | |
| 3 | + path: '/', | |
| 4 | + component: Layout, | |
| 5 | + name: 'Repair', | |
| 6 | + children: [{ | |
| 7 | + path: 'repair', | |
| 8 | + name: 'repair', | |
| 9 | + component: () => import('@/views/repair/index.vue'), | |
| 10 | + meta: { title: '报修管理' } | |
| 11 | + }, { | |
| 12 | + path: '/repair/edit', | |
| 13 | + name: 'repairEdit', | |
| 14 | + component: () => import('@/views/repair/edit.vue'), | |
| 15 | + meta: { title: '报修编辑' } | |
| 16 | + }] | |
| 17 | +} | |
| 18 | + | |
| 19 | +export default repair | ... | ... |
src/style/menu.scss
src/views/column/edit.vue
0 → 100644
src/views/column/index.vue
0 → 100644
src/views/repair/config.ts
0 → 100644
| 1 | +interface Option { | |
| 2 | + label: string, | |
| 3 | + value: number | |
| 4 | +} | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * 维修项目 | |
| 8 | + */ | |
| 9 | +export const projects: Option[] = [ | |
| 10 | + { | |
| 11 | + label: '马桶疏通', | |
| 12 | + value: 1 | |
| 13 | + }, | |
| 14 | + { | |
| 15 | + label: '下水道疏通', | |
| 16 | + value: 2 | |
| 17 | + }, | |
| 18 | + { | |
| 19 | + label: '水龙头维修', | |
| 20 | + value: 3 | |
| 21 | + }, | |
| 22 | + { | |
| 23 | + label: '更换灯泡', | |
| 24 | + value: 4 | |
| 25 | + } | |
| 26 | +] | |
| 27 | + | |
| 28 | +/** | |
| 29 | + * 工单状态 | |
| 30 | + */ | |
| 31 | +export const status: Option[] = [ | |
| 32 | + { | |
| 33 | + label: '未处理', | |
| 34 | + value: 0 | |
| 35 | + }, | |
| 36 | + { | |
| 37 | + label: '处理中', | |
| 38 | + value: 1 | |
| 39 | + }, | |
| 40 | + { | |
| 41 | + label: '已失效', | |
| 42 | + value: 2 | |
| 43 | + }, | |
| 44 | + { | |
| 45 | + label: '已完成', | |
| 46 | + value: 3 | |
| 47 | + }, | |
| 48 | +] | |
| 0 | 49 | \ No newline at end of file | ... | ... |
src/views/repair/edit.vue
0 → 100644
| 1 | +<script setup lang="ts"> | |
| 2 | +import { reactive, ref, getCurrentInstance, onMounted } from "vue"; | |
| 3 | +import { useRoute } from "vue-router"; | |
| 4 | +import { getTableList } from "@/api/community/residence"; | |
| 5 | +import { repairAdd, repairDetail } from "@/api/notify/repair"; | |
| 6 | +import { back } from "@/utils/tool"; | |
| 7 | +import { projects } from "./config"; | |
| 8 | +import type { ElForm } from "element-plus"; | |
| 9 | +let instance: ComponentInternalInstance | null = getCurrentInstance(); | |
| 10 | +let form = reactive({ | |
| 11 | + data: { | |
| 12 | + userName: "", | |
| 13 | + neighboorHoodId: null, | |
| 14 | + address: "", | |
| 15 | + phone: "", | |
| 16 | + repairProject: "", | |
| 17 | + intentBeginTime: "", | |
| 18 | + intentEndTime: "", | |
| 19 | + remark: "", | |
| 20 | + id: null, | |
| 21 | + }, | |
| 22 | + neighborhoods: [], | |
| 23 | + checkList: [], | |
| 24 | + projects: projects, | |
| 25 | + loading: false, | |
| 26 | + dataType: "", | |
| 27 | +}); | |
| 28 | +const ruleFormRef = ref<InstanceType<typeof ElForm>>(); | |
| 29 | +/** | |
| 30 | + * 表单验证规则 | |
| 31 | + */ | |
| 32 | +const rules = reactive({ | |
| 33 | + neighboorHoodId: [ | |
| 34 | + { | |
| 35 | + required: true, | |
| 36 | + message: "请选择小区", | |
| 37 | + trigger: "blur", | |
| 38 | + }, | |
| 39 | + ], | |
| 40 | + userName: [ | |
| 41 | + { | |
| 42 | + required: true, | |
| 43 | + message: "请填写报修人", | |
| 44 | + trigger: "blur", | |
| 45 | + }, | |
| 46 | + ], | |
| 47 | + address: [ | |
| 48 | + { | |
| 49 | + required: true, | |
| 50 | + message: "请填写报修地址", | |
| 51 | + trigger: "blur", | |
| 52 | + }, | |
| 53 | + ], | |
| 54 | + phone: [ | |
| 55 | + { | |
| 56 | + required: true, | |
| 57 | + message: "请填写联系电话", | |
| 58 | + trigger: "blur", | |
| 59 | + }, | |
| 60 | + ], | |
| 61 | + repairProject: [ | |
| 62 | + { | |
| 63 | + required: true, | |
| 64 | + message: "请选择报修项目", | |
| 65 | + trigger: "blur", | |
| 66 | + }, | |
| 67 | + ], | |
| 68 | + intentBeginTime: [ | |
| 69 | + { | |
| 70 | + required: true, | |
| 71 | + message: "请选择意向上门开始时间", | |
| 72 | + trigger: "blur", | |
| 73 | + }, | |
| 74 | + ], | |
| 75 | + intentEndTime: [ | |
| 76 | + { | |
| 77 | + required: true, | |
| 78 | + message: "请选择意向上门结束时间", | |
| 79 | + trigger: "blur", | |
| 80 | + }, | |
| 81 | + ], | |
| 82 | +}); | |
| 83 | +/** | |
| 84 | + * 表单重置 | |
| 85 | + */ | |
| 86 | +const resetForm = (formEl: InstanceType<typeof ElForm> | undefined) => { | |
| 87 | + if (!formEl) return; | |
| 88 | + form.checkList = []; | |
| 89 | + formEl.resetFields(); | |
| 90 | +}; | |
| 91 | +/** | |
| 92 | + * 表单提交 | |
| 93 | + */ | |
| 94 | +const submitForm = (formEl: InstanceType<typeof ElForm> | undefined) => { | |
| 95 | + form.loading = true; | |
| 96 | + if (!formEl) return; | |
| 97 | + formEl.validate((valid) => { | |
| 98 | + if (valid) { | |
| 99 | + console.log(form.data); | |
| 100 | + repairAdd(form.data) | |
| 101 | + .then((res) => { | |
| 102 | + if (res) { | |
| 103 | + instance?.proxy?.$message.success("操作成功"); | |
| 104 | + history.go(-1); | |
| 105 | + } | |
| 106 | + }) | |
| 107 | + .catch((error) => { | |
| 108 | + console.log(error); | |
| 109 | + }) | |
| 110 | + .finally(() => { | |
| 111 | + form.loading = false; | |
| 112 | + }); | |
| 113 | + } else { | |
| 114 | + instance?.proxy?.$message.error("请检查表单格式"); | |
| 115 | + form.loading = false; | |
| 116 | + return false; | |
| 117 | + } | |
| 118 | + }); | |
| 119 | +}; | |
| 120 | +/** | |
| 121 | + * 小区列表 | |
| 122 | + * @param {number | null} pageSize 一次请求多少条数据 | |
| 123 | + */ | |
| 124 | +const getNeighborhoods = async (pageSize: number = 20) => { | |
| 125 | + try { | |
| 126 | + const res = await getTableList({ | |
| 127 | + page: 1, | |
| 128 | + type: 0, | |
| 129 | + pageSize: pageSize, | |
| 130 | + }); | |
| 131 | + form.neighborhoods = res?.data?.data?.list; | |
| 132 | + if (res?.data?.data?.total > pageSize) { | |
| 133 | + getNeighborhoods(res?.data?.data?.total); | |
| 134 | + } | |
| 135 | + } catch (e) { | |
| 136 | + console.log(e); | |
| 137 | + } | |
| 138 | +}; | |
| 139 | +onMounted(() => { | |
| 140 | + getNeighborhoods(); | |
| 141 | + form.data = useRoute().query; | |
| 142 | + if (JSON.stringify(form.data) === "{}") { | |
| 143 | + form.dataType = "add"; | |
| 144 | + } else { | |
| 145 | + form.dataType = "edit"; | |
| 146 | + form.checkList = form.data.repairProject | |
| 147 | + ? form.data.repairProject?.split(",").map((v) => v / 1) | |
| 148 | + : []; | |
| 149 | + } | |
| 150 | +}); | |
| 151 | +</script> | |
| 152 | + | |
| 153 | +<template> | |
| 154 | + <div class="page-container"> | |
| 155 | + <el-card class="form_card" style="max-width: 1303px"> | |
| 156 | + <h1 v-show="form.dataType === 'add'">创建工单</h1> | |
| 157 | + <h1 v-show="form.dataType === 'edit'">工单详情</h1> | |
| 158 | + <el-form | |
| 159 | + :inline="true" | |
| 160 | + :model="form.data" | |
| 161 | + :rules="rules" | |
| 162 | + ref="ruleFormRef" | |
| 163 | + label-width="120px" | |
| 164 | + class="card-form" | |
| 165 | + :disabled="form.dataType === 'edit'" | |
| 166 | + > | |
| 167 | + <el-form-item | |
| 168 | + label="所属小区" | |
| 169 | + prop="neighboorHoodId" | |
| 170 | + style="width: 50%" | |
| 171 | + > | |
| 172 | + <el-select | |
| 173 | + v-model="form.data.neighboorHoodId" | |
| 174 | + placeholder="请选择小区" | |
| 175 | + > | |
| 176 | + <el-option | |
| 177 | + :label="item.name" | |
| 178 | + :value="item.id" | |
| 179 | + v-for="(item, index) in form.neighborhoods" | |
| 180 | + :key="index" | |
| 181 | + ></el-option> | |
| 182 | + </el-select> | |
| 183 | + </el-form-item> | |
| 184 | + <el-form-item label="报修人" prop="userName" style="width: 50%"> | |
| 185 | + <el-input | |
| 186 | + v-model.trim="form.data.userName" | |
| 187 | + placeholder="请填写报修人" | |
| 188 | + maxlength="15" | |
| 189 | + /> | |
| 190 | + </el-form-item> | |
| 191 | + <el-form-item label="报修地址" prop="address" style="width: 100%"> | |
| 192 | + <el-input | |
| 193 | + v-model.trim="form.data.address" | |
| 194 | + placeholder="请填写报修地址" | |
| 195 | + maxlength="15" | |
| 196 | + /> | |
| 197 | + </el-form-item> | |
| 198 | + <el-form-item label="联系电话" prop="phone" style="width: 100%"> | |
| 199 | + <el-input | |
| 200 | + v-model.trim="form.data.phone" | |
| 201 | + placeholder="请填写联系电话" | |
| 202 | + maxlength="15" | |
| 203 | + /> | |
| 204 | + </el-form-item> | |
| 205 | + <el-form-item label="报修项目" prop="repairProject" style="width: 100%"> | |
| 206 | + <el-checkbox-group | |
| 207 | + v-model="form.checkList" | |
| 208 | + @change="(data) => (form.data.repairProject = data.join(','))" | |
| 209 | + > | |
| 210 | + <el-checkbox | |
| 211 | + v-for="(item, index) in form.projects" | |
| 212 | + :key="index" | |
| 213 | + :label="item.value" | |
| 214 | + >{{ item.label }}</el-checkbox | |
| 215 | + > | |
| 216 | + </el-checkbox-group> | |
| 217 | + </el-form-item> | |
| 218 | + <el-form-item | |
| 219 | + label="意向开始时间" | |
| 220 | + prop="intentBeginTime" | |
| 221 | + style="width: 50%" | |
| 222 | + > | |
| 223 | + <!-- format="YYYY-MM-DD HH:mm:ss" | |
| 224 | + value-format="YYYY-MM-DD HH:mm:ss" --> | |
| 225 | + <el-date-picker | |
| 226 | + v-model="form.data.intentBeginTime" | |
| 227 | + type="datetime" | |
| 228 | + placeholder="请选择意向上门开始时间" | |
| 229 | + > | |
| 230 | + </el-date-picker> | |
| 231 | + </el-form-item> | |
| 232 | + <el-form-item | |
| 233 | + label="意向结束时间" | |
| 234 | + prop="intentEndTime" | |
| 235 | + style="width: 50%" | |
| 236 | + > | |
| 237 | + <el-date-picker | |
| 238 | + v-model="form.data.intentEndTime" | |
| 239 | + type="datetime" | |
| 240 | + placeholder="请选择意向上门结束时间" | |
| 241 | + ></el-date-picker> | |
| 242 | + </el-form-item> | |
| 243 | + <el-form-item label="备注" prop="remark" style="width: 100%"> | |
| 244 | + <el-input | |
| 245 | + v-model.trim="form.data.remark" | |
| 246 | + placeholder="请填写备注" | |
| 247 | + maxlength="15" | |
| 248 | + type="textarea" | |
| 249 | + :rows="5" | |
| 250 | + /> | |
| 251 | + </el-form-item> | |
| 252 | + <el-form-item style="width: 100%" v-show="form.dataType !== 'edit'"> | |
| 253 | + <el-button | |
| 254 | + type="primary" | |
| 255 | + @click="submitForm(ruleFormRef)" | |
| 256 | + :loading="form.loading" | |
| 257 | + >提交</el-button | |
| 258 | + > | |
| 259 | + <el-button | |
| 260 | + type="info" | |
| 261 | + @click="resetForm(ruleFormRef)" | |
| 262 | + v-show="form.dataType === 'add'" | |
| 263 | + >取消</el-button | |
| 264 | + > | |
| 265 | + <el-button type="info" @click="back">返回</el-button> | |
| 266 | + </el-form-item> | |
| 267 | + </el-form> | |
| 268 | + <el-button type="info" @click="back" v-if="form.dataType === 'edit'" | |
| 269 | + >返回</el-button | |
| 270 | + > | |
| 271 | + </el-card> | |
| 272 | + </div> | |
| 273 | +</template> | ... | ... |
src/views/repair/index.vue
0 → 100644
| 1 | +<script setup lang="ts"> | |
| 2 | +import { reactive, ref, onMounted, getCurrentInstance } from "vue"; | |
| 3 | +import { repairList } from "@/api/notify/repair"; | |
| 4 | +import { parseTime, globalFilters } from "@/utils/tool"; | |
| 5 | +import Pagination from "@/components/Pagination/index.vue"; | |
| 6 | +import { ElMessageBox } from "element-plus"; | |
| 7 | +import { status, projects } from "./config"; | |
| 8 | +interface Form { | |
| 9 | + page: number; | |
| 10 | + pageSize: number; | |
| 11 | + userName?: string; | |
| 12 | + status?: number; | |
| 13 | + repairProject?: string; | |
| 14 | + id?: string; | |
| 15 | + phone?: string; | |
| 16 | + endTime?: string; | |
| 17 | + startTime?: string; | |
| 18 | +} | |
| 19 | +interface Params { | |
| 20 | + total: number; | |
| 21 | + query: Form; | |
| 22 | +} | |
| 23 | +interface Data { | |
| 24 | + loading: boolean; | |
| 25 | + list: any[]; | |
| 26 | + projects: any[]; | |
| 27 | + status: any[]; | |
| 28 | + params: Params; | |
| 29 | +} | |
| 30 | +const value1 = ref([]); | |
| 31 | +let data: Data = reactive({ | |
| 32 | + list: [], | |
| 33 | + projects: projects, | |
| 34 | + status: status, | |
| 35 | + loading: false, | |
| 36 | + params: { | |
| 37 | + total: 0, | |
| 38 | + query: { | |
| 39 | + page: 1, | |
| 40 | + pageSize: 10, | |
| 41 | + userName: "", | |
| 42 | + status: null, | |
| 43 | + repairProject: "", | |
| 44 | + id: "", | |
| 45 | + phone: "", | |
| 46 | + endTime: "", | |
| 47 | + startTime: "", | |
| 48 | + }, | |
| 49 | + }, | |
| 50 | +}); | |
| 51 | +/** | |
| 52 | + * 列表 | |
| 53 | + */ | |
| 54 | +const getList = async () => { | |
| 55 | + data.loading = true; | |
| 56 | + try { | |
| 57 | + const res = await repairList(data.params.query); | |
| 58 | + data.list = res?.data?.data?.list; | |
| 59 | + data.params.total = res?.data?.data?.total; | |
| 60 | + } catch (e) { | |
| 61 | + console.log(e); | |
| 62 | + } finally { | |
| 63 | + data.loading = false; | |
| 64 | + } | |
| 65 | +}; | |
| 66 | +/** | |
| 67 | + * 状态 | |
| 68 | + * @param {object} obj 要操作的数据对象 | |
| 69 | + */ | |
| 70 | +const handleStatus = async (obj) => { | |
| 71 | + try { | |
| 72 | + const res = await roleStatus({ | |
| 73 | + roleId: obj.id, | |
| 74 | + status: obj.status ? 0 : 1, | |
| 75 | + }); | |
| 76 | + if (res?.data) { | |
| 77 | + globalProperties.$message.success("操作成功"); | |
| 78 | + getList(); | |
| 79 | + } else { | |
| 80 | + globalProperties.$message.error("操作失败"); | |
| 81 | + } | |
| 82 | + } catch (e) { | |
| 83 | + console.log(e); | |
| 84 | + } | |
| 85 | +}; | |
| 86 | +/** | |
| 87 | + * 时间组件回调 | |
| 88 | + * @param {array} value [开始时间, 结束时间] | |
| 89 | + */ | |
| 90 | +const handleTimeChange = (value: array) => { | |
| 91 | + data.params.query.startTime = value ? value[0] : ""; | |
| 92 | + data.params.query.endTime = value ? value[1] : ""; | |
| 93 | + getList(); | |
| 94 | +}; | |
| 95 | +/** | |
| 96 | + * 获取维修项目名 | |
| 97 | + * @param {string} ids 维修项目id串 | |
| 98 | + */ | |
| 99 | +const getProjectNames = (ids: string) => { | |
| 100 | + let result: array = []; | |
| 101 | + if (ids) { | |
| 102 | + ids.split(",").map((item) => { | |
| 103 | + projects.map((i) => { | |
| 104 | + if (~~i.value === ~~item) { | |
| 105 | + result.push(i.label); | |
| 106 | + } | |
| 107 | + }); | |
| 108 | + }); | |
| 109 | + } | |
| 110 | + return result.join(","); | |
| 111 | +}; | |
| 112 | +/** | |
| 113 | + * 状态值 | |
| 114 | + * @enum {number} | |
| 115 | + */ | |
| 116 | +enum payTypeEnum { | |
| 117 | + "微信" = 1, | |
| 118 | + "现金", | |
| 119 | + "支付宝", | |
| 120 | +} | |
| 121 | +onMounted(() => { | |
| 122 | + getList(); | |
| 123 | +}); | |
| 124 | +</script> | |
| 125 | + | |
| 126 | +<template> | |
| 127 | + <div class="page-container"> | |
| 128 | + <h1>工单列表</h1> | |
| 129 | + <el-row style="padding-bottom: 20px"> | |
| 130 | + <el-form :inline="true" label-width="70px"> | |
| 131 | + <el-form-item label="时间"> | |
| 132 | + <el-date-picker | |
| 133 | + v-model="value1" | |
| 134 | + type="datetimerange" | |
| 135 | + range-separator="至" | |
| 136 | + format="YYYY-MM-DD HH:mm:ss" | |
| 137 | + value-format="YYYY-MM-DD HH:mm:ss" | |
| 138 | + start-placeholder="开始时间" | |
| 139 | + end-placeholder="结束时间" | |
| 140 | + @change="handleTimeChange" | |
| 141 | + > | |
| 142 | + </el-date-picker> | |
| 143 | + </el-form-item> | |
| 144 | + <el-form-item label="状态"> | |
| 145 | + <el-select | |
| 146 | + v-model="data.params.query.status" | |
| 147 | + clearable | |
| 148 | + placeholder="请选择状态" | |
| 149 | + @change="getList" | |
| 150 | + > | |
| 151 | + <el-option | |
| 152 | + :label="item.label" | |
| 153 | + :value="item.value" | |
| 154 | + v-for="(item, index) in data.status" | |
| 155 | + :key="index" | |
| 156 | + ></el-option> | |
| 157 | + </el-select> | |
| 158 | + </el-form-item> | |
| 159 | + <el-form-item label="报修人"> | |
| 160 | + <el-input | |
| 161 | + v-model.trim="data.params.query.userName" | |
| 162 | + placeholder="请填写报修人" | |
| 163 | + maxlength="15" | |
| 164 | + @change="getList" | |
| 165 | + /> | |
| 166 | + </el-form-item> | |
| 167 | + <el-form-item label="报修项目"> | |
| 168 | + <el-select | |
| 169 | + v-model="data.params.query.repairProject" | |
| 170 | + clearable | |
| 171 | + placeholder="请选择报修项目" | |
| 172 | + @change="getList" | |
| 173 | + > | |
| 174 | + <el-option | |
| 175 | + :label="item.label" | |
| 176 | + :value="item.value" | |
| 177 | + v-for="(item, index) in data.projects" | |
| 178 | + :key="index" | |
| 179 | + ></el-option> | |
| 180 | + </el-select> | |
| 181 | + </el-form-item> | |
| 182 | + <el-form-item label="联系电话"> | |
| 183 | + <el-input | |
| 184 | + v-model.trim="data.params.query.phone" | |
| 185 | + placeholder="请填写联系电话" | |
| 186 | + maxlength="15" | |
| 187 | + @change="getList" | |
| 188 | + /> | |
| 189 | + </el-form-item> | |
| 190 | + <el-form-item label="订单号"> | |
| 191 | + <el-input | |
| 192 | + v-model.trim="data.params.query.id" | |
| 193 | + placeholder="请填写订单号" | |
| 194 | + maxlength="15" | |
| 195 | + @change="getList" | |
| 196 | + /> | |
| 197 | + </el-form-item> | |
| 198 | + <el-form-item> | |
| 199 | + <el-button type="primary" @click="getList">查询</el-button> | |
| 200 | + <el-button type="primary" | |
| 201 | + ><router-link :to="{ path: '/repair/edit' }" | |
| 202 | + >创建工单</router-link | |
| 203 | + ></el-button | |
| 204 | + > | |
| 205 | + </el-form-item> | |
| 206 | + </el-form> | |
| 207 | + </el-row> | |
| 208 | + <el-table | |
| 209 | + :data="data.list" | |
| 210 | + style="width: 100%" | |
| 211 | + border | |
| 212 | + v-loading="data.loading" | |
| 213 | + align="center" | |
| 214 | + element-loading-text="拼命加载中" | |
| 215 | + > | |
| 216 | + <el-table-column prop="id" label="订单编号" align="center"> | |
| 217 | + </el-table-column> | |
| 218 | + <el-table-column prop="neighboorHoodId" label="小区" align="center"> | |
| 219 | + </el-table-column> | |
| 220 | + <el-table-column prop="repairProject" label="报修项目" align="center"> | |
| 221 | + <template #default="scope"> | |
| 222 | + {{ getProjectNames(scope.row.repairProject) }} | |
| 223 | + </template> | |
| 224 | + </el-table-column> | |
| 225 | + <el-table-column prop="address" label="报修地址" align="center"> | |
| 226 | + </el-table-column> | |
| 227 | + <el-table-column prop="userName" label="报修人" align="center"> | |
| 228 | + </el-table-column> | |
| 229 | + <el-table-column prop="phone" label="联系电话" align="center"> | |
| 230 | + </el-table-column> | |
| 231 | + <el-table-column | |
| 232 | + prop="intentBeginTime" | |
| 233 | + label="意向上门时间" | |
| 234 | + align="center" | |
| 235 | + > | |
| 236 | + <template #default="scope"> | |
| 237 | + {{ parseTime(new Date(scope.row.intentBeginTime).getTime()) }} ~ | |
| 238 | + {{ parseTime(new Date(scope.row.intentEndTime).getTime()) }} | |
| 239 | + </template> | |
| 240 | + </el-table-column> | |
| 241 | + <el-table-column prop="totalFee" label="金额" align="center"> | |
| 242 | + </el-table-column> | |
| 243 | + <el-table-column prop="repairId" label="处理人" align="center"> | |
| 244 | + </el-table-column> | |
| 245 | + <el-table-column prop="payType" label="支付方式" align="center"> | |
| 246 | + <template #default="scope"> | |
| 247 | + {{ payTypeEnum[scope.row.payType] }} | |
| 248 | + </template> | |
| 249 | + </el-table-column> | |
| 250 | + <el-table-column prop="repairTime" label="处理时间" align="center"> | |
| 251 | + <template #default="scope"> | |
| 252 | + {{ parseTime(new Date(scope.row.repairTime).getTime()) }} | |
| 253 | + </template> | |
| 254 | + </el-table-column> | |
| 255 | + <el-table-column prop="status" label="状态" align="center"> | |
| 256 | + <template #default="scope"> | |
| 257 | + {{ globalFilters(scope.row.status, data.status) }} | |
| 258 | + </template> | |
| 259 | + </el-table-column> | |
| 260 | + <el-table-column label="操作" align="center"> | |
| 261 | + <template #default="scope"> | |
| 262 | + <el-button type="text"> | |
| 263 | + <router-link :to="{ path: '/repair/edit', query: scope.row }" | |
| 264 | + >详情</router-link | |
| 265 | + > | |
| 266 | + </el-button> | |
| 267 | + </template> | |
| 268 | + </el-table-column> | |
| 269 | + </el-table> | |
| 270 | + <Pagination | |
| 271 | + :total="data.params.total" | |
| 272 | + v-model:currentPage="data.params.query.page" | |
| 273 | + v-model:pageSize="data.params.query.pageSize" | |
| 274 | + @pageChange="getList" | |
| 275 | + ></Pagination> | |
| 276 | + </div> | |
| 277 | +</template> | ... | ... |