|
|
|
|
@ -2,11 +2,7 @@
|
|
|
|
|
<view class="container">
|
|
|
|
|
<!-- 顶部图片和标题 -->
|
|
|
|
|
<view class="header-section">
|
|
|
|
|
<image
|
|
|
|
|
class="header-image"
|
|
|
|
|
src="/static/imgs/indexImg.png"
|
|
|
|
|
mode="aspectFill"
|
|
|
|
|
></image>
|
|
|
|
|
<image class="header-image" src="/static/imgs/indexImg.png" mode="aspectFill"></image>
|
|
|
|
|
<view class="header-overlay">
|
|
|
|
|
<view class="header-title">生成电梯图纸</view>
|
|
|
|
|
<view class="header-subtitle">
|
|
|
|
|
@ -18,42 +14,27 @@
|
|
|
|
|
<!-- 选择图纸模板 -->
|
|
|
|
|
<view class="section">
|
|
|
|
|
<view class="section-title">选择图纸模板</view>
|
|
|
|
|
<view class="template-grid">
|
|
|
|
|
<view
|
|
|
|
|
class="template-item"
|
|
|
|
|
:class="{ active: selectedTemplate === 'passenger' }"
|
|
|
|
|
@click="selectTemplate('passenger')"
|
|
|
|
|
>
|
|
|
|
|
<u-icon name="edit-pen" color="#4285f4" size="24"></u-icon>
|
|
|
|
|
<view class="template-name">乘客电梯标准图纸</view>
|
|
|
|
|
<view class="template-desc">适用于住宅、商业建筑</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view
|
|
|
|
|
class="template-item"
|
|
|
|
|
:class="{ active: selectedTemplate === 'freight' }"
|
|
|
|
|
@click="selectTemplate('freight')"
|
|
|
|
|
>
|
|
|
|
|
<u-icon name="car" color="#4285f4" size="24"></u-icon>
|
|
|
|
|
<view class="template-name">货运电梯专用图纸</view>
|
|
|
|
|
<view class="template-desc">适用于仓库、工厂</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view
|
|
|
|
|
class="template-item"
|
|
|
|
|
:class="{ active: selectedTemplate === 'medical' }"
|
|
|
|
|
@click="selectTemplate('medical')"
|
|
|
|
|
>
|
|
|
|
|
<u-icon name="plus-circle" color="#4285f4" size="24"></u-icon>
|
|
|
|
|
<view class="template-name">医用电梯专业图纸</view>
|
|
|
|
|
<view class="template-desc">适用于医院、医疗场所</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view
|
|
|
|
|
class="template-item"
|
|
|
|
|
:class="{ active: selectedTemplate === 'sightseeing' }"
|
|
|
|
|
@click="selectTemplate('sightseeing')"
|
|
|
|
|
>
|
|
|
|
|
<u-icon name="eye" color="#4285f4" size="24"></u-icon>
|
|
|
|
|
<view class="template-name">观光电梯定制图纸</view>
|
|
|
|
|
<view class="template-desc">适用于商场、酒店</view>
|
|
|
|
|
<uv-skeletons v-if="loading" :loading="loading" :skeleton="[{
|
|
|
|
|
type: 'flex',
|
|
|
|
|
num: 2,
|
|
|
|
|
gap: '20rpx',
|
|
|
|
|
children:[{
|
|
|
|
|
type: 'custom',
|
|
|
|
|
num: 1,
|
|
|
|
|
gap: '20rpx',
|
|
|
|
|
style: 'width: 300rpx;height:200rpx;marginLeft: 10rpx;'
|
|
|
|
|
},{
|
|
|
|
|
type: 'custom',
|
|
|
|
|
num: 1,
|
|
|
|
|
gap: '20rpx',
|
|
|
|
|
style: 'width: 300rpx;height:200rpx;marginLeft: 10rpx;'
|
|
|
|
|
}]
|
|
|
|
|
}]"></uv-skeletons>
|
|
|
|
|
<view class="template-grid" v-else>
|
|
|
|
|
<view class="template-item" :class="{ active: currentTemplate.id === item.id }"
|
|
|
|
|
@click="selectTemplate(item)" v-for="item in templateList" :key="item.id">
|
|
|
|
|
<view class="template-name">{{item.name}}</view>
|
|
|
|
|
<view class="template-desc">{{item.description}}</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
@ -61,25 +42,19 @@
|
|
|
|
|
<!-- 设置参数 -->
|
|
|
|
|
<view class="section">
|
|
|
|
|
<view class="section-title">设置参数</view>
|
|
|
|
|
<view class="form">
|
|
|
|
|
<uv-form
|
|
|
|
|
labelAlign="left"
|
|
|
|
|
labelWidth="auto"
|
|
|
|
|
labelPosition="left"
|
|
|
|
|
:model="formField"
|
|
|
|
|
:rules="rules"
|
|
|
|
|
ref="form"
|
|
|
|
|
>
|
|
|
|
|
<uv-form-item prop="phone" label="电梯类型">
|
|
|
|
|
<uv-input
|
|
|
|
|
v-model="formField.phone"
|
|
|
|
|
color="#000"
|
|
|
|
|
border="none"
|
|
|
|
|
:placeholderStyle="{ color: '#666778' }"
|
|
|
|
|
placeholder="请输入"
|
|
|
|
|
></uv-input>
|
|
|
|
|
<uv-skeletons v-if="loading" :loading="loading" :skeleton="[{
|
|
|
|
|
type: 'line',
|
|
|
|
|
num: 3,
|
|
|
|
|
gap: '20rpx'
|
|
|
|
|
}]"></uv-skeletons>
|
|
|
|
|
<view class="form" v-else>
|
|
|
|
|
<uv-form labelAlign="left" labelWidth="auto" labelPosition="left" :model="formField" :rules="rules"
|
|
|
|
|
ref="form">
|
|
|
|
|
<uv-form-item :prop="item.key" :label="item.name + ':'" v-for="item in currentTemplate.params">
|
|
|
|
|
<uv-input :type="item.type === 'number' ? 'digit' : 'text'" v-model="item.value" color="#000"
|
|
|
|
|
border="bottom" :placeholderStyle="{ color: '#666778' }" placeholder="请输入"></uv-input>
|
|
|
|
|
</uv-form-item>
|
|
|
|
|
<uv-form-item prop="password" label="载重(kg)">
|
|
|
|
|
<!-- <uv-form-item prop="password" label="载重(kg)">
|
|
|
|
|
<uv-input
|
|
|
|
|
v-model="formField.password"
|
|
|
|
|
color="#000"
|
|
|
|
|
@ -134,26 +109,25 @@
|
|
|
|
|
v-model="formField.password"
|
|
|
|
|
placeholder="请输入"
|
|
|
|
|
></uv-textarea>
|
|
|
|
|
</uv-form-item>
|
|
|
|
|
</uv-form-item> -->
|
|
|
|
|
</uv-form>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
<!-- 底部按钮 -->
|
|
|
|
|
<view class="bottom-actions">
|
|
|
|
|
<uv-button
|
|
|
|
|
:loading="generating"
|
|
|
|
|
@click="viewHistory"
|
|
|
|
|
text="生成图纸"
|
|
|
|
|
color="#3F70FF"
|
|
|
|
|
></uv-button>
|
|
|
|
|
<uv-button :loading="generating" @click="() => modalRef.open()" text="生成图纸" color="#3F70FF"></uv-button>
|
|
|
|
|
<uv-button @click="viewHistory" text="查看记录"></uv-button>
|
|
|
|
|
</view>
|
|
|
|
|
<uv-modal ref="modalRef" showCancelButton content='确定生成图纸?' @confirm="confirmGenerate"></uv-modal>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
|
import { ref, onMounted } from "vue";
|
|
|
|
|
import {
|
|
|
|
|
ref,
|
|
|
|
|
onMounted
|
|
|
|
|
} from "vue";
|
|
|
|
|
import {
|
|
|
|
|
onShow,
|
|
|
|
|
onLoad,
|
|
|
|
|
@ -161,21 +135,59 @@ import {
|
|
|
|
|
onShareTimeline,
|
|
|
|
|
onReachBottom,
|
|
|
|
|
} from "@dcloudio/uni-app";
|
|
|
|
|
import { useAuthStore, useUserStore } from "@/store";
|
|
|
|
|
import {
|
|
|
|
|
useAuthStore,
|
|
|
|
|
useUserStore
|
|
|
|
|
} from "@/store";
|
|
|
|
|
import RPC from "@/utils/request";
|
|
|
|
|
import { usePermission } from "@/hooks/usePermission";
|
|
|
|
|
import {
|
|
|
|
|
usePermission
|
|
|
|
|
} from "@/hooks/usePermission";
|
|
|
|
|
|
|
|
|
|
const authStore = useAuthStore();
|
|
|
|
|
const userStore = useUserStore();
|
|
|
|
|
const loading = ref(false)
|
|
|
|
|
|
|
|
|
|
const generating = ref(false);
|
|
|
|
|
const modalRef = ref(null)
|
|
|
|
|
const confirmGenerate = () => {
|
|
|
|
|
const params = {}
|
|
|
|
|
currentTemplate.value.params.forEach(item => {
|
|
|
|
|
params[item.name] = item.value
|
|
|
|
|
})
|
|
|
|
|
RPC.post('/template_create_task', {template_id:currentTemplate.value.id,template_data:params}).then(() => {
|
|
|
|
|
|
|
|
|
|
// 响应式数据
|
|
|
|
|
const selectedTemplate = ref("passenger");
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: "图纸开始生成",
|
|
|
|
|
icon: "success",
|
|
|
|
|
});
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: "/pagesA/generate-record/generate-record",
|
|
|
|
|
});
|
|
|
|
|
}, 1000)
|
|
|
|
|
modalRef.value.close()
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
const templateList = ref([])
|
|
|
|
|
const currentTemplate = ref({})
|
|
|
|
|
const getList = () => {
|
|
|
|
|
loading.value = true
|
|
|
|
|
RPC.post('/template/list', {
|
|
|
|
|
page: 1,
|
|
|
|
|
limit: -1
|
|
|
|
|
}).then(res => {
|
|
|
|
|
templateList.value = res.rows || []
|
|
|
|
|
currentTemplate.value = res.rows[0] ? JSON.parse(JSON.stringify(res.rows[0])) : {}
|
|
|
|
|
}).finally(() => {
|
|
|
|
|
loading.value = false
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
getList()
|
|
|
|
|
|
|
|
|
|
// 选择模板
|
|
|
|
|
const selectTemplate = (template) => {
|
|
|
|
|
selectedTemplate.value = template;
|
|
|
|
|
const selectTemplate = (item) => {
|
|
|
|
|
currentTemplate.value = JSON.parse(JSON.stringify(item));
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const form = ref(null);
|
|
|
|
|
@ -196,50 +208,8 @@ const rules = ref({
|
|
|
|
|
// }
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 生成图纸
|
|
|
|
|
const generateDrawing = async () => {
|
|
|
|
|
if (!selectedTemplate.value) {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: "请选择图纸模板",
|
|
|
|
|
icon: "none",
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
generating.value = true;
|
|
|
|
|
try {
|
|
|
|
|
const params = {};
|
|
|
|
|
|
|
|
|
|
// 这里调用生成图纸的API
|
|
|
|
|
// const result = await RPC.post('/api/generate-drawing', params)
|
|
|
|
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: "图纸生成中...",
|
|
|
|
|
icon: "loading",
|
|
|
|
|
duration: 2000,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 模拟生成过程
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: "图纸生成成功",
|
|
|
|
|
icon: "success",
|
|
|
|
|
});
|
|
|
|
|
generating.value = false;
|
|
|
|
|
}, 2000);
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error("生成图纸失败:", error);
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: "生成失败,请重试",
|
|
|
|
|
icon: "none",
|
|
|
|
|
});
|
|
|
|
|
generating.value = false;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 查看历史记录
|
|
|
|
|
const viewHistory = () => {
|
|
|
|
|
console.log(111);
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: "/pagesA/generate-record/generate-record",
|
|
|
|
|
});
|
|
|
|
|
@ -286,7 +256,8 @@ onLoad(() => {
|
|
|
|
|
padding-bottom: 52px;
|
|
|
|
|
|
|
|
|
|
/* #ifdef H5 */
|
|
|
|
|
padding-bottom: 102px; /* H5环境下需要更多空间 (50px按钮 + 50px tabBar + 2px间距) */
|
|
|
|
|
padding-bottom: 102px;
|
|
|
|
|
/* H5环境下需要更多空间 (50px按钮 + 50px tabBar + 2px间距) */
|
|
|
|
|
/* #endif */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -341,6 +312,8 @@ onLoad(() => {
|
|
|
|
|
display: grid;
|
|
|
|
|
grid-template-columns: 1fr 1fr;
|
|
|
|
|
gap: 12px;
|
|
|
|
|
max-height: 200px;
|
|
|
|
|
overflow-y: auto;
|
|
|
|
|
|
|
|
|
|
.template-item {
|
|
|
|
|
border: 1px solid #e5e5e5;
|
|
|
|
|
@ -385,7 +358,8 @@ onLoad(() => {
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
|
|
|
|
/* #ifdef H5 */
|
|
|
|
|
bottom: 50px; /* H5环境下给tabBar留出空间 */
|
|
|
|
|
bottom: 50px;
|
|
|
|
|
/* H5环境下给tabBar留出空间 */
|
|
|
|
|
/* #endif */
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|