Browse Source

'save'

main
hflllll 2 months ago
parent
commit
678ee0578b
9 changed files with 199 additions and 90 deletions
  1. +18
    -1
      api/modules/config.js
  2. +3
    -1
      api/modules/exhibit.js
  3. +32
    -17
      pages/index/home.vue
  4. +2
    -2
      pages/index/maintain.vue
  5. +40
    -6
      stores/index.js
  6. +77
    -52
      subPages/home/RAArecord.vue
  7. +4
    -4
      subPages/home/maintainanceSubmit.vue
  8. +11
    -5
      subPages/home/repairSubmit.vue
  9. +12
    -2
      subPages/repair/maintainSubmit.vue

+ 18
- 1
api/modules/config.js View File

@ -22,5 +22,22 @@ export default {
url: '/config/queryCategoryList',
method: 'GET'
})
}
},
// 获取故障情况列表
async queryMalfunctionDescList(data) {
return http({
url: '/config/queryMalfunctionDescList',
method: 'GET',
data
})
},
// 获取人员情况
async queryUserList() {
return http({
url: '/userInfo/queryUserList',
method: 'GET'
})
},
}

+ 3
- 1
api/modules/exhibit.js View File

@ -89,5 +89,7 @@ export default {
showLoading: true,
needToken: true
})
}
},
}

+ 32
- 17
pages/index/home.vue View File

