Commit 8592fee744f96751c3d5b069d31ba2baf5f4034d
1 parent
6c157c6e
开发排版功能
Showing
22 changed files
with
2369 additions
and
2 deletions
src/api/org/classesManageApi.js
0 → 100644
| 1 | +import request from '@/utils/request' | ||
| 2 | + | ||
| 3 | +// 获取班次列表 | ||
| 4 | +export function listClasses(params) { | ||
| 5 | + return new Promise((resolve, reject) => { | ||
| 6 | + request({ | ||
| 7 | + url: '/classes.listClasses', | ||
| 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 saveClasses(data) { | ||
| 21 | + return new Promise((resolve, reject) => { | ||
| 22 | + request({ | ||
| 23 | + url: '/classes.saveClasses', | ||
| 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 updateClasses(data) { | ||
| 37 | + return new Promise((resolve, reject) => { | ||
| 38 | + request({ | ||
| 39 | + url: '/classes.updateClasses', | ||
| 40 | + method: 'post', | ||
| 41 | + data | ||
| 42 | + }).then(response => { | ||
| 43 | + const res = response.data | ||
| 44 | + resolve(res) | ||
| 45 | + }).catch(error => { | ||
| 46 | + reject(error) | ||
| 47 | + }) | ||
| 48 | + }) | ||
| 49 | +} | ||
| 50 | + | ||
| 51 | +// 删除班次 | ||
| 52 | +export function deleteClasses(data) { | ||
| 53 | + return new Promise((resolve, reject) => { | ||
| 54 | + request({ | ||
| 55 | + url: '/classes.deleteClasses', | ||
| 56 | + method: 'post', | ||
| 57 | + data | ||
| 58 | + }).then(response => { | ||
| 59 | + const res = response.data | ||
| 60 | + resolve(res) | ||
| 61 | + }).catch(error => { | ||
| 62 | + reject(error) | ||
| 63 | + }) | ||
| 64 | + }) | ||
| 65 | +} | ||
| 66 | + | ||
| 67 | +// 更新班次状态 | ||
| 68 | +export function updateClassesState(data) { | ||
| 69 | + return new Promise((resolve, reject) => { | ||
| 70 | + request({ | ||
| 71 | + url: '/classes.updateClassesState', | ||
| 72 | + method: 'post', | ||
| 73 | + data | ||
| 74 | + }).then(response => { | ||
| 75 | + const res = response.data | ||
| 76 | + resolve(res) | ||
| 77 | + }).catch(error => { | ||
| 78 | + reject(error) | ||
| 79 | + }) | ||
| 80 | + }) | ||
| 81 | +} | ||
| 0 | \ No newline at end of file | 82 | \ No newline at end of file |
src/api/org/dataPrivilegeManageApi.js
0 → 100644
| 1 | +import request from '@/utils/request' | ||
| 2 | + | ||
| 3 | +// 获取数据权限列表 | ||
| 4 | +export function listDataPrivilege(params) { | ||
| 5 | + return new Promise((resolve, reject) => { | ||
| 6 | + request({ | ||
| 7 | + url: '/dataPrivilege.listDataPrivilege', | ||
| 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 saveDataPrivilege(data) { | ||
| 21 | + return new Promise((resolve, reject) => { | ||
| 22 | + request({ | ||
| 23 | + url: '/dataPrivilege.saveDataPrivilege', | ||
| 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 updateDataPrivilege(data) { | ||
| 37 | + return new Promise((resolve, reject) => { | ||
| 38 | + request({ | ||
| 39 | + url: '/dataPrivilege.updateDataPrivilege', | ||
| 40 | + method: 'post', | ||
| 41 | + data | ||
| 42 | + }).then(response => { | ||
| 43 | + const res = response.data | ||
| 44 | + resolve(res) | ||
| 45 | + }).catch(error => { | ||
| 46 | + reject(error) | ||
| 47 | + }) | ||
| 48 | + }) | ||
| 49 | +} | ||
| 50 | + | ||
| 51 | +// 删除数据权限 | ||
| 52 | +export function deleteDataPrivilege(data) { | ||
| 53 | + return new Promise((resolve, reject) => { | ||
| 54 | + request({ | ||
| 55 | + url: '/dataPrivilege.deleteDataPrivilege', | ||
| 56 | + method: 'post', | ||
| 57 | + data | ||
| 58 | + }).then(response => { | ||
| 59 | + const res = response.data | ||
| 60 | + resolve(res) | ||
| 61 | + }).catch(error => { | ||
| 62 | + reject(error) | ||
| 63 | + }) | ||
| 64 | + }) | ||
| 65 | +} | ||
| 66 | + | ||
| 67 | +// 获取数据权限单元列表 | ||
| 68 | +export function listDataPrivilegeUnit(params) { | ||
| 69 | + return new Promise((resolve, reject) => { | ||
| 70 | + request({ | ||
| 71 | + url: '/dataPrivilegeUnit.listDataPrivilegeUnit', | ||
| 72 | + method: 'get', | ||
| 73 | + params | ||
| 74 | + }).then(response => { | ||
| 75 | + const res = response.data | ||
| 76 | + resolve(res) | ||
| 77 | + }).catch(error => { | ||
| 78 | + reject(error) | ||
| 79 | + }) | ||
| 80 | + }) | ||
| 81 | +} | ||
| 82 | + | ||
| 83 | +// 获取未关联的单元列表 | ||
| 84 | +export function listUnitsNotInDataPrivilege(params) { | ||
| 85 | + return new Promise((resolve, reject) => { | ||
| 86 | + request({ | ||
| 87 | + url: '/dataPrivilegeUnit.listUnitsNotInDataPrivilege', | ||
| 88 | + method: 'get', | ||
| 89 | + params | ||
| 90 | + }).then(response => { | ||
| 91 | + const res = response.data | ||
| 92 | + resolve(res) | ||
| 93 | + }).catch(error => { | ||
| 94 | + reject(error) | ||
| 95 | + }) | ||
| 96 | + }) | ||
| 97 | +} | ||
| 98 | + | ||
| 99 | +// 保存数据权限单元 | ||
| 100 | +export function saveDataPrivilegeUnit(data) { | ||
| 101 | + return new Promise((resolve, reject) => { | ||
| 102 | + request({ | ||
| 103 | + url: '/dataPrivilegeUnit.saveDataPrivilegeUnit', | ||
| 104 | + method: 'post', | ||
| 105 | + data | ||
| 106 | + }).then(response => { | ||
| 107 | + const res = response.data | ||
| 108 | + resolve(res) | ||
| 109 | + }).catch(error => { | ||
| 110 | + reject(error) | ||
| 111 | + }) | ||
| 112 | + }) | ||
| 113 | +} | ||
| 114 | + | ||
| 115 | +// 删除数据权限单元 | ||
| 116 | +export function deleteDataPrivilegeUnit(data) { | ||
| 117 | + return new Promise((resolve, reject) => { | ||
| 118 | + request({ | ||
| 119 | + url: '/dataPrivilegeUnit.deleteDataPrivilegeUnit', | ||
| 120 | + method: 'post', | ||
| 121 | + data | ||
| 122 | + }).then(response => { | ||
| 123 | + const res = response.data | ||
| 124 | + resolve(res) | ||
| 125 | + }).catch(error => { | ||
| 126 | + reject(error) | ||
| 127 | + }) | ||
| 128 | + }) | ||
| 129 | +} | ||
| 130 | + | ||
| 131 | +// 获取数据权限员工列表 | ||
| 132 | +export function listDataPrivilegeStaff(params) { | ||
| 133 | + return new Promise((resolve, reject) => { | ||
| 134 | + request({ | ||
| 135 | + url: '/dataPrivilegeStaff.listDataPrivilegeStaff', | ||
| 136 | + method: 'get', | ||
| 137 | + params | ||
| 138 | + }).then(response => { | ||
| 139 | + const res = response.data | ||
| 140 | + resolve(res) | ||
| 141 | + }).catch(error => { | ||
| 142 | + reject(error) | ||
| 143 | + }) | ||
| 144 | + }) | ||
| 145 | +} | ||
| 146 | + | ||
| 147 | +// 获取未关联的员工列表 | ||
| 148 | +export function listStaffNotInDataPrivilege(params) { | ||
| 149 | + return new Promise((resolve, reject) => { | ||
| 150 | + request({ | ||
| 151 | + url: '/dataPrivilegeStaff.listStaffNotInDataPrivilege', | ||
| 152 | + method: 'get', | ||
| 153 | + params | ||
| 154 | + }).then(response => { | ||
| 155 | + const res = response.data | ||
| 156 | + resolve(res) | ||
| 157 | + }).catch(error => { | ||
| 158 | + reject(error) | ||
| 159 | + }) | ||
| 160 | + }) | ||
| 161 | +} | ||
| 162 | + | ||
| 163 | +// 保存数据权限员工 | ||
| 164 | +export function saveDataPrivilegeStaff(data) { | ||
| 165 | + return new Promise((resolve, reject) => { | ||
| 166 | + request({ | ||
| 167 | + url: '/dataPrivilegeStaff.saveDataPrivilegeStaff', | ||
| 168 | + method: 'post', | ||
| 169 | + data | ||
| 170 | + }).then(response => { | ||
| 171 | + const res = response.data | ||
| 172 | + resolve(res) | ||
| 173 | + }).catch(error => { | ||
| 174 | + reject(error) | ||
| 175 | + }) | ||
| 176 | + }) | ||
| 177 | +} | ||
| 178 | + | ||
| 179 | +// 删除数据权限员工 | ||
| 180 | +export function deleteDataPrivilegeStaff(data) { | ||
| 181 | + return new Promise((resolve, reject) => { | ||
| 182 | + request({ | ||
| 183 | + url: '/dataPrivilegeStaff.deleteDataPrivilegeStaff', | ||
| 184 | + method: 'post', | ||
| 185 | + data | ||
| 186 | + }).then(response => { | ||
| 187 | + const res = response.data | ||
| 188 | + resolve(res) | ||
| 189 | + }).catch(error => { | ||
| 190 | + reject(error) | ||
| 191 | + }) | ||
| 192 | + }) | ||
| 193 | +} | ||
| 0 | \ No newline at end of file | 194 | \ No newline at end of file |
src/components/org/addClasses.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <el-dialog :title="$t('classesManage.add.title')" :visible.sync="visible" width="60%" @close="handleClose"> | ||
| 3 | + <el-form ref="form" :model="formData" label-width="120px"> | ||
| 4 | + <el-form-item :label="$t('classesManage.add.name')" prop="name" :rules="[ | ||
| 5 | + { required: true, message: $t('classesManage.validate.nameRequired'), trigger: 'blur' }, | ||
| 6 | + { max: 100, message: $t('classesManage.validate.nameMaxLength'), trigger: 'blur' } | ||
| 7 | + ]"> | ||
| 8 | + <el-input v-model="formData.name" :placeholder="$t('classesManage.add.namePlaceholder')" /> | ||
| 9 | + </el-form-item> | ||
| 10 | + | ||
| 11 | + <el-form-item v-for="(time, index) in formData.times" :key="time.id" | ||
| 12 | + :label="index === 0 ? $t('classesManage.add.workTime') : ''"> | ||
| 13 | + <el-col :span="10"> | ||
| 14 | + <el-time-picker v-model="time.startTime" :placeholder="$t('classesManage.add.startTimePlaceholder')" | ||
| 15 | + format="HH:mm" value-format="HH:mm" /> | ||
| 16 | + </el-col> | ||
| 17 | + <el-col :span="2" style="text-align: center">-</el-col> | ||
| 18 | + <el-col :span="10"> | ||
| 19 | + <el-time-picker v-model="time.endTime" :placeholder="$t('classesManage.add.endTimePlaceholder')" | ||
| 20 | + format="HH:mm" value-format="HH:mm" /> | ||
| 21 | + </el-col> | ||
| 22 | + <el-col :span="2"> | ||
| 23 | + <el-button type="danger" icon="el-icon-delete" circle @click="removeTime(index)" /> | ||
| 24 | + </el-col> | ||
| 25 | + </el-form-item> | ||
| 26 | + | ||
| 27 | + <el-form-item> | ||
| 28 | + <el-button type="primary" @click="addTime"> | ||
| 29 | + {{ $t('classesManage.add.addTime') }} | ||
| 30 | + </el-button> | ||
| 31 | + </el-form-item> | ||
| 32 | + | ||
| 33 | + <el-form-item :label="$t('classesManage.add.remark')" prop="remark" :rules="[ | ||
| 34 | + { required: true, message: $t('classesManage.validate.remarkRequired'), trigger: 'blur' }, | ||
| 35 | + { max: 200, message: $t('classesManage.validate.remarkMaxLength'), trigger: 'blur' } | ||
| 36 | + ]"> | ||
| 37 | + <el-input v-model="formData.remark" type="textarea" :placeholder="$t('classesManage.add.remarkPlaceholder')" | ||
| 38 | + :rows="3" /> | ||
| 39 | + </el-form-item> | ||
| 40 | + </el-form> | ||
| 41 | + | ||
| 42 | + <div slot="footer" class="dialog-footer"> | ||
| 43 | + <el-button @click="visible = false"> | ||
| 44 | + {{ $t('common.cancel') }} | ||
| 45 | + </el-button> | ||
| 46 | + <el-button type="primary" @click="handleSubmit"> | ||
| 47 | + {{ $t('common.save') }} | ||
| 48 | + </el-button> | ||
| 49 | + </div> | ||
| 50 | + </el-dialog> | ||
| 51 | +</template> | ||
| 52 | + | ||
| 53 | +<script> | ||
| 54 | +import { saveClasses } from '@/api/org/classesManageApi' | ||
| 55 | +import { getUuid } from '@/utils/commonUtil' | ||
| 56 | + | ||
| 57 | +export default { | ||
| 58 | + name: 'AddClasses', | ||
| 59 | + data() { | ||
| 60 | + return { | ||
| 61 | + visible: false, | ||
| 62 | + formData: { | ||
| 63 | + name: '', | ||
| 64 | + remark: '', | ||
| 65 | + times: [] | ||
| 66 | + } | ||
| 67 | + } | ||
| 68 | + }, | ||
| 69 | + methods: { | ||
| 70 | + open() { | ||
| 71 | + this.resetForm() | ||
| 72 | + this.addTime() | ||
| 73 | + this.visible = true | ||
| 74 | + }, | ||
| 75 | + resetForm() { | ||
| 76 | + this.formData = { | ||
| 77 | + name: '', | ||
| 78 | + remark: '', | ||
| 79 | + times: [] | ||
| 80 | + } | ||
| 81 | + this.$nextTick(() => { | ||
| 82 | + this.$refs.form && this.$refs.form.clearValidate() | ||
| 83 | + }) | ||
| 84 | + }, | ||
| 85 | + addTime() { | ||
| 86 | + this.formData.times.push({ | ||
| 87 | + id: getUuid(), | ||
| 88 | + startTime: '', | ||
| 89 | + endTime: '' | ||
| 90 | + }) | ||
| 91 | + }, | ||
| 92 | + removeTime(index) { | ||
| 93 | + this.formData.times.splice(index, 1) | ||
| 94 | + }, | ||
| 95 | + handleClose() { | ||
| 96 | + this.$refs.form.resetFields() | ||
| 97 | + }, | ||
| 98 | + async handleSubmit() { | ||
| 99 | + try { | ||
| 100 | + await this.$refs.form.validate() | ||
| 101 | + this.loading = true | ||
| 102 | + await saveClasses(this.formData) | ||
| 103 | + this.$message.success(this.$t('common.saveSuccess')) | ||
| 104 | + this.visible = false | ||
| 105 | + this.$emit('success') | ||
| 106 | + } catch (error) { | ||
| 107 | + if (error !== 'validate') { | ||
| 108 | + this.$message.error(error.message || this.$t('common.saveFailed')) | ||
| 109 | + } | ||
| 110 | + } finally { | ||
| 111 | + this.loading = false | ||
| 112 | + } | ||
| 113 | + } | ||
| 114 | + } | ||
| 115 | +} | ||
| 116 | +</script> | ||
| 0 | \ No newline at end of file | 117 | \ No newline at end of file |
src/components/org/addDataPrivilege.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <el-dialog | ||
| 3 | + :title="$t('dataPrivilege.addTitle')" | ||
| 4 | + :visible.sync="visible" | ||
| 5 | + width="50%" | ||
| 6 | + @close="handleClose"> | ||
| 7 | + <el-form ref="form" :model="form" :rules="rules" label-width="120px"> | ||
| 8 | + <el-form-item :label="$t('dataPrivilege.name')" prop="name"> | ||
| 9 | + <el-input | ||
| 10 | + v-model="form.name" | ||
| 11 | + :placeholder="$t('dataPrivilege.namePlaceholder')" /> | ||
| 12 | + </el-form-item> | ||
| 13 | + <el-form-item :label="$t('dataPrivilege.code')" prop="code"> | ||
| 14 | + <el-input | ||
| 15 | + v-model="form.code" | ||
| 16 | + :placeholder="$t('dataPrivilege.codePlaceholder')" /> | ||
| 17 | + </el-form-item> | ||
| 18 | + <el-form-item :label="$t('dataPrivilege.remark')" prop="remark"> | ||
| 19 | + <el-input | ||
| 20 | + v-model="form.remark" | ||
| 21 | + type="textarea" | ||
| 22 | + :placeholder="$t('dataPrivilege.remarkPlaceholder')" /> | ||
| 23 | + </el-form-item> | ||
| 24 | + </el-form> | ||
| 25 | + <div slot="footer" class="dialog-footer"> | ||
| 26 | + <el-button @click="visible = false">{{ $t('common.cancel') }}</el-button> | ||
| 27 | + <el-button type="primary" @click="handleSubmit">{{ $t('common.confirm') }}</el-button> | ||
| 28 | + </div> | ||
| 29 | + </el-dialog> | ||
| 30 | +</template> | ||
| 31 | + | ||
| 32 | +<script> | ||
| 33 | +import { saveDataPrivilege } from '@/api/org/dataPrivilegeManageApi' | ||
| 34 | +import { getCommunityId } from '@/api/community/communityApi' | ||
| 35 | + | ||
| 36 | +export default { | ||
| 37 | + name: 'AddDataPrivilege', | ||
| 38 | + data() { | ||
| 39 | + return { | ||
| 40 | + visible: false, | ||
| 41 | + form: { | ||
| 42 | + name: '', | ||
| 43 | + code: '', | ||
| 44 | + remark: '', | ||
| 45 | + communityId: '' | ||
| 46 | + }, | ||
| 47 | + rules: { | ||
| 48 | + name: [ | ||
| 49 | + { required: true, message: this.$t('dataPrivilege.nameRequired'), trigger: 'blur' }, | ||
| 50 | + { max: 50, message: this.$t('dataPrivilege.nameMaxLength'), trigger: 'blur' } | ||
| 51 | + ], | ||
| 52 | + code: [ | ||
| 53 | + { required: true, message: this.$t('dataPrivilege.codeRequired'), trigger: 'blur' }, | ||
| 54 | + { max: 30, message: this.$t('dataPrivilege.codeMaxLength'), trigger: 'blur' } | ||
| 55 | + ], | ||
| 56 | + remark: [ | ||
| 57 | + { required: true, message: this.$t('dataPrivilege.remarkRequired'), trigger: 'blur' }, | ||
| 58 | + { max: 256, message: this.$t('dataPrivilege.remarkMaxLength'), trigger: 'blur' } | ||
| 59 | + ] | ||
| 60 | + } | ||
| 61 | + } | ||
| 62 | + }, | ||
| 63 | + methods: { | ||
| 64 | + open() { | ||
| 65 | + this.form.communityId = getCommunityId() | ||
| 66 | + this.visible = true | ||
| 67 | + this.$nextTick(() => { | ||
| 68 | + this.$refs.form && this.$refs.form.resetFields() | ||
| 69 | + }) | ||
| 70 | + }, | ||
| 71 | + handleClose() { | ||
| 72 | + this.$refs.form.resetFields() | ||
| 73 | + }, | ||
| 74 | + handleSubmit() { | ||
| 75 | + this.$refs.form.validate(async valid => { | ||
| 76 | + if (valid) { | ||
| 77 | + try { | ||
| 78 | + await saveDataPrivilege(this.form) | ||
| 79 | + this.$message.success(this.$t('dataPrivilege.addSuccess')) | ||
| 80 | + this.visible = false | ||
| 81 | + this.$emit('success') | ||
| 82 | + } catch (error) { | ||
| 83 | + console.error('Failed to add data privilege:', error) | ||
| 84 | + } | ||
| 85 | + } | ||
| 86 | + }) | ||
| 87 | + } | ||
| 88 | + } | ||
| 89 | +} | ||
| 90 | +</script> | ||
| 0 | \ No newline at end of file | 91 | \ No newline at end of file |
src/components/org/addDataPrivilegeStaff.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <el-dialog :title="$t('dataPrivilege.staff')" :visible.sync="visible" width="70%" top="5vh" @close="handleClose"> | ||
| 3 | + <div class="search-bar"> | ||
| 4 | + <el-row :gutter="20"> | ||
| 5 | + <el-col :span="8"> | ||
| 6 | + <el-input v-model="searchForm.staffId" :placeholder="$t('dataPrivilege.inputStaffId')" clearable> | ||
| 7 | + </el-input> | ||
| 8 | + </el-col> | ||
| 9 | + <el-col :span="8"> | ||
| 10 | + <el-input v-model="searchForm.staffName" :placeholder="$t('dataPrivilege.inputStaffName')" clearable> | ||
| 11 | + </el-input> | ||
| 12 | + </el-col> | ||
| 13 | + <el-col :span="8"> | ||
| 14 | + <el-button type="primary" @click="handleSearch"> | ||
| 15 | + <i class="el-icon-search"></i>{{ $t('common.search') }} | ||
| 16 | + </el-button> | ||
| 17 | + <el-button @click="handleReset"> | ||
| 18 | + <i class="el-icon-refresh"></i>{{ $t('common.reset') }} | ||
| 19 | + </el-button> | ||
| 20 | + </el-col> | ||
| 21 | + </el-row> | ||
| 22 | + </div> | ||
| 23 | + | ||
| 24 | + <el-table :data="tableData" border style="width: 100%; margin-top: 15px" @selection-change="handleSelectionChange"> | ||
| 25 | + <el-table-column type="selection" width="55" align="center"> | ||
| 26 | + </el-table-column> | ||
| 27 | + <el-table-column prop="userId" :label="$t('dataPrivilege.staffId')" align="center"> | ||
| 28 | + </el-table-column> | ||
| 29 | + <el-table-column prop="name" :label="$t('dataPrivilege.staffName')" align="center"> | ||
| 30 | + </el-table-column> | ||
| 31 | + <el-table-column prop="address" :label="$t('dataPrivilege.staffAddress')" align="center"> | ||
| 32 | + </el-table-column> | ||
| 33 | + </el-table> | ||
| 34 | + | ||
| 35 | + <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" | ||
| 36 | + :current-page="pagination.current" :page-sizes="[10, 20, 30, 50]" :page-size="pagination.size" | ||
| 37 | + layout="total, sizes, prev, pager, next, jumper" :total="pagination.total"> | ||
| 38 | + </el-pagination> | ||
| 39 | + | ||
| 40 | + <div slot="footer" class="dialog-footer"> | ||
| 41 | + <el-button @click="visible = false">{{ $t('common.cancel') }}</el-button> | ||
| 42 | + <el-button type="primary" @click="handleSubmit" :disabled="selectedStaffs.length === 0"> | ||
| 43 | + {{ $t('common.submit') }} | ||
| 44 | + </el-button> | ||
| 45 | + </div> | ||
| 46 | + </el-dialog> | ||
| 47 | +</template> | ||
| 48 | + | ||
| 49 | +<script> | ||
| 50 | +import { listStaffNotInDataPrivilege, saveDataPrivilegeStaff } from '@/api/org/dataPrivilegeManageApi' | ||
| 51 | +import { getCommunityId } from '@/api/community/communityApi' | ||
| 52 | + | ||
| 53 | +export default { | ||
| 54 | + name: 'AddDataPrivilegeStaff', | ||
| 55 | + data() { | ||
| 56 | + return { | ||
| 57 | + visible: false, | ||
| 58 | + dpId: '', | ||
| 59 | + searchForm: { | ||
| 60 | + staffId: '', | ||
| 61 | + staffName: '' | ||
| 62 | + }, | ||
| 63 | + tableData: [], | ||
| 64 | + selectedStaffs: [], | ||
| 65 | + pagination: { | ||
| 66 | + current: 1, | ||
| 67 | + size: 10, | ||
| 68 | + total: 0 | ||
| 69 | + } | ||
| 70 | + } | ||
| 71 | + }, | ||
| 72 | + methods: { | ||
| 73 | + open(params) { | ||
| 74 | + this.dpId = params.dpId | ||
| 75 | + this.visible = true | ||
| 76 | + this.loadData() | ||
| 77 | + }, | ||
| 78 | + handleClose() { | ||
| 79 | + this.searchForm = { | ||
| 80 | + staffId: '', | ||
| 81 | + staffName: '' | ||
| 82 | + } | ||
| 83 | + this.selectedStaffs = [] | ||
| 84 | + }, | ||
| 85 | + async loadData() { | ||
| 86 | + try { | ||
| 87 | + const params = { | ||
| 88 | + page: this.pagination.current, | ||
| 89 | + row: this.pagination.size, | ||
| 90 | + dpId: this.dpId, | ||
| 91 | + staffId: this.searchForm.staffId, | ||
| 92 | + staffName: this.searchForm.staffName, | ||
| 93 | + communityId: getCommunityId() | ||
| 94 | + } | ||
| 95 | + const { data, total } = await listStaffNotInDataPrivilege(params) | ||
| 96 | + this.tableData = data | ||
| 97 | + this.pagination.total = total | ||
| 98 | + } catch (error) { | ||
| 99 | + console.error('Failed to load staffs:', error) | ||
| 100 | + } | ||
| 101 | + }, | ||
| 102 | + handleSearch() { | ||
| 103 | + this.pagination.current = 1 | ||
| 104 | + this.loadData() | ||
| 105 | + }, | ||
| 106 | + handleReset() { | ||
| 107 | + this.searchForm = { | ||
| 108 | + staffId: '', | ||
| 109 | + staffName: '' | ||
| 110 | + } | ||
| 111 | + this.pagination.current = 1 | ||
| 112 | + this.loadData() | ||
| 113 | + }, | ||
| 114 | + handleSelectionChange(val) { | ||
| 115 | + this.selectedStaffs = val | ||
| 116 | + }, | ||
| 117 | + handleSizeChange(val) { | ||
| 118 | + this.pagination.size = val | ||
| 119 | + this.loadData() | ||
| 120 | + }, | ||
| 121 | + handleCurrentChange(val) { | ||
| 122 | + this.pagination.current = val | ||
| 123 | + this.loadData() | ||
| 124 | + }, | ||
| 125 | + async handleSubmit() { | ||
| 126 | + try { | ||
| 127 | + const staffs = this.selectedStaffs.map(item => ({ | ||
| 128 | + staffId: item.userId, | ||
| 129 | + staffName: item.name | ||
| 130 | + })) | ||
| 131 | + | ||
| 132 | + await saveDataPrivilegeStaff({ | ||
| 133 | + dpId: this.dpId, | ||
| 134 | + staffs, | ||
| 135 | + communityId: getCommunityId() | ||
| 136 | + }) | ||
| 137 | + | ||
| 138 | + this.$message.success(this.$t('dataPrivilege.associateSuccess')) | ||
| 139 | + this.visible = false | ||
| 140 | + this.$emit('success') | ||
| 141 | + } catch (error) { | ||
| 142 | + console.error('Failed to associate staffs:', error) | ||
| 143 | + } | ||
| 144 | + } | ||
| 145 | + } | ||
| 146 | +} | ||
| 147 | +</script> | ||
| 148 | + | ||
| 149 | +<style scoped> | ||
| 150 | +.search-bar { | ||
| 151 | + margin-bottom: 15px; | ||
| 152 | +} | ||
| 153 | + | ||
| 154 | +.dialog-footer { | ||
| 155 | + text-align: right; | ||
| 156 | +} | ||
| 157 | +</style> | ||
| 0 | \ No newline at end of file | 158 | \ No newline at end of file |
src/components/org/addDataPrivilegeUnit.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <el-dialog :title="$t('dataPrivilege.buildingUnit')" :visible.sync="visible" width="70%" top="5vh" | ||
| 3 | + @close="handleClose"> | ||
| 4 | + <div class="search-bar"> | ||
| 5 | + <el-row :gutter="20"> | ||
| 6 | + <el-col :span="8"> | ||
| 7 | + <el-input v-model="searchForm.floorNum" :placeholder="$t('dataPrivilege.inputBuildingNum')" clearable> | ||
| 8 | + </el-input> | ||
| 9 | + </el-col> | ||
| 10 | + <el-col :span="8"> | ||
| 11 | + <el-input v-model="searchForm.unitNum" :placeholder="$t('dataPrivilege.inputUnitNum')" clearable> | ||
| 12 | + </el-input> | ||
| 13 | + </el-col> | ||
| 14 | + <el-col :span="8"> | ||
| 15 | + <el-button type="primary" @click="handleSearch"> | ||
| 16 | + <i class="el-icon-search"></i>{{ $t('common.search') }} | ||
| 17 | + </el-button> | ||
| 18 | + <el-button @click="handleReset"> | ||
| 19 | + <i class="el-icon-refresh"></i>{{ $t('common.reset') }} | ||
| 20 | + </el-button> | ||
| 21 | + </el-col> | ||
| 22 | + </el-row> | ||
| 23 | + </div> | ||
| 24 | + | ||
| 25 | + <el-table :data="tableData" border style="width: 100%; margin-top: 15px" @selection-change="handleSelectionChange"> | ||
| 26 | + <el-table-column type="selection" width="55" align="center"> | ||
| 27 | + </el-table-column> | ||
| 28 | + <el-table-column prop="floorNum" :label="$t('dataPrivilege.buildingNum')" align="center"> | ||
| 29 | + </el-table-column> | ||
| 30 | + <el-table-column prop="unitNum" :label="$t('dataPrivilege.unitNum')" align="center"> | ||
| 31 | + </el-table-column> | ||
| 32 | + </el-table> | ||
| 33 | + | ||
| 34 | + <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" | ||
| 35 | + :current-page="pagination.current" :page-sizes="[10, 20, 30, 50]" :page-size="pagination.size" | ||
| 36 | + layout="total, sizes, prev, pager, next, jumper" :total="pagination.total"> | ||
| 37 | + </el-pagination> | ||
| 38 | + | ||
| 39 | + <div slot="footer" class="dialog-footer"> | ||
| 40 | + <el-button @click="visible = false">{{ $t('common.cancel') }}</el-button> | ||
| 41 | + <el-button type="primary" @click="handleSubmit" :disabled="selectedUnits.length === 0"> | ||
| 42 | + {{ $t('common.submit') }} | ||
| 43 | + </el-button> | ||
| 44 | + </div> | ||
| 45 | + </el-dialog> | ||
| 46 | +</template> | ||
| 47 | + | ||
| 48 | +<script> | ||
| 49 | +import { listUnitsNotInDataPrivilege, saveDataPrivilegeUnit } from '@/api/org/dataPrivilegeManageApi' | ||
| 50 | +import { getCommunityId } from '@/api/community/communityApi' | ||
| 51 | + | ||
| 52 | +export default { | ||
| 53 | + name: 'AddDataPrivilegeUnit', | ||
| 54 | + data() { | ||
| 55 | + return { | ||
| 56 | + visible: false, | ||
| 57 | + dpId: '', | ||
| 58 | + searchForm: { | ||
| 59 | + floorNum: '', | ||
| 60 | + unitNum: '' | ||
| 61 | + }, | ||
| 62 | + tableData: [], | ||
| 63 | + selectedUnits: [], | ||
| 64 | + pagination: { | ||
| 65 | + current: 1, | ||
| 66 | + size: 10, | ||
| 67 | + total: 0 | ||
| 68 | + } | ||
| 69 | + } | ||
| 70 | + }, | ||
| 71 | + methods: { | ||
| 72 | + open(params) { | ||
| 73 | + this.dpId = params.dpId | ||
| 74 | + this.visible = true | ||
| 75 | + this.loadData() | ||
| 76 | + }, | ||
| 77 | + handleClose() { | ||
| 78 | + this.searchForm = { | ||
| 79 | + floorNum: '', | ||
| 80 | + unitNum: '' | ||
| 81 | + } | ||
| 82 | + this.selectedUnits = [] | ||
| 83 | + }, | ||
| 84 | + async loadData() { | ||
| 85 | + try { | ||
| 86 | + const params = { | ||
| 87 | + page: this.pagination.current, | ||
| 88 | + row: this.pagination.size, | ||
| 89 | + dpId: this.dpId, | ||
| 90 | + floorNum: this.searchForm.floorNum, | ||
| 91 | + unitNum: this.searchForm.unitNum, | ||
| 92 | + communityId: getCommunityId() | ||
| 93 | + } | ||
| 94 | + const { data, total } = await listUnitsNotInDataPrivilege(params) | ||
| 95 | + this.tableData = data | ||
| 96 | + this.pagination.total = total | ||
| 97 | + } catch (error) { | ||
| 98 | + console.error('Failed to load units:', error) | ||
| 99 | + } | ||
| 100 | + }, | ||
| 101 | + handleSearch() { | ||
| 102 | + this.pagination.current = 1 | ||
| 103 | + this.loadData() | ||
| 104 | + }, | ||
| 105 | + handleReset() { | ||
| 106 | + this.searchForm = { | ||
| 107 | + floorNum: '', | ||
| 108 | + unitNum: '' | ||
| 109 | + } | ||
| 110 | + this.pagination.current = 1 | ||
| 111 | + this.loadData() | ||
| 112 | + }, | ||
| 113 | + handleSelectionChange(val) { | ||
| 114 | + this.selectedUnits = val | ||
| 115 | + }, | ||
| 116 | + handleSizeChange(val) { | ||
| 117 | + this.pagination.size = val | ||
| 118 | + this.loadData() | ||
| 119 | + }, | ||
| 120 | + handleCurrentChange(val) { | ||
| 121 | + this.pagination.current = val | ||
| 122 | + this.loadData() | ||
| 123 | + }, | ||
| 124 | + async handleSubmit() { | ||
| 125 | + try { | ||
| 126 | + const units = this.selectedUnits.map(item => ({ | ||
| 127 | + unitId: item.unitId, | ||
| 128 | + unitNum: item.unitNum, | ||
| 129 | + floorId: item.floorId, | ||
| 130 | + floorNum: item.floorNum | ||
| 131 | + })) | ||
| 132 | + | ||
| 133 | + await saveDataPrivilegeUnit({ | ||
| 134 | + dpId: this.dpId, | ||
| 135 | + units, | ||
| 136 | + communityId: getCommunityId() | ||
| 137 | + }) | ||
| 138 | + | ||
| 139 | + this.$message.success(this.$t('dataPrivilege.associateSuccess')) | ||
| 140 | + this.visible = false | ||
| 141 | + this.$emit('success') | ||
| 142 | + } catch (error) { | ||
| 143 | + console.error('Failed to associate units:', error) | ||
| 144 | + } | ||
| 145 | + } | ||
| 146 | + } | ||
| 147 | +} | ||
| 148 | +</script> | ||
| 149 | + | ||
| 150 | +<style scoped> | ||
| 151 | +.search-bar { | ||
| 152 | + margin-bottom: 15px; | ||
| 153 | +} | ||
| 154 | + | ||
| 155 | +.dialog-footer { | ||
| 156 | + text-align: right; | ||
| 157 | +} | ||
| 158 | +</style> | ||
| 0 | \ No newline at end of file | 159 | \ No newline at end of file |
src/components/org/classesState.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <el-dialog | ||
| 3 | + :title="$t('classesManage.state.title')" | ||
| 4 | + :visible.sync="visible" | ||
| 5 | + width="30%" | ||
| 6 | + @close="handleClose" | ||
| 7 | + > | ||
| 8 | + <div class="state-content"> | ||
| 9 | + <el-alert | ||
| 10 | + :type="formData.state === '1001' ? 'success' : 'warning'" | ||
| 11 | + :title=" | ||
| 12 | + $t('classesManage.state.confirmMessage', { | ||
| 13 | + action: formData.stateName, | ||
| 14 | + name: $t('classesManage.state.classes') | ||
| 15 | + }) | ||
| 16 | + " | ||
| 17 | + :closable="false" | ||
| 18 | + show-icon | ||
| 19 | + /> | ||
| 20 | + </div> | ||
| 21 | + <div slot="footer" class="dialog-footer"> | ||
| 22 | + <el-button @click="visible = false"> | ||
| 23 | + {{ $t('common.cancel') }} | ||
| 24 | + </el-button> | ||
| 25 | + <el-button | ||
| 26 | + :type="formData.state === '1001' ? 'success' : 'warning'" | ||
| 27 | + @click="handleConfirm" | ||
| 28 | + :loading="loading" | ||
| 29 | + > | ||
| 30 | + {{ $t('common.confirm') }} | ||
| 31 | + </el-button> | ||
| 32 | + </div> | ||
| 33 | + </el-dialog> | ||
| 34 | +</template> | ||
| 35 | + | ||
| 36 | +<script> | ||
| 37 | +import { updateClassesState } from '@/api/org/classesManageApi' | ||
| 38 | + | ||
| 39 | +export default { | ||
| 40 | + name: 'ClassesState', | ||
| 41 | + data() { | ||
| 42 | + return { | ||
| 43 | + visible: false, | ||
| 44 | + loading: false, | ||
| 45 | + formData: { | ||
| 46 | + classesId: '', | ||
| 47 | + stateName: '', | ||
| 48 | + state: '' | ||
| 49 | + } | ||
| 50 | + } | ||
| 51 | + }, | ||
| 52 | + methods: { | ||
| 53 | + open(data) { | ||
| 54 | + this.formData = { | ||
| 55 | + classesId: data.classesId, | ||
| 56 | + stateName: data.stateName, | ||
| 57 | + state: data.state | ||
| 58 | + } | ||
| 59 | + this.visible = true | ||
| 60 | + }, | ||
| 61 | + handleClose() { | ||
| 62 | + this.formData = { | ||
| 63 | + classesId: '', | ||
| 64 | + stateName: '', | ||
| 65 | + state: '' | ||
| 66 | + } | ||
| 67 | + }, | ||
| 68 | + async handleConfirm() { | ||
| 69 | + try { | ||
| 70 | + this.loading = true | ||
| 71 | + await updateClassesState(this.formData) | ||
| 72 | + this.$message.success( | ||
| 73 | + this.$t('classesManage.state.successMessage', { | ||
| 74 | + action: this.formData.stateName | ||
| 75 | + }) | ||
| 76 | + ) | ||
| 77 | + this.visible = false | ||
| 78 | + this.$emit('success') | ||
| 79 | + } catch (error) { | ||
| 80 | + this.$message.error(error.message || this.$t('common.operationFailed')) | ||
| 81 | + } finally { | ||
| 82 | + this.loading = false | ||
| 83 | + } | ||
| 84 | + } | ||
| 85 | + } | ||
| 86 | +} | ||
| 87 | +</script> | ||
| 88 | + | ||
| 89 | +<style scoped> | ||
| 90 | +.state-content { | ||
| 91 | + margin-bottom: 20px; | ||
| 92 | +} | ||
| 93 | +</style> | ||
| 0 | \ No newline at end of file | 94 | \ No newline at end of file |
src/components/org/dataPrivilegeDiv.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div> | ||
| 3 | + | ||
| 4 | + <el-card class="box-card"> | ||
| 5 | + <div class="button-group"> | ||
| 6 | + <el-button type="primary" size="small" @click="handleAdd"> | ||
| 7 | + <i class="el-icon-plus"></i>{{ $t('dataPrivilege.add') }} | ||
| 8 | + </el-button> | ||
| 9 | + <el-button type="primary" size="small" @click="handleEdit" :disabled="!currentDataPrivilege.dpId"> | ||
| 10 | + <i class="el-icon-edit"></i>{{ $t('dataPrivilege.edit') }} | ||
| 11 | + </el-button> | ||
| 12 | + <el-button type="primary" size="small" @click="handleDelete" :disabled="!currentDataPrivilege.dpId"> | ||
| 13 | + <i class="el-icon-delete"></i>{{ $t('dataPrivilege.delete') }} | ||
| 14 | + </el-button> | ||
| 15 | + </div> | ||
| 16 | + | ||
| 17 | + <div class="data-privilege-list"> | ||
| 18 | + <ul> | ||
| 19 | + <li v-for="(item, index) in dataPrivileges" :key="index" | ||
| 20 | + :class="{ active: item.dpId === currentDataPrivilege.dpId }" @click="handleSelect(item)"> | ||
| 21 | + {{ item.name }} | ||
| 22 | + </li> | ||
| 23 | + </ul> | ||
| 24 | + </div> | ||
| 25 | + </el-card> | ||
| 26 | + <!-- 添加数据权限对话框 --> | ||
| 27 | + <add-data-privilege ref="addDataPrivilege" @success="handleRefresh" /> | ||
| 28 | + <!-- 编辑数据权限对话框 --> | ||
| 29 | + <edit-data-privilege ref="editDataPrivilege" @success="handleRefresh" /> | ||
| 30 | + <!-- 删除数据权限对话框 --> | ||
| 31 | + <delete-data-privilege ref="deleteDataPrivilege" @success="handleRefresh" /> | ||
| 32 | + </div> | ||
| 33 | +</template> | ||
| 34 | + | ||
| 35 | +<script> | ||
| 36 | +import { listDataPrivilege } from '@/api/org/dataPrivilegeManageApi' | ||
| 37 | +import { getCommunityId } from '@/api/community/communityApi' | ||
| 38 | +import AddDataPrivilege from '@/components/org/addDataPrivilege' | ||
| 39 | +import EditDataPrivilege from '@/components/org/editDataPrivilege' | ||
| 40 | +import DeleteDataPrivilege from '@/components/org/deleteDataPrivilege' | ||
| 41 | +export default { | ||
| 42 | + name: 'DataPrivilegeDiv', | ||
| 43 | + components: { | ||
| 44 | + AddDataPrivilege, | ||
| 45 | + EditDataPrivilege, | ||
| 46 | + DeleteDataPrivilege | ||
| 47 | + }, | ||
| 48 | + data() { | ||
| 49 | + return { | ||
| 50 | + dataPrivileges: [], | ||
| 51 | + currentDataPrivilege: {}, | ||
| 52 | + communityId: '' | ||
| 53 | + } | ||
| 54 | + }, | ||
| 55 | + created() { | ||
| 56 | + this.communityId = getCommunityId() | ||
| 57 | + this.loadData() | ||
| 58 | + }, | ||
| 59 | + methods: { | ||
| 60 | + handleRefresh() { | ||
| 61 | + this.loadData() | ||
| 62 | + }, | ||
| 63 | + async loadData() { | ||
| 64 | + try { | ||
| 65 | + const params = { | ||
| 66 | + page: 1, | ||
| 67 | + row: 100, | ||
| 68 | + communityId: this.communityId | ||
| 69 | + } | ||
| 70 | + const { data } = await listDataPrivilege(params) | ||
| 71 | + this.dataPrivileges = data | ||
| 72 | + if (data.length > 0) { | ||
| 73 | + this.currentDataPrivilege = data[0] | ||
| 74 | + this.$emit('switch-data-privilege', data[0]) | ||
| 75 | + } | ||
| 76 | + } catch (error) { | ||
| 77 | + console.error('Failed to load data privileges:', error) | ||
| 78 | + } | ||
| 79 | + }, | ||
| 80 | + handleSelect(item) { | ||
| 81 | + this.currentDataPrivilege = item | ||
| 82 | + this.$emit('switch-data-privilege', item) | ||
| 83 | + }, | ||
| 84 | + handleAdd() { | ||
| 85 | + this.$refs.addDataPrivilege.open() | ||
| 86 | + }, | ||
| 87 | + handleEdit() { | ||
| 88 | + this.$refs.editDataPrivilege.open(this.currentDataPrivilege) | ||
| 89 | + }, | ||
| 90 | + handleDelete() { | ||
| 91 | + this.$refs.deleteDataPrivilege.open(this.currentDataPrivilege) | ||
| 92 | + } | ||
| 93 | + } | ||
| 94 | +} | ||
| 95 | +</script> | ||
| 96 | + | ||
| 97 | +<style lang="scss" scoped> | ||
| 98 | +.box-card { | ||
| 99 | + height: 100%; | ||
| 100 | + | ||
| 101 | + .button-group { | ||
| 102 | + margin-bottom: 15px; | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + .data-privilege-list { | ||
| 106 | + ul { | ||
| 107 | + list-style: none; | ||
| 108 | + padding: 0; | ||
| 109 | + margin: 0; | ||
| 110 | + | ||
| 111 | + li { | ||
| 112 | + padding: 10px; | ||
| 113 | + cursor: pointer; | ||
| 114 | + border-bottom: 1px solid #eee; | ||
| 115 | + transition: all 0.3s; | ||
| 116 | + | ||
| 117 | + &:hover { | ||
| 118 | + background-color: #f5f5f5; | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + &.active { | ||
| 122 | + background-color: #e6f7ff; | ||
| 123 | + color: #1890ff; | ||
| 124 | + } | ||
| 125 | + } | ||
| 126 | + } | ||
| 127 | + } | ||
| 128 | +} | ||
| 129 | +</style> | ||
| 0 | \ No newline at end of file | 130 | \ No newline at end of file |
src/components/org/dataPrivilegeStaff.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div class="data-privilege-staff"> | ||
| 3 | + | ||
| 4 | + <el-form :inline="true" :model="searchForm"> | ||
| 5 | + <el-form-item :label="$t('dataPrivilege.staffName')"> | ||
| 6 | + <el-input v-model="searchForm.staffName" :placeholder="$t('dataPrivilege.inputStaffName')" clearable> | ||
| 7 | + </el-input> | ||
| 8 | + </el-form-item> | ||
| 9 | + <el-form-item :label="$t('dataPrivilege.phone')"> | ||
| 10 | + <el-input v-model="searchForm.tel" :placeholder="$t('dataPrivilege.inputPhone')" clearable> | ||
| 11 | + </el-input> | ||
| 12 | + </el-form-item> | ||
| 13 | + <el-form-item> | ||
| 14 | + <el-button type="primary" @click="handleSearch"> | ||
| 15 | + <i class="el-icon-search"></i>{{ $t('common.search') }} | ||
| 16 | + </el-button> | ||
| 17 | + <el-button @click="handleReset"> | ||
| 18 | + <i class="el-icon-refresh"></i>{{ $t('common.reset') }} | ||
| 19 | + </el-button> | ||
| 20 | + <el-button type="primary" @click="handleAdd"> | ||
| 21 | + <i class="el-icon-plus"></i>{{ $t('dataPrivilege.associateStaff') }} | ||
| 22 | + </el-button> | ||
| 23 | + </el-form-item> | ||
| 24 | + </el-form> | ||
| 25 | + | ||
| 26 | + | ||
| 27 | + <el-table :data="tableData" border style="width: 100%" v-loading="loading"> | ||
| 28 | + <el-table-column prop="staffName" :label="$t('dataPrivilege.name')" align="center"> | ||
| 29 | + </el-table-column> | ||
| 30 | + <el-table-column prop="tel" :label="$t('dataPrivilege.phone')" align="center"> | ||
| 31 | + </el-table-column> | ||
| 32 | + <el-table-column prop="email" :label="$t('dataPrivilege.email')" align="center"> | ||
| 33 | + </el-table-column> | ||
| 34 | + <el-table-column prop="address" :label="$t('dataPrivilege.address')" align="center"> | ||
| 35 | + </el-table-column> | ||
| 36 | + <el-table-column :label="$t('dataPrivilege.gender')" align="center"> | ||
| 37 | + <template slot-scope="scope"> | ||
| 38 | + {{ scope.row.sex === 0 ? $t('dataPrivilege.male') : $t('dataPrivilege.female') }} | ||
| 39 | + </template> | ||
| 40 | + </el-table-column> | ||
| 41 | + <el-table-column :label="$t('common.operation')" align="center" width="200"> | ||
| 42 | + <template slot-scope="scope"> | ||
| 43 | + <el-button size="mini" type="danger" @click="handleDelete(scope.row)"> | ||
| 44 | + {{ $t('common.delete') }} | ||
| 45 | + </el-button> | ||
| 46 | + <el-button size="mini" type="primary" @click="handleDetail(scope.row)"> | ||
| 47 | + {{ $t('common.detail') }} | ||
| 48 | + </el-button> | ||
| 49 | + </template> | ||
| 50 | + </el-table-column> | ||
| 51 | + </el-table> | ||
| 52 | + | ||
| 53 | + <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" | ||
| 54 | + :current-page="pagination.current" :page-sizes="[10, 20, 30, 50]" :page-size="pagination.size" | ||
| 55 | + layout="total, sizes, prev, pager, next, jumper" :total="pagination.total"> | ||
| 56 | + </el-pagination> | ||
| 57 | + | ||
| 58 | + <add-data-privilege-staff ref="addDataPrivilegeStaff" @success="loadData" /> | ||
| 59 | + <delete-data-privilege-staff ref="deleteDataPrivilegeStaff" @success="loadData" /> | ||
| 60 | + </div> | ||
| 61 | +</template> | ||
| 62 | + | ||
| 63 | +<script> | ||
| 64 | +import { listDataPrivilegeStaff } from '@/api/org/dataPrivilegeManageApi' | ||
| 65 | +import AddDataPrivilegeStaff from '@/components/org/addDataPrivilegeStaff' | ||
| 66 | +import DeleteDataPrivilegeStaff from '@/components/org/deleteDataPrivilegeStaff' | ||
| 67 | + | ||
| 68 | +export default { | ||
| 69 | + name: 'DataPrivilegeStaff', | ||
| 70 | + components: { | ||
| 71 | + AddDataPrivilegeStaff, | ||
| 72 | + DeleteDataPrivilegeStaff | ||
| 73 | + }, | ||
| 74 | + data() { | ||
| 75 | + return { | ||
| 76 | + dpId: '', | ||
| 77 | + loading: false, | ||
| 78 | + searchForm: { | ||
| 79 | + staffName: '', | ||
| 80 | + tel: '' | ||
| 81 | + }, | ||
| 82 | + tableData: [], | ||
| 83 | + pagination: { | ||
| 84 | + current: 1, | ||
| 85 | + size: 10, | ||
| 86 | + total: 0 | ||
| 87 | + } | ||
| 88 | + } | ||
| 89 | + }, | ||
| 90 | + created() { | ||
| 91 | + }, | ||
| 92 | + methods: { | ||
| 93 | + open(dpId) { | ||
| 94 | + this.dpId = dpId | ||
| 95 | + this.loadData() | ||
| 96 | + }, | ||
| 97 | + async loadData() { | ||
| 98 | + this.loading = true | ||
| 99 | + try { | ||
| 100 | + const params = { | ||
| 101 | + page: this.pagination.current, | ||
| 102 | + row: this.pagination.size, | ||
| 103 | + dpId: this.dpId, | ||
| 104 | + staffName: this.searchForm.staffName, | ||
| 105 | + tel: this.searchForm.tel | ||
| 106 | + } | ||
| 107 | + const { data, total } = await listDataPrivilegeStaff(params) | ||
| 108 | + this.tableData = data | ||
| 109 | + this.pagination.total = total | ||
| 110 | + } catch (error) { | ||
| 111 | + console.error('Failed to load data privilege staff:', error) | ||
| 112 | + } finally { | ||
| 113 | + this.loading = false | ||
| 114 | + } | ||
| 115 | + }, | ||
| 116 | + handleSearch() { | ||
| 117 | + this.pagination.current = 1 | ||
| 118 | + this.loadData(this.dpId) | ||
| 119 | + }, | ||
| 120 | + handleReset() { | ||
| 121 | + this.searchForm = { | ||
| 122 | + staffName: '', | ||
| 123 | + tel: '' | ||
| 124 | + } | ||
| 125 | + this.pagination.current = 1 | ||
| 126 | + this.loadData(this.dpId) | ||
| 127 | + }, | ||
| 128 | + handleAdd() { | ||
| 129 | + this.$refs.addDataPrivilegeStaff.open({ dpId: this.dpId }) | ||
| 130 | + }, | ||
| 131 | + handleDelete(row) { | ||
| 132 | + this.$refs.deleteDataPrivilegeStaff.open(row) | ||
| 133 | + }, | ||
| 134 | + handleDetail(row) { | ||
| 135 | + this.$router.push(`/staff/detail/${row.staffId}`) | ||
| 136 | + }, | ||
| 137 | + handleSizeChange(val) { | ||
| 138 | + this.pagination.size = val | ||
| 139 | + this.loadData(this.dpId) | ||
| 140 | + }, | ||
| 141 | + handleCurrentChange(val) { | ||
| 142 | + this.pagination.current = val | ||
| 143 | + this.loadData(this.dpId) | ||
| 144 | + } | ||
| 145 | + }, | ||
| 146 | + | ||
| 147 | +} | ||
| 148 | +</script> | ||
| 149 | + | ||
| 150 | +<style scoped> | ||
| 151 | +.data-privilege-staff { | ||
| 152 | + padding: 20px; | ||
| 153 | +} | ||
| 154 | + | ||
| 155 | +.search-card { | ||
| 156 | + margin-bottom: 20px; | ||
| 157 | +} | ||
| 158 | + | ||
| 159 | +.el-pagination { | ||
| 160 | + margin-top: 15px; | ||
| 161 | + text-align: right; | ||
| 162 | +} | ||
| 163 | +</style> | ||
| 0 | \ No newline at end of file | 164 | \ No newline at end of file |
src/components/org/dataPrivilegeUnit.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div class="data-privilege-unit"> | ||
| 3 | + <div class="action-bar text-right"> | ||
| 4 | + <el-button type="primary" size="small" @click="handleAdd"> | ||
| 5 | + <i class="el-icon-plus"></i>{{ $t('dataPrivilege.associateUnit') }} | ||
| 6 | + </el-button> | ||
| 7 | + </div> | ||
| 8 | + | ||
| 9 | + <el-table :data="tableData" border style="width: 100%" v-loading="loading"> | ||
| 10 | + <el-table-column prop="floorNum" :label="$t('dataPrivilege.building')" align="center"> | ||
| 11 | + </el-table-column> | ||
| 12 | + <el-table-column prop="unitNum" :label="$t('dataPrivilege.unit')" align="center"> | ||
| 13 | + </el-table-column> | ||
| 14 | + <el-table-column :label="$t('common.operation')" align="center" width="150"> | ||
| 15 | + <template slot-scope="scope"> | ||
| 16 | + <el-button size="mini" type="danger" @click="handleDelete(scope.row)"> | ||
| 17 | + {{ $t('common.delete') }} | ||
| 18 | + </el-button> | ||
| 19 | + </template> | ||
| 20 | + </el-table-column> | ||
| 21 | + </el-table> | ||
| 22 | + | ||
| 23 | + <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" | ||
| 24 | + :current-page="pagination.current" :page-sizes="[10, 20, 30, 50]" :page-size="pagination.size" | ||
| 25 | + layout="total, sizes, prev, pager, next, jumper" :total="pagination.total"> | ||
| 26 | + </el-pagination> | ||
| 27 | + | ||
| 28 | + <add-data-privilege-unit ref="addDataPrivilegeUnit" @success="loadData" /> | ||
| 29 | + <delete-data-privilege-unit ref="deleteDataPrivilegeUnit" @success="loadData" /> | ||
| 30 | + </div> | ||
| 31 | +</template> | ||
| 32 | + | ||
| 33 | +<script> | ||
| 34 | +import { listDataPrivilegeUnit } from '@/api/org/dataPrivilegeManageApi' | ||
| 35 | +import AddDataPrivilegeUnit from '@/components/org/addDataPrivilegeUnit' | ||
| 36 | +import DeleteDataPrivilegeUnit from '@/components/org/deleteDataPrivilegeUnit' | ||
| 37 | + | ||
| 38 | +export default { | ||
| 39 | + name: 'DataPrivilegeUnit', | ||
| 40 | + components: { | ||
| 41 | + AddDataPrivilegeUnit, | ||
| 42 | + DeleteDataPrivilegeUnit | ||
| 43 | + }, | ||
| 44 | + data() { | ||
| 45 | + return { | ||
| 46 | + dpId: '', | ||
| 47 | + loading: false, | ||
| 48 | + tableData: [], | ||
| 49 | + pagination: { | ||
| 50 | + current: 1, | ||
| 51 | + size: 10, | ||
| 52 | + total: 0 | ||
| 53 | + } | ||
| 54 | + } | ||
| 55 | + }, | ||
| 56 | + created() { | ||
| 57 | + | ||
| 58 | + }, | ||
| 59 | + methods: { | ||
| 60 | + open(dpId) { | ||
| 61 | + this.dpId = dpId | ||
| 62 | + this.loadData() | ||
| 63 | + }, | ||
| 64 | + async loadData() { | ||
| 65 | + this.loading = true | ||
| 66 | + try { | ||
| 67 | + const params = { | ||
| 68 | + page: this.pagination.current, | ||
| 69 | + row: this.pagination.size, | ||
| 70 | + dpId: this.dpId | ||
| 71 | + } | ||
| 72 | + const { data, total } = await listDataPrivilegeUnit(params) | ||
| 73 | + this.tableData = data | ||
| 74 | + this.pagination.total = total | ||
| 75 | + } catch (error) { | ||
| 76 | + console.error('Failed to load data privilege units:', error) | ||
| 77 | + } finally { | ||
| 78 | + this.loading = false | ||
| 79 | + } | ||
| 80 | + }, | ||
| 81 | + handleAdd() { | ||
| 82 | + this.$refs.addDataPrivilegeUnit.open({ dpId: this.dpId }) | ||
| 83 | + }, | ||
| 84 | + handleDelete(row) { | ||
| 85 | + this.$refs.deleteDataPrivilegeUnit.open(row) | ||
| 86 | + }, | ||
| 87 | + handleSizeChange(val) { | ||
| 88 | + this.pagination.size = val | ||
| 89 | + this.loadData(this.dpId) | ||
| 90 | + }, | ||
| 91 | + handleCurrentChange(val) { | ||
| 92 | + this.pagination.current = val | ||
| 93 | + this.loadData(this.dpId) | ||
| 94 | + } | ||
| 95 | + }, | ||
| 96 | +} | ||
| 97 | +</script> | ||
| 98 | + | ||
| 99 | +<style scoped> | ||
| 100 | +.data-privilege-unit { | ||
| 101 | + padding: 20px; | ||
| 102 | +} | ||
| 103 | + | ||
| 104 | +.action-bar { | ||
| 105 | + margin-bottom: 15px; | ||
| 106 | +} | ||
| 107 | +</style> | ||
| 0 | \ No newline at end of file | 108 | \ No newline at end of file |
src/components/org/deleteClasses.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <el-dialog | ||
| 3 | + :title="$t('classesManage.delete.title')" | ||
| 4 | + :visible.sync="visible" | ||
| 5 | + width="30%" | ||
| 6 | + @close="handleClose" | ||
| 7 | + > | ||
| 8 | + <div class="delete-content"> | ||
| 9 | + <el-alert | ||
| 10 | + type="warning" | ||
| 11 | + :title="$t('classesManage.delete.confirmMessage')" | ||
| 12 | + :closable="false" | ||
| 13 | + show-icon | ||
| 14 | + /> | ||
| 15 | + </div> | ||
| 16 | + <div slot="footer" class="dialog-footer"> | ||
| 17 | + <el-button @click="visible = false"> | ||
| 18 | + {{ $t('common.cancel') }} | ||
| 19 | + </el-button> | ||
| 20 | + <el-button type="danger" @click="handleConfirm" :loading="loading"> | ||
| 21 | + {{ $t('common.confirmDelete') }} | ||
| 22 | + </el-button> | ||
| 23 | + </div> | ||
| 24 | + </el-dialog> | ||
| 25 | +</template> | ||
| 26 | + | ||
| 27 | +<script> | ||
| 28 | +import { deleteClasses } from '@/api/org/classesManageApi' | ||
| 29 | + | ||
| 30 | +export default { | ||
| 31 | + name: 'DeleteClasses', | ||
| 32 | + data() { | ||
| 33 | + return { | ||
| 34 | + visible: false, | ||
| 35 | + loading: false, | ||
| 36 | + classesId: '' | ||
| 37 | + } | ||
| 38 | + }, | ||
| 39 | + methods: { | ||
| 40 | + open(data) { | ||
| 41 | + this.classesId = data.classesId | ||
| 42 | + this.visible = true | ||
| 43 | + }, | ||
| 44 | + handleClose() { | ||
| 45 | + this.classesId = '' | ||
| 46 | + }, | ||
| 47 | + async handleConfirm() { | ||
| 48 | + try { | ||
| 49 | + this.loading = true | ||
| 50 | + await deleteClasses({ classesId: this.classesId }) | ||
| 51 | + this.$message.success(this.$t('common.deleteSuccess')) | ||
| 52 | + this.visible = false | ||
| 53 | + this.$emit('success') | ||
| 54 | + } catch (error) { | ||
| 55 | + this.$message.error(error.message || this.$t('common.deleteFailed')) | ||
| 56 | + } finally { | ||
| 57 | + this.loading = false | ||
| 58 | + } | ||
| 59 | + } | ||
| 60 | + } | ||
| 61 | +} | ||
| 62 | +</script> | ||
| 63 | + | ||
| 64 | +<style scoped> | ||
| 65 | +.delete-content { | ||
| 66 | + margin-bottom: 20px; | ||
| 67 | +} | ||
| 68 | +</style> | ||
| 0 | \ No newline at end of file | 69 | \ No newline at end of file |
src/components/org/deleteDataPrivilege.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <el-dialog | ||
| 3 | + :title="$t('dataPrivilege.deleteTitle')" | ||
| 4 | + :visible.sync="visible" | ||
| 5 | + width="30%" | ||
| 6 | + center> | ||
| 7 | + <div class="delete-content"> | ||
| 8 | + <p>{{ $t('dataPrivilege.deleteConfirm') }}</p> | ||
| 9 | + </div> | ||
| 10 | + <div slot="footer" class="dialog-footer"> | ||
| 11 | + <el-button @click="visible = false">{{ $t('common.cancel') }}</el-button> | ||
| 12 | + <el-button type="danger" @click="handleConfirm">{{ $t('common.confirm') }}</el-button> | ||
| 13 | + </div> | ||
| 14 | + </el-dialog> | ||
| 15 | +</template> | ||
| 16 | + | ||
| 17 | +<script> | ||
| 18 | +import { deleteDataPrivilege } from '@/api/org/dataPrivilegeManageApi' | ||
| 19 | +import { getCommunityId } from '@/api/community/communityApi' | ||
| 20 | + | ||
| 21 | +export default { | ||
| 22 | + name: 'DeleteDataPrivilege', | ||
| 23 | + data() { | ||
| 24 | + return { | ||
| 25 | + visible: false, | ||
| 26 | + dpId: '', | ||
| 27 | + communityId: '' | ||
| 28 | + } | ||
| 29 | + }, | ||
| 30 | + methods: { | ||
| 31 | + open(data) { | ||
| 32 | + this.dpId = data.dpId | ||
| 33 | + this.communityId = getCommunityId() | ||
| 34 | + this.visible = true | ||
| 35 | + }, | ||
| 36 | + async handleConfirm() { | ||
| 37 | + try { | ||
| 38 | + await deleteDataPrivilege({ | ||
| 39 | + dpId: this.dpId, | ||
| 40 | + communityId: this.communityId | ||
| 41 | + }) | ||
| 42 | + this.$message.success(this.$t('dataPrivilege.deleteSuccess')) | ||
| 43 | + this.visible = false | ||
| 44 | + this.$emit('success') | ||
| 45 | + } catch (error) { | ||
| 46 | + console.error('Failed to delete data privilege:', error) | ||
| 47 | + } | ||
| 48 | + } | ||
| 49 | + } | ||
| 50 | +} | ||
| 51 | +</script> | ||
| 52 | + | ||
| 53 | +<style scoped> | ||
| 54 | +.delete-content { | ||
| 55 | + text-align: center; | ||
| 56 | + font-size: 16px; | ||
| 57 | + margin-bottom: 20px; | ||
| 58 | +} | ||
| 59 | +.dialog-footer { | ||
| 60 | + text-align: center; | ||
| 61 | +} | ||
| 62 | +</style> | ||
| 0 | \ No newline at end of file | 63 | \ No newline at end of file |
src/components/org/deleteDataPrivilegeStaff.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <el-dialog :title="$t('dataPrivilege.confirmOperation')" :visible.sync="visible" width="400px" center> | ||
| 3 | + <div class="delete-content"> | ||
| 4 | + <p>{{ $t('dataPrivilege.confirmCancelAuth') }}</p> | ||
| 5 | + </div> | ||
| 6 | + <div slot="footer" class="dialog-footer"> | ||
| 7 | + <el-button @click="visible = false">{{ $t('common.cancel') }}</el-button> | ||
| 8 | + <el-button type="danger" @click="handleConfirm" :loading="loading"> | ||
| 9 | + {{ $t('common.confirmDelete') }} | ||
| 10 | + </el-button> | ||
| 11 | + </div> | ||
| 12 | + </el-dialog> | ||
| 13 | +</template> | ||
| 14 | + | ||
| 15 | +<script> | ||
| 16 | +import { deleteDataPrivilegeStaff } from '@/api/org/dataPrivilegeManageApi' | ||
| 17 | +import { getCommunityId } from '@/api/community/communityApi' | ||
| 18 | + | ||
| 19 | +export default { | ||
| 20 | + name: 'DeleteDataPrivilegeStaff', | ||
| 21 | + data() { | ||
| 22 | + return { | ||
| 23 | + visible: false, | ||
| 24 | + loading: false, | ||
| 25 | + form: { | ||
| 26 | + dpId: '', | ||
| 27 | + staffId: '', | ||
| 28 | + communityId: '' | ||
| 29 | + } | ||
| 30 | + } | ||
| 31 | + }, | ||
| 32 | + methods: { | ||
| 33 | + open(data) { | ||
| 34 | + this.form = { | ||
| 35 | + dpId: data.dpId, | ||
| 36 | + staffId: data.staffId, | ||
| 37 | + dpsId: data.dpsId, | ||
| 38 | + communityId: getCommunityId() | ||
| 39 | + } | ||
| 40 | + this.visible = true | ||
| 41 | + this.loading = false | ||
| 42 | + }, | ||
| 43 | + async handleConfirm() { | ||
| 44 | + this.loading = true | ||
| 45 | + try { | ||
| 46 | + await deleteDataPrivilegeStaff(this.form) | ||
| 47 | + this.$message.success(this.$t('dataPrivilege.deleteSuccess')) | ||
| 48 | + this.visible = false | ||
| 49 | + this.$emit('success') | ||
| 50 | + } catch (error) { | ||
| 51 | + console.error('Failed to delete data privilege staff:', error) | ||
| 52 | + this.$message.error(this.$t('dataPrivilege.deleteFailed')) | ||
| 53 | + } finally { | ||
| 54 | + this.loading = false | ||
| 55 | + } | ||
| 56 | + } | ||
| 57 | + } | ||
| 58 | +} | ||
| 59 | +</script> | ||
| 60 | + | ||
| 61 | +<style scoped> | ||
| 62 | +.delete-content { | ||
| 63 | + text-align: center; | ||
| 64 | + font-size: 16px; | ||
| 65 | + margin-bottom: 20px; | ||
| 66 | +} | ||
| 67 | + | ||
| 68 | +.dialog-footer { | ||
| 69 | + text-align: center; | ||
| 70 | +} | ||
| 71 | +</style> | ||
| 0 | \ No newline at end of file | 72 | \ No newline at end of file |
src/components/org/deleteDataPrivilegeUnit.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <el-dialog :title="$t('dataPrivilege.confirmOperation')" :visible.sync="visible" width="400px" center> | ||
| 3 | + <div class="delete-content"> | ||
| 4 | + <p>{{ $t('dataPrivilege.confirmCancelUnit') }}</p> | ||
| 5 | + </div> | ||
| 6 | + <div slot="footer" class="dialog-footer"> | ||
| 7 | + <el-button @click="visible = false">{{ $t('common.cancel') }}</el-button> | ||
| 8 | + <el-button type="danger" @click="handleConfirm" :loading="loading"> | ||
| 9 | + {{ $t('common.confirmDelete') }} | ||
| 10 | + </el-button> | ||
| 11 | + </div> | ||
| 12 | + </el-dialog> | ||
| 13 | +</template> | ||
| 14 | + | ||
| 15 | +<script> | ||
| 16 | +import { deleteDataPrivilegeUnit } from '@/api/org/dataPrivilegeManageApi' | ||
| 17 | +import { getCommunityId } from '@/api/community/communityApi' | ||
| 18 | + | ||
| 19 | +export default { | ||
| 20 | + name: 'DeleteDataPrivilegeUnit', | ||
| 21 | + data() { | ||
| 22 | + return { | ||
| 23 | + visible: false, | ||
| 24 | + loading: false, | ||
| 25 | + form: { | ||
| 26 | + dpId: '', | ||
| 27 | + unitId: '', | ||
| 28 | + communityId: '' | ||
| 29 | + } | ||
| 30 | + } | ||
| 31 | + }, | ||
| 32 | + methods: { | ||
| 33 | + open(data) { | ||
| 34 | + this.form = { | ||
| 35 | + dpId: data.dpId, | ||
| 36 | + unitId: data.unitId, | ||
| 37 | + dpUnitId: data.dpUnitId, | ||
| 38 | + communityId: getCommunityId() | ||
| 39 | + } | ||
| 40 | + this.visible = true | ||
| 41 | + this.loading = false | ||
| 42 | + }, | ||
| 43 | + async handleConfirm() { | ||
| 44 | + this.loading = true | ||
| 45 | + try { | ||
| 46 | + await deleteDataPrivilegeUnit(this.form) | ||
| 47 | + this.$message.success(this.$t('dataPrivilege.deleteSuccess')) | ||
| 48 | + this.visible = false | ||
| 49 | + this.$emit('success') | ||
| 50 | + } catch (error) { | ||
| 51 | + console.error('Failed to delete data privilege unit:', error) | ||
| 52 | + this.$message.error(this.$t('dataPrivilege.deleteFailed')) | ||
| 53 | + } finally { | ||
| 54 | + this.loading = false | ||
| 55 | + } | ||
| 56 | + } | ||
| 57 | + } | ||
| 58 | +} | ||
| 59 | +</script> | ||
| 60 | + | ||
| 61 | +<style scoped> | ||
| 62 | +.delete-content { | ||
| 63 | + text-align: center; | ||
| 64 | + font-size: 16px; | ||
| 65 | + margin-bottom: 20px; | ||
| 66 | +} | ||
| 67 | + | ||
| 68 | +.dialog-footer { | ||
| 69 | + text-align: center; | ||
| 70 | +} | ||
| 71 | +</style> | ||
| 0 | \ No newline at end of file | 72 | \ No newline at end of file |
src/components/org/editClasses.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <el-dialog :title="$t('classesManage.edit.title')" :visible.sync="visible" width="60%" @close="handleClose"> | ||
| 3 | + <el-form ref="form" :model="formData" label-width="120px"> | ||
| 4 | + <el-form-item :label="$t('classesManage.edit.name')" prop="name" :rules="[ | ||
| 5 | + { required: true, message: $t('classesManage.validate.nameRequired'), trigger: 'blur' }, | ||
| 6 | + { max: 100, message: $t('classesManage.validate.nameMaxLength'), trigger: 'blur' } | ||
| 7 | + ]"> | ||
| 8 | + <el-input v-model="formData.name" :placeholder="$t('classesManage.edit.namePlaceholder')" /> | ||
| 9 | + </el-form-item> | ||
| 10 | + | ||
| 11 | + <el-form-item v-for="(time, index) in formData.times" :key="time.id" | ||
| 12 | + :label="index === 0 ? $t('classesManage.edit.workTime') : ''"> | ||
| 13 | + <el-col :span="10"> | ||
| 14 | + <el-time-picker v-model="time.startTime" :placeholder="$t('classesManage.edit.startTimePlaceholder')" | ||
| 15 | + format="HH:mm" value-format="HH:mm" /> | ||
| 16 | + </el-col> | ||
| 17 | + <el-col :span="2" style="text-align: center">-</el-col> | ||
| 18 | + <el-col :span="10"> | ||
| 19 | + <el-time-picker v-model="time.endTime" :placeholder="$t('classesManage.edit.endTimePlaceholder')" | ||
| 20 | + format="HH:mm" value-format="HH:mm" /> | ||
| 21 | + </el-col> | ||
| 22 | + <el-col :span="2"> | ||
| 23 | + <el-button type="danger" icon="el-icon-delete" circle @click="removeTime(index)" /> | ||
| 24 | + </el-col> | ||
| 25 | + </el-form-item> | ||
| 26 | + | ||
| 27 | + <el-form-item> | ||
| 28 | + <el-button type="primary" @click="addTime"> | ||
| 29 | + {{ $t('classesManage.edit.addTime') }} | ||
| 30 | + </el-button> | ||
| 31 | + </el-form-item> | ||
| 32 | + | ||
| 33 | + <el-form-item :label="$t('classesManage.edit.remark')" prop="remark" :rules="[ | ||
| 34 | + { required: true, message: $t('classesManage.validate.remarkRequired'), trigger: 'blur' }, | ||
| 35 | + { max: 200, message: $t('classesManage.validate.remarkMaxLength'), trigger: 'blur' } | ||
| 36 | + ]"> | ||
| 37 | + <el-input v-model="formData.remark" type="textarea" :placeholder="$t('classesManage.edit.remarkPlaceholder')" | ||
| 38 | + :rows="3" /> | ||
| 39 | + </el-form-item> | ||
| 40 | + </el-form> | ||
| 41 | + | ||
| 42 | + <div slot="footer" class="dialog-footer"> | ||
| 43 | + <el-button @click="visible = false"> | ||
| 44 | + {{ $t('common.cancel') }} | ||
| 45 | + </el-button> | ||
| 46 | + <el-button type="primary" @click="handleSubmit"> | ||
| 47 | + {{ $t('common.save') }} | ||
| 48 | + </el-button> | ||
| 49 | + </div> | ||
| 50 | + </el-dialog> | ||
| 51 | +</template> | ||
| 52 | + | ||
| 53 | +<script> | ||
| 54 | +import { updateClasses } from '@/api/org/classesManageApi' | ||
| 55 | +import { getUuid } from '@/utils/commonUtil' | ||
| 56 | + | ||
| 57 | +export default { | ||
| 58 | + name: 'EditClasses', | ||
| 59 | + data() { | ||
| 60 | + return { | ||
| 61 | + visible: false, | ||
| 62 | + formData: { | ||
| 63 | + classesId: '', | ||
| 64 | + name: '', | ||
| 65 | + remark: '', | ||
| 66 | + times: [] | ||
| 67 | + } | ||
| 68 | + } | ||
| 69 | + }, | ||
| 70 | + methods: { | ||
| 71 | + open(data) { | ||
| 72 | + this.formData = { | ||
| 73 | + classesId: data.classesId, | ||
| 74 | + name: data.name, | ||
| 75 | + remark: data.remark, | ||
| 76 | + times: data.times.map(item => ({ | ||
| 77 | + id: getUuid(), | ||
| 78 | + startTime: item.startTime, | ||
| 79 | + endTime: item.endTime | ||
| 80 | + })) | ||
| 81 | + } | ||
| 82 | + this.visible = true | ||
| 83 | + }, | ||
| 84 | + addTime() { | ||
| 85 | + this.formData.times.push({ | ||
| 86 | + id: getUuid(), | ||
| 87 | + startTime: '', | ||
| 88 | + endTime: '' | ||
| 89 | + }) | ||
| 90 | + }, | ||
| 91 | + removeTime(index) { | ||
| 92 | + this.formData.times.splice(index, 1) | ||
| 93 | + }, | ||
| 94 | + handleClose() { | ||
| 95 | + this.$refs.form.resetFields() | ||
| 96 | + }, | ||
| 97 | + async handleSubmit() { | ||
| 98 | + try { | ||
| 99 | + await this.$refs.form.validate() | ||
| 100 | + this.loading = true | ||
| 101 | + await updateClasses(this.formData) | ||
| 102 | + this.$message.success(this.$t('common.saveSuccess')) | ||
| 103 | + this.visible = false | ||
| 104 | + this.$emit('success') | ||
| 105 | + } catch (error) { | ||
| 106 | + if (error !== 'validate') { | ||
| 107 | + this.$message.error(error.message || this.$t('common.saveFailed')) | ||
| 108 | + } | ||
| 109 | + } finally { | ||
| 110 | + this.loading = false | ||
| 111 | + } | ||
| 112 | + } | ||
| 113 | + } | ||
| 114 | +} | ||
| 115 | +</script> | ||
| 0 | \ No newline at end of file | 116 | \ No newline at end of file |
src/components/org/editDataPrivilege.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <el-dialog | ||
| 3 | + :title="$t('dataPrivilege.editTitle')" | ||
| 4 | + :visible.sync="visible" | ||
| 5 | + width="50%" | ||
| 6 | + @close="handleClose"> | ||
| 7 | + <el-form ref="form" :model="form" :rules="rules" label-width="120px"> | ||
| 8 | + <el-form-item :label="$t('dataPrivilege.name')" prop="name"> | ||
| 9 | + <el-input | ||
| 10 | + v-model="form.name" | ||
| 11 | + :placeholder="$t('dataPrivilege.namePlaceholder')" /> | ||
| 12 | + </el-form-item> | ||
| 13 | + <el-form-item :label="$t('dataPrivilege.code')" prop="code"> | ||
| 14 | + <el-input | ||
| 15 | + v-model="form.code" | ||
| 16 | + :placeholder="$t('dataPrivilege.codePlaceholder')" /> | ||
| 17 | + </el-form-item> | ||
| 18 | + <el-form-item :label="$t('dataPrivilege.remark')" prop="remark"> | ||
| 19 | + <el-input | ||
| 20 | + v-model="form.remark" | ||
| 21 | + type="textarea" | ||
| 22 | + :placeholder="$t('dataPrivilege.remarkPlaceholder')" /> | ||
| 23 | + </el-form-item> | ||
| 24 | + </el-form> | ||
| 25 | + <div slot="footer" class="dialog-footer"> | ||
| 26 | + <el-button @click="visible = false">{{ $t('common.cancel') }}</el-button> | ||
| 27 | + <el-button type="primary" @click="handleSubmit">{{ $t('common.confirm') }}</el-button> | ||
| 28 | + </div> | ||
| 29 | + </el-dialog> | ||
| 30 | +</template> | ||
| 31 | + | ||
| 32 | +<script> | ||
| 33 | +import { updateDataPrivilege } from '@/api/org/dataPrivilegeManageApi' | ||
| 34 | +import { getCommunityId } from '@/api/community/communityApi' | ||
| 35 | + | ||
| 36 | +export default { | ||
| 37 | + name: 'EditDataPrivilege', | ||
| 38 | + data() { | ||
| 39 | + return { | ||
| 40 | + visible: false, | ||
| 41 | + form: { | ||
| 42 | + dpId: '', | ||
| 43 | + name: '', | ||
| 44 | + code: '', | ||
| 45 | + remark: '', | ||
| 46 | + communityId: '' | ||
| 47 | + }, | ||
| 48 | + rules: { | ||
| 49 | + name: [ | ||
| 50 | + { required: true, message: this.$t('dataPrivilege.nameRequired'), trigger: 'blur' }, | ||
| 51 | + { max: 50, message: this.$t('dataPrivilege.nameMaxLength'), trigger: 'blur' } | ||
| 52 | + ], | ||
| 53 | + code: [ | ||
| 54 | + { required: true, message: this.$t('dataPrivilege.codeRequired'), trigger: 'blur' }, | ||
| 55 | + { max: 30, message: this.$t('dataPrivilege.codeMaxLength'), trigger: 'blur' } | ||
| 56 | + ], | ||
| 57 | + remark: [ | ||
| 58 | + { required: true, message: this.$t('dataPrivilege.remarkRequired'), trigger: 'blur' }, | ||
| 59 | + { max: 256, message: this.$t('dataPrivilege.remarkMaxLength'), trigger: 'blur' } | ||
| 60 | + ] | ||
| 61 | + } | ||
| 62 | + } | ||
| 63 | + }, | ||
| 64 | + methods: { | ||
| 65 | + open(data) { | ||
| 66 | + this.form = { | ||
| 67 | + dpId: data.dpId, | ||
| 68 | + name: data.name, | ||
| 69 | + code: data.code, | ||
| 70 | + remark: data.remark, | ||
| 71 | + communityId: getCommunityId() | ||
| 72 | + } | ||
| 73 | + this.visible = true | ||
| 74 | + }, | ||
| 75 | + handleClose() { | ||
| 76 | + this.$refs.form.resetFields() | ||
| 77 | + }, | ||
| 78 | + handleSubmit() { | ||
| 79 | + this.$refs.form.validate(async valid => { | ||
| 80 | + if (valid) { | ||
| 81 | + try { | ||
| 82 | + await updateDataPrivilege(this.form) | ||
| 83 | + this.$message.success(this.$t('dataPrivilege.editSuccess')) | ||
| 84 | + this.visible = false | ||
| 85 | + this.$emit('success') | ||
| 86 | + } catch (error) { | ||
| 87 | + console.error('Failed to edit data privilege:', error) | ||
| 88 | + } | ||
| 89 | + } | ||
| 90 | + }) | ||
| 91 | + } | ||
| 92 | + } | ||
| 93 | +} | ||
| 94 | +</script> | ||
| 95 | + | ||
| 96 | +<style scoped> | ||
| 97 | +.dialog-footer { | ||
| 98 | + text-align: right; | ||
| 99 | +} | ||
| 100 | +</style> | ||
| 0 | \ No newline at end of file | 101 | \ No newline at end of file |
src/i18n/userI18n.js
| 1 | import { messages as staffCommunityMessages } from '../views/staff/staffCommunityLang' | 1 | import { messages as staffCommunityMessages } from '../views/staff/staffCommunityLang' |
| 2 | import { messages as staffAppAuthManageMessages } from '../views/staff/staffAppAuthManageLang' | 2 | import { messages as staffAppAuthManageMessages } from '../views/staff/staffAppAuthManageLang' |
| 3 | +import { messages as dataPrivilegeManageMessages } from '../views/org/dataPrivilegeManageLang' | ||
| 4 | +import { messages as classesManageMessages } from '../views/org/classesManageLang' | ||
| 3 | 5 | ||
| 4 | export const messages = { | 6 | export const messages = { |
| 5 | en: { | 7 | en: { |
| 6 | ...staffCommunityMessages.en, | 8 | ...staffCommunityMessages.en, |
| 7 | ...staffAppAuthManageMessages.en, | 9 | ...staffAppAuthManageMessages.en, |
| 10 | + ...dataPrivilegeManageMessages.en, | ||
| 11 | + ...classesManageMessages.en, | ||
| 8 | }, | 12 | }, |
| 9 | zh: { | 13 | zh: { |
| 10 | ...staffCommunityMessages.zh, | 14 | ...staffCommunityMessages.zh, |
| 11 | ...staffAppAuthManageMessages.zh, | 15 | ...staffAppAuthManageMessages.zh, |
| 16 | + ...dataPrivilegeManageMessages.zh, | ||
| 17 | + ...classesManageMessages.zh, | ||
| 12 | } | 18 | } |
| 13 | } | 19 | } |
| 14 | \ No newline at end of file | 20 | \ No newline at end of file |
src/router/userRouter.js
| @@ -5,8 +5,18 @@ export default [ | @@ -5,8 +5,18 @@ export default [ | ||
| 5 | component: () => import('@/views/staff/staffCommunityList.vue') | 5 | component: () => import('@/views/staff/staffCommunityList.vue') |
| 6 | }, | 6 | }, |
| 7 | { | 7 | { |
| 8 | - path:'/pages/property/staffAppAuthManage', | ||
| 9 | - name:'/pages/property/staffAppAuthManage', | 8 | + path: '/pages/property/staffAppAuthManage', |
| 9 | + name: '/pages/property/staffAppAuthManage', | ||
| 10 | component: () => import('@/views/staff/staffAppAuthManageList.vue') | 10 | component: () => import('@/views/staff/staffAppAuthManageList.vue') |
| 11 | + }, | ||
| 12 | + { | ||
| 13 | + path: '/pages/property/dataPrivilegeManage', | ||
| 14 | + name: '/pages/property/dataPrivilegeManage', | ||
| 15 | + component: () => import('@/views/org/dataPrivilegeManageList.vue') | ||
| 16 | + }, | ||
| 17 | + { | ||
| 18 | + path:'/pages/property/classesManage', | ||
| 19 | + name:'/pages/property/classesManage', | ||
| 20 | + component: () => import('@/views/org/classesManageList.vue') | ||
| 11 | }, | 21 | }, |
| 12 | ] | 22 | ] |
| 13 | \ No newline at end of file | 23 | \ No newline at end of file |
src/views/org/classesManageLang.js
0 → 100644
| 1 | +export const messages = { | ||
| 2 | + en: { | ||
| 3 | + classesManage: { | ||
| 4 | + search: { | ||
| 5 | + title: 'Search Conditions', | ||
| 6 | + namePlaceholder: 'Please enter class name' | ||
| 7 | + }, | ||
| 8 | + list: { | ||
| 9 | + title: 'Class Information' | ||
| 10 | + }, | ||
| 11 | + table: { | ||
| 12 | + classesId: 'ID', | ||
| 13 | + name: 'Class Name', | ||
| 14 | + times: 'Time Period', | ||
| 15 | + state: 'Status', | ||
| 16 | + createTime: 'Create Time', | ||
| 17 | + remark: 'Remark' | ||
| 18 | + }, | ||
| 19 | + add: { | ||
| 20 | + title: 'Add Class', | ||
| 21 | + name: 'Class Name', | ||
| 22 | + namePlaceholder: 'Please enter class name', | ||
| 23 | + workTime: 'Work Time', | ||
| 24 | + startTimePlaceholder: 'Start Time', | ||
| 25 | + endTimePlaceholder: 'End Time', | ||
| 26 | + addTime: 'Add Time', | ||
| 27 | + remark: 'Remark', | ||
| 28 | + remarkPlaceholder: 'Please enter remark' | ||
| 29 | + }, | ||
| 30 | + edit: { | ||
| 31 | + title: 'Edit Class', | ||
| 32 | + name: 'Class Name', | ||
| 33 | + namePlaceholder: 'Please enter class name', | ||
| 34 | + workTime: 'Work Time', | ||
| 35 | + startTimePlaceholder: 'Start Time', | ||
| 36 | + endTimePlaceholder: 'End Time', | ||
| 37 | + addTime: 'Add Time', | ||
| 38 | + remark: 'Remark', | ||
| 39 | + remarkPlaceholder: 'Please enter remark' | ||
| 40 | + }, | ||
| 41 | + delete: { | ||
| 42 | + title: 'Delete Confirmation', | ||
| 43 | + confirmMessage: 'Are you sure to delete this class?' | ||
| 44 | + }, | ||
| 45 | + state: { | ||
| 46 | + title: 'Status Confirmation', | ||
| 47 | + confirmMessage: 'Are you sure to {action} this {name}?', | ||
| 48 | + successMessage: '{action} successfully', | ||
| 49 | + classes: 'class' | ||
| 50 | + }, | ||
| 51 | + validate: { | ||
| 52 | + nameRequired: 'Class name is required', | ||
| 53 | + nameMaxLength: 'Class name cannot exceed 100 characters', | ||
| 54 | + remarkRequired: 'Remark is required', | ||
| 55 | + remarkMaxLength: 'Remark cannot exceed 200 characters' | ||
| 56 | + }, | ||
| 57 | + fetchError: 'Failed to fetch class data' | ||
| 58 | + } | ||
| 59 | + }, | ||
| 60 | + zh: { | ||
| 61 | + classesManage: { | ||
| 62 | + search: { | ||
| 63 | + title: '查询条件', | ||
| 64 | + namePlaceholder: '请输入班次名称' | ||
| 65 | + }, | ||
| 66 | + list: { | ||
| 67 | + title: '班次信息' | ||
| 68 | + }, | ||
| 69 | + table: { | ||
| 70 | + classesId: '编号', | ||
| 71 | + name: '班次名称', | ||
| 72 | + times: '时段', | ||
| 73 | + state: '状态', | ||
| 74 | + createTime: '创建时间', | ||
| 75 | + remark: '备注说明' | ||
| 76 | + }, | ||
| 77 | + add: { | ||
| 78 | + title: '添加班次', | ||
| 79 | + name: '班次名称', | ||
| 80 | + namePlaceholder: '请输入班次名称', | ||
| 81 | + workTime: '工作时间', | ||
| 82 | + startTimePlaceholder: '上班时间', | ||
| 83 | + endTimePlaceholder: '下班时间', | ||
| 84 | + addTime: '增加时段', | ||
| 85 | + remark: '备注说明', | ||
| 86 | + remarkPlaceholder: '请输入备注说明' | ||
| 87 | + }, | ||
| 88 | + edit: { | ||
| 89 | + title: '修改班次', | ||
| 90 | + name: '班次名称', | ||
| 91 | + namePlaceholder: '请输入班次名称', | ||
| 92 | + workTime: '工作时间', | ||
| 93 | + startTimePlaceholder: '上班时间', | ||
| 94 | + endTimePlaceholder: '下班时间', | ||
| 95 | + addTime: '增加时段', | ||
| 96 | + remark: '备注说明', | ||
| 97 | + remarkPlaceholder: '请输入备注说明' | ||
| 98 | + }, | ||
| 99 | + delete: { | ||
| 100 | + title: '删除确认', | ||
| 101 | + confirmMessage: '确定删除该班次吗?' | ||
| 102 | + }, | ||
| 103 | + state: { | ||
| 104 | + title: '状态确认', | ||
| 105 | + confirmMessage: '确定{action}该{name}吗?', | ||
| 106 | + successMessage: '{action}成功', | ||
| 107 | + classes: '班次' | ||
| 108 | + }, | ||
| 109 | + validate: { | ||
| 110 | + nameRequired: '班次名称不能为空', | ||
| 111 | + nameMaxLength: '班次名称不能超过100个字符', | ||
| 112 | + remarkRequired: '备注说明不能为空', | ||
| 113 | + remarkMaxLength: '备注说明不能超过200个字符' | ||
| 114 | + }, | ||
| 115 | + fetchError: '获取班次数据失败' | ||
| 116 | + } | ||
| 117 | + } | ||
| 118 | +} | ||
| 0 | \ No newline at end of file | 119 | \ No newline at end of file |
src/views/org/classesManageList.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div class="classes-manage-container"> | ||
| 3 | + <!-- 查询条件 --> | ||
| 4 | + <el-card class="search-wrapper"> | ||
| 5 | + <div slot="header" class="text-left"> | ||
| 6 | + <span>{{ $t('classesManage.search.title') }}</span> | ||
| 7 | + </div> | ||
| 8 | + <el-row :gutter="20"> | ||
| 9 | + <el-col :span="6"> | ||
| 10 | + <el-input v-model="searchForm.name" :placeholder="$t('classesManage.search.namePlaceholder')" clearable /> | ||
| 11 | + </el-col> | ||
| 12 | + <el-col :span="4"> | ||
| 13 | + <el-button type="primary" @click="handleSearch"> | ||
| 14 | + <i class="el-icon-search"></i> | ||
| 15 | + {{ $t('common.search') }} | ||
| 16 | + </el-button> | ||
| 17 | + <el-button @click="handleReset"> | ||
| 18 | + <i class="el-icon-refresh"></i> | ||
| 19 | + {{ $t('common.reset') }} | ||
| 20 | + </el-button> | ||
| 21 | + </el-col> | ||
| 22 | + </el-row> | ||
| 23 | + </el-card> | ||
| 24 | + | ||
| 25 | + <!-- 班次信息 --> | ||
| 26 | + <el-card class="list-wrapper"> | ||
| 27 | + <div slot="header" class="flex justify-between "> | ||
| 28 | + <span>{{ $t('classesManage.list.title') }}</span> | ||
| 29 | + <div style="float: right"> | ||
| 30 | + <el-button type="primary" size="small" @click="handleShowDocument"> | ||
| 31 | + <i class="el-icon-document"></i> | ||
| 32 | + {{ $t('common.document') }} | ||
| 33 | + </el-button> | ||
| 34 | + <el-button type="primary" size="small" @click="handleAdd"> | ||
| 35 | + <i class="el-icon-plus"></i> | ||
| 36 | + {{ $t('common.add') }} | ||
| 37 | + </el-button> | ||
| 38 | + </div> | ||
| 39 | + </div> | ||
| 40 | + | ||
| 41 | + <el-table v-loading="loading" :data="tableData" border style="width: 100%"> | ||
| 42 | + <el-table-column prop="classesId" :label="$t('classesManage.table.classesId')" align="center" /> | ||
| 43 | + <el-table-column prop="name" :label="$t('classesManage.table.name')" align="center" /> | ||
| 44 | + <el-table-column :label="$t('classesManage.table.times')" align="center"> | ||
| 45 | + <template slot-scope="scope"> | ||
| 46 | + <div v-for="(time, index) in scope.row.times" :key="index"> | ||
| 47 | + {{ time.startTime }}~{{ time.endTime }} | ||
| 48 | + </div> | ||
| 49 | + </template> | ||
| 50 | + </el-table-column> | ||
| 51 | + <el-table-column :label="$t('classesManage.table.state')" align="center"> | ||
| 52 | + <template slot-scope="scope"> | ||
| 53 | + {{ scope.row.state === '1001' ? $t('common.enabled') : $t('common.disabled') }} | ||
| 54 | + </template> | ||
| 55 | + </el-table-column> | ||
| 56 | + <el-table-column prop="createTime" :label="$t('classesManage.table.createTime')" align="center" /> | ||
| 57 | + <el-table-column prop="remark" :label="$t('classesManage.table.remark')" align="center" /> | ||
| 58 | + <el-table-column :label="$t('common.operation')" align="center" width="300" fixed="right"> | ||
| 59 | + <template slot-scope="scope"> | ||
| 60 | + <el-button size="mini" type="primary" @click="handleEdit(scope.row)"> | ||
| 61 | + {{ $t('common.edit') }} | ||
| 62 | + </el-button> | ||
| 63 | + <el-button size="mini" type="danger" @click="handleDelete(scope.row)"> | ||
| 64 | + {{ $t('common.delete') }} | ||
| 65 | + </el-button> | ||
| 66 | + <el-button v-if="scope.row.state === '1001'" size="mini" type="warning" @click="handleDisable(scope.row)"> | ||
| 67 | + {{ $t('common.disabled') }} | ||
| 68 | + </el-button> | ||
| 69 | + <el-button v-else size="mini" type="success" @click="handleEnable(scope.row)"> | ||
| 70 | + {{ $t('common.enabled') }} | ||
| 71 | + </el-button> | ||
| 72 | + </template> | ||
| 73 | + </el-table-column> | ||
| 74 | + </el-table> | ||
| 75 | + | ||
| 76 | + <el-pagination :current-page.sync="page.current" :page-sizes="[10, 20, 30, 50]" :page-size="page.size" | ||
| 77 | + :total="page.total" layout="total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange" | ||
| 78 | + @current-change="handleCurrentChange" /> | ||
| 79 | + </el-card> | ||
| 80 | + | ||
| 81 | + <!-- 组件 --> | ||
| 82 | + <add-classes ref="addClasses" @success="handleSuccess" /> | ||
| 83 | + <edit-classes ref="editClasses" @success="handleSuccess" /> | ||
| 84 | + <delete-classes ref="deleteClasses" @success="handleSuccess" /> | ||
| 85 | + <classes-state ref="classesState" @success="handleSuccess" /> | ||
| 86 | + </div> | ||
| 87 | +</template> | ||
| 88 | + | ||
| 89 | +<script> | ||
| 90 | +import { listClasses } from '@/api/org/classesManageApi' | ||
| 91 | +import AddClasses from '@/components/org/addClasses' | ||
| 92 | +import EditClasses from '@/components/org/editClasses' | ||
| 93 | +import DeleteClasses from '@/components/org/deleteClasses' | ||
| 94 | +import ClassesState from '@/components/org/classesState' | ||
| 95 | + | ||
| 96 | +export default { | ||
| 97 | + name: 'ClassesManageList', | ||
| 98 | + components: { | ||
| 99 | + AddClasses, | ||
| 100 | + EditClasses, | ||
| 101 | + DeleteClasses, | ||
| 102 | + ClassesState | ||
| 103 | + }, | ||
| 104 | + data() { | ||
| 105 | + return { | ||
| 106 | + loading: false, | ||
| 107 | + searchForm: { | ||
| 108 | + name: '' | ||
| 109 | + }, | ||
| 110 | + tableData: [], | ||
| 111 | + page: { | ||
| 112 | + current: 1, | ||
| 113 | + size: 10, | ||
| 114 | + total: 0 | ||
| 115 | + } | ||
| 116 | + } | ||
| 117 | + }, | ||
| 118 | + created() { | ||
| 119 | + this.getList() | ||
| 120 | + }, | ||
| 121 | + methods: { | ||
| 122 | + async getList() { | ||
| 123 | + try { | ||
| 124 | + this.loading = true | ||
| 125 | + const params = { | ||
| 126 | + page: this.page.current, | ||
| 127 | + row: this.page.size, | ||
| 128 | + name: this.searchForm.name | ||
| 129 | + } | ||
| 130 | + const { data, total } = await listClasses(params) | ||
| 131 | + this.tableData = data | ||
| 132 | + this.page.total = total | ||
| 133 | + } catch (error) { | ||
| 134 | + this.$message.error(this.$t('classesManage.fetchError')) | ||
| 135 | + } finally { | ||
| 136 | + this.loading = false | ||
| 137 | + } | ||
| 138 | + }, | ||
| 139 | + handleSearch() { | ||
| 140 | + this.page.current = 1 | ||
| 141 | + this.getList() | ||
| 142 | + }, | ||
| 143 | + handleReset() { | ||
| 144 | + this.searchForm = { | ||
| 145 | + name: '' | ||
| 146 | + } | ||
| 147 | + this.handleSearch() | ||
| 148 | + }, | ||
| 149 | + handleAdd() { | ||
| 150 | + this.$refs.addClasses.open() | ||
| 151 | + }, | ||
| 152 | + handleEdit(row) { | ||
| 153 | + this.$refs.editClasses.open(row) | ||
| 154 | + }, | ||
| 155 | + handleDelete(row) { | ||
| 156 | + this.$refs.deleteClasses.open(row) | ||
| 157 | + }, | ||
| 158 | + handleEnable(row) { | ||
| 159 | + this.$refs.classesState.open({ | ||
| 160 | + classesId: row.classesId, | ||
| 161 | + stateName: this.$t('common.enable'), | ||
| 162 | + state: '1001' | ||
| 163 | + }) | ||
| 164 | + }, | ||
| 165 | + handleDisable(row) { | ||
| 166 | + this.$refs.classesState.open({ | ||
| 167 | + classesId: row.classesId, | ||
| 168 | + stateName: this.$t('common.disable'), | ||
| 169 | + state: '2002' | ||
| 170 | + }) | ||
| 171 | + }, | ||
| 172 | + handleShowDocument() { | ||
| 173 | + // TODO: 显示文档逻辑 | ||
| 174 | + }, | ||
| 175 | + handleSuccess() { | ||
| 176 | + this.getList() | ||
| 177 | + }, | ||
| 178 | + handleSizeChange(val) { | ||
| 179 | + this.page.size = val | ||
| 180 | + this.getList() | ||
| 181 | + }, | ||
| 182 | + handleCurrentChange(val) { | ||
| 183 | + this.page.current = val | ||
| 184 | + this.getList() | ||
| 185 | + } | ||
| 186 | + } | ||
| 187 | +} | ||
| 188 | +</script> | ||
| 189 | + | ||
| 190 | +<style lang="scss" scoped> | ||
| 191 | +.classes-manage-container { | ||
| 192 | + padding: 0; | ||
| 193 | + margin: 0; | ||
| 194 | + | ||
| 195 | + .search-wrapper { | ||
| 196 | + margin-bottom: 20px; | ||
| 197 | + | ||
| 198 | + .el-input { | ||
| 199 | + width: 100%; | ||
| 200 | + } | ||
| 201 | + } | ||
| 202 | + | ||
| 203 | + .list-wrapper { | ||
| 204 | + .el-pagination { | ||
| 205 | + margin-top: 20px; | ||
| 206 | + text-align: right; | ||
| 207 | + } | ||
| 208 | + } | ||
| 209 | +} | ||
| 210 | +</style> | ||
| 0 | \ No newline at end of file | 211 | \ No newline at end of file |
src/views/org/dataPrivilegeManageLang.js
0 → 100644
| 1 | +export const messages = { | ||
| 2 | + en: { | ||
| 3 | + dataPrivilege: { | ||
| 4 | + title: 'Data Privilege', | ||
| 5 | + add: 'Add', | ||
| 6 | + edit: 'Edit', | ||
| 7 | + delete: 'Delete', | ||
| 8 | + addTitle: 'Add Data Privilege', | ||
| 9 | + editTitle: 'Edit Data Privilege', | ||
| 10 | + deleteTitle: 'Delete Confirmation', | ||
| 11 | + name: 'Name', | ||
| 12 | + code: 'Code', | ||
| 13 | + remark: 'Remark', | ||
| 14 | + namePlaceholder: 'Please enter name', | ||
| 15 | + codePlaceholder: 'Please enter code', | ||
| 16 | + remarkPlaceholder: 'Please enter remark', | ||
| 17 | + nameRequired: 'Name is required', | ||
| 18 | + nameMaxLength: 'Name cannot exceed 50 characters', | ||
| 19 | + codeRequired: 'Code is required', | ||
| 20 | + codeMaxLength: 'Code cannot exceed 30 characters', | ||
| 21 | + remarkRequired: 'Remark is required', | ||
| 22 | + remarkMaxLength: 'Remark cannot exceed 256 characters', | ||
| 23 | + addSuccess: 'Added successfully', | ||
| 24 | + editSuccess: 'Modified successfully', | ||
| 25 | + deleteSuccess: 'Deleted successfully', | ||
| 26 | + deleteFailed: 'Delete failed', | ||
| 27 | + deleteConfirm: 'Are you sure to delete this data privilege?', | ||
| 28 | + confirmOperation: 'Please confirm your operation', | ||
| 29 | + unitAuth: 'Unit Authorization', | ||
| 30 | + staffRelation: 'Staff Relation', | ||
| 31 | + building: 'Building', | ||
| 32 | + unit: 'Unit', | ||
| 33 | + operation: 'Operation', | ||
| 34 | + associateUnit: 'Associate Unit', | ||
| 35 | + buildingUnit: 'Building Unit', | ||
| 36 | + inputBuildingNum: 'Input building number', | ||
| 37 | + inputUnitNum: 'Input unit number', | ||
| 38 | + buildingNum: 'Building Number', | ||
| 39 | + unitNum: 'Unit Number', | ||
| 40 | + confirmCancelUnit: 'Confirm to cancel building unit authorization?', | ||
| 41 | + associateSuccess: 'Association successful', | ||
| 42 | + staff: 'Staff', | ||
| 43 | + staffName: 'Staff Name', | ||
| 44 | + phone: 'Phone', | ||
| 45 | + email: 'Email', | ||
| 46 | + address: 'Address', | ||
| 47 | + gender: 'Gender', | ||
| 48 | + male: 'Male', | ||
| 49 | + female: 'Female', | ||
| 50 | + inputStaffName: 'Input staff name', | ||
| 51 | + inputPhone: 'Input phone number', | ||
| 52 | + inputStaffId: 'Input staff ID', | ||
| 53 | + staffId: 'Staff ID', | ||
| 54 | + staffAddress: 'Staff Address', | ||
| 55 | + associateStaff: 'Associate Staff', | ||
| 56 | + confirmCancelAuth: 'Confirm to cancel staff authorization?', | ||
| 57 | + detail: 'Detail' | ||
| 58 | + } | ||
| 59 | + }, | ||
| 60 | + zh: { | ||
| 61 | + dataPrivilege: { | ||
| 62 | + title: '数据权限', | ||
| 63 | + add: '添加', | ||
| 64 | + edit: '修改', | ||
| 65 | + delete: '删除', | ||
| 66 | + addTitle: '添加数据权限', | ||
| 67 | + editTitle: '修改数据权限', | ||
| 68 | + deleteTitle: '删除确认', | ||
| 69 | + name: '名称', | ||
| 70 | + code: '编号', | ||
| 71 | + remark: '备注', | ||
| 72 | + namePlaceholder: '请输入名称', | ||
| 73 | + codePlaceholder: '请输入编号', | ||
| 74 | + remarkPlaceholder: '请输入备注', | ||
| 75 | + nameRequired: '名称不能为空', | ||
| 76 | + nameMaxLength: '名称不能超过50个字符', | ||
| 77 | + codeRequired: '编号不能为空', | ||
| 78 | + codeMaxLength: '编号不能超过30个字符', | ||
| 79 | + remarkRequired: '备注不能为空', | ||
| 80 | + remarkMaxLength: '备注不能超过256个字符', | ||
| 81 | + addSuccess: '添加成功', | ||
| 82 | + editSuccess: '修改成功', | ||
| 83 | + deleteSuccess: '删除成功', | ||
| 84 | + deleteFailed: '删除失败', | ||
| 85 | + deleteConfirm: '确定删除此数据权限吗?', | ||
| 86 | + confirmOperation: '请确认您的操作', | ||
| 87 | + unitAuth: '单元授权', | ||
| 88 | + staffRelation: '员工关联', | ||
| 89 | + building: '楼栋', | ||
| 90 | + unit: '单元', | ||
| 91 | + operation: '操作', | ||
| 92 | + associateUnit: '关联单元', | ||
| 93 | + buildingUnit: '楼栋单元', | ||
| 94 | + inputBuildingNum: '输入楼栋编号', | ||
| 95 | + inputUnitNum: '输入单元编号', | ||
| 96 | + buildingNum: '楼栋编号', | ||
| 97 | + unitNum: '单元编号', | ||
| 98 | + confirmCancelUnit: '确定取消楼栋单元授权吗?', | ||
| 99 | + associateSuccess: '关联成功', | ||
| 100 | + staff: '员工', | ||
| 101 | + staffName: '员工名称', | ||
| 102 | + phone: '手机号', | ||
| 103 | + email: '邮箱', | ||
| 104 | + address: '地址', | ||
| 105 | + gender: '性别', | ||
| 106 | + male: '男', | ||
| 107 | + female: '女', | ||
| 108 | + inputStaffName: '输入员工名称', | ||
| 109 | + inputPhone: '输入手机号', | ||
| 110 | + inputStaffId: '输入员工编号', | ||
| 111 | + staffId: '员工编号', | ||
| 112 | + staffAddress: '员工地址', | ||
| 113 | + associateStaff: '关联员工', | ||
| 114 | + confirmCancelAuth: '确定取消员工授权吗?', | ||
| 115 | + detail: '详情' | ||
| 116 | + } | ||
| 117 | + } | ||
| 118 | +} | ||
| 0 | \ No newline at end of file | 119 | \ No newline at end of file |
src/views/org/dataPrivilegeManageList.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div class="data-privilege-container"> | ||
| 3 | + <el-row class="data-privilege-wrapper"> | ||
| 4 | + <el-col :span="4" class="left-panel"> | ||
| 5 | + <data-privilege-div ref="dataPrivilegeDiv" @switch-data-privilege="handleSwitchDataPrivilege" /> | ||
| 6 | + </el-col> | ||
| 7 | + <el-col :span="20" class="right-panel"> | ||
| 8 | + <el-card class="box-card"> | ||
| 9 | + <div slot="header" class="text-left"> | ||
| 10 | + <h5>{{ $t('dataPrivilege.title') }}: {{ currentDataPrivilege.name }}</h5> | ||
| 11 | + <p>{{ currentDataPrivilege.description }}</p> | ||
| 12 | + </div> | ||
| 13 | + <div class="tab-wrapper"> | ||
| 14 | + <el-tabs v-model="activeTab" @tab-click="handleTabClick(activeTab)"> | ||
| 15 | + <el-tab-pane :label="$t('dataPrivilege.unitAuth')" name="dataPrivilegeUnit"> | ||
| 16 | + <data-privilege-unit v-if="activeTab === 'dataPrivilegeUnit'" ref="dataPrivilegeUnit" | ||
| 17 | + /> | ||
| 18 | + </el-tab-pane> | ||
| 19 | + <el-tab-pane :label="$t('dataPrivilege.staffRelation')" name="dataPrivilegeStaff"> | ||
| 20 | + <data-privilege-staff v-if="activeTab === 'dataPrivilegeStaff'" ref="dataPrivilegeStaff" | ||
| 21 | + /> | ||
| 22 | + </el-tab-pane> | ||
| 23 | + </el-tabs> | ||
| 24 | + </div> | ||
| 25 | + </el-card> | ||
| 26 | + </el-col> | ||
| 27 | + </el-row> | ||
| 28 | + | ||
| 29 | + | ||
| 30 | + </div> | ||
| 31 | +</template> | ||
| 32 | + | ||
| 33 | +<script> | ||
| 34 | +import DataPrivilegeDiv from '@/components/org/dataPrivilegeDiv' | ||
| 35 | +import DataPrivilegeUnit from '@/components/org/dataPrivilegeUnit' | ||
| 36 | +import DataPrivilegeStaff from '@/components/org/dataPrivilegeStaff' | ||
| 37 | + | ||
| 38 | +import { getCommunityId } from '@/api/community/communityApi' | ||
| 39 | + | ||
| 40 | +export default { | ||
| 41 | + name: 'DataPrivilegeManageList', | ||
| 42 | + components: { | ||
| 43 | + DataPrivilegeDiv, | ||
| 44 | + DataPrivilegeUnit, | ||
| 45 | + DataPrivilegeStaff, | ||
| 46 | + }, | ||
| 47 | + data() { | ||
| 48 | + return { | ||
| 49 | + activeTab: 'dataPrivilegeUnit', | ||
| 50 | + currentDataPrivilege: { | ||
| 51 | + dpId: '', | ||
| 52 | + name: '', | ||
| 53 | + description: '' | ||
| 54 | + }, | ||
| 55 | + communityId: '' | ||
| 56 | + } | ||
| 57 | + }, | ||
| 58 | + created() { | ||
| 59 | + this.communityId = getCommunityId() | ||
| 60 | + }, | ||
| 61 | + methods: { | ||
| 62 | + handleSwitchDataPrivilege(data) { | ||
| 63 | + this.currentDataPrivilege = { ...data } | ||
| 64 | + this.handleTabClick(this.activeTab) | ||
| 65 | + }, | ||
| 66 | + handleTabClick(tab) { | ||
| 67 | + this.activeTab = tab | ||
| 68 | + setTimeout(() => { | ||
| 69 | + this.$refs[tab].open(this.currentDataPrivilege.dpId) | ||
| 70 | + }, 100) | ||
| 71 | + }, | ||
| 72 | + handleRefresh() { | ||
| 73 | + this.$refs.dataPrivilegeDiv.loadData() | ||
| 74 | + if (this.activeTab === 'unit') { | ||
| 75 | + this.$refs.dataPrivilegeUnit && this.$refs.dataPrivilegeUnit.loadData() | ||
| 76 | + } else { | ||
| 77 | + this.$refs.dataPrivilegeStaff && this.$refs.dataPrivilegeStaff.loadData() | ||
| 78 | + } | ||
| 79 | + } | ||
| 80 | + } | ||
| 81 | +} | ||
| 82 | +</script> | ||
| 83 | + | ||
| 84 | +<style lang="scss" scoped> | ||
| 85 | +.data-privilege-container { | ||
| 86 | + padding: 0; | ||
| 87 | + margin: 0; | ||
| 88 | + height: 100%; | ||
| 89 | + | ||
| 90 | + .data-privilege-wrapper { | ||
| 91 | + height: 100%; | ||
| 92 | + | ||
| 93 | + .left-panel { | ||
| 94 | + padding-right: 0; | ||
| 95 | + height: 100%; | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + .right-panel { | ||
| 99 | + padding-left: 10px; | ||
| 100 | + height: 100%; | ||
| 101 | + | ||
| 102 | + .box-card { | ||
| 103 | + height: 100%; | ||
| 104 | + | ||
| 105 | + .clearfix { | ||
| 106 | + h5 { | ||
| 107 | + margin: 0 0 10px 0; | ||
| 108 | + font-size: 16px; | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + p { | ||
| 112 | + margin: 0; | ||
| 113 | + color: #999; | ||
| 114 | + } | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + .line-x { | ||
| 118 | + height: 1px; | ||
| 119 | + background-color: #e6e6e6; | ||
| 120 | + margin: 15px 0; | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + .tab-wrapper { | ||
| 124 | + height: calc(100% - 80px); | ||
| 125 | + overflow: auto; | ||
| 126 | + } | ||
| 127 | + } | ||
| 128 | + } | ||
| 129 | + } | ||
| 130 | +} | ||
| 131 | +</style> | ||
| 0 | \ No newline at end of file | 132 | \ No newline at end of file |