添加组件

master
suixy 3 months ago
parent e94d76ab7d
commit 66a269afaa

@ -14,7 +14,7 @@
<el-dialog title="输入密码" :modal-append-to-body="false" :visible.sync="getPasswordVisible">
<el-form :model="form" label-width="50px">
<el-form-item label="密码">
<el-input v-model="form.secretKey" autocomplete="off"></el-input>
<el-input v-model="form.providedKey" autocomplete="off"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
@ -50,7 +50,7 @@ export default {
} else {
this.form = {
documentId: e.uuid,
secretKey: ''
providedKey: ''
}
this.getPasswordVisible = true
this.$message.error('请输入密钥')
@ -58,14 +58,35 @@ export default {
})
},
downFile1() {
if (!this.form.secretKey) {
if (!this.form.providedKey) {
this.$message.error('请输入密码')
return
}
getSecureDocumentAddress(this.form).then((res) => {
getSecureDocumentAddress(this.form).then(async (res) => {
if (res.code === 200) {
console.log('下载地址', res.data)
console.log('下载地址', res)
let url = res.msg
let filename = url.split('/').at(-1)?.split('_')[0] + '.' + url.split('/').at(-1)?.split('.').at(-1)
try {
const response = await fetch(url, {mode: 'cors'});
if (!response.ok) throw new Error('网络错误');
const blob = await response.blob(); //
const blobUrl = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = blobUrl;
a.download = filename || url.split('/').pop();
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(blobUrl); //
this.getPasswordVisible = false
} catch (err) {
console.error('下载失败:', err);
}
} else {
this.$message.error('密钥错误')
}

@ -4,8 +4,6 @@
<div class="title">
页面编辑器
</div>
{{ type }}-
{{ value }}
<el-select clearable @change="typeChange" v-model="type" size="small" style="margin-right: 12px;"
placeholder="请选择">
<el-option
@ -386,6 +384,33 @@ export default {
}
},
mounted() {
if (this.$route.query.type && this.$route.query.id) {
if (this.$route.query.type === '1') {
this.props = {checkStrictly: true, value: 'webMenuId', label: 'webMenuName'}
selectMenuTree().then(v => {
this.options = v.data.find(vv => vv.webMenuId === 4).children
this.type = this.$route.query.type
this.value = this.$route.query.id.split(',').map(v => parseFloat(v))
getHwWeb(this.value.at(-1)).then(res => {
this.components = JSON.parse(res?.data?.webJsonString || '[]')
})
})
}
if (this.$route.query.type === '2') {
this.props = {checkStrictly: true, value: 'id', label: 'name', children: 'list'}
getHwWeb(7).then(res => {
this.options = JSON.parse(res?.data?.webJsonString || '{}').productList || []
this.type = this.$route.query.type
this.value = this.$route.query.id.split(',').map(v => parseFloat(v))
listHwWeb1({webCode: this.value[0], deviceId: this.value[2]}).then(e => {
this.components = JSON.parse(e.rows?.[0]?.webJsonString || '[]')
})
})
}
}
},
methods: {
edit(key, e) {

@ -34,7 +34,7 @@
<!-- 按钮 -->
<div class="btn-wrap" v-if="ii.id">
<el-button class="more-btn" @click="toDetail(ii.id)">
<el-button class="more-btn" @click="toDetail(i.id,ii.id)">
了解更多
<i class="el-icon-arrow-right icon"></i>
</el-button>
@ -75,9 +75,9 @@ export default {
}
},
methods: {
toDetail(id) {
if (id) {
this.$router.push(`/productCenter/detail/edit?type=${this.$props.data.id}&id=${id}`)
toDetail(id, id1) {
if (id && id1) {
this.$router.push(`/editor?type=2&id=${this.$props.data.id},${id},${id1}`)
}
},
tabEdit(e, action) {

Loading…
Cancel
Save