@ -15,18 +15,18 @@
<!-- 展品分类 -->
<view class="category-section" @click="openPicker">
<view class="category-label">展品分类</view>
<view class="category-label">{{ selectedCategory.label ||'展品分类' }}</view>
<uv-icon name="arrow-down-fill" size="14" color="#C70019"></uv-icon>
<uv-picker
<!-- <uv-picker
ref="picker"
v-model="categoryShow"
:columns="columns"
mode="selector"
@confirm="onCategoryConfirm"
confirmColor="#C70019"
>
</uv-picker>
</uv-picker> -->
<uv-picker ref="picker" confirmColor="#C70019" :columns="[columns[0], columns[1][0]]" keyName="label" @confirm="onCategoryConfirm" @change="onCategoryChange"></uv-picker>
</view>
<!-- 展品列表 -->
@ -52,7 +52,7 @@
</view>
<view class="content-row">
<text class="label">展品类型</text>
<text class="value">{{ item.type }}</text>
<text class="value">{{ item.categoryId_dictText }}</text>
</view>
<view class="content-row">
<text class="label">下次保养日期</text>
@ -111,16 +111,17 @@ export default {
return {
mixinListApi: 'exhibit.queryShowpieceList',
searchValue: '',
categoryShow: false,
selectedCategory: '',
columns: [
[
'全部',
'文字内容',
'互动设备',
'展示设备'
]
]
selectedCategory: {
label: '',
value: ''
},
}
},
computed: {
//
columns() {
return this.$store.state.categoryList
}
},
methods: {
@ -130,18 +131,32 @@ export default {
this.getList(true)
},
mixinSetParams() {
const params = { }
if (this.selectedCategory.value) {
params.categoryId = this.selectedCategory.value
}
return {
title: this.searchValue
title: this.searchValue,
...params
}
},
openPicker() {
this.$refs.picker.open()
},
onCategoryConfirm(e) {
this.selectedCategory = e.label
this.selectedCategory = e.value[1]
console.log('选择分类:', e)
this.initPage()
this.getList(true)
// TODO:
},
onCategoryChange(e) {
const { columnIndex , index} = e
if (columnIndex === 0) {
this.$refs.picker.setColumnValues(1, this.columns[1][index])
}
},
copyId(id) {
uni.setClipboardData({
data: id,


+ 2
- 2
pages/index/maintain.vue View File

@ -52,13 +52,13 @@
<view class="detail-row">
<view class="detail-item">
<text class="detail-label">展品位置</text>
<text class="detail-value">{{ item.position }}</text>
<text class="detail-value">{{ item.showpiece.position }}</text>
</view>
</view>
<view class="detail-row">
<view class="detail-item">
<text class="detail-label">报修人</text>
<text class="detail-value">{{ item.reporterName }}</text>
<text class="detail-value">{{ item.malfunctionName_dictText }}</text>
</view>
<view class="detail-item">
<text class="detail-label">报修日期</text>


+ 40
- 6
stores/index.js View File

@ -9,11 +9,47 @@ const store = new Vuex.Store({
// 存放状态
configList: [],
departmentList: [],
categoryList: []
},
mutations: {
// 分类列表
// 构造用于uv-picker的树状结构数组
setCategoryList(state, data) {
state.categoryList = data
// 将返回的平面数组data 根据pid和hasChild组装成两个数组,其一为pid为0的父级一维数组,其二为pid不为0的子级二维数组,其中pid相同的排一起 不同的分为不同子数组,并且按顺序排序,比如第一个为[中国,美国] 第二个按顺序为[[上海,福建],[纽约,华盛顿]]
// 分离父级和子级数据
const parentCategories = data.filter(item => item.pid === 0 || item.pid === '0')
const childCategories = data.filter(item => item.pid !== 0 && item.pid !== '0')
// 构建父级一维数组
const parentArray = parentCategories.map((item) => {
return {
label: item.name || item.title || item.categoryName,
value: item.id
}
})
// 构建子级二维数组
const childArray = []
parentCategories.forEach(parent => {
const children = childCategories
.filter(child => child.pid === parent.id)
.map(child => {
return {
label: child.name || child.title || child.categoryName,
value: child.id
}
})
childArray.push(children.length > 0 ? children : [{
label: '全部',
value: 0
}])
})
console.log('父数组','子数组',parentArray, childArray);
// 组装最终结果
state.categoryList = [parentArray, childArray]
console.log('最终数组', state.categoryList);
},
setConfigList(state, data) {
state.configList = data
@ -22,6 +58,7 @@ const store = new Vuex.Store({
state.departmentList = data
},
//
},
actions: {
// 查询配置列表
@ -37,7 +74,6 @@ const store = new Vuex.Store({
return acc
}, {})
commit('setConfigList', config)
},
// 查询部门列表
async getDepartment({ commit }) {
@ -62,15 +98,13 @@ const store = new Vuex.Store({
await Promise.all([
dispatch('getConfig'),
dispatch('getDepartment'),
// dispatch('getCategory'),
dispatch('getCategory'),
])
console.log('所有配置数据初始化完成')
} catch (error) {
console.error('配置数据初始化失败:', error)
}
},
}
})

+ 77
- 52
subPages/home/RAArecord.vue View File

@ -29,20 +29,28 @@
<text class="arrow-icon"></text>
</view>
<view class="picker-btn" :class="{ active: selectedPerson }" @click="showPersonPicker" >
<text class="btn-text">{{ selectedPerson || '人员' }}</text>
<text class="btn-text">{{ selectedPerson.label || '人员' }}</text>
<text class="arrow-icon"></text>
</view>
</view>
</view>
<!-- 时间选择器 -->
<uv-picker
<!-- <uv-picker
ref="timePicker"
:columns="timeColumns"
@confirm="onTimeConfirm"
@cancel="onTimeCancel"
title="选择时间范围"
confirmColor="#C70019"
></uv-picker>
></uv-picker> -->
<!-- 日期选择器 -->
<uv-datetime-picker
confirm-color="#C70019"
ref="timePicker"
mode="date"
@confirm="onTimeConfirm"
></uv-datetime-picker>
<!-- 人员选择器 -->
<uv-picker
@ -50,6 +58,7 @@
:columns="personColumns"
@confirm="onPersonConfirm"
@cancel="onPersonCancel"
keyName="label"
title="选择人员"
confirmColor="#C70019"
></uv-picker>
@ -86,11 +95,11 @@
</view>
<!-- 上传图片 -->
<view class="info-row" v-if="!record.isCollapsed">
<view class="info-row" v-if="!collapsedStates[index]">
<text class="label">上传图片</text>
</view>
<view class="image-container" v-if="!record.isCollapsed">
<view class="image-container" v-if="!collapsedStates[index]">
<image class="uploaded-image" :src="record.uploadImage" mode="aspectFill"></image>
</view>
@ -124,7 +133,7 @@
</view>
<!-- 保养前图片 -->
<view class="image-container" v-if="!record.isCollapsed">
<view class="image-container" v-if="!collapsedStates[index]">
<image
class="uploaded-image"
v-for="(img, imgIndex) in record.beforeImages"
@ -134,17 +143,17 @@
></image>
</view>
<view class="info-row" v-if="!record.isCollapsed">
<view class="info-row" v-if="!collapsedStates[index]">
<text class="label">保养后状态</text>
</view>
<!-- 保养后状态文本区域 -->
<view class="content-text" v-if="!record.isCollapsed">
<view class="content-text" v-if="!collapsedStates[index]">
<text>{{ record.afterStatus }}</text>
</view>
<!-- 保养后图片 -->
<view class="image-container" v-if="!record.isCollapsed">
<view class="image-container" v-if="!collapsedStates[index]">
<image
class="uploaded-image"
v-for="(img, imgIndex) in record.afterImages"
@ -155,33 +164,33 @@
</view>
<!-- 是否产生费用 -->
<view class="info-row" v-if="!record.isCollapsed">
<view class="info-row" v-if="!collapsedStates[index]">
<text class="label">是否产生费用</text>
<text class="value red-text">{{ record.hasCost }}</text>
</view>
</template>
<!-- 查看全部按钮收起状态时显示 -->
<!-- <view class="view-all-btn" v-if="record.isCollapsed" @click="toggleCollapse(index)">
<!-- <view class="view-all-btn" v-if="collapsedStates[index]" @click="toggleCollapse(index)">
<text class="view-all-text">查看全部</text>
<text class="view-all-icon"></text>
</view> -->
<!-- 产生费用 -->
<view class="info-row" v-if="!record.isCollapsed">
<view class="info-row" v-if="!collapsedStates[index]">
<text class="label">产生费用</text>
<text class="value red-text">{{ record.totalCost }}</text>
</view>
<!-- 费用详情表格 -->
<view class="cost-table" v-if="!record.isCollapsed">
<view class="cost-table" v-if="!collapsedStates[index]">
<view class="table-header">
<text class="header-cell">费用名称</text>
<text class="header-cell">数量</text>
<text class="header-cell">金额</text>
</view>
<view class="table-row" v-for="(item, index) in record.costDetails" :key="index">
<view class="table-row" v-for="(item, costIndex) in record.costDetails" :key="costIndex">
<text class="cell">{{ item.name }}</text>
<text class="cell">{{ item.quantity }}</text>
<text class="cell">{{ item.amount }}</text>
@ -191,18 +200,18 @@
<!-- 维修记录特有字段 -->
<template v-if="activeMainTab === 'repair'">
<!-- 问题是否解决 -->
<view class="info-row" v-if="!record.isCollapsed">
<view class="info-row" v-if="!collapsedStates[index]">
<text class="label">问题是否解决</text>
<text class="value red-text">{{ record.isResolved }}</text>
</view>
<!-- 备注 -->
<view class="info-row" v-if="!record.isCollapsed">
<view class="info-row" v-if="!collapsedStates[index]">
<text class="label">备注</text>
</view>
<!-- 备注文本区域 -->
<view class="content-text" v-if="!record.isCollapsed">
<view class="content-text" v-if="!collapsedStates[index]">
<text>{{ record.remark }}</text>
</view>
</template>
@ -210,35 +219,35 @@
<!-- 保养记录特有字段 -->
<template v-else>
<!-- 附件信息 -->
<view class="info-row" v-if="!record.isCollapsed">
<view class="info-row" v-if="!collapsedStates[index]">
<text class="label">附件信息</text>
</view>
<!-- 附件信息文本区域 -->
<view class="content-text" v-if="!record.isCollapsed">
<view class="content-text" v-if="!collapsedStates[index]">
<text>{{ record.attachmentInfo }}</text>
</view>
<!-- 附件图片 -->
<view class="image-container" v-if="!record.isCollapsed">
<view class="image-container" v-if="!collapsedStates[index]">
<image class="uploaded-image" :src="record.attachmentImage" mode="aspectFill"></image>
</view>
<!-- 保养备注 -->
<view class="info-row" v-if="!record.isCollapsed">
<view class="info-row" v-if="!collapsedStates[index]">
<text class="label">备注</text>
</view>
<!-- 保养备注文本区域 -->
<view class="content-text" v-if="!record.isCollapsed">
<view class="content-text" v-if="!collapsedStates[index]">
<text>{{ record.maintainRemark }}</text>
</view>
</template>
<!-- 收起按钮 -->
<view class="collapse-btn" @click="toggleCollapse(index)">
<text class="collapse-text">{{ record.isCollapsed ? '查看全部' : '收起' }}</text>
<text class="collapse-icon">{{ record.isCollapsed ? '▼' : '▲' }}</text>
<text class="collapse-text">{{ collapsedStates[index] ? '查看全部' : '收起' }}</text>
<text class="collapse-icon">{{ collapsedStates[index] ? '▼' : '▲' }}</text>
</view>
</view>
</view>
@ -256,6 +265,7 @@ export default {
mixinListApi: 'exhibit.queryRepairList',
activeMainTab: 'repair', // Tab
activeFilter: 0, //
collapsedStates: [], // /
filterOptions: [
{ name: '时间' },
{ name: '人员' }
@ -265,9 +275,7 @@ export default {
timeColumns: [
['今天', '昨天', '本周', '本月', '上月', '自定义']
],
personColumns: [
['张三', '李四', '王五', '赵六', '钱七', '孙八']
],
personColumns: [ ],
//
repairData: [
{
@ -284,7 +292,6 @@ export default {
],
isResolved: '是',
remark: '文字内容',
isCollapsed: true //
},
{
repairPerson: '李华',
@ -299,8 +306,7 @@ export default {
{ name: '达玛树脂', quantity: '1', amount: '200.00' }
],
isResolved: '是',
remark: '文字内容',
isCollapsed: true //
remark: '文字内容'
},
],
//
@ -320,8 +326,7 @@ export default {
],
attachmentInfo: '附件信息',
maintainRemark: '文字内容',
attachmentImage: '/static/商城_商品2.png',
isCollapsed: true //
attachmentImage: '/static/商城_商品2.png'
},
{
maintainPerson: '李华',
@ -338,16 +343,12 @@ export default {
],
attachmentInfo: '附件信息',
maintainRemark: '文字内容',
attachmentImage: '/static/商城_商品2.png',
isCollapsed: true //
attachmentImage: '/static/商城_商品2.png'
}
]
}
},
computed: {
// list() {
// return this.activeMainTab === 'repair' ? this.repairData : this.maintainData
// },
contentText() {
const tabText = this.activeMainTab === 'repair' ? '维修' : '保养'
const filterText = this.filterOptions[this.activeFilter].name
@ -364,18 +365,37 @@ export default {
},
methods: {
mixinSetParams() {
const params = { }
if (this.activeMainTab === 'repair' && this.selectedTime) {
params.repairDate = this.selectedTime
} else if (this.activeMainTab === 'maintain' && this.selectedTime) {
params.maintainDate = this.selectedTime
}
if (this.selectedPerson) {
params.id = this.selectedPerson.id
}
return {
showpieceId: this.showpieceId
showpieceId: this.showpieceId,
...params
}
},
switchMainTab(tab) {
async switchMainTab(tab) {
this.activeMainTab = tab
this.mixinListApi = this.activeMainTab === 'repair' ? 'exhibit.queryRepairList' : 'exhibit.queryMaintenanceList'
this.onFilterChange()
this.initPage()
await this.getList(true)
this.initCollapsedStates()
},
onFilterChange(index) {
this.activeFilter = index
initCollapsedStates() {
this.collapsedStates = new Array(this.list.length).fill(true)
},
onFilterChange() {
// this.activeFilter = index
//
this.selectedTime = ''
this.selectedPerson = ''
},
showTimePicker() {
this.$refs.timePicker.open()
@ -383,9 +403,11 @@ export default {
showPersonPicker() {
this.$refs.personPicker.open()
},
onTimeConfirm(value) {
this.selectedTime = value.value[0]
console.log('选择的时间:', value)
onTimeConfirm(e) {
const date = new Date(e.value)
this.selectedTime = `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`
this.initPage()
this.getList(true)
},
onTimeCancel() {
console.log('取消选择时间')
@ -393,22 +415,25 @@ export default {
onPersonConfirm(value) {
this.selectedPerson = value.value[0]
console.log('选择的人员:', value)
this.initPage()
this.getList(true)
},
onPersonCancel() {
console.log('取消选择人员')
},
toggleCollapse(index) {
if (this.activeMainTab === 'repair') {
this.repairData[index].isCollapsed = !this.repairData[index].isCollapsed
console.log('收起/展开费用详情', this.repairData[index].isCollapsed)
} else {
this.maintainData[index].isCollapsed = !this.maintainData[index].isCollapsed
console.log('收起/展开费用详情', this.maintainData[index].isCollapsed)
}
this.$set(this.collapsedStates, index, !this.collapsedStates[index])
console.log('收起/展开费用详情', this.collapsedStates[index])
}
},
onLoad(args){{
async onLoad(args){{
this.showpieceId = args.id
this.initCollapsedStates()
const userRes = await this.$api.config.queryUserList()
this.personColumns = [[...userRes.result.records.map(item => ({
label: item.nickName,
id: item.id
}))]]
}}
}
</script>


+ 4
- 4
subPages/home/maintainanceSubmit.vue View File

@ -210,7 +210,7 @@
<view class="form-item" @click="showNextDatePicker">
<text class="label">下次保养日期</text>
<view class="select-area">
<text class="value" :class="{ placeholder: !nextMaintenanceDate }">{{ nextMaintenanceDate || '请选择' }}</text>
<text class="value" :class="{ placeholder: !malfunctionDate }">{{ malfunctionDate || '请选择' }}</text>
<uv-icon name="arrow-down" size="18" color="#000"></uv-icon>
</view>
</view>
@ -276,7 +276,7 @@ export default {
costList: [],
remarkText: '',
remarkImage: [],
nextMaintenanceDate: '',
malfunctionDate: '',
remark: '',
showpieceId: '',
submiting: false
@ -312,7 +312,7 @@ export default {
confirmNextDate(e) {
// uv-datetime-picker
const date = new Date(e.value)
this.nextMaintenanceDate = date.getFullYear() + '-' +
this.malfunctionDate = date.getFullYear() + '-' +
String(date.getMonth() + 1).padStart(2, '0') + '-' +
String(date.getDate()).padStart(2, '0')
},
@ -478,7 +478,7 @@ export default {
amount: this.amount,
remarkText: this.remarkText,
remarkImage: this.remarkImage?.join(',') || '',
nextMaintenanceDate: this.nextMaintenanceDate,
malfunctionDate: this.malfunctionDate,
remark: this.remark,
showpieceId: this.showpieceId
}


+ 11
- 5
subPages/home/repairSubmit.vue View File

@ -37,7 +37,7 @@
<view class="form-item" @click="showFaultPicker">
<text class="label">故障情况</text>
<view class="select-area">
<text class="value" :class="{ placeholder: !malfunctionStatus }">{{ malfunctionStatus.label || '请选择' }}</text>
<text class="value" :class="{ placeholder: !malfunctionStatus }">{{ malfunctionStatus || '请选择' }}</text>
<uv-icon name="arrow-down" size="18" color="#000"></uv-icon>
</view>
</view>
@ -294,7 +294,6 @@ export default {
isAffectExperience: '0',
remark: '',
showpieceId: '',
//
frequencyOptions: [
@ -453,8 +452,7 @@ export default {
showpieceId: this.showpieceId,
malfunctionDate: this.malfunctionDate,
urgency: this.urgency.value,
malfunctionStatus: this.malfunctionStatus.id,
malfunctionDesc: this.malfunctionDesc,
malfunctionDesc: this.malfunctionStatus + this.malfunctionDesc,
malfunctionImage: this.malfunctionImage.join(','),
firstDate: this.firstDate,
frequency: this.frequency,
@ -479,8 +477,16 @@ export default {
}
}
},
onLoad(args) {
async onLoad(args) {
this.showpieceId = args.id
try {
const listRes = await this.$api.config.queryMalfunctionDescList()
if (listRes.code === 200) {
this.faultColumns = [[...listRes.result.records.map(item => item.malfunction)]]
}
} catch (error) {
uni.showToast({ title: error.message, icon: 'none' })
}
}
}
</script>


+ 12
- 2
subPages/repair/maintainSubmit.vue View File

@ -345,7 +345,7 @@
<view class="form-item">
<text class="label">备注</text>
</view>
<view class="textarea-container">
<view class="textarea-container">
<uv-textarea
v-model="processData.remark"
placeholder="备注"
@ -392,6 +392,12 @@ export default {
'维修中': '1',
'已解决': '2'
},
//
reverseStatusMap: {
'0': '故障中',
'1': '维修中',
'2': '已解决'
},
//
repairData: {
malfunctionDate: '2025-08-28', // malfunctionDate
@ -405,7 +411,8 @@ export default {
isMeasure: '0', // isMeasure 0-1-
measureDesc: '措施说明', // measureDesc
isAffectExperience: '0', // isAffectExperience 0-1-
remark: '备注' // remark
remark: '备注', // remark
status: '0', // status
},
//
@ -460,8 +467,11 @@ export default {
})
if (queryRes.code === 200) {
this.repairData = queryRes.result
//
this.selectedStatus = this.reverseStatusMap[this.repairData.status]
}
},
//
async startRepair() {
//


Loading…
Cancel
Save