Commit 21e37d17c0c45941d44b671495d83042b244f719
1 parent
fc7cb950
开发设备类型功能
Showing
15 changed files
with
1618 additions
and
1 deletions
src/api/community/locationManageApi.js
0 → 100644
| 1 | +import request from '@/utils/request' | ||
| 2 | +import { getCommunityId } from '@/api/community/communityApi' | ||
| 3 | + | ||
| 4 | +// 查询位置列表 | ||
| 5 | +export function listCommunityLocations(params) { | ||
| 6 | + return new Promise((resolve, reject) => { | ||
| 7 | + request({ | ||
| 8 | + url: '/communityLocation.listCommunityLocations', | ||
| 9 | + method: 'get', | ||
| 10 | + params: { | ||
| 11 | + ...params, | ||
| 12 | + communityId: getCommunityId() | ||
| 13 | + } | ||
| 14 | + }).then(response => { | ||
| 15 | + const res = response.data | ||
| 16 | + resolve(res) | ||
| 17 | + }).catch(error => { | ||
| 18 | + reject(error) | ||
| 19 | + }) | ||
| 20 | + }) | ||
| 21 | +} | ||
| 22 | + | ||
| 23 | +// 添加位置 | ||
| 24 | +export function saveCommunityLocation(data) { | ||
| 25 | + return new Promise((resolve, reject) => { | ||
| 26 | + request({ | ||
| 27 | + url: '/communityLocation.saveCommunityLocation', | ||
| 28 | + method: 'post', | ||
| 29 | + data: { | ||
| 30 | + ...data, | ||
| 31 | + communityId: getCommunityId() | ||
| 32 | + } | ||
| 33 | + }).then(response => { | ||
| 34 | + const res = response.data | ||
| 35 | + resolve(res) | ||
| 36 | + }).catch(error => { | ||
| 37 | + reject(error) | ||
| 38 | + }) | ||
| 39 | + }) | ||
| 40 | +} | ||
| 41 | + | ||
| 42 | +// 修改位置 | ||
| 43 | +export function updateCommunityLocation(data) { | ||
| 44 | + return new Promise((resolve, reject) => { | ||
| 45 | + request({ | ||
| 46 | + url: '/communityLocation.updateCommunityLocation', | ||
| 47 | + method: 'post', | ||
| 48 | + data: { | ||
| 49 | + ...data, | ||
| 50 | + communityId: getCommunityId() | ||
| 51 | + } | ||
| 52 | + }).then(response => { | ||
| 53 | + const res = response.data | ||
| 54 | + resolve(res) | ||
| 55 | + }).catch(error => { | ||
| 56 | + reject(error) | ||
| 57 | + }) | ||
| 58 | + }) | ||
| 59 | +} | ||
| 60 | + | ||
| 61 | +// 删除位置 | ||
| 62 | +export function deleteCommunityLocation(data) { | ||
| 63 | + return new Promise((resolve, reject) => { | ||
| 64 | + request({ | ||
| 65 | + url: '/communityLocation.deleteCommunityLocation', | ||
| 66 | + method: 'post', | ||
| 67 | + data: { | ||
| 68 | + ...data, | ||
| 69 | + communityId: getCommunityId() | ||
| 70 | + } | ||
| 71 | + }).then(response => { | ||
| 72 | + const res = response.data | ||
| 73 | + resolve(res) | ||
| 74 | + }).catch(error => { | ||
| 75 | + reject(error) | ||
| 76 | + }) | ||
| 77 | + }) | ||
| 78 | +} | ||
| 79 | + | ||
| 80 | +// 查询楼栋列表 | ||
| 81 | +export function queryFloors(params) { | ||
| 82 | + return new Promise((resolve, reject) => { | ||
| 83 | + request({ | ||
| 84 | + url: '/floor.queryFloors', | ||
| 85 | + method: 'get', | ||
| 86 | + params: { | ||
| 87 | + ...params, | ||
| 88 | + communityId: getCommunityId() | ||
| 89 | + } | ||
| 90 | + }).then(response => { | ||
| 91 | + const res = response.data | ||
| 92 | + resolve(res) | ||
| 93 | + }).catch(error => { | ||
| 94 | + reject(error) | ||
| 95 | + }) | ||
| 96 | + }) | ||
| 97 | +} | ||
| 98 | + | ||
| 99 | +// 查询单元列表 | ||
| 100 | +export function queryUnits(params) { | ||
| 101 | + return new Promise((resolve, reject) => { | ||
| 102 | + request({ | ||
| 103 | + url: '/unit.queryUnits', | ||
| 104 | + method: 'get', | ||
| 105 | + params: { | ||
| 106 | + ...params, | ||
| 107 | + communityId: getCommunityId() | ||
| 108 | + } | ||
| 109 | + }).then(response => { | ||
| 110 | + const res = response.data | ||
| 111 | + resolve(res) | ||
| 112 | + }).catch(error => { | ||
| 113 | + reject(error) | ||
| 114 | + }) | ||
| 115 | + }) | ||
| 116 | +} | ||
| 117 | + | ||
| 118 | +// 查询房屋列表 | ||
| 119 | +export function queryRooms(params) { | ||
| 120 | + return new Promise((resolve, reject) => { | ||
| 121 | + request({ | ||
| 122 | + url: '/room.queryRooms', | ||
| 123 | + method: 'get', | ||
| 124 | + params: { | ||
| 125 | + ...params, | ||
| 126 | + communityId: getCommunityId() | ||
| 127 | + } | ||
| 128 | + }).then(response => { | ||
| 129 | + const res = response.data | ||
| 130 | + resolve(res) | ||
| 131 | + }).catch(error => { | ||
| 132 | + reject(error) | ||
| 133 | + }) | ||
| 134 | + }) | ||
| 135 | +} | ||
| 136 | + | ||
| 137 | +// 查询岗亭列表 | ||
| 138 | +export function listParkingBox(params) { | ||
| 139 | + return new Promise((resolve, reject) => { | ||
| 140 | + request({ | ||
| 141 | + url: '/parkingBox.listParkingBox', | ||
| 142 | + method: 'get', | ||
| 143 | + params: { | ||
| 144 | + ...params, | ||
| 145 | + communityId: getCommunityId() | ||
| 146 | + } | ||
| 147 | + }).then(response => { | ||
| 148 | + const res = response.data | ||
| 149 | + resolve(res) | ||
| 150 | + }).catch(error => { | ||
| 151 | + reject(error) | ||
| 152 | + }) | ||
| 153 | + }) | ||
| 154 | +} | ||
| 155 | + | ||
| 156 | +// 查询停车场列表 | ||
| 157 | +export function listParkingAreas(params) { | ||
| 158 | + return new Promise((resolve, reject) => { | ||
| 159 | + request({ | ||
| 160 | + url: '/parkingArea.listParkingAreas', | ||
| 161 | + method: 'get', | ||
| 162 | + params: { | ||
| 163 | + ...params, | ||
| 164 | + communityId: getCommunityId() | ||
| 165 | + } | ||
| 166 | + }).then(response => { | ||
| 167 | + const res = response.data | ||
| 168 | + resolve(res) | ||
| 169 | + }).catch(error => { | ||
| 170 | + reject(error) | ||
| 171 | + }) | ||
| 172 | + }) | ||
| 173 | +} | ||
| 174 | + | ||
| 175 | +// 查询组织树 | ||
| 176 | +export function listOrgTree(params) { | ||
| 177 | + return new Promise((resolve, reject) => { | ||
| 178 | + request({ | ||
| 179 | + url: '/org.listOrgTree', | ||
| 180 | + method: 'get', | ||
| 181 | + params: { | ||
| 182 | + ...params, | ||
| 183 | + communityId: getCommunityId() | ||
| 184 | + } | ||
| 185 | + }).then(response => { | ||
| 186 | + const res = response.data | ||
| 187 | + resolve(res) | ||
| 188 | + }).catch(error => { | ||
| 189 | + reject(error) | ||
| 190 | + }) | ||
| 191 | + }) | ||
| 192 | +} | ||
| 193 | + | ||
| 194 | +// 查询组织列表 | ||
| 195 | +export function listOrgs(params) { | ||
| 196 | + return new Promise((resolve, reject) => { | ||
| 197 | + request({ | ||
| 198 | + url: '/org.listOrgs', | ||
| 199 | + method: 'get', | ||
| 200 | + params: { | ||
| 201 | + ...params, | ||
| 202 | + communityId: getCommunityId() | ||
| 203 | + } | ||
| 204 | + }).then(response => { | ||
| 205 | + const res = response.data | ||
| 206 | + resolve(res) | ||
| 207 | + }).catch(error => { | ||
| 208 | + reject(error) | ||
| 209 | + }) | ||
| 210 | + }) | ||
| 211 | +} | ||
| 0 | \ No newline at end of file | 212 | \ No newline at end of file |
src/api/machine/machineTypeTreeManageApi.js
0 → 100644
| 1 | +import request from '@/utils/request' | ||
| 2 | + | ||
| 3 | +// 获取设备类型列表 | ||
| 4 | +export function listMachineType(params) { | ||
| 5 | + return new Promise((resolve, reject) => { | ||
| 6 | + request({ | ||
| 7 | + url: '/machineType.listMachineType', | ||
| 8 | + method: 'get', | ||
| 9 | + params | ||
| 10 | + }).then(response => { | ||
| 11 | + const res = response.data | ||
| 12 | + resolve(res) | ||
| 13 | + }).catch(error => { | ||
| 14 | + reject(error) | ||
| 15 | + }) | ||
| 16 | + }) | ||
| 17 | +} | ||
| 18 | + | ||
| 19 | +// 添加设备类型 | ||
| 20 | +export function saveMachineType(data) { | ||
| 21 | + return new Promise((resolve, reject) => { | ||
| 22 | + request({ | ||
| 23 | + url: '/machineType.saveMachineType', | ||
| 24 | + method: 'post', | ||
| 25 | + data | ||
| 26 | + }).then(response => { | ||
| 27 | + const res = response.data | ||
| 28 | + resolve(res) | ||
| 29 | + }).catch(error => { | ||
| 30 | + reject(error) | ||
| 31 | + }) | ||
| 32 | + }) | ||
| 33 | +} | ||
| 34 | + | ||
| 35 | +// 更新设备类型 | ||
| 36 | +export function updateMachineType(data) { | ||
| 37 | + return new Promise((resolve, reject) => { | ||
| 38 | + request({ | ||
| 39 | + url: '/machineType.updateMachineType', | ||
| 40 | + method: 'post', | ||
| 41 | + data | ||
| 42 | + }).then(response => { | ||
| 43 | + const res = response.data | ||
| 44 | + resolve(res) | ||
| 45 | + }).catch(error => { | ||
| 46 | + reject(error) | ||
| 47 | + }) | ||
| 48 | + }) | ||
| 49 | +} | ||
| 50 | + | ||
| 51 | +// 删除设备类型 | ||
| 52 | +export function deleteMachineType(data) { | ||
| 53 | + return new Promise((resolve, reject) => { | ||
| 54 | + request({ | ||
| 55 | + url: '/machineType.deleteMachineType', | ||
| 56 | + method: 'post', | ||
| 57 | + data | ||
| 58 | + }).then(response => { | ||
| 59 | + const res = response.data | ||
| 60 | + resolve(res) | ||
| 61 | + }).catch(error => { | ||
| 62 | + reject(error) | ||
| 63 | + }) | ||
| 64 | + }) | ||
| 65 | +} | ||
| 0 | \ No newline at end of file | 66 | \ No newline at end of file |
src/components/community/AddLocation.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <el-dialog :title="$t('locationManage.add')" :visible.sync="visible" width="50%" @close="handleClose"> | ||
| 3 | + <el-form ref="form" :model="formData" label-width="120px"> | ||
| 4 | + <el-form-item :label="$t('locationManage.locationName')" prop="locationName" :rules="[ | ||
| 5 | + { required: true, message: $t('locationManage.locationNameRequired') }, | ||
| 6 | + { max: 100, message: $t('locationManage.locationNameMaxLength') } | ||
| 7 | + ]"> | ||
| 8 | + <el-input v-model="formData.locationName" :placeholder="$t('locationManage.enterLocationName')" /> | ||
| 9 | + </el-form-item> | ||
| 10 | + | ||
| 11 | + <el-form-item :label="$t('locationManage.locationType')" prop="locationType" :rules="[ | ||
| 12 | + { required: true, message: $t('locationManage.locationTypeRequired') } | ||
| 13 | + ]"> | ||
| 14 | + <el-select v-model="formData.locationType" :placeholder="$t('locationManage.selectLocationType')" | ||
| 15 | + style="width:100%" @change="handleLocationTypeChange"> | ||
| 16 | + <el-option v-for="item in locationTypeOptions" :key="item.value" :label="item.label" :value="item.value" /> | ||
| 17 | + </el-select> | ||
| 18 | + </el-form-item> | ||
| 19 | + </el-form> | ||
| 20 | + | ||
| 21 | + <span slot="footer" class="dialog-footer"> | ||
| 22 | + <el-button @click="visible = false">{{ $t('common.cancel') }}</el-button> | ||
| 23 | + <el-button type="primary" @click="handleSubmit">{{ $t('common.confirm') }}</el-button> | ||
| 24 | + </span> | ||
| 25 | + </el-dialog> | ||
| 26 | +</template> | ||
| 27 | + | ||
| 28 | +<script> | ||
| 29 | +import { getCommunityId,getCommunityName } from '@/api/community/communityApi' | ||
| 30 | +import { saveCommunityLocation } from '@/api/community/locationManageApi' | ||
| 31 | + | ||
| 32 | + | ||
| 33 | +export default { | ||
| 34 | + name: 'AddLocation', | ||
| 35 | + components: { | ||
| 36 | + }, | ||
| 37 | + data() { | ||
| 38 | + return { | ||
| 39 | + visible: false, | ||
| 40 | + formData: { | ||
| 41 | + locationName: '', | ||
| 42 | + locationType: '', | ||
| 43 | + locationObjId: '', | ||
| 44 | + locationObjName: '', | ||
| 45 | + communityId: getCommunityId() | ||
| 46 | + }, | ||
| 47 | + locationTypeOptions: [ | ||
| 48 | + { value: '1000', label: this.$t('locationManage.community') }, | ||
| 49 | + ] | ||
| 50 | + } | ||
| 51 | + }, | ||
| 52 | + methods: { | ||
| 53 | + open() { | ||
| 54 | + this.visible = true | ||
| 55 | + }, | ||
| 56 | + handleClose() { | ||
| 57 | + this.$refs.form.resetFields() | ||
| 58 | + this.formData = { | ||
| 59 | + locationName: '', | ||
| 60 | + locationType: '', | ||
| 61 | + locationObjId: '', | ||
| 62 | + locationObjName: '', | ||
| 63 | + communityId: getCommunityId() | ||
| 64 | + } | ||
| 65 | + }, | ||
| 66 | + handleLocationTypeChange(val) { | ||
| 67 | + console.log(val) | ||
| 68 | + this.formData.locationObjId = '' | ||
| 69 | + this.formData.locationObjName = '' | ||
| 70 | + }, | ||
| 71 | + handleFloorChange(data) { | ||
| 72 | + if (data) { | ||
| 73 | + this.formData.locationObjId = data.floorId | ||
| 74 | + this.formData.locationObjName = data.floorNum | ||
| 75 | + } else { | ||
| 76 | + this.formData.locationObjId = '' | ||
| 77 | + this.formData.locationObjName = '' | ||
| 78 | + } | ||
| 79 | + }, | ||
| 80 | + handleUnitChange(data) { | ||
| 81 | + if (data) { | ||
| 82 | + this.formData.locationObjId = data.unitId | ||
| 83 | + this.formData.locationObjName = `${data.floorNum}${data.unitNum}` | ||
| 84 | + } else { | ||
| 85 | + this.formData.locationObjId = '' | ||
| 86 | + this.formData.locationObjName = '' | ||
| 87 | + } | ||
| 88 | + }, | ||
| 89 | + handleParkingBoxChange(data) { | ||
| 90 | + if (data) { | ||
| 91 | + this.formData.locationObjId = data.boxId | ||
| 92 | + this.formData.locationObjName = data.boxName | ||
| 93 | + } else { | ||
| 94 | + this.formData.locationObjId = '' | ||
| 95 | + this.formData.locationObjName = '' | ||
| 96 | + } | ||
| 97 | + }, | ||
| 98 | + handleOrgChange(data) { | ||
| 99 | + if (data) { | ||
| 100 | + this.formData.locationObjId = data.orgId | ||
| 101 | + this.formData.locationObjName = data.allOrgName | ||
| 102 | + } else { | ||
| 103 | + this.formData.locationObjId = '' | ||
| 104 | + this.formData.locationObjName = '' | ||
| 105 | + } | ||
| 106 | + }, | ||
| 107 | + async handleSubmit() { | ||
| 108 | + try { | ||
| 109 | + await this.$refs.form.validate() | ||
| 110 | + | ||
| 111 | + if (this.formData.locationType === '1000') { | ||
| 112 | + this.formData.locationObjId = getCommunityId() | ||
| 113 | + this.formData.locationObjName = getCommunityName() | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + await saveCommunityLocation(this.formData) | ||
| 117 | + this.$message.success(this.$t('common.addSuccess')) | ||
| 118 | + this.visible = false | ||
| 119 | + this.$emit('success') | ||
| 120 | + } catch (error) { | ||
| 121 | + console.error(error) | ||
| 122 | + } | ||
| 123 | + } | ||
| 124 | + } | ||
| 125 | +} | ||
| 126 | +</script> | ||
| 0 | \ No newline at end of file | 127 | \ No newline at end of file |
src/components/community/DeleteLocation.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <el-dialog | ||
| 3 | + :title="$t('locationManage.confirmOperation')" | ||
| 4 | + :visible.sync="visible" | ||
| 5 | + width="30%" | ||
| 6 | + @close="handleClose" | ||
| 7 | + > | ||
| 8 | + <div style="text-align:center"> | ||
| 9 | + <p>{{ $t('locationManage.confirmDeleteLocation') }}</p> | ||
| 10 | + </div> | ||
| 11 | + <span slot="footer" class="dialog-footer"> | ||
| 12 | + <el-button @click="visible = false">{{ $t('common.cancel') }}</el-button> | ||
| 13 | + <el-button type="primary" @click="handleConfirm">{{ $t('common.confirm') }}</el-button> | ||
| 14 | + </span> | ||
| 15 | + </el-dialog> | ||
| 16 | +</template> | ||
| 17 | + | ||
| 18 | +<script> | ||
| 19 | +import { getCommunityId } from '@/api/community/communityApi' | ||
| 20 | +import { deleteCommunityLocation } from '@/api/community/locationManageApi' | ||
| 21 | + | ||
| 22 | +export default { | ||
| 23 | + name: 'DeleteLocation', | ||
| 24 | + data() { | ||
| 25 | + return { | ||
| 26 | + visible: false, | ||
| 27 | + locationData: {} | ||
| 28 | + } | ||
| 29 | + }, | ||
| 30 | + methods: { | ||
| 31 | + open(data) { | ||
| 32 | + this.locationData = data | ||
| 33 | + this.visible = true | ||
| 34 | + }, | ||
| 35 | + handleClose() { | ||
| 36 | + this.locationData = {} | ||
| 37 | + }, | ||
| 38 | + async handleConfirm() { | ||
| 39 | + try { | ||
| 40 | + const params = { | ||
| 41 | + ...this.locationData, | ||
| 42 | + communityId: getCommunityId() | ||
| 43 | + } | ||
| 44 | + await deleteCommunityLocation(params) | ||
| 45 | + this.$message.success(this.$t('common.deleteSuccess')) | ||
| 46 | + this.visible = false | ||
| 47 | + this.$emit('success') | ||
| 48 | + } catch (error) { | ||
| 49 | + this.$message.error(this.$t('common.deleteFailed')) | ||
| 50 | + } | ||
| 51 | + } | ||
| 52 | + } | ||
| 53 | +} | ||
| 54 | +</script> | ||
| 0 | \ No newline at end of file | 55 | \ No newline at end of file |
src/components/community/EditLocation.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <el-dialog :title="$t('locationManage.edit')" :visible.sync="visible" width="50%" @close="handleClose"> | ||
| 3 | + <el-form ref="form" :model="formData" label-width="120px"> | ||
| 4 | + <el-form-item :label="$t('locationManage.locationName')" prop="locationName" :rules="[ | ||
| 5 | + { required: true, message: $t('locationManage.locationNameRequired') }, | ||
| 6 | + { max: 100, message: $t('locationManage.locationNameMaxLength') } | ||
| 7 | + ]"> | ||
| 8 | + <el-input v-model="formData.locationName" :placeholder="$t('locationManage.enterLocationName')" /> | ||
| 9 | + </el-form-item> | ||
| 10 | + | ||
| 11 | + <el-form-item :label="$t('locationManage.locationType')" prop="locationType"> | ||
| 12 | + <el-select v-model="formData.locationType" :placeholder="$t('locationManage.selectLocationType')" | ||
| 13 | + style="width:100%" disabled> | ||
| 14 | + <el-option v-for="item in locationTypeOptions" :key="item.value" :label="item.label" :value="item.value" /> | ||
| 15 | + </el-select> | ||
| 16 | + </el-form-item> | ||
| 17 | + | ||
| 18 | + <el-form-item :label="$t('locationManage.locationObject')" prop="locationObjName"> | ||
| 19 | + <el-input v-model="formData.locationObjName" disabled /> | ||
| 20 | + </el-form-item> | ||
| 21 | + </el-form> | ||
| 22 | + | ||
| 23 | + <span slot="footer" class="dialog-footer"> | ||
| 24 | + <el-button @click="visible = false">{{ $t('common.cancel') }}</el-button> | ||
| 25 | + <el-button type="primary" @click="handleSubmit">{{ $t('common.confirm') }}</el-button> | ||
| 26 | + </span> | ||
| 27 | + </el-dialog> | ||
| 28 | +</template> | ||
| 29 | + | ||
| 30 | +<script> | ||
| 31 | +import { getCommunityId,getCommunityName } from '@/api/community/communityApi' | ||
| 32 | +import { updateCommunityLocation } from '@/api/community/locationManageApi' | ||
| 33 | + | ||
| 34 | + | ||
| 35 | +export default { | ||
| 36 | + name: 'EditLocation', | ||
| 37 | + components: { | ||
| 38 | + }, | ||
| 39 | + data() { | ||
| 40 | + return { | ||
| 41 | + visible: false, | ||
| 42 | + formData: { | ||
| 43 | + locationId: '', | ||
| 44 | + locationName: '', | ||
| 45 | + locationType: '', | ||
| 46 | + locationObjId: '', | ||
| 47 | + locationObjName: '', | ||
| 48 | + floorId: '', | ||
| 49 | + unitId: '', | ||
| 50 | + boxId: '', | ||
| 51 | + paId: '', | ||
| 52 | + communityId: getCommunityId() | ||
| 53 | + }, | ||
| 54 | + locationTypeOptions: [ | ||
| 55 | + { value: '1000', label: this.$t('locationManage.community') }, | ||
| 56 | + ] | ||
| 57 | + } | ||
| 58 | + }, | ||
| 59 | + methods: { | ||
| 60 | + open(row) { | ||
| 61 | + this.formData = { | ||
| 62 | + ...row, | ||
| 63 | + communityId: getCommunityId() | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + // Set values for select components | ||
| 67 | + | ||
| 68 | + | ||
| 69 | + this.visible = true | ||
| 70 | + }, | ||
| 71 | + handleClose() { | ||
| 72 | + this.$refs.form.resetFields() | ||
| 73 | + this.formData = { | ||
| 74 | + locationId: '', | ||
| 75 | + locationName: '', | ||
| 76 | + locationType: '', | ||
| 77 | + locationObjId: '', | ||
| 78 | + locationObjName: '', | ||
| 79 | + floorId: '', | ||
| 80 | + unitId: '', | ||
| 81 | + boxId: '', | ||
| 82 | + paId: '', | ||
| 83 | + communityId: getCommunityId() | ||
| 84 | + } | ||
| 85 | + }, | ||
| 86 | + handleFloorChange(data) { | ||
| 87 | + if (data) { | ||
| 88 | + this.formData.locationObjId = data.floorId | ||
| 89 | + this.formData.locationObjName = data.floorNum + this.$t('locationManage.buildingUnit') | ||
| 90 | + } | ||
| 91 | + }, | ||
| 92 | + handleUnitChange(data) { | ||
| 93 | + if (data) { | ||
| 94 | + this.formData.locationObjId = data.unitId | ||
| 95 | + this.formData.locationObjName = `${data.floorNum}${data.unitNum}` | ||
| 96 | + } | ||
| 97 | + }, | ||
| 98 | + handleParkingBoxChange(data) { | ||
| 99 | + if (data) { | ||
| 100 | + this.formData.locationObjId = data.boxId | ||
| 101 | + this.formData.locationObjName = data.boxName | ||
| 102 | + } | ||
| 103 | + }, | ||
| 104 | + handleParkingAreaChange(data) { | ||
| 105 | + if (data) { | ||
| 106 | + this.formData.locationObjId = data.paId | ||
| 107 | + this.formData.locationObjName = data.num + this.$t('locationManage.parkingLot') | ||
| 108 | + } | ||
| 109 | + }, | ||
| 110 | + async handleSubmit() { | ||
| 111 | + try { | ||
| 112 | + await this.$refs.form.validate() | ||
| 113 | + | ||
| 114 | + if (this.formData.locationType === '1000') { | ||
| 115 | + this.formData.locationObjId = getCommunityId() | ||
| 116 | + this.formData.locationObjName = getCommunityName() | ||
| 117 | + } | ||
| 118 | + | ||
| 119 | + await updateCommunityLocation(this.formData) | ||
| 120 | + this.$message.success(this.$t('common.editSuccess')) | ||
| 121 | + this.visible = false | ||
| 122 | + this.$emit('success') | ||
| 123 | + } catch (error) { | ||
| 124 | + console.error(error) | ||
| 125 | + } | ||
| 126 | + } | ||
| 127 | + } | ||
| 128 | +} | ||
| 129 | +</script> | ||
| 0 | \ No newline at end of file | 130 | \ No newline at end of file |
src/components/machine/addMachineType.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <el-dialog | ||
| 3 | + :title="$t('machineTypeTree.add')" | ||
| 4 | + :visible.sync="dialogVisible" | ||
| 5 | + width="50%" | ||
| 6 | + @close="handleClose" | ||
| 7 | + > | ||
| 8 | + <el-form ref="form" :model="form" :rules="rules" label-width="120px"> | ||
| 9 | + <el-form-item :label="$t('machineTypeTree.machineTypeName')" prop="machineTypeName"> | ||
| 10 | + <el-input | ||
| 11 | + v-model.trim="form.machineTypeName" | ||
| 12 | + :placeholder="$t('machineTypeTree.requiredPlaceholder', {field: $t('machineTypeTree.machineTypeName')})" | ||
| 13 | + ></el-input> | ||
| 14 | + </el-form-item> | ||
| 15 | + <el-form-item :label="$t('machineTypeTree.machineTypeCode')" prop="machineTypeCode"> | ||
| 16 | + <el-input | ||
| 17 | + v-model.trim="form.machineTypeCode" | ||
| 18 | + :placeholder="$t('machineTypeTree.requiredPlaceholder', {field: $t('machineTypeTree.machineTypeCode')})" | ||
| 19 | + ></el-input> | ||
| 20 | + </el-form-item> | ||
| 21 | + <el-form-item :label="$t('machineTypeTree.status')" prop="isEnable"> | ||
| 22 | + <el-radio-group v-model="form.isEnable"> | ||
| 23 | + <el-radio :label="'1000'">{{ $t('machineTypeTree.enable') }}</el-radio> | ||
| 24 | + <el-radio :label="'2000'">{{ $t('machineTypeTree.disable') }}</el-radio> | ||
| 25 | + </el-radio-group> | ||
| 26 | + </el-form-item> | ||
| 27 | + <el-form-item :label="$t('machineTypeTree.importanceLevel')" prop="importanceLevel"> | ||
| 28 | + <el-select | ||
| 29 | + v-model="form.importanceLevel" | ||
| 30 | + :placeholder="$t('machineTypeTree.requiredPlaceholder', {field: $t('machineTypeTree.importanceLevel')})" | ||
| 31 | + style="width:100%" | ||
| 32 | + > | ||
| 33 | + <el-option | ||
| 34 | + v-for="item in importanceLevels" | ||
| 35 | + :key="item.statusCd" | ||
| 36 | + :label="item.name" | ||
| 37 | + :value="item.statusCd" | ||
| 38 | + ></el-option> | ||
| 39 | + </el-select> | ||
| 40 | + </el-form-item> | ||
| 41 | + <el-form-item :label="$t('machineTypeTree.seq')" prop="seq"> | ||
| 42 | + <el-input-number | ||
| 43 | + v-model="form.seq" | ||
| 44 | + :placeholder="$t('machineTypeTree.requiredPlaceholder', {field: $t('machineTypeTree.seq')})" | ||
| 45 | + controls-position="right" | ||
| 46 | + :min="1" | ||
| 47 | + style="width:100%" | ||
| 48 | + ></el-input-number> | ||
| 49 | + </el-form-item> | ||
| 50 | + <el-form-item :label="$t('machineTypeTree.unit')"> | ||
| 51 | + <el-input | ||
| 52 | + v-model.trim="form.unit" | ||
| 53 | + :placeholder="$t('machineTypeTree.optionalPlaceholder', {field: $t('machineTypeTree.unit')})" | ||
| 54 | + ></el-input> | ||
| 55 | + </el-form-item> | ||
| 56 | + <el-form-item :label="$t('machineTypeTree.warrantyDeadline')"> | ||
| 57 | + <el-date-picker | ||
| 58 | + v-model="form.warrantyDeadline" | ||
| 59 | + type="date" | ||
| 60 | + :placeholder="$t('machineTypeTree.optionalPlaceholder', {field: $t('machineTypeTree.warrantyDeadline')})" | ||
| 61 | + style="width:100%" | ||
| 62 | + value-format="yyyy-MM-dd" | ||
| 63 | + ></el-date-picker> | ||
| 64 | + </el-form-item> | ||
| 65 | + <el-form-item :label="$t('machineTypeTree.remark')"> | ||
| 66 | + <el-input | ||
| 67 | + v-model.trim="form.remark" | ||
| 68 | + type="textarea" | ||
| 69 | + :placeholder="$t('machineTypeTree.optionalPlaceholder', {field: $t('machineTypeTree.remark')})" | ||
| 70 | + ></el-input> | ||
| 71 | + </el-form-item> | ||
| 72 | + </el-form> | ||
| 73 | + | ||
| 74 | + <span slot="footer" class="dialog-footer"> | ||
| 75 | + <el-button @click="dialogVisible = false">{{ $t('common.cancel') }}</el-button> | ||
| 76 | + <el-button type="primary" @click="handleSubmit">{{ $t('common.confirm') }}</el-button> | ||
| 77 | + </span> | ||
| 78 | + </el-dialog> | ||
| 79 | +</template> | ||
| 80 | + | ||
| 81 | +<script> | ||
| 82 | +import { saveMachineType } from '@/api/machine/machineTypeTreeManageApi' | ||
| 83 | +import { getDict } from '@/api/community/communityApi' | ||
| 84 | +import { getCommunityId } from '@/api/community/communityApi' | ||
| 85 | + | ||
| 86 | +export default { | ||
| 87 | + name: 'AddMachineType', | ||
| 88 | + data() { | ||
| 89 | + return { | ||
| 90 | + dialogVisible: false, | ||
| 91 | + form: { | ||
| 92 | + parentTypeId: '', | ||
| 93 | + machineTypeName: '', | ||
| 94 | + machineTypeCode: '', | ||
| 95 | + isEnable: '1000', | ||
| 96 | + importanceLevel: '', | ||
| 97 | + unit: '', | ||
| 98 | + warrantyDeadline: '', | ||
| 99 | + seq: 1, | ||
| 100 | + remark: '', | ||
| 101 | + communityId: '' | ||
| 102 | + }, | ||
| 103 | + importanceLevels: [], | ||
| 104 | + rules: { | ||
| 105 | + machineTypeName: [ | ||
| 106 | + { required: true, message: this.$t('machineTypeTree.requiredMessage', {field: this.$t('machineTypeTree.machineTypeName')}), trigger: 'blur' }, | ||
| 107 | + { max: 30, message: this.$t('machineTypeTree.maxLengthMessage', {length: 30}), trigger: 'blur' } | ||
| 108 | + ], | ||
| 109 | + machineTypeCode: [ | ||
| 110 | + { required: true, message: this.$t('machineTypeTree.requiredMessage', {field: this.$t('machineTypeTree.machineTypeCode')}), trigger: 'blur' }, | ||
| 111 | + { max: 30, message: this.$t('machineTypeTree.maxLengthMessage', {length: 30}), trigger: 'blur' } | ||
| 112 | + ], | ||
| 113 | + isEnable: [ | ||
| 114 | + { required: true, message: this.$t('machineTypeTree.requiredMessage', {field: this.$t('machineTypeTree.status')}), trigger: 'change' } | ||
| 115 | + ], | ||
| 116 | + importanceLevel: [ | ||
| 117 | + { required: true, message: this.$t('machineTypeTree.requiredMessage', {field: this.$t('machineTypeTree.importanceLevel')}), trigger: 'change' } | ||
| 118 | + ], | ||
| 119 | + seq: [ | ||
| 120 | + { required: true, message: this.$t('machineTypeTree.requiredMessage', {field: this.$t('machineTypeTree.seq')}), trigger: 'blur' } | ||
| 121 | + ] | ||
| 122 | + } | ||
| 123 | + } | ||
| 124 | + }, | ||
| 125 | + created() { | ||
| 126 | + this.form.communityId = getCommunityId() | ||
| 127 | + this.getDictData() | ||
| 128 | + }, | ||
| 129 | + methods: { | ||
| 130 | + async getDictData() { | ||
| 131 | + try { | ||
| 132 | + const data = await getDict('machine_type', 'importance_level') | ||
| 133 | + this.importanceLevels = data | ||
| 134 | + } catch (error) { | ||
| 135 | + console.error('获取字典数据失败:', error) | ||
| 136 | + } | ||
| 137 | + }, | ||
| 138 | + open(params) { | ||
| 139 | + this.form.parentTypeId = params.typeId || '' | ||
| 140 | + this.dialogVisible = true | ||
| 141 | + this.$nextTick(() => { | ||
| 142 | + this.$refs.form && this.$refs.form.resetFields() | ||
| 143 | + }) | ||
| 144 | + }, | ||
| 145 | + handleClose() { | ||
| 146 | + this.$refs.form.resetFields() | ||
| 147 | + }, | ||
| 148 | + handleSubmit() { | ||
| 149 | + this.$refs.form.validate(async valid => { | ||
| 150 | + if (valid) { | ||
| 151 | + try { | ||
| 152 | + await saveMachineType(this.form) | ||
| 153 | + this.$message.success(this.$t('common.addSuccess')) | ||
| 154 | + this.dialogVisible = false | ||
| 155 | + this.$emit('success') | ||
| 156 | + } catch (error) { | ||
| 157 | + console.error('添加设备类型失败:', error) | ||
| 158 | + } | ||
| 159 | + } | ||
| 160 | + }) | ||
| 161 | + } | ||
| 162 | + } | ||
| 163 | +} | ||
| 164 | +</script> | ||
| 0 | \ No newline at end of file | 165 | \ No newline at end of file |
src/components/machine/deleteMachineType.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <el-dialog | ||
| 3 | + :title="$t('machineTypeTree.confirmOperation')" | ||
| 4 | + :visible.sync="dialogVisible" | ||
| 5 | + width="30%" | ||
| 6 | + > | ||
| 7 | + <div class="text-center"> | ||
| 8 | + <p>{{ $t('machineTypeTree.confirmDelete') }}</p> | ||
| 9 | + </div> | ||
| 10 | + <span slot="footer" class="dialog-footer"> | ||
| 11 | + <el-button @click="dialogVisible = false">{{ $t('machineTypeTree.cancelDelete') }}</el-button> | ||
| 12 | + <el-button type="primary" @click="handleConfirm">{{ $t('machineTypeTree.confirmDeleteBtn') }}</el-button> | ||
| 13 | + </span> | ||
| 14 | + </el-dialog> | ||
| 15 | +</template> | ||
| 16 | + | ||
| 17 | +<script> | ||
| 18 | +import { deleteMachineType } from '@/api/machine/machineTypeTreeManageApi' | ||
| 19 | +import { getCommunityId } from '@/api/community/communityApi' | ||
| 20 | + | ||
| 21 | +export default { | ||
| 22 | + name: 'DeleteMachineType', | ||
| 23 | + data() { | ||
| 24 | + return { | ||
| 25 | + dialogVisible: false, | ||
| 26 | + form: { | ||
| 27 | + typeId: '', | ||
| 28 | + communityId: '' | ||
| 29 | + } | ||
| 30 | + } | ||
| 31 | + }, | ||
| 32 | + created() { | ||
| 33 | + this.form.communityId = getCommunityId() | ||
| 34 | + }, | ||
| 35 | + methods: { | ||
| 36 | + open(data) { | ||
| 37 | + this.form.typeId = data.typeId | ||
| 38 | + this.dialogVisible = true | ||
| 39 | + }, | ||
| 40 | + async handleConfirm() { | ||
| 41 | + try { | ||
| 42 | + await deleteMachineType(this.form) | ||
| 43 | + this.$message.success(this.$t('common.deleteSuccess')) | ||
| 44 | + this.dialogVisible = false | ||
| 45 | + this.$emit('success') | ||
| 46 | + } catch (error) { | ||
| 47 | + console.error('删除设备类型失败:', error) | ||
| 48 | + } | ||
| 49 | + } | ||
| 50 | + } | ||
| 51 | +} | ||
| 52 | +</script> | ||
| 53 | + | ||
| 54 | +<style scoped> | ||
| 55 | +.text-center { | ||
| 56 | + text-align: center; | ||
| 57 | + font-size: 16px; | ||
| 58 | + margin: 20px 0; | ||
| 59 | +} | ||
| 60 | +</style> | ||
| 0 | \ No newline at end of file | 61 | \ No newline at end of file |
src/components/machine/editMachineType.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <el-dialog | ||
| 3 | + :title="$t('machineTypeTree.edit')" | ||
| 4 | + :visible.sync="dialogVisible" | ||
| 5 | + width="50%" | ||
| 6 | + @close="handleClose" | ||
| 7 | + > | ||
| 8 | + <el-form ref="form" :model="form" :rules="rules" label-width="120px"> | ||
| 9 | + <el-form-item :label="$t('machineTypeTree.machineTypeName')" prop="machineTypeName"> | ||
| 10 | + <el-input | ||
| 11 | + v-model.trim="form.machineTypeName" | ||
| 12 | + :placeholder="$t('machineTypeTree.requiredPlaceholder', {field: $t('machineTypeTree.machineTypeName')})" | ||
| 13 | + ></el-input> | ||
| 14 | + </el-form-item> | ||
| 15 | + <el-form-item :label="$t('machineTypeTree.machineTypeCode')" prop="machineTypeCode"> | ||
| 16 | + <el-input | ||
| 17 | + v-model.trim="form.machineTypeCode" | ||
| 18 | + :placeholder="$t('machineTypeTree.requiredPlaceholder', {field: $t('machineTypeTree.machineTypeCode')})" | ||
| 19 | + ></el-input> | ||
| 20 | + </el-form-item> | ||
| 21 | + <el-form-item :label="$t('machineTypeTree.status')" prop="isEnable"> | ||
| 22 | + <el-radio-group v-model="form.isEnable"> | ||
| 23 | + <el-radio :label="'1000'">{{ $t('machineTypeTree.enable') }}</el-radio> | ||
| 24 | + <el-radio :label="'2000'">{{ $t('machineTypeTree.disable') }}</el-radio> | ||
| 25 | + </el-radio-group> | ||
| 26 | + </el-form-item> | ||
| 27 | + <el-form-item :label="$t('machineTypeTree.importanceLevel')" prop="importanceLevel"> | ||
| 28 | + <el-select | ||
| 29 | + v-model="form.importanceLevel" | ||
| 30 | + :placeholder="$t('machineTypeTree.requiredPlaceholder', {field: $t('machineTypeTree.importanceLevel')})" | ||
| 31 | + style="width:100%" | ||
| 32 | + > | ||
| 33 | + <el-option | ||
| 34 | + v-for="item in importanceLevels" | ||
| 35 | + :key="item.statusCd" | ||
| 36 | + :label="item.name" | ||
| 37 | + :value="item.statusCd" | ||
| 38 | + ></el-option> | ||
| 39 | + </el-select> | ||
| 40 | + </el-form-item> | ||
| 41 | + <el-form-item :label="$t('machineTypeTree.seq')" prop="seq"> | ||
| 42 | + <el-input-number | ||
| 43 | + v-model="form.seq" | ||
| 44 | + :placeholder="$t('machineTypeTree.requiredPlaceholder', {field: $t('machineTypeTree.seq')})" | ||
| 45 | + controls-position="right" | ||
| 46 | + :min="1" | ||
| 47 | + style="width:100%" | ||
| 48 | + ></el-input-number> | ||
| 49 | + </el-form-item> | ||
| 50 | + <el-form-item :label="$t('machineTypeTree.unit')"> | ||
| 51 | + <el-input | ||
| 52 | + v-model.trim="form.unit" | ||
| 53 | + :placeholder="$t('machineTypeTree.optionalPlaceholder', {field: $t('machineTypeTree.unit')})" | ||
| 54 | + ></el-input> | ||
| 55 | + </el-form-item> | ||
| 56 | + <el-form-item :label="$t('machineTypeTree.warrantyDeadline')"> | ||
| 57 | + <el-date-picker | ||
| 58 | + v-model="form.warrantyDeadline" | ||
| 59 | + type="date" | ||
| 60 | + :placeholder="$t('machineTypeTree.optionalPlaceholder', {field: $t('machineTypeTree.warrantyDeadline')})" | ||
| 61 | + style="width:100%" | ||
| 62 | + value-format="yyyy-MM-dd" | ||
| 63 | + ></el-date-picker> | ||
| 64 | + </el-form-item> | ||
| 65 | + <el-form-item :label="$t('machineTypeTree.remark')"> | ||
| 66 | + <el-input | ||
| 67 | + v-model.trim="form.remark" | ||
| 68 | + type="textarea" | ||
| 69 | + :placeholder="$t('machineTypeTree.optionalPlaceholder', {field: $t('machineTypeTree.remark')})" | ||
| 70 | + ></el-input> | ||
| 71 | + </el-form-item> | ||
| 72 | + </el-form> | ||
| 73 | + | ||
| 74 | + <span slot="footer" class="dialog-footer"> | ||
| 75 | + <el-button @click="dialogVisible = false">{{ $t('common.cancel') }}</el-button> | ||
| 76 | + <el-button type="primary" @click="handleSubmit">{{ $t('common.confirm') }}</el-button> | ||
| 77 | + </span> | ||
| 78 | + </el-dialog> | ||
| 79 | +</template> | ||
| 80 | + | ||
| 81 | +<script> | ||
| 82 | +import { updateMachineType } from '@/api/machine/machineTypeTreeManageApi' | ||
| 83 | +import { getDict } from '@/api/community/communityApi' | ||
| 84 | +import { getCommunityId } from '@/api/community/communityApi' | ||
| 85 | + | ||
| 86 | +export default { | ||
| 87 | + name: 'EditMachineType', | ||
| 88 | + data() { | ||
| 89 | + return { | ||
| 90 | + dialogVisible: false, | ||
| 91 | + form: { | ||
| 92 | + typeId: '', | ||
| 93 | + machineTypeName: '', | ||
| 94 | + machineTypeCode: '', | ||
| 95 | + isEnable: '', | ||
| 96 | + importanceLevel: '', | ||
| 97 | + unit: '', | ||
| 98 | + warrantyDeadline: '', | ||
| 99 | + seq: 1, | ||
| 100 | + remark: '', | ||
| 101 | + communityId: '' | ||
| 102 | + }, | ||
| 103 | + importanceLevels: [], | ||
| 104 | + rules: { | ||
| 105 | + machineTypeName: [ | ||
| 106 | + { required: true, message: this.$t('machineTypeTree.requiredMessage', {field: this.$t('machineTypeTree.machineTypeName')}), trigger: 'blur' }, | ||
| 107 | + { max: 30, message: this.$t('machineTypeTree.maxLengthMessage', {length: 30}), trigger: 'blur' } | ||
| 108 | + ], | ||
| 109 | + machineTypeCode: [ | ||
| 110 | + { required: true, message: this.$t('machineTypeTree.requiredMessage', {field: this.$t('machineTypeTree.machineTypeCode')}), trigger: 'blur' }, | ||
| 111 | + { max: 30, message: this.$t('machineTypeTree.maxLengthMessage', {length: 30}), trigger: 'blur' } | ||
| 112 | + ], | ||
| 113 | + isEnable: [ | ||
| 114 | + { required: true, message: this.$t('machineTypeTree.requiredMessage', {field: this.$t('machineTypeTree.status')}), trigger: 'change' } | ||
| 115 | + ], | ||
| 116 | + importanceLevel: [ | ||
| 117 | + { required: true, message: this.$t('machineTypeTree.requiredMessage', {field: this.$t('machineTypeTree.importanceLevel')}), trigger: 'change' } | ||
| 118 | + ], | ||
| 119 | + seq: [ | ||
| 120 | + { required: true, message: this.$t('machineTypeTree.requiredMessage', {field: this.$t('machineTypeTree.seq')}), trigger: 'blur' } | ||
| 121 | + ], | ||
| 122 | + typeId: [ | ||
| 123 | + { required: true, message: this.$t('machineTypeTree.requiredMessage', {field: 'ID'}), trigger: 'blur' }, | ||
| 124 | + { max: 30, message: this.$t('machineTypeTree.maxLengthMessage', {length: 30}), trigger: 'blur' } | ||
| 125 | + ] | ||
| 126 | + } | ||
| 127 | + } | ||
| 128 | + }, | ||
| 129 | + created() { | ||
| 130 | + this.form.communityId = getCommunityId() | ||
| 131 | + this.getDictData() | ||
| 132 | + }, | ||
| 133 | + methods: { | ||
| 134 | + async getDictData() { | ||
| 135 | + try { | ||
| 136 | + const data = await getDict('machine_type', 'importance_level') | ||
| 137 | + this.importanceLevels = data | ||
| 138 | + } catch (error) { | ||
| 139 | + console.error('获取字典数据失败:', error) | ||
| 140 | + } | ||
| 141 | + }, | ||
| 142 | + open(data) { | ||
| 143 | + this.form = { | ||
| 144 | + ...this.form, | ||
| 145 | + ...data | ||
| 146 | + } | ||
| 147 | + this.dialogVisible = true | ||
| 148 | + this.$nextTick(() => { | ||
| 149 | + this.$refs.form && this.$refs.form.clearValidate() | ||
| 150 | + }) | ||
| 151 | + }, | ||
| 152 | + handleClose() { | ||
| 153 | + this.$refs.form.resetFields() | ||
| 154 | + }, | ||
| 155 | + handleSubmit() { | ||
| 156 | + this.$refs.form.validate(async valid => { | ||
| 157 | + if (valid) { | ||
| 158 | + try { | ||
| 159 | + await updateMachineType(this.form) | ||
| 160 | + this.$message.success(this.$t('common.editSuccess')) | ||
| 161 | + this.dialogVisible = false | ||
| 162 | + this.$emit('success') | ||
| 163 | + } catch (error) { | ||
| 164 | + console.error('修改设备类型失败:', error) | ||
| 165 | + } | ||
| 166 | + } | ||
| 167 | + }) | ||
| 168 | + } | ||
| 169 | + } | ||
| 170 | +} | ||
| 171 | +</script> | ||
| 0 | \ No newline at end of file | 172 | \ No newline at end of file |
src/components/machine/machineTypeTree.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <el-card class="tree-container"> | ||
| 3 | + <el-tree ref="machineTypeTree" :data="treeData" node-key="id" :props="defaultProps" :highlight-current="true" | ||
| 4 | + :expand-on-click-node="false" @node-click="handleNodeClick"></el-tree> | ||
| 5 | + </el-card> | ||
| 6 | +</template> | ||
| 7 | + | ||
| 8 | +<script> | ||
| 9 | +import { listMachineType } from '@/api/machine/machineTypeTreeManageApi' | ||
| 10 | +import { getCommunityId } from '@/api/community/communityApi' | ||
| 11 | + | ||
| 12 | +export default { | ||
| 13 | + name: 'MachineTypeTree', | ||
| 14 | + props: { | ||
| 15 | + state: { | ||
| 16 | + type: String, | ||
| 17 | + default: '' | ||
| 18 | + } | ||
| 19 | + }, | ||
| 20 | + data() { | ||
| 21 | + return { | ||
| 22 | + treeData: [], | ||
| 23 | + defaultProps: { | ||
| 24 | + children: 'children', | ||
| 25 | + label: 'text' | ||
| 26 | + }, | ||
| 27 | + communityId: '' | ||
| 28 | + } | ||
| 29 | + }, | ||
| 30 | + created() { | ||
| 31 | + this.communityId = getCommunityId() | ||
| 32 | + this.loadMachineTypesTree() | ||
| 33 | + }, | ||
| 34 | + methods: { | ||
| 35 | + async loadMachineTypesTree() { | ||
| 36 | + try { | ||
| 37 | + const params = { | ||
| 38 | + page: 1, | ||
| 39 | + row: 100, | ||
| 40 | + communityId: this.communityId, | ||
| 41 | + state: this.state | ||
| 42 | + } | ||
| 43 | + const { data } = await listMachineType(params) | ||
| 44 | + this.treeData = this.buildTree(data) | ||
| 45 | + } catch (error) { | ||
| 46 | + console.error('加载设备类型树失败:', error) | ||
| 47 | + } | ||
| 48 | + }, | ||
| 49 | + buildTree(data) { | ||
| 50 | + const result = [] | ||
| 51 | + const map = {} | ||
| 52 | + | ||
| 53 | + if (!Array.isArray(data)) { | ||
| 54 | + return result | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + data.forEach(item => { | ||
| 58 | + map[item.typeId] = { | ||
| 59 | + id: item.typeId, | ||
| 60 | + typeId: item.typeId, | ||
| 61 | + parentTypeId: item.parentTypeId, | ||
| 62 | + text: item.machineTypeName, | ||
| 63 | + children: [] | ||
| 64 | + } | ||
| 65 | + }) | ||
| 66 | + | ||
| 67 | + data.forEach(item => { | ||
| 68 | + const parent = map[item.parentTypeId] | ||
| 69 | + if (parent) { | ||
| 70 | + parent.children.push(map[item.typeId]) | ||
| 71 | + } else { | ||
| 72 | + result.push(map[item.typeId]) | ||
| 73 | + } | ||
| 74 | + }) | ||
| 75 | + | ||
| 76 | + return result | ||
| 77 | + }, | ||
| 78 | + handleNodeClick(data) { | ||
| 79 | + this.$emit('switchType', { | ||
| 80 | + typeId: data.typeId, | ||
| 81 | + typeName: data.text | ||
| 82 | + }) | ||
| 83 | + }, | ||
| 84 | + refreshTree() { | ||
| 85 | + this.loadMachineTypesTree() | ||
| 86 | + } | ||
| 87 | + } | ||
| 88 | +} | ||
| 89 | +</script> | ||
| 90 | + | ||
| 91 | +<style lang="scss" scoped> | ||
| 92 | +.tree-container { | ||
| 93 | + height: 100%; | ||
| 94 | + | ||
| 95 | + .el-tree { | ||
| 96 | + height: 100%; | ||
| 97 | + overflow: auto; | ||
| 98 | + } | ||
| 99 | +} | ||
| 100 | +</style> | ||
| 0 | \ No newline at end of file | 101 | \ No newline at end of file |
src/i18n/index.js
| @@ -197,7 +197,8 @@ import { messages as assetInventoryManageMessages } from '../views/resource/asse | @@ -197,7 +197,8 @@ import { messages as assetInventoryManageMessages } from '../views/resource/asse | ||
| 197 | import { messages as myResourceStoreManageMessages } from '../views/resource/myResourceStoreManageLang' | 197 | import { messages as myResourceStoreManageMessages } from '../views/resource/myResourceStoreManageLang' |
| 198 | import { messages as allocationUserStorehouseManageMessages } from '../views/resource/allocationUserStorehouseManageLang' | 198 | import { messages as allocationUserStorehouseManageMessages } from '../views/resource/allocationUserStorehouseManageLang' |
| 199 | import { messages as resourceStoreUseRecordManageMessages } from '../views/resource/resourceStoreUseRecordManageLang' | 199 | import { messages as resourceStoreUseRecordManageMessages } from '../views/resource/resourceStoreUseRecordManageLang' |
| 200 | - | 200 | +import { messages as locationManageMessages } from '../views/community/locationManageLang' |
| 201 | +import { messages as machineTypeTreeManageMessages } from '../views/machine/machineTypeTreeManageLang' | ||
| 201 | Vue.use(VueI18n) | 202 | Vue.use(VueI18n) |
| 202 | 203 | ||
| 203 | // 合并所有语言配置 | 204 | // 合并所有语言配置 |
| @@ -398,6 +399,8 @@ const messages = { | @@ -398,6 +399,8 @@ const messages = { | ||
| 398 | ...myResourceStoreManageMessages.en, | 399 | ...myResourceStoreManageMessages.en, |
| 399 | ...allocationUserStorehouseManageMessages.en, | 400 | ...allocationUserStorehouseManageMessages.en, |
| 400 | ...resourceStoreUseRecordManageMessages.en, | 401 | ...resourceStoreUseRecordManageMessages.en, |
| 402 | + ...locationManageMessages.en, | ||
| 403 | + ...machineTypeTreeManageMessages.en, | ||
| 401 | }, | 404 | }, |
| 402 | zh: { | 405 | zh: { |
| 403 | ...loginMessages.zh, | 406 | ...loginMessages.zh, |
| @@ -595,6 +598,8 @@ const messages = { | @@ -595,6 +598,8 @@ const messages = { | ||
| 595 | ...myResourceStoreManageMessages.zh, | 598 | ...myResourceStoreManageMessages.zh, |
| 596 | ...allocationUserStorehouseManageMessages.zh, | 599 | ...allocationUserStorehouseManageMessages.zh, |
| 597 | ...resourceStoreUseRecordManageMessages.zh, | 600 | ...resourceStoreUseRecordManageMessages.zh, |
| 601 | + ...locationManageMessages.zh, | ||
| 602 | + ...machineTypeTreeManageMessages.zh, | ||
| 598 | } | 603 | } |
| 599 | } | 604 | } |
| 600 | 605 |
src/router/index.js
| @@ -976,6 +976,16 @@ const routes = [ | @@ -976,6 +976,16 @@ const routes = [ | ||
| 976 | name: '/pages/common/resourceStoreUseRecordManage', | 976 | name: '/pages/common/resourceStoreUseRecordManage', |
| 977 | component: () => import('@/views/resource/resourceStoreUseRecordManageList.vue') | 977 | component: () => import('@/views/resource/resourceStoreUseRecordManageList.vue') |
| 978 | }, | 978 | }, |
| 979 | + { | ||
| 980 | + path:'/pages/property/locationManage', | ||
| 981 | + name:'/pages/property/locationManage', | ||
| 982 | + component: () => import('@/views/community/locationManageList.vue') | ||
| 983 | + }, | ||
| 984 | + { | ||
| 985 | + path:'/pages/property/machineTypeTreeManage', | ||
| 986 | + name:'/pages/property/machineTypeTreeManage', | ||
| 987 | + component: () => import('@/views/machine/machineTypeTreeManageList.vue') | ||
| 988 | + }, | ||
| 979 | // 其他子路由可以在这里添加 | 989 | // 其他子路由可以在这里添加 |
| 980 | ] | 990 | ] |
| 981 | }, | 991 | }, |
src/views/community/locationManageLang.js
0 → 100644
| 1 | +export const messages = { | ||
| 2 | + en: { | ||
| 3 | + locationManage: { | ||
| 4 | + queryCondition: 'Query Conditions', | ||
| 5 | + deviceLocation: 'Device Location', | ||
| 6 | + enterLocationCode: 'Enter location code', | ||
| 7 | + enterLocationName: 'Enter location name', | ||
| 8 | + selectLocationType: 'Select location type', | ||
| 9 | + locationCode: 'Location Code', | ||
| 10 | + locationName: 'Location Name', | ||
| 11 | + locationType: 'Location Type', | ||
| 12 | + locationObject: 'Location Object', | ||
| 13 | + operation: 'Operation', | ||
| 14 | + add: 'Add', | ||
| 15 | + edit: 'Edit', | ||
| 16 | + delete: 'Delete', | ||
| 17 | + confirmOperation: 'Please confirm your operation', | ||
| 18 | + confirmDeleteLocation: 'Confirm to delete this location?', | ||
| 19 | + selectBuilding: 'Select building', | ||
| 20 | + selectUnit: 'Select unit', | ||
| 21 | + selectRoom: 'Select room', | ||
| 22 | + selectGuardBox: 'Select guard box', | ||
| 23 | + selectParkingArea: 'Select parking area', | ||
| 24 | + selectCompany: 'Select company', | ||
| 25 | + selectDepartment: 'Select department', | ||
| 26 | + selectOrg: 'Select organization', | ||
| 27 | + selectOrgRequired: 'Please select related organization', | ||
| 28 | + selectOrgFirst: 'Please select an organization first', | ||
| 29 | + belongBuilding: 'Belong Building', | ||
| 30 | + belongUnit: 'Belong Unit', | ||
| 31 | + belongGuardBox: 'Belong Guard Box', | ||
| 32 | + belongDepartment: 'Belong Department', | ||
| 33 | + modifyBuilding: 'Modify Building', | ||
| 34 | + modifyUnit: 'Modify Unit', | ||
| 35 | + modifyGuardBox: 'Modify Guard Box', | ||
| 36 | + modifyParkingLot: 'Modify Parking Lot', | ||
| 37 | + community: 'Community', | ||
| 38 | + building: 'Building', | ||
| 39 | + unit: 'Unit', | ||
| 40 | + room: 'Room', | ||
| 41 | + guardBox: 'Guard Box', | ||
| 42 | + department: 'Department', | ||
| 43 | + parkingLot: 'Parking Lot', | ||
| 44 | + buildingUnit: 'Building', | ||
| 45 | + noOwner: 'No Owner', | ||
| 46 | + locationNameRequired: 'Location name is required', | ||
| 47 | + locationNameMaxLength: 'Location name cannot exceed 100 characters', | ||
| 48 | + locationTypeRequired: 'Location type is required', | ||
| 49 | + fetchError: 'Failed to fetch location data' | ||
| 50 | + } | ||
| 51 | + }, | ||
| 52 | + zh: { | ||
| 53 | + locationManage: { | ||
| 54 | + queryCondition: '查询条件', | ||
| 55 | + deviceLocation: '设备位置', | ||
| 56 | + enterLocationCode: '请输入位置编码', | ||
| 57 | + enterLocationName: '请输入位置名称', | ||
| 58 | + selectLocationType: '请选择位置类型', | ||
| 59 | + locationCode: '位置编码', | ||
| 60 | + locationName: '位置名称', | ||
| 61 | + locationType: '位置类型', | ||
| 62 | + locationObject: '位置对象', | ||
| 63 | + operation: '操作', | ||
| 64 | + add: '添加', | ||
| 65 | + edit: '修改', | ||
| 66 | + delete: '删除', | ||
| 67 | + confirmOperation: '请确认您的操作', | ||
| 68 | + confirmDeleteLocation: '确定删除该位置管理?', | ||
| 69 | + selectBuilding: '请选择楼栋', | ||
| 70 | + selectUnit: '请选择单元', | ||
| 71 | + selectRoom: '请选择房屋', | ||
| 72 | + selectGuardBox: '请选择岗亭', | ||
| 73 | + selectParkingArea: '请选择停车场', | ||
| 74 | + selectCompany: '请选择公司', | ||
| 75 | + selectDepartment: '选择部门', | ||
| 76 | + selectOrg: '选择组织', | ||
| 77 | + selectOrgRequired: '必填,请填写关联组织', | ||
| 78 | + selectOrgFirst: '请先选择组织', | ||
| 79 | + belongBuilding: '归属楼栋', | ||
| 80 | + belongUnit: '归属单元', | ||
| 81 | + belongGuardBox: '归属岗亭', | ||
| 82 | + belongDepartment: '归属部门', | ||
| 83 | + modifyBuilding: '修改楼栋', | ||
| 84 | + modifyUnit: '修改单元', | ||
| 85 | + modifyGuardBox: '修改岗亭', | ||
| 86 | + modifyParkingLot: '修改停车场', | ||
| 87 | + community: '小区', | ||
| 88 | + building: '楼栋', | ||
| 89 | + unit: '单元', | ||
| 90 | + room: '房屋', | ||
| 91 | + guardBox: '岗亭', | ||
| 92 | + department: '部门', | ||
| 93 | + parkingLot: '停车场', | ||
| 94 | + buildingUnit: '号楼', | ||
| 95 | + noOwner: '无业主', | ||
| 96 | + locationNameRequired: '位置名称不能为空', | ||
| 97 | + locationNameMaxLength: '位置名称不能超过100位', | ||
| 98 | + locationTypeRequired: '位置类型不能为空', | ||
| 99 | + fetchError: '获取位置数据失败' | ||
| 100 | + } | ||
| 101 | + } | ||
| 102 | +} | ||
| 0 | \ No newline at end of file | 103 | \ No newline at end of file |
src/views/community/locationManageList.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div class="location-manage-container"> | ||
| 3 | + <el-row> | ||
| 4 | + <el-col :span="24"> | ||
| 5 | + <el-card class="box-card"> | ||
| 6 | + <div slot="header" class="flex justify-between"> | ||
| 7 | + <span>{{ $t('locationManage.queryCondition') }}</span> | ||
| 8 | + </div> | ||
| 9 | + <el-row :gutter="20"> | ||
| 10 | + <el-col :span="6"> | ||
| 11 | + <el-input v-model="locationManageInfo.conditions.locationId" | ||
| 12 | + :placeholder="$t('locationManage.enterLocationCode')" clearable /> | ||
| 13 | + </el-col> | ||
| 14 | + <el-col :span="8"> | ||
| 15 | + <el-input v-model="locationManageInfo.conditions.locationName" | ||
| 16 | + :placeholder="$t('locationManage.enterLocationName')" clearable /> | ||
| 17 | + </el-col> | ||
| 18 | + <el-col :span="6"> | ||
| 19 | + <el-select v-model="locationManageInfo.conditions.locationType" | ||
| 20 | + :placeholder="$t('locationManage.selectLocationType')" style="width:100%" clearable> | ||
| 21 | + <el-option v-for="item in locationTypeOptions" :key="item.value" :label="item.label" | ||
| 22 | + :value="item.value" /> | ||
| 23 | + </el-select> | ||
| 24 | + </el-col> | ||
| 25 | + <el-col :span="4"> | ||
| 26 | + <el-button type="primary" @click="_queryLocationMethod"> | ||
| 27 | + <i class="el-icon-search"></i> | ||
| 28 | + {{ $t('common.search') }} | ||
| 29 | + </el-button> | ||
| 30 | + <el-button @click="_resetLocationMethod"> | ||
| 31 | + <i class="el-icon-refresh"></i> | ||
| 32 | + {{ $t('common.reset') }} | ||
| 33 | + </el-button> | ||
| 34 | + </el-col> | ||
| 35 | + </el-row> | ||
| 36 | + </el-card> | ||
| 37 | + </el-col> | ||
| 38 | + </el-row> | ||
| 39 | + | ||
| 40 | + <el-row style="margin-top:20px"> | ||
| 41 | + <el-col :span="24"> | ||
| 42 | + <el-card class="box-card"> | ||
| 43 | + <div slot="header" class="flex justify-between"> | ||
| 44 | + <span>{{ $t('locationManage.deviceLocation') }}</span> | ||
| 45 | + <el-button type="primary" size="small" style="float:right" @click="_openAddLocationModal"> | ||
| 46 | + <i class="el-icon-plus"></i> | ||
| 47 | + {{ $t('common.add') }} | ||
| 48 | + </el-button> | ||
| 49 | + </div> | ||
| 50 | + <el-table :data="locationManageInfo.locations" border style="width:100%"> | ||
| 51 | + <el-table-column prop="locationId" :label="$t('locationManage.locationCode')" align="center" /> | ||
| 52 | + <el-table-column prop="locationName" :label="$t('locationManage.locationName')" align="center" /> | ||
| 53 | + <el-table-column prop="locationTypeName" :label="$t('locationManage.locationType')" align="center" /> | ||
| 54 | + <el-table-column prop="locationObjName" :label="$t('locationManage.locationObject')" align="center" /> | ||
| 55 | + <el-table-column :label="$t('common.operation')" align="center" width="200"> | ||
| 56 | + <template slot-scope="scope"> | ||
| 57 | + <el-button size="mini" type="primary" @click="_openEditLocationModel(scope.row)"> | ||
| 58 | + {{ $t('common.edit') }} | ||
| 59 | + </el-button> | ||
| 60 | + <el-button size="mini" type="danger" @click="_openDeleteLocationModel(scope.row)"> | ||
| 61 | + {{ $t('common.delete') }} | ||
| 62 | + </el-button> | ||
| 63 | + </template> | ||
| 64 | + </el-table-column> | ||
| 65 | + </el-table> | ||
| 66 | + <el-pagination :current-page.sync="page.current" :page-sizes="[10, 20, 30, 50]" :page-size="page.size" | ||
| 67 | + :total="page.total" layout="total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange" | ||
| 68 | + @current-change="handleCurrentChange" /> | ||
| 69 | + </el-card> | ||
| 70 | + </el-col> | ||
| 71 | + </el-row> | ||
| 72 | + | ||
| 73 | + <add-location ref="addLocation" @success="handleSuccess" /> | ||
| 74 | + <edit-location ref="editLocation" @success="handleSuccess" /> | ||
| 75 | + <delete-location ref="deleteLocation" @success="handleSuccess" /> | ||
| 76 | + </div> | ||
| 77 | +</template> | ||
| 78 | + | ||
| 79 | +<script> | ||
| 80 | +import { getCommunityId } from '@/api/community/communityApi' | ||
| 81 | +import { listCommunityLocations } from '@/api/community/locationManageApi' | ||
| 82 | +import AddLocation from '@/components/community/AddLocation' | ||
| 83 | +import EditLocation from '@/components/community/EditLocation' | ||
| 84 | +import DeleteLocation from '@/components/community/DeleteLocation' | ||
| 85 | + | ||
| 86 | +export default { | ||
| 87 | + name: 'LocationManageList', | ||
| 88 | + components: { | ||
| 89 | + AddLocation, | ||
| 90 | + EditLocation, | ||
| 91 | + DeleteLocation | ||
| 92 | + }, | ||
| 93 | + data() { | ||
| 94 | + return { | ||
| 95 | + locationManageInfo: { | ||
| 96 | + locations: [], | ||
| 97 | + conditions: { | ||
| 98 | + locationId: '', | ||
| 99 | + locationName: '', | ||
| 100 | + locationType: '', | ||
| 101 | + communityId: '' | ||
| 102 | + } | ||
| 103 | + }, | ||
| 104 | + locationTypeOptions: [ | ||
| 105 | + { value: '1000', label: this.$t('locationManage.community') }, | ||
| 106 | + { value: '6000', label: this.$t('locationManage.building') }, | ||
| 107 | + { value: '2000', label: this.$t('locationManage.unit') }, | ||
| 108 | + { value: '3000', label: this.$t('locationManage.room') }, | ||
| 109 | + { value: '4000', label: this.$t('locationManage.guardBox') }, | ||
| 110 | + { value: '5000', label: this.$t('locationManage.department') } | ||
| 111 | + ], | ||
| 112 | + page: { | ||
| 113 | + current: 1, | ||
| 114 | + size: 10, | ||
| 115 | + total: 0 | ||
| 116 | + } | ||
| 117 | + } | ||
| 118 | + }, | ||
| 119 | + created() { | ||
| 120 | + this._listLocations(this.page.current, this.page.size) | ||
| 121 | + }, | ||
| 122 | + methods: { | ||
| 123 | + async _listLocations(page, size) { | ||
| 124 | + try { | ||
| 125 | + this.locationManageInfo.conditions.communityId = getCommunityId() | ||
| 126 | + const params = { | ||
| 127 | + page: page, | ||
| 128 | + row: size, | ||
| 129 | + ...this.locationManageInfo.conditions | ||
| 130 | + } | ||
| 131 | + const { data, total } = await listCommunityLocations(params) | ||
| 132 | + this.locationManageInfo.locations = data | ||
| 133 | + this.page.total = total | ||
| 134 | + } catch (error) { | ||
| 135 | + this.$message.error(this.$t('locationManage.fetchError')) | ||
| 136 | + } | ||
| 137 | + }, | ||
| 138 | + _openAddLocationModal() { | ||
| 139 | + this.$refs.addLocation.open() | ||
| 140 | + }, | ||
| 141 | + _openEditLocationModel(row) { | ||
| 142 | + this.$refs.editLocation.open(row) | ||
| 143 | + }, | ||
| 144 | + _openDeleteLocationModel(row) { | ||
| 145 | + this.$refs.deleteLocation.open(row) | ||
| 146 | + }, | ||
| 147 | + _queryLocationMethod() { | ||
| 148 | + this.page.current = 1 | ||
| 149 | + this._listLocations(this.page.current, this.page.size) | ||
| 150 | + }, | ||
| 151 | + _resetLocationMethod() { | ||
| 152 | + this.locationManageInfo.conditions = { | ||
| 153 | + locationId: '', | ||
| 154 | + locationName: '', | ||
| 155 | + locationType: '', | ||
| 156 | + communityId: getCommunityId() | ||
| 157 | + } | ||
| 158 | + this._listLocations(this.page.current, this.page.size) | ||
| 159 | + }, | ||
| 160 | + handleSuccess() { | ||
| 161 | + this._listLocations(this.page.current, this.page.size) | ||
| 162 | + }, | ||
| 163 | + handleSizeChange(val) { | ||
| 164 | + this.page.size = val | ||
| 165 | + this._listLocations(this.page.current, this.page.size) | ||
| 166 | + }, | ||
| 167 | + handleCurrentChange(val) { | ||
| 168 | + this.page.current = val | ||
| 169 | + this._listLocations(this.page.current, this.page.size) | ||
| 170 | + } | ||
| 171 | + } | ||
| 172 | +} | ||
| 173 | +</script> | ||
| 174 | + | ||
| 175 | +<style lang="scss" scoped> | ||
| 176 | +.location-manage-container { | ||
| 177 | + padding: 20px; | ||
| 178 | + | ||
| 179 | + .box-card { | ||
| 180 | + margin-bottom: 20px; | ||
| 181 | + } | ||
| 182 | + | ||
| 183 | + .el-pagination { | ||
| 184 | + margin-top: 20px; | ||
| 185 | + text-align: right; | ||
| 186 | + } | ||
| 187 | +} | ||
| 188 | +</style> | ||
| 0 | \ No newline at end of file | 189 | \ No newline at end of file |
src/views/machine/machineTypeTreeManageLang.js
0 → 100644
| 1 | +export const messages = { | ||
| 2 | + en: { | ||
| 3 | + machineTypeTree: { | ||
| 4 | + addParent: 'Add Parent Category', | ||
| 5 | + addChild: 'Add Child Category', | ||
| 6 | + edit: 'Edit', | ||
| 7 | + delete: 'Delete', | ||
| 8 | + detail: 'Details', | ||
| 9 | + machineTypeName: 'Equipment Type Name', | ||
| 10 | + machineTypeCode: 'Category Code', | ||
| 11 | + status: 'Status', | ||
| 12 | + enable: 'Enable', | ||
| 13 | + disable: 'Disable', | ||
| 14 | + importanceLevel: 'Importance Level', | ||
| 15 | + seq: 'Sort Value', | ||
| 16 | + unit: 'Unit', | ||
| 17 | + warrantyDeadline: 'Warranty Deadline', | ||
| 18 | + remark: 'Remark', | ||
| 19 | + requiredPlaceholder: 'Required, please enter {field}', | ||
| 20 | + optionalPlaceholder: 'Optional, please enter {field}', | ||
| 21 | + requiredMessage: '{field} is required', | ||
| 22 | + maxLengthMessage: 'Cannot exceed {length} characters', | ||
| 23 | + selectTypeFirst: 'Please select equipment category first', | ||
| 24 | + confirmOperation: 'Please confirm your operation', | ||
| 25 | + confirmDelete: 'Confirm to delete equipment type?', | ||
| 26 | + cancelDelete: 'Cancel', | ||
| 27 | + confirmDeleteBtn: 'Confirm Delete' | ||
| 28 | + } | ||
| 29 | + }, | ||
| 30 | + zh: { | ||
| 31 | + machineTypeTree: { | ||
| 32 | + addParent: '添加一级分类', | ||
| 33 | + addChild: '添加子级分类', | ||
| 34 | + edit: '修改', | ||
| 35 | + delete: '删除', | ||
| 36 | + detail: '详情', | ||
| 37 | + machineTypeName: '设备类型名称', | ||
| 38 | + machineTypeCode: '分类编码', | ||
| 39 | + status: '启用状态', | ||
| 40 | + enable: '启用', | ||
| 41 | + disable: '停用', | ||
| 42 | + importanceLevel: '重要等级', | ||
| 43 | + seq: '排序值', | ||
| 44 | + unit: '单位', | ||
| 45 | + warrantyDeadline: '保修截止日期', | ||
| 46 | + remark: '备注', | ||
| 47 | + requiredPlaceholder: '必填,请填写{field}', | ||
| 48 | + optionalPlaceholder: '选填,请填写{field}', | ||
| 49 | + requiredMessage: '{field}不能为空', | ||
| 50 | + maxLengthMessage: '{field}不能超过{length}个字符', | ||
| 51 | + selectTypeFirst: '请先选择设备分类', | ||
| 52 | + confirmOperation: '请确认您的操作', | ||
| 53 | + confirmDelete: '确定删除设备类型?', | ||
| 54 | + cancelDelete: '点错了', | ||
| 55 | + confirmDeleteBtn: '确认删除' | ||
| 56 | + } | ||
| 57 | + } | ||
| 58 | +} | ||
| 0 | \ No newline at end of file | 59 | \ No newline at end of file |
src/views/machine/machineTypeTreeManageList.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div class="machine-type-tree-manage-container"> | ||
| 3 | + <div class="box-card"> | ||
| 4 | + | ||
| 5 | + <el-row :gutter="20"> | ||
| 6 | + <el-col :span="4" style="padding-right:0"> | ||
| 7 | + <div class=""> | ||
| 8 | + <el-button-group> | ||
| 9 | + <el-button type="primary" size="small" @click="openAddParentMachineTypeModal"> | ||
| 10 | + <i class="el-icon-plus"></i>{{ $t('machineTypeTree.addParent') }} | ||
| 11 | + </el-button> | ||
| 12 | + <el-button type="primary" size="small" @click="openAddMachineTypeModal"> | ||
| 13 | + <i class="el-icon-plus"></i>{{ $t('machineTypeTree.addChild') }} | ||
| 14 | + </el-button> | ||
| 15 | + <el-button type="primary" size="small" @click="openEditMachineTypeModel"> | ||
| 16 | + <i class="el-icon-edit"></i>{{ $t('machineTypeTree.edit') }} | ||
| 17 | + </el-button> | ||
| 18 | + <el-button type="primary" size="small" @click="openDeleteMachineTypeModel"> | ||
| 19 | + <i class="el-icon-delete"></i>{{ $t('machineTypeTree.delete') }} | ||
| 20 | + </el-button> | ||
| 21 | + </el-button-group> | ||
| 22 | + </div> | ||
| 23 | + <div> | ||
| 24 | + <machine-type-tree ref="machineTypeTree" @switchType="handleSwitchType"></machine-type-tree> | ||
| 25 | + </div> | ||
| 26 | + </el-col> | ||
| 27 | + <el-col :span="20"> | ||
| 28 | + <el-card class="box-card"> | ||
| 29 | + <div slot="header" class="clearfix"> | ||
| 30 | + <h3>{{ $t('machineTypeTree.detail') }}</h3> | ||
| 31 | + </div> | ||
| 32 | + <div class="detail-content"> | ||
| 33 | + <el-form label-width="120px"> | ||
| 34 | + <el-form-item :label="$t('machineTypeTree.machineTypeName')"> | ||
| 35 | + <span>{{ machineTypeInfo.machineTypeName }}</span> | ||
| 36 | + </el-form-item> | ||
| 37 | + <el-form-item :label="$t('machineTypeTree.machineTypeCode')"> | ||
| 38 | + <span>{{ machineTypeInfo.machineTypeCode }}</span> | ||
| 39 | + </el-form-item> | ||
| 40 | + <el-form-item :label="$t('machineTypeTree.status')"> | ||
| 41 | + <el-radio-group v-model="machineTypeInfo.isEnable" disabled> | ||
| 42 | + <el-radio :label="'1000'">{{ $t('machineTypeTree.enable') }}</el-radio> | ||
| 43 | + <el-radio :label="'2000'">{{ $t('machineTypeTree.disable') }}</el-radio> | ||
| 44 | + </el-radio-group> | ||
| 45 | + </el-form-item> | ||
| 46 | + <el-form-item :label="$t('machineTypeTree.importanceLevel')"> | ||
| 47 | + <template v-for="(item, index) in importanceLevels"> | ||
| 48 | + <span v-if="machineTypeInfo.importanceLevel == item.statusCd" :key="index"> | ||
| 49 | + {{ item.name }} | ||
| 50 | + </span> | ||
| 51 | + </template> | ||
| 52 | + </el-form-item> | ||
| 53 | + <el-form-item :label="$t('machineTypeTree.seq')"> | ||
| 54 | + <span>{{ machineTypeInfo.seq }}</span> | ||
| 55 | + </el-form-item> | ||
| 56 | + <el-form-item :label="$t('machineTypeTree.unit')"> | ||
| 57 | + <span>{{ machineTypeInfo.unit }}</span> | ||
| 58 | + </el-form-item> | ||
| 59 | + <el-form-item :label="$t('machineTypeTree.warrantyDeadline')"> | ||
| 60 | + <span>{{ machineTypeInfo.warrantyDeadline }}</span> | ||
| 61 | + </el-form-item> | ||
| 62 | + <el-form-item :label="$t('machineTypeTree.remark')"> | ||
| 63 | + <span>{{ machineTypeInfo.remark }}</span> | ||
| 64 | + </el-form-item> | ||
| 65 | + </el-form> | ||
| 66 | + </div> | ||
| 67 | + </el-card> | ||
| 68 | + </el-col> | ||
| 69 | + </el-row> | ||
| 70 | + </div> | ||
| 71 | + | ||
| 72 | + <add-machine-type ref="addMachineType" @success="handleSuccess"></add-machine-type> | ||
| 73 | + <edit-machine-type ref="editMachineType" @success="handleSuccess"></edit-machine-type> | ||
| 74 | + <delete-machine-type ref="deleteMachineType" @success="handleSuccess"></delete-machine-type> | ||
| 75 | + </div> | ||
| 76 | +</template> | ||
| 77 | + | ||
| 78 | +<script> | ||
| 79 | +import { getDict } from '@/api/community/communityApi' | ||
| 80 | +import { getCommunityId } from '@/api/community/communityApi' | ||
| 81 | +import MachineTypeTree from '@/components/machine/machineTypeTree' | ||
| 82 | +import AddMachineType from '@/components/machine/addMachineType' | ||
| 83 | +import EditMachineType from '@/components/machine/editMachineType' | ||
| 84 | +import DeleteMachineType from '@/components/machine/deleteMachineType' | ||
| 85 | + | ||
| 86 | +export default { | ||
| 87 | + name: 'MachineTypeTreeManageList', | ||
| 88 | + components: { | ||
| 89 | + MachineTypeTree, | ||
| 90 | + AddMachineType, | ||
| 91 | + EditMachineType, | ||
| 92 | + DeleteMachineType | ||
| 93 | + }, | ||
| 94 | + data() { | ||
| 95 | + return { | ||
| 96 | + machineTypeInfo: {}, | ||
| 97 | + importanceLevels: [], | ||
| 98 | + currentTypeId: '', | ||
| 99 | + communityId: '' | ||
| 100 | + } | ||
| 101 | + }, | ||
| 102 | + created() { | ||
| 103 | + this.communityId = getCommunityId() | ||
| 104 | + this.getDictData() | ||
| 105 | + }, | ||
| 106 | + methods: { | ||
| 107 | + async getDictData() { | ||
| 108 | + try { | ||
| 109 | + const data = await getDict('machine_type', 'importance_level') | ||
| 110 | + this.importanceLevels = data | ||
| 111 | + } catch (error) { | ||
| 112 | + console.error('获取字典数据失败:', error) | ||
| 113 | + } | ||
| 114 | + }, | ||
| 115 | + handleSwitchType(data) { | ||
| 116 | + this.currentTypeId = data.typeId | ||
| 117 | + this.machineTypeInfo = { | ||
| 118 | + ...this.machineTypeInfo, | ||
| 119 | + ...data | ||
| 120 | + } | ||
| 121 | + }, | ||
| 122 | + openAddParentMachineTypeModal() { | ||
| 123 | + this.$refs.addMachineType.open({}) | ||
| 124 | + }, | ||
| 125 | + openAddMachineTypeModal() { | ||
| 126 | + if (!this.currentTypeId) { | ||
| 127 | + this.$message.warning(this.$t('machineTypeTree.selectTypeFirst')) | ||
| 128 | + return | ||
| 129 | + } | ||
| 130 | + this.$refs.addMachineType.open({ typeId: this.currentTypeId }) | ||
| 131 | + }, | ||
| 132 | + openEditMachineTypeModel() { | ||
| 133 | + if (!this.currentTypeId) { | ||
| 134 | + this.$message.warning(this.$t('machineTypeTree.selectTypeFirst')) | ||
| 135 | + return | ||
| 136 | + } | ||
| 137 | + this.$refs.editMachineType.open(this.machineTypeInfo) | ||
| 138 | + }, | ||
| 139 | + openDeleteMachineTypeModel() { | ||
| 140 | + if (!this.currentTypeId) { | ||
| 141 | + this.$message.warning(this.$t('machineTypeTree.selectTypeFirst')) | ||
| 142 | + return | ||
| 143 | + } | ||
| 144 | + this.$refs.deleteMachineType.open(this.machineTypeInfo) | ||
| 145 | + }, | ||
| 146 | + handleSuccess() { | ||
| 147 | + this.$refs.machineTypeTree.refreshTree() | ||
| 148 | + } | ||
| 149 | + } | ||
| 150 | +} | ||
| 151 | +</script> | ||
| 152 | + | ||
| 153 | +<style lang="scss" scoped> | ||
| 154 | +.machine-type-tree-manage-container { | ||
| 155 | + padding: 20px; | ||
| 156 | + | ||
| 157 | + .box-card { | ||
| 158 | + margin-bottom: 20px; | ||
| 159 | + } | ||
| 160 | + | ||
| 161 | + .detail-content { | ||
| 162 | + padding: 20px; | ||
| 163 | + | ||
| 164 | + span { | ||
| 165 | + line-height: 40px; | ||
| 166 | + } | ||
| 167 | + } | ||
| 168 | + | ||
| 169 | + .el-row { | ||
| 170 | + width: 100%; | ||
| 171 | + } | ||
| 172 | + | ||
| 173 | +} | ||
| 174 | +</style> | ||
| 0 | \ No newline at end of file | 175 | \ No newline at end of file |