Commit 13933980aab547d654d6f2dfb8a00810fc6a2c90
1 parent
11681ac1
add:维修人员管理
Showing
10 changed files
with
479 additions
and
29 deletions
src/api/notify/serviceman.ts
0 → 100644
| 1 | +import request from '../request' | |
| 2 | + | |
| 3 | +// 列表查询 | |
| 4 | +export function getTableList(params:any) { | |
| 5 | + return request({ | |
| 6 | + method: 'get', | |
| 7 | + url: '/accendant/getList', | |
| 8 | + params: params | |
| 9 | + }) | |
| 10 | +} | |
| 11 | + | |
| 12 | +// 新增修改 | |
| 13 | +export function addOrUpdate(params:any) { | |
| 14 | + return request({ | |
| 15 | + method: 'post', | |
| 16 | + url: '/accendant/addOrUpdate', | |
| 17 | + data: params | |
| 18 | + }) | |
| 19 | +} | |
| 20 | +// 删除 | |
| 21 | +export function deleteAccendant(params:any) { | |
| 22 | + return request({ | |
| 23 | + method: 'delete', | |
| 24 | + url: '/accendant/deleteAccendant', | |
| 25 | + params: params | |
| 26 | + }) | |
| 27 | +} | ... | ... |
src/components/Pagination/index.vue
| ... | ... | @@ -39,8 +39,8 @@ const props = withDefaults(defineProps<Props>(), { |
| 39 | 39 | |
| 40 | 40 | const emit = defineEmits<{ |
| 41 | 41 | (e: "pageChange", curPage: number, curSize: number, tagName: string): void; |
| 42 | - (e: "update:currentPage", val); | |
| 43 | - (e: "update:pageSize", val); | |
| 42 | + (e: "update:currentPage", val:number): void; | |
| 43 | + (e: "update:pageSize", val:number): void; | |
| 44 | 44 | }>(); |
| 45 | 45 | |
| 46 | 46 | const currentPage = computed({ | ... | ... |
src/router/index.ts
| ... | ... | @@ -9,6 +9,7 @@ import Property from "./modules/property" |
| 9 | 9 | import Community from "./modules/community" |
| 10 | 10 | import OwnerManagement from "./modules/ownerManagement" |
| 11 | 11 | import Housekeeper from "./modules/housekeeper" |
| 12 | +import Serviceman from "./modules/serviceman" | |
| 12 | 13 | import Layout from '@/layout/enter.vue' |
| 13 | 14 | const routes: Array<any> = [ |
| 14 | 15 | { |
| ... | ... | @@ -38,6 +39,7 @@ const routes: Array<any> = [ |
| 38 | 39 | Community, |
| 39 | 40 | OwnerManagement, |
| 40 | 41 | Housekeeper, |
| 42 | + Serviceman, | |
| 41 | 43 | { |
| 42 | 44 | path: '/404', |
| 43 | 45 | name: 'Error', | ... | ... |
src/router/modules/serviceman.ts
0 → 100644
| 1 | +import Layout from '@/layout/enter.vue' | |
| 2 | +const serviceman = { | |
| 3 | + path: '/', | |
| 4 | + component: Layout, | |
| 5 | + name: 'Serviceman', | |
| 6 | + children: [{ | |
| 7 | + path: 'serviceman', | |
| 8 | + name: 'serviceman', | |
| 9 | + component: () => import('@/views/serviceman/index.vue'), | |
| 10 | + meta: { title: '维修人员管理' } | |
| 11 | + }] | |
| 12 | +} | |
| 13 | + | |
| 14 | +export default serviceman | ... | ... |
src/views/community/housekeeper/houseDetail.vue
| ... | ... | @@ -36,7 +36,7 @@ let data = reactive({ |
| 36 | 36 | /** |
| 37 | 37 | * 获取下拉数据 |
| 38 | 38 | */ |
| 39 | -const getSelectList: void = () => { | |
| 39 | +const getSelectList = (): void => { | |
| 40 | 40 | getTableList({ page: 1, pageSize: 1000, type: 0 }) |
| 41 | 41 | .then((res) => { |
| 42 | 42 | data.options = res.data.data.list; |
| ... | ... | @@ -124,7 +124,7 @@ let submitForm = (formEl: InstanceType<typeof ElForm> | undefined) => { |
| 124 | 124 | addOrUpdate(props.formObj) |
| 125 | 125 | .then((res) => { |
| 126 | 126 | loading.value = false; |
| 127 | - emit('success') | |
| 127 | + emit("success"); | |
| 128 | 128 | }) |
| 129 | 129 | .catch((err) => { |
| 130 | 130 | loading.value = false; |
| ... | ... | @@ -176,12 +176,14 @@ defineExpose({ |
| 176 | 176 | <el-form-item label="楼宇名称:" prop="buildingName"> |
| 177 | 177 | <el-input |
| 178 | 178 | v-model="props.formObj.buildingName" |
| 179 | + maxlength="30" | |
| 179 | 180 | :disabled="!!props.formObj.id" |
| 180 | 181 | placeholder="请输入楼宇名称" |
| 181 | 182 | ></el-input> |
| 182 | 183 | </el-form-item> |
| 183 | 184 | <el-form-item label="单元:" prop="unitCount"> |
| 184 | 185 | <el-input |
| 186 | + maxlength="15" | |
| 185 | 187 | v-model="props.formObj.unitCount" |
| 186 | 188 | placeholder="请输入单元" |
| 187 | 189 | onkeyup="value=value.replace(/[^\d]/g,'')" |
| ... | ... | @@ -197,13 +199,15 @@ defineExpose({ |
| 197 | 199 | </el-form-item> |
| 198 | 200 | <el-form-item label="建筑面积:" prop="grossArea"> |
| 199 | 201 | <el-input |
| 202 | + maxlength="8" | |
| 200 | 203 | v-model="props.formObj.grossArea" |
| 201 | - onkeyup="value=value.replace(/[^\d]/g,'')" | |
| 204 | + onkeyup="value=value.replace(/[^\d.]/g,'')" | |
| 202 | 205 | placeholder="请输入建筑面积" |
| 203 | 206 | ></el-input> |
| 204 | 207 | </el-form-item> |
| 205 | 208 | <el-form-item label="总房屋数量:" prop="houseCount"> |
| 206 | 209 | <el-input |
| 210 | + maxlength="4" | |
| 207 | 211 | v-model="props.formObj.houseCount" |
| 208 | 212 | onkeyup="value=value.replace(/[^\d]/g,'')" |
| 209 | 213 | placeholder="请输入总房屋数量" |
| ... | ... | @@ -211,8 +215,9 @@ defineExpose({ |
| 211 | 215 | </el-form-item> |
| 212 | 216 | <el-form-item label="使用面积:" prop="employArea"> |
| 213 | 217 | <el-input |
| 218 | + maxlength="8" | |
| 214 | 219 | v-model="props.formObj.employArea" |
| 215 | - onkeyup="value=value.replace(/[^\d]/g,'')" | |
| 220 | + onkeyup="value=value.replace(/[^\d.]/g,'')" | |
| 216 | 221 | placeholder="请输入使用面积" |
| 217 | 222 | ></el-input> |
| 218 | 223 | </el-form-item> | ... | ... |
src/views/community/residence/communityDetail.vue
| ... | ... | @@ -107,22 +107,22 @@ const cancel: void = () => { |
| 107 | 107 | <template> |
| 108 | 108 | <el-form ref="ruleFormRef" :model="props.formObj" :rules="rules" label-width="100px"> |
| 109 | 109 | <el-form-item label="小区名称:" prop="name"> |
| 110 | - <el-input v-model="props.formObj.name" placeholder="请输入名称" :disabled="!!props.formObj.id"></el-input> | |
| 110 | + <el-input v-model="props.formObj.name" placeholder="请输入名称" :disabled="!!props.formObj.id" maxlength="30"></el-input> | |
| 111 | 111 | </el-form-item> |
| 112 | 112 | <el-form-item label="所在地区:" prop="locality"> |
| 113 | - <el-input v-model="props.formObj.locality" placeholder="请输入所在地区"></el-input> | |
| 113 | + <el-input v-model="props.formObj.locality" placeholder="请输入所在地区" maxlength="30"></el-input> | |
| 114 | 114 | </el-form-item> |
| 115 | 115 | <el-form-item label="详细地址:" prop="address"> |
| 116 | - <el-input v-model="props.formObj.address" placeholder="请输入详细地址"></el-input> | |
| 116 | + <el-input v-model="props.formObj.address" placeholder="请输入详细地址" maxlength="50"></el-input> | |
| 117 | 117 | </el-form-item> |
| 118 | 118 | <el-form-item label="楼座数:" prop="buildingCount"> |
| 119 | - <el-input v-model="props.formObj.buildingCount" onkeyup="value=value.replace(/[^\d]/g,'')" placeholder="请输入楼座数"></el-input> | |
| 119 | + <el-input v-model="props.formObj.buildingCount" onkeyup="value=value.replace(/[^\d]/g,'')" placeholder="请输入楼座数" maxlength="3"></el-input> | |
| 120 | 120 | </el-form-item> |
| 121 | 121 | <el-form-item label="储藏室数:" prop="storeroomCount"> |
| 122 | - <el-input v-model="props.formObj.storeroomCount" onkeyup="value=value.replace(/[^\d]/g,'')" placeholder="请输入储藏室数"></el-input> | |
| 122 | + <el-input v-model="props.formObj.storeroomCount" onkeyup="value=value.replace(/[^\d]/g,'')" placeholder="请输入储藏室数" maxlength="3"></el-input> | |
| 123 | 123 | </el-form-item> |
| 124 | 124 | <el-form-item label="车位数:" prop="truckSpaceCount"> |
| 125 | - <el-input v-model="props.formObj.truckSpaceCount" onkeyup="value=value.replace(/[^\d]/g,'')" placeholder="请输入车位数"></el-input> | |
| 125 | + <el-input v-model="props.formObj.truckSpaceCount" onkeyup="value=value.replace(/[^\d]/g,'')" placeholder="请输入车位数" maxlength="3"></el-input> | |
| 126 | 126 | </el-form-item> |
| 127 | 127 | <el-form-item> |
| 128 | 128 | <el-button | ... | ... |
src/views/housekeeper/buildinMganager/detail.vue
| 1 | 1 | <script setup lang="ts"> |
| 2 | -import { reactive, ref, getCurrentInstance,defineExpose } from "vue"; | |
| 2 | +import { reactive, ref, getCurrentInstance, defineExpose } from "vue"; | |
| 3 | 3 | import type { ElForm } from "element-plus"; |
| 4 | 4 | import { insertOrUpdate } from "@/api/housekeeper/buildinMganager.ts"; |
| 5 | 5 | |
| ... | ... | @@ -88,12 +88,14 @@ let submitForm = (formEl: InstanceType<typeof ElForm> | undefined) => { |
| 88 | 88 | if (!formEl) return; |
| 89 | 89 | formEl.validate((valid) => { |
| 90 | 90 | if (valid) { |
| 91 | - insertOrUpdate(props.formObj).then((res) => { | |
| 92 | - loading.value = false; | |
| 93 | - emit("success"); | |
| 94 | - }).catch((err) => { | |
| 95 | - loading.value = false; | |
| 96 | - }); | |
| 91 | + insertOrUpdate(props.formObj) | |
| 92 | + .then((res) => { | |
| 93 | + loading.value = false; | |
| 94 | + emit("success"); | |
| 95 | + }) | |
| 96 | + .catch((err) => { | |
| 97 | + loading.value = false; | |
| 98 | + }); | |
| 97 | 99 | } else { |
| 98 | 100 | instance?.proxy?.$message.error("请完善信息"); //调用 |
| 99 | 101 | loading.value = false; |
| ... | ... | @@ -115,7 +117,7 @@ const cancel: void = () => { |
| 115 | 117 | }; |
| 116 | 118 | |
| 117 | 119 | defineExpose({ |
| 118 | - resetForm | |
| 120 | + resetForm, | |
| 119 | 121 | }); |
| 120 | 122 | </script> |
| 121 | 123 | |
| ... | ... | @@ -131,16 +133,21 @@ defineExpose({ |
| 131 | 133 | <el-input |
| 132 | 134 | v-model="props.formObj.name" |
| 133 | 135 | placeholder="请输入名称" |
| 136 | + maxlength="10" | |
| 134 | 137 | ></el-input> |
| 135 | 138 | </el-form-item> |
| 136 | 139 | <el-form-item label="手机号:" prop="mobile"> |
| 137 | 140 | <el-input |
| 138 | 141 | v-model="props.formObj.mobile" |
| 142 | + maxlength="30" | |
| 143 | + onkeyup="value=value.replace(/[^\d]/g,'')" | |
| 139 | 144 | placeholder="请输入所在地区" |
| 140 | 145 | ></el-input> |
| 141 | 146 | </el-form-item> |
| 142 | 147 | <el-form-item label="身份证号:" prop="idcard"> |
| 143 | 148 | <el-input |
| 149 | + maxlength="18" | |
| 150 | + onkeyup="value=value.replace(/[^\d]/g,'')" | |
| 144 | 151 | v-model="props.formObj.idcard" |
| 145 | 152 | placeholder="请输入详细地址" |
| 146 | 153 | ></el-input> |
| ... | ... | @@ -179,6 +186,7 @@ defineExpose({ |
| 179 | 186 | </el-form-item> |
| 180 | 187 | <el-form-item label="户籍所在地:" prop="censusRegister"> |
| 181 | 188 | <el-input |
| 189 | + maxlength="50" | |
| 182 | 190 | v-model="props.formObj.censusRegister" |
| 183 | 191 | placeholder="请输入户籍所在地" |
| 184 | 192 | ></el-input> |
| ... | ... | @@ -194,6 +202,7 @@ defineExpose({ |
| 194 | 202 | </el-form-item> |
| 195 | 203 | <el-form-item label="民族:" prop="nationality"> |
| 196 | 204 | <el-input |
| 205 | + maxlength="20" | |
| 197 | 206 | v-model="props.formObj.nationality" |
| 198 | 207 | placeholder="请输入民族" |
| 199 | 208 | ></el-input> | ... | ... |
src/views/ownerManagement/owner/detail.vue
| 1 | 1 | <script setup lang="ts"> |
| 2 | -import { reactive, onMounted, watchEffect,defineEmits } from "vue"; | |
| 2 | +import { reactive, onMounted, watchEffect, defineEmits } from "vue"; | |
| 3 | 3 | import { getResidentById, update } from "@/api/ownerManagement/owner.ts"; |
| 4 | 4 | |
| 5 | 5 | // 声明props |
| ... | ... | @@ -35,11 +35,7 @@ const data = reactive({ |
| 35 | 35 | { label: "城镇户口", value: 1 }, |
| 36 | 36 | { label: "外阜", value: 2 }, |
| 37 | 37 | ], |
| 38 | - livingList: [ | |
| 39 | - { label: "自住"}, | |
| 40 | - { label: "暂住" }, | |
| 41 | - { label: "外租" }, | |
| 42 | - ], | |
| 38 | + livingList: [{ label: "自住" }, { label: "暂住" }, { label: "外租" }], | |
| 43 | 39 | }); |
| 44 | 40 | const emit = defineEmits<{ |
| 45 | 41 | (e: "cancel"): void; |
| ... | ... | @@ -62,7 +58,7 @@ const getData = (id: number) => { |
| 62 | 58 | */ |
| 63 | 59 | const submit = () => { |
| 64 | 60 | update(data.formObj).then((res) => { |
| 65 | - emit("success") | |
| 61 | + emit("success"); | |
| 66 | 62 | }); |
| 67 | 63 | }; |
| 68 | 64 | /** |
| ... | ... | @@ -97,6 +93,8 @@ watchEffect((newValue, oldVlaue) => { |
| 97 | 93 | </el-form-item> |
| 98 | 94 | <el-form-item label="身份证号:" prop="idcard"> |
| 99 | 95 | <el-input |
| 96 | + maxlength="18" | |
| 97 | + onkeyup="value=value.replace(/[^\d]/g,'')" | |
| 100 | 98 | v-model="data.formObj.idcard" |
| 101 | 99 | :disabled="props.isEdit" |
| 102 | 100 | ></el-input> |
| ... | ... | @@ -104,6 +102,8 @@ watchEffect((newValue, oldVlaue) => { |
| 104 | 102 | |
| 105 | 103 | <el-form-item label="手机号:" prop="mobile"> |
| 106 | 104 | <el-input |
| 105 | + maxlength="11" | |
| 106 | + onkeyup="value=value.replace(/[^\d]/g,'')" | |
| 107 | 107 | v-model="data.formObj.mobile" |
| 108 | 108 | disabled |
| 109 | 109 | ></el-input> |
| ... | ... | @@ -192,7 +192,7 @@ watchEffect((newValue, oldVlaue) => { |
| 192 | 192 | </el-select> |
| 193 | 193 | </el-form-item> |
| 194 | 194 | <el-form-item label="居住类型:" prop="isLiving"> |
| 195 | - <el-select | |
| 195 | + <el-select | |
| 196 | 196 | v-model="data.formObj.isLiving" |
| 197 | 197 | placeholder="请选择" |
| 198 | 198 | style="width: 200px" |
| ... | ... | @@ -222,7 +222,7 @@ watchEffect((newValue, oldVlaue) => { |
| 222 | 222 | <el-row> |
| 223 | 223 | <el-form-item> |
| 224 | 224 | <el-button type="primary" @click="submit">保存</el-button> |
| 225 | - <el-button @click="cancel">取消</el-button> | |
| 225 | + <el-button @click="cancel">取消</el-button> | |
| 226 | 226 | </el-form-item> |
| 227 | 227 | </el-row> |
| 228 | 228 | </el-form> | ... | ... |
src/views/serviceman/detail.vue
0 → 100644
| 1 | +<script setup lang="ts"> | |
| 2 | +import { reactive, ref, onMounted, getCurrentInstance,defineExpose } from "vue"; | |
| 3 | +import type { ElForm } from "element-plus"; | |
| 4 | +import { addOrUpdate } from "@/api/notify/serviceman.ts"; | |
| 5 | +import { getTableList } from "@/api/community/residence.ts"; | |
| 6 | + | |
| 7 | +const ruleFormRef = ref<InstanceType<typeof ElForm>>(); | |
| 8 | +let instance: ComponentInternalInstance | null = getCurrentInstance(); //获取app实例 | |
| 9 | +// 声明props | |
| 10 | +const props = defineProps({ | |
| 11 | + formObj: { | |
| 12 | + type: Object, | |
| 13 | + default: { | |
| 14 | + name: null, | |
| 15 | + age:null, | |
| 16 | + mobile: null, | |
| 17 | + idCard: null, | |
| 18 | + sex: null, | |
| 19 | + neighborhoods: [], | |
| 20 | + }, | |
| 21 | + }, | |
| 22 | +}); | |
| 23 | +const data = reactive({ | |
| 24 | + loading: false, | |
| 25 | + options: [], | |
| 26 | + sexList: ["男", "女"], | |
| 27 | +}); | |
| 28 | + | |
| 29 | +// 表单验证 | |
| 30 | +const rules = reactive({ | |
| 31 | + name: [ | |
| 32 | + { | |
| 33 | + required: true, | |
| 34 | + message: "请输入小区名", | |
| 35 | + trigger: "blur", | |
| 36 | + }, | |
| 37 | + ], | |
| 38 | + age: [ | |
| 39 | + { | |
| 40 | + required: true, | |
| 41 | + message: "请输入年龄", | |
| 42 | + trigger: "blur", | |
| 43 | + }, | |
| 44 | + ], | |
| 45 | + mobile: [ | |
| 46 | + { | |
| 47 | + required: true, | |
| 48 | + message: "请输入手机号", | |
| 49 | + trigger: "blur", | |
| 50 | + }, | |
| 51 | + ], | |
| 52 | + idCard: [ | |
| 53 | + { | |
| 54 | + required: true, | |
| 55 | + message: "请输入身份证", | |
| 56 | + trigger: "blur", | |
| 57 | + }, | |
| 58 | + ], | |
| 59 | + neighborhoods: [ | |
| 60 | + { | |
| 61 | + required: true, | |
| 62 | + message: "请输入楼座数", | |
| 63 | + trigger: "blur", | |
| 64 | + }, | |
| 65 | + ], | |
| 66 | + sex: [ | |
| 67 | + { | |
| 68 | + required: true, | |
| 69 | + message: "请选择性别", | |
| 70 | + trigger: "blur", | |
| 71 | + }, | |
| 72 | + ], | |
| 73 | +}); | |
| 74 | +/** | |
| 75 | + * 获取下拉数据 | |
| 76 | + */ | |
| 77 | +const getSelectList = (): void => { | |
| 78 | + getTableList({ page: 1, pageSize: 1000, type: 0 }) | |
| 79 | + .then((res) => { | |
| 80 | + data.options = res.data.data.list; | |
| 81 | + }) | |
| 82 | + .catch((err) => { | |
| 83 | + console.log(err); | |
| 84 | + }); | |
| 85 | +}; | |
| 86 | +const emit = defineEmits<{ | |
| 87 | + (e: "cancel"): void; | |
| 88 | + (e: "success"): void; | |
| 89 | +}>(); | |
| 90 | + | |
| 91 | +/** | |
| 92 | + * 表单提交 | |
| 93 | + * @param {ElForm | undefined} formEl 表单对象 | |
| 94 | + */ | |
| 95 | +let submitForm = (formEl: InstanceType<typeof ElForm> | undefined) => { | |
| 96 | + data.loading = true; | |
| 97 | + if (!formEl) return; | |
| 98 | + formEl.validate((valid) => { | |
| 99 | + if (valid) { | |
| 100 | + let params = JSON.parse(JSON.stringify(props.formObj)); | |
| 101 | + delete params.neighborhoods; | |
| 102 | + let ids = props.formObj.neighborhoods | |
| 103 | + .map((item) => { | |
| 104 | + return item.id; | |
| 105 | + }) | |
| 106 | + .toString(); | |
| 107 | + params=Object.assign(params,{ids:ids}) | |
| 108 | + // console.log({ accendant: params, neighborhoodIds: ids }) | |
| 109 | + addOrUpdate(params) | |
| 110 | + .then((res) => { | |
| 111 | + data.loading = false; | |
| 112 | + emit("success"); | |
| 113 | + }) | |
| 114 | + .catch((err) => { | |
| 115 | + data.loading = false; | |
| 116 | + }); | |
| 117 | + } else { | |
| 118 | + instance?.proxy?.$message.error("请完善信息"); //调用 | |
| 119 | + data.loading = false; | |
| 120 | + return false; | |
| 121 | + } | |
| 122 | + }); | |
| 123 | +}; | |
| 124 | +/** | |
| 125 | + * 重置 | |
| 126 | + */ | |
| 127 | +let resetForm = () => { | |
| 128 | + ruleFormRef.value.resetFields(); | |
| 129 | +}; | |
| 130 | +/** | |
| 131 | + * 取消提交 | |
| 132 | + */ | |
| 133 | +const cancel: void = () => { | |
| 134 | + emit("cancel"); | |
| 135 | +}; | |
| 136 | +defineExpose({ | |
| 137 | + resetForm, | |
| 138 | +}); | |
| 139 | +onMounted(() => { | |
| 140 | + getSelectList(); | |
| 141 | +}); | |
| 142 | +</script> | |
| 143 | + | |
| 144 | +<template> | |
| 145 | + <el-form | |
| 146 | + ref="ruleFormRef" | |
| 147 | + :model="props.formObj" | |
| 148 | + :rules="rules" | |
| 149 | + label-width="100px" | |
| 150 | + > | |
| 151 | + <el-form-item label="姓名:" prop="name"> | |
| 152 | + <el-input | |
| 153 | + v-model="props.formObj.name" | |
| 154 | + placeholder="请输入姓名" | |
| 155 | + maxlength="30" | |
| 156 | + ></el-input> | |
| 157 | + </el-form-item> | |
| 158 | + <el-form-item label="年龄:" prop="age"> | |
| 159 | + <el-input | |
| 160 | + v-model="props.formObj.age" | |
| 161 | + placeholder="请输入年龄" | |
| 162 | + maxlength="3" | |
| 163 | + onkeyup="value=value.replace(/[^\d]/g,'')" | |
| 164 | + ></el-input> | |
| 165 | + </el-form-item> | |
| 166 | + <el-form-item label="联系电话:" prop="mobile"> | |
| 167 | + <el-input | |
| 168 | + v-model="props.formObj.mobile" | |
| 169 | + placeholder="请输入联系电话" | |
| 170 | + maxlength="11" | |
| 171 | + onkeyup="value=value.replace(/[^\d]/g,'')" | |
| 172 | + ></el-input> | |
| 173 | + </el-form-item> | |
| 174 | + <el-form-item label="身份证号:" prop="idCard"> | |
| 175 | + <el-input | |
| 176 | + v-model="props.formObj.idCard" | |
| 177 | + placeholder="请输入身份证号" | |
| 178 | + maxlength="18" | |
| 179 | + onkeyup="value=value.replace(/[^\d]/g,'')" | |
| 180 | + ></el-input> | |
| 181 | + </el-form-item> | |
| 182 | + <el-form-item label="服务小区:" prop="neighborhoods"> | |
| 183 | + <el-select | |
| 184 | + v-model="props.formObj.neighborhoods" | |
| 185 | + multiple | |
| 186 | + placeholder="请选择小区" | |
| 187 | + value-key="id" | |
| 188 | + > | |
| 189 | + <el-option | |
| 190 | + v-for="item in data.options" | |
| 191 | + :key="item" | |
| 192 | + :label="item.name" | |
| 193 | + :value="item" | |
| 194 | + > | |
| 195 | + </el-option> | |
| 196 | + </el-select> | |
| 197 | + </el-form-item> | |
| 198 | + <el-form-item label="性别:" prop="sex"> | |
| 199 | + <el-select v-model="props.formObj.sex" placeholder="请选择性别"> | |
| 200 | + <el-option | |
| 201 | + v-for="item in data.sexList" | |
| 202 | + :key="item" | |
| 203 | + :label="item" | |
| 204 | + :value="item" | |
| 205 | + > | |
| 206 | + </el-option> | |
| 207 | + </el-select> | |
| 208 | + </el-form-item> | |
| 209 | + <el-form-item> | |
| 210 | + <el-button | |
| 211 | + type="primary" | |
| 212 | + @click="submitForm(ruleFormRef)" | |
| 213 | + :loading="data.loading" | |
| 214 | + >保存</el-button | |
| 215 | + > | |
| 216 | + <el-button @click="cancel">取消</el-button> | |
| 217 | + </el-form-item> | |
| 218 | + </el-form> | |
| 219 | +</template> | ... | ... |
src/views/serviceman/index.vue
0 → 100644
| 1 | +<script setup lang="ts"> | |
| 2 | +import { reactive, onMounted, getCurrentInstance,ref } from "vue"; | |
| 3 | +import { getTableList, deleteAccendant } from "@/api/notify/serviceman.ts"; | |
| 4 | +import Detail from "./detail.vue"; | |
| 5 | +import { parseTime } from "@/utils/tool.ts"; | |
| 6 | +import Pagination from "@/components/Pagination/index.vue"; | |
| 7 | + | |
| 8 | +let instance: ComponentInternalInstance | null = getCurrentInstance(); //获取app实例 | |
| 9 | +const detailRef = ref<InstanceType<typeof ElForm>>(); | |
| 10 | +// 数据筛选 | |
| 11 | +const searchData = reactive({ | |
| 12 | + name: null, | |
| 13 | + accendantType:1, | |
| 14 | + page: 1, | |
| 15 | + pageSize: 10, | |
| 16 | +}); | |
| 17 | +// 展示 | |
| 18 | +const data = reactive({ | |
| 19 | + total: 0, | |
| 20 | + tableList: [], | |
| 21 | + dialogVisible: false, | |
| 22 | + loading: false, | |
| 23 | + title: "新增维修人员", | |
| 24 | + formObj: {}, | |
| 25 | +}); | |
| 26 | + | |
| 27 | +/** | |
| 28 | + * 列表查询 | |
| 29 | + */ | |
| 30 | +const search = (): void => { | |
| 31 | + data.loading = true; | |
| 32 | + getTableList(searchData) | |
| 33 | + .then((res) => { | |
| 34 | + data.tableList = res.data.data; | |
| 35 | + data.total = res.data.data.length; | |
| 36 | + searchData.pageSize = res.data.data.pageSize; | |
| 37 | + data.loading = false; | |
| 38 | + }) | |
| 39 | + .catch((err) => { | |
| 40 | + console.log(err); | |
| 41 | + data.loading = false; | |
| 42 | + }); | |
| 43 | +}; | |
| 44 | +/** | |
| 45 | + * 编辑 | |
| 46 | + * @param { Object } 列表对象 | |
| 47 | + */ | |
| 48 | +const edit = (row: Object) => { | |
| 49 | + data.title = "编辑维修人员"; | |
| 50 | + data.formObj = JSON.parse(JSON.stringify(row)); | |
| 51 | + data.dialogVisible = true; | |
| 52 | +}; | |
| 53 | +/** | |
| 54 | + * 删除 | |
| 55 | + * @param { number } accendantId 唯一ID | |
| 56 | + */ | |
| 57 | +const remove = (accendantId: number) => { | |
| 58 | + instance?.proxy?.$messageBox | |
| 59 | + .confirm("确认要进行此操作?", "提示", { | |
| 60 | + confirmButtonText: "确定", | |
| 61 | + cancelButtonText: "取消", | |
| 62 | + }) | |
| 63 | + .then(() => { | |
| 64 | + deleteAccendant({ accendantId: accendantId }).then((res) => { | |
| 65 | + instance?.proxy?.$message.success("操作成功"); //调用 | |
| 66 | + search(); | |
| 67 | + }); | |
| 68 | + }) | |
| 69 | + .catch((err) => {}); | |
| 70 | +}; | |
| 71 | +/** | |
| 72 | + * 组件操作成功回调 | |
| 73 | + */ | |
| 74 | +const changeData: void = () => { | |
| 75 | + data.dialogVisible = false; | |
| 76 | + search(); | |
| 77 | +}; | |
| 78 | + | |
| 79 | +/** | |
| 80 | + * 弹框关闭 | |
| 81 | + */ | |
| 82 | +const dialogClose: void = () => { | |
| 83 | + data.title = "新增维修人员"; | |
| 84 | + data.formObj = {}; | |
| 85 | + detailRef.value.resetForm(); | |
| 86 | +}; | |
| 87 | + | |
| 88 | +onMounted(() => { | |
| 89 | + search(); | |
| 90 | +}); | |
| 91 | +</script> | |
| 92 | +<template> | |
| 93 | + <div class="app-container"> | |
| 94 | + <!-- 搜索 --> | |
| 95 | + <el-form :inline="true" :model="searchData" v-loading="data.loading"> | |
| 96 | + <el-form-item> | |
| 97 | + <el-input | |
| 98 | + placeholder="请输入姓名/电话" | |
| 99 | + v-model="searchData.name" | |
| 100 | + clearable | |
| 101 | + ></el-input> | |
| 102 | + </el-form-item> | |
| 103 | + <el-form-item | |
| 104 | + ><el-button type="primary" @click="search" | |
| 105 | + >查询</el-button | |
| 106 | + ></el-form-item | |
| 107 | + > | |
| 108 | + <el-row> | |
| 109 | + <el-form-item> | |
| 110 | + <!-- <el-button type="primary">导入</el-button> | |
| 111 | + <el-button type="primary">导出</el-button> --> | |
| 112 | + <el-button type="primary" @click="data.dialogVisible = true" | |
| 113 | + >新增</el-button | |
| 114 | + > | |
| 115 | + </el-form-item> | |
| 116 | + </el-row> | |
| 117 | + </el-form> | |
| 118 | + | |
| 119 | + <!-- 表格 --> | |
| 120 | + <el-table border :data="data.tableList"> | |
| 121 | + <el-table-column label="姓名" prop="name"></el-table-column> | |
| 122 | + <el-table-column label="性别" prop="sex"></el-table-column> | |
| 123 | + <el-table-column label="年龄" prop="age"></el-table-column> | |
| 124 | + <el-table-column label="服务小区" prop="truckSpaceCount"> | |
| 125 | + <template #default="scope"> | |
| 126 | + <span v-for="item in scope.row.neighborhoods">{{ `${item.name} ` }}</span> | |
| 127 | + </template> | |
| 128 | + </el-table-column> | |
| 129 | + <el-table-column label="联系电话" prop="mobile"></el-table-column> | |
| 130 | + <el-table-column label="身份证号" prop="idCard"></el-table-column> | |
| 131 | + <el-table-column label="创建时间" prop="createTime"> | |
| 132 | + <template #default="scope"> | |
| 133 | + <span>{{ parseTime(new Date(scope.row.createTime).getTime()) }}</span> | |
| 134 | + </template> | |
| 135 | + </el-table-column> | |
| 136 | + <el-table-column label="操作"> | |
| 137 | + <template #default="scope"> | |
| 138 | + <el-button type="text" size="mini" @click="edit(scope.row)" | |
| 139 | + >编辑</el-button | |
| 140 | + > | |
| 141 | + <el-button type="text" size="mini" @click="remove(scope.row.id)" | |
| 142 | + >删除</el-button | |
| 143 | + > | |
| 144 | + </template> | |
| 145 | + </el-table-column> | |
| 146 | + </el-table> | |
| 147 | + | |
| 148 | + <!-- 分页 --> | |
| 149 | + <Pagination | |
| 150 | + v-if="data.total > 0" | |
| 151 | + :total="data.total" | |
| 152 | + v-model:currentPage="searchData.page" | |
| 153 | + v-model:pageSize="searchData.pageSize" | |
| 154 | + @pageChange="search" | |
| 155 | + ></Pagination> | |
| 156 | + | |
| 157 | + <!-- 详情弹框 --> | |
| 158 | + <el-dialog | |
| 159 | + v-model="data.dialogVisible" | |
| 160 | + :title="data.title" | |
| 161 | + width="30%" | |
| 162 | + @close="dialogClose" | |
| 163 | + > | |
| 164 | + <Detail | |
| 165 | + ref="detailRef" | |
| 166 | + @cancel="data.dialogVisible = false" | |
| 167 | + @success="changeData" | |
| 168 | + :formObj="data.formObj" | |
| 169 | + ></Detail> | |
| 170 | + </el-dialog> | |
| 171 | + </div> | |
| 172 | +</template> | |
| 173 | + | |
| 174 | +<style></style> | ... | ... |