Commit 439c1b5638a609710f4c3354610dcac67e4ac928
1 parent
21e37d17
开发完成设备台账功能
Showing
26 changed files
with
2772 additions
and
71 deletions
src/api/machine/addEquipmentAccountApi.js
0 → 100644
| 1 | +import request from '@/utils/request' | ||
| 2 | + | ||
| 3 | +// 保存设备账户信息 | ||
| 4 | +export function saveEquipmentAccount(data) { | ||
| 5 | + return new Promise((resolve, reject) => { | ||
| 6 | + request({ | ||
| 7 | + url: '/equipmentAccount.saveEquipmentAccount', | ||
| 8 | + method: 'post', | ||
| 9 | + data | ||
| 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 getEquipmentDict(dictType, dictName) { | ||
| 21 | + return new Promise((resolve, reject) => { | ||
| 22 | + request({ | ||
| 23 | + url: '/dict.getDict', | ||
| 24 | + method: 'get', | ||
| 25 | + params: { | ||
| 26 | + dictType, | ||
| 27 | + dictName | ||
| 28 | + } | ||
| 29 | + }).then(response => { | ||
| 30 | + const res = response.data | ||
| 31 | + resolve(res) | ||
| 32 | + }).catch(error => { | ||
| 33 | + reject(error) | ||
| 34 | + }) | ||
| 35 | + }) | ||
| 36 | +} | ||
| 0 | \ No newline at end of file | 37 | \ No newline at end of file |
src/api/machine/editEquipmentAccountApi.js
0 → 100644
| 1 | +import request from '@/utils/request' | ||
| 2 | + | ||
| 3 | +// 更新设备信息 | ||
| 4 | +export function updateEquipmentAccount(data) { | ||
| 5 | + return new Promise((resolve, reject) => { | ||
| 6 | + request({ | ||
| 7 | + url: '/equipmentAccount.updateEquipmentAccount', | ||
| 8 | + method: 'post', | ||
| 9 | + data | ||
| 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 listEquipmentAccount(params) { | ||
| 21 | + return new Promise((resolve, reject) => { | ||
| 22 | + request({ | ||
| 23 | + url: '/equipmentAccount.listEquipmentAccount', | ||
| 24 | + method: 'get', | ||
| 25 | + params | ||
| 26 | + }).then(response => { | ||
| 27 | + const res = response.data | ||
| 28 | + resolve(res) | ||
| 29 | + }).catch(error => { | ||
| 30 | + reject(error) | ||
| 31 | + }) | ||
| 32 | + }) | ||
| 33 | +} | ||
| 0 | \ No newline at end of file | 34 | \ No newline at end of file |
src/api/machine/equipmentAccountApi.js
0 → 100644
| 1 | +import request from '@/utils/request' | ||
| 2 | + | ||
| 3 | +// 获取设备台账列表 | ||
| 4 | +export function listEquipmentAccount(params) { | ||
| 5 | + return new Promise((resolve, reject) => { | ||
| 6 | + request({ | ||
| 7 | + url: '/equipmentAccount.listEquipmentAccount', | ||
| 8 | + method: 'get', | ||
| 9 | + params | ||
| 10 | + }).then(response => { | ||
| 11 | + const res = response.data | ||
| 12 | + resolve({ | ||
| 13 | + data: res.data, | ||
| 14 | + total: res.total, | ||
| 15 | + records: res.records | ||
| 16 | + }) | ||
| 17 | + }).catch(error => { | ||
| 18 | + reject(error) | ||
| 19 | + }) | ||
| 20 | + }) | ||
| 21 | +} | ||
| 22 | + | ||
| 23 | +// 获取设备类型列表 | ||
| 24 | +export function listMachineType(params) { | ||
| 25 | + return new Promise((resolve, reject) => { | ||
| 26 | + request({ | ||
| 27 | + url: '/machineType.listMachineType', | ||
| 28 | + method: 'get', | ||
| 29 | + params | ||
| 30 | + }).then(response => { | ||
| 31 | + const res = response.data | ||
| 32 | + resolve(res.data) | ||
| 33 | + }).catch(error => { | ||
| 34 | + reject(error) | ||
| 35 | + }) | ||
| 36 | + }) | ||
| 37 | +} | ||
| 38 | + | ||
| 39 | +// 获取组织树 | ||
| 40 | +export function listOrgTree(params) { | ||
| 41 | + return new Promise((resolve, reject) => { | ||
| 42 | + request({ | ||
| 43 | + url: '/org.listOrgTree', | ||
| 44 | + method: 'get', | ||
| 45 | + params | ||
| 46 | + }).then(response => { | ||
| 47 | + const res = response.data | ||
| 48 | + resolve(res.data) | ||
| 49 | + }).catch(error => { | ||
| 50 | + reject(error) | ||
| 51 | + }) | ||
| 52 | + }) | ||
| 53 | +} | ||
| 54 | + | ||
| 55 | +// 查询员工信息 | ||
| 56 | +export function queryStaffInfos(params) { | ||
| 57 | + return new Promise((resolve, reject) => { | ||
| 58 | + request({ | ||
| 59 | + url: '/query.staff.infos', | ||
| 60 | + method: 'get', | ||
| 61 | + params | ||
| 62 | + }).then(response => { | ||
| 63 | + const res = response.data | ||
| 64 | + resolve({ | ||
| 65 | + staffs: res.staffs | ||
| 66 | + }) | ||
| 67 | + }).catch(error => { | ||
| 68 | + reject(error) | ||
| 69 | + }) | ||
| 70 | + }) | ||
| 71 | +} | ||
| 72 | + | ||
| 73 | +// 修改设备状态 | ||
| 74 | +export function changeStateEquipment(data) { | ||
| 75 | + return new Promise((resolve, reject) => { | ||
| 76 | + request({ | ||
| 77 | + url: '/equipmentAccount.changeStateEquipment', | ||
| 78 | + method: 'post', | ||
| 79 | + data | ||
| 80 | + }).then(response => { | ||
| 81 | + const res = response.data | ||
| 82 | + resolve(res) | ||
| 83 | + }).catch(error => { | ||
| 84 | + reject(error) | ||
| 85 | + }) | ||
| 86 | + }) | ||
| 87 | +} | ||
| 88 | + | ||
| 89 | +// 移动设备 | ||
| 90 | +export function moveEquipment(data) { | ||
| 91 | + return new Promise((resolve, reject) => { | ||
| 92 | + request({ | ||
| 93 | + url: '/equipmentAccount.moveEquipment', | ||
| 94 | + method: 'post', | ||
| 95 | + data | ||
| 96 | + }).then(response => { | ||
| 97 | + const res = response.data | ||
| 98 | + resolve(res) | ||
| 99 | + }).catch(error => { | ||
| 100 | + reject(error) | ||
| 101 | + }) | ||
| 102 | + }) | ||
| 103 | +} | ||
| 104 | + | ||
| 105 | +// 删除设备台账 | ||
| 106 | +export function deleteEquipmentAccount(data) { | ||
| 107 | + return new Promise((resolve, reject) => { | ||
| 108 | + request({ | ||
| 109 | + url: '/equipmentAccount.deleteEquipmentAccount', | ||
| 110 | + method: 'post', | ||
| 111 | + data | ||
| 112 | + }).then(response => { | ||
| 113 | + const res = response.data | ||
| 114 | + resolve(res) | ||
| 115 | + }).catch(error => { | ||
| 116 | + reject(error) | ||
| 117 | + }) | ||
| 118 | + }) | ||
| 119 | +} | ||
| 120 | + | ||
| 121 | +// 获取设备详情 | ||
| 122 | +export function getEquipmentAccountDetail(params) { | ||
| 123 | + return new Promise((resolve, reject) => { | ||
| 124 | + request({ | ||
| 125 | + url: '/equipmentAccount.getEquipmentAccountDetail', | ||
| 126 | + method: 'get', | ||
| 127 | + params | ||
| 128 | + }).then(response => { | ||
| 129 | + const res = response.data | ||
| 130 | + resolve(res.data) | ||
| 131 | + }).catch(error => { | ||
| 132 | + reject(error) | ||
| 133 | + }) | ||
| 134 | + }) | ||
| 135 | +} | ||
| 136 | + | ||
| 137 | +// 导入设备数据 | ||
| 138 | +export function importEquipmentData(data) { | ||
| 139 | + return new Promise((resolve, reject) => { | ||
| 140 | + request({ | ||
| 141 | + url: '/importExportEquipment.importData', | ||
| 142 | + method: 'post', | ||
| 143 | + data, | ||
| 144 | + headers: { | ||
| 145 | + 'Content-Type': 'multipart/form-data' | ||
| 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 exportImportTemplate(params) { | ||
| 158 | + return new Promise((resolve, reject) => { | ||
| 159 | + request({ | ||
| 160 | + url: '/importExportEquipment.exportImportDataTemp', | ||
| 161 | + method: 'get', | ||
| 162 | + params, | ||
| 163 | + responseType: 'blob' | ||
| 164 | + }).then(response => { | ||
| 165 | + // 创建下载链接 | ||
| 166 | + const url = window.URL.createObjectURL(new Blob([response.data])) | ||
| 167 | + const link = document.createElement('a') | ||
| 168 | + link.href = url | ||
| 169 | + link.setAttribute('download', 'equipment_import_template.xlsx') | ||
| 170 | + document.body.appendChild(link) | ||
| 171 | + link.click() | ||
| 172 | + document.body.removeChild(link) | ||
| 173 | + resolve() | ||
| 174 | + }).catch(error => { | ||
| 175 | + reject(error) | ||
| 176 | + }) | ||
| 177 | + }) | ||
| 178 | +} | ||
| 179 | + | ||
| 180 | +// 导出设备数据 | ||
| 181 | +export function exportEquipmentData(params) { | ||
| 182 | + return new Promise((resolve, reject) => { | ||
| 183 | + request({ | ||
| 184 | + url: '/importExportEquipment.exportData', | ||
| 185 | + method: 'get', | ||
| 186 | + params, | ||
| 187 | + responseType: 'blob' | ||
| 188 | + }).then(response => { | ||
| 189 | + // 创建下载链接 | ||
| 190 | + const url = window.URL.createObjectURL(new Blob([response.data])) | ||
| 191 | + const link = document.createElement('a') | ||
| 192 | + link.href = url | ||
| 193 | + link.setAttribute('download', 'equipment_export_data.xlsx') | ||
| 194 | + document.body.appendChild(link) | ||
| 195 | + link.click() | ||
| 196 | + document.body.removeChild(link) | ||
| 197 | + resolve() | ||
| 198 | + }).catch(error => { | ||
| 199 | + reject(error) | ||
| 200 | + }) | ||
| 201 | + }) | ||
| 202 | +} | ||
| 0 | \ No newline at end of file | 203 | \ No newline at end of file |
src/api/machine/equipmentAccountDetailApi.js
0 → 100644
| 1 | +import request from '@/utils/request' | ||
| 2 | +import { getCommunityId } from '@/api/community/communityApi' | ||
| 3 | + | ||
| 4 | +// 获取设备详情 | ||
| 5 | +export function getEquipmentAccountDetail(params) { | ||
| 6 | + return new Promise((resolve, reject) => { | ||
| 7 | + request({ | ||
| 8 | + url: '/equipmentAccount.listEquipmentAccount', | ||
| 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 getEquipmentLogs(params) { | ||
| 25 | + return new Promise((resolve, reject) => { | ||
| 26 | + request({ | ||
| 27 | + url: '/equipmentOperatingLog.listEquipmentOperatingLog', | ||
| 28 | + method: 'get', | ||
| 29 | + params: { | ||
| 30 | + ...params, | ||
| 31 | + communityId: getCommunityId() | ||
| 32 | + } | ||
| 33 | + }).then(response => { | ||
| 34 | + const res = response.data | ||
| 35 | + resolve(res) | ||
| 36 | + }).catch(error => { | ||
| 37 | + reject(error) | ||
| 38 | + }) | ||
| 39 | + }) | ||
| 40 | +} | ||
| 0 | \ No newline at end of file | 41 | \ No newline at end of file |
src/api/resource/printEquipmentAccountLabelApi.js
0 → 100644
| 1 | +import request from '@/utils/request' | ||
| 2 | + | ||
| 3 | +// 获取设备账户标签列表 | ||
| 4 | +export function getEquipmentAccountList(params) { | ||
| 5 | + return new Promise((resolve, reject) => { | ||
| 6 | + request({ | ||
| 7 | + url: '/equipmentAccount.listEquipmentAccount', | ||
| 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 | +} | ||
| 0 | \ No newline at end of file | 18 | \ No newline at end of file |
src/components/machine/changeStateEquipment.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <el-dialog | ||
| 3 | + :title="$t('equipmentAccount.changeState')" | ||
| 4 | + :visible.sync="dialogVisible" | ||
| 5 | + width="50%" | ||
| 6 | + @close="handleClose"> | ||
| 7 | + <el-form ref="form" :model="formData" label-width="120px"> | ||
| 8 | + <el-form-item :label="$t('equipmentAccount.state')" prop="state" required> | ||
| 9 | + <el-select | ||
| 10 | + v-model="formData.state" | ||
| 11 | + :placeholder="$t('equipmentAccount.selectState')" | ||
| 12 | + style="width:100%"> | ||
| 13 | + <el-option | ||
| 14 | + v-for="item in useStatus" | ||
| 15 | + :key="item.statusCd" | ||
| 16 | + :label="item.name" | ||
| 17 | + :value="item.statusCd"> | ||
| 18 | + </el-option> | ||
| 19 | + </el-select> | ||
| 20 | + </el-form-item> | ||
| 21 | + </el-form> | ||
| 22 | + <span slot="footer" class="dialog-footer"> | ||
| 23 | + <el-button @click="dialogVisible = false">{{ $t('common.cancel') }}</el-button> | ||
| 24 | + <el-button type="primary" @click="handleSubmit">{{ $t('common.confirm') }}</el-button> | ||
| 25 | + </span> | ||
| 26 | + </el-dialog> | ||
| 27 | +</template> | ||
| 28 | + | ||
| 29 | +<script> | ||
| 30 | +import { getDict } from '@/api/community/communityApi' | ||
| 31 | +import { getCommunityId } from '@/api/community/communityApi' | ||
| 32 | +import { changeStateEquipment } from '@/api/machine/equipmentAccountApi' | ||
| 33 | + | ||
| 34 | +export default { | ||
| 35 | + name: 'ChangeStateEquipment', | ||
| 36 | + data() { | ||
| 37 | + return { | ||
| 38 | + dialogVisible: false, | ||
| 39 | + communityId: '', | ||
| 40 | + useStatus: [], | ||
| 41 | + formData: { | ||
| 42 | + machineId: '', | ||
| 43 | + state: '', | ||
| 44 | + communityId: '' | ||
| 45 | + } | ||
| 46 | + } | ||
| 47 | + }, | ||
| 48 | + created() { | ||
| 49 | + this.communityId = getCommunityId() | ||
| 50 | + this.loadDictData() | ||
| 51 | + }, | ||
| 52 | + methods: { | ||
| 53 | + async loadDictData() { | ||
| 54 | + try { | ||
| 55 | + const data = await getDict('equipment_account', 'state') | ||
| 56 | + this.useStatus = data | ||
| 57 | + } catch (error) { | ||
| 58 | + console.error('获取状态字典失败:', error) | ||
| 59 | + } | ||
| 60 | + }, | ||
| 61 | + open(data) { | ||
| 62 | + this.formData = { | ||
| 63 | + machineId: data.machineId, | ||
| 64 | + state: data.state, | ||
| 65 | + communityId: this.communityId | ||
| 66 | + } | ||
| 67 | + this.dialogVisible = true | ||
| 68 | + }, | ||
| 69 | + handleClose() { | ||
| 70 | + this.$refs.form.resetFields() | ||
| 71 | + }, | ||
| 72 | + async handleSubmit() { | ||
| 73 | + try { | ||
| 74 | + await changeStateEquipment(this.formData) | ||
| 75 | + this.$message.success(this.$t('common.operateSuccess')) | ||
| 76 | + this.dialogVisible = false | ||
| 77 | + this.$emit('success') | ||
| 78 | + } catch (error) { | ||
| 79 | + console.error('修改设备状态失败:', error) | ||
| 80 | + } | ||
| 81 | + } | ||
| 82 | + } | ||
| 83 | +} | ||
| 84 | +</script> | ||
| 0 | \ No newline at end of file | 85 | \ No newline at end of file |
src/components/machine/deleteEquipmentAccount.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <el-dialog | ||
| 3 | + :title="$t('common.confirmOperation')" | ||
| 4 | + :visible.sync="dialogVisible" | ||
| 5 | + width="30%" | ||
| 6 | + @close="handleClose"> | ||
| 7 | + <div class="confirm-content"> | ||
| 8 | + <el-alert | ||
| 9 | + :title="$t('equipmentAccount.confirmDelete')" | ||
| 10 | + type="warning" | ||
| 11 | + :closable="false" | ||
| 12 | + show-icon> | ||
| 13 | + </el-alert> | ||
| 14 | + </div> | ||
| 15 | + <span slot="footer" class="dialog-footer"> | ||
| 16 | + <el-button @click="dialogVisible = false">{{ $t('common.cancel') }}</el-button> | ||
| 17 | + <el-button type="primary" @click="handleConfirm">{{ $t('common.confirm') }}</el-button> | ||
| 18 | + </span> | ||
| 19 | + </el-dialog> | ||
| 20 | +</template> | ||
| 21 | + | ||
| 22 | +<script> | ||
| 23 | +import { getCommunityId } from '@/api/community/communityApi' | ||
| 24 | +import { deleteEquipmentAccount } from '@/api/machine/equipmentAccountApi' | ||
| 25 | + | ||
| 26 | +export default { | ||
| 27 | + name: 'DeleteEquipmentAccount', | ||
| 28 | + data() { | ||
| 29 | + return { | ||
| 30 | + dialogVisible: false, | ||
| 31 | + communityId: '', | ||
| 32 | + equipmentData: { | ||
| 33 | + machineId: '', | ||
| 34 | + communityId: '' | ||
| 35 | + } | ||
| 36 | + } | ||
| 37 | + }, | ||
| 38 | + created() { | ||
| 39 | + this.communityId = getCommunityId() | ||
| 40 | + }, | ||
| 41 | + methods: { | ||
| 42 | + open(data) { | ||
| 43 | + this.equipmentData = { | ||
| 44 | + machineId: data.machineId, | ||
| 45 | + communityId: this.communityId | ||
| 46 | + } | ||
| 47 | + this.dialogVisible = true | ||
| 48 | + }, | ||
| 49 | + handleClose() { | ||
| 50 | + this.equipmentData = { | ||
| 51 | + machineId: '', | ||
| 52 | + communityId: this.communityId | ||
| 53 | + } | ||
| 54 | + }, | ||
| 55 | + async handleConfirm() { | ||
| 56 | + try { | ||
| 57 | + await deleteEquipmentAccount(this.equipmentData) | ||
| 58 | + this.$message.success(this.$t('common.deleteSuccess')) | ||
| 59 | + this.dialogVisible = false | ||
| 60 | + this.$emit('success') | ||
| 61 | + } catch (error) { | ||
| 62 | + console.error('删除设备失败:', error) | ||
| 63 | + } | ||
| 64 | + } | ||
| 65 | + } | ||
| 66 | +} | ||
| 67 | +</script> | ||
| 68 | + | ||
| 69 | +<style scoped> | ||
| 70 | +.confirm-content { | ||
| 71 | + text-align: center; | ||
| 72 | + margin-bottom: 20px; | ||
| 73 | +} | ||
| 74 | +</style> | ||
| 0 | \ No newline at end of file | 75 | \ No newline at end of file |
src/components/machine/editMachineType.vue
| 1 | <template> | 1 | <template> |
| 2 | - <el-dialog | ||
| 3 | - :title="$t('machineTypeTree.edit')" | ||
| 4 | - :visible.sync="dialogVisible" | ||
| 5 | - width="50%" | ||
| 6 | - @close="handleClose" | ||
| 7 | - > | 2 | + <el-dialog :title="$t('machineTypeTree.edit')" :visible.sync="dialogVisible" width="50%" @close="handleClose"> |
| 8 | <el-form ref="form" :model="form" :rules="rules" label-width="120px"> | 3 | <el-form ref="form" :model="form" :rules="rules" label-width="120px"> |
| 9 | <el-form-item :label="$t('machineTypeTree.machineTypeName')" prop="machineTypeName"> | 4 | <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> | 5 | + <el-input v-model.trim="form.machineTypeName" |
| 6 | + :placeholder="$t('machineTypeTree.requiredPlaceholder', { field: $t('machineTypeTree.machineTypeName') })"></el-input> | ||
| 14 | </el-form-item> | 7 | </el-form-item> |
| 15 | <el-form-item :label="$t('machineTypeTree.machineTypeCode')" prop="machineTypeCode"> | 8 | <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> | 9 | + <el-input v-model.trim="form.machineTypeCode" |
| 10 | + :placeholder="$t('machineTypeTree.requiredPlaceholder', { field: $t('machineTypeTree.machineTypeCode') })"></el-input> | ||
| 20 | </el-form-item> | 11 | </el-form-item> |
| 21 | <el-form-item :label="$t('machineTypeTree.status')" prop="isEnable"> | 12 | <el-form-item :label="$t('machineTypeTree.status')" prop="isEnable"> |
| 22 | <el-radio-group v-model="form.isEnable"> | 13 | <el-radio-group v-model="form.isEnable"> |
| @@ -25,52 +16,33 @@ | @@ -25,52 +16,33 @@ | ||
| 25 | </el-radio-group> | 16 | </el-radio-group> |
| 26 | </el-form-item> | 17 | </el-form-item> |
| 27 | <el-form-item :label="$t('machineTypeTree.importanceLevel')" prop="importanceLevel"> | 18 | <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> | 19 | + <el-select v-model="form.importanceLevel" |
| 20 | + :placeholder="$t('machineTypeTree.requiredPlaceholder', { field: $t('machineTypeTree.importanceLevel') })" | ||
| 21 | + style="width:100%"> | ||
| 22 | + <el-option v-for="item in importanceLevels" :key="item.statusCd" :label="item.name" | ||
| 23 | + :value="item.statusCd"></el-option> | ||
| 39 | </el-select> | 24 | </el-select> |
| 40 | </el-form-item> | 25 | </el-form-item> |
| 41 | <el-form-item :label="$t('machineTypeTree.seq')" prop="seq"> | 26 | <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> | 27 | + <el-input-number v-model="form.seq" |
| 28 | + :placeholder="$t('machineTypeTree.requiredPlaceholder', { field: $t('machineTypeTree.seq') })" | ||
| 29 | + controls-position="right" :min="1" style="width:100%"></el-input-number> | ||
| 49 | </el-form-item> | 30 | </el-form-item> |
| 50 | <el-form-item :label="$t('machineTypeTree.unit')"> | 31 | <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> | 32 | + <el-input v-model.trim="form.unit" |
| 33 | + :placeholder="$t('machineTypeTree.optionalPlaceholder', { field: $t('machineTypeTree.unit') })"></el-input> | ||
| 55 | </el-form-item> | 34 | </el-form-item> |
| 56 | <el-form-item :label="$t('machineTypeTree.warrantyDeadline')"> | 35 | <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> | 36 | + <el-date-picker v-model="form.warrantyDeadline" type="date" |
| 37 | + :placeholder="$t('machineTypeTree.optionalPlaceholder', { field: $t('machineTypeTree.warrantyDeadline') })" | ||
| 38 | + style="width:100%" value-format="yyyy-MM-dd"></el-date-picker> | ||
| 64 | </el-form-item> | 39 | </el-form-item> |
| 65 | <el-form-item :label="$t('machineTypeTree.remark')"> | 40 | <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> | 41 | + <el-input v-model.trim="form.remark" type="textarea" |
| 42 | + :placeholder="$t('machineTypeTree.optionalPlaceholder', { field: $t('machineTypeTree.remark') })"></el-input> | ||
| 71 | </el-form-item> | 43 | </el-form-item> |
| 72 | </el-form> | 44 | </el-form> |
| 73 | - | 45 | + |
| 74 | <span slot="footer" class="dialog-footer"> | 46 | <span slot="footer" class="dialog-footer"> |
| 75 | <el-button @click="dialogVisible = false">{{ $t('common.cancel') }}</el-button> | 47 | <el-button @click="dialogVisible = false">{{ $t('common.cancel') }}</el-button> |
| 76 | <el-button type="primary" @click="handleSubmit">{{ $t('common.confirm') }}</el-button> | 48 | <el-button type="primary" @click="handleSubmit">{{ $t('common.confirm') }}</el-button> |
| @@ -79,7 +51,7 @@ | @@ -79,7 +51,7 @@ | ||
| 79 | </template> | 51 | </template> |
| 80 | 52 | ||
| 81 | <script> | 53 | <script> |
| 82 | -import { updateMachineType } from '@/api/machine/machineTypeTreeManageApi' | 54 | +import { updateMachineType,listMachineType } from '@/api/machine/machineTypeTreeManageApi' |
| 83 | import { getDict } from '@/api/community/communityApi' | 55 | import { getDict } from '@/api/community/communityApi' |
| 84 | import { getCommunityId } from '@/api/community/communityApi' | 56 | import { getCommunityId } from '@/api/community/communityApi' |
| 85 | 57 | ||
| @@ -103,25 +75,25 @@ export default { | @@ -103,25 +75,25 @@ export default { | ||
| 103 | importanceLevels: [], | 75 | importanceLevels: [], |
| 104 | rules: { | 76 | rules: { |
| 105 | machineTypeName: [ | 77 | 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' } | 78 | + { required: true, message: this.$t('machineTypeTree.requiredMessage', { field: this.$t('machineTypeTree.machineTypeName') }), trigger: 'blur' }, |
| 79 | + { max: 30, message: this.$t('machineTypeTree.maxLengthMessage', { length: 30 }), trigger: 'blur' } | ||
| 108 | ], | 80 | ], |
| 109 | machineTypeCode: [ | 81 | 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' } | 82 | + { required: true, message: this.$t('machineTypeTree.requiredMessage', { field: this.$t('machineTypeTree.machineTypeCode') }), trigger: 'blur' }, |
| 83 | + { max: 30, message: this.$t('machineTypeTree.maxLengthMessage', { length: 30 }), trigger: 'blur' } | ||
| 112 | ], | 84 | ], |
| 113 | isEnable: [ | 85 | isEnable: [ |
| 114 | - { required: true, message: this.$t('machineTypeTree.requiredMessage', {field: this.$t('machineTypeTree.status')}), trigger: 'change' } | 86 | + { required: true, message: this.$t('machineTypeTree.requiredMessage', { field: this.$t('machineTypeTree.status') }), trigger: 'change' } |
| 115 | ], | 87 | ], |
| 116 | importanceLevel: [ | 88 | importanceLevel: [ |
| 117 | - { required: true, message: this.$t('machineTypeTree.requiredMessage', {field: this.$t('machineTypeTree.importanceLevel')}), trigger: 'change' } | 89 | + { required: true, message: this.$t('machineTypeTree.requiredMessage', { field: this.$t('machineTypeTree.importanceLevel') }), trigger: 'change' } |
| 118 | ], | 90 | ], |
| 119 | seq: [ | 91 | seq: [ |
| 120 | - { required: true, message: this.$t('machineTypeTree.requiredMessage', {field: this.$t('machineTypeTree.seq')}), trigger: 'blur' } | 92 | + { required: true, message: this.$t('machineTypeTree.requiredMessage', { field: this.$t('machineTypeTree.seq') }), trigger: 'blur' } |
| 121 | ], | 93 | ], |
| 122 | typeId: [ | 94 | 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' } | 95 | + { required: true, message: this.$t('machineTypeTree.requiredMessage', { field: 'ID' }), trigger: 'blur' }, |
| 96 | + { max: 30, message: this.$t('machineTypeTree.maxLengthMessage', { length: 30 }), trigger: 'blur' } | ||
| 125 | ] | 97 | ] |
| 126 | } | 98 | } |
| 127 | } | 99 | } |
| @@ -148,6 +120,12 @@ export default { | @@ -148,6 +120,12 @@ export default { | ||
| 148 | this.$nextTick(() => { | 120 | this.$nextTick(() => { |
| 149 | this.$refs.form && this.$refs.form.clearValidate() | 121 | this.$refs.form && this.$refs.form.clearValidate() |
| 150 | }) | 122 | }) |
| 123 | + this._loadMachienType() | ||
| 124 | + }, | ||
| 125 | + async _loadMachienType() { | ||
| 126 | + | ||
| 127 | + const res = await listMachineType({ communityId: getCommunityId(), typeId: this.form.typeId,page:1,row:1 }); | ||
| 128 | + this.form = {...res.data[0]} | ||
| 151 | }, | 129 | }, |
| 152 | handleClose() { | 130 | handleClose() { |
| 153 | this.$refs.form.resetFields() | 131 | this.$refs.form.resetFields() |
src/components/machine/importEquipment.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <el-dialog | ||
| 3 | + :title="$t('equipmentAccount.importEquipment')" | ||
| 4 | + :visible.sync="dialogVisible" | ||
| 5 | + width="50%" | ||
| 6 | + @close="handleClose"> | ||
| 7 | + <el-form ref="form" :model="formData" label-width="120px"> | ||
| 8 | + <el-form-item :label="$t('equipmentAccount.selectFile')" prop="excelFile" required> | ||
| 9 | + <el-upload | ||
| 10 | + ref="upload" | ||
| 11 | + action="" | ||
| 12 | + :auto-upload="false" | ||
| 13 | + :on-change="handleFileChange" | ||
| 14 | + :file-list="fileList" | ||
| 15 | + :limit="1" | ||
| 16 | + accept=".xls,.xlsx"> | ||
| 17 | + <el-button slot="trigger" size="small" type="primary">{{ $t('common.selectFile') }}</el-button> | ||
| 18 | + <div slot="tip" class="el-upload__tip"> | ||
| 19 | + {{ $t('equipmentAccount.fileTip') }} | ||
| 20 | + </div> | ||
| 21 | + </el-upload> | ||
| 22 | + </el-form-item> | ||
| 23 | + | ||
| 24 | + <el-form-item :label="$t('equipmentAccount.downloadTemplate')"> | ||
| 25 | + <div> | ||
| 26 | + {{ $t('equipmentAccount.downloadTip1') }} | ||
| 27 | + <el-link type="primary" @click="downloadTemplate">{{ $t('equipmentAccount.downloadTemplate') }}</el-link> | ||
| 28 | + {{ $t('equipmentAccount.downloadTip2') }} | ||
| 29 | + </div> | ||
| 30 | + </el-form-item> | ||
| 31 | + </el-form> | ||
| 32 | + | ||
| 33 | + <span slot="footer" class="dialog-footer"> | ||
| 34 | + <el-button @click="dialogVisible = false">{{ $t('common.cancel') }}</el-button> | ||
| 35 | + <el-button type="primary" @click="handleImport" :loading="loading">{{ $t('common.import') }}</el-button> | ||
| 36 | + </span> | ||
| 37 | + </el-dialog> | ||
| 38 | +</template> | ||
| 39 | + | ||
| 40 | +<script> | ||
| 41 | +import { getCommunityId } from '@/api/community/communityApi' | ||
| 42 | +import { importEquipmentData, exportImportTemplate } from '@/api/machine/equipmentAccountApi' | ||
| 43 | + | ||
| 44 | +export default { | ||
| 45 | + name: 'ImportEquipment', | ||
| 46 | + data() { | ||
| 47 | + return { | ||
| 48 | + dialogVisible: false, | ||
| 49 | + loading: false, | ||
| 50 | + communityId: '', | ||
| 51 | + formData: { | ||
| 52 | + excelFile: null, | ||
| 53 | + typeId: '' | ||
| 54 | + }, | ||
| 55 | + fileList: [] | ||
| 56 | + } | ||
| 57 | + }, | ||
| 58 | + created() { | ||
| 59 | + this.communityId = getCommunityId() | ||
| 60 | + }, | ||
| 61 | + methods: { | ||
| 62 | + open(params) { | ||
| 63 | + this.formData.typeId = params.typeId | ||
| 64 | + this.dialogVisible = true | ||
| 65 | + }, | ||
| 66 | + handleClose() { | ||
| 67 | + this.fileList = [] | ||
| 68 | + this.formData.excelFile = null | ||
| 69 | + this.$refs.upload.clearFiles() | ||
| 70 | + }, | ||
| 71 | + handleFileChange(file) { | ||
| 72 | + this.formData.excelFile = file.raw | ||
| 73 | + }, | ||
| 74 | + async handleImport() { | ||
| 75 | + if (!this.formData.excelFile) { | ||
| 76 | + this.$message.warning(this.$t('equipmentAccount.selectFileFirst')) | ||
| 77 | + return | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + if (!this.checkFileType(this.formData.excelFile.name)) { | ||
| 81 | + this.$message.warning(this.$t('equipmentAccount.invalidFileType')) | ||
| 82 | + return | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + if (!this.checkFileSize(this.formData.excelFile.size)) { | ||
| 86 | + this.$message.warning(this.$t('equipmentAccount.fileSizeExceed')) | ||
| 87 | + return | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + try { | ||
| 91 | + this.loading = true | ||
| 92 | + const formData = new FormData() | ||
| 93 | + formData.append('uploadFile', this.formData.excelFile) | ||
| 94 | + formData.append('communityId', this.communityId) | ||
| 95 | + formData.append('typeId', this.formData.typeId) | ||
| 96 | + | ||
| 97 | + await importEquipmentData(formData) | ||
| 98 | + this.$message.success(this.$t('common.importSuccess')) | ||
| 99 | + this.dialogVisible = false | ||
| 100 | + this.$emit('success') | ||
| 101 | + } catch (error) { | ||
| 102 | + console.error('导入设备失败:', error) | ||
| 103 | + } finally { | ||
| 104 | + this.loading = false | ||
| 105 | + } | ||
| 106 | + }, | ||
| 107 | + downloadTemplate() { | ||
| 108 | + if (!this.formData.typeId) { | ||
| 109 | + this.$message.warning(this.$t('equipmentAccount.selectTypeFirst')) | ||
| 110 | + return | ||
| 111 | + } | ||
| 112 | + exportImportTemplate({ | ||
| 113 | + typeId: this.formData.typeId, | ||
| 114 | + communityId: this.communityId | ||
| 115 | + }) | ||
| 116 | + }, | ||
| 117 | + checkFileType(filename) { | ||
| 118 | + const ext = filename.split('.').pop().toLowerCase() | ||
| 119 | + return ['xls', 'xlsx'].includes(ext) | ||
| 120 | + }, | ||
| 121 | + checkFileSize(size) { | ||
| 122 | + return size <= 2 * 1024 * 1024 // 2MB | ||
| 123 | + } | ||
| 124 | + } | ||
| 125 | +} | ||
| 126 | +</script> | ||
| 127 | + | ||
| 128 | +<style scoped> | ||
| 129 | +.el-upload__tip { | ||
| 130 | + margin-top: 7px; | ||
| 131 | + color: #606266; | ||
| 132 | + font-size: 12px; | ||
| 133 | +} | ||
| 134 | +</style> | ||
| 0 | \ No newline at end of file | 135 | \ No newline at end of file |
src/components/machine/moveEquipment.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <el-dialog | ||
| 3 | + :title="$t('equipmentAccount.moveEquipment')" | ||
| 4 | + :visible.sync="dialogVisible" | ||
| 5 | + width="50%" | ||
| 6 | + @close="handleClose"> | ||
| 7 | + <el-form ref="form" :model="formData" label-width="150px"> | ||
| 8 | + <el-form-item :label="$t('equipmentAccount.newLocation')" prop="locationObjId" required> | ||
| 9 | + <el-input | ||
| 10 | + v-model="formData.locationObjName" | ||
| 11 | + :placeholder="$t('equipmentAccount.selectLocation')" | ||
| 12 | + readonly | ||
| 13 | + @click.native="showSpaceTree"> | ||
| 14 | + <el-button slot="append" icon="el-icon-search" @click="showSpaceTree"></el-button> | ||
| 15 | + </el-input> | ||
| 16 | + </el-form-item> | ||
| 17 | + </el-form> | ||
| 18 | + <span slot="footer" class="dialog-footer"> | ||
| 19 | + <el-button @click="dialogVisible = false">{{ $t('common.cancel') }}</el-button> | ||
| 20 | + <el-button type="primary" @click="handleSubmit">{{ $t('common.confirm') }}</el-button> | ||
| 21 | + </span> | ||
| 22 | + | ||
| 23 | + <!-- 空间树选择器 --> | ||
| 24 | + <space-tree-dialog | ||
| 25 | + ref="spaceTreeDialog" | ||
| 26 | + @select="handleSpaceSelect"> | ||
| 27 | + </space-tree-dialog> | ||
| 28 | + </el-dialog> | ||
| 29 | +</template> | ||
| 30 | + | ||
| 31 | +<script> | ||
| 32 | +import { getCommunityId } from '@/api/community/communityApi' | ||
| 33 | +import { moveEquipment } from '@/api/machine/equipmentAccountApi' | ||
| 34 | +import SpaceTreeDialog from '@/components/common/SpaceTreeDialog' | ||
| 35 | + | ||
| 36 | +export default { | ||
| 37 | + name: 'MoveEquipment', | ||
| 38 | + components: { | ||
| 39 | + SpaceTreeDialog | ||
| 40 | + }, | ||
| 41 | + data() { | ||
| 42 | + return { | ||
| 43 | + dialogVisible: false, | ||
| 44 | + communityId: '', | ||
| 45 | + formData: { | ||
| 46 | + machineId: '', | ||
| 47 | + locationObjId: '', | ||
| 48 | + locationObjName: '', | ||
| 49 | + communityId: '' | ||
| 50 | + } | ||
| 51 | + } | ||
| 52 | + }, | ||
| 53 | + created() { | ||
| 54 | + this.communityId = getCommunityId() | ||
| 55 | + }, | ||
| 56 | + methods: { | ||
| 57 | + open(data) { | ||
| 58 | + this.formData = { | ||
| 59 | + machineId: data.machineId, | ||
| 60 | + locationObjId: '', | ||
| 61 | + locationObjName: '', | ||
| 62 | + communityId: this.communityId | ||
| 63 | + } | ||
| 64 | + this.dialogVisible = true | ||
| 65 | + }, | ||
| 66 | + handleClose() { | ||
| 67 | + this.$refs.form.resetFields() | ||
| 68 | + }, | ||
| 69 | + showSpaceTree() { | ||
| 70 | + this.$refs.spaceTreeDialog.open() | ||
| 71 | + }, | ||
| 72 | + handleSpaceSelect(space) { | ||
| 73 | + this.formData.locationObjId = space.id | ||
| 74 | + this.formData.locationObjName = space.text | ||
| 75 | + }, | ||
| 76 | + async handleSubmit() { | ||
| 77 | + try { | ||
| 78 | + if (!this.formData.locationObjId) { | ||
| 79 | + this.$message.warning(this.$t('equipmentAccount.selectLocationFirst')) | ||
| 80 | + return | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + await moveEquipment(this.formData) | ||
| 84 | + this.$message.success(this.$t('common.operateSuccess')) | ||
| 85 | + this.dialogVisible = false | ||
| 86 | + this.$emit('success') | ||
| 87 | + } catch (error) { | ||
| 88 | + console.error('移动设备失败:', error) | ||
| 89 | + } | ||
| 90 | + } | ||
| 91 | + } | ||
| 92 | +} | ||
| 93 | +</script> | ||
| 0 | \ No newline at end of file | 94 | \ No newline at end of file |
src/components/machine/printEquipmentAccount.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <el-dialog | ||
| 3 | + :title="$t('equipmentAccount.printLabel')" | ||
| 4 | + :visible.sync="dialogVisible" | ||
| 5 | + width="70%" | ||
| 6 | + @close="handleClose"> | ||
| 7 | + <el-form ref="form" :model="formData" label-width="150px"> | ||
| 8 | + <el-row :gutter="20"> | ||
| 9 | + <el-col :span="12"> | ||
| 10 | + <el-form-item :label="$t('equipmentAccount.machineName')" prop="machineName"> | ||
| 11 | + <el-input v-model="formData.machineName" :disabled="true"></el-input> | ||
| 12 | + </el-form-item> | ||
| 13 | + | ||
| 14 | + <el-form-item :label="$t('equipmentAccount.machineCode')" prop="machineCode"> | ||
| 15 | + <el-input v-model="formData.machineCode" :disabled="true"></el-input> | ||
| 16 | + </el-form-item> | ||
| 17 | + | ||
| 18 | + <el-form-item :label="$t('equipmentAccount.brand')" prop="brand"> | ||
| 19 | + <el-input v-model="formData.brand" :disabled="true"></el-input> | ||
| 20 | + </el-form-item> | ||
| 21 | + | ||
| 22 | + <el-form-item :label="$t('equipmentAccount.model')" prop="model"> | ||
| 23 | + <el-input v-model="formData.model" :disabled="true"></el-input> | ||
| 24 | + </el-form-item> | ||
| 25 | + | ||
| 26 | + <el-form-item :label="$t('equipmentAccount.locationDetail')" prop="locationDetail"> | ||
| 27 | + <el-input v-model="formData.locationDetail" :disabled="true"></el-input> | ||
| 28 | + </el-form-item> | ||
| 29 | + </el-col> | ||
| 30 | + | ||
| 31 | + <el-col :span="12"> | ||
| 32 | + <el-form-item :label="$t('equipmentAccount.firstEnableTime')" prop="firstEnableTime"> | ||
| 33 | + <el-input v-model="formData.firstEnableTime" :disabled="true"></el-input> | ||
| 34 | + </el-form-item> | ||
| 35 | + | ||
| 36 | + <el-form-item :label="$t('equipmentAccount.warrantyDeadline')" prop="warrantyDeadline"> | ||
| 37 | + <el-input v-model="formData.warrantyDeadline" :disabled="true"></el-input> | ||
| 38 | + </el-form-item> | ||
| 39 | + | ||
| 40 | + <el-form-item :label="$t('equipmentAccount.importanceLevel')" prop="importanceLevel"> | ||
| 41 | + <el-input v-model="formData.levelName" :disabled="true"></el-input> | ||
| 42 | + </el-form-item> | ||
| 43 | + | ||
| 44 | + <el-form-item :label="$t('equipmentAccount.state')" prop="state"> | ||
| 45 | + <el-input v-model="formData.stateName" :disabled="true"></el-input> | ||
| 46 | + </el-form-item> | ||
| 47 | + | ||
| 48 | + <el-form-item :label="$t('equipmentAccount.purchasePrice')" prop="purchasePrice"> | ||
| 49 | + <el-input v-model="formData.purchasePrice" :disabled="true"> | ||
| 50 | + <template slot="append">{{ $t('common.yuan') }}</template> | ||
| 51 | + </el-input> | ||
| 52 | + </el-form-item> | ||
| 53 | + </el-col> | ||
| 54 | + </el-row> | ||
| 55 | + | ||
| 56 | + <el-form-item :label="$t('equipmentAccount.printQty')" prop="printQty"> | ||
| 57 | + <el-input-number | ||
| 58 | + v-model="formData.printQty" | ||
| 59 | + :min="1" | ||
| 60 | + :max="10" | ||
| 61 | + label="打印数量"> | ||
| 62 | + </el-input-number> | ||
| 63 | + </el-form-item> | ||
| 64 | + </el-form> | ||
| 65 | + | ||
| 66 | + <span slot="footer" class="dialog-footer"> | ||
| 67 | + <el-button @click="dialogVisible = false">{{ $t('common.cancel') }}</el-button> | ||
| 68 | + <el-button type="primary" @click="handlePrint">{{ $t('equipmentAccount.printPreview') }}</el-button> | ||
| 69 | + </span> | ||
| 70 | + </el-dialog> | ||
| 71 | +</template> | ||
| 72 | + | ||
| 73 | +<script> | ||
| 74 | +import { getCommunityId } from '@/api/community/communityApi' | ||
| 75 | +import { getEquipmentAccountDetail } from '@/api/machine/equipmentAccountApi' | ||
| 76 | + | ||
| 77 | +export default { | ||
| 78 | + name: 'PrintEquipmentAccount', | ||
| 79 | + data() { | ||
| 80 | + return { | ||
| 81 | + dialogVisible: false, | ||
| 82 | + communityId: '', | ||
| 83 | + formData: { | ||
| 84 | + machineId: '', | ||
| 85 | + machineName: '', | ||
| 86 | + machineCode: '', | ||
| 87 | + brand: '', | ||
| 88 | + model: '', | ||
| 89 | + locationDetail: '', | ||
| 90 | + firstEnableTime: '', | ||
| 91 | + warrantyDeadline: '', | ||
| 92 | + importanceLevel: '', | ||
| 93 | + levelName: '', | ||
| 94 | + state: '', | ||
| 95 | + stateName: '', | ||
| 96 | + purchasePrice: '', | ||
| 97 | + printQty: 1 | ||
| 98 | + } | ||
| 99 | + } | ||
| 100 | + }, | ||
| 101 | + created() { | ||
| 102 | + this.communityId = getCommunityId() | ||
| 103 | + }, | ||
| 104 | + methods: { | ||
| 105 | + async open(data) { | ||
| 106 | + try { | ||
| 107 | + const params = { | ||
| 108 | + machineId: data.machineId, | ||
| 109 | + communityId: this.communityId | ||
| 110 | + } | ||
| 111 | + const detail = await getEquipmentAccountDetail(params) | ||
| 112 | + this.formData = { | ||
| 113 | + ...detail, | ||
| 114 | + printQty: 1 | ||
| 115 | + } | ||
| 116 | + this.dialogVisible = true | ||
| 117 | + } catch (error) { | ||
| 118 | + console.error('获取设备详情失败:', error) | ||
| 119 | + } | ||
| 120 | + }, | ||
| 121 | + handleClose() { | ||
| 122 | + this.formData.printQty = 1 | ||
| 123 | + this.$refs.form.resetFields() | ||
| 124 | + }, | ||
| 125 | + handlePrint() { | ||
| 126 | + window.open(`/print.html#/pages/property/printEquipmentAccountLabel?machineId=${this.formData.machineId}&qty=${this.formData.printQty}`) | ||
| 127 | + this.dialogVisible = false | ||
| 128 | + } | ||
| 129 | + } | ||
| 130 | +} | ||
| 131 | +</script> | ||
| 132 | + | ||
| 133 | +<style scoped> | ||
| 134 | +.el-form-item { | ||
| 135 | + margin-bottom: 15px; | ||
| 136 | +} | ||
| 137 | +</style> | ||
| 0 | \ No newline at end of file | 138 | \ No newline at end of file |
src/components/machine/viewEquipmentAccount.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <el-dialog | ||
| 3 | + :title="$t('equipmentAccount.viewEquipment')" | ||
| 4 | + :visible.sync="dialogVisible" | ||
| 5 | + width="70%" | ||
| 6 | + @close="handleClose"> | ||
| 7 | + <el-form ref="form" :model="formData" label-width="150px" :disabled="true"> | ||
| 8 | + <el-row :gutter="20"> | ||
| 9 | + <el-col :span="12"> | ||
| 10 | + <el-form-item :label="$t('equipmentAccount.machineName')" prop="machineName"> | ||
| 11 | + <el-input v-model="formData.machineName"></el-input> | ||
| 12 | + </el-form-item> | ||
| 13 | + | ||
| 14 | + <el-form-item :label="$t('equipmentAccount.machineCode')" prop="machineCode"> | ||
| 15 | + <el-input v-model="formData.machineCode"></el-input> | ||
| 16 | + </el-form-item> | ||
| 17 | + | ||
| 18 | + <el-form-item :label="$t('equipmentAccount.brand')" prop="brand"> | ||
| 19 | + <el-input v-model="formData.brand"></el-input> | ||
| 20 | + </el-form-item> | ||
| 21 | + | ||
| 22 | + <el-form-item :label="$t('equipmentAccount.model')" prop="model"> | ||
| 23 | + <el-input v-model="formData.model"></el-input> | ||
| 24 | + </el-form-item> | ||
| 25 | + | ||
| 26 | + <el-form-item :label="$t('equipmentAccount.locationDetail')" prop="locationDetail"> | ||
| 27 | + <el-input v-model="formData.locationDetail"></el-input> | ||
| 28 | + </el-form-item> | ||
| 29 | + | ||
| 30 | + <el-form-item :label="$t('equipmentAccount.firstEnableTime')" prop="firstEnableTime"> | ||
| 31 | + <el-input v-model="formData.firstEnableTime"></el-input> | ||
| 32 | + </el-form-item> | ||
| 33 | + | ||
| 34 | + <el-form-item :label="$t('equipmentAccount.warrantyDeadline')" prop="warrantyDeadline"> | ||
| 35 | + <el-input v-model="formData.warrantyDeadline"></el-input> | ||
| 36 | + </el-form-item> | ||
| 37 | + </el-col> | ||
| 38 | + | ||
| 39 | + <el-col :span="12"> | ||
| 40 | + <el-form-item :label="$t('equipmentAccount.usefulLife')" prop="usefulLife"> | ||
| 41 | + <el-input v-model="formData.usefulLife"> | ||
| 42 | + <template slot="append">{{ $t('common.month') }}</template> | ||
| 43 | + </el-input> | ||
| 44 | + </el-form-item> | ||
| 45 | + | ||
| 46 | + <el-form-item :label="$t('equipmentAccount.importanceLevel')" prop="importanceLevel"> | ||
| 47 | + <el-input v-model="formData.levelName"></el-input> | ||
| 48 | + </el-form-item> | ||
| 49 | + | ||
| 50 | + <el-form-item :label="$t('equipmentAccount.state')" prop="state"> | ||
| 51 | + <el-input v-model="formData.stateName"></el-input> | ||
| 52 | + </el-form-item> | ||
| 53 | + | ||
| 54 | + <el-form-item :label="$t('equipmentAccount.purchasePrice')" prop="purchasePrice"> | ||
| 55 | + <el-input v-model="formData.purchasePrice"> | ||
| 56 | + <template slot="append">{{ $t('common.yuan') }}</template> | ||
| 57 | + </el-input> | ||
| 58 | + </el-form-item> | ||
| 59 | + | ||
| 60 | + <el-form-item :label="$t('equipmentAccount.netWorth')" prop="netWorth"> | ||
| 61 | + <el-input v-model="formData.netWorth"> | ||
| 62 | + <template slot="append">{{ $t('common.yuan') }}</template> | ||
| 63 | + </el-input> | ||
| 64 | + </el-form-item> | ||
| 65 | + | ||
| 66 | + <el-form-item :label="$t('equipmentAccount.useOrgName')" prop="useOrgName"> | ||
| 67 | + <el-input v-model="formData.useOrgName"></el-input> | ||
| 68 | + </el-form-item> | ||
| 69 | + | ||
| 70 | + <el-form-item :label="$t('equipmentAccount.useUserName')" prop="useUserName"> | ||
| 71 | + <el-input v-model="formData.useUserName"></el-input> | ||
| 72 | + </el-form-item> | ||
| 73 | + </el-col> | ||
| 74 | + </el-row> | ||
| 75 | + | ||
| 76 | + <el-row :gutter="20"> | ||
| 77 | + <el-col :span="12"> | ||
| 78 | + <el-form-item :label="$t('equipmentAccount.chargeOrgName')" prop="chargeOrgName"> | ||
| 79 | + <el-input v-model="formData.chargeOrgName"></el-input> | ||
| 80 | + </el-form-item> | ||
| 81 | + </el-col> | ||
| 82 | + | ||
| 83 | + <el-col :span="12"> | ||
| 84 | + <el-form-item :label="$t('equipmentAccount.chargeUseName')" prop="chargeUseName"> | ||
| 85 | + <el-input v-model="formData.chargeUseName"></el-input> | ||
| 86 | + </el-form-item> | ||
| 87 | + </el-col> | ||
| 88 | + </el-row> | ||
| 89 | + | ||
| 90 | + <el-form-item :label="$t('equipmentAccount.remark')" prop="remark"> | ||
| 91 | + <el-input | ||
| 92 | + v-model="formData.remark" | ||
| 93 | + type="textarea" | ||
| 94 | + :rows="3"> | ||
| 95 | + </el-input> | ||
| 96 | + </el-form-item> | ||
| 97 | + </el-form> | ||
| 98 | + | ||
| 99 | + <span slot="footer" class="dialog-footer"> | ||
| 100 | + <el-button @click="dialogVisible = false">{{ $t('common.close') }}</el-button> | ||
| 101 | + </span> | ||
| 102 | + </el-dialog> | ||
| 103 | +</template> | ||
| 104 | + | ||
| 105 | +<script> | ||
| 106 | +import { getCommunityId } from '@/api/community/communityApi' | ||
| 107 | +import { getEquipmentAccountDetail } from '@/api/machine/equipmentAccountApi' | ||
| 108 | + | ||
| 109 | +export default { | ||
| 110 | + name: 'ViewEquipmentAccount', | ||
| 111 | + data() { | ||
| 112 | + return { | ||
| 113 | + dialogVisible: false, | ||
| 114 | + communityId: '', | ||
| 115 | + formData: { | ||
| 116 | + machineId: '', | ||
| 117 | + machineName: '', | ||
| 118 | + machineCode: '', | ||
| 119 | + brand: '', | ||
| 120 | + model: '', | ||
| 121 | + locationDetail: '', | ||
| 122 | + firstEnableTime: '', | ||
| 123 | + warrantyDeadline: '', | ||
| 124 | + usefulLife: '', | ||
| 125 | + importanceLevel: '', | ||
| 126 | + levelName: '', | ||
| 127 | + state: '', | ||
| 128 | + stateName: '', | ||
| 129 | + purchasePrice: '', | ||
| 130 | + netWorth: '', | ||
| 131 | + useOrgName: '', | ||
| 132 | + useUserName: '', | ||
| 133 | + chargeOrgName: '', | ||
| 134 | + chargeUseName: '', | ||
| 135 | + remark: '' | ||
| 136 | + } | ||
| 137 | + } | ||
| 138 | + }, | ||
| 139 | + created() { | ||
| 140 | + this.communityId = getCommunityId() | ||
| 141 | + }, | ||
| 142 | + methods: { | ||
| 143 | + async open(machineId) { | ||
| 144 | + try { | ||
| 145 | + const params = { | ||
| 146 | + machineId, | ||
| 147 | + communityId: this.communityId | ||
| 148 | + } | ||
| 149 | + const data = await getEquipmentAccountDetail(params) | ||
| 150 | + this.formData = { ...data } | ||
| 151 | + this.dialogVisible = true | ||
| 152 | + } catch (error) { | ||
| 153 | + console.error('获取设备详情失败:', error) | ||
| 154 | + } | ||
| 155 | + }, | ||
| 156 | + handleClose() { | ||
| 157 | + this.$refs.form.resetFields() | ||
| 158 | + } | ||
| 159 | + } | ||
| 160 | +} | ||
| 161 | +</script> | ||
| 162 | + | ||
| 163 | +<style scoped> | ||
| 164 | +.el-form-item { | ||
| 165 | + margin-bottom: 15px; | ||
| 166 | +} | ||
| 167 | +</style> | ||
| 0 | \ No newline at end of file | 168 | \ No newline at end of file |
src/i18n/commonLang.js
| @@ -45,7 +45,8 @@ export const messages = { | @@ -45,7 +45,8 @@ export const messages = { | ||
| 45 | more:'More', | 45 | more:'More', |
| 46 | tip:'Tip', | 46 | tip:'Tip', |
| 47 | selectFile:'Select File', | 47 | selectFile:'Select File', |
| 48 | - change:'Change' | 48 | + change:'Change', |
| 49 | + print:'Print', | ||
| 49 | } | 50 | } |
| 50 | }, | 51 | }, |
| 51 | zh: { | 52 | zh: { |
| @@ -94,7 +95,8 @@ export const messages = { | @@ -94,7 +95,8 @@ export const messages = { | ||
| 94 | more:'更多', | 95 | more:'更多', |
| 95 | tip:'提示', | 96 | tip:'提示', |
| 96 | selectFile:'选择文件', | 97 | selectFile:'选择文件', |
| 97 | - change:'变更' | 98 | + change:'变更', |
| 99 | + print:'打印', | ||
| 98 | } | 100 | } |
| 99 | } | 101 | } |
| 100 | } | 102 | } |
| 101 | \ No newline at end of file | 103 | \ No newline at end of file |
src/i18n/index.js
| @@ -199,6 +199,12 @@ import { messages as allocationUserStorehouseManageMessages } from '../views/res | @@ -199,6 +199,12 @@ import { messages as allocationUserStorehouseManageMessages } from '../views/res | ||
| 199 | import { messages as resourceStoreUseRecordManageMessages } from '../views/resource/resourceStoreUseRecordManageLang' | 199 | import { messages as resourceStoreUseRecordManageMessages } from '../views/resource/resourceStoreUseRecordManageLang' |
| 200 | import { messages as locationManageMessages } from '../views/community/locationManageLang' | 200 | import { messages as locationManageMessages } from '../views/community/locationManageLang' |
| 201 | import { messages as machineTypeTreeManageMessages } from '../views/machine/machineTypeTreeManageLang' | 201 | import { messages as machineTypeTreeManageMessages } from '../views/machine/machineTypeTreeManageLang' |
| 202 | +import { messages as equipmentAccountMessages } from '../views/machine/equipmentAccountLang' | ||
| 203 | +import { messages as addEquipmentAccountMessages } from '../views/machine/addEquipmentAccountLang' | ||
| 204 | +import { messages as editEquipmentAccountMessages } from '../views/machine/editEquipmentAccountLang' | ||
| 205 | +import { messages as equipmentAccountDetailMessages } from '../views/machine/equipmentAccountDetailLang' | ||
| 206 | +import { messages as printEquipmentAccountLabelMessages } from '../views/resource/printEquipmentAccountLabelLang' | ||
| 207 | + | ||
| 202 | Vue.use(VueI18n) | 208 | Vue.use(VueI18n) |
| 203 | 209 | ||
| 204 | // 合并所有语言配置 | 210 | // 合并所有语言配置 |
| @@ -401,6 +407,11 @@ const messages = { | @@ -401,6 +407,11 @@ const messages = { | ||
| 401 | ...resourceStoreUseRecordManageMessages.en, | 407 | ...resourceStoreUseRecordManageMessages.en, |
| 402 | ...locationManageMessages.en, | 408 | ...locationManageMessages.en, |
| 403 | ...machineTypeTreeManageMessages.en, | 409 | ...machineTypeTreeManageMessages.en, |
| 410 | + ...equipmentAccountMessages.en, | ||
| 411 | + ...addEquipmentAccountMessages.en, | ||
| 412 | + ...editEquipmentAccountMessages.en, | ||
| 413 | + ...equipmentAccountDetailMessages.en, | ||
| 414 | + ...printEquipmentAccountLabelMessages.en, | ||
| 404 | }, | 415 | }, |
| 405 | zh: { | 416 | zh: { |
| 406 | ...loginMessages.zh, | 417 | ...loginMessages.zh, |
| @@ -600,6 +611,11 @@ const messages = { | @@ -600,6 +611,11 @@ const messages = { | ||
| 600 | ...resourceStoreUseRecordManageMessages.zh, | 611 | ...resourceStoreUseRecordManageMessages.zh, |
| 601 | ...locationManageMessages.zh, | 612 | ...locationManageMessages.zh, |
| 602 | ...machineTypeTreeManageMessages.zh, | 613 | ...machineTypeTreeManageMessages.zh, |
| 614 | + ...equipmentAccountMessages.zh, | ||
| 615 | + ...addEquipmentAccountMessages.zh, | ||
| 616 | + ...editEquipmentAccountMessages.zh, | ||
| 617 | + ...equipmentAccountDetailMessages.zh, | ||
| 618 | + ...printEquipmentAccountLabelMessages.zh, | ||
| 603 | } | 619 | } |
| 604 | } | 620 | } |
| 605 | 621 |
src/router/index.js
| @@ -2,6 +2,7 @@ import Vue from 'vue' | @@ -2,6 +2,7 @@ import Vue from 'vue' | ||
| 2 | import VueRouter from 'vue-router' | 2 | import VueRouter from 'vue-router' |
| 3 | import Layout from '@/views/layout/layout.vue' | 3 | import Layout from '@/views/layout/layout.vue' |
| 4 | import Login from '@/views/user/login/Login.vue' | 4 | import Login from '@/views/user/login/Login.vue' |
| 5 | +import printEquipmentAccountLabel from '@/views/resource/printEquipmentAccountLabelList.vue' | ||
| 5 | 6 | ||
| 6 | Vue.use(VueRouter) | 7 | Vue.use(VueRouter) |
| 7 | 8 | ||
| @@ -977,15 +978,36 @@ const routes = [ | @@ -977,15 +978,36 @@ const routes = [ | ||
| 977 | component: () => import('@/views/resource/resourceStoreUseRecordManageList.vue') | 978 | component: () => import('@/views/resource/resourceStoreUseRecordManageList.vue') |
| 978 | }, | 979 | }, |
| 979 | { | 980 | { |
| 980 | - path:'/pages/property/locationManage', | ||
| 981 | - name:'/pages/property/locationManage', | 981 | + path: '/pages/property/locationManage', |
| 982 | + name: '/pages/property/locationManage', | ||
| 982 | component: () => import('@/views/community/locationManageList.vue') | 983 | 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 | - }, | 984 | + }, |
| 985 | + { | ||
| 986 | + path: '/pages/property/machineTypeTreeManage', | ||
| 987 | + name: '/pages/property/machineTypeTreeManage', | ||
| 988 | + component: () => import('@/views/machine/machineTypeTreeManageList.vue') | ||
| 989 | + }, | ||
| 990 | + { | ||
| 991 | + path: '/pages/property/equipmentAccount', | ||
| 992 | + name: '/pages/property/equipmentAccount', | ||
| 993 | + component: () => import('@/views/machine/equipmentAccountList.vue') | ||
| 994 | + }, | ||
| 995 | + { | ||
| 996 | + path: '/views/machine/addEquipmentAccount', | ||
| 997 | + name: '/views/machine/addEquipmentAccount', | ||
| 998 | + component: () => import('@/views/machine/addEquipmentAccountList.vue') | ||
| 999 | + }, | ||
| 1000 | + { | ||
| 1001 | + path: '/views/machine/editEquipmentAccount', | ||
| 1002 | + name: '/views/machine/editEquipmentAccount', | ||
| 1003 | + component: () => import('@/views/machine/editEquipmentAccountList.vue') | ||
| 1004 | + }, | ||
| 1005 | + { | ||
| 1006 | + path: '/views/machine/equipmentAccountDetail', | ||
| 1007 | + name: '/views/machine/equipmentAccountDetail', | ||
| 1008 | + component: () => import('@/views/machine/equipmentAccountDetailList.vue') | ||
| 1009 | + }, | ||
| 1010 | + | ||
| 989 | // 其他子路由可以在这里添加 | 1011 | // 其他子路由可以在这里添加 |
| 990 | ] | 1012 | ] |
| 991 | }, | 1013 | }, |
| @@ -997,7 +1019,12 @@ const routes = [ | @@ -997,7 +1019,12 @@ const routes = [ | ||
| 997 | title: '登陆页面', | 1019 | title: '登陆页面', |
| 998 | icon: 'el-icon-s-home' | 1020 | icon: 'el-icon-s-home' |
| 999 | } | 1021 | } |
| 1000 | - } | 1022 | + }, |
| 1023 | + { | ||
| 1024 | + path: '/views/resource/printEquipmentAccountLabel', | ||
| 1025 | + name: '/views/resource/printEquipmentAccountLabel', | ||
| 1026 | + component: printEquipmentAccountLabel | ||
| 1027 | + }, | ||
| 1001 | ] | 1028 | ] |
| 1002 | 1029 | ||
| 1003 | const router = new VueRouter({ | 1030 | const router = new VueRouter({ |
src/views/machine/addEquipmentAccountLang.js
0 → 100644
| 1 | +export const messages = { | ||
| 2 | + en: { | ||
| 3 | + addEquipmentAccount: { | ||
| 4 | + title: 'Add Equipment', | ||
| 5 | + machineName: 'Equipment Name', | ||
| 6 | + machineNamePlaceholder: 'Required, please enter equipment name', | ||
| 7 | + machineCode: 'Equipment Code', | ||
| 8 | + machineCodePlaceholder: 'Required, please enter equipment code', | ||
| 9 | + importanceLevel: 'Importance Level', | ||
| 10 | + importanceLevelPlaceholder: 'Required, please select importance level', | ||
| 11 | + state: 'Usage Status', | ||
| 12 | + statePlaceholder: 'Required, please select usage status', | ||
| 13 | + brand: 'Brand', | ||
| 14 | + brandPlaceholder: 'Optional, please enter brand', | ||
| 15 | + model: 'Model', | ||
| 16 | + modelPlaceholder: 'Optional, please enter model', | ||
| 17 | + netWorth: 'Net Worth', | ||
| 18 | + netWorthPlaceholder: 'Optional, please enter net worth', | ||
| 19 | + locationDetail: 'Location Detail', | ||
| 20 | + locationDetailPlaceholder: 'Optional, please enter location detail', | ||
| 21 | + firstEnableTime: 'First Enable Time', | ||
| 22 | + firstEnableTimePlaceholder: 'Optional, please select first enable time', | ||
| 23 | + warrantyDeadline: 'Warranty Deadline', | ||
| 24 | + warrantyDeadlinePlaceholder: 'Optional, please select warranty deadline', | ||
| 25 | + usefulLife: 'Useful Life (Years)', | ||
| 26 | + usefulLifePlaceholder: 'Optional, please enter useful life', | ||
| 27 | + purchasePrice: 'Purchase Price', | ||
| 28 | + purchasePricePlaceholder: 'Optional, please enter purchase price', | ||
| 29 | + useUserName: 'User', | ||
| 30 | + useUserNamePlaceholder: 'Required, please select user', | ||
| 31 | + chargeUseName: 'Responsible Person', | ||
| 32 | + chargeUseNamePlaceholder: 'Required, please select responsible person', | ||
| 33 | + remark: 'Remark', | ||
| 34 | + remarkPlaceholder: 'Optional, please enter remark', | ||
| 35 | + validate: { | ||
| 36 | + machineNameRequired: 'Equipment name is required', | ||
| 37 | + machineCodeRequired: 'Equipment code is required', | ||
| 38 | + importanceLevelRequired: 'Importance level is required', | ||
| 39 | + stateRequired: 'Usage status is required', | ||
| 40 | + useUserNameRequired: 'User is required', | ||
| 41 | + chargeUseNameRequired: 'Responsible person is required' | ||
| 42 | + }, | ||
| 43 | + saveSuccess: 'Add successfully', | ||
| 44 | + saveFailed: 'Add failed' | ||
| 45 | + } | ||
| 46 | + }, | ||
| 47 | + zh: { | ||
| 48 | + addEquipmentAccount: { | ||
| 49 | + title: '添加设备', | ||
| 50 | + machineName: '设备名称', | ||
| 51 | + machineNamePlaceholder: '必填,请填写设备名称', | ||
| 52 | + machineCode: '设备编码', | ||
| 53 | + machineCodePlaceholder: '必填,请填写设备编码', | ||
| 54 | + importanceLevel: '重要等级', | ||
| 55 | + importanceLevelPlaceholder: '必填,请选择重要等级', | ||
| 56 | + state: '使用状态', | ||
| 57 | + statePlaceholder: '必填,请选择使用状态', | ||
| 58 | + brand: '设备品牌', | ||
| 59 | + brandPlaceholder: '选填,请填写设备品牌', | ||
| 60 | + model: '设备型号', | ||
| 61 | + modelPlaceholder: '选填,请填写设备型号', | ||
| 62 | + netWorth: '资产净值', | ||
| 63 | + netWorthPlaceholder: '选填,请填写资产净值', | ||
| 64 | + locationDetail: '位置详情', | ||
| 65 | + locationDetailPlaceholder: '选填,请填写位置详情', | ||
| 66 | + firstEnableTime: '首次启用时间', | ||
| 67 | + firstEnableTimePlaceholder: '选填,请填写首次启用时间', | ||
| 68 | + warrantyDeadline: '保修截止日期', | ||
| 69 | + warrantyDeadlinePlaceholder: '选填,请填写保修截止日期', | ||
| 70 | + usefulLife: '使用年限(年)', | ||
| 71 | + usefulLifePlaceholder: '选填,请填写使用年限', | ||
| 72 | + purchasePrice: '采购价格', | ||
| 73 | + purchasePricePlaceholder: '选填,请填写采购价格', | ||
| 74 | + useUserName: '使用人', | ||
| 75 | + useUserNamePlaceholder: '必填,请选择使用人', | ||
| 76 | + chargeUseName: '责任人', | ||
| 77 | + chargeUseNamePlaceholder: '必填,请选择责任人', | ||
| 78 | + remark: '备注', | ||
| 79 | + remarkPlaceholder: '选填,请填写备注', | ||
| 80 | + validate: { | ||
| 81 | + machineNameRequired: '设备名称不能为空', | ||
| 82 | + machineCodeRequired: '设备编码不能为空', | ||
| 83 | + importanceLevelRequired: '重要等级不能为空', | ||
| 84 | + stateRequired: '使用状态不能为空', | ||
| 85 | + useUserNameRequired: '使用人不能为空', | ||
| 86 | + chargeUseNameRequired: '责任人不能为空' | ||
| 87 | + }, | ||
| 88 | + saveSuccess: '添加成功', | ||
| 89 | + saveFailed: '添加失败' | ||
| 90 | + } | ||
| 91 | + } | ||
| 92 | +} | ||
| 0 | \ No newline at end of file | 93 | \ No newline at end of file |
src/views/machine/addEquipmentAccountList.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div class="add-equipment-account-container"> | ||
| 3 | + <el-card class="box-card"> | ||
| 4 | + <div slot="header" class="clearfix"> | ||
| 5 | + <span>{{ $t('addEquipmentAccount.title') }}</span> | ||
| 6 | + </div> | ||
| 7 | + | ||
| 8 | + <el-form ref="form" :model="addEquipmentAccountInfo" label-width="120px" label-position="right"> | ||
| 9 | + <el-row :gutter="20"> | ||
| 10 | + <el-col :span="24"> | ||
| 11 | + <el-row :gutter="20"> | ||
| 12 | + <el-col :span="12"> | ||
| 13 | + <el-form-item :label="$t('addEquipmentAccount.machineName')" prop="machineName" required> | ||
| 14 | + <el-input v-model.trim="addEquipmentAccountInfo.machineName" | ||
| 15 | + :placeholder="$t('addEquipmentAccount.machineNamePlaceholder')" /> | ||
| 16 | + </el-form-item> | ||
| 17 | + </el-col> | ||
| 18 | + <el-col :span="12"> | ||
| 19 | + <el-form-item :label="$t('addEquipmentAccount.machineCode')" prop="machineCode" required> | ||
| 20 | + <el-input v-model.trim="addEquipmentAccountInfo.machineCode" | ||
| 21 | + :placeholder="$t('addEquipmentAccount.machineCodePlaceholder')" /> | ||
| 22 | + </el-form-item> | ||
| 23 | + </el-col> | ||
| 24 | + </el-row> | ||
| 25 | + | ||
| 26 | + <el-row :gutter="20"> | ||
| 27 | + <el-col :span="12"> | ||
| 28 | + <el-form-item :label="$t('addEquipmentAccount.importanceLevel')" prop="importanceLevel" required> | ||
| 29 | + <el-select v-model="addEquipmentAccountInfo.importanceLevel" | ||
| 30 | + :placeholder="$t('addEquipmentAccount.importanceLevelPlaceholder')" style="width:100%"> | ||
| 31 | + <el-option v-for="(item, index) in addEquipmentAccountInfo.importanceLevels" :key="index" | ||
| 32 | + :label="item.name" :value="item.statusCd" /> | ||
| 33 | + </el-select> | ||
| 34 | + </el-form-item> | ||
| 35 | + </el-col> | ||
| 36 | + <el-col :span="12"> | ||
| 37 | + <el-form-item :label="$t('addEquipmentAccount.state')" prop="state" required> | ||
| 38 | + <el-select v-model="addEquipmentAccountInfo.state" | ||
| 39 | + :placeholder="$t('addEquipmentAccount.statePlaceholder')" style="width:100%"> | ||
| 40 | + <el-option v-for="(item, index) in addEquipmentAccountInfo.useStatus" :key="index" :label="item.name" | ||
| 41 | + :value="item.statusCd" /> | ||
| 42 | + </el-select> | ||
| 43 | + </el-form-item> | ||
| 44 | + </el-col> | ||
| 45 | + </el-row> | ||
| 46 | + | ||
| 47 | + <el-row :gutter="20"> | ||
| 48 | + <el-col :span="12"> | ||
| 49 | + <el-form-item :label="$t('addEquipmentAccount.brand')"> | ||
| 50 | + <el-input v-model.trim="addEquipmentAccountInfo.brand" | ||
| 51 | + :placeholder="$t('addEquipmentAccount.brandPlaceholder')" /> | ||
| 52 | + </el-form-item> | ||
| 53 | + </el-col> | ||
| 54 | + <el-col :span="12"> | ||
| 55 | + <el-form-item :label="$t('addEquipmentAccount.model')"> | ||
| 56 | + <el-input v-model.trim="addEquipmentAccountInfo.model" | ||
| 57 | + :placeholder="$t('addEquipmentAccount.modelPlaceholder')" /> | ||
| 58 | + </el-form-item> | ||
| 59 | + </el-col> | ||
| 60 | + </el-row> | ||
| 61 | + | ||
| 62 | + <el-row :gutter="20"> | ||
| 63 | + <el-col :span="12"> | ||
| 64 | + <el-form-item :label="$t('addEquipmentAccount.netWorth')"> | ||
| 65 | + <el-input v-model.trim="addEquipmentAccountInfo.netWorth" | ||
| 66 | + :placeholder="$t('addEquipmentAccount.netWorthPlaceholder')" /> | ||
| 67 | + </el-form-item> | ||
| 68 | + </el-col> | ||
| 69 | + <el-col :span="12"> | ||
| 70 | + <el-form-item :label="$t('addEquipmentAccount.locationDetail')"> | ||
| 71 | + <el-input v-model.trim="addEquipmentAccountInfo.locationDetail" | ||
| 72 | + :placeholder="$t('addEquipmentAccount.locationDetailPlaceholder')" /> | ||
| 73 | + </el-form-item> | ||
| 74 | + </el-col> | ||
| 75 | + </el-row> | ||
| 76 | + | ||
| 77 | + <el-row :gutter="20"> | ||
| 78 | + <el-col :span="12"> | ||
| 79 | + <el-form-item :label="$t('addEquipmentAccount.firstEnableTime')"> | ||
| 80 | + <el-date-picker v-model="addEquipmentAccountInfo.firstEnableTime" type="date" value-format="yyyy-MM-dd" | ||
| 81 | + :placeholder="$t('addEquipmentAccount.firstEnableTimePlaceholder')" style="width:100%" /> | ||
| 82 | + </el-form-item> | ||
| 83 | + </el-col> | ||
| 84 | + <el-col :span="12"> | ||
| 85 | + <el-form-item :label="$t('addEquipmentAccount.warrantyDeadline')"> | ||
| 86 | + <el-date-picker v-model="addEquipmentAccountInfo.warrantyDeadline" type="date" value-format="yyyy-MM-dd" | ||
| 87 | + :placeholder="$t('addEquipmentAccount.warrantyDeadlinePlaceholder')" style="width:100%" /> | ||
| 88 | + </el-form-item> | ||
| 89 | + </el-col> | ||
| 90 | + </el-row> | ||
| 91 | + | ||
| 92 | + <el-row :gutter="20"> | ||
| 93 | + <el-col :span="12"> | ||
| 94 | + <el-form-item :label="$t('addEquipmentAccount.usefulLife')"> | ||
| 95 | + <el-input v-model.trim="addEquipmentAccountInfo.usefulLife" | ||
| 96 | + :placeholder="$t('addEquipmentAccount.usefulLifePlaceholder')" /> | ||
| 97 | + </el-form-item> | ||
| 98 | + </el-col> | ||
| 99 | + <el-col :span="12"> | ||
| 100 | + <el-form-item :label="$t('addEquipmentAccount.purchasePrice')"> | ||
| 101 | + <el-input v-model.trim="addEquipmentAccountInfo.purchasePrice" | ||
| 102 | + :placeholder="$t('addEquipmentAccount.purchasePricePlaceholder')" /> | ||
| 103 | + </el-form-item> | ||
| 104 | + </el-col> | ||
| 105 | + </el-row> | ||
| 106 | + | ||
| 107 | + <el-row :gutter="20"> | ||
| 108 | + <el-col :span="12"> | ||
| 109 | + <el-form-item :label="$t('addEquipmentAccount.useUserName')" prop="useUserName" required> | ||
| 110 | + <el-input v-model.trim="addEquipmentAccountInfo.useUserName" | ||
| 111 | + :placeholder="$t('addEquipmentAccount.useUserNamePlaceholder')" /> | ||
| 112 | + </el-form-item> | ||
| 113 | + </el-col> | ||
| 114 | + <el-col :span="12"> | ||
| 115 | + <el-form-item :label="$t('addEquipmentAccount.chargeUseName')" prop="chargeUseName" required> | ||
| 116 | + <el-input v-model.trim="addEquipmentAccountInfo.chargeUseName" | ||
| 117 | + :placeholder="$t('addEquipmentAccount.chargeUseNamePlaceholder')" /> | ||
| 118 | + </el-form-item> | ||
| 119 | + </el-col> | ||
| 120 | + </el-row> | ||
| 121 | + | ||
| 122 | + <el-row :gutter="20"> | ||
| 123 | + <el-col :span="24"> | ||
| 124 | + <el-form-item :label="$t('addEquipmentAccount.remark')"> | ||
| 125 | + <el-input v-model.trim="addEquipmentAccountInfo.remark" type="textarea" | ||
| 126 | + :placeholder="$t('addEquipmentAccount.remarkPlaceholder')" :rows="3" /> | ||
| 127 | + </el-form-item> | ||
| 128 | + </el-col> | ||
| 129 | + </el-row> | ||
| 130 | + </el-col> | ||
| 131 | + </el-row> | ||
| 132 | + | ||
| 133 | + <el-row :gutter="20"> | ||
| 134 | + <el-col :span="24" style="text-align: right; margin-top: 20px;"> | ||
| 135 | + <el-button type="warning" @click="handleCancel"> | ||
| 136 | + {{ $t('common.cancel') }} | ||
| 137 | + </el-button> | ||
| 138 | + <el-button type="primary" @click="handleSave"> | ||
| 139 | + {{ $t('common.save') }} | ||
| 140 | + </el-button> | ||
| 141 | + </el-col> | ||
| 142 | + </el-row> | ||
| 143 | + </el-form> | ||
| 144 | + </el-card> | ||
| 145 | + </div> | ||
| 146 | +</template> | ||
| 147 | + | ||
| 148 | +<script> | ||
| 149 | +import { saveEquipmentAccount } from '@/api/machine/addEquipmentAccountApi' | ||
| 150 | +import { getDict } from '@/api/community/communityApi' | ||
| 151 | +import { getCommunityId } from '@/api/community/communityApi' | ||
| 152 | + | ||
| 153 | +export default { | ||
| 154 | + name: 'AddEquipmentAccountList', | ||
| 155 | + data() { | ||
| 156 | + return { | ||
| 157 | + addEquipmentAccountInfo: { | ||
| 158 | + machineId: '', | ||
| 159 | + machineName: '', | ||
| 160 | + machineCode: '', | ||
| 161 | + brand: '', | ||
| 162 | + model: '', | ||
| 163 | + typeId: '', | ||
| 164 | + locationDetail: '', | ||
| 165 | + locationObjId: '', | ||
| 166 | + locationObjName: '', | ||
| 167 | + firstEnableTime: '', | ||
| 168 | + warrantyDeadline: '', | ||
| 169 | + usefulLife: '', | ||
| 170 | + importanceLevel: '', | ||
| 171 | + importanceLevels: [], | ||
| 172 | + state: '', | ||
| 173 | + purchasePrice: '', | ||
| 174 | + netWorth: '', | ||
| 175 | + useOrgId: '', | ||
| 176 | + useOrgName: '', | ||
| 177 | + useUserId: '', | ||
| 178 | + useUserName: '', | ||
| 179 | + useUseTel: '', | ||
| 180 | + chargeOrgId: '', | ||
| 181 | + chargeOrgName: '', | ||
| 182 | + chargeOrgTel: '', | ||
| 183 | + chargeUseId: '', | ||
| 184 | + chargeUseName: '', | ||
| 185 | + remark: '', | ||
| 186 | + useStatus: [] | ||
| 187 | + } | ||
| 188 | + } | ||
| 189 | + }, | ||
| 190 | + created() { | ||
| 191 | + this.initData() | ||
| 192 | + }, | ||
| 193 | + methods: { | ||
| 194 | + async initData() { | ||
| 195 | + this.addEquipmentAccountInfo.typeId = this.$route.query.typeId | ||
| 196 | + this.communityId = await getCommunityId() | ||
| 197 | + | ||
| 198 | + try { | ||
| 199 | + const importanceLevels = await getDict('equipment_account', 'importance_level') | ||
| 200 | + const useStatus = await getDict('equipment_account', 'state') | ||
| 201 | + this.addEquipmentAccountInfo.importanceLevels = importanceLevels | ||
| 202 | + this.addEquipmentAccountInfo.useStatus = useStatus | ||
| 203 | + } catch (error) { | ||
| 204 | + console.error('Failed to fetch dict data:', error) | ||
| 205 | + } | ||
| 206 | + }, | ||
| 207 | + validateForm() { | ||
| 208 | + const requiredFields = [ | ||
| 209 | + { field: 'machineName', message: this.$t('addEquipmentAccount.validate.machineNameRequired') }, | ||
| 210 | + { field: 'machineCode', message: this.$t('addEquipmentAccount.validate.machineCodeRequired') }, | ||
| 211 | + { field: 'importanceLevel', message: this.$t('addEquipmentAccount.validate.importanceLevelRequired') }, | ||
| 212 | + { field: 'state', message: this.$t('addEquipmentAccount.validate.stateRequired') }, | ||
| 213 | + { field: 'useUserName', message: this.$t('addEquipmentAccount.validate.useUserNameRequired') }, | ||
| 214 | + { field: 'chargeUseName', message: this.$t('addEquipmentAccount.validate.chargeUseNameRequired') } | ||
| 215 | + ] | ||
| 216 | + | ||
| 217 | + for (const item of requiredFields) { | ||
| 218 | + if (!this.addEquipmentAccountInfo[item.field]) { | ||
| 219 | + this.$message.error(item.message) | ||
| 220 | + return false | ||
| 221 | + } | ||
| 222 | + } | ||
| 223 | + | ||
| 224 | + return true | ||
| 225 | + }, | ||
| 226 | + async handleSave() { | ||
| 227 | + if (!this.validateForm()) return | ||
| 228 | + | ||
| 229 | + try { | ||
| 230 | + const params = { | ||
| 231 | + ...this.addEquipmentAccountInfo, | ||
| 232 | + communityId: this.communityId | ||
| 233 | + } | ||
| 234 | + const res = await saveEquipmentAccount(params) | ||
| 235 | + | ||
| 236 | + if (res.code === 0) { | ||
| 237 | + this.$message.success(this.$t('addEquipmentAccount.saveSuccess')) | ||
| 238 | + this.$router.go(-1) | ||
| 239 | + } else { | ||
| 240 | + this.$message.error(res.msg) | ||
| 241 | + } | ||
| 242 | + } catch (error) { | ||
| 243 | + console.error('Save equipment account failed:', error) | ||
| 244 | + this.$message.error(this.$t('addEquipmentAccount.saveFailed')) | ||
| 245 | + } | ||
| 246 | + }, | ||
| 247 | + handleCancel() { | ||
| 248 | + this.$router.go(-1) | ||
| 249 | + } | ||
| 250 | + } | ||
| 251 | +} | ||
| 252 | +</script> | ||
| 253 | + | ||
| 254 | +<style lang="scss" scoped> | ||
| 255 | +.add-equipment-account-container { | ||
| 256 | + padding: 20px; | ||
| 257 | + | ||
| 258 | + .box-card { | ||
| 259 | + width: 100%; | ||
| 260 | + } | ||
| 261 | + | ||
| 262 | + .el-form-item { | ||
| 263 | + margin-bottom: 22px; | ||
| 264 | + } | ||
| 265 | +} | ||
| 266 | +</style> | ||
| 0 | \ No newline at end of file | 267 | \ No newline at end of file |
src/views/machine/editEquipmentAccountLang.js
0 → 100644
| 1 | +export const messages = { | ||
| 2 | + en: { | ||
| 3 | + editEquipmentAccount: { | ||
| 4 | + title: 'Edit Equipment', | ||
| 5 | + machineName: 'Equipment Name', | ||
| 6 | + machineNamePlaceholder: 'Required, please enter equipment name', | ||
| 7 | + machineCode: 'Equipment Code', | ||
| 8 | + machineCodePlaceholder: 'Required, please enter equipment code', | ||
| 9 | + importanceLevel: 'Importance Level', | ||
| 10 | + importanceLevelPlaceholder: 'Required, please select importance level', | ||
| 11 | + state: 'Status', | ||
| 12 | + statePlaceholder: 'Required, please select status', | ||
| 13 | + brand: 'Brand', | ||
| 14 | + brandPlaceholder: 'Optional, please enter brand', | ||
| 15 | + model: 'Model', | ||
| 16 | + modelPlaceholder: 'Optional, please enter model', | ||
| 17 | + netWorth: 'Net Worth', | ||
| 18 | + netWorthPlaceholder: 'Optional, please enter net worth', | ||
| 19 | + locationDetail: 'Location Detail', | ||
| 20 | + locationDetailPlaceholder: 'Optional, please enter location detail', | ||
| 21 | + firstEnableTime: 'First Enable Time', | ||
| 22 | + firstEnableTimePlaceholder: 'Optional, please select first enable time', | ||
| 23 | + warrantyDeadline: 'Warranty Deadline', | ||
| 24 | + warrantyDeadlinePlaceholder: 'Optional, please select warranty deadline', | ||
| 25 | + usefulLife: 'Useful Life (Years)', | ||
| 26 | + usefulLifePlaceholder: 'Optional, please enter useful life', | ||
| 27 | + purchasePrice: 'Purchase Price', | ||
| 28 | + purchasePricePlaceholder: 'Optional, please enter purchase price', | ||
| 29 | + useUserName: 'User', | ||
| 30 | + useUserNamePlaceholder: 'Required, please select user', | ||
| 31 | + chargeUseName: 'Responsible Person', | ||
| 32 | + chargeUseNamePlaceholder: 'Required, please select responsible person', | ||
| 33 | + remark: 'Remark', | ||
| 34 | + remarkPlaceholder: 'Optional, please enter remark' | ||
| 35 | + } | ||
| 36 | + }, | ||
| 37 | + zh: { | ||
| 38 | + editEquipmentAccount: { | ||
| 39 | + title: '修改设备', | ||
| 40 | + machineName: '设备名称', | ||
| 41 | + machineNamePlaceholder: '必填,请填写设备名称', | ||
| 42 | + machineCode: '设备编码', | ||
| 43 | + machineCodePlaceholder: '必填,请填写设备编码', | ||
| 44 | + importanceLevel: '重要等级', | ||
| 45 | + importanceLevelPlaceholder: '必填,请选择重要等级', | ||
| 46 | + state: '使用状态', | ||
| 47 | + statePlaceholder: '必填,请选择使用状态', | ||
| 48 | + brand: '设备品牌', | ||
| 49 | + brandPlaceholder: '选填,请填写设备品牌', | ||
| 50 | + model: '设备型号', | ||
| 51 | + modelPlaceholder: '选填,请填写设备型号', | ||
| 52 | + netWorth: '资产净值', | ||
| 53 | + netWorthPlaceholder: '选填,请填写资产净值', | ||
| 54 | + locationDetail: '位置详情', | ||
| 55 | + locationDetailPlaceholder: '选填,请填写位置详情', | ||
| 56 | + firstEnableTime: '首次启用时间', | ||
| 57 | + firstEnableTimePlaceholder: '选填,请填写首次启用时间', | ||
| 58 | + warrantyDeadline: '保修截止日期', | ||
| 59 | + warrantyDeadlinePlaceholder: '选填,请填写保修截止日期', | ||
| 60 | + usefulLife: '使用年限(年)', | ||
| 61 | + usefulLifePlaceholder: '选填,请填写使用年限', | ||
| 62 | + purchasePrice: '采购价格', | ||
| 63 | + purchasePricePlaceholder: '选填,请填写采购价格', | ||
| 64 | + useUserName: '使用人', | ||
| 65 | + useUserNamePlaceholder: '必填,请选择使用人', | ||
| 66 | + chargeUseName: '责任人', | ||
| 67 | + chargeUseNamePlaceholder: '必填,请选择责任人', | ||
| 68 | + remark: '备注', | ||
| 69 | + remarkPlaceholder: '选填,请填写备注' | ||
| 70 | + } | ||
| 71 | + } | ||
| 72 | +} | ||
| 0 | \ No newline at end of file | 73 | \ No newline at end of file |
src/views/machine/editEquipmentAccountList.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div class="edit-equipment-account-container"> | ||
| 3 | + <el-card class="box-card"> | ||
| 4 | + <div slot="header" class="clearfix"> | ||
| 5 | + <h5>{{ $t('editEquipmentAccount.title') }}</h5> | ||
| 6 | + </div> | ||
| 7 | + | ||
| 8 | + <el-row :gutter="20"> | ||
| 9 | + <el-col :span="24"> | ||
| 10 | + <el-form label-position="right" label-width="120px"> | ||
| 11 | + <el-row :gutter="20"> | ||
| 12 | + <el-col :span="12"> | ||
| 13 | + <el-form-item :label="$t('editEquipmentAccount.machineName')"> | ||
| 14 | + <el-input v-model.trim="editEquipmentAccountInfo.machineName" | ||
| 15 | + :placeholder="$t('editEquipmentAccount.machineNamePlaceholder')" /> | ||
| 16 | + </el-form-item> | ||
| 17 | + </el-col> | ||
| 18 | + <el-col :span="12"> | ||
| 19 | + <el-form-item :label="$t('editEquipmentAccount.machineCode')"> | ||
| 20 | + <el-input v-model.trim="editEquipmentAccountInfo.machineCode" | ||
| 21 | + :placeholder="$t('editEquipmentAccount.machineCodePlaceholder')" /> | ||
| 22 | + </el-form-item> | ||
| 23 | + </el-col> | ||
| 24 | + </el-row> | ||
| 25 | + | ||
| 26 | + <el-row :gutter="20"> | ||
| 27 | + <el-col :span="12"> | ||
| 28 | + <el-form-item :label="$t('editEquipmentAccount.importanceLevel')"> | ||
| 29 | + <el-select v-model="editEquipmentAccountInfo.importanceLevel" | ||
| 30 | + :placeholder="$t('editEquipmentAccount.importanceLevelPlaceholder')" style="width:100%"> | ||
| 31 | + <el-option v-for="(item, index) in editEquipmentAccountInfo.importanceLevels" :key="index" | ||
| 32 | + :label="item.name" :value="item.statusCd" /> | ||
| 33 | + </el-select> | ||
| 34 | + </el-form-item> | ||
| 35 | + </el-col> | ||
| 36 | + <el-col :span="12"> | ||
| 37 | + <el-form-item :label="$t('editEquipmentAccount.state')"> | ||
| 38 | + <el-select v-model="editEquipmentAccountInfo.state" | ||
| 39 | + :placeholder="$t('editEquipmentAccount.statePlaceholder')" style="width:100%"> | ||
| 40 | + <el-option v-for="(item, index) in editEquipmentAccountInfo.useStatus" :key="index" :label="item.name" | ||
| 41 | + :value="item.statusCd" /> | ||
| 42 | + </el-select> | ||
| 43 | + </el-form-item> | ||
| 44 | + </el-col> | ||
| 45 | + </el-row> | ||
| 46 | + | ||
| 47 | + <el-row :gutter="20"> | ||
| 48 | + <el-col :span="12"> | ||
| 49 | + <el-form-item :label="$t('editEquipmentAccount.brand')"> | ||
| 50 | + <el-input v-model.trim="editEquipmentAccountInfo.brand" | ||
| 51 | + :placeholder="$t('editEquipmentAccount.brandPlaceholder')" /> | ||
| 52 | + </el-form-item> | ||
| 53 | + </el-col> | ||
| 54 | + <el-col :span="12"> | ||
| 55 | + <el-form-item :label="$t('editEquipmentAccount.model')"> | ||
| 56 | + <el-input v-model.trim="editEquipmentAccountInfo.model" | ||
| 57 | + :placeholder="$t('editEquipmentAccount.modelPlaceholder')" /> | ||
| 58 | + </el-form-item> | ||
| 59 | + </el-col> | ||
| 60 | + </el-row> | ||
| 61 | + | ||
| 62 | + <el-row :gutter="20"> | ||
| 63 | + <el-col :span="12"> | ||
| 64 | + <el-form-item :label="$t('editEquipmentAccount.netWorth')"> | ||
| 65 | + <el-input v-model.trim="editEquipmentAccountInfo.netWorth" | ||
| 66 | + :placeholder="$t('editEquipmentAccount.netWorthPlaceholder')" /> | ||
| 67 | + </el-form-item> | ||
| 68 | + </el-col> | ||
| 69 | + <el-col :span="12"> | ||
| 70 | + <el-form-item :label="$t('editEquipmentAccount.locationDetail')"> | ||
| 71 | + <el-input v-model.trim="editEquipmentAccountInfo.locationDetail" | ||
| 72 | + :placeholder="$t('editEquipmentAccount.locationDetailPlaceholder')" /> | ||
| 73 | + </el-form-item> | ||
| 74 | + </el-col> | ||
| 75 | + </el-row> | ||
| 76 | + | ||
| 77 | + <el-row :gutter="20"> | ||
| 78 | + <el-col :span="12"> | ||
| 79 | + <el-form-item :label="$t('editEquipmentAccount.firstEnableTime')"> | ||
| 80 | + <el-date-picker v-model="editEquipmentAccountInfo.firstEnableTime" type="date" value-format="yyyy-MM-dd" | ||
| 81 | + :placeholder="$t('editEquipmentAccount.firstEnableTimePlaceholder')" style="width:100%" /> | ||
| 82 | + </el-form-item> | ||
| 83 | + </el-col> | ||
| 84 | + <el-col :span="12"> | ||
| 85 | + <el-form-item :label="$t('editEquipmentAccount.warrantyDeadline')"> | ||
| 86 | + <el-date-picker v-model="editEquipmentAccountInfo.warrantyDeadline" type="date" value-format="yyyy-MM-dd" | ||
| 87 | + :placeholder="$t('editEquipmentAccount.warrantyDeadlinePlaceholder')" style="width:100%" /> | ||
| 88 | + </el-form-item> | ||
| 89 | + </el-col> | ||
| 90 | + </el-row> | ||
| 91 | + | ||
| 92 | + <el-row :gutter="20"> | ||
| 93 | + <el-col :span="12"> | ||
| 94 | + <el-form-item :label="$t('editEquipmentAccount.usefulLife')"> | ||
| 95 | + <el-input v-model.trim="editEquipmentAccountInfo.usefulLife" | ||
| 96 | + :placeholder="$t('editEquipmentAccount.usefulLifePlaceholder')" /> | ||
| 97 | + </el-form-item> | ||
| 98 | + </el-col> | ||
| 99 | + <el-col :span="12"> | ||
| 100 | + <el-form-item :label="$t('editEquipmentAccount.purchasePrice')"> | ||
| 101 | + <el-input v-model.trim="editEquipmentAccountInfo.purchasePrice" | ||
| 102 | + :placeholder="$t('editEquipmentAccount.purchasePricePlaceholder')" /> | ||
| 103 | + </el-form-item> | ||
| 104 | + </el-col> | ||
| 105 | + </el-row> | ||
| 106 | + | ||
| 107 | + <el-row :gutter="20"> | ||
| 108 | + <el-col :span="12"> | ||
| 109 | + <el-form-item :label="$t('editEquipmentAccount.useUserName')"> | ||
| 110 | + <el-input v-model.trim="editEquipmentAccountInfo.useUserName" | ||
| 111 | + :placeholder="$t('editEquipmentAccount.useUserNamePlaceholder')" /> | ||
| 112 | + </el-form-item> | ||
| 113 | + </el-col> | ||
| 114 | + <el-col :span="12"> | ||
| 115 | + <el-form-item :label="$t('editEquipmentAccount.chargeUseName')"> | ||
| 116 | + <el-input v-model.trim="editEquipmentAccountInfo.chargeUseName" | ||
| 117 | + :placeholder="$t('editEquipmentAccount.chargeUseNamePlaceholder')" /> | ||
| 118 | + </el-form-item> | ||
| 119 | + </el-col> | ||
| 120 | + </el-row> | ||
| 121 | + | ||
| 122 | + <el-row :gutter="20"> | ||
| 123 | + <el-col :span="24"> | ||
| 124 | + <el-form-item :label="$t('editEquipmentAccount.remark')"> | ||
| 125 | + <el-input v-model.trim="editEquipmentAccountInfo.remark" type="textarea" | ||
| 126 | + :placeholder="$t('editEquipmentAccount.remarkPlaceholder')" /> | ||
| 127 | + </el-form-item> | ||
| 128 | + </el-col> | ||
| 129 | + </el-row> | ||
| 130 | + | ||
| 131 | + <el-row> | ||
| 132 | + <el-col :span="24" style="text-align: right"> | ||
| 133 | + <el-button type="warning" @click="_goBack"> | ||
| 134 | + {{ $t('common.cancel') }} | ||
| 135 | + </el-button> | ||
| 136 | + <el-button type="primary" @click="saveEquipmentAccountInfo"> | ||
| 137 | + {{ $t('common.save') }} | ||
| 138 | + </el-button> | ||
| 139 | + </el-col> | ||
| 140 | + </el-row> | ||
| 141 | + </el-form> | ||
| 142 | + </el-col> | ||
| 143 | + </el-row> | ||
| 144 | + </el-card> | ||
| 145 | + </div> | ||
| 146 | +</template> | ||
| 147 | + | ||
| 148 | +<script> | ||
| 149 | +import { updateEquipmentAccount, listEquipmentAccount } from '@/api/machine/editEquipmentAccountApi' | ||
| 150 | +import { getDict } from '@/api/community/communityApi' | ||
| 151 | +import { getCommunityId } from '@/api/community/communityApi' | ||
| 152 | + | ||
| 153 | +export default { | ||
| 154 | + name: 'EditEquipmentAccountList', | ||
| 155 | + data() { | ||
| 156 | + return { | ||
| 157 | + editEquipmentAccountInfo: { | ||
| 158 | + machineId: '', | ||
| 159 | + machineName: '', | ||
| 160 | + machineCode: '', | ||
| 161 | + brand: '', | ||
| 162 | + model: '', | ||
| 163 | + typeId: '', | ||
| 164 | + locationDetail: '', | ||
| 165 | + locationObjId: '', | ||
| 166 | + locationObjName: '', | ||
| 167 | + firstEnableTime: '', | ||
| 168 | + warrantyDeadline: '', | ||
| 169 | + usefulLife: '', | ||
| 170 | + importanceLevel: '', | ||
| 171 | + importanceLevels: [], | ||
| 172 | + state: '', | ||
| 173 | + purchasePrice: '', | ||
| 174 | + netWorth: '', | ||
| 175 | + useOrgId: '', | ||
| 176 | + useOrgName: '', | ||
| 177 | + useUserId: '', | ||
| 178 | + useUserName: '', | ||
| 179 | + useUseTel: '', | ||
| 180 | + chargeOrgId: '', | ||
| 181 | + chargeOrgName: '', | ||
| 182 | + chargeOrgTel: '', | ||
| 183 | + chargeUseId: '', | ||
| 184 | + chargeUseName: '', | ||
| 185 | + remark: '', | ||
| 186 | + useStatus: [] | ||
| 187 | + }, | ||
| 188 | + communityId: '' | ||
| 189 | + } | ||
| 190 | + }, | ||
| 191 | + created() { | ||
| 192 | + this.communityId = getCommunityId() | ||
| 193 | + this.editEquipmentAccountInfo.machineId = this.$route.query.machineId | ||
| 194 | + this.getDictData() | ||
| 195 | + this._listEquipmentAccounts() | ||
| 196 | + }, | ||
| 197 | + methods: { | ||
| 198 | + async getDictData() { | ||
| 199 | + try { | ||
| 200 | + const importanceLevels = await getDict('equipment_account', 'importance_level') | ||
| 201 | + const useStatus = await getDict('equipment_account', 'state') | ||
| 202 | + this.editEquipmentAccountInfo.importanceLevels = importanceLevels | ||
| 203 | + this.editEquipmentAccountInfo.useStatus = useStatus | ||
| 204 | + } catch (error) { | ||
| 205 | + console.error('获取字典数据失败:', error) | ||
| 206 | + } | ||
| 207 | + }, | ||
| 208 | + async _listEquipmentAccounts() { | ||
| 209 | + try { | ||
| 210 | + const params = { | ||
| 211 | + page: 1, | ||
| 212 | + row: 1, | ||
| 213 | + communityId: this.communityId, | ||
| 214 | + machineId: this.editEquipmentAccountInfo.machineId | ||
| 215 | + } | ||
| 216 | + const { data } = await listEquipmentAccount(params) | ||
| 217 | + Object.assign(this.editEquipmentAccountInfo, data[0]) | ||
| 218 | + } catch (error) { | ||
| 219 | + console.error('获取设备信息失败:', error) | ||
| 220 | + } | ||
| 221 | + }, | ||
| 222 | + editEquipmentAccountValidate() { | ||
| 223 | + // 这里应该添加表单验证逻辑 | ||
| 224 | + return true | ||
| 225 | + }, | ||
| 226 | + async saveEquipmentAccountInfo() { | ||
| 227 | + if (!this.editEquipmentAccountValidate()) { | ||
| 228 | + return | ||
| 229 | + } | ||
| 230 | + try { | ||
| 231 | + this.editEquipmentAccountInfo.communityId = this.communityId | ||
| 232 | + const res = await updateEquipmentAccount(this.editEquipmentAccountInfo) | ||
| 233 | + if (res.code === 0) { | ||
| 234 | + this.$message.success(this.$t('common.updateSuccess')) | ||
| 235 | + this._goBack() | ||
| 236 | + } else { | ||
| 237 | + this.$message.error(res.msg) | ||
| 238 | + } | ||
| 239 | + } catch (error) { | ||
| 240 | + console.error('保存设备信息失败:', error) | ||
| 241 | + this.$message.error(this.$t('common.updateError')) | ||
| 242 | + } | ||
| 243 | + }, | ||
| 244 | + _goBack() { | ||
| 245 | + this.$router.go(-1) | ||
| 246 | + } | ||
| 247 | + } | ||
| 248 | +} | ||
| 249 | +</script> | ||
| 250 | + | ||
| 251 | +<style lang="scss" scoped> | ||
| 252 | +.edit-equipment-account-container { | ||
| 253 | + padding: 20px; | ||
| 254 | + | ||
| 255 | + .box-card { | ||
| 256 | + margin-bottom: 20px; | ||
| 257 | + } | ||
| 258 | + | ||
| 259 | + .el-form-item { | ||
| 260 | + margin-bottom: 22px; | ||
| 261 | + } | ||
| 262 | +} | ||
| 263 | +</style> | ||
| 0 | \ No newline at end of file | 264 | \ No newline at end of file |
src/views/machine/equipmentAccountDetailLang.js
0 → 100644
| 1 | +export const messages = { | ||
| 2 | + en: { | ||
| 3 | + equipmentAccountDetail: { | ||
| 4 | + title: 'Equipment Details', | ||
| 5 | + back: 'Back', | ||
| 6 | + print: 'Print', | ||
| 7 | + machineName: 'Equipment Name', | ||
| 8 | + machineCode: 'Equipment Code', | ||
| 9 | + levelName: 'Importance Level', | ||
| 10 | + stateName: 'Usage Status', | ||
| 11 | + brand: 'Equipment Brand', | ||
| 12 | + model: 'Equipment Model', | ||
| 13 | + locationDetail: 'Location Details', | ||
| 14 | + firstEnableTime: 'First Enable Time', | ||
| 15 | + warrantyDeadline: 'Warranty Deadline', | ||
| 16 | + usefulLife: 'Useful Life (Years)', | ||
| 17 | + purchasePrice: 'Purchase Price', | ||
| 18 | + netWorth: 'Net Worth', | ||
| 19 | + useUserName: 'User', | ||
| 20 | + chargeUseName: 'Responsible Person', | ||
| 21 | + remark: 'Remark', | ||
| 22 | + logTitle: 'Equipment Logs', | ||
| 23 | + serialNumber: 'No.', | ||
| 24 | + operatingCode: 'Operation Code', | ||
| 25 | + operatingDescriptor: 'Operation Description', | ||
| 26 | + createTime: 'Operation Time', | ||
| 27 | + yuan: 'Yuan', | ||
| 28 | + illegalOperation: 'Illegal operation', | ||
| 29 | + dataError: 'Data error' | ||
| 30 | + } | ||
| 31 | + }, | ||
| 32 | + zh: { | ||
| 33 | + equipmentAccountDetail: { | ||
| 34 | + title: '设备详情', | ||
| 35 | + back: '返回', | ||
| 36 | + print: '打印', | ||
| 37 | + machineName: '设备名称', | ||
| 38 | + machineCode: '设备编码', | ||
| 39 | + levelName: '重要等级', | ||
| 40 | + stateName: '使用状态', | ||
| 41 | + brand: '设备品牌', | ||
| 42 | + model: '设备型号', | ||
| 43 | + locationDetail: '位置详情', | ||
| 44 | + firstEnableTime: '首次启用时间', | ||
| 45 | + warrantyDeadline: '保修截止日期', | ||
| 46 | + usefulLife: '使用年限(年)', | ||
| 47 | + purchasePrice: '采购价格', | ||
| 48 | + netWorth: '资产净值', | ||
| 49 | + useUserName: '使用人', | ||
| 50 | + chargeUseName: '责任人', | ||
| 51 | + remark: '备注', | ||
| 52 | + logTitle: '设备日志', | ||
| 53 | + serialNumber: '序号', | ||
| 54 | + operatingCode: '操作编码', | ||
| 55 | + operatingDescriptor: '操作描述', | ||
| 56 | + createTime: '操作时间', | ||
| 57 | + yuan: '元', | ||
| 58 | + illegalOperation: '非法操作', | ||
| 59 | + dataError: '数据异常' | ||
| 60 | + } | ||
| 61 | + } | ||
| 62 | +} | ||
| 0 | \ No newline at end of file | 63 | \ No newline at end of file |
src/views/machine/equipmentAccountDetailList.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div class="equipment-account-detail-container"> | ||
| 3 | + <el-card class="box-card"> | ||
| 4 | + <div slot="header" class="flex justify-between"> | ||
| 5 | + <span>{{ $t('equipmentAccountDetail.title') }}</span> | ||
| 6 | + <div class="card-header-actions"> | ||
| 7 | + <el-button size="small" @click="_goBack()"> | ||
| 8 | + <i class="el-icon-close"></i> | ||
| 9 | + {{ $t('equipmentAccountDetail.back') }} | ||
| 10 | + </el-button> | ||
| 11 | + <el-button type="primary" size="small" @click="_printEquipmentDetail()"> | ||
| 12 | + <i class="el-icon-printer"></i> | ||
| 13 | + {{ $t('equipmentAccountDetail.print') }} | ||
| 14 | + </el-button> | ||
| 15 | + </div> | ||
| 16 | + </div> | ||
| 17 | + | ||
| 18 | + <el-row :gutter="20"> | ||
| 19 | + <el-col :span="8"> | ||
| 20 | + <div class="form-item"> | ||
| 21 | + <label>{{ $t('equipmentAccountDetail.machineName') }}:</label> | ||
| 22 | + <span>{{ equipmentAccountDetail.machineName }}</span> | ||
| 23 | + </div> | ||
| 24 | + </el-col> | ||
| 25 | + <el-col :span="8"> | ||
| 26 | + <div class="form-item"> | ||
| 27 | + <label>{{ $t('equipmentAccountDetail.machineCode') }}:</label> | ||
| 28 | + <span>{{ equipmentAccountDetail.machineCode }}</span> | ||
| 29 | + </div> | ||
| 30 | + </el-col> | ||
| 31 | + <el-col :span="8"> | ||
| 32 | + <div class="form-item"> | ||
| 33 | + <label>{{ $t('equipmentAccountDetail.levelName') }}:</label> | ||
| 34 | + <span>{{ equipmentAccountDetail.levelName }}</span> | ||
| 35 | + </div> | ||
| 36 | + </el-col> | ||
| 37 | + </el-row> | ||
| 38 | + | ||
| 39 | + <el-row :gutter="20"> | ||
| 40 | + <el-col :span="8"> | ||
| 41 | + <div class="form-item"> | ||
| 42 | + <label>{{ $t('equipmentAccountDetail.stateName') }}:</label> | ||
| 43 | + <span>{{ equipmentAccountDetail.stateName }}</span> | ||
| 44 | + </div> | ||
| 45 | + </el-col> | ||
| 46 | + <el-col :span="8"> | ||
| 47 | + <div class="form-item"> | ||
| 48 | + <label>{{ $t('equipmentAccountDetail.brand') }}:</label> | ||
| 49 | + <span>{{ equipmentAccountDetail.brand }}</span> | ||
| 50 | + </div> | ||
| 51 | + </el-col> | ||
| 52 | + <el-col :span="8"> | ||
| 53 | + <div class="form-item"> | ||
| 54 | + <label>{{ $t('equipmentAccountDetail.model') }}:</label> | ||
| 55 | + <span>{{ equipmentAccountDetail.model }}</span> | ||
| 56 | + </div> | ||
| 57 | + </el-col> | ||
| 58 | + </el-row> | ||
| 59 | + | ||
| 60 | + <el-row :gutter="20"> | ||
| 61 | + <el-col :span="8"> | ||
| 62 | + <div class="form-item"> | ||
| 63 | + <label>{{ $t('equipmentAccountDetail.locationDetail') }}:</label> | ||
| 64 | + <span>{{ equipmentAccountDetail.locationDetail }}</span> | ||
| 65 | + </div> | ||
| 66 | + </el-col> | ||
| 67 | + <el-col :span="8"> | ||
| 68 | + <div class="form-item"> | ||
| 69 | + <label>{{ $t('equipmentAccountDetail.firstEnableTime') }}:</label> | ||
| 70 | + <span>{{ equipmentAccountDetail.firstEnableTime }}</span> | ||
| 71 | + </div> | ||
| 72 | + </el-col> | ||
| 73 | + <el-col :span="8"> | ||
| 74 | + <div class="form-item"> | ||
| 75 | + <label>{{ $t('equipmentAccountDetail.warrantyDeadline') }}:</label> | ||
| 76 | + <span>{{ equipmentAccountDetail.warrantyDeadline }}</span> | ||
| 77 | + </div> | ||
| 78 | + </el-col> | ||
| 79 | + </el-row> | ||
| 80 | + | ||
| 81 | + <el-row :gutter="20"> | ||
| 82 | + <el-col :span="8"> | ||
| 83 | + <div class="form-item"> | ||
| 84 | + <label>{{ $t('equipmentAccountDetail.usefulLife') }}:</label> | ||
| 85 | + <span>{{ equipmentAccountDetail.usefulLife }}</span> | ||
| 86 | + </div> | ||
| 87 | + </el-col> | ||
| 88 | + <el-col :span="8"> | ||
| 89 | + <div class="form-item"> | ||
| 90 | + <label>{{ $t('equipmentAccountDetail.purchasePrice') }}:</label> | ||
| 91 | + <span>{{ equipmentAccountDetail.purchasePrice }} {{ $t('equipmentAccountDetail.yuan') }}</span> | ||
| 92 | + </div> | ||
| 93 | + </el-col> | ||
| 94 | + <el-col :span="8"> | ||
| 95 | + <div class="form-item"> | ||
| 96 | + <label>{{ $t('equipmentAccountDetail.netWorth') }}:</label> | ||
| 97 | + <span>{{ equipmentAccountDetail.netWorth }} {{ $t('equipmentAccountDetail.yuan') }}</span> | ||
| 98 | + </div> | ||
| 99 | + </el-col> | ||
| 100 | + </el-row> | ||
| 101 | + | ||
| 102 | + <el-row :gutter="20"> | ||
| 103 | + <el-col :span="8"> | ||
| 104 | + <div class="form-item"> | ||
| 105 | + <label>{{ $t('equipmentAccountDetail.useUserName') }}:</label> | ||
| 106 | + <span>{{ equipmentAccountDetail.useUserName }}</span> | ||
| 107 | + </div> | ||
| 108 | + </el-col> | ||
| 109 | + <el-col :span="8"> | ||
| 110 | + <div class="form-item"> | ||
| 111 | + <label>{{ $t('equipmentAccountDetail.chargeUseName') }}:</label> | ||
| 112 | + <span>{{ equipmentAccountDetail.chargeUseName }}</span> | ||
| 113 | + </div> | ||
| 114 | + </el-col> | ||
| 115 | + </el-row> | ||
| 116 | + | ||
| 117 | + <el-row :gutter="20"> | ||
| 118 | + <el-col :span="16"> | ||
| 119 | + <div class="form-item"> | ||
| 120 | + <label>{{ $t('equipmentAccountDetail.remark') }}:</label> | ||
| 121 | + <span>{{ equipmentAccountDetail.remark }}</span> | ||
| 122 | + </div> | ||
| 123 | + </el-col> | ||
| 124 | + </el-row> | ||
| 125 | + | ||
| 126 | + </el-card> | ||
| 127 | + <el-card> | ||
| 128 | + <el-row :gutter="20" class="mt-20"> | ||
| 129 | + <el-col :span="24"> | ||
| 130 | + <el-card shadow="never"> | ||
| 131 | + <div slot="header" class="flex justify-between"> | ||
| 132 | + <span>{{ $t('equipmentAccountDetail.logTitle') }}</span> | ||
| 133 | + </div> | ||
| 134 | + <el-table :data="equipmentAccountDetail.elogs" border style="width: 100%"> | ||
| 135 | + <el-table-column type="index" :label="$t('equipmentAccountDetail.serialNumber')" width="80" | ||
| 136 | + align="center" /> | ||
| 137 | + <el-table-column prop="operatingCode" :label="$t('equipmentAccountDetail.operatingCode')" align="center" /> | ||
| 138 | + <el-table-column prop="operatingDescriptor" :label="$t('equipmentAccountDetail.operatingDescriptor')" | ||
| 139 | + align="center" /> | ||
| 140 | + <el-table-column prop="createTime" :label="$t('equipmentAccountDetail.createTime')" align="center" /> | ||
| 141 | + <el-table-column prop="remark" :label="$t('equipmentAccountDetail.remark')" align="center" /> | ||
| 142 | + </el-table> | ||
| 143 | + </el-card> | ||
| 144 | + </el-col> | ||
| 145 | + </el-row> | ||
| 146 | + </el-card> | ||
| 147 | + | ||
| 148 | + <view-image ref="viewImage" /> | ||
| 149 | + </div> | ||
| 150 | +</template> | ||
| 151 | + | ||
| 152 | +<script> | ||
| 153 | +import { getEquipmentAccountDetail, getEquipmentLogs } from '@/api/machine/equipmentAccountDetailApi' | ||
| 154 | +import ViewImage from '@/components/system/viewImage' | ||
| 155 | +import { getCommunityId } from '@/api/community/communityApi' | ||
| 156 | + | ||
| 157 | +export default { | ||
| 158 | + name: 'EquipmentAccountDetailList', | ||
| 159 | + components: { | ||
| 160 | + ViewImage | ||
| 161 | + }, | ||
| 162 | + data() { | ||
| 163 | + return { | ||
| 164 | + equipmentAccountDetail: { | ||
| 165 | + machineId: '', | ||
| 166 | + machineName: '', | ||
| 167 | + machineCode: '', | ||
| 168 | + brand: '', | ||
| 169 | + model: '', | ||
| 170 | + locationDetail: '', | ||
| 171 | + firstEnableTime: '', | ||
| 172 | + warrantyDeadline: '', | ||
| 173 | + usefulLife: '', | ||
| 174 | + importanceLevel: '', | ||
| 175 | + state: '', | ||
| 176 | + stateName: '', | ||
| 177 | + levelName: '', | ||
| 178 | + purchasePrice: '', | ||
| 179 | + netWorth: '', | ||
| 180 | + useOrgId: '', | ||
| 181 | + useOrgName: '', | ||
| 182 | + useUserId: '', | ||
| 183 | + useUserName: '', | ||
| 184 | + useUseTel: '', | ||
| 185 | + chargeOrgId: '', | ||
| 186 | + chargeOrgName: '', | ||
| 187 | + chargeOrgTel: '', | ||
| 188 | + chargeUseId: '', | ||
| 189 | + chargeUseName: '', | ||
| 190 | + remark: '', | ||
| 191 | + elogs: [] | ||
| 192 | + }, | ||
| 193 | + communityId: '' | ||
| 194 | + } | ||
| 195 | + }, | ||
| 196 | + created() { | ||
| 197 | + this.communityId = getCommunityId() | ||
| 198 | + const machineId = this.$route.query.machineId | ||
| 199 | + if (!machineId) { | ||
| 200 | + this.$message.error(this.$t('equipmentAccountDetail.illegalOperation')) | ||
| 201 | + this.$router.push('/machine/equipmentAccount') | ||
| 202 | + return | ||
| 203 | + } | ||
| 204 | + this.equipmentAccountDetail.machineId = machineId | ||
| 205 | + this._listEquipmentDetail() | ||
| 206 | + }, | ||
| 207 | + methods: { | ||
| 208 | + async _listEquipmentDetail() { | ||
| 209 | + try { | ||
| 210 | + const params = { | ||
| 211 | + page: 1, | ||
| 212 | + row: 1, | ||
| 213 | + communityId: this.communityId, | ||
| 214 | + machineId: this.equipmentAccountDetail.machineId | ||
| 215 | + } | ||
| 216 | + const { data } = await getEquipmentAccountDetail(params) | ||
| 217 | + if (data.length < 1) { | ||
| 218 | + this.$message.error(this.$t('equipmentAccountDetail.dataError')) | ||
| 219 | + this.$router.push('/machine/equipmentAccount') | ||
| 220 | + return | ||
| 221 | + } | ||
| 222 | + this.equipmentAccountDetail = { ...this.equipmentAccountDetail, ...data[0] } | ||
| 223 | + this._loadEquipmentLogs() | ||
| 224 | + } catch (error) { | ||
| 225 | + console.error('Failed to fetch equipment detail:', error) | ||
| 226 | + } | ||
| 227 | + }, | ||
| 228 | + async _loadEquipmentLogs() { | ||
| 229 | + try { | ||
| 230 | + const params = { | ||
| 231 | + page: 1, | ||
| 232 | + row: 100, | ||
| 233 | + communityId: this.communityId, | ||
| 234 | + machineId: this.equipmentAccountDetail.machineId | ||
| 235 | + } | ||
| 236 | + const { data } = await getEquipmentLogs(params) | ||
| 237 | + this.equipmentAccountDetail.elogs = data | ||
| 238 | + } catch (error) { | ||
| 239 | + console.error('Failed to fetch equipment logs:', error) | ||
| 240 | + } | ||
| 241 | + }, | ||
| 242 | + _goBack() { | ||
| 243 | + this.$router.go(-1) | ||
| 244 | + }, | ||
| 245 | + openFile(photo) { | ||
| 246 | + this.$refs.viewImage.open(photo.url) | ||
| 247 | + }, | ||
| 248 | + _printEquipmentDetail() { | ||
| 249 | + window.open(`/print.html#/pages/property/printEquipmentAccountLabel?machineId=${this.equipmentAccountDetail.machineId}`) | ||
| 250 | + } | ||
| 251 | + } | ||
| 252 | +} | ||
| 253 | +</script> | ||
| 254 | + | ||
| 255 | +<style lang="scss" scoped> | ||
| 256 | +.equipment-account-detail-container { | ||
| 257 | + padding: 20px; | ||
| 258 | + | ||
| 259 | + .box-card { | ||
| 260 | + margin-bottom: 20px; | ||
| 261 | + } | ||
| 262 | + | ||
| 263 | + .card-header-actions { | ||
| 264 | + float: right; | ||
| 265 | + } | ||
| 266 | + | ||
| 267 | + .form-item { | ||
| 268 | + margin-bottom: 18px; | ||
| 269 | + text-align: left; | ||
| 270 | + label { | ||
| 271 | + margin-right: 10px; | ||
| 272 | + } | ||
| 273 | + | ||
| 274 | + span { | ||
| 275 | + color: #606266; | ||
| 276 | + } | ||
| 277 | + } | ||
| 278 | + | ||
| 279 | + .mt-20 { | ||
| 280 | + margin-top: 20px; | ||
| 281 | + } | ||
| 282 | +} | ||
| 283 | +</style> | ||
| 0 | \ No newline at end of file | 284 | \ No newline at end of file |
src/views/machine/equipmentAccountLang.js
0 → 100644
| 1 | +export const messages = { | ||
| 2 | + en: { | ||
| 3 | + equipmentAccount: { | ||
| 4 | + addEquipment: 'Add Equipment', | ||
| 5 | + batchPrint: 'Batch Print', | ||
| 6 | + searchCondition: 'Search Condition', | ||
| 7 | + hide: 'Hide', | ||
| 8 | + more: 'More', | ||
| 9 | + machineName: 'Equipment Name', | ||
| 10 | + machineNamePlaceholder: 'Please enter equipment name', | ||
| 11 | + machineCode: 'Equipment Code', | ||
| 12 | + machineCodePlaceholder: 'Please enter equipment code', | ||
| 13 | + state: 'Status', | ||
| 14 | + selectState: 'Please select status', | ||
| 15 | + importanceLevel: 'Importance Level', | ||
| 16 | + selectImportanceLevel: 'Please select importance level', | ||
| 17 | + newLocation: 'New Location', | ||
| 18 | + selectLocation: 'Please select location', | ||
| 19 | + selectLocationFirst: 'Please select location first', | ||
| 20 | + moveEquipment: 'Move Equipment', | ||
| 21 | + confirmOperation: 'Confirm Operation', | ||
| 22 | + confirmDelete: 'Are you sure to delete this equipment?', | ||
| 23 | + viewEquipment: 'View Equipment', | ||
| 24 | + printLabel: 'Print Label', | ||
| 25 | + printQty: 'Print Quantity', | ||
| 26 | + printPreview: 'Print Preview', | ||
| 27 | + importEquipment: 'Import Equipment', | ||
| 28 | + selectFile: 'Select File', | ||
| 29 | + fileTip: 'Only .xls, .xlsx files can be uploaded, and no more than 2MB', | ||
| 30 | + downloadTemplate: 'Download Template', | ||
| 31 | + downloadTip1: 'Please download', | ||
| 32 | + downloadTip2: 'to prepare data before uploading', | ||
| 33 | + selectFileFirst: 'Please select file first', | ||
| 34 | + invalidFileType: 'Invalid file type, only .xls, .xlsx files are allowed', | ||
| 35 | + fileSizeExceed: 'File size cannot exceed 2MB', | ||
| 36 | + selectTypeFirst: 'Please select equipment type first', | ||
| 37 | + importSuccess: 'Import successfully', | ||
| 38 | + stateDescription: 'Equipment status: in use, out of service, etc.', | ||
| 39 | + brand: 'Brand', | ||
| 40 | + model: 'Model', | ||
| 41 | + locationDetail: 'Location Detail', | ||
| 42 | + firstEnableTime: 'First Enable Time', | ||
| 43 | + warrantyDeadline: 'Warranty Deadline', | ||
| 44 | + usefulLife: 'Useful Life', | ||
| 45 | + purchasePrice: 'Purchase Price', | ||
| 46 | + netWorth: 'Net Worth', | ||
| 47 | + useOrgName: 'Use Department', | ||
| 48 | + useUserName: 'User', | ||
| 49 | + chargeOrgName: 'Responsible Department', | ||
| 50 | + chargeUseName: 'Responsible Person', | ||
| 51 | + remark: 'Remark' | ||
| 52 | + } | ||
| 53 | + }, | ||
| 54 | + zh: { | ||
| 55 | + equipmentAccount: { | ||
| 56 | + addEquipment: '添加设备', | ||
| 57 | + batchPrint: '批量打印', | ||
| 58 | + searchCondition: '查询条件', | ||
| 59 | + hide: '隐藏', | ||
| 60 | + more: '更多', | ||
| 61 | + machineName: '设备名称', | ||
| 62 | + machineNamePlaceholder: '请输入设备名称', | ||
| 63 | + machineCode: '设备编码', | ||
| 64 | + machineCodePlaceholder: '请输入设备编码', | ||
| 65 | + state: '状态', | ||
| 66 | + selectState: '请选择状态', | ||
| 67 | + importanceLevel: '重要等级', | ||
| 68 | + selectImportanceLevel: '请选择重要等级', | ||
| 69 | + newLocation: '新位置', | ||
| 70 | + selectLocation: '请选择位置', | ||
| 71 | + selectLocationFirst: '请先选择位置', | ||
| 72 | + moveEquipment: '移动设备', | ||
| 73 | + confirmOperation: '确认操作', | ||
| 74 | + confirmDelete: '确定删除该设备吗?', | ||
| 75 | + viewEquipment: '查看设备', | ||
| 76 | + printLabel: '打印标签', | ||
| 77 | + printQty: '打印数量', | ||
| 78 | + printPreview: '打印预览', | ||
| 79 | + importEquipment: '导入设备', | ||
| 80 | + selectFile: '选择文件', | ||
| 81 | + fileTip: '只能上传.xls, .xlsx文件,且不超过2MB', | ||
| 82 | + downloadTemplate: '下载模板', | ||
| 83 | + downloadTip1: '请先下载', | ||
| 84 | + downloadTip2: '准备数据后上传导入', | ||
| 85 | + selectFileFirst: '请先选择文件', | ||
| 86 | + invalidFileType: '文件类型不正确,只能上传.xls, .xlsx文件', | ||
| 87 | + fileSizeExceed: '文件大小不能超过2MB', | ||
| 88 | + selectTypeFirst: '请先选择设备分类', | ||
| 89 | + importSuccess: '导入成功', | ||
| 90 | + stateDescription: '设备状态分为:使用中、停用中等状态', | ||
| 91 | + brand: '品牌', | ||
| 92 | + model: '型号', | ||
| 93 | + locationDetail: '位置详情', | ||
| 94 | + firstEnableTime: '首次启用时间', | ||
| 95 | + warrantyDeadline: '保修截止日期', | ||
| 96 | + usefulLife: '使用年限', | ||
| 97 | + purchasePrice: '采购价格', | ||
| 98 | + netWorth: '资产净值', | ||
| 99 | + useOrgName: '使用部门', | ||
| 100 | + useUserName: '使用人', | ||
| 101 | + chargeOrgName: '责任部门', | ||
| 102 | + chargeUseName: '责任人', | ||
| 103 | + remark: '备注' | ||
| 104 | + } | ||
| 105 | + } | ||
| 106 | +} | ||
| 0 | \ No newline at end of file | 107 | \ No newline at end of file |
src/views/machine/equipmentAccountList.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div class="equipment-account-container"> | ||
| 3 | + <el-card class="box-card"> | ||
| 4 | + <div class="operation-wrapper text-left"> | ||
| 5 | + <el-button type="primary" size="small" @click="openAddEquipmentAccountModal"> | ||
| 6 | + <i class="el-icon-plus"></i>{{ $t('equipmentAccount.addEquipment') }} | ||
| 7 | + </el-button> | ||
| 8 | + <el-button type="primary" size="small" @click="printEquipmentAccounts"> | ||
| 9 | + <i class="el-icon-printer"></i>{{ $t('equipmentAccount.batchPrint') }} | ||
| 10 | + </el-button> | ||
| 11 | + </div> | ||
| 12 | + </el-card> | ||
| 13 | + | ||
| 14 | + <el-row :gutter="20" class="margin-top"> | ||
| 15 | + <el-col :span="4" class="tree-container"> | ||
| 16 | + <machine-type-tree ref="machineTypeTree" @switchType="handleSwitchType"></machine-type-tree> | ||
| 17 | + </el-col> | ||
| 18 | + <el-col :span="20"> | ||
| 19 | + <el-card class="box-card text-left"> | ||
| 20 | + <div slot="header" class=""> | ||
| 21 | + <span>{{ $t('equipmentAccount.searchCondition') }}</span> | ||
| 22 | + <el-button type="text" style="float: right;" @click="toggleMoreCondition"> | ||
| 23 | + {{ equipmentAccountInfo.moreCondition ? $t('equipmentAccount.hide') : $t('equipmentAccount.more') }} | ||
| 24 | + </el-button> | ||
| 25 | + </div> | ||
| 26 | + <el-form :inline="true" :model="equipmentAccountInfo.conditions" class="search-form"> | ||
| 27 | + <el-form-item :label="$t('equipmentAccount.machineName')"> | ||
| 28 | + <el-input v-model.trim="equipmentAccountInfo.conditions.machineName" | ||
| 29 | + :placeholder="$t('equipmentAccount.machineNamePlaceholder')"></el-input> | ||
| 30 | + </el-form-item> | ||
| 31 | + <el-form-item :label="$t('equipmentAccount.machineCode')"> | ||
| 32 | + <el-input v-model.trim="equipmentAccountInfo.conditions.machineCode" | ||
| 33 | + :placeholder="$t('equipmentAccount.machineCodePlaceholder')"></el-input> | ||
| 34 | + </el-form-item> | ||
| 35 | + <el-form-item :label="$t('equipmentAccount.state')"> | ||
| 36 | + <el-select v-model="equipmentAccountInfo.conditions.state" style="width:100%"> | ||
| 37 | + <el-option :label="$t('equipmentAccount.selectState')" value=""></el-option> | ||
| 38 | + <el-option v-for="item in equipmentAccountInfo.useStatus" :key="item.statusCd" :label="item.name" | ||
| 39 | + :value="item.statusCd"> | ||
| 40 | + </el-option> | ||
| 41 | + </el-select> | ||
| 42 | + </el-form-item> | ||
| 43 | + <el-form-item> | ||
| 44 | + <el-button type="primary" @click="queryEquipmentAccountMethod">{{ $t('common.search') }}</el-button> | ||
| 45 | + <el-button @click="resetEquipmentAccountMethod">{{ $t('common.reset') }}</el-button> | ||
| 46 | + </el-form-item> | ||
| 47 | + </el-form> | ||
| 48 | + | ||
| 49 | + <el-form v-show="equipmentAccountInfo.moreCondition" :inline="true" :model="equipmentAccountInfo.conditions" | ||
| 50 | + class="search-form"> | ||
| 51 | + <el-form-item :label="$t('equipmentAccount.importanceLevel')"> | ||
| 52 | + <el-select v-model="equipmentAccountInfo.conditions.importanceLevel" style="width:100%"> | ||
| 53 | + <el-option :label="$t('equipmentAccount.selectImportanceLevel')" value=""></el-option> | ||
| 54 | + <el-option v-for="item in equipmentAccountInfo.importanceLevels" :key="item.statusCd" :label="item.name" | ||
| 55 | + :value="item.statusCd"> | ||
| 56 | + </el-option> | ||
| 57 | + </el-select> | ||
| 58 | + </el-form-item> | ||
| 59 | + </el-form> | ||
| 60 | + </el-card> | ||
| 61 | + | ||
| 62 | + <el-card class="box-card"> | ||
| 63 | + <el-table :data="equipmentAccountInfo.equipmentAccounts" border style="width: 100%" @selection-change="handleSelectionChange"> | ||
| 64 | + <el-table-column type="selection" width="55" align="center"></el-table-column> | ||
| 65 | + <el-table-column prop="machineName" :label="$t('equipmentAccount.machineName')" | ||
| 66 | + align="center"></el-table-column> | ||
| 67 | + <el-table-column prop="machineCode" :label="$t('equipmentAccount.machineCode')" | ||
| 68 | + align="center"></el-table-column> | ||
| 69 | + <el-table-column prop="brand" :label="$t('equipmentAccount.brand')" align="center"></el-table-column> | ||
| 70 | + <el-table-column prop="model" :label="$t('equipmentAccount.model')" align="center"></el-table-column> | ||
| 71 | + <el-table-column prop="locationDetail" :label="$t('equipmentAccount.locationDetail')" | ||
| 72 | + align="center"></el-table-column> | ||
| 73 | + <el-table-column prop="firstEnableTime" :label="$t('equipmentAccount.firstEnableTime')" | ||
| 74 | + align="center"></el-table-column> | ||
| 75 | + <el-table-column prop="warrantyDeadline" :label="$t('equipmentAccount.warrantyDeadline')" | ||
| 76 | + align="center"></el-table-column> | ||
| 77 | + <el-table-column prop="usefulLife" :label="$t('equipmentAccount.usefulLife')" | ||
| 78 | + align="center"></el-table-column> | ||
| 79 | + <el-table-column prop="levelName" :label="$t('equipmentAccount.importanceLevel')" | ||
| 80 | + align="center"></el-table-column> | ||
| 81 | + <el-table-column prop="stateName" :label="$t('equipmentAccount.state')" align="center"></el-table-column> | ||
| 82 | + <el-table-column prop="purchasePrice" :label="$t('equipmentAccount.purchasePrice')" | ||
| 83 | + align="center"></el-table-column> | ||
| 84 | + <el-table-column prop="netWorth" :label="$t('equipmentAccount.netWorth')" align="center"></el-table-column> | ||
| 85 | + <el-table-column :label="$t('common.operation')" align="center" width="300"> | ||
| 86 | + <template slot-scope="scope"> | ||
| 87 | + <el-button-group> | ||
| 88 | + <el-button size="mini" @click="printEquipmentAccount(scope.row)">{{ $t('common.print') }}</el-button> | ||
| 89 | + <el-button size="mini" @click="openEquipmentAccountDetail(scope.row)">{{ $t('common.detail') | ||
| 90 | + }}</el-button> | ||
| 91 | + <el-button size="mini" @click="openEditEquipmentAccountModel(scope.row)">{{ $t('common.edit') | ||
| 92 | + }}</el-button> | ||
| 93 | + <el-button size="mini" type="danger" @click="openDeleteEquipmentAccountModel(scope.row)">{{ | ||
| 94 | + $t('common.delete') }}</el-button> | ||
| 95 | + </el-button-group> | ||
| 96 | + </template> | ||
| 97 | + </el-table-column> | ||
| 98 | + </el-table> | ||
| 99 | + | ||
| 100 | + <el-row class="pagination-wrapper"> | ||
| 101 | + <el-col :span="12"> | ||
| 102 | + <div>{{ $t('equipmentAccount.stateDescription') }}</div> | ||
| 103 | + </el-col> | ||
| 104 | + <el-col :span="12"> | ||
| 105 | + <el-pagination :current-page.sync="equipmentAccountInfo.currentPage" :page-sizes="[10, 20, 30, 50]" | ||
| 106 | + :page-size="10" layout="total, sizes, prev, pager, next, jumper" :total="equipmentAccountInfo.total" | ||
| 107 | + @size-change="handleSizeChange" @current-change="handleCurrentChange"> | ||
| 108 | + </el-pagination> | ||
| 109 | + </el-col> | ||
| 110 | + </el-row> | ||
| 111 | + </el-card> | ||
| 112 | + </el-col> | ||
| 113 | + </el-row> | ||
| 114 | + | ||
| 115 | + <!-- 子组件 --> | ||
| 116 | + <delete-equipment-account ref="deleteEquipmentAccount"></delete-equipment-account> | ||
| 117 | + <view-equipment-account ref="viewEquipmentAccount"></view-equipment-account> | ||
| 118 | + <print-equipment-account ref="printEquipmentAccount"></print-equipment-account> | ||
| 119 | + <import-equipment ref="importEquipment"></import-equipment> | ||
| 120 | + </div> | ||
| 121 | +</template> | ||
| 122 | + | ||
| 123 | +<script> | ||
| 124 | +import { getDict } from '@/api/community/communityApi' | ||
| 125 | +import { getCommunityId } from '@/api/community/communityApi' | ||
| 126 | +import { listEquipmentAccount } from '@/api/machine/equipmentAccountApi' | ||
| 127 | +import MachineTypeTree from '@/components/machine/machineTypeTree' | ||
| 128 | +import DeleteEquipmentAccount from '@/components/machine/deleteEquipmentAccount' | ||
| 129 | +import ViewEquipmentAccount from '@/components/machine/viewEquipmentAccount' | ||
| 130 | +import PrintEquipmentAccount from '@/components/machine/printEquipmentAccount' | ||
| 131 | +import ImportEquipment from '@/components/machine/importEquipment' | ||
| 132 | + | ||
| 133 | +export default { | ||
| 134 | + name: 'EquipmentAccountList', | ||
| 135 | + components: { | ||
| 136 | + MachineTypeTree, | ||
| 137 | + DeleteEquipmentAccount, | ||
| 138 | + ViewEquipmentAccount, | ||
| 139 | + PrintEquipmentAccount, | ||
| 140 | + ImportEquipment | ||
| 141 | + }, | ||
| 142 | + data() { | ||
| 143 | + return { | ||
| 144 | + communityId: '', | ||
| 145 | + equipmentAccountInfo: { | ||
| 146 | + currentPage: 1, | ||
| 147 | + equipmentAccounts: [], | ||
| 148 | + total: 0, | ||
| 149 | + moreCondition: false, | ||
| 150 | + machineIds: [], | ||
| 151 | + conditions: { | ||
| 152 | + machineName: '', | ||
| 153 | + machineCode: '', | ||
| 154 | + state: '', | ||
| 155 | + importanceLevel: '', | ||
| 156 | + typeId: '' | ||
| 157 | + }, | ||
| 158 | + useStatus: [], | ||
| 159 | + importanceLevels: [] | ||
| 160 | + } | ||
| 161 | + } | ||
| 162 | + }, | ||
| 163 | + created() { | ||
| 164 | + this.communityId = getCommunityId() | ||
| 165 | + this.getDictData() | ||
| 166 | + this.listEquipmentAccounts() | ||
| 167 | + }, | ||
| 168 | + methods: { | ||
| 169 | + async getDictData() { | ||
| 170 | + try { | ||
| 171 | + const stateData = await getDict('equipment_account', 'state') | ||
| 172 | + const levelData = await getDict('equipment_account', 'importance_level') | ||
| 173 | + this.equipmentAccountInfo.useStatus = stateData | ||
| 174 | + this.equipmentAccountInfo.importanceLevels = levelData | ||
| 175 | + } catch (error) { | ||
| 176 | + console.error('获取字典数据失败:', error) | ||
| 177 | + } | ||
| 178 | + }, | ||
| 179 | + handleSelectionChange(selectedRows) { | ||
| 180 | + this.equipmentAccountInfo.machineIds = selectedRows.map(row => row.machineId) | ||
| 181 | + }, | ||
| 182 | + async listEquipmentAccounts() { | ||
| 183 | + try { | ||
| 184 | + const params = { | ||
| 185 | + page: this.equipmentAccountInfo.currentPage, | ||
| 186 | + row: 10, | ||
| 187 | + communityId: this.communityId, | ||
| 188 | + ...this.equipmentAccountInfo.conditions | ||
| 189 | + } | ||
| 190 | + const { data, total } = await listEquipmentAccount(params) | ||
| 191 | + this.equipmentAccountInfo.equipmentAccounts = data | ||
| 192 | + this.equipmentAccountInfo.total = total | ||
| 193 | + } catch (error) { | ||
| 194 | + console.error('获取设备台账列表失败:', error) | ||
| 195 | + } | ||
| 196 | + }, | ||
| 197 | + handleSwitchType(type) { | ||
| 198 | + this.equipmentAccountInfo.conditions.typeId = type.typeId | ||
| 199 | + this.listEquipmentAccounts() | ||
| 200 | + }, | ||
| 201 | + openAddEquipmentAccountModal() { | ||
| 202 | + if (!this.equipmentAccountInfo.conditions.typeId) { | ||
| 203 | + this.$message.warning(this.$t('equipmentAccount.selectTypeFirst')) | ||
| 204 | + return | ||
| 205 | + } | ||
| 206 | + this.$router.push(`/views/machine/addEquipmentAccount?typeId=${this.equipmentAccountInfo.conditions.typeId}`) | ||
| 207 | + }, | ||
| 208 | + openEditEquipmentAccountModel(row) { | ||
| 209 | + this.$router.push(`/views/machine/editEquipmentAccount?machineId=${row.machineId}`) | ||
| 210 | + }, | ||
| 211 | + openEquipmentAccountDetail(row) { | ||
| 212 | + this.$router.push(`/views/machine/equipmentAccountDetail?machineId=${row.machineId}`) | ||
| 213 | + }, | ||
| 214 | + openDeleteEquipmentAccountModel(row) { | ||
| 215 | + this.$refs.deleteEquipmentAccount.open(row) | ||
| 216 | + }, | ||
| 217 | + printEquipmentAccount(row) { | ||
| 218 | + //this.$refs.printEquipmentAccount.open(row) | ||
| 219 | + window.open(`/#/views/resource/printEquipmentAccountLabel?machineId=${row.machineId}`) | ||
| 220 | + | ||
| 221 | + }, | ||
| 222 | + printEquipmentAccounts() { | ||
| 223 | + if (this.equipmentAccountInfo.machineIds.length === 0) { | ||
| 224 | + this.$message.warning(this.$t('equipmentAccount.selectEquipmentFirst')) | ||
| 225 | + return | ||
| 226 | + } | ||
| 227 | + window.open(`/#/views/resource/printEquipmentAccountLabel?machineIds=${this.equipmentAccountInfo.machineIds}`) | ||
| 228 | + }, | ||
| 229 | + queryEquipmentAccountMethod() { | ||
| 230 | + this.equipmentAccountInfo.currentPage = 1 | ||
| 231 | + this.listEquipmentAccounts() | ||
| 232 | + }, | ||
| 233 | + resetEquipmentAccountMethod() { | ||
| 234 | + this.equipmentAccountInfo.conditions = { | ||
| 235 | + machineName: '', | ||
| 236 | + machineCode: '', | ||
| 237 | + state: '', | ||
| 238 | + importanceLevel: '', | ||
| 239 | + typeId: this.equipmentAccountInfo.conditions.typeId | ||
| 240 | + } | ||
| 241 | + this.listEquipmentAccounts() | ||
| 242 | + }, | ||
| 243 | + toggleMoreCondition() { | ||
| 244 | + this.equipmentAccountInfo.moreCondition = !this.equipmentAccountInfo.moreCondition | ||
| 245 | + }, | ||
| 246 | + handleSizeChange(val) { | ||
| 247 | + console.log(`每页 ${val} 条`) | ||
| 248 | + this.equipmentAccountInfo.currentPage = 1 | ||
| 249 | + this.listEquipmentAccounts() | ||
| 250 | + }, | ||
| 251 | + handleCurrentChange(val) { | ||
| 252 | + this.equipmentAccountInfo.currentPage = val | ||
| 253 | + this.listEquipmentAccounts() | ||
| 254 | + } | ||
| 255 | + } | ||
| 256 | +} | ||
| 257 | +</script> | ||
| 258 | + | ||
| 259 | +<style lang="scss" scoped> | ||
| 260 | +.equipment-account-container { | ||
| 261 | + padding: 20px; | ||
| 262 | + | ||
| 263 | + .operation-wrapper { | ||
| 264 | + margin-bottom: 0px; | ||
| 265 | + } | ||
| 266 | + | ||
| 267 | + .tree-container { | ||
| 268 | + padding-right: 0; | ||
| 269 | + } | ||
| 270 | + | ||
| 271 | + .search-form { | ||
| 272 | + margin-bottom: 20px; | ||
| 273 | + } | ||
| 274 | + | ||
| 275 | + .pagination-wrapper { | ||
| 276 | + margin-top: 20px; | ||
| 277 | + display: flex; | ||
| 278 | + justify-content: space-between; | ||
| 279 | + align-items: center; | ||
| 280 | + } | ||
| 281 | +}</style> | ||
| 0 | \ No newline at end of file | 282 | \ No newline at end of file |
src/views/machine/machineTypeTreeManageList.vue
| @@ -82,6 +82,7 @@ import MachineTypeTree from '@/components/machine/machineTypeTree' | @@ -82,6 +82,7 @@ import MachineTypeTree from '@/components/machine/machineTypeTree' | ||
| 82 | import AddMachineType from '@/components/machine/addMachineType' | 82 | import AddMachineType from '@/components/machine/addMachineType' |
| 83 | import EditMachineType from '@/components/machine/editMachineType' | 83 | import EditMachineType from '@/components/machine/editMachineType' |
| 84 | import DeleteMachineType from '@/components/machine/deleteMachineType' | 84 | import DeleteMachineType from '@/components/machine/deleteMachineType' |
| 85 | +import {listMachineType} from '@/api/machine/machineTypeTreeManageApi' | ||
| 85 | 86 | ||
| 86 | export default { | 87 | export default { |
| 87 | name: 'MachineTypeTreeManageList', | 88 | name: 'MachineTypeTreeManageList', |
| @@ -115,9 +116,9 @@ export default { | @@ -115,9 +116,9 @@ export default { | ||
| 115 | handleSwitchType(data) { | 116 | handleSwitchType(data) { |
| 116 | this.currentTypeId = data.typeId | 117 | this.currentTypeId = data.typeId |
| 117 | this.machineTypeInfo = { | 118 | this.machineTypeInfo = { |
| 118 | - ...this.machineTypeInfo, | ||
| 119 | ...data | 119 | ...data |
| 120 | } | 120 | } |
| 121 | + this._loadMachienType() | ||
| 121 | }, | 122 | }, |
| 122 | openAddParentMachineTypeModal() { | 123 | openAddParentMachineTypeModal() { |
| 123 | this.$refs.addMachineType.open({}) | 124 | this.$refs.addMachineType.open({}) |
| @@ -143,6 +144,10 @@ export default { | @@ -143,6 +144,10 @@ export default { | ||
| 143 | } | 144 | } |
| 144 | this.$refs.deleteMachineType.open(this.machineTypeInfo) | 145 | this.$refs.deleteMachineType.open(this.machineTypeInfo) |
| 145 | }, | 146 | }, |
| 147 | + async _loadMachienType() { | ||
| 148 | + const res = await listMachineType({ communityId: getCommunityId(), typeId: this.machineTypeInfo.typeId,page:1,row:1 }); | ||
| 149 | + this.machineTypeInfo = {...res.data[0]} | ||
| 150 | + }, | ||
| 146 | handleSuccess() { | 151 | handleSuccess() { |
| 147 | this.$refs.machineTypeTree.refreshTree() | 152 | this.$refs.machineTypeTree.refreshTree() |
| 148 | } | 153 | } |
src/views/resource/printEquipmentAccountLabelLang.js
0 → 100644
| 1 | +export const messages = { | ||
| 2 | + en: { | ||
| 3 | + printEquipmentAccount: { | ||
| 4 | + machineId: 'Equipment ID', | ||
| 5 | + printTime: 'Print Time', | ||
| 6 | + equipmentLabel: 'Equipment Label', | ||
| 7 | + project: 'Project', | ||
| 8 | + locationName: 'Location Name', | ||
| 9 | + machineName: 'Machine Name', | ||
| 10 | + importanceLevel: 'Importance Level', | ||
| 11 | + systemName: 'System Name', | ||
| 12 | + enableDate: 'Enable Date', | ||
| 13 | + machineBrand: 'Machine Brand', | ||
| 14 | + specificationModel: 'Specification Model', | ||
| 15 | + code: 'Code', | ||
| 16 | + responsiblePerson: 'Responsible Person' | ||
| 17 | + } | ||
| 18 | + }, | ||
| 19 | + zh: { | ||
| 20 | + printEquipmentAccount: { | ||
| 21 | + machineId: '设备ID', | ||
| 22 | + printTime: '打印时间', | ||
| 23 | + equipmentLabel: '设备标签', | ||
| 24 | + project: '项目', | ||
| 25 | + locationName: '位置名称', | ||
| 26 | + machineName: '设备名称', | ||
| 27 | + importanceLevel: '重要等级', | ||
| 28 | + systemName: '系统名称', | ||
| 29 | + enableDate: '启用日期', | ||
| 30 | + machineBrand: '设备品牌', | ||
| 31 | + specificationModel: '规格型号', | ||
| 32 | + code: '编码', | ||
| 33 | + responsiblePerson: '责任人' | ||
| 34 | + } | ||
| 35 | + } | ||
| 36 | +} | ||
| 0 | \ No newline at end of file | 37 | \ No newline at end of file |
src/views/resource/printEquipmentAccountLabelList.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div class="print-equipment-account-label-container"> | ||
| 3 | + <el-card> | ||
| 4 | + <div slot="header" class="flex justify-between"> | ||
| 5 | + <span>{{ $t('printEquipmentAccount.machineId') }}:{{ printEquipmentAccountInfo.machineId }}</span> | ||
| 6 | + | ||
| 7 | + <span>{{ $t('printEquipmentAccount.printTime') }}:{{ nowTime }}</span> | ||
| 8 | + </div> | ||
| 9 | + | ||
| 10 | + <el-table :data="[printEquipmentAccountInfo]" border style="width: 100%; margin-top: 20px; margin-bottom: 0;"> | ||
| 11 | + <el-table-column prop="header" label="" colspan="6" align="center"> | ||
| 12 | + <template> | ||
| 13 | + <span style="font-size: 40px;">{{ $t('printEquipmentAccount.equipmentLabel') }}</span> | ||
| 14 | + </template> | ||
| 15 | + </el-table-column> | ||
| 16 | + <el-table-column prop="content" label="" colspan="2"> | ||
| 17 | + <template slot-scope="scope"> | ||
| 18 | + <el-row :gutter="20" style="font-size: 28px;"> | ||
| 19 | + <el-col :span="12"> | ||
| 20 | + <div>{{ $t('printEquipmentAccount.project') }}:{{ scope.row.yqName }}</div> | ||
| 21 | + </el-col> | ||
| 22 | + <el-col :span="12"> | ||
| 23 | + <div>{{ $t('printEquipmentAccount.locationName') }}:{{ scope.row.locationDetail }}</div> | ||
| 24 | + </el-col> | ||
| 25 | + </el-row> | ||
| 26 | + <el-row :gutter="20" style="font-size: 28px;"> | ||
| 27 | + <el-col :span="12"> | ||
| 28 | + <div>{{ $t('printEquipmentAccount.machineName') }}:{{ scope.row.machineName }}</div> | ||
| 29 | + </el-col> | ||
| 30 | + <el-col :span="12"> | ||
| 31 | + <div>{{ $t('printEquipmentAccount.importanceLevel') }}:{{ scope.row.levelName }}</div> | ||
| 32 | + </el-col> | ||
| 33 | + </el-row> | ||
| 34 | + <el-row :gutter="20" style="font-size: 28px;"> | ||
| 35 | + <el-col :span="12"> | ||
| 36 | + <div>{{ $t('printEquipmentAccount.systemName') }}:{{ scope.row.sysName }}</div> | ||
| 37 | + </el-col> | ||
| 38 | + <el-col :span="12"> | ||
| 39 | + <div>{{ $t('printEquipmentAccount.enableDate') }}:{{ scope.row.firstEnableTime }}</div> | ||
| 40 | + </el-col> | ||
| 41 | + </el-row> | ||
| 42 | + <el-row :gutter="20" style="font-size: 28px;"> | ||
| 43 | + <el-col :span="12"> | ||
| 44 | + <div>{{ $t('printEquipmentAccount.machineBrand') }}:{{ scope.row.brand }}</div> | ||
| 45 | + </el-col> | ||
| 46 | + <el-col :span="12" rowspan="4"> | ||
| 47 | + <div id="qrcode" style="width:200px; height:200px;"></div> | ||
| 48 | + </el-col> | ||
| 49 | + </el-row> | ||
| 50 | + <el-row :gutter="20" style="font-size: 28px;"> | ||
| 51 | + <el-col :span="12"> | ||
| 52 | + <div>{{ $t('printEquipmentAccount.specificationModel') }}:{{ scope.row.model }}</div> | ||
| 53 | + </el-col> | ||
| 54 | + </el-row> | ||
| 55 | + <el-row :gutter="20" style="font-size: 28px;"> | ||
| 56 | + <el-col :span="12"> | ||
| 57 | + <div>{{ $t('printEquipmentAccount.code') }}:{{ scope.row.machineCode }}</div> | ||
| 58 | + </el-col> | ||
| 59 | + </el-row> | ||
| 60 | + <el-row :gutter="20" style="font-size: 28px;"> | ||
| 61 | + <el-col :span="12"> | ||
| 62 | + <div>{{ $t('printEquipmentAccount.responsiblePerson') }}:{{ scope.row.chargeUseName }}</div> | ||
| 63 | + </el-col> | ||
| 64 | + </el-row> | ||
| 65 | + <el-row :gutter="20" style="font-size: 28px;"> | ||
| 66 | + <el-col :span="24" align="center"> | ||
| 67 | + <div>设备标志 严禁损坏</div> | ||
| 68 | + </el-col> | ||
| 69 | + </el-row> | ||
| 70 | + </template> | ||
| 71 | + </el-table-column> | ||
| 72 | + </el-table> | ||
| 73 | + | ||
| 74 | + <div id="print-btn" style="margin-top: 20px;"> | ||
| 75 | + <el-button type="primary" class="float-right" @click="_printPurchaseApplyDiv"> | ||
| 76 | + <i class="el-icon-check"></i> {{ $t('common.print') }} | ||
| 77 | + </el-button> | ||
| 78 | + <el-button type="warning" class="float-right" style="margin-right: 20px;" @click="_closePage"> | ||
| 79 | + {{ $t('common.cancel') }} | ||
| 80 | + </el-button> | ||
| 81 | + </div> | ||
| 82 | + </el-card> | ||
| 83 | + </div> | ||
| 84 | +</template> | ||
| 85 | + | ||
| 86 | +<script> | ||
| 87 | +import { getEquipmentAccountList } from '@/api/resource/printEquipmentAccountLabelApi' | ||
| 88 | +import QRCode from 'qrcodejs2' | ||
| 89 | +import { getCommunityId } from '@/api/community/communityApi' | ||
| 90 | + | ||
| 91 | +export default { | ||
| 92 | + name: 'PrintEquipmentAccountLabelList', | ||
| 93 | + data() { | ||
| 94 | + return { | ||
| 95 | + printEquipmentAccountInfo: { | ||
| 96 | + machineId: '', | ||
| 97 | + machineName: '', | ||
| 98 | + machineCode: '', | ||
| 99 | + brand: '', | ||
| 100 | + model: '', | ||
| 101 | + locationDetail: '', | ||
| 102 | + firstEnableTime: '', | ||
| 103 | + warrantyDeadline: '', | ||
| 104 | + usefulLife: '', | ||
| 105 | + importanceLevel: '', | ||
| 106 | + levelName: '', | ||
| 107 | + state: '', | ||
| 108 | + purchasePrice: '', | ||
| 109 | + netWorth: '', | ||
| 110 | + useOrgId: '', | ||
| 111 | + useOrgName: '', | ||
| 112 | + useUserId: '', | ||
| 113 | + useUserName: '', | ||
| 114 | + useUseTel: '', | ||
| 115 | + chargeOrgId: '', | ||
| 116 | + chargeOrgName: '', | ||
| 117 | + chargeOrgTel: '', | ||
| 118 | + chargeUseId: '', | ||
| 119 | + chargeUseName: '', | ||
| 120 | + remark: '', | ||
| 121 | + yqName: '', | ||
| 122 | + url: '' | ||
| 123 | + }, | ||
| 124 | + printFlag: '0', | ||
| 125 | + nowTime: '', | ||
| 126 | + communityId: '' | ||
| 127 | + } | ||
| 128 | + }, | ||
| 129 | + created() { | ||
| 130 | + this.communityId = getCommunityId() | ||
| 131 | + this._initPrintRepairDetailDateInfo() | ||
| 132 | + const myDate = new Date() | ||
| 133 | + this.nowTime = myDate.toLocaleDateString() | ||
| 134 | + this.printEquipmentAccountInfo.yqName = this.$store.getters.currentCommunity.name | ||
| 135 | + }, | ||
| 136 | + methods: { | ||
| 137 | + async _initPrintRepairDetailDateInfo() { | ||
| 138 | + const machineId = this.$route.query.machineId | ||
| 139 | + try { | ||
| 140 | + const res = await getEquipmentAccountList({ | ||
| 141 | + page: 1, | ||
| 142 | + row: 1, | ||
| 143 | + machineId: machineId, | ||
| 144 | + communityId: this.communityId | ||
| 145 | + }) | ||
| 146 | + const data = res.data[0] | ||
| 147 | + Object.assign(this.printEquipmentAccountInfo, data) | ||
| 148 | + | ||
| 149 | + document.getElementById('qrcode').innerHTML = '' | ||
| 150 | + new QRCode(document.getElementById('qrcode'), { | ||
| 151 | + text: this.printEquipmentAccountInfo.url, | ||
| 152 | + width: 200, | ||
| 153 | + height: 200, | ||
| 154 | + colorDark: '#000000', | ||
| 155 | + colorLight: '#ffffff', | ||
| 156 | + correctLevel: QRCode.CorrectLevel.H | ||
| 157 | + }) | ||
| 158 | + } catch (error) { | ||
| 159 | + console.error('请求失败:', error) | ||
| 160 | + } | ||
| 161 | + }, | ||
| 162 | + _printPurchaseApplyDiv() { | ||
| 163 | + this.printFlag = '1' | ||
| 164 | + document.getElementById('print-btn').style.display = 'none' | ||
| 165 | + window.print() | ||
| 166 | + window.opener = null | ||
| 167 | + window.close() | ||
| 168 | + }, | ||
| 169 | + _closePage() { | ||
| 170 | + window.opener = null | ||
| 171 | + window.close() | ||
| 172 | + } | ||
| 173 | + } | ||
| 174 | +} | ||
| 175 | +</script> | ||
| 176 | + | ||
| 177 | +<style scoped> | ||
| 178 | +.print-equipment-account-label-container { | ||
| 179 | + padding: 20px; | ||
| 180 | +} | ||
| 181 | + | ||
| 182 | +.float-right { | ||
| 183 | + float: right; | ||
| 184 | +} | ||
| 185 | + | ||
| 186 | +.margin-top { | ||
| 187 | + margin-top: 20px; | ||
| 188 | +} | ||
| 189 | + | ||
| 190 | +@media print { | ||
| 191 | + #print-btn { | ||
| 192 | + display: none !important; | ||
| 193 | + } | ||
| 194 | +} | ||
| 195 | +</style> | ||
| 0 | \ No newline at end of file | 196 | \ No newline at end of file |