diff --git a/api/modules/exhibit.js b/api/modules/exhibit.js
index 2ceccb2..5af8ef2 100644
--- a/api/modules/exhibit.js
+++ b/api/modules/exhibit.js
@@ -35,6 +35,7 @@ export default {
url: '/showpiece/addMaintenance',
method: 'POST',
data,
+ showLoading: true,
needToken: true
})
},
@@ -48,5 +49,45 @@ export default {
})
},
- // chakan
-}
\ No newline at end of file
+ // 报修- 新增报修单
+ async addMalfunction(data) {
+ return http({
+ url: '/showpiece/addMalfunction',
+ method: 'POST',
+ data,
+ showLoading: true,
+ needToken: true
+ })
+ },
+
+ // 查看保修单详情
+ async queryMalfunctionById(data) {
+ return http({
+ url: '/showpiece/queryMalfunctionById',
+ method: 'GET',
+ data
+ })
+ },
+
+ // 修改保修单
+ async updateMalfunction(data) {
+ return http({
+ url: '/showpiece/updateMalfunction',
+ method: 'POST',
+ data,
+ showLoading: true,
+ needToken: true
+ })
+ },
+
+ // 新增维修记录
+ async addRepair(data) {
+ return http({
+ url: '/showpiece/addRepair',
+ method: 'POST',
+ data,
+ showLoading: true,
+ needToken: true
+ })
+ }
+}
diff --git a/pages/index/maintain.vue b/pages/index/maintain.vue
index 24cf5ab..830973a 100644
--- a/pages/index/maintain.vue
+++ b/pages/index/maintain.vue
@@ -116,7 +116,6 @@ export default {
mixinListApi: 'exhibit.queryMalfunctionList',
urgencyColumns: [
[
-
'一般',
'紧急',
'非常紧急'
diff --git a/subPages/home/repairSubmit.vue b/subPages/home/repairSubmit.vue
index b5d3b9d..29fef75 100644
--- a/subPages/home/repairSubmit.vue
+++ b/subPages/home/repairSubmit.vue
@@ -11,16 +11,19 @@
-
+
报修日期
- {{ repairDate }}
+
+ {{ malfunctionDate || '请选择' }}
+
+
故障紧急程度
- {{ urgencyLevel || '请选择' }}
+ {{ urgency.label || '请选择' }}
@@ -34,7 +37,7 @@
故障情况
- {{ faultSituation || '请选择' }}
+ {{ malfunctionStatus.label || '请选择' }}
@@ -45,7 +48,7 @@
故障图片
-
+
@@ -72,10 +75,10 @@
-
+
故障首次发生时间
- {{ firstOccurTime || '请选择' }}
+ {{ firstDate || '请选择' }}
@@ -103,7 +106,7 @@
-->
是否影响使用
- {{ impactUsage || '请选择' }}
+ {{ isAffectUse.label || '请选择' }}
@@ -132,7 +135,7 @@
-
- 是
+
+ 是
-
- 否
+
+ 否
-
- 是
+
+ 是
-
- 否
+
+ 否
@@ -231,6 +234,7 @@
confirm-color="#C70019"
ref="urgencyPicker"
:columns="urgencyColumns"
+ keyName="label"
@confirm="confirmUrgency"
@cancel="cancelUrgency"
>
@@ -243,21 +247,31 @@
@cancel="cancelFault"
>
-
+
+
+
+
+
@@ -266,41 +280,56 @@ export default {
data() {
return {
// 表单数据
- repairDate: '2025/03/31',
- urgencyLevel: '',
- faultSituation: '',
- faultDescription: '',
- imageList: [],
- firstOccurTime: '',
- frequency: '',
- faultCondition: '',
- impactUsage: '',
- temporaryMeasures: '',
- hasTakenMeasures: null,
- impactExperience: null,
+ malfunctionDate: '',
+ urgency: '',
+ malfunctionStatus: '',
+ malfunctionDesc: '',
+ malfunctionImage: [],
+ firstDate: '',
+ frequency: '1',
+ reason: '',
+ isAffectUse: '0',
+ malfunctionName: '',
+ isMeasure: '0',
+ isAffectExperience: '0',
remark: '',
-
- // 选择器显示状态(保留用于其他可能的用途)
- // showUrgency: false,
- // showFault: false,
- // showTime: false,
- // showImpact: false,
+ showpieceId: '',
+
// 频率选项
frequencyOptions: [
- { label: '持续性问题', value: 'continuous' },
- { label: '间歇性问题', value: 'intermittent' }
+ { label: '持续性问题', value: '0' },
+ { label: '间歇性问题', value: '1' }
],
// 选择器数据
- urgencyColumns: [['一般', '紧急', '非常紧急']],
+ urgencyColumns: [
+ [
+ { label: '一般', value: '0' },
+ { label: '紧急', value: '1'}
+ ]
+ ],
+
faultColumns: [['硬件故障', '软件故障', '网络故障', '其他']],
- timeColumns: [['今天', '昨天', '一周内', '一个月内', '更早']],
- impactColumns: [['是', '否']]
+ impactColumns: [[
+ { label: '是', value: '1' },
+ { label: '否', value: '0' }
+ ]],
}
},
methods: {
+ // 显示日期选择器
+ showDatePicker() {
+ this.$refs.datePicker.open()
+ },
+
+ // 确认日期选择
+ confirmDate(e) {
+ const date = new Date(e.value)
+ this.malfunctionDate = `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`
+ },
+
// 显示紧急程度选择器
showUrgencyPicker() {
this.$refs.urgencyPicker.open()
@@ -308,7 +337,7 @@ export default {
// 确认紧急程度
confirmUrgency(e) {
- this.urgencyLevel = e.value[0]
+ this.urgency = e.value[0]
},
// 取消紧急程度选择
@@ -323,7 +352,7 @@ export default {
// 确认故障情况
confirmFault(e) {
- this.faultSituation = e.value[0]
+ this.malfunctionStatus = e.value[0]
},
// 取消故障情况选择
@@ -331,19 +360,15 @@ export default {
// 取消操作
},
- // 显示时间选择器
- showTimePicker() {
- this.$refs.timePicker.open()
- },
-
- // 确认时间
- confirmTime(e) {
- this.firstOccurTime = e.value[0]
+ // 显示故障首次发生时间选择器
+ showFirstOccurTimePicker() {
+ this.$refs.firstOccurTimePicker.open()
},
- // 取消时间选择
- cancelTime() {
- // 取消操作
+ // 确认故障首次发生时间
+ confirmFirstOccurTime(e) {
+ const date = new Date(e.value)
+ this.firstDate = `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`
},
// 显示影响使用选择器
@@ -353,7 +378,7 @@ export default {
// 确认影响使用
confirmImpact(e) {
- this.impactUsage = e.value[0]
+ this.isAffectUse = e.value[0]
},
// 取消影响使用选择
@@ -368,12 +393,12 @@ export default {
// 选择是否采取措施
selectMeasures(value) {
- this.hasTakenMeasures = value
+ this.isMeasure = value
},
// 选择是否影响体验
selectExperience(value) {
- this.impactExperience = value
+ this.isAffectExperience = value
},
// 上传图片
@@ -383,7 +408,7 @@ export default {
if (result && result.success) {
console.log(result);
- this.imageList.push(result.url)
+ this.malfunctionImage.push(result.url)
}
} catch (error) {
console.error('头像上传失败:', error)
@@ -396,58 +421,66 @@ export default {
// 删除图片
deleteImage(index) {
- this.imageList.splice(index, 1)
+ this.malfunctionImage.splice(index, 1)
},
// 预览图片
previewImage(url) {
uni.previewImage({
- urls: this.imageList,
+ urls: this.malfunctionImage,
current: url
})
},
// 提交报修
- submitRepair() {
+ async submitRepair() {
// 表单验证
- if (!this.urgencyLevel) {
+ if (!this.urgency) {
uni.showToast({ title: '请选择故障紧急程度', icon: 'none' })
return
}
- if (!this.faultSituation) {
- uni.showToast({ title: '请选择故障情况', icon: 'none' })
- return
- }
- if (!this.faultDescription.trim()) {
+ // if (!this.malfunctionStatus) {
+ // uni.showToast({ title: '请选择故障情况', icon: 'none' })
+ // return
+ // }
+ if (!this.malfunctionDesc.trim()) {
uni.showToast({ title: '请填写故障情况描述', icon: 'none' })
return
}
// 提交数据
const formData = {
- repairDate: this.repairDate,
- urgencyLevel: this.urgencyLevel,
- faultSituation: this.faultSituation,
- faultDescription: this.faultDescription,
- imageList: this.imageList,
- firstOccurTime: this.firstOccurTime,
+ showpieceId: this.showpieceId,
+ malfunctionDate: this.malfunctionDate,
+ urgency: this.urgency.value,
+ malfunctionStatus: this.malfunctionStatus.id,
+ malfunctionDesc: this.malfunctionDesc,
+ malfunctionImage: this.malfunctionImage.join(','),
+ firstDate: this.firstDate,
frequency: this.frequency,
- faultCondition: this.faultCondition,
- impactUsage: this.impactUsage,
- temporaryMeasures: this.temporaryMeasures,
- hasTakenMeasures: this.hasTakenMeasures,
- impactExperience: this.impactExperience,
+ reason: this.reason,
+ isAffectUse: this.isAffectUse.value,
+ malfunctionName: this.malfunctionName,
+ isMeasure: this.isMeasure,
+ isAffectExperience: this.isAffectExperience,
remark: this.remark
}
- console.log('提交数据:', formData)
- uni.showToast({ title: '提交成功', icon: 'success' })
-
- // 返回上一页
- setTimeout(() => {
- uni.navigateBack()
- }, 1500)
+ // console.log('提交数据:', formData)
+ // uni.showToast({ title: '提交成功', icon: 'success' })
+ const subRes = await this.$api.exhibit.addMalfunction(formData)
+ if (subRes.code === 200) {
+ uni.showToast({ title: subRes.message})
+ setTimeout(() => {
+ uni.navigateBack()
+ }, 1000)
+ }else{
+ uni.showToast({ title: subRes.message, icon: 'none' })
+ }
}
+ },
+ onLoad(args) {
+ this.showpieceId = args.id
}
}
diff --git a/subPages/repair/maintainSubmit.vue b/subPages/repair/maintainSubmit.vue
index 217ec58..e8ce08a 100644
--- a/subPages/repair/maintainSubmit.vue
+++ b/subPages/repair/maintainSubmit.vue
@@ -12,7 +12,7 @@
-