完成邀约接口

This commit is contained in:
2025-09-09 20:52:35 +08:00
parent d061b4d470
commit 2e58309db4
11 changed files with 1362 additions and 1372 deletions

View File

@@ -41,10 +41,6 @@
</template>
<script>
// 导入MediaSelector和MediaType
import MediaSelector, {
MediaType
} from '@/utils/mediaSelector';
import {
uploadFiles
} from '@/common/upload.js';
@@ -54,7 +50,7 @@
return {
repairInfo: {
location: '',
type: '1942879389453230082',
type: '',
orderImgUrl: '',
remark: ''
},
@@ -70,17 +66,48 @@
selectType(item) {
this.selectedType = item;
},
async getOrderType() {
let params = {
parentId: '1952989217332658178'
}
let res = await this.$u.api.getRepairTypes(params);
if (res.code == '200') {
this.repairTypes = res.data
this.repairInfo.type = res.data[0].id;
this.selectType(res.data[0].orderTypeName)
}
},
async getOrderType() {
try {
let params = {
parentId: '1952989217332658178'
};
let params1 = {
parentId: '1943128289816682498'
};
// 使用Promise.all同时发起两次请求
const [res1, res2] = await Promise.all([
this.$u.api.repair.getWorkOrdersType(params),
this.$u.api.repair.getWorkOrdersType(params1)
]);
if (res1.code === 200 && res2.code === 200) {
// 合并children数组
const combinedChildren = [
...(res1.data[0]?.children || []),
...(res2.data[0]?.children || [])
];
// 创建合并后的数据结构
const combinedData = [{
...res1.data[0],
children: combinedChildren,
childrenid: res1.data[0].childrenid || res2.data[0].childrenid
}];
this.repairTypes = combinedChildren;
this.repairInfo.type = combinedData[0].id;
this.selectType(combinedChildren[0]?.orderTypeName || '');
} else {
uni.showToast({
title: '获取工单类型失败',
icon: 'none'
});
}
} catch (error) {
uni.showToast({
title: '获取工单类型异常',
icon: 'none'
});
}
},
// 删除图片
deletePic(event) {
this.selectedImages.splice(event.index, 1);
@@ -131,7 +158,8 @@
},
async realSubmit() {
let res = await this.$u.api.addOrder2(this.repairInfo);
this.repairInfo.orderName="工单"
let res = await this.$u.api.repair.addRepair(this.repairInfo);
if (res.code == '200') {
uni.navigateTo({
url: '/pages/sys/user/myRepair/repaired'