修改多条添加逻辑

This commit is contained in:
a0049873 2022-07-19 18:51:21 +08:00
parent 8ec4b585b6
commit 7bcb6b2062
2 changed files with 113 additions and 8 deletions

View File

@ -2,7 +2,7 @@
* @Author: hisense.liangjunhua * @Author: hisense.liangjunhua
* @Date: 2022-06-13 10:22:27 * @Date: 2022-06-13 10:22:27
* @LastEditors: hisense.liangjunhua * @LastEditors: hisense.liangjunhua
* @LastEditTime: 2022-07-16 14:27:31 * @LastEditTime: 2022-07-19 18:34:53
* @Description: 算法上架 * @Description: 算法上架
--> -->
<template> <template>
@ -24,6 +24,7 @@
<div class="vue-box"> <div class="vue-box">
<put-on-the-shelf <put-on-the-shelf
v-if="showView === '基本信息' && refData.name" v-if="showView === '基本信息' && refData.name"
ref="refPutOnTheShelf"
:refData="refData" :refData="refData"
:dataFrom="dataFrom" :dataFrom="dataFrom"
:videoList="videoList" :videoList="videoList"
@ -31,18 +32,25 @@
></put-on-the-shelf> ></put-on-the-shelf>
<put-on-the-shelf <put-on-the-shelf
v-else-if="showView === '算法优势'" v-else-if="showView === '算法优势'"
ref="refPutOnTheShelf"
:refData="refData" :refData="refData"
:dataFrom="dataFrom" :dataFrom="dataFrom"
:configure="sfys" :configure="sfys"
@next="next()"
@back="back()"
></put-on-the-shelf> ></put-on-the-shelf>
<put-on-the-shelf <put-on-the-shelf
v-else-if="showView === '应用场景'" v-else-if="showView === '应用场景'"
ref="refPutOnTheShelf"
:refData="refData" :refData="refData"
:dataFrom="dataFrom" :dataFrom="dataFrom"
:configure="yycj" :configure="yycj"
@next="next()"
@back="back()"
></put-on-the-shelf> ></put-on-the-shelf>
<put-on-the-shelf <put-on-the-shelf
v-else-if="showView === '部署与使用'" v-else-if="showView === '部署与使用'"
ref="refPutOnTheShelf"
:refData="refData" :refData="refData"
:dataFrom="dataFrom" :dataFrom="dataFrom"
:fileList="fileList" :fileList="fileList"
@ -50,6 +58,8 @@
:imgList="imgList" :imgList="imgList"
:externalField="['接口服务', '接口请求方式']" :externalField="['接口服务', '接口请求方式']"
:configure="bs" :configure="bs"
@submit="submit()"
@back="back()"
></put-on-the-shelf> ></put-on-the-shelf>
<!-- <algorithm-essential-information <!-- <algorithm-essential-information
v-if="showView === '基本信息' && refData.name" v-if="showView === '基本信息' && refData.name"
@ -82,12 +92,58 @@
</div> </div>
<div class="btn" :class="showView === '基本信息' ? 'first' : ''"> <div class="btn" :class="showView === '基本信息' ? 'first' : ''">
<button @click="close()">取消</button> <button @click="close()">取消</button>
<button v-show="showView !== '基本信息'" @click="back()">上一步</button> <a-popconfirm
v-if="showView == '算法优势'"
title="如果信息未填写完整将会被丢弃,是否返回上一步?"
ok-text="是"
cancel-text="否"
@confirm="changeSfys('上一步')"
@cancel="cancel"
>
<button>上一步</button>
</a-popconfirm>
<a-popconfirm
v-else-if="showView == '应用场景'"
title="如果信息未填写完整将会被丢弃,是否返回上一步?"
ok-text="是"
cancel-text="否"
@confirm="changeYycj('上一步')"
@cancel="cancel"
>
<button>上一步</button>
</a-popconfirm>
<button v-else-if="showView !== '基本信息'" @click="back()">
上一步
</button>
<button v-show="showView === '部署与使用'" @click="preview()"> <button v-show="showView === '部署与使用'" @click="preview()">
预览 预览
</button> </button>
<button v-show="showView !== '部署与使用'" @click="next()">下一步</button> <a-popconfirm
<button v-show="showView === '部署与使用'" @click="submit()">提交</button> v-if="showView == '算法优势'"
title="如果信息未填写完整将会被丢弃,是否进行下一步?"
ok-text="是"
cancel-text="否"
@confirm="changeSfys('下一步')"
@cancel="cancel"
>
<button>下一步</button>
</a-popconfirm>
<a-popconfirm
v-else-if="showView == '应用场景'"
title="如果信息未填写完整将会被丢弃,是否进行下一步?"
ok-text="是"
cancel-text="否"
@confirm="changeYycj('下一步')"
@cancel="cancel"
>
<button>下一步</button>
</a-popconfirm>
<button v-else-if="showView !== '部署与使用'" @click="next()">
下一步
</button>
<button v-show="showView === '部署与使用'" @click="changeBs()">
提交
</button>
</div> </div>
</div> </div>
</template> </template>
@ -332,6 +388,21 @@
console.log('所有编目结构==============>', res.data.data) console.log('所有编目结构==============>', res.data.data)
}) })
} }
//
const refPutOnTheShelf = ref(null)
const changeSfys = (type) => {
console.log(refPutOnTheShelf)
refPutOnTheShelf.value.add('算法优势', true, type)
}
const changeYycj = (type) => {
console.log(refPutOnTheShelf)
refPutOnTheShelf.value.add('应用场景', true, type)
}
const changeBs = (type) => {
console.log(refPutOnTheShelf)
refPutOnTheShelf.value.add('计费标准信息', true)
refPutOnTheShelf.value.add('常见问题', true, type)
}
init() init()
mybus.on('chageDataFrom', (obj) => { mybus.on('chageDataFrom', (obj) => {
if (obj.attrType == '技术文档' && obj.attrValue != null) { if (obj.attrType == '技术文档' && obj.attrValue != null) {

View File

@ -2,7 +2,7 @@
* @Author: hisense.liangjunhua * @Author: hisense.liangjunhua
* @Date: 2022-06-17 14:11:08 * @Date: 2022-06-17 14:11:08
* @LastEditors: hisense.liangjunhua * @LastEditors: hisense.liangjunhua
* @LastEditTime: 2022-07-19 14:50:30 * @LastEditTime: 2022-07-19 18:49:40
* @Description: 上架 * @Description: 上架
--> -->
<template> <template>
@ -442,7 +442,14 @@
</div> </div>
</template> </template>
<script setup> <script setup>
import { ref, defineProps, watch, onMounted } from 'vue' import {
ref,
defineProps,
watch,
onMounted,
defineExpose,
defineEmits,
} from 'vue'
import mybus from '@/myplugins/mybus' import mybus from '@/myplugins/mybus'
import upload from '@/views/components/upload' import upload from '@/views/components/upload'
import { message } from 'ant-design-vue' import { message } from 'ant-design-vue'
@ -518,6 +525,7 @@
// ] // ]
// }] // }]
}) })
const emit = defineEmits(['next', 'back', 'submit'])
// console.log('props==========>', props) // console.log('props==========>', props)
const changeAdd = () => { const changeAdd = () => {
console.log('子组件方法触发~') console.log('子组件方法触发~')
@ -655,7 +663,7 @@
showText.value = show showText.value = show
}) })
mybus.off('func') mybus.off('func')
const add = (title) => { const add = (title, addFlag, type) => {
console.log(title, 'title') console.log(title, 'title')
let list = props.configure.filter((item) => item.name === title)[0].list let list = props.configure.filter((item) => item.name === title)[0].list
let flag = true let flag = true
@ -707,8 +715,31 @@
item.note1 = '' item.note1 = ''
showKey.value++ showKey.value++
}) })
if (addFlag) {
if (type == '上一步') {
emit('back')
} else if (type == '下一步') {
emit('next')
} else if (type == '提交') {
emit('submit')
}
}
} else { } else {
message.warning('请填写完整') if (!addFlag) {
message.warning('请填写完整')
} else {
list.forEach((item) => {
item.note1 = ''
showKey.value++
})
if (type == '上一步') {
emit('back')
} else if (type == '下一步') {
emit('next')
} else if (type == '提交') {
emit('submit')
}
}
} }
} }
const del = (title, index) => { const del = (title, index) => {
@ -927,6 +958,9 @@
const filterOption = (input, option) => { const filterOption = (input, option) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
} }
defineExpose({
add,
})
</script> </script>
<style></style> <style></style>
<style lang="less" scoped> <style lang="less" scoped>