Commit f68885f80ee5c501add4f9a4c1492eb903f40616

Authored by wuxw
1 parent 439c1b56

开发完成检查项

src/api/inspection/maintainanceItemApi.js 0 → 100644
  1 +import request from '@/utils/request'
  2 +import { getCommunityId } from '@/api/community/communityApi'
  3 +
  4 +// 获取检查项列表
  5 +export function listMaintainanceItem(params) {
  6 + return new Promise((resolve, reject) => {
  7 + request({
  8 + url: '/maintainance.listMaintainanceItem',
  9 + method: 'get',
  10 + params: {
  11 + ...params,
  12 + communityId: params.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 saveMaintainanceItem(data) {
  25 + return new Promise((resolve, reject) => {
  26 + request({
  27 + url: '/maintainance.saveMaintainanceItem',
  28 + method: 'post',
  29 + data: {
  30 + ...data,
  31 + communityId: data.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 updateMaintainanceItem(data) {
  44 + return new Promise((resolve, reject) => {
  45 + request({
  46 + url: '/maintainance.updateMaintainanceItem',
  47 + method: 'post',
  48 + data: {
  49 + ...data,
  50 + communityId: data.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 deleteMaintainanceItem(data) {
  63 + return new Promise((resolve, reject) => {
  64 + request({
  65 + url: '/maintainance.deleteMaintainanceItem',
  66 + method: 'post',
  67 + data: {
  68 + ...data,
  69 + communityId: data.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/addMaintainanceItem.vue 0 → 100644
  1 +<template>
  2 + <el-dialog :title="$t('maintainanceItem.add.title')" :visible.sync="visible" width="50%" @close="handleClose">
  3 + <el-form ref="form" :model="form" :rules="rules" label-width="120px">
  4 + <el-form-item :label="$t('maintainanceItem.form.itemTitle')" prop="itemTitle">
  5 + <el-input v-model="form.itemTitle" :placeholder="$t('maintainanceItem.form.itemTitlePlaceholder')" />
  6 + </el-form-item>
  7 +
  8 + <el-form-item :label="$t('maintainanceItem.form.titleType')" prop="titleType">
  9 + <el-select v-model="form.titleType" :placeholder="$t('maintainanceItem.form.titleTypePlaceholder')"
  10 + style="width:100%" @change="handleTitleTypeChange">
  11 + <el-option v-for="item in titleTypeOptions" :key="item.value" :label="item.label" :value="item.value" />
  12 + </el-select>
  13 + </el-form-item>
  14 +
  15 + <template v-if="form.titleType && form.titleType !== '3003'">
  16 + <el-form-item v-for="(item, index) in form.titleValues" :key="index"
  17 + :label="`${$t('maintainanceItem.form.option')} ${index + 1}`" :prop="'titleValues.' + index + '.itemValue'"
  18 + :rules="{
  19 + required: true,
  20 + message: $t('maintainanceItem.form.optionRequired'),
  21 + trigger: 'blur'
  22 + }">
  23 + <el-row :gutter="10">
  24 + <el-col :span="20">
  25 + <el-input v-model="item.itemValue" :placeholder="$t('maintainanceItem.form.optionPlaceholder')" />
  26 + </el-col>
  27 + <el-col :span="3">
  28 + <el-button v-if="index === form.titleValues.length - 1" type="text" @click="handleAddOption">
  29 + {{ $t('common.add') }}
  30 + </el-button>
  31 + <el-button v-else type="text" @click="handleRemoveOption(index)">
  32 + {{ $t('common.delete') }}
  33 + </el-button>
  34 + </el-col>
  35 + </el-row>
  36 + </el-form-item>
  37 + </template>
  38 +
  39 + <el-form-item :label="$t('maintainanceItem.form.seq')" prop="seq">
  40 + <el-input v-model.number="form.seq" :placeholder="$t('maintainanceItem.form.seqPlaceholder')" />
  41 + </el-form-item>
  42 + </el-form>
  43 +
  44 + <span slot="footer" class="dialog-footer">
  45 + <el-button @click="visible = false">
  46 + {{ $t('common.cancel') }}
  47 + </el-button>
  48 + <el-button type="primary" @click="handleSubmit">
  49 + {{ $t('common.confirm') }}
  50 + </el-button>
  51 + </span>
  52 + </el-dialog>
  53 +</template>
  54 +
  55 +<script>
  56 +import { saveMaintainanceItem } from '@/api/inspection/maintainanceItemApi'
  57 +
  58 +export default {
  59 + name: 'AddMaintainanceItem',
  60 + data() {
  61 + return {
  62 + visible: false,
  63 + form: {
  64 + titleType: '',
  65 + itemTitle: '',
  66 + seq: '',
  67 + titleValues: [],
  68 + communityId: ''
  69 + },
  70 + rules: {
  71 + itemTitle: [
  72 + { required: true, message: this.$t('maintainanceItem.form.itemTitleRequired'), trigger: 'blur' }
  73 + ],
  74 + titleType: [
  75 + { required: true, message: this.$t('maintainanceItem.form.titleTypeRequired'), trigger: 'change' }
  76 + ],
  77 + seq: [
  78 + { required: true, message: this.$t('maintainanceItem.form.seqRequired'), trigger: 'blur' },
  79 + { type: 'number', message: this.$t('maintainanceItem.form.seqNumber'), trigger: 'blur' }
  80 + ]
  81 + },
  82 + titleTypeOptions: [
  83 + { value: '1001', label: this.$t('maintainanceItem.titleType.single') },
  84 + { value: '2002', label: this.$t('maintainanceItem.titleType.multiple') },
  85 + { value: '3003', label: this.$t('maintainanceItem.titleType.shortAnswer') }
  86 + ]
  87 + }
  88 + },
  89 + methods: {
  90 + open(data) {
  91 + this.resetForm()
  92 + if (data) {
  93 + this.form.communityId = data.communityId
  94 + }
  95 + this.visible = true
  96 + },
  97 + resetForm() {
  98 + this.form = {
  99 + titleType: '',
  100 + itemTitle: '',
  101 + seq: '',
  102 + titleValues: [],
  103 + communityId: this.form.communityId || ''
  104 + }
  105 + this.$nextTick(() => {
  106 + this.$refs.form && this.$refs.form.resetFields()
  107 + })
  108 + },
  109 + handleClose() {
  110 + this.resetForm()
  111 + },
  112 + handleTitleTypeChange(value) {
  113 + this.form.titleValues = []
  114 + if (value === '1001') {
  115 + this.form.titleValues = [{ itemValue: '', seq: 1 }]
  116 + } else if (value === '2002') {
  117 + this.form.titleValues = [
  118 + { itemValue: '', seq: 1 },
  119 + { itemValue: '', seq: 2 }
  120 + ]
  121 + }
  122 + },
  123 + handleAddOption() {
  124 + this.form.titleValues.push({
  125 + itemValue: '',
  126 + seq: this.form.titleValues.length + 1
  127 + })
  128 + },
  129 + handleRemoveOption(index) {
  130 + this.form.titleValues.splice(index, 1)
  131 + // 重新排序
  132 + this.form.titleValues.forEach((item, i) => {
  133 + item.seq = i + 1
  134 + })
  135 + },
  136 + handleSubmit() {
  137 + this.$refs.form.validate(async valid => {
  138 + if (valid) {
  139 + try {
  140 + await saveMaintainanceItem(this.form)
  141 + this.$message.success(this.$t('common.saveSuccess'))
  142 + this.$emit('success')
  143 + this.visible = false
  144 + } catch (error) {
  145 + this.$message.error(error.message || this.$t('common.saveFailed'))
  146 + }
  147 + }
  148 + })
  149 + }
  150 + }
  151 +}
  152 +</script>
0 153 \ No newline at end of file
... ...
src/components/inspection/deleteMaintainanceItem.vue 0 → 100644
  1 +<template>
  2 + <el-dialog
  3 + :title="$t('maintainanceItem.delete.title')"
  4 + :visible.sync="visible"
  5 + width="30%"
  6 + @close="handleClose"
  7 + >
  8 + <div class="delete-content">
  9 + <p>{{ $t('maintainanceItem.delete.confirmText') }}</p>
  10 + <p class="delete-item">{{ form.itemTitle }}</p>
  11 + </div>
  12 +
  13 + <span slot="footer" class="dialog-footer">
  14 + <el-button @click="visible = false">
  15 + {{ $t('common.cancel') }}
  16 + </el-button>
  17 + <el-button type="primary" @click="handleConfirm">
  18 + {{ $t('common.confirm') }}
  19 + </el-button>
  20 + </span>
  21 + </el-dialog>
  22 +</template>
  23 +
  24 +<script>
  25 +import { deleteMaintainanceItem } from '@/api/inspection/maintainanceItemApi'
  26 +
  27 +export default {
  28 + name: 'DeleteMaintainanceItem',
  29 + data() {
  30 + return {
  31 + visible: false,
  32 + form: {
  33 + itemId: '',
  34 + itemTitle: '',
  35 + communityId: ''
  36 + }
  37 + }
  38 + },
  39 + methods: {
  40 + open(data) {
  41 + if (data) {
  42 + this.form = {
  43 + itemId: data.itemId,
  44 + itemTitle: data.itemTitle,
  45 + communityId: data.communityId || ''
  46 + }
  47 + }
  48 + this.visible = true
  49 + },
  50 + handleClose() {
  51 + this.form = {
  52 + itemId: '',
  53 + itemTitle: '',
  54 + communityId: ''
  55 + }
  56 + },
  57 + async handleConfirm() {
  58 + try {
  59 + await deleteMaintainanceItem({
  60 + itemId: this.form.itemId,
  61 + communityId: this.form.communityId
  62 + })
  63 + this.$message.success(this.$t('common.deleteSuccess'))
  64 + this.$emit('success')
  65 + this.visible = false
  66 + } catch (error) {
  67 + this.$message.error(error.message || this.$t('common.deleteFailed'))
  68 + }
  69 + }
  70 + }
  71 +}
  72 +</script>
  73 +
  74 +<style lang="scss" scoped>
  75 +.delete-content {
  76 + text-align: center;
  77 + font-size: 16px;
  78 +
  79 + .delete-item {
  80 + font-weight: bold;
  81 + color: #f56c6c;
  82 + margin-top: 10px;
  83 + }
  84 +}
  85 +</style>
0 86 \ No newline at end of file
... ...
src/components/inspection/editMaintainanceItem.vue 0 → 100644
  1 +<template>
  2 + <el-dialog :title="$t('maintainanceItem.edit.title')" :visible.sync="visible" width="50%" @close="handleClose">
  3 + <el-form ref="form" :model="form" :rules="rules" label-width="120px">
  4 + <el-form-item :label="$t('maintainanceItem.form.titleType')" prop="titleType">
  5 + <el-select v-model="form.titleType" :placeholder="$t('maintainanceItem.form.titleTypePlaceholder')"
  6 + style="width:100%" @change="handleTitleTypeChange">
  7 + <el-option v-for="item in titleTypeOptions" :key="item.value" :label="item.label" :value="item.value" />
  8 + </el-select>
  9 + </el-form-item>
  10 +
  11 + <el-form-item :label="$t('maintainanceItem.form.itemTitle')" prop="itemTitle">
  12 + <el-input v-model="form.itemTitle" :placeholder="$t('maintainanceItem.form.itemTitlePlaceholder')" />
  13 + </el-form-item>
  14 +
  15 + <template v-if="form.titleType && form.titleType !== '3003'">
  16 + <el-form-item v-for="(item, index) in form.titleValues" :key="index"
  17 + :label="`${$t('maintainanceItem.form.option')} ${index + 1}`" :prop="'titleValues.' + index + '.itemValue'"
  18 + :rules="{
  19 + required: true,
  20 + message: $t('maintainanceItem.form.optionRequired'),
  21 + trigger: 'blur'
  22 + }">
  23 + <el-row :gutter="10">
  24 + <el-col :span="20">
  25 + <el-input v-model="item.itemValue" :placeholder="$t('maintainanceItem.form.optionPlaceholder')" />
  26 + </el-col>
  27 + <el-col :span="3">
  28 + <el-button v-if="index === form.titleValues.length - 1" type="text" @click="handleAddOption">
  29 + {{ $t('common.add') }}
  30 + </el-button>
  31 + <el-button v-else type="text" @click="handleRemoveOption(index)">
  32 + {{ $t('common.delete') }}
  33 + </el-button>
  34 + </el-col>
  35 + </el-row>
  36 + </el-form-item>
  37 + </template>
  38 +
  39 + <el-form-item :label="$t('maintainanceItem.form.seq')" prop="seq">
  40 + <el-input v-model.number="form.seq" :placeholder="$t('maintainanceItem.form.seqPlaceholder')" />
  41 + </el-form-item>
  42 + </el-form>
  43 +
  44 + <span slot="footer" class="dialog-footer">
  45 + <el-button @click="visible = false">
  46 + {{ $t('common.cancel') }}
  47 + </el-button>
  48 + <el-button type="primary" @click="handleSubmit">
  49 + {{ $t('common.confirm') }}
  50 + </el-button>
  51 + </span>
  52 + </el-dialog>
  53 +</template>
  54 +
  55 +<script>
  56 +import { updateMaintainanceItem } from '@/api/inspection/maintainanceItemApi'
  57 +
  58 +export default {
  59 + name: 'EditMaintainanceItem',
  60 + data() {
  61 + return {
  62 + visible: false,
  63 + form: {
  64 + titleId: '',
  65 + titleType: '',
  66 + itemTitle: '',
  67 + seq: '',
  68 + titleValues: [],
  69 + communityId: ''
  70 + },
  71 + rules: {
  72 + itemTitle: [
  73 + { required: true, message: this.$t('maintainanceItem.form.itemTitleRequired'), trigger: 'blur' }
  74 + ],
  75 + titleType: [
  76 + { required: true, message: this.$t('maintainanceItem.form.titleTypeRequired'), trigger: 'change' }
  77 + ],
  78 + seq: [
  79 + { required: true, message: this.$t('maintainanceItem.form.seqRequired'), trigger: 'blur' },
  80 + ]
  81 + },
  82 + titleTypeOptions: [
  83 + { value: '1001', label: this.$t('maintainanceItem.titleType.single') },
  84 + { value: '2002', label: this.$t('maintainanceItem.titleType.multiple') },
  85 + { value: '3003', label: this.$t('maintainanceItem.titleType.shortAnswer') }
  86 + ]
  87 + }
  88 + },
  89 + methods: {
  90 + open(data) {
  91 + this.resetForm()
  92 + if (data) {
  93 + this.form = {
  94 + ...this.form,
  95 + titleId: data.titleId,
  96 + itemId: data.itemId,
  97 + titleType: data.titleType,
  98 + itemTitle: data.itemTitle,
  99 + seq: data.seq,
  100 + titleValues: data.titleValues || [],
  101 + communityId: data.communityId
  102 + }
  103 + }
  104 + this.visible = true
  105 + },
  106 + resetForm() {
  107 + this.form = {
  108 + titleId: '',
  109 + titleType: '',
  110 + itemTitle: '',
  111 + seq: '',
  112 + titleValues: [],
  113 + communityId: ''
  114 + }
  115 + this.$nextTick(() => {
  116 + this.$refs.form && this.$refs.form.resetFields()
  117 + })
  118 + },
  119 + handleClose() {
  120 + this.resetForm()
  121 + },
  122 + handleTitleTypeChange(value) {
  123 + if (value === '3003') {
  124 + this.form.titleValues = []
  125 + } else if (value === '1001' && (!this.form.titleValues || this.form.titleValues.length === 0)) {
  126 + this.form.titleValues = [{ itemValue: '', seq: 1 }]
  127 + } else if (value === '2002' && (!this.form.titleValues || this.form.titleValues.length === 0)) {
  128 + this.form.titleValues = [
  129 + { itemValue: '', seq: 1 },
  130 + { itemValue: '', seq: 2 }
  131 + ]
  132 + }
  133 + },
  134 + handleAddOption() {
  135 + this.form.titleValues.push({
  136 + itemValue: '',
  137 + seq: this.form.titleValues.length + 1
  138 + })
  139 + },
  140 + handleRemoveOption(index) {
  141 + this.form.titleValues.splice(index, 1)
  142 + // 重新排序
  143 + this.form.titleValues.forEach((item, i) => {
  144 + item.seq = i + 1
  145 + })
  146 + },
  147 + handleSubmit() {
  148 + this.$refs.form.validate(async valid => {
  149 + if (valid) {
  150 + try {
  151 + await updateMaintainanceItem(this.form)
  152 + this.$message.success(this.$t('common.updateSuccess'))
  153 + this.$emit('success')
  154 + this.visible = false
  155 + } catch (error) {
  156 + this.$message.error(error.message || this.$t('common.updateFailed'))
  157 + }
  158 + }
  159 + })
  160 + }
  161 + }
  162 +}
  163 +</script>
0 164 \ No newline at end of file
... ...
src/i18n/index.js
... ... @@ -204,6 +204,7 @@ import { messages as addEquipmentAccountMessages } from &#39;../views/machine/addEqu
204 204 import { messages as editEquipmentAccountMessages } from '../views/machine/editEquipmentAccountLang'
205 205 import { messages as equipmentAccountDetailMessages } from '../views/machine/equipmentAccountDetailLang'
206 206 import { messages as printEquipmentAccountLabelMessages } from '../views/resource/printEquipmentAccountLabelLang'
  207 +import {messages as inspectioni18n} from './inspectionI18n'
207 208  
208 209 Vue.use(VueI18n)
209 210  
... ... @@ -412,6 +413,7 @@ const messages = {
412 413 ...editEquipmentAccountMessages.en,
413 414 ...equipmentAccountDetailMessages.en,
414 415 ...printEquipmentAccountLabelMessages.en,
  416 + ...inspectioni18n.en,
415 417 },
416 418 zh: {
417 419 ...loginMessages.zh,
... ... @@ -616,6 +618,7 @@ const messages = {
616 618 ...editEquipmentAccountMessages.zh,
617 619 ...equipmentAccountDetailMessages.zh,
618 620 ...printEquipmentAccountLabelMessages.zh,
  621 + ...inspectioni18n.zh,
619 622 }
620 623 }
621 624  
... ...
src/i18n/inspectionI18n.js 0 → 100644
  1 +import { messages as maintainanceItemMessages } from '../views/inspection/maintainanceItemLang'
  2 +export const messages = {
  3 + en: {
  4 + ...maintainanceItemMessages.en,
  5 + },
  6 + zh: {
  7 + ...maintainanceItemMessages.zh,
  8 + }
  9 +
  10 +}
0 11 \ No newline at end of file
... ...
src/router/index.js
... ... @@ -3,6 +3,7 @@ import VueRouter from &#39;vue-router&#39;
3 3 import Layout from '@/views/layout/layout.vue'
4 4 import Login from '@/views/user/login/Login.vue'
5 5 import printEquipmentAccountLabel from '@/views/resource/printEquipmentAccountLabelList.vue'
  6 +import inspectionRouter from './inspectionRouter'
6 7  
7 8 Vue.use(VueRouter)
8 9  
... ... @@ -327,26 +328,7 @@ const routes = [
327 328 name: '/views/work/adminRepairDetail',
328 329 component: () => import('@/views/work/adminRepairDetailList.vue')
329 330 },
330   - {
331   - path: '/pages/inspection/adminInspectionPlan',
332   - name: '/pages/inspection/adminInspectionPlan',
333   - component: () => import('@/views/inspection/adminInspectionPlanList.vue')
334   - },
335   - {
336   - path: '/pages/inspection/aInspectionPlanDetail',
337   - name: '/pages/inspection/aInspectionPlanDetail',
338   - component: () => import('@/views/inspection/aInspectionPlanDetailList.vue')
339   - },
340   - {
341   - path: '/pages/inspection/adminInspectionTask',
342   - name: '/pages/inspection/adminInspectionTask',
343   - component: () => import('@/views/inspection/adminInspectionTaskList.vue')
344   - },
345   - {
346   - path: '/views/inspection/adminInspectionTaskDetail',
347   - name: '/views/inspection/adminInspectionTaskDetail',
348   - component: () => import('@/views/inspection/adminInspectionTaskDetailList.vue')
349   - },
  331 +
350 332 {
351 333 path: '/pages/complaint/adminComplaint',
352 334 name: '/pages/complaint/adminComplaint',
... ... @@ -842,36 +824,7 @@ const routes = [
842 824 name: '/pages/property/repairForceFinishManage',
843 825 component: () => import('@/views/work/repairForceFinishManageList.vue')
844 826 },
845   - {
846   - path: '/pages/property/inspectionItemManage',
847   - name: '/pages/property/inspectionItemManage',
848   - component: () => import('@/views/inspection/inspectionItemManageList.vue')
849   - },
850   - {
851   - path: '/views/inspection/inspectionItemTitleManage',
852   - name: '/views/inspection/inspectionItemTitleManage',
853   - component: () => import('@/views/inspection/inspectionItemTitleManageList.vue')
854   - },
855   - {
856   - path: '/pages/inspection/inspectionPlan',
857   - name: '/pages/inspection/inspectionPlan',
858   - component: () => import('@/views/inspection/inspectionPlanList.vue')
859   - },
860   - {
861   - path: '/views/inspection/addInspectionPlan',
862   - name: '/views/inspection/addInspectionPlan',
863   - component: () => import('@/views/inspection/addInspectionPlanList.vue')
864   - },
865   - {
866   - path: '/pages/inspection/inspectionTask',
867   - name: '/pages/inspection/inspectionTask',
868   - component: () => import('@/views/inspection/InspectionTaskList.vue')
869   - },
870   - {
871   - path: '/pages/property/inspectionTaskDetails',
872   - name: '/pages/property/inspectionTaskDetails',
873   - component: () => import('@/views/inspection/inspectionTaskDetailsList.vue')
874   - },
  827 +
875 828 {
876 829 path: '/pages/resource/resourceAuditFlow',
877 830 name: '/pages/resource/resourceAuditFlow',
... ... @@ -892,16 +845,7 @@ const routes = [
892 845 name: '/pages/common/resourceStoreManage',
893 846 component: () => import('@/views/resource/resourceStoreManageList.vue')
894 847 },
895   - {
896   - path: '/pages/inspection/inspectionPoint',
897   - name: '/pages/inspection/inspectionPoint',
898   - component: () => import('@/views/inspection/inspectionPointList.vue')
899   - },
900   - {
901   - path: '/pages/inspection/inspectionRoute',
902   - name: '/pages/inspection/inspectionRoute',
903   - component: () => import('@/views/inspection/inspectionRouteList.vue')
904   - },
  848 +
905 849 {
906 850 path: '/pages/property/resourceSupplierManage',
907 851 name: '/pages/property/resourceSupplierManage',
... ... @@ -1007,7 +951,7 @@ const routes = [
1007 951 name: '/views/machine/equipmentAccountDetail',
1008 952 component: () => import('@/views/machine/equipmentAccountDetailList.vue')
1009 953 },
1010   -
  954 + ...inspectionRouter
1011 955 // 其他子路由可以在这里添加
1012 956 ]
1013 957 },
... ...
src/router/inspectionRouter.js 0 → 100644
  1 +export default [
  2 + {
  3 + path: '/pages/inspection/inspectionPoint',
  4 + name: '/pages/inspection/inspectionPoint',
  5 + component: () => import('@/views/inspection/inspectionPointList.vue')
  6 + },
  7 + {
  8 + path: '/pages/inspection/inspectionRoute',
  9 + name: '/pages/inspection/inspectionRoute',
  10 + component: () => import('@/views/inspection/inspectionRouteList.vue')
  11 + },
  12 + {
  13 + path: '/pages/inspection/adminInspectionPlan',
  14 + name: '/pages/inspection/adminInspectionPlan',
  15 + component: () => import('@/views/inspection/adminInspectionPlanList.vue')
  16 + },
  17 + {
  18 + path: '/pages/inspection/aInspectionPlanDetail',
  19 + name: '/pages/inspection/aInspectionPlanDetail',
  20 + component: () => import('@/views/inspection/aInspectionPlanDetailList.vue')
  21 + },
  22 + {
  23 + path: '/pages/inspection/adminInspectionTask',
  24 + name: '/pages/inspection/adminInspectionTask',
  25 + component: () => import('@/views/inspection/adminInspectionTaskList.vue')
  26 + },
  27 + {
  28 + path: '/views/inspection/adminInspectionTaskDetail',
  29 + name: '/views/inspection/adminInspectionTaskDetail',
  30 + component: () => import('@/views/inspection/adminInspectionTaskDetailList.vue')
  31 + },
  32 + {
  33 + path: '/pages/property/inspectionItemManage',
  34 + name: '/pages/property/inspectionItemManage',
  35 + component: () => import('@/views/inspection/inspectionItemManageList.vue')
  36 + },
  37 + {
  38 + path: '/views/inspection/inspectionItemTitleManage',
  39 + name: '/views/inspection/inspectionItemTitleManage',
  40 + component: () => import('@/views/inspection/inspectionItemTitleManageList.vue')
  41 + },
  42 + {
  43 + path: '/pages/inspection/inspectionPlan',
  44 + name: '/pages/inspection/inspectionPlan',
  45 + component: () => import('@/views/inspection/inspectionPlanList.vue')
  46 + },
  47 + {
  48 + path: '/views/inspection/addInspectionPlan',
  49 + name: '/views/inspection/addInspectionPlan',
  50 + component: () => import('@/views/inspection/addInspectionPlanList.vue')
  51 + },
  52 + {
  53 + path: '/pages/inspection/inspectionTask',
  54 + name: '/pages/inspection/inspectionTask',
  55 + component: () => import('@/views/inspection/InspectionTaskList.vue')
  56 + },
  57 + {
  58 + path: '/pages/property/inspectionTaskDetails',
  59 + name: '/pages/property/inspectionTaskDetails',
  60 + component: () => import('@/views/inspection/inspectionTaskDetailsList.vue')
  61 + },
  62 + {
  63 + path: '/pages/property/maintainanceItem',
  64 + name: '/pages/property/maintainanceItem',
  65 + component: () => import('@/views/inspection/maintainanceItemList.vue')
  66 + },
  67 +]
0 68 \ No newline at end of file
... ...
src/views/inspection/maintainanceItemLang.js 0 → 100644
  1 +export const messages = {
  2 + en: {
  3 + maintainanceItem: {
  4 + search: {
  5 + title: 'Search Conditions',
  6 + itemTitle: 'Please enter item name',
  7 + titleType: 'Please select title type'
  8 + },
  9 + list: {
  10 + title: 'Inspection Items'
  11 + },
  12 + table: {
  13 + itemTitle: 'Name',
  14 + titleType: 'Type',
  15 + seq: 'Sequence',
  16 + createTime: 'Create Time'
  17 + },
  18 + titleType: {
  19 + single: 'Single Choice',
  20 + multiple: 'Multiple Choice',
  21 + shortAnswer: 'Short Answer'
  22 + },
  23 + form: {
  24 + itemTitle: 'Name',
  25 + itemTitlePlaceholder: 'Please enter name',
  26 + itemTitleRequired: 'Name is required',
  27 + titleType: 'Type',
  28 + titleTypePlaceholder: 'Please select type',
  29 + titleTypeRequired: 'Type is required',
  30 + option: 'Option',
  31 + optionPlaceholder: 'Please enter option content',
  32 + optionRequired: 'Option content is required',
  33 + seq: 'Sequence',
  34 + seqPlaceholder: 'Please enter sequence',
  35 + seqRequired: 'Sequence is required',
  36 + seqNumber: 'Sequence must be a number'
  37 + },
  38 + add: {
  39 + title: 'Add Item'
  40 + },
  41 + edit: {
  42 + title: 'Edit Item'
  43 + },
  44 + delete: {
  45 + title: 'Confirm Operation',
  46 + confirmText: 'Are you sure to delete this item?'
  47 + },
  48 + fetchError: 'Failed to fetch data'
  49 + }
  50 + },
  51 + zh: {
  52 + maintainanceItem: {
  53 + search: {
  54 + title: '查询条件',
  55 + itemTitle: '请输入问题名称',
  56 + titleType: '请选择题目类型'
  57 + },
  58 + list: {
  59 + title: '检查项'
  60 + },
  61 + table: {
  62 + itemTitle: '名称',
  63 + titleType: '类型',
  64 + seq: '顺序',
  65 + createTime: '创建时间'
  66 + },
  67 + titleType: {
  68 + single: '单选',
  69 + multiple: '多选',
  70 + shortAnswer: '简答'
  71 + },
  72 + form: {
  73 + itemTitle: '名称',
  74 + itemTitlePlaceholder: '请输入名称',
  75 + itemTitleRequired: '名称不能为空',
  76 + titleType: '类型',
  77 + titleTypePlaceholder: '请选择类型',
  78 + titleTypeRequired: '类型不能为空',
  79 + option: '选项',
  80 + optionPlaceholder: '请输入选项内容',
  81 + optionRequired: '选项内容不能为空',
  82 + seq: '顺序',
  83 + seqPlaceholder: '请输入顺序',
  84 + seqRequired: '顺序不能为空',
  85 + seqNumber: '顺序必须是数字'
  86 + },
  87 + add: {
  88 + title: '添加检查项'
  89 + },
  90 + edit: {
  91 + title: '修改检查项'
  92 + },
  93 + delete: {
  94 + title: '确认操作',
  95 + confirmText: '确定删除该题目吗?'
  96 + },
  97 + fetchError: '获取数据失败'
  98 + }
  99 + }
  100 +}
0 101 \ No newline at end of file
... ...
src/views/inspection/maintainanceItemList.vue 0 → 100644
  1 +<template>
  2 + <div class="maintainance-item-container">
  3 + <!-- 查询条件 -->
  4 + <el-card class="search-wrapper">
  5 + <div slot="header" class="flex justify-between">
  6 + <span>{{ $t('maintainanceItem.search.title') }}</span>
  7 + </div>
  8 + <el-row :gutter="20">
  9 + <el-col :span="6">
  10 + <el-input v-model="searchForm.itemTitle" :placeholder="$t('maintainanceItem.search.itemTitle')" clearable
  11 + @keyup.enter.native="handleSearch" />
  12 + </el-col>
  13 + <el-col :span="6">
  14 + <el-select v-model="searchForm.titleType" :placeholder="$t('maintainanceItem.search.titleType')"
  15 + style="width:100%" clearable>
  16 + <el-option v-for="item in titleTypeOptions" :key="item.value" :label="item.label" :value="item.value" />
  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-button @click="handleReset">
  24 + {{ $t('common.reset') }}
  25 + </el-button>
  26 + </el-col>
  27 + </el-row>
  28 + </el-card>
  29 +
  30 + <!-- 列表区域 -->
  31 + <el-card class="list-wrapper">
  32 + <div slot="header" class="flex justify-between">
  33 + <span>{{ $t('maintainanceItem.list.title') }}</span>
  34 + <div style="float: right;">
  35 + <el-button type="primary" size="small" @click="handleGoBack">
  36 + {{ $t('common.back') }}
  37 + </el-button>
  38 + <el-button type="primary" size="small" @click="handleShowDocument">
  39 + {{ $t('common.document') }}
  40 + </el-button>
  41 + <el-button type="primary" size="small" @click="handleAdd">
  42 + <i class="el-icon-plus" /> {{ $t('common.add') }}
  43 + </el-button>
  44 + </div>
  45 + </div>
  46 +
  47 + <el-table v-loading="loading" :data="tableData" border style="width: 100%">
  48 + <el-table-column prop="itemTitle" :label="$t('maintainanceItem.table.itemTitle')" align="center" />
  49 + <el-table-column prop="titleType" :label="$t('maintainanceItem.table.titleType')" align="center">
  50 + <template slot-scope="scope">
  51 + {{ getTitleTypeName(scope.row.titleType) }}
  52 + </template>
  53 + </el-table-column>
  54 + <el-table-column prop="seq" :label="$t('maintainanceItem.table.seq')" align="center" />
  55 + <el-table-column prop="createTime" :label="$t('maintainanceItem.table.createTime')" align="center" />
  56 + <el-table-column :label="$t('common.operation')" align="center" width="200">
  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 + </template>
  65 + </el-table-column>
  66 + </el-table>
  67 +
  68 + <el-pagination :current-page="pagination.current" :page-sizes="[10, 20, 30, 50]" :page-size="pagination.size"
  69 + :total="pagination.total" layout="total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange"
  70 + @current-change="handleCurrentChange" />
  71 + </el-card>
  72 +
  73 + <!-- 子组件 -->
  74 + <add-maintainance-item ref="addDialog" @success="handleSuccess" />
  75 + <edit-maintainance-item ref="editDialog" @success="handleSuccess" />
  76 + <delete-maintainance-item ref="deleteDialog" @success="handleSuccess" />
  77 + </div>
  78 +</template>
  79 +
  80 +<script>
  81 +import { listMaintainanceItem } from '@/api/inspection/maintainanceItemApi'
  82 +import AddMaintainanceItem from '@/components/inspection/addMaintainanceItem'
  83 +import EditMaintainanceItem from '@/components/inspection/editMaintainanceItem'
  84 +import DeleteMaintainanceItem from '@/components/inspection/deleteMaintainanceItem'
  85 +import { getCommunityId } from '@/api/community/communityApi'
  86 +
  87 +export default {
  88 + name: 'MaintainanceItemList',
  89 + components: {
  90 + AddMaintainanceItem,
  91 + EditMaintainanceItem,
  92 + DeleteMaintainanceItem
  93 + },
  94 + data() {
  95 + return {
  96 + loading: false,
  97 + searchForm: {
  98 + itemTitle: '',
  99 + titleType: '',
  100 + communityId: ''
  101 + },
  102 + tableData: [],
  103 + pagination: {
  104 + current: 1,
  105 + size: 10,
  106 + total: 0
  107 + },
  108 + titleTypeOptions: [
  109 + { value: '1001', label: this.$t('maintainanceItem.titleType.single') },
  110 + { value: '2002', label: this.$t('maintainanceItem.titleType.multiple') },
  111 + { value: '3003', label: this.$t('maintainanceItem.titleType.shortAnswer') }
  112 + ]
  113 + }
  114 + },
  115 + created() {
  116 + this.searchForm.communityId = getCommunityId()
  117 + this.getList()
  118 + },
  119 + methods: {
  120 + async getList() {
  121 + try {
  122 + this.loading = true
  123 + const params = {
  124 + ...this.searchForm,
  125 + page: this.pagination.current,
  126 + row: this.pagination.size
  127 + }
  128 + const { data, total } = await listMaintainanceItem(params)
  129 + this.tableData = data
  130 + this.pagination.total = total
  131 + } catch (error) {
  132 + this.$message.error(this.$t('maintainanceItem.fetchError'))
  133 + } finally {
  134 + this.loading = false
  135 + }
  136 + },
  137 + handleSearch() {
  138 + this.pagination.current = 1
  139 + this.getList()
  140 + },
  141 + handleReset() {
  142 + this.searchForm = {
  143 + itemTitle: '',
  144 + titleType: '',
  145 + communityId: getCommunityId()
  146 + }
  147 + this.handleSearch()
  148 + },
  149 + handleAdd() {
  150 + this.$refs.addDialog.open({
  151 + communityId: this.searchForm.communityId
  152 + })
  153 + },
  154 + handleEdit(row) {
  155 + this.$refs.editDialog.open(row)
  156 + },
  157 + handleDelete(row) {
  158 + this.$refs.deleteDialog.open(row)
  159 + },
  160 + handleSuccess() {
  161 + this.getList()
  162 + },
  163 + handleSizeChange(val) {
  164 + this.pagination.size = val
  165 + this.getList()
  166 + },
  167 + handleCurrentChange(val) {
  168 + this.pagination.current = val
  169 + this.getList()
  170 + },
  171 + handleGoBack() {
  172 + this.$router.go(-1)
  173 + },
  174 + handleShowDocument() {
  175 + // 显示文档逻辑
  176 + },
  177 + getTitleTypeName(type) {
  178 + const option = this.titleTypeOptions.find(item => item.value === type)
  179 + return option ? option.label : ''
  180 + }
  181 + }
  182 +}
  183 +</script>
  184 +
  185 +<style lang="scss" scoped>
  186 +.maintainance-item-container {
  187 + padding: 20px;
  188 +
  189 + .search-wrapper {
  190 + margin-bottom: 20px;
  191 +
  192 + .el-row {
  193 + margin-bottom: 20px;
  194 +
  195 + &:last-child {
  196 + margin-bottom: 0;
  197 + }
  198 + }
  199 + }
  200 +
  201 + .list-wrapper {
  202 + margin-bottom: 20px;
  203 + }
  204 +
  205 + .el-pagination {
  206 + margin-top: 20px;
  207 + text-align: right;
  208 + }
  209 +}
  210 +</style>
0 211 \ No newline at end of file
... ...