新增资源导入
This commit is contained in:
parent
319c25ed4f
commit
78f0ee1b92
|
@ -0,0 +1,128 @@
|
|||
<!--
|
||||
* @Author: hisense.liangjunhua
|
||||
* @Date: 2022-06-20 10:38:17
|
||||
* @LastEditors: hisense.liangjunhua
|
||||
* @LastEditTime: 2022-06-20 11:33:13
|
||||
* @Description: 告诉大家这是什么
|
||||
-->
|
||||
<template>
|
||||
<div class="bsabilityimport">
|
||||
<div class="item" @click="downloadTemplate()">
|
||||
<svg t="1655692930310" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1593" width="200" height="200"><path d="M599.13 0.476L33.55 109.306a20.778 20.778 0 0 0-16.492 20.42v764.308a20.778 20.778 0 0 0 16.372 20.48l565.58 108.83a20.837 20.837 0 0 0 3.81 0.654 19.29 19.29 0 0 0 12.622-4.465 21.313 21.313 0 0 0 7.56-16.015V20.361a21.313 21.313 0 0 0-7.56-16.074 19.23 19.23 0 0 0-16.313-3.81z m-206.11 696.08l-46.14-83.348c-10.597-18.575-20.241-37.864-32.148-59.951h-2.203c-10.538 21.67-20.004 40.305-29.767 58.344l-43.937 76.323-87.278-5 115.557-175.985L158.454 342.8l91.147-5.953 41.317 70.608c9.466 16.55 18.337 33.697 30.541 55.784h2.798c9.824-22.683 18.159-40.543 27.03-58.404l38.935-77.395 86.683-5.953-108.592 188.249L483.93 701.915zM966.519 122.76H663.487v143.36h40.364v40.96h-40.364v102.4h40.364v40.96h-40.364V552.9h40.364v40.96h-40.364v122.939h40.364v40.96h-40.364v143.419h302.972a40.781 40.781 0 0 0 40.424-40.96V163.72a40.781 40.781 0 0 0-40.364-40.96zM905.912 757.7H744.275v-40.96h161.637z m0-163.9H744.275v-40.9h161.637z m0-143.418H744.275v-40.9h161.637z m0-143.42H744.275v-40.84h161.637z" fill="#1296db" p-id="1594"></path></svg>
|
||||
<span>下载模板</span>
|
||||
</div>
|
||||
<el-upload
|
||||
ref="addUpload"
|
||||
class="item"
|
||||
:action="fileUploadUrl"
|
||||
:on-success="onSuccess"
|
||||
:on-remove="onRemove"
|
||||
:show-file-list='false'
|
||||
:on-error="onErrorFile"
|
||||
:on-exceed='onExceed'
|
||||
:limit='1'
|
||||
:on-preview="onPreview"
|
||||
list-type="text"
|
||||
>
|
||||
<svg t="1655692986683" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2083" width="200" height="200"><path d="M192 256v29h9.9c-6.5-9.3-9.9-19-9.9-29z m384 128c-41.9 0-82.3-2.2-120-6.4L590.2 512 467.5 634.8c34.4 3.4 70.8 5.2 108.5 5.2 212.1 0 384-57.3 384-128V256c0 70.7-171.9 128-384 128z m-263.9-99h51.3l17.2 17.2c57.2 11.3 124 17.8 195.4 17.8 212.1 0 384-57.3 384-128S788.1 64 576 64s-384 57.3-384 128c0 36.6 46.2 69.7 120.1 93zM576 704c-59.1 0-115.2-4.5-165.2-12.4L363.4 739H192v93c0 70.7 171.9 128 384 128s384-57.3 384-128V576c0 70.7-171.9 128-384 128z" fill="#E6C27C" p-id="2084"></path><path d="M336.9 349H198.6l98.9 98.9H64v128.2h233.5L198.6 675h138.3l162.9-163z" fill="#497CAD" p-id="2085"></path></svg>
|
||||
<div>导入数据</div>
|
||||
</el-upload>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import Cookies from 'js-cookie'
|
||||
export default {
|
||||
name: '',
|
||||
components: {
|
||||
|
||||
},
|
||||
props: {
|
||||
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
fileUploadUrl: window.SITE_CONFIG.apiURL + '/resource//importResource?token=' + Cookies.get('ucsToken')
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
downloadTemplate () {
|
||||
window.open(window.SITE_CONFIG.apiURL + '/%E8%83%BD%E5%8A%9B%E8%B5%84%E6%BA%90%E5%AF%BC%E5%85%A5%E6%A8%A1%E6%9D%BF.xlsx?token=' + Cookies.get('ucsToken'))
|
||||
},
|
||||
onSuccess (res, file) {
|
||||
this.$message({
|
||||
message: '导入成功',
|
||||
type: 'success'
|
||||
})
|
||||
this.$refs.addUpload.clearFiles()
|
||||
},
|
||||
onErrorFile () {
|
||||
this.$message('导入失败!')
|
||||
this.$refs.addUpload.clearFiles() // 去掉文件列表
|
||||
},
|
||||
onRemove (file, fileList) {
|
||||
console.log(file, fileList)
|
||||
},
|
||||
onPreview (file) {
|
||||
console.log('点击预览===============>', file)
|
||||
window.open(file.response.data)
|
||||
},
|
||||
onExceed (files, fileList) {
|
||||
this.$message.warning('当前附件数量已达上限,请先删除部分附件!')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang='scss' scoped>
|
||||
.bsabilityimport {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
padding: 250px 300px;
|
||||
.item {
|
||||
padding: 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border: 1px solid rgba(0, 0, 0, 0);
|
||||
span {
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
margin-top: 20px;
|
||||
}
|
||||
div {
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
margin-top: 20px;
|
||||
}
|
||||
}
|
||||
.item:hover {
|
||||
cursor: pointer;
|
||||
border: 1px solid #1296db;
|
||||
border-radius: 10px;
|
||||
svg {
|
||||
animation: turn 2s linear infinite;
|
||||
animation-iteration-count: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes turn {
|
||||
0% {
|
||||
-webkit-transform: rotateY(0deg);
|
||||
}
|
||||
25% {
|
||||
-webkit-transform: rotateY(90deg);
|
||||
}
|
||||
50% {
|
||||
-webkit-transform: rotateY(180deg);
|
||||
}
|
||||
75% {
|
||||
-webkit-transform: rotateY(270deg);
|
||||
}
|
||||
100% {
|
||||
-webkit-transform: rotateY(360deg);
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,462 @@
|
|||
<!--
|
||||
* @Author: hisense.liangjunhua
|
||||
* @Date: 2022-06-20 09:35:51
|
||||
* @LastEditors: hisense.liangjunhua
|
||||
* @LastEditTime: 2022-06-20 10:03:03
|
||||
* @Description: 业务组件
|
||||
-->
|
||||
<template>
|
||||
<div class="box">
|
||||
<div class="header">能力上架申请</div>
|
||||
<div class="top">
|
||||
<div
|
||||
v-for="(nav, index) in navList"
|
||||
:key="nav"
|
||||
:class="[index <= navList2.indexOf(showView) ? 'finish' : '']"
|
||||
>
|
||||
<span class="bg-box">
|
||||
<span>{{ index + 1 }}</span>
|
||||
</span>
|
||||
<span>{{ nav.name }}</span>
|
||||
<div class="line" v-if="index !== navList.length - 1"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="vue-box">
|
||||
<put-on-the-shelf
|
||||
v-if="showView === '基本信息' && refData.name"
|
||||
:refData="refData"
|
||||
:dataFrom="dataFrom"
|
||||
:videoList="videoList"
|
||||
:externalField="['算法名称', '算法描述', '共享条件', '共享类型']"
|
||||
></put-on-the-shelf>
|
||||
<put-on-the-shelf
|
||||
v-else-if="showView === '算法优势'"
|
||||
:refData="refData"
|
||||
:dataFrom="dataFrom"
|
||||
:configure="sfys"
|
||||
></put-on-the-shelf>
|
||||
<put-on-the-shelf
|
||||
v-else-if="showView === '应用场景'"
|
||||
:refData="refData"
|
||||
:dataFrom="dataFrom"
|
||||
:configure="yycj"
|
||||
></put-on-the-shelf>
|
||||
<put-on-the-shelf
|
||||
v-else-if="showView === '部署与使用'"
|
||||
:refData="refData"
|
||||
:dataFrom="dataFrom"
|
||||
:fileList="fileList"
|
||||
:imgList="imgList"
|
||||
:externalField="['接口服务', '接口请求方式']"
|
||||
:configure="bs"
|
||||
></put-on-the-shelf>
|
||||
<!-- <algorithm-essential-information
|
||||
v-if="showView === '基本信息' && refData.name"
|
||||
:refData="refData"
|
||||
:dataFrom="dataFrom"
|
||||
:videoList="videoList"
|
||||
></algorithm-essential-information>
|
||||
<algorithm-advantage
|
||||
v-else-if="showView === '算法优势'"
|
||||
:refData="refData"
|
||||
:dataFrom="dataFrom"
|
||||
></algorithm-advantage>
|
||||
<algorithm-scenarios
|
||||
v-else-if="showView === '应用场景'"
|
||||
:refData="refData"
|
||||
:dataFrom="dataFrom"
|
||||
></algorithm-scenarios> -->
|
||||
<!-- <algorithm-scenarios
|
||||
v-else-if="showView === '应用场景'"
|
||||
:refData="refData"
|
||||
:dataFrom="dataFrom"
|
||||
></algorithm-scenarios> -->
|
||||
<!-- <algorithm-deployment-use
|
||||
v-else-if="showView === '部署与使用'"
|
||||
:refData="refData"
|
||||
:dataFrom="dataFrom"
|
||||
:fileList="fileList"
|
||||
:imgList="imgList"
|
||||
></algorithm-deployment-use> -->
|
||||
</div>
|
||||
<div class="btn" :class="showView === '基本信息' ? 'first' : ''">
|
||||
<button v-show="showView !== '基本信息'" @click="back()">上一步</button>
|
||||
<button v-show="showView === '部署与使用'" @click="preview()">
|
||||
预览
|
||||
</button>
|
||||
<button v-show="showView !== '部署与使用'" @click="next()">下一步</button>
|
||||
<button v-show="showView === '部署与使用'" @click="submit()">提交</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
// import AlgorithmEssentialInformation from '@/views/capacityOnTheShelf/components/AlgorithmEssentialInformation.vue'
|
||||
// import AlgorithmAdvantage from '@/views/capacityOnTheShelf/components/AlgorithmAdvantage.vue'
|
||||
// import AlgorithmScenarios from '@/views/capacityOnTheShelf/components/AlgorithmScenarios.vue'
|
||||
import PutOnTheShelf from '@/views/capacityOnTheShelf/components/PutOnTheShelf.vue'
|
||||
// import AlgorithmDeploymentUse from '@/views/capacityOnTheShelf/components/AlgorithmDeploymentUse.vue'
|
||||
import { ref, onBeforeUnmount } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { getCategoryTree } from '@/api/personalCenter'
|
||||
import { shangjiainsert, shangjiaapply } from '@/api/personalCenter'
|
||||
import { getUser, getUserInfo } from '@/api/home'
|
||||
import { message } from 'ant-design-vue'
|
||||
import mybus from '@/myplugins/mybus'
|
||||
const router = useRouter()
|
||||
const showView = ref('基本信息')
|
||||
const sfys = ref([
|
||||
{
|
||||
name: '算法优势',
|
||||
list: [
|
||||
{
|
||||
name: '算法优势名称',
|
||||
field: 'name',
|
||||
type: 'input',
|
||||
note1: '',
|
||||
},
|
||||
{
|
||||
name: '算法优势描述',
|
||||
field: 'desc',
|
||||
type: 'textArea',
|
||||
note1: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
])
|
||||
const yycj = ref([
|
||||
{
|
||||
name: '应用场景',
|
||||
list: [
|
||||
{
|
||||
name: '应用场景名称',
|
||||
field: 'name',
|
||||
type: 'input',
|
||||
note1: '',
|
||||
},
|
||||
{
|
||||
name: '应用场景描述',
|
||||
field: 'desc',
|
||||
type: 'textArea',
|
||||
note1: '',
|
||||
},
|
||||
{
|
||||
name: '应用场景图片',
|
||||
field: 'img',
|
||||
type: 'image',
|
||||
note1: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
])
|
||||
const bs = ref([
|
||||
{
|
||||
name: '计费标准信息',
|
||||
list: [
|
||||
{
|
||||
name: '计费方式',
|
||||
field: 'type',
|
||||
type: 'radio',
|
||||
options: ['一次性买断', '按调用次数', '按并发路数', '按年计费'],
|
||||
note1: '',
|
||||
},
|
||||
{
|
||||
name: '计费标准',
|
||||
field: 'price',
|
||||
type: 'number',
|
||||
company: '元',
|
||||
note1: '',
|
||||
},
|
||||
{
|
||||
name: '计费标准描述',
|
||||
field: 'desc',
|
||||
type: 'textArea',
|
||||
note1: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: '常见问题',
|
||||
list: [
|
||||
{
|
||||
name: '问题',
|
||||
field: 'question',
|
||||
type: 'textArea',
|
||||
note1: '',
|
||||
},
|
||||
{
|
||||
name: '答复',
|
||||
field: 'answer',
|
||||
type: 'textArea',
|
||||
note1: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
])
|
||||
const navList = ref([])
|
||||
const navList2 = ref([])
|
||||
const fileList = ref({})
|
||||
const imgList = ref({})
|
||||
const videoList = ref({})
|
||||
const data = ref({})
|
||||
const refData = ref({})
|
||||
const submitFlag = ref(true)
|
||||
const dataFrom = ref({
|
||||
infoList: [
|
||||
{
|
||||
attrType: '组件类型',
|
||||
attrValue: '智能算法',
|
||||
delFlag: 0,
|
||||
},
|
||||
],
|
||||
delFlag: 0,
|
||||
type: '组件服务',
|
||||
deptId: '',
|
||||
})
|
||||
getUser().then((res) => {
|
||||
dataFrom.value.deptId = res.data.data.deptId
|
||||
})
|
||||
const back = () => {
|
||||
navList.value.forEach((val, index) => {
|
||||
if (val.key === showView.value && index > 0) {
|
||||
showView.value = navList2.value[index - 1]
|
||||
refData.value = data.value.filter(
|
||||
(item) => item.name === showView.value
|
||||
)[0]
|
||||
console.log('表单数据=============>', dataFrom.value)
|
||||
}
|
||||
})
|
||||
}
|
||||
const next = () => {
|
||||
let i = -1
|
||||
navList.value.forEach((val, index) => {
|
||||
if (val.key === showView.value && index < navList.value.length - 1) {
|
||||
i = index + 1
|
||||
}
|
||||
})
|
||||
if (i !== -1) {
|
||||
showView.value = navList2.value[i]
|
||||
refData.value = data.value.filter(
|
||||
(item) => item.name === showView.value
|
||||
)[0]
|
||||
console.log('表单数据=============>', dataFrom.value, refData.value)
|
||||
}
|
||||
}
|
||||
// 预览
|
||||
const preview = () => {
|
||||
dataFrom.value.infoList = dataFrom.value.infoList.filter(
|
||||
(item) => item.attrValue !== ''
|
||||
)
|
||||
console.log('预览==============>', dataFrom.value)
|
||||
window.sessionStorage.setItem('preview', JSON.stringify(dataFrom.value))
|
||||
const newpage = router.resolve({
|
||||
path: '/details',
|
||||
})
|
||||
window.open(newpage.href, '_blank')
|
||||
}
|
||||
const submit = () => {
|
||||
console.log('提交数据=============>', dataFrom.value)
|
||||
if (submitFlag.value) {
|
||||
submitFlag.value = false
|
||||
dataFrom.value.infoList = dataFrom.value.infoList.filter(
|
||||
(item) => item.attrValue !== ''
|
||||
)
|
||||
shangjiainsert(dataFrom.value).then((res) => {
|
||||
const instanceId = res.data.data
|
||||
dataFrom.value.id = res.data.data
|
||||
getUser().then((res6) => {
|
||||
getUserInfo(res6.data.data.id).then((res2) => {
|
||||
const deptId = res2.data.data.deptId
|
||||
const userId = res2.data.data.id
|
||||
const userName = res2.data.data.realName
|
||||
const params = {
|
||||
instanceId: instanceId,
|
||||
deptId: deptId,
|
||||
userId: userId,
|
||||
userName: userName,
|
||||
resourceDTO: [dataFrom.value],
|
||||
}
|
||||
shangjiaapply(params).then((res3) => {
|
||||
console.log('res3', res3)
|
||||
if (res3.data.code == 0) {
|
||||
message.success('上架成功!')
|
||||
submitFlag.value = true
|
||||
window.setTimeout(() => {
|
||||
window.close()
|
||||
}, 1000)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
const init = () => {
|
||||
getCategoryTree().then((res) => {
|
||||
// console.clear()
|
||||
res.data.data = res.data.data
|
||||
.filter((item) => item.name === '组件服务一')[0]
|
||||
.children.filter((item) => item.name === '智能算法')[0]
|
||||
navList.value = []
|
||||
navList2.value = []
|
||||
res.data.data.children.forEach((val) => {
|
||||
console.log(val)
|
||||
navList.value.push({
|
||||
name: val.name,
|
||||
key: val.name,
|
||||
})
|
||||
navList2.value.push(val.name)
|
||||
})
|
||||
data.value = res.data.data.children
|
||||
refData.value = data.value.filter(
|
||||
(item) => item.name === showView.value
|
||||
)[0]
|
||||
console.log('所有编目结构==============>', res.data.data)
|
||||
})
|
||||
}
|
||||
init()
|
||||
mybus.on('chageDataFrom', (obj) => {
|
||||
dataFrom.value.infoList = dataFrom.value.infoList.filter(
|
||||
(item) => item.attrType !== obj.attrType
|
||||
)
|
||||
if (obj.attrValue == [] || obj.attrValue == '[]' || obj.attrValue == null) {
|
||||
obj.attrValue = ''
|
||||
}
|
||||
dataFrom.value.infoList.push(obj)
|
||||
console.log('数据变更=================》', obj, dataFrom.value.infoList)
|
||||
})
|
||||
mybus.on('chageFileList', (obj) => {
|
||||
fileList.value = obj
|
||||
})
|
||||
mybus.on('chageImgList', (obj) => {
|
||||
imgList.value = obj
|
||||
})
|
||||
mybus.on('chageVideoList', (obj) => {
|
||||
videoList.value = obj
|
||||
})
|
||||
//datafrom外面数据
|
||||
mybus.on('chageDataFromDwon', (obj) => {
|
||||
switch (obj.attrType) {
|
||||
case '算法名称':
|
||||
dataFrom.value.name = obj.attrValue
|
||||
break
|
||||
case '算法描述':
|
||||
dataFrom.value.description = obj.attrValue
|
||||
break
|
||||
case '共享条件':
|
||||
dataFrom.value.shareCondition = obj.attrValue
|
||||
break
|
||||
case '共享类型':
|
||||
dataFrom.value.shareType = obj.attrValue
|
||||
break
|
||||
case '服务接口':
|
||||
dataFrom.value.apiUrl = obj.attrValue
|
||||
break
|
||||
case '接口请求方式':
|
||||
dataFrom.value.apiMethodType = obj.attrValue
|
||||
break
|
||||
}
|
||||
// console.log('dataFrom.value', dataFrom.value)
|
||||
})
|
||||
onBeforeUnmount(() => {
|
||||
mybus.off('chageDataFrom')
|
||||
mybus.off('chageFileList')
|
||||
mybus.off('chageImgList')
|
||||
mybus.off('chageDataFromDwon')
|
||||
})
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.box {
|
||||
position: relative;
|
||||
top: 64px;
|
||||
margin: 15px 400px;
|
||||
padding: 10px;
|
||||
background: #fff;
|
||||
.header {
|
||||
font-size: 28px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.vue-box {
|
||||
padding: 0 100px;
|
||||
}
|
||||
.top {
|
||||
margin: 10px 20px 0;
|
||||
padding: 15px 30px;
|
||||
background: #edf4fc;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
div {
|
||||
font-size: 18px;
|
||||
color: #999;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
.bg-box {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 45px;
|
||||
height: 45px;
|
||||
border-radius: 50%;
|
||||
border: 1px solid rgb(214, 214, 214);
|
||||
margin-right: 10px;
|
||||
transition: all 0.3s ease;
|
||||
span {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border-radius: 50%;
|
||||
border: 1px solid #999;
|
||||
}
|
||||
}
|
||||
.line {
|
||||
margin-left: 10px;
|
||||
width: 130px;
|
||||
height: 1px;
|
||||
background: #999;
|
||||
}
|
||||
}
|
||||
.finish {
|
||||
color: #0087ff;
|
||||
.bg-box {
|
||||
background: #9ccefa;
|
||||
color: #fff;
|
||||
border: 1px solid #9ccefa;
|
||||
span {
|
||||
background: #0087ff;
|
||||
border: 1px solid #0087ff;
|
||||
}
|
||||
}
|
||||
.line {
|
||||
background: #0087ff;
|
||||
}
|
||||
}
|
||||
}
|
||||
.btn {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 10px 400px 0;
|
||||
button {
|
||||
cursor: pointer;
|
||||
width: 80px;
|
||||
height: 35px;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
background: #0087ff;
|
||||
}
|
||||
button:nth-of-type(1) {
|
||||
color: #0087ff;
|
||||
background: #e1edfa;
|
||||
}
|
||||
button:nth-of-type(2) {
|
||||
background: #01c5dc;
|
||||
}
|
||||
}
|
||||
.first {
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,462 @@
|
|||
<!--
|
||||
* @Author: hisense.liangjunhua
|
||||
* @Date: 2022-06-20 09:35:17
|
||||
* @LastEditors: hisense.liangjunhua
|
||||
* @LastEditTime: 2022-06-20 10:26:49
|
||||
* @Description: 开发组件
|
||||
-->
|
||||
<template>
|
||||
<div class="box">
|
||||
<div class="header">能力上架申请</div>
|
||||
<div class="top">
|
||||
<div
|
||||
v-for="(nav, index) in navList"
|
||||
:key="nav"
|
||||
:class="[index <= navList2.indexOf(showView) ? 'finish' : '']"
|
||||
>
|
||||
<span class="bg-box">
|
||||
<span>{{ index + 1 }}</span>
|
||||
</span>
|
||||
<span>{{ nav.name }}</span>
|
||||
<div class="line" v-if="index !== navList.length - 1"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="vue-box">
|
||||
<put-on-the-shelf
|
||||
v-if="showView === '基本信息' && refData.name"
|
||||
:refData="refData"
|
||||
:dataFrom="dataFrom"
|
||||
:videoList="videoList"
|
||||
:externalField="['算法名称', '算法描述', '共享条件', '共享类型']"
|
||||
></put-on-the-shelf>
|
||||
<put-on-the-shelf
|
||||
v-else-if="showView === '算法优势'"
|
||||
:refData="refData"
|
||||
:dataFrom="dataFrom"
|
||||
:configure="sfys"
|
||||
></put-on-the-shelf>
|
||||
<put-on-the-shelf
|
||||
v-else-if="showView === '应用场景'"
|
||||
:refData="refData"
|
||||
:dataFrom="dataFrom"
|
||||
:configure="yycj"
|
||||
></put-on-the-shelf>
|
||||
<put-on-the-shelf
|
||||
v-else-if="showView === '部署与使用'"
|
||||
:refData="refData"
|
||||
:dataFrom="dataFrom"
|
||||
:fileList="fileList"
|
||||
:imgList="imgList"
|
||||
:externalField="['接口服务', '接口请求方式']"
|
||||
:configure="bs"
|
||||
></put-on-the-shelf>
|
||||
<!-- <algorithm-essential-information
|
||||
v-if="showView === '基本信息' && refData.name"
|
||||
:refData="refData"
|
||||
:dataFrom="dataFrom"
|
||||
:videoList="videoList"
|
||||
></algorithm-essential-information>
|
||||
<algorithm-advantage
|
||||
v-else-if="showView === '算法优势'"
|
||||
:refData="refData"
|
||||
:dataFrom="dataFrom"
|
||||
></algorithm-advantage>
|
||||
<algorithm-scenarios
|
||||
v-else-if="showView === '应用场景'"
|
||||
:refData="refData"
|
||||
:dataFrom="dataFrom"
|
||||
></algorithm-scenarios> -->
|
||||
<!-- <algorithm-scenarios
|
||||
v-else-if="showView === '应用场景'"
|
||||
:refData="refData"
|
||||
:dataFrom="dataFrom"
|
||||
></algorithm-scenarios> -->
|
||||
<!-- <algorithm-deployment-use
|
||||
v-else-if="showView === '部署与使用'"
|
||||
:refData="refData"
|
||||
:dataFrom="dataFrom"
|
||||
:fileList="fileList"
|
||||
:imgList="imgList"
|
||||
></algorithm-deployment-use> -->
|
||||
</div>
|
||||
<div class="btn" :class="showView === '基本信息' ? 'first' : ''">
|
||||
<button v-show="showView !== '基本信息'" @click="back()">上一步</button>
|
||||
<button v-show="showView === '部署与使用'" @click="preview()">
|
||||
预览
|
||||
</button>
|
||||
<button v-show="showView !== '部署与使用'" @click="next()">下一步</button>
|
||||
<button v-show="showView === '部署与使用'" @click="submit()">提交</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
// import AlgorithmEssentialInformation from '@/views/capacityOnTheShelf/components/AlgorithmEssentialInformation.vue'
|
||||
// import AlgorithmAdvantage from '@/views/capacityOnTheShelf/components/AlgorithmAdvantage.vue'
|
||||
// import AlgorithmScenarios from '@/views/capacityOnTheShelf/components/AlgorithmScenarios.vue'
|
||||
import PutOnTheShelf from '@/views/capacityOnTheShelf/components/PutOnTheShelf.vue'
|
||||
// import AlgorithmDeploymentUse from '@/views/capacityOnTheShelf/components/AlgorithmDeploymentUse.vue'
|
||||
import { ref, onBeforeUnmount } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { getCategoryTree } from '@/api/personalCenter'
|
||||
import { shangjiainsert, shangjiaapply } from '@/api/personalCenter'
|
||||
import { getUser, getUserInfo } from '@/api/home'
|
||||
import { message } from 'ant-design-vue'
|
||||
import mybus from '@/myplugins/mybus'
|
||||
const router = useRouter()
|
||||
const showView = ref('基本信息')
|
||||
const sfys = ref([
|
||||
{
|
||||
name: '算法优势',
|
||||
list: [
|
||||
{
|
||||
name: '算法优势名称',
|
||||
field: 'name',
|
||||
type: 'input',
|
||||
note1: '',
|
||||
},
|
||||
{
|
||||
name: '算法优势描述',
|
||||
field: 'desc',
|
||||
type: 'textArea',
|
||||
note1: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
])
|
||||
const yycj = ref([
|
||||
{
|
||||
name: '应用场景',
|
||||
list: [
|
||||
{
|
||||
name: '应用场景名称',
|
||||
field: 'name',
|
||||
type: 'input',
|
||||
note1: '',
|
||||
},
|
||||
{
|
||||
name: '应用场景描述',
|
||||
field: 'desc',
|
||||
type: 'textArea',
|
||||
note1: '',
|
||||
},
|
||||
{
|
||||
name: '应用场景图片',
|
||||
field: 'img',
|
||||
type: 'image',
|
||||
note1: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
])
|
||||
const bs = ref([
|
||||
{
|
||||
name: '计费标准信息',
|
||||
list: [
|
||||
{
|
||||
name: '计费方式',
|
||||
field: 'type',
|
||||
type: 'radio',
|
||||
options: ['一次性买断', '按调用次数', '按并发路数', '按年计费'],
|
||||
note1: '',
|
||||
},
|
||||
{
|
||||
name: '计费标准',
|
||||
field: 'price',
|
||||
type: 'number',
|
||||
company: '元',
|
||||
note1: '',
|
||||
},
|
||||
{
|
||||
name: '计费标准描述',
|
||||
field: 'desc',
|
||||
type: 'textArea',
|
||||
note1: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: '常见问题',
|
||||
list: [
|
||||
{
|
||||
name: '问题',
|
||||
field: 'question',
|
||||
type: 'textArea',
|
||||
note1: '',
|
||||
},
|
||||
{
|
||||
name: '答复',
|
||||
field: 'answer',
|
||||
type: 'textArea',
|
||||
note1: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
])
|
||||
const navList = ref([])
|
||||
const navList2 = ref([])
|
||||
const fileList = ref({})
|
||||
const imgList = ref({})
|
||||
const videoList = ref({})
|
||||
const data = ref({})
|
||||
const refData = ref({})
|
||||
const submitFlag = ref(true)
|
||||
const dataFrom = ref({
|
||||
infoList: [
|
||||
{
|
||||
attrType: '组件类型',
|
||||
attrValue: '智能算法',
|
||||
delFlag: 0,
|
||||
},
|
||||
],
|
||||
delFlag: 0,
|
||||
type: '组件服务',
|
||||
deptId: '',
|
||||
})
|
||||
getUser().then((res) => {
|
||||
dataFrom.value.deptId = res.data.data.deptId
|
||||
})
|
||||
const back = () => {
|
||||
navList.value.forEach((val, index) => {
|
||||
if (val.key === showView.value && index > 0) {
|
||||
showView.value = navList2.value[index - 1]
|
||||
refData.value = data.value.filter(
|
||||
(item) => item.name === showView.value
|
||||
)[0]
|
||||
console.log('表单数据=============>', dataFrom.value)
|
||||
}
|
||||
})
|
||||
}
|
||||
const next = () => {
|
||||
let i = -1
|
||||
navList.value.forEach((val, index) => {
|
||||
if (val.key === showView.value && index < navList.value.length - 1) {
|
||||
i = index + 1
|
||||
}
|
||||
})
|
||||
if (i !== -1) {
|
||||
showView.value = navList2.value[i]
|
||||
refData.value = data.value.filter(
|
||||
(item) => item.name === showView.value
|
||||
)[0]
|
||||
console.log('表单数据=============>', dataFrom.value, refData.value)
|
||||
}
|
||||
}
|
||||
// 预览
|
||||
const preview = () => {
|
||||
dataFrom.value.infoList = dataFrom.value.infoList.filter(
|
||||
(item) => item.attrValue !== ''
|
||||
)
|
||||
console.log('预览==============>', dataFrom.value)
|
||||
window.sessionStorage.setItem('preview', JSON.stringify(dataFrom.value))
|
||||
const newpage = router.resolve({
|
||||
path: '/details',
|
||||
})
|
||||
window.open(newpage.href, '_blank')
|
||||
}
|
||||
const submit = () => {
|
||||
console.log('提交数据=============>', dataFrom.value)
|
||||
if (submitFlag.value) {
|
||||
submitFlag.value = false
|
||||
dataFrom.value.infoList = dataFrom.value.infoList.filter(
|
||||
(item) => item.attrValue !== ''
|
||||
)
|
||||
shangjiainsert(dataFrom.value).then((res) => {
|
||||
const instanceId = res.data.data
|
||||
dataFrom.value.id = res.data.data
|
||||
getUser().then((res6) => {
|
||||
getUserInfo(res6.data.data.id).then((res2) => {
|
||||
const deptId = res2.data.data.deptId
|
||||
const userId = res2.data.data.id
|
||||
const userName = res2.data.data.realName
|
||||
const params = {
|
||||
instanceId: instanceId,
|
||||
deptId: deptId,
|
||||
userId: userId,
|
||||
userName: userName,
|
||||
resourceDTO: [dataFrom.value],
|
||||
}
|
||||
shangjiaapply(params).then((res3) => {
|
||||
console.log('res3', res3)
|
||||
if (res3.data.code == 0) {
|
||||
message.success('上架成功!')
|
||||
submitFlag.value = true
|
||||
window.setTimeout(() => {
|
||||
window.close()
|
||||
}, 1000)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
const init = () => {
|
||||
getCategoryTree().then((res) => {
|
||||
// console.clear()
|
||||
res.data.data = res.data.data
|
||||
.filter((item) => item.name === '组件服务一')[0]
|
||||
.children.filter((item) => item.name === '智能算法')[0]
|
||||
navList.value = []
|
||||
navList2.value = []
|
||||
res.data.data.children.forEach((val) => {
|
||||
console.log(val)
|
||||
navList.value.push({
|
||||
name: val.name,
|
||||
key: val.name,
|
||||
})
|
||||
navList2.value.push(val.name)
|
||||
})
|
||||
data.value = res.data.data.children
|
||||
refData.value = data.value.filter(
|
||||
(item) => item.name === showView.value
|
||||
)[0]
|
||||
console.log('所有编目结构==============>', res.data.data)
|
||||
})
|
||||
}
|
||||
init()
|
||||
mybus.on('chageDataFrom', (obj) => {
|
||||
dataFrom.value.infoList = dataFrom.value.infoList.filter(
|
||||
(item) => item.attrType !== obj.attrType
|
||||
)
|
||||
if (obj.attrValue == [] || obj.attrValue == '[]' || obj.attrValue == null) {
|
||||
obj.attrValue = ''
|
||||
}
|
||||
dataFrom.value.infoList.push(obj)
|
||||
console.log('数据变更=================》', obj, dataFrom.value.infoList)
|
||||
})
|
||||
mybus.on('chageFileList', (obj) => {
|
||||
fileList.value = obj
|
||||
})
|
||||
mybus.on('chageImgList', (obj) => {
|
||||
imgList.value = obj
|
||||
})
|
||||
mybus.on('chageVideoList', (obj) => {
|
||||
videoList.value = obj
|
||||
})
|
||||
//datafrom外面数据
|
||||
mybus.on('chageDataFromDwon', (obj) => {
|
||||
switch (obj.attrType) {
|
||||
case '算法名称':
|
||||
dataFrom.value.name = obj.attrValue
|
||||
break
|
||||
case '算法描述':
|
||||
dataFrom.value.description = obj.attrValue
|
||||
break
|
||||
case '共享条件':
|
||||
dataFrom.value.shareCondition = obj.attrValue
|
||||
break
|
||||
case '共享类型':
|
||||
dataFrom.value.shareType = obj.attrValue
|
||||
break
|
||||
case '服务接口':
|
||||
dataFrom.value.apiUrl = obj.attrValue
|
||||
break
|
||||
case '接口请求方式':
|
||||
dataFrom.value.apiMethodType = obj.attrValue
|
||||
break
|
||||
}
|
||||
// console.log('dataFrom.value', dataFrom.value)
|
||||
})
|
||||
onBeforeUnmount(() => {
|
||||
mybus.off('chageDataFrom')
|
||||
mybus.off('chageFileList')
|
||||
mybus.off('chageImgList')
|
||||
mybus.off('chageDataFromDwon')
|
||||
})
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.box {
|
||||
position: relative;
|
||||
top: 64px;
|
||||
margin: 15px 400px;
|
||||
padding: 10px;
|
||||
background: #fff;
|
||||
.header {
|
||||
font-size: 28px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.vue-box {
|
||||
padding: 0 100px;
|
||||
}
|
||||
.top {
|
||||
margin: 10px 20px 0;
|
||||
padding: 15px 30px;
|
||||
background: #edf4fc;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
div {
|
||||
font-size: 18px;
|
||||
color: #999;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
.bg-box {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 45px;
|
||||
height: 45px;
|
||||
border-radius: 50%;
|
||||
border: 1px solid rgb(214, 214, 214);
|
||||
margin-right: 10px;
|
||||
transition: all 0.3s ease;
|
||||
span {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border-radius: 50%;
|
||||
border: 1px solid #999;
|
||||
}
|
||||
}
|
||||
.line {
|
||||
margin-left: 10px;
|
||||
width: 130px;
|
||||
height: 1px;
|
||||
background: #999;
|
||||
}
|
||||
}
|
||||
.finish {
|
||||
color: #0087ff;
|
||||
.bg-box {
|
||||
background: #9ccefa;
|
||||
color: #fff;
|
||||
border: 1px solid #9ccefa;
|
||||
span {
|
||||
background: #0087ff;
|
||||
border: 1px solid #0087ff;
|
||||
}
|
||||
}
|
||||
.line {
|
||||
background: #0087ff;
|
||||
}
|
||||
}
|
||||
}
|
||||
.btn {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 10px 400px 0;
|
||||
button {
|
||||
cursor: pointer;
|
||||
width: 80px;
|
||||
height: 35px;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
background: #0087ff;
|
||||
}
|
||||
button:nth-of-type(1) {
|
||||
color: #0087ff;
|
||||
background: #e1edfa;
|
||||
}
|
||||
button:nth-of-type(2) {
|
||||
background: #01c5dc;
|
||||
}
|
||||
}
|
||||
.first {
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
</style>
|
Loading…
Reference in New Issue