Commit daaebda87b0cf2eb6af8facc7db82394f7222ed6
1 parent
f68885f8
开发保养计划功能
Showing
29 changed files
with
3193 additions
and
0 deletions
src/api/inspection/addMaintainancePlanApi.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | +import { getCommunityId } from '@/api/community/communityApi' | |
| 3 | + | |
| 4 | +// 保存保养计划 | |
| 5 | +export function saveMaintainancePlan(data) { | |
| 6 | + return new Promise((resolve, reject) => { | |
| 7 | + request({ | |
| 8 | + url: '/maintainancePlan.saveMaintainancePlan', | |
| 9 | + method: 'post', | |
| 10 | + data: { | |
| 11 | + ...data, | |
| 12 | + communityId: getCommunityId() | |
| 13 | + } | |
| 14 | + }).then(response => { | |
| 15 | + resolve(response.data) | |
| 16 | + }).catch(error => { | |
| 17 | + reject(error) | |
| 18 | + }) | |
| 19 | + }) | |
| 20 | +} | |
| 21 | + | |
| 22 | +// 获取保养标准列表 | |
| 23 | +export function listMaintainanceStandard(params) { | |
| 24 | + return new Promise((resolve, reject) => { | |
| 25 | + request({ | |
| 26 | + url: '/maintainance.listMaintainanceStandard', | |
| 27 | + method: 'get', | |
| 28 | + params: { | |
| 29 | + ...params, | |
| 30 | + communityId: getCommunityId() | |
| 31 | + } | |
| 32 | + }).then(response => { | |
| 33 | + resolve(response.data) | |
| 34 | + }).catch(error => { | |
| 35 | + reject(error) | |
| 36 | + }) | |
| 37 | + }) | |
| 38 | +} | |
| 39 | + | |
| 40 | +// 获取设备列表 | |
| 41 | +export function listEquipmentAccount(params) { | |
| 42 | + return new Promise((resolve, reject) => { | |
| 43 | + request({ | |
| 44 | + url: '/equipmentAccount.listEquipmentAccount', | |
| 45 | + method: 'get', | |
| 46 | + params: { | |
| 47 | + ...params, | |
| 48 | + communityId: getCommunityId() | |
| 49 | + } | |
| 50 | + }).then(response => { | |
| 51 | + resolve(response.data) | |
| 52 | + }).catch(error => { | |
| 53 | + reject(error) | |
| 54 | + }) | |
| 55 | + }) | |
| 56 | +} | |
| 57 | + | |
| 58 | +// 获取组织树 | |
| 59 | +export function listOrgTree(params) { | |
| 60 | + return new Promise((resolve, reject) => { | |
| 61 | + request({ | |
| 62 | + url: '/org.listOrgTree', | |
| 63 | + method: 'get', | |
| 64 | + params: { | |
| 65 | + ...params, | |
| 66 | + communityId: getCommunityId() | |
| 67 | + } | |
| 68 | + }).then(response => { | |
| 69 | + resolve(response.data) | |
| 70 | + }).catch(error => { | |
| 71 | + reject(error) | |
| 72 | + }) | |
| 73 | + }) | |
| 74 | +} | |
| 75 | + | |
| 76 | +// 查询员工信息 | |
| 77 | +export function queryStaffInfos(params) { | |
| 78 | + return new Promise((resolve, reject) => { | |
| 79 | + request({ | |
| 80 | + url: '/query.staff.infos', | |
| 81 | + method: 'get', | |
| 82 | + params: { | |
| 83 | + ...params, | |
| 84 | + communityId: getCommunityId() | |
| 85 | + } | |
| 86 | + }).then(response => { | |
| 87 | + resolve(response.data) | |
| 88 | + }).catch(error => { | |
| 89 | + reject(error) | |
| 90 | + }) | |
| 91 | + }) | |
| 92 | +} | |
| 0 | 93 | \ No newline at end of file | ... | ... |
src/api/inspection/editMaintainancePlanApi.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | +import { getCommunityId } from '@/api/community/communityApi' | |
| 3 | + | |
| 4 | +// 获取保养标准列表 | |
| 5 | +export function listMaintainanceStandard(params) { | |
| 6 | + return new Promise((resolve, reject) => { | |
| 7 | + request({ | |
| 8 | + url: '/maintainance.listMaintainanceStandard', | |
| 9 | + method: 'get', | |
| 10 | + params: { | |
| 11 | + ...params, | |
| 12 | + communityId: getCommunityId() | |
| 13 | + } | |
| 14 | + }).then(response => { | |
| 15 | + resolve(response.data) | |
| 16 | + }).catch(error => { | |
| 17 | + reject(error) | |
| 18 | + }) | |
| 19 | + }) | |
| 20 | +} | |
| 21 | + | |
| 22 | +// 获取保养计划列表 | |
| 23 | +export function listMaintainancePlan(params) { | |
| 24 | + return new Promise((resolve, reject) => { | |
| 25 | + request({ | |
| 26 | + url: '/maintainancePlan.listMaintainancePlan', | |
| 27 | + method: 'get', | |
| 28 | + params: { | |
| 29 | + ...params, | |
| 30 | + communityId: getCommunityId() | |
| 31 | + } | |
| 32 | + }).then(response => { | |
| 33 | + resolve(response.data) | |
| 34 | + }).catch(error => { | |
| 35 | + reject(error) | |
| 36 | + }) | |
| 37 | + }) | |
| 38 | +} | |
| 39 | + | |
| 40 | +// 获取保养计划员工列表 | |
| 41 | +export function listMaintainancePlanStaff(params) { | |
| 42 | + return new Promise((resolve, reject) => { | |
| 43 | + request({ | |
| 44 | + url: '/maintainancePlan.listMaintainancePlanStaff', | |
| 45 | + method: 'get', | |
| 46 | + params: { | |
| 47 | + ...params, | |
| 48 | + communityId: getCommunityId() | |
| 49 | + } | |
| 50 | + }).then(response => { | |
| 51 | + resolve(response.data) | |
| 52 | + }).catch(error => { | |
| 53 | + reject(error) | |
| 54 | + }) | |
| 55 | + }) | |
| 56 | +} | |
| 57 | + | |
| 58 | +// 更新保养计划 | |
| 59 | +export function updateMaintainancePlan(data) { | |
| 60 | + return new Promise((resolve, reject) => { | |
| 61 | + request({ | |
| 62 | + url: '/maintainancePlan.updateMaintainancePlan', | |
| 63 | + method: 'post', | |
| 64 | + data: { | |
| 65 | + ...data, | |
| 66 | + communityId: getCommunityId() | |
| 67 | + } | |
| 68 | + }).then(response => { | |
| 69 | + resolve(response.data) | |
| 70 | + }).catch(error => { | |
| 71 | + reject(error) | |
| 72 | + }) | |
| 73 | + }) | |
| 74 | +} | |
| 75 | + | |
| 76 | +// 获取组织树 | |
| 77 | +export function listOrgTree(params) { | |
| 78 | + return new Promise((resolve, reject) => { | |
| 79 | + request({ | |
| 80 | + url: '/org.listOrgTree', | |
| 81 | + method: 'get', | |
| 82 | + params: { | |
| 83 | + ...params, | |
| 84 | + communityId: getCommunityId() | |
| 85 | + } | |
| 86 | + }).then(response => { | |
| 87 | + resolve(response.data) | |
| 88 | + }).catch(error => { | |
| 89 | + reject(error) | |
| 90 | + }) | |
| 91 | + }) | |
| 92 | +} | |
| 93 | + | |
| 94 | +// 获取员工信息 | |
| 95 | +export function getStaffInfos(params) { | |
| 96 | + return new Promise((resolve, reject) => { | |
| 97 | + request({ | |
| 98 | + url: '/query.staff.infos', | |
| 99 | + method: 'get', | |
| 100 | + params: { | |
| 101 | + ...params, | |
| 102 | + communityId: getCommunityId() | |
| 103 | + } | |
| 104 | + }).then(response => { | |
| 105 | + resolve(response.data) | |
| 106 | + }).catch(error => { | |
| 107 | + reject(error) | |
| 108 | + }) | |
| 109 | + }) | |
| 110 | +} | |
| 0 | 111 | \ No newline at end of file | ... | ... |
src/api/inspection/maintainancePlanMachineApi.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | +import { getCommunityId } from '@/api/community/communityApi' | |
| 3 | + | |
| 4 | +// 获取保养计划设备列表 | |
| 5 | +export function listMaintainancePlanMachine(params) { | |
| 6 | + return new Promise((resolve, reject) => { | |
| 7 | + request({ | |
| 8 | + url: '/maintainancePlan.listMaintainancePlanMachine', | |
| 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 listEquipmentAccount(params) { | |
| 25 | + return new Promise((resolve, reject) => { | |
| 26 | + request({ | |
| 27 | + url: '/equipmentAccount.listEquipmentAccount', | |
| 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 | +} | |
| 41 | + | |
| 42 | +// 保存保养计划设备 | |
| 43 | +export function saveMaintainancePlanMachine(data) { | |
| 44 | + return new Promise((resolve, reject) => { | |
| 45 | + request({ | |
| 46 | + url: '/maintainancePlan.saveMaintainancePlanMachine', | |
| 47 | + method: 'post', | |
| 48 | + data: { | |
| 49 | + ...data, | |
| 50 | + communityId: getCommunityId() | |
| 51 | + } | |
| 52 | + }).then(response => { | |
| 53 | + const res = response.data | |
| 54 | + resolve(res) | |
| 55 | + }).catch(error => { | |
| 56 | + reject(error) | |
| 57 | + }) | |
| 58 | + }) | |
| 59 | +} | |
| 60 | + | |
| 61 | +// 删除保养计划设备 | |
| 62 | +export function deleteMaintainancePlanMachine(data) { | |
| 63 | + return new Promise((resolve, reject) => { | |
| 64 | + request({ | |
| 65 | + url: '/maintainancePlan.deleteMaintainancePlanMachine', | |
| 66 | + method: 'post', | |
| 67 | + data: { | |
| 68 | + ...data, | |
| 69 | + communityId: getCommunityId() | |
| 70 | + } | |
| 71 | + }).then(response => { | |
| 72 | + const res = response.data | |
| 73 | + resolve(res) | |
| 74 | + }).catch(error => { | |
| 75 | + reject(error) | |
| 76 | + }) | |
| 77 | + }) | |
| 78 | +} | |
| 0 | 79 | \ No newline at end of file | ... | ... |
src/api/inspection/maintainancePlanManageApi.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | + | |
| 3 | +// 获取保养计划列表 | |
| 4 | +export function listMaintainancePlan(params) { | |
| 5 | + return new Promise((resolve, reject) => { | |
| 6 | + request({ | |
| 7 | + url: '/maintainancePlan.listMaintainancePlan', | |
| 8 | + method: 'get', | |
| 9 | + params | |
| 10 | + }).then(response => { | |
| 11 | + const res = response.data | |
| 12 | + resolve(res) | |
| 13 | + }).catch(error => { | |
| 14 | + reject(error) | |
| 15 | + }) | |
| 16 | + }) | |
| 17 | +} | |
| 18 | + | |
| 19 | +// 删除保养计划 | |
| 20 | +export function deleteMaintainancePlan(data) { | |
| 21 | + return new Promise((resolve, reject) => { | |
| 22 | + request({ | |
| 23 | + url: '/maintainancePlan.deleteMaintainancePlan', | |
| 24 | + method: 'post', | |
| 25 | + data | |
| 26 | + }).then(response => { | |
| 27 | + const res = response.data | |
| 28 | + resolve(res) | |
| 29 | + }).catch(error => { | |
| 30 | + reject(error) | |
| 31 | + }) | |
| 32 | + }) | |
| 33 | +} | |
| 34 | + | |
| 35 | +// 更新保养计划状态 | |
| 36 | +export function updateMaintainancePlanState(data) { | |
| 37 | + return new Promise((resolve, reject) => { | |
| 38 | + request({ | |
| 39 | + url: '/maintainancePlan.updateMaintainancePlanState', | |
| 40 | + method: 'post', | |
| 41 | + data | |
| 42 | + }).then(response => { | |
| 43 | + const res = response.data | |
| 44 | + resolve(res) | |
| 45 | + }).catch(error => { | |
| 46 | + reject(error) | |
| 47 | + }) | |
| 48 | + }) | |
| 49 | +} | |
| 0 | 50 | \ No newline at end of file | ... | ... |
src/api/inspection/maintainanceStandardItemApi.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | +import { getCommunityId } from '@/api/community/communityApi' | |
| 3 | + | |
| 4 | +// 获取保养标准项列表 | |
| 5 | +export function listMaintainanceStandardItem(params) { | |
| 6 | + return new Promise((resolve, reject) => { | |
| 7 | + request({ | |
| 8 | + url: '/maintainance.listMaintainanceStandardItem', | |
| 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 listMaintainanceItem(params) { | |
| 25 | + return new Promise((resolve, reject) => { | |
| 26 | + request({ | |
| 27 | + url: '/maintainance.listMaintainanceItem', | |
| 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 | +} | |
| 41 | + | |
| 42 | +// 保存保养标准项 | |
| 43 | +export function saveMaintainanceStandardItem(data) { | |
| 44 | + return new Promise((resolve, reject) => { | |
| 45 | + request({ | |
| 46 | + url: '/maintainance.saveMaintainanceStandardItem', | |
| 47 | + method: 'post', | |
| 48 | + data: { | |
| 49 | + ...data, | |
| 50 | + communityId: getCommunityId() | |
| 51 | + } | |
| 52 | + }).then(response => { | |
| 53 | + const res = response.data | |
| 54 | + resolve(res) | |
| 55 | + }).catch(error => { | |
| 56 | + reject(error) | |
| 57 | + }) | |
| 58 | + }) | |
| 59 | +} | |
| 60 | + | |
| 61 | +// 删除保养标准项 | |
| 62 | +export function deleteMaintainanceStandardItem(data) { | |
| 63 | + return new Promise((resolve, reject) => { | |
| 64 | + request({ | |
| 65 | + url: '/maintainance.deleteMaintainanceStandardItem', | |
| 66 | + method: 'post', | |
| 67 | + data: { | |
| 68 | + ...data, | |
| 69 | + communityId: getCommunityId() | |
| 70 | + } | |
| 71 | + }).then(response => { | |
| 72 | + const res = response.data | |
| 73 | + resolve(res) | |
| 74 | + }).catch(error => { | |
| 75 | + reject(error) | |
| 76 | + }) | |
| 77 | + }) | |
| 78 | +} | |
| 0 | 79 | \ No newline at end of file | ... | ... |
src/api/inspection/maintainanceStandardManageApi.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | +import { getCommunityId } from '@/api/community/communityApi' | |
| 3 | + | |
| 4 | +// 获取保养标准列表 | |
| 5 | +export function listMaintainanceStandard(params) { | |
| 6 | + return new Promise((resolve, reject) => { | |
| 7 | + request({ | |
| 8 | + url: '/maintainance.listMaintainanceStandard', | |
| 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 saveMaintainanceStandard(data) { | |
| 25 | + return new Promise((resolve, reject) => { | |
| 26 | + request({ | |
| 27 | + url: '/maintainance.saveMaintainanceStandard', | |
| 28 | + method: 'post', | |
| 29 | + data: { | |
| 30 | + ...data, | |
| 31 | + communityId: getCommunityId() | |
| 32 | + } | |
| 33 | + }).then(response => { | |
| 34 | + const res = response.data | |
| 35 | + resolve(res) | |
| 36 | + }).catch(error => { | |
| 37 | + reject(error) | |
| 38 | + }) | |
| 39 | + }) | |
| 40 | +} | |
| 41 | + | |
| 42 | +// 更新保养标准 | |
| 43 | +export function updateMaintainanceStandard(data) { | |
| 44 | + return new Promise((resolve, reject) => { | |
| 45 | + request({ | |
| 46 | + url: '/maintainance.updateMaintainanceStandard', | |
| 47 | + method: 'post', | |
| 48 | + data: { | |
| 49 | + ...data, | |
| 50 | + communityId: getCommunityId() | |
| 51 | + } | |
| 52 | + }).then(response => { | |
| 53 | + const res = response.data | |
| 54 | + resolve(res) | |
| 55 | + }).catch(error => { | |
| 56 | + reject(error) | |
| 57 | + }) | |
| 58 | + }) | |
| 59 | +} | |
| 60 | + | |
| 61 | +// 删除保养标准 | |
| 62 | +export function deleteMaintainanceStandard(data) { | |
| 63 | + return new Promise((resolve, reject) => { | |
| 64 | + request({ | |
| 65 | + url: '/maintainance.deleteMaintainanceStandard', | |
| 66 | + method: 'post', | |
| 67 | + data: { | |
| 68 | + ...data, | |
| 69 | + communityId: getCommunityId() | |
| 70 | + } | |
| 71 | + }).then(response => { | |
| 72 | + const res = response.data | |
| 73 | + resolve(res) | |
| 74 | + }).catch(error => { | |
| 75 | + reject(error) | |
| 76 | + }) | |
| 77 | + }) | |
| 78 | +} | |
| 0 | 79 | \ No newline at end of file | ... | ... |
src/components/inspection/addMaintainanceStandard.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <el-dialog | |
| 3 | + :title="$t('maintainanceStandard.add.title')" | |
| 4 | + :visible.sync="visible" | |
| 5 | + width="50%" | |
| 6 | + @close="handleClose" | |
| 7 | + > | |
| 8 | + <el-form | |
| 9 | + ref="form" | |
| 10 | + :model="formData" | |
| 11 | + :rules="rules" | |
| 12 | + label-width="120px" | |
| 13 | + > | |
| 14 | + <el-form-item | |
| 15 | + :label="$t('maintainanceStandard.form.standardName')" | |
| 16 | + prop="standardName" | |
| 17 | + > | |
| 18 | + <el-input | |
| 19 | + v-model="formData.standardName" | |
| 20 | + :placeholder="$t('maintainanceStandard.placeholder.standardName')" | |
| 21 | + /> | |
| 22 | + </el-form-item> | |
| 23 | + <el-form-item | |
| 24 | + :label="$t('maintainanceStandard.form.remark')" | |
| 25 | + prop="remark" | |
| 26 | + > | |
| 27 | + <el-input | |
| 28 | + v-model="formData.remark" | |
| 29 | + type="textarea" | |
| 30 | + :placeholder="$t('maintainanceStandard.placeholder.remark')" | |
| 31 | + :rows="3" | |
| 32 | + /> | |
| 33 | + </el-form-item> | |
| 34 | + </el-form> | |
| 35 | + | |
| 36 | + <span slot="footer" class="dialog-footer"> | |
| 37 | + <el-button @click="visible = false"> | |
| 38 | + {{ $t('common.cancel') }} | |
| 39 | + </el-button> | |
| 40 | + <el-button type="primary" @click="handleSubmit"> | |
| 41 | + {{ $t('common.confirm') }} | |
| 42 | + </el-button> | |
| 43 | + </span> | |
| 44 | + </el-dialog> | |
| 45 | +</template> | |
| 46 | + | |
| 47 | +<script> | |
| 48 | +import { saveMaintainanceStandard } from '@/api/inspection/maintainanceStandardManageApi' | |
| 49 | +import { getCommunityId } from '@/api/community/communityApi' | |
| 50 | + | |
| 51 | +export default { | |
| 52 | + name: 'AddMaintainanceStandard', | |
| 53 | + data() { | |
| 54 | + return { | |
| 55 | + visible: false, | |
| 56 | + formData: { | |
| 57 | + standardName: '', | |
| 58 | + remark: '', | |
| 59 | + communityId: '' | |
| 60 | + }, | |
| 61 | + rules: { | |
| 62 | + standardName: [ | |
| 63 | + { required: true, message: this.$t('maintainanceStandard.rules.standardName'), trigger: 'blur' }, | |
| 64 | + { max: 256, message: this.$t('maintainanceStandard.rules.standardNameMax'), trigger: 'blur' } | |
| 65 | + ], | |
| 66 | + remark: [ | |
| 67 | + { required: true, message: this.$t('maintainanceStandard.rules.remark'), trigger: 'blur' }, | |
| 68 | + { max: 512, message: this.$t('maintainanceStandard.rules.remarkMax'), trigger: 'blur' } | |
| 69 | + ] | |
| 70 | + } | |
| 71 | + } | |
| 72 | + }, | |
| 73 | + methods: { | |
| 74 | + open() { | |
| 75 | + this.visible = true | |
| 76 | + this.resetForm() | |
| 77 | + }, | |
| 78 | + resetForm() { | |
| 79 | + this.formData = { | |
| 80 | + standardName: '', | |
| 81 | + remark: '', | |
| 82 | + communityId: getCommunityId() | |
| 83 | + } | |
| 84 | + this.$nextTick(() => { | |
| 85 | + if (this.$refs.form) { | |
| 86 | + this.$refs.form.clearValidate() | |
| 87 | + } | |
| 88 | + }) | |
| 89 | + }, | |
| 90 | + handleClose() { | |
| 91 | + this.resetForm() | |
| 92 | + }, | |
| 93 | + handleSubmit() { | |
| 94 | + this.$refs.form.validate(async valid => { | |
| 95 | + if (valid) { | |
| 96 | + try { | |
| 97 | + await saveMaintainanceStandard(this.formData) | |
| 98 | + this.$message.success(this.$t('maintainanceStandard.message.addSuccess')) | |
| 99 | + this.visible = false | |
| 100 | + this.$emit('success') | |
| 101 | + } catch (error) { | |
| 102 | + this.$message.error(error.message || this.$t('maintainanceStandard.message.addFailed')) | |
| 103 | + } | |
| 104 | + } | |
| 105 | + }) | |
| 106 | + } | |
| 107 | + } | |
| 108 | +} | |
| 109 | +</script> | |
| 0 | 110 | \ No newline at end of file | ... | ... |
src/components/inspection/chooseMaintainancePlanMachine.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <el-dialog | |
| 3 | + :title="$t('chooseMaintainancePlanMachine.title')" | |
| 4 | + :visible.sync="visible" | |
| 5 | + width="80%" | |
| 6 | + @close="handleClose"> | |
| 7 | + | |
| 8 | + <el-row :gutter="20"> | |
| 9 | + <el-col :span="8"> | |
| 10 | + <el-input | |
| 11 | + v-model="searchForm.machineName" | |
| 12 | + :placeholder="$t('chooseMaintainancePlanMachine.machineNamePlaceholder')" | |
| 13 | + clearable | |
| 14 | + @keyup.enter.native="queryMachines"> | |
| 15 | + </el-input> | |
| 16 | + </el-col> | |
| 17 | + <el-col :span="16"> | |
| 18 | + <el-button type="primary" @click="queryMachines"> | |
| 19 | + <i class="el-icon-search"></i> | |
| 20 | + {{ $t('chooseMaintainancePlanMachine.search') }} | |
| 21 | + </el-button> | |
| 22 | + <el-button @click="resetMachines" style="margin-left: 10px;"> | |
| 23 | + <i class="el-icon-refresh"></i> | |
| 24 | + {{ $t('chooseMaintainancePlanMachine.reset') }} | |
| 25 | + </el-button> | |
| 26 | + </el-col> | |
| 27 | + </el-row> | |
| 28 | + | |
| 29 | + <el-table | |
| 30 | + :data="tableData" | |
| 31 | + border | |
| 32 | + style="width: 100%; margin-top: 20px;"> | |
| 33 | + <el-table-column width="50"> | |
| 34 | + <template slot="header"> | |
| 35 | + <el-checkbox v-model="isAllChecked" @change="handleCheckAllChange"></el-checkbox> | |
| 36 | + </template> | |
| 37 | + <template slot-scope="scope"> | |
| 38 | + <el-checkbox | |
| 39 | + v-model="scope.row.checked" | |
| 40 | + @change="handleCheckChange(scope.row)"> | |
| 41 | + </el-checkbox> | |
| 42 | + </template> | |
| 43 | + </el-table-column> | |
| 44 | + <el-table-column | |
| 45 | + prop="machineId" | |
| 46 | + :label="$t('chooseMaintainancePlanMachine.machineId')" | |
| 47 | + align="center"> | |
| 48 | + </el-table-column> | |
| 49 | + <el-table-column | |
| 50 | + prop="machineName" | |
| 51 | + :label="$t('chooseMaintainancePlanMachine.machineName')" | |
| 52 | + align="center"> | |
| 53 | + </el-table-column> | |
| 54 | + </el-table> | |
| 55 | + | |
| 56 | + <el-pagination | |
| 57 | + @size-change="handleSizeChange" | |
| 58 | + @current-change="handleCurrentChange" | |
| 59 | + :current-page="pagination.current" | |
| 60 | + :page-sizes="[10, 20, 30, 50]" | |
| 61 | + :page-size="pagination.size" | |
| 62 | + layout="total, sizes, prev, pager, next, jumper" | |
| 63 | + :total="pagination.total" | |
| 64 | + style="margin-top: 20px;"> | |
| 65 | + </el-pagination> | |
| 66 | + | |
| 67 | + | |
| 68 | + <div slot="footer" class="dialog-footer"> | |
| 69 | + <el-button @click="visible = false">{{ $t('chooseMaintainancePlanMachine.cancel') }}</el-button> | |
| 70 | + <el-button type="primary" @click="submitSelected">{{ $t('chooseMaintainancePlanMachine.submit') }}</el-button> | |
| 71 | + </div> | |
| 72 | + </el-dialog> | |
| 73 | +</template> | |
| 74 | + | |
| 75 | +<script> | |
| 76 | +import { listEquipmentAccount, saveMaintainancePlanMachine } from '@/api/inspection/maintainancePlanMachineApi' | |
| 77 | +import { getCommunityId } from '@/api/community/communityApi' | |
| 78 | + | |
| 79 | +export default { | |
| 80 | + name: 'ChooseMaintainancePlanMachine', | |
| 81 | + data() { | |
| 82 | + return { | |
| 83 | + visible: false, | |
| 84 | + searchForm: { | |
| 85 | + machineName: '' | |
| 86 | + }, | |
| 87 | + tableData: [], | |
| 88 | + pagination: { | |
| 89 | + current: 1, | |
| 90 | + size: 10, | |
| 91 | + total: 0 | |
| 92 | + }, | |
| 93 | + isAllChecked: false, | |
| 94 | + selectedMachines: [], | |
| 95 | + formData: {} | |
| 96 | + } | |
| 97 | + }, | |
| 98 | + methods: { | |
| 99 | + open(params) { | |
| 100 | + this.formData = { ...params } | |
| 101 | + this.visible = true | |
| 102 | + this.resetMachines() | |
| 103 | + }, | |
| 104 | + async queryMachines() { | |
| 105 | + try { | |
| 106 | + const params = { | |
| 107 | + page: this.pagination.current, | |
| 108 | + row: this.pagination.size, | |
| 109 | + machineName: this.searchForm.machineName, | |
| 110 | + communityId: getCommunityId() | |
| 111 | + } | |
| 112 | + const { data, records } = await listEquipmentAccount(params) | |
| 113 | + this.tableData = data.map(item => ({ | |
| 114 | + ...item, | |
| 115 | + checked: false | |
| 116 | + })) | |
| 117 | + this.pagination.total = records | |
| 118 | + this.isAllChecked = false | |
| 119 | + } catch (error) { | |
| 120 | + this.$message.error(this.$t('chooseMaintainancePlanMachine.fetchError')) | |
| 121 | + } | |
| 122 | + }, | |
| 123 | + resetMachines() { | |
| 124 | + this.searchForm.machineName = '' | |
| 125 | + this.pagination.current = 1 | |
| 126 | + this.queryMachines() | |
| 127 | + }, | |
| 128 | + handleCheckAllChange(val) { | |
| 129 | + this.tableData.forEach(item => { | |
| 130 | + item.checked = val | |
| 131 | + }) | |
| 132 | + this.updateSelectedMachines() | |
| 133 | + }, | |
| 134 | + handleCheckChange(row) { | |
| 135 | + console.log(row) | |
| 136 | + this.isAllChecked = this.tableData.every(item => item.checked) | |
| 137 | + this.updateSelectedMachines() | |
| 138 | + }, | |
| 139 | + updateSelectedMachines() { | |
| 140 | + this.selectedMachines = this.tableData | |
| 141 | + .filter(item => item.checked) | |
| 142 | + .map(item => item.machineId) | |
| 143 | + }, | |
| 144 | + async submitSelected() { | |
| 145 | + if (this.selectedMachines.length === 0) { | |
| 146 | + this.$message.warning(this.$t('chooseMaintainancePlanMachine.selectWarning')) | |
| 147 | + return | |
| 148 | + } | |
| 149 | + | |
| 150 | + try { | |
| 151 | + const params = { | |
| 152 | + communityId: getCommunityId(), | |
| 153 | + planId: this.formData.planId, | |
| 154 | + machines: this.selectedMachines | |
| 155 | + } | |
| 156 | + await saveMaintainancePlanMachine(params) | |
| 157 | + this.$emit('success') | |
| 158 | + this.visible = false | |
| 159 | + this.$message.success(this.$t('chooseMaintainancePlanMachine.addSuccess')) | |
| 160 | + } catch (error) { | |
| 161 | + this.$message.error(this.$t('chooseMaintainancePlanMachine.addError')) | |
| 162 | + } | |
| 163 | + }, | |
| 164 | + handleSizeChange(val) { | |
| 165 | + this.pagination.size = val | |
| 166 | + this.queryMachines() | |
| 167 | + }, | |
| 168 | + handleCurrentChange(val) { | |
| 169 | + this.pagination.current = val | |
| 170 | + this.queryMachines() | |
| 171 | + }, | |
| 172 | + handleClose() { | |
| 173 | + this.searchForm.machineName = '' | |
| 174 | + this.tableData = [] | |
| 175 | + this.selectedMachines = [] | |
| 176 | + this.isAllChecked = false | |
| 177 | + } | |
| 178 | + } | |
| 179 | +} | |
| 180 | +</script> | |
| 181 | + | |
| 182 | +<style scoped> | |
| 183 | +.dialog-footer { | |
| 184 | + text-align: right; | |
| 185 | +} | |
| 186 | +</style> | |
| 0 | 187 | \ No newline at end of file | ... | ... |
src/components/inspection/chooseMaintainanceStandardItem.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <el-dialog :title="$t('chooseMaintainanceStandardItem.title')" :visible.sync="visible" width="70%" @close="handleClose"> | |
| 3 | + <el-row :gutter="20"> | |
| 4 | + <el-col :span="24"> | |
| 5 | + | |
| 6 | + <el-row :gutter="20"> | |
| 7 | + <el-col :span="12"> | |
| 8 | + <el-input v-model="form.itemTitle" :placeholder="$t('chooseMaintainanceStandardItem.searchPlaceholder')" | |
| 9 | + clearable @keyup.enter.native="queryItems"> | |
| 10 | + </el-input> | |
| 11 | + </el-col> | |
| 12 | + <el-col :span="12"> | |
| 13 | + <el-button type="primary" @click="queryItems"> | |
| 14 | + <i class="el-icon-search"></i> | |
| 15 | + {{ $t('chooseMaintainanceStandardItem.search') }} | |
| 16 | + </el-button> | |
| 17 | + <el-button @click="resetItems" style="margin-left: 10px;"> | |
| 18 | + <i class="el-icon-refresh"></i> | |
| 19 | + {{ $t('chooseMaintainanceStandardItem.reset') }} | |
| 20 | + </el-button> | |
| 21 | + </el-col> | |
| 22 | + </el-row> | |
| 23 | + | |
| 24 | + <el-table :data="tableData" border style="width: 100%; margin-top: 15px;" v-loading="loading"> | |
| 25 | + <el-table-column width="50" align="center"> | |
| 26 | + <template slot="header"> | |
| 27 | + <el-checkbox v-model="isAllChecked" @change="handleCheckAllChange"></el-checkbox> | |
| 28 | + </template> | |
| 29 | + <template slot-scope="scope"> | |
| 30 | + <el-checkbox v-model="scope.row.checked" @change="handleItemCheckChange(scope.row)"> | |
| 31 | + </el-checkbox> | |
| 32 | + </template> | |
| 33 | + </el-table-column> | |
| 34 | + <el-table-column prop="itemId" :label="$t('chooseMaintainanceStandardItem.id')" align="center"> | |
| 35 | + </el-table-column> | |
| 36 | + <el-table-column prop="itemTitle" :label="$t('chooseMaintainanceStandardItem.item')" align="center"> | |
| 37 | + </el-table-column> | |
| 38 | + </el-table> | |
| 39 | + | |
| 40 | + <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" | |
| 41 | + :current-page="pagination.current" :page-sizes="[10, 20, 30, 50]" :page-size="pagination.size" | |
| 42 | + layout="total, sizes, prev, pager, next, jumper" :total="pagination.total" | |
| 43 | + style="margin-top: 20px; text-align: right;"> | |
| 44 | + </el-pagination> | |
| 45 | + | |
| 46 | + <div style="margin-top: 20px; text-align: right;" v-if="tableData.length > 0"> | |
| 47 | + <el-button type="primary" @click="submit"> | |
| 48 | + <i class="el-icon-check"></i> | |
| 49 | + {{ $t('chooseMaintainanceStandardItem.submit') }} | |
| 50 | + </el-button> | |
| 51 | + <el-button @click="handleClose" style="margin-left: 10px;"> | |
| 52 | + <i class="el-icon-close"></i> | |
| 53 | + {{ $t('chooseMaintainanceStandardItem.cancel') }} | |
| 54 | + </el-button> | |
| 55 | + </div> | |
| 56 | + </el-col> | |
| 57 | + </el-row> | |
| 58 | + </el-dialog> | |
| 59 | +</template> | |
| 60 | + | |
| 61 | +<script> | |
| 62 | +import { listMaintainanceItem, saveMaintainanceStandardItem } from '@/api/inspection/maintainanceStandardItemApi' | |
| 63 | +import { getCommunityId } from '@/api/community/communityApi' | |
| 64 | + | |
| 65 | +export default { | |
| 66 | + name: 'ChooseMaintainanceStandardItem', | |
| 67 | + data() { | |
| 68 | + return { | |
| 69 | + visible: false, | |
| 70 | + loading: false, | |
| 71 | + form: { | |
| 72 | + itemTitle: '', | |
| 73 | + standardId: '' | |
| 74 | + }, | |
| 75 | + tableData: [], | |
| 76 | + pagination: { | |
| 77 | + current: 1, | |
| 78 | + size: 10, | |
| 79 | + total: 0 | |
| 80 | + }, | |
| 81 | + isAllChecked: false | |
| 82 | + } | |
| 83 | + }, | |
| 84 | + methods: { | |
| 85 | + open(params) { | |
| 86 | + this.resetForm() | |
| 87 | + this.form.standardId = params.standardId | |
| 88 | + this.visible = true | |
| 89 | + this.loadItems() | |
| 90 | + }, | |
| 91 | + async loadItems() { | |
| 92 | + try { | |
| 93 | + this.loading = true | |
| 94 | + const params = { | |
| 95 | + page: this.pagination.current, | |
| 96 | + row: this.pagination.size, | |
| 97 | + itemTitle: this.form.itemTitle, | |
| 98 | + communityId: getCommunityId() | |
| 99 | + } | |
| 100 | + const { data, records } = await listMaintainanceItem(params) | |
| 101 | + this.tableData = data.map(item => ({ | |
| 102 | + ...item, | |
| 103 | + checked: false | |
| 104 | + })) | |
| 105 | + this.pagination.total = records | |
| 106 | + } catch (error) { | |
| 107 | + this.$message.error(this.$t('chooseMaintainanceStandardItem.fetchError')) | |
| 108 | + } finally { | |
| 109 | + this.loading = false | |
| 110 | + } | |
| 111 | + }, | |
| 112 | + queryItems() { | |
| 113 | + this.pagination.current = 1 | |
| 114 | + this.loadItems() | |
| 115 | + }, | |
| 116 | + resetItems() { | |
| 117 | + this.form.itemTitle = '' | |
| 118 | + this.queryItems() | |
| 119 | + }, | |
| 120 | + handleCheckAllChange(val) { | |
| 121 | + this.tableData.forEach(item => { | |
| 122 | + item.checked = val | |
| 123 | + }) | |
| 124 | + }, | |
| 125 | + handleItemCheckChange() { | |
| 126 | + this.isAllChecked = this.tableData.every(item => item.checked) | |
| 127 | + }, | |
| 128 | + async submit() { | |
| 129 | + const selectedItems = this.tableData | |
| 130 | + .filter(item => item.checked) | |
| 131 | + .map(item => item.itemId) | |
| 132 | + | |
| 133 | + if (selectedItems.length === 0) { | |
| 134 | + this.$message.warning(this.$t('chooseMaintainanceStandardItem.selectWarning')) | |
| 135 | + return | |
| 136 | + } | |
| 137 | + | |
| 138 | + try { | |
| 139 | + const params = { | |
| 140 | + communityId: getCommunityId(), | |
| 141 | + standardId: this.form.standardId, | |
| 142 | + items: selectedItems | |
| 143 | + } | |
| 144 | + await saveMaintainanceStandardItem(params) | |
| 145 | + this.$message.success(this.$t('chooseMaintainanceStandardItem.submitSuccess')) | |
| 146 | + this.$emit('success') | |
| 147 | + this.handleClose() | |
| 148 | + } catch (error) { | |
| 149 | + this.$message.error(this.$t('chooseMaintainanceStandardItem.submitError')) | |
| 150 | + } | |
| 151 | + }, | |
| 152 | + handleSizeChange(val) { | |
| 153 | + this.pagination.size = val | |
| 154 | + this.loadItems() | |
| 155 | + }, | |
| 156 | + handleCurrentChange(val) { | |
| 157 | + this.pagination.current = val | |
| 158 | + this.loadItems() | |
| 159 | + }, | |
| 160 | + handleClose() { | |
| 161 | + this.visible = false | |
| 162 | + this.resetForm() | |
| 163 | + }, | |
| 164 | + resetForm() { | |
| 165 | + this.form = { | |
| 166 | + itemTitle: '', | |
| 167 | + standardId: '' | |
| 168 | + } | |
| 169 | + this.tableData = [] | |
| 170 | + this.pagination = { | |
| 171 | + current: 1, | |
| 172 | + size: 10, | |
| 173 | + total: 0 | |
| 174 | + } | |
| 175 | + this.isAllChecked = false | |
| 176 | + } | |
| 177 | + } | |
| 178 | +} | |
| 179 | +</script> | |
| 180 | + | |
| 181 | +<style scoped> | |
| 182 | +.el-input { | |
| 183 | + width: 100%; | |
| 184 | +} | |
| 185 | +</style> | |
| 0 | 186 | \ No newline at end of file | ... | ... |
src/components/inspection/deleteMaintainancePlan.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <el-dialog | |
| 3 | + :title="$t('deleteMaintainancePlan.title')" | |
| 4 | + :visible.sync="visible" | |
| 5 | + width="30%" | |
| 6 | + @close="handleClose" | |
| 7 | + > | |
| 8 | + <div class="text-center"> | |
| 9 | + <p>{{ $t('deleteMaintainancePlan.confirm') }}</p> | |
| 10 | + </div> | |
| 11 | + <span slot="footer" class="dialog-footer"> | |
| 12 | + <el-button @click="handleClose">{{ $t('common.cancel') }}</el-button> | |
| 13 | + <el-button type="primary" @click="handleConfirm">{{ $t('common.confirm') }}</el-button> | |
| 14 | + </span> | |
| 15 | + </el-dialog> | |
| 16 | +</template> | |
| 17 | + | |
| 18 | +<script> | |
| 19 | +import { deleteMaintainancePlan } from '@/api/inspection/maintainancePlanManageApi' | |
| 20 | +import { getCommunityId } from '@/api/community/communityApi' | |
| 21 | + | |
| 22 | +export default { | |
| 23 | + name: 'DeleteMaintainancePlan', | |
| 24 | + data() { | |
| 25 | + return { | |
| 26 | + visible: false, | |
| 27 | + currentRow: {}, | |
| 28 | + communityId: '' | |
| 29 | + } | |
| 30 | + }, | |
| 31 | + created() { | |
| 32 | + this.communityId = getCommunityId() | |
| 33 | + }, | |
| 34 | + methods: { | |
| 35 | + open(row) { | |
| 36 | + this.currentRow = { ...row } | |
| 37 | + this.visible = true | |
| 38 | + }, | |
| 39 | + async handleConfirm() { | |
| 40 | + try { | |
| 41 | + const params = { | |
| 42 | + planId: this.currentRow.planId, | |
| 43 | + communityId: this.communityId | |
| 44 | + } | |
| 45 | + await deleteMaintainancePlan(params) | |
| 46 | + this.$message.success(this.$t('deleteMaintainancePlan.success')) | |
| 47 | + this.$emit('success') | |
| 48 | + this.visible = false | |
| 49 | + } catch (error) { | |
| 50 | + this.$message.error(this.$t('deleteMaintainancePlan.error')) | |
| 51 | + } | |
| 52 | + }, | |
| 53 | + handleClose() { | |
| 54 | + this.visible = false | |
| 55 | + } | |
| 56 | + } | |
| 57 | +} | |
| 58 | +</script> | |
| 59 | + | |
| 60 | +<style scoped> | |
| 61 | +.text-center { | |
| 62 | + text-align: center; | |
| 63 | +} | |
| 64 | +</style> | |
| 0 | 65 | \ No newline at end of file | ... | ... |
src/components/inspection/deleteMaintainancePlanMachine.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <el-dialog :title="$t('deleteMaintainancePlanMachine.title')" :visible.sync="visible" width="30%" @close="handleClose"> | |
| 3 | + | |
| 4 | + <div style="text-align: center; margin-bottom: 20px;"> | |
| 5 | + <p>{{ $t('deleteMaintainancePlanMachine.confirmText') }}</p> | |
| 6 | + </div> | |
| 7 | + | |
| 8 | + <div slot="footer" class="dialog-footer"> | |
| 9 | + <el-button @click="visible = false">{{ $t('deleteMaintainancePlanMachine.cancel') }}</el-button> | |
| 10 | + <el-button type="primary" @click="confirmDelete">{{ $t('deleteMaintainancePlanMachine.confirm') }}</el-button> | |
| 11 | + </div> | |
| 12 | + </el-dialog> | |
| 13 | +</template> | |
| 14 | + | |
| 15 | +<script> | |
| 16 | +import { deleteMaintainancePlanMachine } from '@/api/inspection/maintainancePlanMachineApi' | |
| 17 | +import { getCommunityId } from '@/api/community/communityApi' | |
| 18 | + | |
| 19 | +export default { | |
| 20 | + name: 'DeleteMaintainancePlanMachine', | |
| 21 | + data() { | |
| 22 | + return { | |
| 23 | + visible: false, | |
| 24 | + formData: {} | |
| 25 | + } | |
| 26 | + }, | |
| 27 | + methods: { | |
| 28 | + open(params) { | |
| 29 | + this.formData = { ...params } | |
| 30 | + this.visible = true | |
| 31 | + }, | |
| 32 | + async confirmDelete() { | |
| 33 | + try { | |
| 34 | + const params = { | |
| 35 | + ...this.formData, | |
| 36 | + communityId: getCommunityId() | |
| 37 | + } | |
| 38 | + await deleteMaintainancePlanMachine(params) | |
| 39 | + this.$emit('success') | |
| 40 | + this.visible = false | |
| 41 | + this.$message.success(this.$t('deleteMaintainancePlanMachine.deleteSuccess')) | |
| 42 | + } catch (error) { | |
| 43 | + this.$message.error(this.$t('deleteMaintainancePlanMachine.deleteError')) | |
| 44 | + } | |
| 45 | + }, | |
| 46 | + handleClose() { | |
| 47 | + this.formData = {} | |
| 48 | + } | |
| 49 | + } | |
| 50 | +} | |
| 51 | +</script> | |
| 52 | + | |
| 53 | +<style scoped> | |
| 54 | +.dialog-footer { | |
| 55 | + text-align: right; | |
| 56 | +} | |
| 57 | +</style> | |
| 0 | 58 | \ No newline at end of file | ... | ... |
src/components/inspection/deleteMaintainanceStandard.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <el-dialog | |
| 3 | + :title="$t('maintainanceStandard.delete.title')" | |
| 4 | + :visible.sync="visible" | |
| 5 | + width="30%" | |
| 6 | + center | |
| 7 | + > | |
| 8 | + <div class="text-center"> | |
| 9 | + <p>{{ $t('maintainanceStandard.delete.confirmText') }}</p> | |
| 10 | + </div> | |
| 11 | + <span slot="footer" class="dialog-footer"> | |
| 12 | + <el-button @click="visible = false"> | |
| 13 | + {{ $t('common.cancel') }} | |
| 14 | + </el-button> | |
| 15 | + <el-button type="primary" @click="handleConfirm" :loading="loading"> | |
| 16 | + {{ $t('common.confirm') }} | |
| 17 | + </el-button> | |
| 18 | + </span> | |
| 19 | + </el-dialog> | |
| 20 | +</template> | |
| 21 | + | |
| 22 | +<script> | |
| 23 | +import { deleteMaintainanceStandard } from '@/api/inspection/maintainanceStandardManageApi' | |
| 24 | +import { getCommunityId } from '@/api/community/communityApi' | |
| 25 | + | |
| 26 | +export default { | |
| 27 | + name: 'DeleteMaintainanceStandard', | |
| 28 | + data() { | |
| 29 | + return { | |
| 30 | + visible: false, | |
| 31 | + loading: false, | |
| 32 | + currentData: { | |
| 33 | + standardId: '', | |
| 34 | + communityId: '' | |
| 35 | + } | |
| 36 | + } | |
| 37 | + }, | |
| 38 | + methods: { | |
| 39 | + open(row) { | |
| 40 | + this.currentData = { | |
| 41 | + standardId: row.standardId, | |
| 42 | + communityId: getCommunityId() | |
| 43 | + } | |
| 44 | + this.visible = true | |
| 45 | + }, | |
| 46 | + async handleConfirm() { | |
| 47 | + try { | |
| 48 | + this.loading = true | |
| 49 | + await deleteMaintainanceStandard(this.currentData) | |
| 50 | + this.$message.success(this.$t('maintainanceStandard.message.deleteSuccess')) | |
| 51 | + this.visible = false | |
| 52 | + this.$emit('success') | |
| 53 | + } catch (error) { | |
| 54 | + this.$message.error(error.message || this.$t('maintainanceStandard.message.deleteFailed')) | |
| 55 | + } finally { | |
| 56 | + this.loading = false | |
| 57 | + } | |
| 58 | + } | |
| 59 | + } | |
| 60 | +} | |
| 61 | +</script> | |
| 0 | 62 | \ No newline at end of file | ... | ... |
src/components/inspection/deleteMaintainanceStandardItem.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <el-dialog :title="$t('deleteMaintainanceStandardItem.title')" :visible.sync="visible" width="30%" @close="handleClose"> | |
| 3 | + <el-row> | |
| 4 | + <el-col :span="24"> | |
| 5 | + | |
| 6 | + <div style="text-align: center; margin-bottom: 20px;"> | |
| 7 | + {{ $t('deleteMaintainanceStandardItem.confirmMessage') }} | |
| 8 | + </div> | |
| 9 | + <div style="text-align: center;"> | |
| 10 | + <el-button @click="handleClose"> | |
| 11 | + {{ $t('deleteMaintainanceStandardItem.cancel') }} | |
| 12 | + </el-button> | |
| 13 | + <el-button type="primary" @click="confirmDelete" style="margin-left: 20px;"> | |
| 14 | + {{ $t('deleteMaintainanceStandardItem.confirm') }} | |
| 15 | + </el-button> | |
| 16 | + </div> | |
| 17 | + </el-col> | |
| 18 | + </el-row> | |
| 19 | + </el-dialog> | |
| 20 | +</template> | |
| 21 | + | |
| 22 | +<script> | |
| 23 | +import { deleteMaintainanceStandardItem } from '@/api/inspection/maintainanceStandardItemApi' | |
| 24 | +import { getCommunityId } from '@/api/community/communityApi' | |
| 25 | + | |
| 26 | +export default { | |
| 27 | + name: 'DeleteMaintainanceStandardItem', | |
| 28 | + data() { | |
| 29 | + return { | |
| 30 | + visible: false, | |
| 31 | + form: { | |
| 32 | + itemId: '', | |
| 33 | + msiId: '', | |
| 34 | + standardId: '' | |
| 35 | + } | |
| 36 | + } | |
| 37 | + }, | |
| 38 | + methods: { | |
| 39 | + open(params) { | |
| 40 | + this.form = { | |
| 41 | + itemId: params.itemId, | |
| 42 | + msiId: params.msiId, | |
| 43 | + standardId: params.standardId | |
| 44 | + } | |
| 45 | + this.visible = true | |
| 46 | + }, | |
| 47 | + async confirmDelete() { | |
| 48 | + try { | |
| 49 | + const params = { | |
| 50 | + ...this.form, | |
| 51 | + communityId: getCommunityId() | |
| 52 | + } | |
| 53 | + await deleteMaintainanceStandardItem(params) | |
| 54 | + this.$message.success(this.$t('deleteMaintainanceStandardItem.deleteSuccess')) | |
| 55 | + this.$emit('success') | |
| 56 | + this.handleClose() | |
| 57 | + } catch (error) { | |
| 58 | + this.$message.error(this.$t('deleteMaintainanceStandardItem.deleteError')) | |
| 59 | + } | |
| 60 | + }, | |
| 61 | + handleClose() { | |
| 62 | + this.visible = false | |
| 63 | + this.resetForm() | |
| 64 | + }, | |
| 65 | + resetForm() { | |
| 66 | + this.form = { | |
| 67 | + itemId: '', | |
| 68 | + standardId: '' | |
| 69 | + } | |
| 70 | + } | |
| 71 | + } | |
| 72 | +} | |
| 73 | +</script> | |
| 0 | 74 | \ No newline at end of file | ... | ... |
src/components/inspection/editMaintainanceStandard.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <el-dialog | |
| 3 | + :title="$t('maintainanceStandard.edit.title')" | |
| 4 | + :visible.sync="visible" | |
| 5 | + width="50%" | |
| 6 | + @close="handleClose" | |
| 7 | + > | |
| 8 | + <el-form | |
| 9 | + ref="form" | |
| 10 | + :model="formData" | |
| 11 | + :rules="rules" | |
| 12 | + label-width="120px" | |
| 13 | + > | |
| 14 | + <el-form-item | |
| 15 | + :label="$t('maintainanceStandard.form.standardName')" | |
| 16 | + prop="standardName" | |
| 17 | + > | |
| 18 | + <el-input | |
| 19 | + v-model="formData.standardName" | |
| 20 | + :placeholder="$t('maintainanceStandard.placeholder.standardName')" | |
| 21 | + /> | |
| 22 | + </el-form-item> | |
| 23 | + <el-form-item | |
| 24 | + :label="$t('maintainanceStandard.form.remark')" | |
| 25 | + prop="remark" | |
| 26 | + > | |
| 27 | + <el-input | |
| 28 | + v-model="formData.remark" | |
| 29 | + type="textarea" | |
| 30 | + :placeholder="$t('maintainanceStandard.placeholder.remark')" | |
| 31 | + :rows="3" | |
| 32 | + /> | |
| 33 | + </el-form-item> | |
| 34 | + </el-form> | |
| 35 | + | |
| 36 | + <span slot="footer" class="dialog-footer"> | |
| 37 | + <el-button @click="visible = false"> | |
| 38 | + {{ $t('common.cancel') }} | |
| 39 | + </el-button> | |
| 40 | + <el-button type="primary" @click="handleSubmit"> | |
| 41 | + {{ $t('common.confirm') }} | |
| 42 | + </el-button> | |
| 43 | + </span> | |
| 44 | + </el-dialog> | |
| 45 | +</template> | |
| 46 | + | |
| 47 | +<script> | |
| 48 | +import { updateMaintainanceStandard } from '@/api/inspection/maintainanceStandardManageApi' | |
| 49 | +import { getCommunityId } from '@/api/community/communityApi' | |
| 50 | + | |
| 51 | +export default { | |
| 52 | + name: 'EditMaintainanceStandard', | |
| 53 | + data() { | |
| 54 | + return { | |
| 55 | + visible: false, | |
| 56 | + formData: { | |
| 57 | + standardId: '', | |
| 58 | + standardName: '', | |
| 59 | + remark: '', | |
| 60 | + communityId: '' | |
| 61 | + }, | |
| 62 | + rules: { | |
| 63 | + standardName: [ | |
| 64 | + { required: true, message: this.$t('maintainanceStandard.rules.standardName'), trigger: 'blur' }, | |
| 65 | + { max: 256, message: this.$t('maintainanceStandard.rules.standardNameMax'), trigger: 'blur' } | |
| 66 | + ], | |
| 67 | + remark: [ | |
| 68 | + { required: true, message: this.$t('maintainanceStandard.rules.remark'), trigger: 'blur' }, | |
| 69 | + { max: 512, message: this.$t('maintainanceStandard.rules.remarkMax'), trigger: 'blur' } | |
| 70 | + ], | |
| 71 | + standardId: [ | |
| 72 | + { required: true, message: this.$t('maintainanceStandard.rules.standardId'), trigger: 'blur' } | |
| 73 | + ] | |
| 74 | + } | |
| 75 | + } | |
| 76 | + }, | |
| 77 | + methods: { | |
| 78 | + open(row) { | |
| 79 | + this.formData = { | |
| 80 | + standardId: row.standardId, | |
| 81 | + standardName: row.standardName, | |
| 82 | + remark: row.remark, | |
| 83 | + communityId: getCommunityId() | |
| 84 | + } | |
| 85 | + this.visible = true | |
| 86 | + this.$nextTick(() => { | |
| 87 | + if (this.$refs.form) { | |
| 88 | + this.$refs.form.clearValidate() | |
| 89 | + } | |
| 90 | + }) | |
| 91 | + }, | |
| 92 | + handleClose() { | |
| 93 | + this.formData = { | |
| 94 | + standardId: '', | |
| 95 | + standardName: '', | |
| 96 | + remark: '', | |
| 97 | + communityId: '' | |
| 98 | + } | |
| 99 | + }, | |
| 100 | + handleSubmit() { | |
| 101 | + this.$refs.form.validate(async valid => { | |
| 102 | + if (valid) { | |
| 103 | + try { | |
| 104 | + await updateMaintainanceStandard(this.formData) | |
| 105 | + this.$message.success(this.$t('maintainanceStandard.message.editSuccess')) | |
| 106 | + this.visible = false | |
| 107 | + this.$emit('success') | |
| 108 | + } catch (error) { | |
| 109 | + this.$message.error(error.message || this.$t('maintainanceStandard.message.editFailed')) | |
| 110 | + } | |
| 111 | + } | |
| 112 | + }) | |
| 113 | + } | |
| 114 | + } | |
| 115 | +} | |
| 116 | +</script> | |
| 0 | 117 | \ No newline at end of file | ... | ... |
src/components/inspection/maintainancePlanState.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <el-dialog | |
| 3 | + :title="$t('maintainancePlanState.title')" | |
| 4 | + :visible.sync="visible" | |
| 5 | + width="30%" | |
| 6 | + @close="handleClose" | |
| 7 | + > | |
| 8 | + <div class="text-center"> | |
| 9 | + <p> | |
| 10 | + {{ $t('maintainancePlanState.confirm') }} | |
| 11 | + <span style="color:#409EFF">{{ formData.stateName }}</span> | |
| 12 | + {{ $t('maintainancePlanState.plan') }} | |
| 13 | + </p> | |
| 14 | + </div> | |
| 15 | + <span slot="footer" class="dialog-footer"> | |
| 16 | + <el-button @click="handleClose">{{ $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 { updateMaintainancePlanState } from '@/api/inspection/maintainancePlanManageApi' | |
| 24 | +import { getCommunityId } from '@/api/community/communityApi' | |
| 25 | + | |
| 26 | +export default { | |
| 27 | + name: 'MaintainancePlanState', | |
| 28 | + data() { | |
| 29 | + return { | |
| 30 | + visible: false, | |
| 31 | + formData: { | |
| 32 | + planId: '', | |
| 33 | + stateName: '', | |
| 34 | + state: '' | |
| 35 | + }, | |
| 36 | + communityId: '' | |
| 37 | + } | |
| 38 | + }, | |
| 39 | + created() { | |
| 40 | + this.communityId = getCommunityId() | |
| 41 | + }, | |
| 42 | + methods: { | |
| 43 | + open(data) { | |
| 44 | + this.formData = { ...data } | |
| 45 | + this.visible = true | |
| 46 | + }, | |
| 47 | + async handleConfirm() { | |
| 48 | + try { | |
| 49 | + const params = { | |
| 50 | + planId: this.formData.planId, | |
| 51 | + state: this.formData.state, | |
| 52 | + communityId: this.communityId | |
| 53 | + } | |
| 54 | + await updateMaintainancePlanState(params) | |
| 55 | + this.$message.success(this.$t('maintainancePlanState.success')) | |
| 56 | + this.$emit('success') | |
| 57 | + this.visible = false | |
| 58 | + } catch (error) { | |
| 59 | + this.$message.error(this.$t('maintainancePlanState.error')) | |
| 60 | + } | |
| 61 | + }, | |
| 62 | + handleClose() { | |
| 63 | + this.visible = false | |
| 64 | + } | |
| 65 | + } | |
| 66 | +} | |
| 67 | +</script> | |
| 68 | + | |
| 69 | +<style scoped> | |
| 70 | +.text-center { | |
| 71 | + text-align: center; | |
| 72 | +} | |
| 73 | +</style> | |
| 0 | 74 | \ No newline at end of file | ... | ... |
src/i18n/inspectionI18n.js
| 1 | 1 | import { messages as maintainanceItemMessages } from '../views/inspection/maintainanceItemLang' |
| 2 | +import { messages as maintainanceStandardManageMessages } from '../views/inspection/maintainanceStandardManageLang' | |
| 3 | +import { messages as maintainanceStandardItemMessages } from '../views/inspection/maintainanceStandardItemLang' | |
| 4 | +import { messages as maintainancePlanManageMessages } from '../views/inspection/maintainancePlanManageLang' | |
| 5 | +import { messages as addMaintainancePlanMessages } from '../views/inspection/addMaintainancePlanLang' | |
| 6 | +import { messages as editMaintainancePlanMessages } from '../views/inspection/editMaintainancePlanLang' | |
| 7 | +import { messages as maintainancePlanMachineMessages } from '../views/inspection/maintainancePlanMachineLang' | |
| 8 | + | |
| 2 | 9 | export const messages = { |
| 3 | 10 | en: { |
| 4 | 11 | ...maintainanceItemMessages.en, |
| 12 | + ...maintainanceStandardManageMessages.en, | |
| 13 | + ...maintainanceStandardItemMessages.en, | |
| 14 | + ...maintainancePlanManageMessages.en, | |
| 15 | + ...addMaintainancePlanMessages.en, | |
| 16 | + ...editMaintainancePlanMessages.en, | |
| 17 | + ...maintainancePlanMachineMessages.en, | |
| 5 | 18 | }, |
| 6 | 19 | zh: { |
| 7 | 20 | ...maintainanceItemMessages.zh, |
| 21 | + ...maintainanceStandardManageMessages.zh, | |
| 22 | + ...maintainanceStandardItemMessages.zh, | |
| 23 | + ...maintainancePlanManageMessages.zh, | |
| 24 | + ...addMaintainancePlanMessages.zh, | |
| 25 | + ...editMaintainancePlanMessages.zh, | |
| 26 | + ...maintainancePlanMachineMessages.zh, | |
| 8 | 27 | } |
| 9 | 28 | |
| 10 | 29 | } |
| 11 | 30 | \ No newline at end of file | ... | ... |
src/router/inspectionRouter.js
| ... | ... | @@ -64,4 +64,34 @@ export default [ |
| 64 | 64 | name: '/pages/property/maintainanceItem', |
| 65 | 65 | component: () => import('@/views/inspection/maintainanceItemList.vue') |
| 66 | 66 | }, |
| 67 | + { | |
| 68 | + path: '/pages/property/maintainanceStandardManage', | |
| 69 | + name: '/pages/property/maintainanceStandardManage', | |
| 70 | + component: () => import('@/views/inspection/maintainanceStandardManageList.vue') | |
| 71 | + }, | |
| 72 | + { | |
| 73 | + path: '/views/inspection/maintainanceStandardItem', | |
| 74 | + name: '/views/inspection/maintainanceStandardItem', | |
| 75 | + component: () => import('@/views/inspection/maintainanceStandardItemList.vue') | |
| 76 | + }, | |
| 77 | + { | |
| 78 | + path: '/pages/property/maintainancePlanManage', | |
| 79 | + name: '/pages/property/maintainancePlanManage', | |
| 80 | + component: () => import('@/views/inspection/maintainancePlanManageList.vue') | |
| 81 | + }, | |
| 82 | + { | |
| 83 | + path: '/views/inspection/addMaintainancePlan', | |
| 84 | + name: '/views/inspection/addMaintainancePlan', | |
| 85 | + component: () => import('@/views/inspection/addMaintainancePlanList.vue') | |
| 86 | + }, | |
| 87 | + { | |
| 88 | + path: '/views/inspection/editMaintainancePlan', | |
| 89 | + name: '/views/inspection/editMaintainancePlan', | |
| 90 | + component: () => import('@/views/inspection/editMaintainancePlanList.vue') | |
| 91 | + }, | |
| 92 | + { | |
| 93 | + path: '/views/inspection/maintainancePlanMachine', | |
| 94 | + name: '/views/inspection/maintainancePlanMachine', | |
| 95 | + component: () => import('@/views/inspection/maintainancePlanMachineList.vue') | |
| 96 | + }, | |
| 67 | 97 | ] |
| 68 | 98 | \ No newline at end of file | ... | ... |
src/views/inspection/addMaintainancePlanLang.js
0 → 100644
| 1 | +export const messages = { | |
| 2 | + en: { | |
| 3 | + addMaintainancePlan: { | |
| 4 | + title: 'Add Maintenance Plan', | |
| 5 | + planName: 'Plan Name', | |
| 6 | + planNamePlaceholder: 'Required, please enter plan name', | |
| 7 | + standard: 'Maintenance Standard', | |
| 8 | + standardPlaceholder: 'Required, please select maintenance standard', | |
| 9 | + period: 'Maintenance Cycle', | |
| 10 | + periodPlaceholder: 'Required, please select inspection cycle', | |
| 11 | + month: 'Month', | |
| 12 | + monthUnit: 'Month', | |
| 13 | + day: 'Day', | |
| 14 | + dayUnit: 'Day', | |
| 15 | + fixedDays: 'Fixed Days', | |
| 16 | + fixedDaysPlaceholder: 'Required, please enter days', | |
| 17 | + startDate: 'Start Date', | |
| 18 | + startDatePlaceholder: 'Required, please enter start date', | |
| 19 | + endDate: 'End Date', | |
| 20 | + endDatePlaceholder: 'Required, please enter end date', | |
| 21 | + staff: 'Select Staff', | |
| 22 | + machine: 'Maintenance Equipment', | |
| 23 | + machinePlaceholder: 'Required, please select equipment', | |
| 24 | + saveSuccess: 'Added successfully', | |
| 25 | + saveError: 'Failed to add', | |
| 26 | + validate: { | |
| 27 | + planNameRequired: 'Plan name cannot be empty', | |
| 28 | + standardRequired: 'Maintenance standard cannot be empty', | |
| 29 | + periodRequired: 'Maintenance cycle cannot be empty', | |
| 30 | + monthRequired: 'Month cannot be empty', | |
| 31 | + dayRequired: 'Day cannot be empty', | |
| 32 | + fixedDaysRequired: 'Fixed days cannot be empty', | |
| 33 | + startDateRequired: 'Start date cannot be empty', | |
| 34 | + endDateRequired: 'End date cannot be empty', | |
| 35 | + machineRequired: 'Equipment cannot be empty' | |
| 36 | + } | |
| 37 | + } | |
| 38 | + }, | |
| 39 | + zh: { | |
| 40 | + addMaintainancePlan: { | |
| 41 | + title: '添加保养计划', | |
| 42 | + planName: '计划名称', | |
| 43 | + planNamePlaceholder: '必填,请填写计划名称', | |
| 44 | + standard: '保养标准', | |
| 45 | + standardPlaceholder: '必填,请选择保养标准', | |
| 46 | + period: '保养周期', | |
| 47 | + periodPlaceholder: '必填,请选择巡检周期', | |
| 48 | + month: '月', | |
| 49 | + monthUnit: '月', | |
| 50 | + day: '日', | |
| 51 | + dayUnit: '日', | |
| 52 | + fixedDays: '固定天数', | |
| 53 | + fixedDaysPlaceholder: '必填,请填写多少天后保养一次', | |
| 54 | + startDate: '开始日期', | |
| 55 | + startDatePlaceholder: '必填,请填写开始日期', | |
| 56 | + endDate: '结束日期', | |
| 57 | + endDatePlaceholder: '必填,请填写结束日期', | |
| 58 | + staff: '选择员工', | |
| 59 | + machine: '保养设备', | |
| 60 | + machinePlaceholder: '必填,请选择设备', | |
| 61 | + saveSuccess: '添加成功', | |
| 62 | + saveError: '添加失败', | |
| 63 | + validate: { | |
| 64 | + planNameRequired: '计划名称不能为空', | |
| 65 | + standardRequired: '保养标准不能为空', | |
| 66 | + periodRequired: '保养周期不能为空', | |
| 67 | + monthRequired: '月不能为空', | |
| 68 | + dayRequired: '日不能为空', | |
| 69 | + fixedDaysRequired: '固定天数不能为空', | |
| 70 | + startDateRequired: '开始日期不能为空', | |
| 71 | + endDateRequired: '结束日期不能为空', | |
| 72 | + machineRequired: '设备不能为空' | |
| 73 | + } | |
| 74 | + } | |
| 75 | + } | |
| 76 | +} | |
| 0 | 77 | \ No newline at end of file | ... | ... |
src/views/inspection/addMaintainancePlanList.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="add-maintainance-plan-container"> | |
| 3 | + <el-card> | |
| 4 | + <div slot="header" class="clearfix"> | |
| 5 | + <span>{{ $t('addMaintainancePlan.title') }}</span> | |
| 6 | + </div> | |
| 7 | + | |
| 8 | + <el-form ref="form" :model="addMaintainancePlanInfo" label-width="120px"> | |
| 9 | + <el-row :gutter="20"> | |
| 10 | + <el-col :span="24"> | |
| 11 | + <el-form-item :label="$t('addMaintainancePlan.planName')" prop="planName"> | |
| 12 | + <el-input v-model="addMaintainancePlanInfo.planName" | |
| 13 | + :placeholder="$t('addMaintainancePlan.planNamePlaceholder')" clearable /> | |
| 14 | + </el-form-item> | |
| 15 | + </el-col> | |
| 16 | + </el-row> | |
| 17 | + | |
| 18 | + <el-row :gutter="20"> | |
| 19 | + <el-col :span="12"> | |
| 20 | + <el-form-item :label="$t('addMaintainancePlan.standard')" prop="standardId"> | |
| 21 | + <el-select v-model="addMaintainancePlanInfo.standardId" | |
| 22 | + :placeholder="$t('addMaintainancePlan.standardPlaceholder')" style="width:100%" clearable> | |
| 23 | + <el-option v-for="item in addMaintainancePlanInfo.standards" :key="item.standardId" | |
| 24 | + :label="item.standardName" :value="item.standardId" /> | |
| 25 | + </el-select> | |
| 26 | + </el-form-item> | |
| 27 | + </el-col> | |
| 28 | + <el-col :span="12"> | |
| 29 | + <el-form-item :label="$t('addMaintainancePlan.period')" prop="planPeriod"> | |
| 30 | + <el-select v-model="addMaintainancePlanInfo.planPeriod" @change="changeMaintainancePeriod" | |
| 31 | + :placeholder="$t('addMaintainancePlan.periodPlaceholder')" style="width:100%" clearable> | |
| 32 | + <el-option label="月/天" value="2020022" /> | |
| 33 | + <el-option label="固定(天)" value="2020024" /> | |
| 34 | + </el-select> | |
| 35 | + </el-form-item> | |
| 36 | + </el-col> | |
| 37 | + </el-row> | |
| 38 | + | |
| 39 | + <el-row :gutter="20" v-if="addMaintainancePlanInfo.planPeriod === '2020022'"> | |
| 40 | + <el-col :span="24"> | |
| 41 | + <el-form-item :label="$t('addMaintainancePlan.month')"> | |
| 42 | + <el-checkbox-group v-model="addMaintainancePlanInfo.months"> | |
| 43 | + <el-checkbox v-for="index in 12" :key="index" :label="index"> | |
| 44 | + {{ index }}{{ $t('addMaintainancePlan.monthUnit') }} | |
| 45 | + </el-checkbox> | |
| 46 | + </el-checkbox-group> | |
| 47 | + </el-form-item> | |
| 48 | + </el-col> | |
| 49 | + </el-row> | |
| 50 | + | |
| 51 | + <el-row :gutter="20" v-if="addMaintainancePlanInfo.planPeriod === '2020022'"> | |
| 52 | + <el-col :span="24"> | |
| 53 | + <el-form-item :label="$t('addMaintainancePlan.day')"> | |
| 54 | + <el-checkbox-group v-model="addMaintainancePlanInfo.days"> | |
| 55 | + <el-checkbox v-for="index in 31" :key="index" :label="index"> | |
| 56 | + {{ index }}{{ $t('addMaintainancePlan.dayUnit') }} | |
| 57 | + </el-checkbox> | |
| 58 | + </el-checkbox-group> | |
| 59 | + </el-form-item> | |
| 60 | + </el-col> | |
| 61 | + </el-row> | |
| 62 | + | |
| 63 | + <el-row :gutter="20" v-if="addMaintainancePlanInfo.planPeriod === '2020024'"> | |
| 64 | + <el-col :span="12"> | |
| 65 | + <el-form-item :label="$t('addMaintainancePlan.fixedDays')"> | |
| 66 | + <el-input-number v-model="addMaintainancePlanInfo.everyDays" :min="1" | |
| 67 | + :placeholder="$t('addMaintainancePlan.fixedDaysPlaceholder')" /> | |
| 68 | + </el-form-item> | |
| 69 | + </el-col> | |
| 70 | + </el-row> | |
| 71 | + | |
| 72 | + <el-row :gutter="20"> | |
| 73 | + <el-col :span="12"> | |
| 74 | + <el-form-item :label="$t('addMaintainancePlan.startDate')" prop="startDate"> | |
| 75 | + <el-date-picker v-model="addMaintainancePlanInfo.startDate" type="date" | |
| 76 | + :placeholder="$t('addMaintainancePlan.startDatePlaceholder')" style="width:100%" | |
| 77 | + value-format="yyyy-MM-dd" /> | |
| 78 | + </el-form-item> | |
| 79 | + </el-col> | |
| 80 | + <el-col :span="12"> | |
| 81 | + <el-form-item :label="$t('addMaintainancePlan.endDate')" prop="endDate"> | |
| 82 | + <el-date-picker v-model="addMaintainancePlanInfo.endDate" type="date" | |
| 83 | + :placeholder="$t('addMaintainancePlan.endDatePlaceholder')" style="width:100%" | |
| 84 | + value-format="yyyy-MM-dd" /> | |
| 85 | + </el-form-item> | |
| 86 | + </el-col> | |
| 87 | + </el-row> | |
| 88 | + | |
| 89 | + <el-row :gutter="20"> | |
| 90 | + <el-col :span="24"> | |
| 91 | + <el-form-item :label="$t('addMaintainancePlan.staff')"> | |
| 92 | + <select-staffs-div ref="selectStaffs" @selectStaffs="handleStaffSelected" /> | |
| 93 | + | |
| 94 | + </el-form-item> | |
| 95 | + </el-col> | |
| 96 | + </el-row> | |
| 97 | + | |
| 98 | + <el-row :gutter="20"> | |
| 99 | + <el-col :span="24"> | |
| 100 | + <el-form-item :label="$t('addMaintainancePlan.machine')" prop="machineIds"> | |
| 101 | + <el-select v-model="addMaintainancePlanInfo.machineIds" multiple | |
| 102 | + :placeholder="$t('addMaintainancePlan.machinePlaceholder')" style="width:100%"> | |
| 103 | + <el-option v-for="item in addMaintainancePlanInfo.machines" :key="item.machineId" | |
| 104 | + :label="`${item.machineName}(${item.machineCode})`" :value="item.machineId" /> | |
| 105 | + </el-select> | |
| 106 | + </el-form-item> | |
| 107 | + </el-col> | |
| 108 | + </el-row> | |
| 109 | + | |
| 110 | + <el-row> | |
| 111 | + <el-col :span="24" style="text-align: right;"> | |
| 112 | + <el-button type="warning" @click="goBack"> | |
| 113 | + {{ $t('common.back') }} | |
| 114 | + </el-button> | |
| 115 | + <el-button type="primary" @click="saveMaintainancePlanInfo"> | |
| 116 | + {{ $t('common.save') }} | |
| 117 | + </el-button> | |
| 118 | + </el-col> | |
| 119 | + </el-row> | |
| 120 | + </el-form> | |
| 121 | + </el-card> | |
| 122 | + </div> | |
| 123 | +</template> | |
| 124 | + | |
| 125 | +<script> | |
| 126 | +import { getCommunityId } from '@/api/community/communityApi' | |
| 127 | +import SelectStaffsDiv from '@/components/staff/selectStaffsDiv' | |
| 128 | +import { | |
| 129 | + saveMaintainancePlan, | |
| 130 | + listMaintainanceStandard, | |
| 131 | + listEquipmentAccount | |
| 132 | +} from '@/api/inspection/addMaintainancePlanApi' | |
| 133 | + | |
| 134 | +export default { | |
| 135 | + name: 'AddMaintainancePlanList', | |
| 136 | + components: { | |
| 137 | + SelectStaffsDiv | |
| 138 | + }, | |
| 139 | + data() { | |
| 140 | + return { | |
| 141 | + addMaintainancePlanInfo: { | |
| 142 | + planId: '', | |
| 143 | + planName: '', | |
| 144 | + standardId: '', | |
| 145 | + standards: [], | |
| 146 | + planPeriod: '', | |
| 147 | + startDate: new Date().toISOString().split('T')[0], | |
| 148 | + endDate: '2050-01-01', | |
| 149 | + state: '2020025', | |
| 150 | + remark: '', | |
| 151 | + machineIds: [], | |
| 152 | + months: [], | |
| 153 | + days: [], | |
| 154 | + everyDays: [], | |
| 155 | + machines: [] | |
| 156 | + } | |
| 157 | + } | |
| 158 | + }, | |
| 159 | + created() { | |
| 160 | + this.initData() | |
| 161 | + }, | |
| 162 | + methods: { | |
| 163 | + async initData() { | |
| 164 | + this.addMaintainancePlanInfo.communityId = getCommunityId() | |
| 165 | + await this.listMaintainanceStandards() | |
| 166 | + await this.listEquipmentAccounts() | |
| 167 | + }, | |
| 168 | + handleStaffSelected(staffs) { | |
| 169 | + console.log(staffs) | |
| 170 | + this.form.staffs = staffs | |
| 171 | + }, | |
| 172 | + async listMaintainanceStandards() { | |
| 173 | + try { | |
| 174 | + const params = { | |
| 175 | + page: 1, | |
| 176 | + row: 100, | |
| 177 | + communityId: this.addMaintainancePlanInfo.communityId | |
| 178 | + } | |
| 179 | + const { data } = await listMaintainanceStandard(params) | |
| 180 | + this.addMaintainancePlanInfo.standards = data | |
| 181 | + } catch (error) { | |
| 182 | + console.error('获取保养标准失败:', error) | |
| 183 | + } | |
| 184 | + }, | |
| 185 | + async listEquipmentAccounts() { | |
| 186 | + try { | |
| 187 | + const params = { | |
| 188 | + page: 1, | |
| 189 | + row: 100, | |
| 190 | + communityId: this.addMaintainancePlanInfo.communityId | |
| 191 | + } | |
| 192 | + const { data } = await listEquipmentAccount(params) | |
| 193 | + this.addMaintainancePlanInfo.machines = data | |
| 194 | + } catch (error) { | |
| 195 | + console.error('获取设备列表失败:', error) | |
| 196 | + } | |
| 197 | + }, | |
| 198 | + changeMaintainancePeriod() { | |
| 199 | + this.addMaintainancePlanInfo.months = [] | |
| 200 | + this.addMaintainancePlanInfo.days = [] | |
| 201 | + this.addMaintainancePlanInfo.everyDays = [] | |
| 202 | + }, | |
| 203 | + validateForm() { | |
| 204 | + const requiredFields = [ | |
| 205 | + { field: 'planName', message: this.$t('addMaintainancePlan.validate.planNameRequired') }, | |
| 206 | + { field: 'standardId', message: this.$t('addMaintainancePlan.validate.standardRequired') }, | |
| 207 | + { field: 'planPeriod', message: this.$t('addMaintainancePlan.validate.periodRequired') }, | |
| 208 | + { field: 'startDate', message: this.$t('addMaintainancePlan.validate.startDateRequired') }, | |
| 209 | + { field: 'endDate', message: this.$t('addMaintainancePlan.validate.endDateRequired') } | |
| 210 | + ] | |
| 211 | + | |
| 212 | + for (const { field, message } of requiredFields) { | |
| 213 | + if (!this.addMaintainancePlanInfo[field]) { | |
| 214 | + this.$message.error(message) | |
| 215 | + return false | |
| 216 | + } | |
| 217 | + } | |
| 218 | + | |
| 219 | + if (this.addMaintainancePlanInfo.planPeriod === '2020022') { | |
| 220 | + if (this.addMaintainancePlanInfo.months.length === 0) { | |
| 221 | + this.$message.error(this.$t('addMaintainancePlan.validate.monthRequired')) | |
| 222 | + return false | |
| 223 | + } | |
| 224 | + if (this.addMaintainancePlanInfo.days.length === 0) { | |
| 225 | + this.$message.error(this.$t('addMaintainancePlan.validate.dayRequired')) | |
| 226 | + return false | |
| 227 | + } | |
| 228 | + } else if (this.addMaintainancePlanInfo.planPeriod === '2020024') { | |
| 229 | + if (!this.addMaintainancePlanInfo.everyDays) { | |
| 230 | + this.$message.error(this.$t('addMaintainancePlan.validate.fixedDaysRequired')) | |
| 231 | + return false | |
| 232 | + } | |
| 233 | + } | |
| 234 | + | |
| 235 | + if (this.addMaintainancePlanInfo.machineIds.length === 0) { | |
| 236 | + this.$message.error(this.$t('addMaintainancePlan.validate.machineRequired')) | |
| 237 | + return false | |
| 238 | + } | |
| 239 | + | |
| 240 | + return true | |
| 241 | + }, | |
| 242 | + async saveMaintainancePlanInfo() { | |
| 243 | + if (!this.validateForm()) return | |
| 244 | + | |
| 245 | + try { | |
| 246 | + const formData = { | |
| 247 | + ...this.addMaintainancePlanInfo, | |
| 248 | + maintainanceMonth: this.addMaintainancePlanInfo.months.join(','), | |
| 249 | + maintainanceDay: this.addMaintainancePlanInfo.days.join(','), | |
| 250 | + maintainanceEveryday: this.addMaintainancePlanInfo.everyDays, | |
| 251 | + staffs: this.$refs.selectStaffs.getSelectedStaffs() | |
| 252 | + } | |
| 253 | + | |
| 254 | + const { code, msg } = await saveMaintainancePlan(formData) | |
| 255 | + if (code === 0) { | |
| 256 | + this.$message.success(this.$t('addMaintainancePlan.saveSuccess')) | |
| 257 | + this.goBack() | |
| 258 | + } else { | |
| 259 | + this.$message.error(msg) | |
| 260 | + } | |
| 261 | + } catch (error) { | |
| 262 | + console.error('保存保养计划失败:', error) | |
| 263 | + this.$message.error(this.$t('addMaintainancePlan.saveError')) | |
| 264 | + } | |
| 265 | + }, | |
| 266 | + goBack() { | |
| 267 | + this.$router.go(-1) | |
| 268 | + } | |
| 269 | + } | |
| 270 | +} | |
| 271 | +</script> | |
| 272 | + | |
| 273 | +<style lang="scss" scoped> | |
| 274 | +.add-maintainance-plan-container { | |
| 275 | + padding: 20px; | |
| 276 | + | |
| 277 | + .el-checkbox { | |
| 278 | + margin-right: 15px; | |
| 279 | + margin-bottom: 10px; | |
| 280 | + } | |
| 281 | + | |
| 282 | + .el-date-editor, | |
| 283 | + .el-select, | |
| 284 | + .el-input { | |
| 285 | + width: 100%; | |
| 286 | + } | |
| 287 | +} | |
| 288 | +</style> | |
| 0 | 289 | \ No newline at end of file | ... | ... |
src/views/inspection/editMaintainancePlanLang.js
0 → 100644
| 1 | +export const messages = { | |
| 2 | + en: { | |
| 3 | + editMaintainancePlan: { | |
| 4 | + title: 'Edit Maintenance Plan', | |
| 5 | + planName: 'Plan Name', | |
| 6 | + planNamePlaceholder: 'Required, please enter plan name', | |
| 7 | + standard: 'Maintenance Standard', | |
| 8 | + standardPlaceholder: 'Required, please select maintenance standard', | |
| 9 | + period: 'Inspection Cycle', | |
| 10 | + periodPlaceholder: 'Required, please select inspection cycle', | |
| 11 | + month: 'Month', | |
| 12 | + monthUnit: 'Month', | |
| 13 | + day: 'Day', | |
| 14 | + dayUnit: 'Day', | |
| 15 | + fixedDay: 'Fixed Days', | |
| 16 | + fixedDayPlaceholder: 'Required, please enter days', | |
| 17 | + startDate: 'Start Date', | |
| 18 | + startDatePlaceholder: 'Required, please select start date', | |
| 19 | + endDate: 'End Date', | |
| 20 | + endDatePlaceholder: 'Required, please select end date', | |
| 21 | + selectStaff: 'Select Staff', | |
| 22 | + saveSuccess: 'Save successfully', | |
| 23 | + saveError: 'Save failed', | |
| 24 | + fetchStandardError: 'Failed to get maintenance standards', | |
| 25 | + fetchPlanError: 'Failed to get maintenance plan', | |
| 26 | + fetchStaffError: 'Failed to get staff list' | |
| 27 | + }, | |
| 28 | + orgTree: { | |
| 29 | + fetchError: 'Failed to get organization tree' | |
| 30 | + } | |
| 31 | + }, | |
| 32 | + zh: { | |
| 33 | + editMaintainancePlan: { | |
| 34 | + title: '修改保养计划', | |
| 35 | + planName: '计划名称', | |
| 36 | + planNamePlaceholder: '必填,请填写计划名称', | |
| 37 | + standard: '保养标准', | |
| 38 | + standardPlaceholder: '必填,请选择保养标准', | |
| 39 | + period: '巡检周期', | |
| 40 | + periodPlaceholder: '必填,请选择巡检周期', | |
| 41 | + month: '月', | |
| 42 | + monthUnit: '月', | |
| 43 | + day: '日', | |
| 44 | + dayUnit: '日', | |
| 45 | + fixedDay: '固定天数', | |
| 46 | + fixedDayPlaceholder: '必填,请填写多少天后保养一次', | |
| 47 | + startDate: '开始日期', | |
| 48 | + startDatePlaceholder: '必填,请填写开始日期', | |
| 49 | + endDate: '结束日期', | |
| 50 | + endDatePlaceholder: '必填,请填写结束日期', | |
| 51 | + selectStaff: '选择员工', | |
| 52 | + saveSuccess: '保存成功', | |
| 53 | + saveError: '保存失败', | |
| 54 | + fetchStandardError: '获取保养标准失败', | |
| 55 | + fetchPlanError: '获取保养计划失败', | |
| 56 | + fetchStaffError: '获取员工列表失败' | |
| 57 | + }, | |
| 58 | + orgTree: { | |
| 59 | + fetchError: '获取组织树失败' | |
| 60 | + } | |
| 61 | + } | |
| 62 | +} | |
| 0 | 63 | \ No newline at end of file | ... | ... |
src/views/inspection/editMaintainancePlanList.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="edit-maintainance-plan-container"> | |
| 3 | + <el-card class="box-card"> | |
| 4 | + <div slot="header" class="clearfix"> | |
| 5 | + <span>{{ $t('editMaintainancePlan.title') }}</span> | |
| 6 | + </div> | |
| 7 | + | |
| 8 | + <el-form ref="form" :model="editMaintainancePlanInfo" label-width="120px"> | |
| 9 | + <el-row :gutter="20"> | |
| 10 | + <el-col :span="12"> | |
| 11 | + <el-form-item :label="$t('editMaintainancePlan.planName')" prop="planName"> | |
| 12 | + <el-input v-model="editMaintainancePlanInfo.planName" | |
| 13 | + :placeholder="$t('editMaintainancePlan.planNamePlaceholder')" clearable> | |
| 14 | + </el-input> | |
| 15 | + </el-form-item> | |
| 16 | + </el-col> | |
| 17 | + <el-col :span="12"> | |
| 18 | + <el-form-item :label="$t('editMaintainancePlan.standard')" prop="standardId"> | |
| 19 | + <el-select v-model="editMaintainancePlanInfo.standardId" | |
| 20 | + :placeholder="$t('editMaintainancePlan.standardPlaceholder')" style="width:100%"> | |
| 21 | + <el-option v-for="item in editMaintainancePlanInfo.standards" :key="item.standardId" | |
| 22 | + :label="item.standardName" :value="item.standardId"> | |
| 23 | + </el-option> | |
| 24 | + </el-select> | |
| 25 | + </el-form-item> | |
| 26 | + </el-col> | |
| 27 | + </el-row> | |
| 28 | + | |
| 29 | + <el-row :gutter="20"> | |
| 30 | + <el-col :span="12"> | |
| 31 | + <el-form-item :label="$t('editMaintainancePlan.period')" prop="planPeriod"> | |
| 32 | + <el-select v-model="editMaintainancePlanInfo.planPeriod" | |
| 33 | + :placeholder="$t('editMaintainancePlan.periodPlaceholder')" @change="changeMaintainancePeriod" | |
| 34 | + style="width:100%"> | |
| 35 | + <el-option label="月/天" value="2020022"> | |
| 36 | + </el-option> | |
| 37 | + <el-option label="固定(天)" value="2020024"> | |
| 38 | + </el-option> | |
| 39 | + </el-select> | |
| 40 | + </el-form-item> | |
| 41 | + </el-col> | |
| 42 | + </el-row> | |
| 43 | + | |
| 44 | + <template v-if="editMaintainancePlanInfo.planPeriod === '2020022'"> | |
| 45 | + <el-row :gutter="20"> | |
| 46 | + <el-col :span="24"> | |
| 47 | + <el-form-item :label="$t('editMaintainancePlan.month')"> | |
| 48 | + <el-checkbox-group v-model="editMaintainancePlanInfo.months"> | |
| 49 | + <el-checkbox v-for="index in 12" :key="index" :label="index"> | |
| 50 | + {{ index }}{{ $t('editMaintainancePlan.monthUnit') }} | |
| 51 | + </el-checkbox> | |
| 52 | + </el-checkbox-group> | |
| 53 | + </el-form-item> | |
| 54 | + </el-col> | |
| 55 | + </el-row> | |
| 56 | + | |
| 57 | + <el-row :gutter="20"> | |
| 58 | + <el-col :span="24"> | |
| 59 | + <el-form-item :label="$t('editMaintainancePlan.day')"> | |
| 60 | + <el-checkbox-group v-model="editMaintainancePlanInfo.days"> | |
| 61 | + <el-checkbox v-for="index in 31" :key="index" :label="index"> | |
| 62 | + {{ index }}{{ $t('editMaintainancePlan.dayUnit') }} | |
| 63 | + </el-checkbox> | |
| 64 | + </el-checkbox-group> | |
| 65 | + </el-form-item> | |
| 66 | + </el-col> | |
| 67 | + </el-row> | |
| 68 | + </template> | |
| 69 | + | |
| 70 | + <template v-if="editMaintainancePlanInfo.planPeriod === '2020024'"> | |
| 71 | + <el-row :gutter="20"> | |
| 72 | + <el-col :span="12"> | |
| 73 | + <el-form-item :label="$t('editMaintainancePlan.fixedDay')"> | |
| 74 | + <el-input-number v-model="editMaintainancePlanInfo.everyDays" :min="1" | |
| 75 | + :placeholder="$t('editMaintainancePlan.fixedDayPlaceholder')"> | |
| 76 | + </el-input-number> | |
| 77 | + </el-form-item> | |
| 78 | + </el-col> | |
| 79 | + </el-row> | |
| 80 | + </template> | |
| 81 | + | |
| 82 | + <el-row :gutter="20"> | |
| 83 | + <el-col :span="12"> | |
| 84 | + <el-form-item :label="$t('editMaintainancePlan.startDate')" prop="startDate"> | |
| 85 | + <el-date-picker v-model="editMaintainancePlanInfo.startDate" type="date" | |
| 86 | + :placeholder="$t('editMaintainancePlan.startDatePlaceholder')" style="width:100%"> | |
| 87 | + </el-date-picker> | |
| 88 | + </el-form-item> | |
| 89 | + </el-col> | |
| 90 | + <el-col :span="12"> | |
| 91 | + <el-form-item :label="$t('editMaintainancePlan.endDate')" prop="endDate"> | |
| 92 | + <el-date-picker v-model="editMaintainancePlanInfo.endDate" type="date" | |
| 93 | + :placeholder="$t('editMaintainancePlan.endDatePlaceholder')" style="width:100%"> | |
| 94 | + </el-date-picker> | |
| 95 | + </el-form-item> | |
| 96 | + </el-col> | |
| 97 | + </el-row> | |
| 98 | + | |
| 99 | + <el-row :gutter="20"> | |
| 100 | + <el-col :span="24"> | |
| 101 | + <el-form-item :label="$t('editMaintainancePlan.selectStaff')"> | |
| 102 | + <select-staffs-div ref="selectStaffs" @selectStaffs="handleStaffSelected" /> | |
| 103 | + </el-form-item> | |
| 104 | + </el-col> | |
| 105 | + </el-row> | |
| 106 | + | |
| 107 | + <el-row> | |
| 108 | + <el-col :span="24" class="text-right"> | |
| 109 | + <el-button type="primary" @click="saveMaintainancePlanInfo"> | |
| 110 | + {{ $t('common.save') }} | |
| 111 | + </el-button> | |
| 112 | + <el-button @click="goBack"> | |
| 113 | + {{ $t('common.back') }} | |
| 114 | + </el-button> | |
| 115 | + </el-col> | |
| 116 | + </el-row> | |
| 117 | + </el-form> | |
| 118 | + </el-card> | |
| 119 | + </div> | |
| 120 | +</template> | |
| 121 | + | |
| 122 | +<script> | |
| 123 | +import { updateMaintainancePlan, listMaintainanceStandard, listMaintainancePlan, listMaintainancePlanStaff } from '@/api/inspection/editMaintainancePlanApi' | |
| 124 | +import SelectStaffsDiv from '@/components/staff/selectStaffsDiv' | |
| 125 | +import { getCommunityId } from '@/api/community/communityApi' | |
| 126 | + | |
| 127 | +export default { | |
| 128 | + name: 'EditMaintainancePlan', | |
| 129 | + components: { | |
| 130 | + SelectStaffsDiv | |
| 131 | + }, | |
| 132 | + data() { | |
| 133 | + return { | |
| 134 | + editMaintainancePlanInfo: { | |
| 135 | + planId: '', | |
| 136 | + planName: '', | |
| 137 | + standardId: '', | |
| 138 | + standards: [], | |
| 139 | + planPeriod: '', | |
| 140 | + startDate: new Date(), | |
| 141 | + endDate: '2050-01-01', | |
| 142 | + state: '2020025', | |
| 143 | + remark: '', | |
| 144 | + months: [], | |
| 145 | + days: [], | |
| 146 | + everyDays: [], | |
| 147 | + staffs: [], | |
| 148 | + communityId: '' | |
| 149 | + } | |
| 150 | + } | |
| 151 | + }, | |
| 152 | + created() { | |
| 153 | + this.editMaintainancePlanInfo.communityId = getCommunityId() | |
| 154 | + this.editMaintainancePlanInfo.planId = this.$route.query.planId | |
| 155 | + this.initEditMaintainancePlanDateInfo() | |
| 156 | + this.listEditMaintainanceStandards() | |
| 157 | + this.listMaintainancePlans() | |
| 158 | + this.listMaintainancePlanStaffs() | |
| 159 | + }, | |
| 160 | + methods: { | |
| 161 | + initEditMaintainancePlanDateInfo() { | |
| 162 | + // 日期初始化逻辑 | |
| 163 | + }, | |
| 164 | + handleStaffSelected(staffs) { | |
| 165 | + console.log(staffs) | |
| 166 | + this.editMaintainancePlanInfo.staffs = staffs | |
| 167 | + }, | |
| 168 | + changeMaintainancePeriod() { | |
| 169 | + this.editMaintainancePlanInfo.months = [] | |
| 170 | + this.editMaintainancePlanInfo.days = [] | |
| 171 | + this.editMaintainancePlanInfo.everyDays = [] | |
| 172 | + | |
| 173 | + if (this.editMaintainancePlanInfo.planPeriod === '2020022') { | |
| 174 | + for (let month = 1; month < 13; month++) { | |
| 175 | + this.editMaintainancePlanInfo.months.push(month) | |
| 176 | + } | |
| 177 | + for (let day = 1; day < 32; day++) { | |
| 178 | + this.editMaintainancePlanInfo.days.push(day) | |
| 179 | + } | |
| 180 | + } | |
| 181 | + }, | |
| 182 | + async listEditMaintainanceStandards() { | |
| 183 | + try { | |
| 184 | + const params = { | |
| 185 | + page: 1, | |
| 186 | + row: 100, | |
| 187 | + communityId: this.editMaintainancePlanInfo.communityId | |
| 188 | + } | |
| 189 | + const { data } = await listMaintainanceStandard(params) | |
| 190 | + this.editMaintainancePlanInfo.standards = data | |
| 191 | + } catch (error) { | |
| 192 | + this.$message.error(this.$t('editMaintainancePlan.fetchStandardError')) | |
| 193 | + } | |
| 194 | + }, | |
| 195 | + async listMaintainancePlans() { | |
| 196 | + try { | |
| 197 | + const params = { | |
| 198 | + page: 1, | |
| 199 | + row: 1, | |
| 200 | + communityId: this.editMaintainancePlanInfo.communityId, | |
| 201 | + planId: this.editMaintainancePlanInfo.planId | |
| 202 | + } | |
| 203 | + const { data } = await listMaintainancePlan(params) | |
| 204 | + if (data && data.length > 0) { | |
| 205 | + Object.assign(this.editMaintainancePlanInfo, data[0]) | |
| 206 | + this.editMaintainancePlanInfo.months = data[0].maintainanceMonth.split(',') | |
| 207 | + this.editMaintainancePlanInfo.days = data[0].maintainanceDay.split(',') | |
| 208 | + this.editMaintainancePlanInfo.everyDays = data[0].maintainanceEveryday | |
| 209 | + } | |
| 210 | + } catch (error) { | |
| 211 | + this.$message.error(this.$t('editMaintainancePlan.fetchPlanError')) | |
| 212 | + } | |
| 213 | + }, | |
| 214 | + async listMaintainancePlanStaffs() { | |
| 215 | + try { | |
| 216 | + const params = { | |
| 217 | + page: 1, | |
| 218 | + row: 100, | |
| 219 | + communityId: this.editMaintainancePlanInfo.communityId, | |
| 220 | + planId: this.editMaintainancePlanInfo.planId | |
| 221 | + } | |
| 222 | + const { data } = await listMaintainancePlanStaff(params) | |
| 223 | + this.editMaintainancePlanInfo.staffs = data.map(item => ({ | |
| 224 | + userId: item.staffId, | |
| 225 | + name: item.staffName | |
| 226 | + })) | |
| 227 | + this.$refs.selectStaffs.setStaffs(this.editMaintainancePlanInfo.staffs) | |
| 228 | + } catch (error) { | |
| 229 | + this.$message.error(this.$t('editMaintainancePlan.fetchStaffError')) | |
| 230 | + } | |
| 231 | + }, | |
| 232 | + validateForm() { | |
| 233 | + // 表单验证逻辑 | |
| 234 | + return true | |
| 235 | + }, | |
| 236 | + async saveMaintainancePlanInfo() { | |
| 237 | + if (!this.validateForm()) return | |
| 238 | + | |
| 239 | + try { | |
| 240 | + const params = { | |
| 241 | + ...this.editMaintainancePlanInfo, | |
| 242 | + maintainanceMonth: this.editMaintainancePlanInfo.months.join(','), | |
| 243 | + maintainanceDay: this.editMaintainancePlanInfo.days.join(','), | |
| 244 | + maintainanceEveryday: this.editMaintainancePlanInfo.everyDays, | |
| 245 | + staffs: this.$refs.selectStaffs.getSelectedStaffs() | |
| 246 | + } | |
| 247 | + | |
| 248 | + const res = await updateMaintainancePlan(params) | |
| 249 | + if (res.code === 0) { | |
| 250 | + this.$message.success(this.$t('editMaintainancePlan.saveSuccess')) | |
| 251 | + this.goBack() | |
| 252 | + } else { | |
| 253 | + this.$message.error(res.msg) | |
| 254 | + } | |
| 255 | + } catch (error) { | |
| 256 | + this.$message.error(this.$t('editMaintainancePlan.saveError')) | |
| 257 | + } | |
| 258 | + }, | |
| 259 | + goBack() { | |
| 260 | + this.$router.go(-1) | |
| 261 | + } | |
| 262 | + } | |
| 263 | +} | |
| 264 | +</script> | |
| 265 | + | |
| 266 | +<style lang="scss" scoped> | |
| 267 | +.edit-maintainance-plan-container { | |
| 268 | + padding: 20px; | |
| 269 | + | |
| 270 | + .el-checkbox { | |
| 271 | + margin-right: 15px; | |
| 272 | + margin-bottom: 10px; | |
| 273 | + } | |
| 274 | + | |
| 275 | + .text-right { | |
| 276 | + text-align: right; | |
| 277 | + } | |
| 278 | + | |
| 279 | + .el-date-editor, | |
| 280 | + .el-select { | |
| 281 | + width: 100%; | |
| 282 | + } | |
| 283 | +} | |
| 284 | +</style> | |
| 0 | 285 | \ No newline at end of file | ... | ... |
src/views/inspection/maintainancePlanMachineLang.js
0 → 100644
| 1 | +export const messages = { | |
| 2 | + en: { | |
| 3 | + maintainancePlanMachine: { | |
| 4 | + title: 'Maintenance Equipment', | |
| 5 | + back: 'Back', | |
| 6 | + add: 'Add', | |
| 7 | + machineName: 'Equipment Name', | |
| 8 | + machineId: 'Equipment ID', | |
| 9 | + operation: 'Operation', | |
| 10 | + delete: 'Delete', | |
| 11 | + fetchError: 'Failed to fetch equipment list' | |
| 12 | + }, | |
| 13 | + chooseMaintainancePlanMachine: { | |
| 14 | + title: 'Select Equipment', | |
| 15 | + machineNamePlaceholder: 'Enter equipment name', | |
| 16 | + search: 'Search', | |
| 17 | + reset: 'Reset', | |
| 18 | + machineId: 'ID', | |
| 19 | + machineName: 'Equipment Name', | |
| 20 | + cancel: 'Cancel', | |
| 21 | + submit: 'Submit', | |
| 22 | + selectWarning: 'Please select at least one equipment', | |
| 23 | + addSuccess: 'Added successfully', | |
| 24 | + addError: 'Failed to add equipment', | |
| 25 | + fetchError: 'Failed to fetch equipment list' | |
| 26 | + }, | |
| 27 | + deleteMaintainancePlanMachine: { | |
| 28 | + title: 'Confirm Operation', | |
| 29 | + confirmText: 'Are you sure to delete this maintenance equipment?', | |
| 30 | + cancel: 'Cancel', | |
| 31 | + confirm: 'Confirm', | |
| 32 | + deleteSuccess: 'Deleted successfully', | |
| 33 | + deleteError: 'Failed to delete equipment' | |
| 34 | + } | |
| 35 | + }, | |
| 36 | + zh: { | |
| 37 | + maintainancePlanMachine: { | |
| 38 | + title: '保养设备', | |
| 39 | + back: '返回', | |
| 40 | + add: '添加', | |
| 41 | + machineName: '设备名称', | |
| 42 | + machineId: '设备编号', | |
| 43 | + operation: '操作', | |
| 44 | + delete: '删除', | |
| 45 | + fetchError: '获取设备列表失败' | |
| 46 | + }, | |
| 47 | + chooseMaintainancePlanMachine: { | |
| 48 | + title: '选择设备', | |
| 49 | + machineNamePlaceholder: '输入设备名称', | |
| 50 | + search: '查询', | |
| 51 | + reset: '重置', | |
| 52 | + machineId: '编号', | |
| 53 | + machineName: '设备名称', | |
| 54 | + cancel: '取消', | |
| 55 | + submit: '提交', | |
| 56 | + selectWarning: '请至少选择一台设备', | |
| 57 | + addSuccess: '添加成功', | |
| 58 | + addError: '添加设备失败', | |
| 59 | + fetchError: '获取设备列表失败' | |
| 60 | + }, | |
| 61 | + deleteMaintainancePlanMachine: { | |
| 62 | + title: '请确认您的操作', | |
| 63 | + confirmText: '确定删除保养设备?', | |
| 64 | + cancel: '点错了', | |
| 65 | + confirm: '确认删除', | |
| 66 | + deleteSuccess: '删除成功', | |
| 67 | + deleteError: '删除设备失败' | |
| 68 | + } | |
| 69 | + } | |
| 70 | +} | |
| 0 | 71 | \ No newline at end of file | ... | ... |
src/views/inspection/maintainancePlanMachineList.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="maintainance-plan-machine-container"> | |
| 3 | + <el-card class="box-card"> | |
| 4 | + <div slot="header" class="clearfix"> | |
| 5 | + <span>{{ $t('maintainancePlanMachine.title') }}</span> | |
| 6 | + <div class="card-header-actions"> | |
| 7 | + <el-button type="primary" size="small" @click="_goBack" style="margin-right:10px"> | |
| 8 | + <i class="el-icon-close"></i> | |
| 9 | + <span>{{ $t('maintainancePlanMachine.back') }}</span> | |
| 10 | + </el-button> | |
| 11 | + <el-button type="primary" size="small" @click="_openAddMaintainancePlanMachineModal"> | |
| 12 | + <i class="el-icon-plus"></i> | |
| 13 | + <span>{{ $t('maintainancePlanMachine.add') }}</span> | |
| 14 | + </el-button> | |
| 15 | + </div> | |
| 16 | + </div> | |
| 17 | + | |
| 18 | + <el-table :data="maintainancePlanMachineInfo.machines" border style="width: 100%"> | |
| 19 | + <el-table-column prop="machineName" :label="$t('maintainancePlanMachine.machineName')" align="center"> | |
| 20 | + </el-table-column> | |
| 21 | + <el-table-column prop="machineId" :label="$t('maintainancePlanMachine.machineId')" align="center"> | |
| 22 | + </el-table-column> | |
| 23 | + <el-table-column :label="$t('maintainancePlanMachine.operation')" align="center"> | |
| 24 | + <template slot-scope="scope"> | |
| 25 | + <el-button size="mini" type="danger" @click="_openDeleteMaintainancePlanMachineModel(scope.row)"> | |
| 26 | + {{ $t('maintainancePlanMachine.delete') }} | |
| 27 | + </el-button> | |
| 28 | + </template> | |
| 29 | + </el-table-column> | |
| 30 | + </el-table> | |
| 31 | + | |
| 32 | + <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" | |
| 33 | + :current-page="pagination.current" :page-sizes="[10, 20, 30, 50]" :page-size="pagination.size" | |
| 34 | + layout="total, sizes, prev, pager, next, jumper" :total="pagination.total"> | |
| 35 | + </el-pagination> | |
| 36 | + </el-card> | |
| 37 | + | |
| 38 | + <choose-maintainance-plan-machine ref="chooseMachineModal" | |
| 39 | + @success="handleSuccess"></choose-maintainance-plan-machine> | |
| 40 | + <delete-maintainance-plan-machine ref="deleteMachineModal" | |
| 41 | + @success="handleSuccess"></delete-maintainance-plan-machine> | |
| 42 | + </div> | |
| 43 | +</template> | |
| 44 | + | |
| 45 | +<script> | |
| 46 | +import { listMaintainancePlanMachine } from '@/api/inspection/maintainancePlanMachineApi' | |
| 47 | +import ChooseMaintainancePlanMachine from '@/components/inspection/chooseMaintainancePlanMachine' | |
| 48 | +import DeleteMaintainancePlanMachine from '@/components/inspection/deleteMaintainancePlanMachine' | |
| 49 | +import { getCommunityId } from '@/api/community/communityApi' | |
| 50 | + | |
| 51 | +export default { | |
| 52 | + name: 'MaintainancePlanMachineList', | |
| 53 | + components: { | |
| 54 | + ChooseMaintainancePlanMachine, | |
| 55 | + DeleteMaintainancePlanMachine | |
| 56 | + }, | |
| 57 | + data() { | |
| 58 | + return { | |
| 59 | + maintainancePlanMachineInfo: { | |
| 60 | + machines: [], | |
| 61 | + planId: '', | |
| 62 | + routeName: '' | |
| 63 | + }, | |
| 64 | + pagination: { | |
| 65 | + current: 1, | |
| 66 | + size: 10, | |
| 67 | + total: 0 | |
| 68 | + } | |
| 69 | + } | |
| 70 | + }, | |
| 71 | + created() { | |
| 72 | + this.maintainancePlanMachineInfo.planId = this.$route.query.planId | |
| 73 | + this._listMaintainancePlanMachines(1, 10) | |
| 74 | + }, | |
| 75 | + methods: { | |
| 76 | + async _listMaintainancePlanMachines(page, size) { | |
| 77 | + try { | |
| 78 | + const params = { | |
| 79 | + page: page, | |
| 80 | + row: size, | |
| 81 | + communityId: getCommunityId(), | |
| 82 | + planId: this.maintainancePlanMachineInfo.planId | |
| 83 | + } | |
| 84 | + const { data, records } = await listMaintainancePlanMachine(params) | |
| 85 | + this.maintainancePlanMachineInfo.machines = data | |
| 86 | + this.pagination.total = records | |
| 87 | + } catch (error) { | |
| 88 | + this.$message.error(this.$t('maintainancePlanMachine.fetchError')) | |
| 89 | + } | |
| 90 | + }, | |
| 91 | + _openAddMaintainancePlanMachineModal() { | |
| 92 | + this.$refs.chooseMachineModal.open({ | |
| 93 | + planId: this.maintainancePlanMachineInfo.planId | |
| 94 | + }) | |
| 95 | + }, | |
| 96 | + _openDeleteMaintainancePlanMachineModel(machine) { | |
| 97 | + this.$refs.deleteMachineModal.open({ | |
| 98 | + ...machine, | |
| 99 | + planId: this.maintainancePlanMachineInfo.planId | |
| 100 | + }) | |
| 101 | + }, | |
| 102 | + _goBack() { | |
| 103 | + this.$router.go(-1) | |
| 104 | + }, | |
| 105 | + handleSuccess() { | |
| 106 | + this._listMaintainancePlanMachines(this.pagination.current, this.pagination.size) | |
| 107 | + }, | |
| 108 | + handleSizeChange(val) { | |
| 109 | + this.pagination.size = val | |
| 110 | + this._listMaintainancePlanMachines(this.pagination.current, val) | |
| 111 | + }, | |
| 112 | + handleCurrentChange(val) { | |
| 113 | + this.pagination.current = val | |
| 114 | + this._listMaintainancePlanMachines(val, this.pagination.size) | |
| 115 | + } | |
| 116 | + } | |
| 117 | +} | |
| 118 | +</script> | |
| 119 | + | |
| 120 | +<style lang="scss" scoped> | |
| 121 | +.maintainance-plan-machine-container { | |
| 122 | + padding: 20px; | |
| 123 | + | |
| 124 | + .box-card { | |
| 125 | + margin-bottom: 20px; | |
| 126 | + | |
| 127 | + .clearfix { | |
| 128 | + display: flex; | |
| 129 | + justify-content: space-between; | |
| 130 | + align-items: center; | |
| 131 | + | |
| 132 | + .card-header-actions { | |
| 133 | + display: flex; | |
| 134 | + } | |
| 135 | + } | |
| 136 | + } | |
| 137 | + | |
| 138 | + .el-pagination { | |
| 139 | + margin-top: 20px; | |
| 140 | + text-align: right; | |
| 141 | + } | |
| 142 | +} | |
| 143 | +</style> | |
| 0 | 144 | \ No newline at end of file | ... | ... |
src/views/inspection/maintainancePlanManageLang.js
0 → 100644
| 1 | +export const messages = { | |
| 2 | + en: { | |
| 3 | + maintainancePlanManage: { | |
| 4 | + search: { | |
| 5 | + title: 'Search Conditions', | |
| 6 | + planName: 'Plan Name', | |
| 7 | + state: 'Status', | |
| 8 | + allState: 'All Status' | |
| 9 | + }, | |
| 10 | + list: { | |
| 11 | + title: 'Maintenance Plan (Generate Tasks on Maintenance Day)' | |
| 12 | + }, | |
| 13 | + table: { | |
| 14 | + planName: 'Plan Name', | |
| 15 | + standardName: 'Maintenance Standard', | |
| 16 | + planPeriod: 'Plan Cycle', | |
| 17 | + dateRange: 'Date Range', | |
| 18 | + machineCount: 'Equipment Count', | |
| 19 | + machine: 'Equipment', | |
| 20 | + staffCount: 'Maintenance Staff Count', | |
| 21 | + createUser: 'Creator', | |
| 22 | + createTime: 'Creation Time', | |
| 23 | + state: 'Status' | |
| 24 | + }, | |
| 25 | + button: { | |
| 26 | + enable: 'Enable', | |
| 27 | + disable: 'Disable' | |
| 28 | + }, | |
| 29 | + tip: 'Please ensure the plan start time and end time are valid and maintenance staff are assigned, otherwise maintenance tasks cannot be generated', | |
| 30 | + fetchError: 'Failed to fetch maintenance plans' | |
| 31 | + }, | |
| 32 | + deleteMaintainancePlan: { | |
| 33 | + title: 'Please confirm your operation', | |
| 34 | + confirm: 'Are you sure to delete this maintenance plan?', | |
| 35 | + success: 'Delete successfully', | |
| 36 | + error: 'Failed to delete' | |
| 37 | + }, | |
| 38 | + maintainancePlanState: { | |
| 39 | + title: 'Please confirm your operation', | |
| 40 | + confirm: 'Are you sure to', | |
| 41 | + plan: 'this maintenance plan?', | |
| 42 | + success: 'Operation successful', | |
| 43 | + error: 'Operation failed' | |
| 44 | + } | |
| 45 | + }, | |
| 46 | + zh: { | |
| 47 | + maintainancePlanManage: { | |
| 48 | + search: { | |
| 49 | + title: '查询条件', | |
| 50 | + planName: '计划名称', | |
| 51 | + state: '状态', | |
| 52 | + allState: '全部状态' | |
| 53 | + }, | |
| 54 | + list: { | |
| 55 | + title: '保养计划(保养日生成任务)' | |
| 56 | + }, | |
| 57 | + table: { | |
| 58 | + planName: '计划名称', | |
| 59 | + standardName: '保养标准', | |
| 60 | + planPeriod: '计划周期', | |
| 61 | + dateRange: '日期范围', | |
| 62 | + machineCount: '设备数', | |
| 63 | + machine: '设备', | |
| 64 | + staffCount: '保养人数', | |
| 65 | + createUser: '制定人', | |
| 66 | + createTime: '制定时间', | |
| 67 | + state: '状态' | |
| 68 | + }, | |
| 69 | + button: { | |
| 70 | + enable: '启用', | |
| 71 | + disable: '停用' | |
| 72 | + }, | |
| 73 | + tip: '请确保计划开始时间和计划结束时间是有效时间范围,并且设置了保养人,不然无法生成保养任务', | |
| 74 | + fetchError: '获取保养计划失败' | |
| 75 | + }, | |
| 76 | + deleteMaintainancePlan: { | |
| 77 | + title: '请确认您的操作', | |
| 78 | + confirm: '确定删除保养计划?', | |
| 79 | + success: '删除成功', | |
| 80 | + error: '删除失败' | |
| 81 | + }, | |
| 82 | + maintainancePlanState: { | |
| 83 | + title: '请确认您的操作', | |
| 84 | + confirm: '确定', | |
| 85 | + plan: '保养计划?', | |
| 86 | + success: '操作成功', | |
| 87 | + error: '操作失败' | |
| 88 | + } | |
| 89 | + } | |
| 90 | +} | |
| 0 | 91 | \ No newline at end of file | ... | ... |
src/views/inspection/maintainancePlanManageList.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="maintainance-plan-manage-container animated fadeInRight"> | |
| 3 | + <el-card class="search-card"> | |
| 4 | + <div slot="header" class="flex justify-between"> | |
| 5 | + <span>{{ $t('maintainancePlanManage.search.title') }}</span> | |
| 6 | + </div> | |
| 7 | + <el-row :gutter="20"> | |
| 8 | + <el-col :span="6"> | |
| 9 | + <el-input v-model="searchForm.maintainancePlanName" :placeholder="$t('maintainancePlanManage.search.planName')" | |
| 10 | + clearable /> | |
| 11 | + </el-col> | |
| 12 | + <el-col :span="6"> | |
| 13 | + <el-select v-model="searchForm.state" :placeholder="$t('maintainancePlanManage.search.state')" | |
| 14 | + style="width:100%"> | |
| 15 | + <el-option :label="$t('maintainancePlanManage.search.allState')" value="" /> | |
| 16 | + <el-option v-for="item in states" :key="item.statusCd" :label="item.name" :value="item.statusCd" /> | |
| 17 | + </el-select> | |
| 18 | + </el-col> | |
| 19 | + <el-col :span="6"> | |
| 20 | + <el-button type="primary" @click="handleSearch"> | |
| 21 | + {{ $t('common.search') }} | |
| 22 | + </el-button> | |
| 23 | + </el-col> | |
| 24 | + </el-row> | |
| 25 | + </el-card> | |
| 26 | + | |
| 27 | + <el-card class="table-card"> | |
| 28 | + <div slot="header" class="flex justify-between"> | |
| 29 | + <span>{{ $t('maintainancePlanManage.list.title') }}</span> | |
| 30 | + <el-button type="primary" size="small" style="float:right" @click="handleAdd"> | |
| 31 | + {{ $t('common.add') }} | |
| 32 | + </el-button> | |
| 33 | + </div> | |
| 34 | + | |
| 35 | + <el-table v-loading="loading" :data="tableData" border style="width:100%"> | |
| 36 | + <el-table-column prop="planName" :label="$t('maintainancePlanManage.table.planName')" align="center" /> | |
| 37 | + <el-table-column prop="standardName" :label="$t('maintainancePlanManage.table.standardName')" align="center" /> | |
| 38 | + <el-table-column prop="planPeriodName" :label="$t('maintainancePlanManage.table.planPeriod')" align="center" /> | |
| 39 | + <el-table-column :label="$t('maintainancePlanManage.table.dateRange')" align="center"> | |
| 40 | + <template slot-scope="scope"> | |
| 41 | + {{ scope.row.startDate }}~{{ scope.row.endDate }} | |
| 42 | + </template> | |
| 43 | + </el-table-column> | |
| 44 | + <el-table-column :label="$t('maintainancePlanManage.table.machineCount')" align="center"> | |
| 45 | + <template slot-scope="scope"> | |
| 46 | + {{ scope.row.machineCount }} | |
| 47 | + (<el-link type="primary" @click="handleViewMachine(scope.row)"> | |
| 48 | + {{ $t('maintainancePlanManage.table.machine') }} | |
| 49 | + </el-link>) | |
| 50 | + </template> | |
| 51 | + </el-table-column> | |
| 52 | + <el-table-column prop="staffCount" :label="$t('maintainancePlanManage.table.staffCount')" align="center" /> | |
| 53 | + <el-table-column prop="createUserName" :label="$t('maintainancePlanManage.table.createUser')" align="center" /> | |
| 54 | + <el-table-column prop="createTime" :label="$t('maintainancePlanManage.table.createTime')" align="center" /> | |
| 55 | + <el-table-column prop="stateName" :label="$t('maintainancePlanManage.table.state')" align="center" /> | |
| 56 | + <el-table-column :label="$t('common.operation')" align="center" width="300"> | |
| 57 | + <template slot-scope="scope"> | |
| 58 | + <el-button size="mini" type="primary" @click="handleEdit(scope.row)"> | |
| 59 | + {{ $t('common.edit') }} | |
| 60 | + </el-button> | |
| 61 | + <el-button size="mini" type="danger" @click="handleDelete(scope.row)"> | |
| 62 | + {{ $t('common.delete') }} | |
| 63 | + </el-button> | |
| 64 | + <el-button v-if="scope.row.state === '2020025'" size="mini" type="warning" @click="handleDisable(scope.row)"> | |
| 65 | + {{ $t('maintainancePlanManage.button.disable') }} | |
| 66 | + </el-button> | |
| 67 | + <el-button v-else size="mini" type="success" @click="handleEnable(scope.row)"> | |
| 68 | + {{ $t('maintainancePlanManage.button.enable') }} | |
| 69 | + </el-button> | |
| 70 | + </template> | |
| 71 | + </el-table-column> | |
| 72 | + </el-table> | |
| 73 | + | |
| 74 | + <div class="pagination-wrapper"> | |
| 75 | + <div class="tip"> | |
| 76 | + {{ $t('maintainancePlanManage.tip') }} | |
| 77 | + </div> | |
| 78 | + <el-pagination :current-page="pagination.current" :page-sizes="[10, 20, 30, 50]" :page-size="pagination.size" | |
| 79 | + :total="pagination.total" layout="total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange" | |
| 80 | + @current-change="handleCurrentChange" /> | |
| 81 | + </div> | |
| 82 | + </el-card> | |
| 83 | + | |
| 84 | + <delete-maintainance-plan ref="deleteDialog" @success="handleSuccess" /> | |
| 85 | + <maintainance-plan-state ref="stateDialog" @success="handleSuccess" /> | |
| 86 | + </div> | |
| 87 | +</template> | |
| 88 | + | |
| 89 | +<script> | |
| 90 | +import { listMaintainancePlan } from '@/api/inspection/maintainancePlanManageApi' | |
| 91 | +import { getDict } from '@/api/community/communityApi' | |
| 92 | +import { getCommunityId } from '@/api/community/communityApi' | |
| 93 | +import DeleteMaintainancePlan from '@/components/inspection/deleteMaintainancePlan' | |
| 94 | +import MaintainancePlanState from '@/components/inspection/maintainancePlanState' | |
| 95 | + | |
| 96 | +export default { | |
| 97 | + name: 'MaintainancePlanManageList', | |
| 98 | + components: { | |
| 99 | + DeleteMaintainancePlan, | |
| 100 | + MaintainancePlanState | |
| 101 | + }, | |
| 102 | + data() { | |
| 103 | + return { | |
| 104 | + loading: false, | |
| 105 | + searchForm: { | |
| 106 | + maintainancePlanName: '', | |
| 107 | + state: '' | |
| 108 | + }, | |
| 109 | + tableData: [], | |
| 110 | + states: [], | |
| 111 | + pagination: { | |
| 112 | + current: 1, | |
| 113 | + size: 10, | |
| 114 | + total: 0 | |
| 115 | + }, | |
| 116 | + communityId: '' | |
| 117 | + } | |
| 118 | + }, | |
| 119 | + created() { | |
| 120 | + this.communityId = getCommunityId() | |
| 121 | + this.getList() | |
| 122 | + this.getDictData() | |
| 123 | + }, | |
| 124 | + methods: { | |
| 125 | + async getList() { | |
| 126 | + try { | |
| 127 | + this.loading = true | |
| 128 | + const params = { | |
| 129 | + page: this.pagination.current, | |
| 130 | + row: this.pagination.size, | |
| 131 | + maintainancePlanName: this.searchForm.maintainancePlanName, | |
| 132 | + state: this.searchForm.state, | |
| 133 | + communityId: this.communityId | |
| 134 | + } | |
| 135 | + const { data, total } = await listMaintainancePlan(params) | |
| 136 | + this.tableData = data | |
| 137 | + this.pagination.total = total | |
| 138 | + } catch (error) { | |
| 139 | + this.$message.error(this.$t('maintainancePlanManage.fetchError')) | |
| 140 | + } finally { | |
| 141 | + this.loading = false | |
| 142 | + } | |
| 143 | + }, | |
| 144 | + async getDictData() { | |
| 145 | + try { | |
| 146 | + const data = await getDict('maintainance_plan', 'state') | |
| 147 | + this.states = data | |
| 148 | + } catch (error) { | |
| 149 | + console.error('获取字典数据失败:', error) | |
| 150 | + } | |
| 151 | + }, | |
| 152 | + handleSearch() { | |
| 153 | + this.pagination.current = 1 | |
| 154 | + this.getList() | |
| 155 | + }, | |
| 156 | + handleAdd() { | |
| 157 | + this.$router.push('/views/inspection/addMaintainancePlan') | |
| 158 | + }, | |
| 159 | + handleEdit(row) { | |
| 160 | + this.$router.push(`/views/inspection/editMaintainancePlan?planId=${row.planId}`) | |
| 161 | + }, | |
| 162 | + handleDelete(row) { | |
| 163 | + this.$refs.deleteDialog.open(row) | |
| 164 | + }, | |
| 165 | + handleViewMachine(row) { | |
| 166 | + this.$router.push(`/views/inspection/maintainancePlanMachine?planId=${row.planId}`) | |
| 167 | + }, | |
| 168 | + handleEnable(row) { | |
| 169 | + this.$refs.stateDialog.open({ | |
| 170 | + planId: row.planId, | |
| 171 | + stateName: this.$t('maintainancePlanManage.button.enable'), | |
| 172 | + state: '2020025' | |
| 173 | + }) | |
| 174 | + }, | |
| 175 | + handleDisable(row) { | |
| 176 | + this.$refs.stateDialog.open({ | |
| 177 | + planId: row.planId, | |
| 178 | + stateName: this.$t('maintainancePlanManage.button.disable'), | |
| 179 | + state: '2020026' | |
| 180 | + }) | |
| 181 | + }, | |
| 182 | + handleSuccess() { | |
| 183 | + this.getList() | |
| 184 | + }, | |
| 185 | + handleSizeChange(val) { | |
| 186 | + this.pagination.size = val | |
| 187 | + this.getList() | |
| 188 | + }, | |
| 189 | + handleCurrentChange(val) { | |
| 190 | + this.pagination.current = val | |
| 191 | + this.getList() | |
| 192 | + } | |
| 193 | + } | |
| 194 | +} | |
| 195 | +</script> | |
| 196 | + | |
| 197 | +<style lang="scss" scoped> | |
| 198 | +.maintainance-plan-manage-container { | |
| 199 | + padding: 20px; | |
| 200 | + | |
| 201 | + .search-card { | |
| 202 | + margin-bottom: 20px; | |
| 203 | + } | |
| 204 | + | |
| 205 | + .table-card { | |
| 206 | + margin-bottom: 20px; | |
| 207 | + } | |
| 208 | + | |
| 209 | + .pagination-wrapper { | |
| 210 | + margin-top: 20px; | |
| 211 | + display: flex; | |
| 212 | + justify-content: space-between; | |
| 213 | + align-items: center; | |
| 214 | + | |
| 215 | + .tip { | |
| 216 | + color: #909399; | |
| 217 | + font-size: 14px; | |
| 218 | + } | |
| 219 | + } | |
| 220 | +} | |
| 221 | +</style> | |
| 0 | 222 | \ No newline at end of file | ... | ... |
src/views/inspection/maintainanceStandardItemLang.js
0 → 100644
| 1 | +export const messages = { | |
| 2 | + en: { | |
| 3 | + maintainanceStandardItem: { | |
| 4 | + title: 'Inspection Items', | |
| 5 | + back: 'Back', | |
| 6 | + add: 'Add', | |
| 7 | + item: 'Inspection Item', | |
| 8 | + id: 'ID', | |
| 9 | + operation: 'Operation', | |
| 10 | + delete: 'Delete', | |
| 11 | + fetchError: 'Failed to fetch inspection items' | |
| 12 | + }, | |
| 13 | + chooseMaintainanceStandardItem: { | |
| 14 | + title: 'Select Inspection Items', | |
| 15 | + searchPlaceholder: 'Enter inspection item', | |
| 16 | + search: 'Search', | |
| 17 | + reset: 'Reset', | |
| 18 | + id: 'ID', | |
| 19 | + item: 'Inspection Item', | |
| 20 | + submit: 'Submit', | |
| 21 | + cancel: 'Cancel', | |
| 22 | + selectWarning: 'Please select at least one inspection item', | |
| 23 | + submitSuccess: 'Added successfully', | |
| 24 | + submitError: 'Failed to add inspection items', | |
| 25 | + fetchError: 'Failed to fetch available inspection items' | |
| 26 | + }, | |
| 27 | + deleteMaintainanceStandardItem: { | |
| 28 | + title: 'Confirm Operation', | |
| 29 | + confirmMessage: 'Are you sure to delete this inspection item?', | |
| 30 | + cancel: 'Cancel', | |
| 31 | + confirm: 'Confirm Delete', | |
| 32 | + deleteSuccess: 'Deleted successfully', | |
| 33 | + deleteError: 'Failed to delete inspection item' | |
| 34 | + } | |
| 35 | + }, | |
| 36 | + zh: { | |
| 37 | + maintainanceStandardItem: { | |
| 38 | + title: '检查项', | |
| 39 | + back: '返回', | |
| 40 | + add: '添加', | |
| 41 | + item: '检查项', | |
| 42 | + id: '编号', | |
| 43 | + operation: '操作', | |
| 44 | + delete: '删除', | |
| 45 | + fetchError: '获取检查项失败' | |
| 46 | + }, | |
| 47 | + chooseMaintainanceStandardItem: { | |
| 48 | + title: '选择检查项', | |
| 49 | + searchPlaceholder: '输入检查项', | |
| 50 | + search: '查询', | |
| 51 | + reset: '重置', | |
| 52 | + id: '编号', | |
| 53 | + item: '检查项', | |
| 54 | + submit: '提交', | |
| 55 | + cancel: '取消', | |
| 56 | + selectWarning: '请至少选择一项检查项', | |
| 57 | + submitSuccess: '添加成功', | |
| 58 | + submitError: '添加检查项失败', | |
| 59 | + fetchError: '获取可选检查项失败' | |
| 60 | + }, | |
| 61 | + deleteMaintainanceStandardItem: { | |
| 62 | + title: '请确认您的操作', | |
| 63 | + confirmMessage: '确定删除该检查项吗?', | |
| 64 | + cancel: '点错了', | |
| 65 | + confirm: '确认删除', | |
| 66 | + deleteSuccess: '删除成功', | |
| 67 | + deleteError: '删除检查项失败' | |
| 68 | + } | |
| 69 | + } | |
| 70 | +} | |
| 0 | 71 | \ No newline at end of file | ... | ... |
src/views/inspection/maintainanceStandardItemList.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="maintainance-standard-item-container"> | |
| 3 | + <el-card class="box-card"> | |
| 4 | + <div slot="header" class="clearfix"> | |
| 5 | + <span>{{ $t('maintainanceStandardItem.title') }}</span> | |
| 6 | + <div class="card-header-actions"> | |
| 7 | + <el-button type="primary" size="small" @click="_goBack" style="margin-right:10px"> | |
| 8 | + <i class="el-icon-close"></i> | |
| 9 | + <span>{{ $t('maintainanceStandardItem.back') }}</span> | |
| 10 | + </el-button> | |
| 11 | + <el-button type="primary" size="small" @click="_openAddMaintainanceStandardItemModal"> | |
| 12 | + <i class="el-icon-plus"></i> | |
| 13 | + <span>{{ $t('maintainanceStandardItem.add') }}</span> | |
| 14 | + </el-button> | |
| 15 | + </div> | |
| 16 | + </div> | |
| 17 | + | |
| 18 | + <el-table :data="maintainanceStandardItemInfo.items" border style="width: 100%" v-loading="loading"> | |
| 19 | + <el-table-column prop="itemTitle" :label="$t('maintainanceStandardItem.item')" align="center"> | |
| 20 | + </el-table-column> | |
| 21 | + <el-table-column prop="itemId" :label="$t('maintainanceStandardItem.id')" align="center"> | |
| 22 | + </el-table-column> | |
| 23 | + <el-table-column :label="$t('maintainanceStandardItem.operation')" align="center" width="150"> | |
| 24 | + <template slot-scope="scope"> | |
| 25 | + <el-button size="mini" type="danger" @click="_openDeleteMaintainanceStandardItemModel(scope.row)"> | |
| 26 | + {{ $t('maintainanceStandardItem.delete') }} | |
| 27 | + </el-button> | |
| 28 | + </template> | |
| 29 | + </el-table-column> | |
| 30 | + </el-table> | |
| 31 | + | |
| 32 | + <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" | |
| 33 | + :current-page="pagination.current" :page-sizes="[10, 20, 30, 50]" :page-size="pagination.size" | |
| 34 | + layout="total, sizes, prev, pager, next, jumper" :total="pagination.total" | |
| 35 | + style="margin-top: 20px; text-align: right;"> | |
| 36 | + </el-pagination> | |
| 37 | + </el-card> | |
| 38 | + | |
| 39 | + <choose-maintainance-standard-item ref="chooseModal" @success="_listMaintainanceStandardItems"></choose-maintainance-standard-item> | |
| 40 | + <delete-maintainance-standard-item ref="deleteModal" @success="_listMaintainanceStandardItems"></delete-maintainance-standard-item> | |
| 41 | + </div> | |
| 42 | +</template> | |
| 43 | + | |
| 44 | +<script> | |
| 45 | +import { listMaintainanceStandardItem } from '@/api/inspection/maintainanceStandardItemApi' | |
| 46 | +import ChooseMaintainanceStandardItem from '@/components/inspection/chooseMaintainanceStandardItem' | |
| 47 | +import DeleteMaintainanceStandardItem from '@/components/inspection/deleteMaintainanceStandardItem' | |
| 48 | +import { getCommunityId } from '@/api/community/communityApi' | |
| 49 | + | |
| 50 | +export default { | |
| 51 | + name: 'MaintainanceStandardItemList', | |
| 52 | + components: { | |
| 53 | + ChooseMaintainanceStandardItem, | |
| 54 | + DeleteMaintainanceStandardItem | |
| 55 | + }, | |
| 56 | + data() { | |
| 57 | + return { | |
| 58 | + loading: false, | |
| 59 | + maintainanceStandardItemInfo: { | |
| 60 | + items: [], | |
| 61 | + standardId: '' | |
| 62 | + }, | |
| 63 | + pagination: { | |
| 64 | + current: 1, | |
| 65 | + size: 10, | |
| 66 | + total: 0 | |
| 67 | + } | |
| 68 | + } | |
| 69 | + }, | |
| 70 | + created() { | |
| 71 | + this.maintainanceStandardItemInfo.standardId = this.$route.query.standardId | |
| 72 | + this._listMaintainanceStandardItems() | |
| 73 | + }, | |
| 74 | + methods: { | |
| 75 | + async _listMaintainanceStandardItems() { | |
| 76 | + try { | |
| 77 | + this.loading = true | |
| 78 | + const params = { | |
| 79 | + page: this.pagination.current, | |
| 80 | + row: this.pagination.size, | |
| 81 | + communityId: getCommunityId(), | |
| 82 | + standardId: this.maintainanceStandardItemInfo.standardId | |
| 83 | + } | |
| 84 | + const { data, records } = await listMaintainanceStandardItem(params) | |
| 85 | + this.maintainanceStandardItemInfo.items = data | |
| 86 | + this.pagination.total = records | |
| 87 | + } catch (error) { | |
| 88 | + this.$message.error(this.$t('maintainanceStandardItem.fetchError')) | |
| 89 | + } finally { | |
| 90 | + this.loading = false | |
| 91 | + } | |
| 92 | + }, | |
| 93 | + _openAddMaintainanceStandardItemModal() { | |
| 94 | + this.$refs.chooseModal.open({ | |
| 95 | + standardId: this.maintainanceStandardItemInfo.standardId | |
| 96 | + }) | |
| 97 | + }, | |
| 98 | + _openDeleteMaintainanceStandardItemModel(item) { | |
| 99 | + this.$refs.deleteModal.open({ | |
| 100 | + ...item, | |
| 101 | + standardId: this.maintainanceStandardItemInfo.standardId | |
| 102 | + }) | |
| 103 | + }, | |
| 104 | + _goBack() { | |
| 105 | + this.$router.go(-1) | |
| 106 | + }, | |
| 107 | + handleSizeChange(val) { | |
| 108 | + this.pagination.size = val | |
| 109 | + this._listMaintainanceStandardItems() | |
| 110 | + }, | |
| 111 | + handleCurrentChange(val) { | |
| 112 | + this.pagination.current = val | |
| 113 | + this._listMaintainanceStandardItems() | |
| 114 | + } | |
| 115 | + } | |
| 116 | +} | |
| 117 | +</script> | |
| 118 | + | |
| 119 | +<style lang="scss" scoped> | |
| 120 | +.maintainance-standard-item-container { | |
| 121 | + padding: 20px; | |
| 122 | + | |
| 123 | + .box-card { | |
| 124 | + margin-bottom: 20px; | |
| 125 | + | |
| 126 | + .clearfix { | |
| 127 | + display: flex; | |
| 128 | + justify-content: space-between; | |
| 129 | + align-items: center; | |
| 130 | + } | |
| 131 | + | |
| 132 | + .card-header-actions { | |
| 133 | + display: flex; | |
| 134 | + align-items: center; | |
| 135 | + } | |
| 136 | + } | |
| 137 | +} | |
| 138 | +</style> | |
| 0 | 139 | \ No newline at end of file | ... | ... |
src/views/inspection/maintainanceStandardManageLang.js
0 → 100644
| 1 | +export const messages = { | |
| 2 | + en: { | |
| 3 | + maintainanceStandard: { | |
| 4 | + search: { | |
| 5 | + title: 'Search Conditions', | |
| 6 | + standardName: 'Please select maintenance item' | |
| 7 | + }, | |
| 8 | + list: { | |
| 9 | + title: 'Maintenance Standard' | |
| 10 | + }, | |
| 11 | + table: { | |
| 12 | + standardName: 'Maintenance Standard', | |
| 13 | + itemCount: 'Inspection Items', | |
| 14 | + item: 'Items', | |
| 15 | + remark: 'Remark', | |
| 16 | + createTime: 'Create Time' | |
| 17 | + }, | |
| 18 | + form: { | |
| 19 | + standardName: 'Maintenance Item', | |
| 20 | + remark: 'Remark' | |
| 21 | + }, | |
| 22 | + placeholder: { | |
| 23 | + standardName: 'Required, please fill in the maintenance item', | |
| 24 | + remark: 'Required, please fill in the remark' | |
| 25 | + }, | |
| 26 | + rules: { | |
| 27 | + standardName: 'Maintenance item cannot be empty', | |
| 28 | + standardNameMax: 'Maintenance item cannot exceed 256 characters', | |
| 29 | + remark: 'Remark cannot be empty', | |
| 30 | + remarkMax: 'Remark cannot exceed 512 characters', | |
| 31 | + standardId: 'ID cannot be empty' | |
| 32 | + }, | |
| 33 | + add: { | |
| 34 | + title: 'Add Maintenance Standard' | |
| 35 | + }, | |
| 36 | + edit: { | |
| 37 | + title: 'Edit Maintenance Standard' | |
| 38 | + }, | |
| 39 | + delete: { | |
| 40 | + title: 'Confirm Operation', | |
| 41 | + confirmText: 'Are you sure to delete this maintenance standard?' | |
| 42 | + }, | |
| 43 | + message: { | |
| 44 | + addSuccess: 'Add successfully', | |
| 45 | + addFailed: 'Add failed', | |
| 46 | + editSuccess: 'Edit successfully', | |
| 47 | + editFailed: 'Edit failed', | |
| 48 | + deleteSuccess: 'Delete successfully', | |
| 49 | + deleteFailed: 'Delete failed', | |
| 50 | + fetchError: 'Failed to fetch data' | |
| 51 | + } | |
| 52 | + } | |
| 53 | + }, | |
| 54 | + zh: { | |
| 55 | + maintainanceStandard: { | |
| 56 | + search: { | |
| 57 | + title: '查询条件', | |
| 58 | + standardName: '请选择保养项目' | |
| 59 | + }, | |
| 60 | + list: { | |
| 61 | + title: '保养标准' | |
| 62 | + }, | |
| 63 | + table: { | |
| 64 | + standardName: '保养标准', | |
| 65 | + itemCount: '检查项', | |
| 66 | + item: '检查项', | |
| 67 | + remark: '备注', | |
| 68 | + createTime: '创建时间' | |
| 69 | + }, | |
| 70 | + form: { | |
| 71 | + standardName: '保养项目', | |
| 72 | + remark: '备注' | |
| 73 | + }, | |
| 74 | + placeholder: { | |
| 75 | + standardName: '必填,请填写保养项目', | |
| 76 | + remark: '必填,请填写备注' | |
| 77 | + }, | |
| 78 | + rules: { | |
| 79 | + standardName: '保养项目不能为空', | |
| 80 | + standardNameMax: '保养项目不能超过256个字符', | |
| 81 | + remark: '备注不能为空', | |
| 82 | + remarkMax: '备注不能超过512个字符', | |
| 83 | + standardId: '编号不能为空' | |
| 84 | + }, | |
| 85 | + add: { | |
| 86 | + title: '添加保养标准' | |
| 87 | + }, | |
| 88 | + edit: { | |
| 89 | + title: '修改保养标准' | |
| 90 | + }, | |
| 91 | + delete: { | |
| 92 | + title: '请确认您的操作', | |
| 93 | + confirmText: '确定删除保养标准?' | |
| 94 | + }, | |
| 95 | + message: { | |
| 96 | + addSuccess: '添加成功', | |
| 97 | + addFailed: '添加失败', | |
| 98 | + editSuccess: '修改成功', | |
| 99 | + editFailed: '修改失败', | |
| 100 | + deleteSuccess: '删除成功', | |
| 101 | + deleteFailed: '删除失败', | |
| 102 | + fetchError: '获取数据失败' | |
| 103 | + } | |
| 104 | + } | |
| 105 | + } | |
| 106 | +} | |
| 0 | 107 | \ No newline at end of file | ... | ... |
src/views/inspection/maintainanceStandardManageList.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="maintainance-standard-container"> | |
| 3 | + <!-- 查询条件 --> | |
| 4 | + <el-card class="search-wrapper"> | |
| 5 | + <div slot="header" class="flex justify-between"> | |
| 6 | + <span>{{ $t('maintainanceStandard.search.title') }}</span> | |
| 7 | + </div> | |
| 8 | + <el-row :gutter="20"> | |
| 9 | + <el-col :span="6"> | |
| 10 | + <el-input v-model="searchForm.standardName" :placeholder="$t('maintainanceStandard.search.standardName')" | |
| 11 | + clearable /> | |
| 12 | + </el-col> | |
| 13 | + <el-col :span="4"> | |
| 14 | + <el-button type="primary" @click="handleSearch"> | |
| 15 | + {{ $t('common.search') }} | |
| 16 | + </el-button> | |
| 17 | + </el-col> | |
| 18 | + </el-row> | |
| 19 | + </el-card> | |
| 20 | + | |
| 21 | + <!-- 列表 --> | |
| 22 | + <el-card class="list-wrapper"> | |
| 23 | + <div slot="header" class="flex justify-between"> | |
| 24 | + <span>{{ $t('maintainanceStandard.list.title') }}</span> | |
| 25 | + <el-button type="primary" size="small" @click="handleAdd"> | |
| 26 | + {{ $t('common.add') }} | |
| 27 | + </el-button> | |
| 28 | + </div> | |
| 29 | + | |
| 30 | + <el-table v-loading="loading" :data="tableData" border style="width: 100%"> | |
| 31 | + <el-table-column prop="standardName" :label="$t('maintainanceStandard.table.standardName')" align="center" /> | |
| 32 | + <el-table-column :label="$t('maintainanceStandard.table.itemCount')" align="center"> | |
| 33 | + <template slot-scope="scope"> | |
| 34 | + {{ scope.row.itemCount }} ( | |
| 35 | + <el-link type="primary" @click="handleItem(scope.row)"> | |
| 36 | + {{ $t('maintainanceStandard.table.item') }} | |
| 37 | + </el-link>) | |
| 38 | + </template> | |
| 39 | + </el-table-column> | |
| 40 | + <el-table-column prop="remark" :label="$t('maintainanceStandard.table.remark')" align="center" /> | |
| 41 | + <el-table-column prop="createTime" :label="$t('maintainanceStandard.table.createTime')" align="center" /> | |
| 42 | + <el-table-column :label="$t('common.operation')" align="center" width="200"> | |
| 43 | + <template slot-scope="scope"> | |
| 44 | + <el-button size="mini" type="primary" @click="handleEdit(scope.row)"> | |
| 45 | + {{ $t('common.edit') }} | |
| 46 | + </el-button> | |
| 47 | + <el-button size="mini" type="danger" @click="handleDelete(scope.row)"> | |
| 48 | + {{ $t('common.delete') }} | |
| 49 | + </el-button> | |
| 50 | + </template> | |
| 51 | + </el-table-column> | |
| 52 | + </el-table> | |
| 53 | + | |
| 54 | + <el-pagination :current-page.sync="page.current" :page-sizes="[10, 20, 30, 50]" :page-size="page.size" | |
| 55 | + :total="page.total" layout="total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange" | |
| 56 | + @current-change="handleCurrentChange" /> | |
| 57 | + </el-card> | |
| 58 | + | |
| 59 | + <!-- 组件 --> | |
| 60 | + <AddMaintainanceStandard ref="addDialog" @success="handleSuccess" /> | |
| 61 | + <EditMaintainanceStandard ref="editDialog" @success="handleSuccess" /> | |
| 62 | + <DeleteMaintainanceStandard ref="deleteDialog" @success="handleSuccess" /> | |
| 63 | + </div> | |
| 64 | +</template> | |
| 65 | + | |
| 66 | +<script> | |
| 67 | +import { | |
| 68 | + listMaintainanceStandard | |
| 69 | +} from '@/api/inspection/maintainanceStandardManageApi' | |
| 70 | +import AddMaintainanceStandard from '@/components/inspection/addMaintainanceStandard' | |
| 71 | +import EditMaintainanceStandard from '@/components/inspection/editMaintainanceStandard' | |
| 72 | +import DeleteMaintainanceStandard from '@/components/inspection/deleteMaintainanceStandard' | |
| 73 | +import { getCommunityId } from '@/api/community/communityApi' | |
| 74 | + | |
| 75 | +export default { | |
| 76 | + name: 'MaintainanceStandardManageList', | |
| 77 | + components: { | |
| 78 | + AddMaintainanceStandard, | |
| 79 | + EditMaintainanceStandard, | |
| 80 | + DeleteMaintainanceStandard | |
| 81 | + }, | |
| 82 | + data() { | |
| 83 | + return { | |
| 84 | + loading: false, | |
| 85 | + searchForm: { | |
| 86 | + standardName: '', | |
| 87 | + communityId: '' | |
| 88 | + }, | |
| 89 | + tableData: [], | |
| 90 | + page: { | |
| 91 | + current: 1, | |
| 92 | + size: 10, | |
| 93 | + total: 0 | |
| 94 | + } | |
| 95 | + } | |
| 96 | + }, | |
| 97 | + created() { | |
| 98 | + this.searchForm.communityId = getCommunityId() | |
| 99 | + this.getList() | |
| 100 | + }, | |
| 101 | + methods: { | |
| 102 | + async getList() { | |
| 103 | + try { | |
| 104 | + this.loading = true | |
| 105 | + const params = { | |
| 106 | + page: this.page.current, | |
| 107 | + row: this.page.size, | |
| 108 | + ...this.searchForm | |
| 109 | + } | |
| 110 | + const { data, total } = await listMaintainanceStandard(params) | |
| 111 | + this.tableData = data | |
| 112 | + this.page.total = total | |
| 113 | + } catch (error) { | |
| 114 | + this.$message.error(this.$t('maintainanceStandard.fetchError')) | |
| 115 | + } finally { | |
| 116 | + this.loading = false | |
| 117 | + } | |
| 118 | + }, | |
| 119 | + handleSearch() { | |
| 120 | + this.page.current = 1 | |
| 121 | + this.getList() | |
| 122 | + }, | |
| 123 | + handleAdd() { | |
| 124 | + this.$refs.addDialog.open() | |
| 125 | + }, | |
| 126 | + handleEdit(row) { | |
| 127 | + this.$refs.editDialog.open(row) | |
| 128 | + }, | |
| 129 | + handleDelete(row) { | |
| 130 | + this.$refs.deleteDialog.open(row) | |
| 131 | + }, | |
| 132 | + handleItem(row) { | |
| 133 | + this.$router.push(`/views/inspection/maintainanceStandardItem?standardId=${row.standardId}`) | |
| 134 | + }, | |
| 135 | + handleSuccess() { | |
| 136 | + this.getList() | |
| 137 | + }, | |
| 138 | + handleSizeChange(val) { | |
| 139 | + this.page.size = val | |
| 140 | + this.getList() | |
| 141 | + }, | |
| 142 | + handleCurrentChange(val) { | |
| 143 | + this.page.current = val | |
| 144 | + this.getList() | |
| 145 | + } | |
| 146 | + } | |
| 147 | +} | |
| 148 | +</script> | |
| 149 | + | |
| 150 | +<style lang="scss" scoped> | |
| 151 | +.maintainance-standard-container { | |
| 152 | + padding: 20px; | |
| 153 | + margin: 0; | |
| 154 | + | |
| 155 | + .search-wrapper { | |
| 156 | + margin-bottom: 20px; | |
| 157 | + | |
| 158 | + .search-title { | |
| 159 | + font-size: 16px; | |
| 160 | + font-weight: bold; | |
| 161 | + margin-bottom: 20px; | |
| 162 | + text-align: left; | |
| 163 | + color: #333; | |
| 164 | + } | |
| 165 | + } | |
| 166 | + | |
| 167 | + .list-wrapper { | |
| 168 | + .list-header { | |
| 169 | + display: flex; | |
| 170 | + justify-content: space-between; | |
| 171 | + align-items: center; | |
| 172 | + margin-bottom: 20px; | |
| 173 | + | |
| 174 | + .list-title { | |
| 175 | + font-size: 16px; | |
| 176 | + font-weight: bold; | |
| 177 | + color: #333; | |
| 178 | + } | |
| 179 | + } | |
| 180 | + | |
| 181 | + .el-pagination { | |
| 182 | + margin-top: 20px; | |
| 183 | + text-align: right; | |
| 184 | + } | |
| 185 | + } | |
| 186 | +} | |
| 187 | +</style> | |
| 0 | 188 | \ No newline at end of file | ... | ... |