|
|
|
|
@ -31,8 +31,7 @@
|
|
|
|
|
}]
|
|
|
|
|
}]"></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-item" :class="{ active: currentTemplate.id === item.id }" @click="selectTemplate(item)" v-for="item in templateList" :key="item.id">
|
|
|
|
|
<view class="tag" v-if="item.price_cents">¥ {{ item.price_cents / 100 }}</view>
|
|
|
|
|
<view class="template-name">{{ item.name }}</view>
|
|
|
|
|
<view class="template-desc">{{ item.description }}</view>
|
|
|
|
|
@ -41,7 +40,7 @@
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
<!-- 设置参数 -->
|
|
|
|
|
<view class="section">
|
|
|
|
|
<view class="section" v-if="has_access">
|
|
|
|
|
<view class="section-title">设置参数</view>
|
|
|
|
|
<uv-skeletons v-if="loading" :loading="loading" :skeleton="[{
|
|
|
|
|
type: 'line',
|
|
|
|
|
@ -49,11 +48,9 @@
|
|
|
|
|
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?.filter(item => item.enabled) || [])">
|
|
|
|
|
<uv-input :type="item.type === 'number' ? 'digit' : 'text'" v-model="item.value" color="#000"
|
|
|
|
|
border="bottom" :placeholderStyle="{ color: '#666778' }" placeholder="请输入"></uv-input>
|
|
|
|
|
<uv-form labelAlign="left" labelWidth="auto" labelPosition="left" :model="formField" :rules="rules" ref="form">
|
|
|
|
|
<uv-form-item :prop="item.name" :label="item.name + ':'" v-for="item in (currentTemplate.params?.filter(item => item.enabled) || [])">
|
|
|
|
|
<uv-input @click="openPicker(item)" :readonly="item.type === 'select'" :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-input
|
|
|
|
|
@ -115,12 +112,18 @@
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
<view class="section" v-else>
|
|
|
|
|
<div class="status">状态:{{ currentTemplate.access_status }}</div>
|
|
|
|
|
<uv-button text="申请权限" color="#3F70FF"></uv-button>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
<!-- 底部按钮 -->
|
|
|
|
|
<view class="bottom-actions">
|
|
|
|
|
<uv-button :loading="generating" @click="() => modalRef.open()" text="生成图纸" color="#3F70FF"></uv-button>
|
|
|
|
|
<uv-button :loading="generating" @click="modalRefOpen" text="生成图纸" color="#3F70FF"></uv-button>
|
|
|
|
|
<uv-button @click="viewHistory" text="查看记录"></uv-button>
|
|
|
|
|
</view>
|
|
|
|
|
<uv-modal ref="modalRef" showCancelButton content='确定生成图纸?' @confirm="confirmGenerate"></uv-modal>
|
|
|
|
|
<uv-picker ref="picker" :columns="columns" @confirm="confirm"></uv-picker>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
@ -135,6 +138,7 @@
|
|
|
|
|
onShareAppMessage,
|
|
|
|
|
onShareTimeline,
|
|
|
|
|
onReachBottom,
|
|
|
|
|
onPullDownRefresh
|
|
|
|
|
} from "@dcloudio/uni-app";
|
|
|
|
|
import {
|
|
|
|
|
useAuthStore,
|
|
|
|
|
@ -149,6 +153,35 @@
|
|
|
|
|
const userStore = useUserStore();
|
|
|
|
|
const loading = ref(false)
|
|
|
|
|
|
|
|
|
|
const has_access = ref(false)
|
|
|
|
|
const applyRef = ref(null)
|
|
|
|
|
|
|
|
|
|
const modalRefOpen = () => {
|
|
|
|
|
if(!has_access.value) {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: "模板无权限使用",
|
|
|
|
|
icon: "error",
|
|
|
|
|
});
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
modalRef.value.open()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const currentParams = ref(null)
|
|
|
|
|
const openPicker = item => {
|
|
|
|
|
console.log(item)
|
|
|
|
|
if (item.type !== 'select') return
|
|
|
|
|
currentParams.value = item
|
|
|
|
|
columns.value = [item.options.split(',')]
|
|
|
|
|
picker.value.open()
|
|
|
|
|
}
|
|
|
|
|
const picker = ref(null)
|
|
|
|
|
const columns = ref([[]])
|
|
|
|
|
const confirm = val => {
|
|
|
|
|
console.log(val)
|
|
|
|
|
currentParams.value.value = val.value[0]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const generating = ref(false);
|
|
|
|
|
const modalRef = ref(null)
|
|
|
|
|
const confirmGenerate = () => {
|
|
|
|
|
@ -174,7 +207,7 @@
|
|
|
|
|
const currentTemplate = ref({})
|
|
|
|
|
const getList = () => {
|
|
|
|
|
loading.value = true
|
|
|
|
|
RPC.post('/template/list', {
|
|
|
|
|
RPC.post('/template/list_with_access', {
|
|
|
|
|
page: 1,
|
|
|
|
|
limit: -1
|
|
|
|
|
}).then(res => {
|
|
|
|
|
@ -184,11 +217,11 @@
|
|
|
|
|
loading.value = false
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
getList()
|
|
|
|
|
|
|
|
|
|
// 选择模板
|
|
|
|
|
const selectTemplate = (item) => {
|
|
|
|
|
currentTemplate.value = JSON.parse(JSON.stringify(item));
|
|
|
|
|
has_access.value = currentTemplate.value.has_access
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const form = ref(null);
|
|
|
|
|
@ -238,6 +271,7 @@
|
|
|
|
|
console.log("index-onLoad");
|
|
|
|
|
});
|
|
|
|
|
onShow(async () => {
|
|
|
|
|
getList()
|
|
|
|
|
console.log("test page onShow");
|
|
|
|
|
const hasPermission = await usePermission();
|
|
|
|
|
console.log(hasPermission ? "已登录" : "跳转登录");
|
|
|
|
|
@ -247,6 +281,10 @@
|
|
|
|
|
uni.$uv.route("/pages/login/login");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
onPullDownRefresh(() => {
|
|
|
|
|
getList()
|
|
|
|
|
uni.stopPullDownRefresh();
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
@ -323,6 +361,7 @@
|
|
|
|
|
text-align: center;
|
|
|
|
|
transition: all 0.3s;
|
|
|
|
|
position: relative;
|
|
|
|
|
|
|
|
|
|
.tag {
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 0px;
|
|
|
|
|
|