后台 上架功能开发

This commit is contained in:
a0049873 2022-07-11 15:41:18 +08:00
parent c4a99bf8de
commit 2eca6ab758
7 changed files with 232 additions and 66 deletions

View File

@ -2,7 +2,7 @@
* @Author: hisense.wuhongjian
* @Date: 2022-04-11 10:11:40
* @LastEditors: hisense.liangjunhua
* @LastEditTime: 2022-07-08 14:13:20
* @LastEditTime: 2022-07-11 12:09:13
* @Description: 告诉大家这是什么
-->
<!DOCTYPE html>
@ -43,8 +43,9 @@
<script>
// window.SITE_CONFIG['apiURL'] = 'http://15.2.21.166:8888/renren-admin';
// window.SITE_CONFIG['apiURL'] = 'http://124.222.94.39:8888/renren-admin';
window.SITE_CONFIG['apiURL'] = 'http://10.16.5.35:8888/renren-admin';
// window.SITE_CONFIG['apiURL'] = 'http://15.2.21.238:8888/renren-admin';
// window.SITE_CONFIG['apiURL'] = 'http://10.16.5.35:8888/renren-admin';
window.SITE_CONFIG['apiURL'] = 'http://15.2.21.238:8888/renren-admin';
window.SITE_CONFIG['previewUrl'] = 'http://15.2.21.238:9796/';
// window.SITE_CONFIG['apiURL'] = 'http://15.2.23.141:8000/renren-admin';
// WebSocket地址
window.SITE_CONFIG['socketURL'] ='ws://localhost:8080/renren-admin/websocket';

View File

@ -19,14 +19,14 @@
$t("export")
}}</el-button>
</el-form-item>
<el-form-item>
<!-- <el-form-item>
<el-button
v-if="$hasPermission('ability:bsabilityai:save')"
type="primary"
@click="addOrUpdateHandleAI()"
>挂接</el-button
>
</el-form-item>
</el-form-item> -->
<el-form-item>
<el-button
type="primary"
@ -90,12 +90,19 @@
width="150"
>
<template slot-scope="scope">
<el-button
<!-- <el-button
v-if="$hasPermission('ability:bsabilityai:update')"
type="text"
size="small"
@click="UpdateHandle(scope.row)"
>{{ $t("update") }}</el-button
> -->
<el-button
v-if="$hasPermission('ability:bsabilityai:update')"
type="text"
size="small"
@click="UpdateData(scope.row)"
>{{ $t("update") }}</el-button
>
<el-button
v-if="$hasPermission('ability:bsabilityai:delete')"
@ -150,7 +157,7 @@
</span>
</el-dialog>
<el-dialog
:title="'上架'+radio"
:title="submitFrom.id?'修改'+radio:'上架'+radio"
:visible.sync="showPutOnTheShelfFlag2"
:close-on-click-modal='false'
:close-on-press-escape='false'
@ -289,7 +296,6 @@ export default {
// this.addOrUpdateHandle(id)
this.addOrUpdateVisible = true
this.disabled = false
console.log('显示数据=============》', val)
this.$nextTick(() => {
this.$refs.addOrUpdate.UpdateState = false
this.$refs.addOrUpdate.dataFormShowDetails = val
@ -298,7 +304,6 @@ export default {
this.disabled = true
},
showDocument (val) {
console.log(val)
window.open(
window.SITE_CONFIG.frontUrl + '?id=' + val.id + '&&type=' + val.type,
'_blank'
@ -324,7 +329,6 @@ export default {
})
)
.then(({ data: res }) => {
console.log('res', res)
if (res.code !== 0) {
this.dataList = []
this.total = 0
@ -354,32 +358,11 @@ export default {
fullScreen () {
if (window.outerHeight === screen.availHeight) {
if (window.outerWidth === screen.availWidth) {
console.log(
'全屏1',
window.outerHeight,
screen.availHeight,
window.outerWidth,
screen.availWidth
)
this.qp = false
} else {
console.log(
'不是全屏2',
window.outerHeight,
screen.availHeight,
window.outerWidth,
screen.availWidth
)
this.qp = true
}
} else {
console.log(
'不是全屏3',
window.outerHeight,
screen.availHeight,
window.outerWidth,
screen.availWidth
)
this.qp = true
}
},
@ -400,7 +383,7 @@ export default {
handleIsShowRelatePopup (type) {
this.relateApplicationVisible = type
},
//
//
clear () {
this.showPutOnTheShelfFlag = false
this.showPutOnTheShelfFlag2 = false
@ -417,6 +400,7 @@ export default {
}
]
}
this.reset()
},
showPutOnTheShelf () {
this.showPutOnTheShelfFlag = true
@ -429,9 +413,9 @@ export default {
this.showPutOnTheShelfFlag2 = true
this.submitFrom.infoList[0].attrValue = this.radio
this.putOnTheShelfList = this.insertList.children.filter(item => item.name === this.radio)[0].children
console.log('radio', this.radio)
},
changeInfoList (obj) {
console.log(obj, this.submitFrom)
this.submitFrom.infoList = this.submitFrom.infoList.filter((item) => item.attrType !== obj.attrType)
this.submitFrom.infoList.push(obj)
},
@ -483,12 +467,20 @@ export default {
case '部门联系人电话':
this.submitFrom.deptPhone = val.note1
break
case '归属部门':
this.submitFrom.deptId = val.note1
break
case '能力类型':
this.submitFrom.type = val.note1
break
default:
if (val.type !== 'image' && val.type !== 'file' && val.type !== 'video') {
this.submitFrom.infoList.push({
attrType: val.name,
attrValue: val.note1,
delFlag: 0
})
}
break
}
}
@ -497,7 +489,124 @@ export default {
})
})
this.submitFrom.infoList = this.submitFrom.infoList.sort((a, b) => arr.indexOf(a.attrType) - arr.indexOf(b.attrType))
console.log('表单数据=================>', this.submitFrom, this.putOnTheShelfList, arr)
if (this.submitFrom.id) {
//
this.submitFrom.infoList.map(val => {
if (val.attrType === '组件类型') {
val.attrValue = this.radio
}
})
console.log('编辑===============>', this.submitFrom)
this.$http
.put('/resource/update', this.submitFrom)
.then(({ data: res }) => {
if (res.code !== 0) {
this.$message.error('修改失败!')
} else {
this.$message.success('修改成功!')
this.clear()
}
})
.catch(() => {})
} else {
this.$http
.post('/resource/insert?source= b', this.submitFrom)
.then(({ data: res }) => {
if (res.code !== 0) {
this.$message.error('上架失败!')
} else {
this.$message.success('上架成功!')
this.clear()
}
})
.catch(() => {})
}
},
//
UpdateData (item) {
this.$http.get('/category/getCategoryTree').then(res => {
this.insertList = res.data.data.filter(item => item.name === '组件服务一')[0]
this.radio = item.infoList.filter(val => val.attrType === '组件类型')[0].attrValue
this.putOnTheShelfList = this.insertList.children.filter(item => item.name === this.radio)[0].children
this.putOnTheShelfList.map(parent => {
parent.children.map(child => {
if (child.name === '算法优势' || child.name === '应用场景' || child.name === '功能介绍') {
const obj = item.infoList.filter(val => val.attrType === child.name)[0]
if (obj) {
child.note1 = obj.attrValue
}
} else {
if (child.children) {
child.children.map(data => {
if (data.name === '计费标准信息' || data.name === '常见问题') {
const obj = item.infoList.filter(val => val.attrType === child.name)[0]
if (obj) {
data.note1 = obj.attrValue
}
} else {
switch (data.name) {
case '算法名称':
case '应用名称':
case '组件名称':
case '图层名称':
data.note1 = item.name
break
case '算法描述':
case '应用描述':
case '组件描述':
case '图层描述':
data.note1 = item.description
break
case '共享条件':
data.note1 = item.shareCondition
break
case '共享类型':
data.note1 = item.shareType
break
case '服务接口':
data.note1 = item.apiUrl
break
case '接口请求方式':
data.note1 = item.apiMethodType
break
case '访问地址':
data.note1 = item.link
break
case '部门联系人':
data.note1 = item.deptContacts
break
case '部门联系人电话':
data.note1 = item.deptPhone
break
case '归属部门':
data.note1 = item.deptId
break
case '能力类型':
data.note1 = item.type
break
default:
// eslint-disable-next-line no-case-declarations
const obj1 = item.infoList.filter(val => val.attrType === data.name)[0]
if (obj1) {
data.note1 = obj1.attrValue
}
break
}
if (data.type === 'image' || data.type === 'file' || data.type === 'video') {
const obj1 = item.infoList.filter(val => val.attrType === data.name)[0]
if (obj1) {
data.note2 = obj1.note2
}
}
}
})
}
}
})
})
this.submitFrom.id = item.id
this.showPutOnTheShelfFlag2 = true
})
}
}
}

View File

@ -48,8 +48,6 @@ export default {
},
methods: {
onSuccess (res, file) {
console.log('limit', this.limit)
console.log(res, file, this.child)
if (res.code !== 0) {
return this.$message.error('上传图片失败')
}
@ -88,10 +86,8 @@ export default {
} else {
this.child.note1 = arr.join(';')
}
console.log(this.child.note1)
},
onPreview (file) {
console.log('点击预览===============>', file)
window.open(file.response.data)
},
onExceed (files, fileList) {

View File

@ -2,7 +2,7 @@
* @Author: hisense.liangjunhua
* @Date: 2022-07-08 14:55:19
* @LastEditors: hisense.liangjunhua
* @LastEditTime: 2022-07-08 17:23:58
* @LastEditTime: 2022-07-11 15:39:31
* @Description: 告诉大家这是什么
-->
<template>
@ -41,7 +41,7 @@ export default {
data () {
return {
apiURL: window.SITE_CONFIG.apiURL + '/upload?token=' + Cookies.get('ucsToken'),
fileList: JSON.parse(JSON.stringify(this.list))
fileList: []
}
},
methods: {
@ -53,11 +53,19 @@ export default {
},
handlePreview (file) {
console.log(file)
if (file.response) {
window.open(
window.SITE_CONFIG.previewUrl +
'hisense_office/onlinePreview?url=' +
btoa(encodeURI(file.response.data))
)
} else {
window.open(
window.SITE_CONFIG.previewUrl +
'hisense_office/onlinePreview?url=' +
btoa(encodeURI(file.url))
)
}
},
handleChange (file, fileList) {
console.log(file, fileList)
@ -71,7 +79,8 @@ export default {
this.$emit('changeInfoList', {
attrType: this.title,
attrValue: file.response.data,
delFlag: 0
delFlag: 0,
note2: file.name
})
} else {
this.$message.error(file.name + '上传失败')
@ -83,12 +92,20 @@ export default {
}
},
handleRemove (file) {
console.log(file, '删除', this.title)
this.$emit('changeInfoList', {
attrType: this.title,
attrValue: '',
delFlag: 0
delFlag: 0,
note2: null
})
}
},
created () {
if (this.list.note1) {
this.fileList.push({ name: this.list.note2 || '--', url: this.list.note1 })
}
console.log('上传组件===================>', this.list, this.fileList)
}
}
</script>

View File

@ -19,7 +19,7 @@ js:
<a-input v-if="type == 'input'" v-model:value="data.note1" :placeholder="'请输入' + name" />
<!-- 下拉框 -->
<el-select
v-else-if="type === 'select' || type == 'radio'"
v-else-if="(type === 'select' && name !== '归属部门') || type == 'radio'"
style="width: 240px"
v-model:value="data.note1"
:placeholder="'请选择' + name">
@ -30,6 +30,21 @@ js:
{{ itemSelect.dictLabel }}
</el-option>
</el-select>
<el-select
v-else-if="(type === 'select' && name === '归属部门')"
style="width: 240px"
v-model:value="data.note1"
filterable
placeholder="请输入关键词"
:loading="loading">
<el-option
v-for="(itemSelect) in options"
:key="itemSelect.id"
:label="itemSelect.name"
:value="itemSelect.id">
{{ itemSelect.name }}
</el-option>
</el-select>
<!-- 多选 -->
<div
v-else-if="type === 'checkBox'"
@ -82,16 +97,26 @@ export default {
if (this.data.isLinkToDic === 'true' && this.data.linkValue) {
this.$http
.get(`/sys/dict/data/page?page=1&limit=20&dictTypeId=${this.data.linkValue}&deFlage=0`).then(({ data: res }) => {
console.log(res, 'res')
const dataList = []
res.data.list.forEach((element) => {
dataList.push(element)
console.log(dataList, 'this.options')
})
this.options = dataList
console.log(this.options)
})
.catch(() => {})
} else if (this.data.name === '归属部门') {
this.$http.get('/sys/dept/all').then(res => {
const dataList = []
res.data.data.forEach((element) => {
dataList.push(element)
})
this.options = dataList
if (!this.data.note1) {
this.$http.get('/sys/user/info').then(({ data: res }) => {
this.data.note1 = res.data.deptId
})
}
})
}
},
chekBoxChange (list) {
@ -102,10 +127,16 @@ export default {
str += ';'
}
})
// console.log(str)
this.data.note1 = str
}
},
created () {
if (this.data.name === '应用领域') {
if (this.data.note1) {
this.valueCheckBox = this.data.note1.split(';')
}
}
},
mounted () {
this.selectOptions()
}

View File

@ -2,7 +2,7 @@
* @Author: hisense.liangjunhua
* @Date: 2022-07-08 09:54:50
* @LastEditors: hisense.liangjunhua
* @LastEditTime: 2022-07-09 10:54:48
* @LastEditTime: 2022-07-11 15:00:24
* @Description: 多条数据特殊处理
-->
<template>
@ -62,7 +62,8 @@ export default {
upload
},
props: {
configure: Object
configure: Object,
showData: Object
},
data () {
return {
@ -75,7 +76,6 @@ export default {
const list = this.configure.list
let flag = true
list.forEach((item) => {
console.log(item)
if (item.type !== 'number' && !item.note1.length > 0) {
flag = false
} else if (item.type === 'number' && !item.note1 > 0) {
@ -88,7 +88,6 @@ export default {
obj[item.field] = item.note1
})
this.data.push(obj)
// console.log(data.value[title])
this.$emit('changeInfoList', {
attrType: title,
attrValue: JSON.stringify(this.data),
@ -110,6 +109,17 @@ export default {
delFlag: 0
})
}
},
created () {
if (this.configure.name === '计费标准信息' || this.configure.name === '常见问题') {
if (this.showData.children[0].note1) {
this.data = JSON.parse(this.showData.children[0].note1)
}
} else {
if (this.showData.note1) {
this.data = JSON.parse(this.showData.note1)
}
}
}
}
</script>

View File

@ -2,7 +2,7 @@
* @Author: hisense.liangjunhua
* @Date: 2022-07-08 09:48:52
* @LastEditors: hisense.liangjunhua
* @LastEditTime: 2022-07-09 10:57:07
* @LastEditTime: 2022-07-11 15:11:10
* @Description: 告诉大家这是什么
-->
<template>
@ -13,13 +13,15 @@
<div class="top">{{child.name}}</div>
<div v-for="item in child.children" :key="item.id" class='item'>
<span v-if="item.name != '来源应用'">{{ item.name }}</span>
<upload :list="[]" v-if="item.type == 'image'" type="图片" btnName="上传图片" :maxCount="1" :data="item"
tip="支持图片类型大小不超过100M"></upload>
<upload @changeInfoList='changeInfoList' :title='item.name' accept='.pdf,.ppt,.xlsx,.doc,.docx' :list="[]" v-else-if="item.type == 'file' && item.name !== '使用手册'" type="文件" btnName="上传附件" :maxCount="1"
<!-- <upload :list="[]" v-if="item.type == 'image'" type="图片" btnName="上传图片" :maxCount="1" :data="item"
tip="支持图片类型大小不超过100M"></upload> -->
<upload @changeInfoList='changeInfoList' :title='item.name' accept='.jpg,.jpeg,.png' :list="item" v-if="item.type == 'image'" type="图片" btnName="上传图片" :maxCount="1"
:dataList="item" tip="支持文件类型大小不超过100M"></upload>
<upload @changeInfoList='changeInfoList' :title='item.name' accept='.pdf,.ppt,.xlsx,.doc,.docx' :list="[]" v-else-if="item.name == '使用手册'" type="文件" btnName="上传附件" :maxCount="1" :dataList="item" :busType="2"
<upload @changeInfoList='changeInfoList' :title='item.name' accept='.pdf,.ppt,.xlsx,.doc,.docx' :list="item" v-else-if="item.type == 'file' && item.name !== '使用手册'" type="文件" btnName="上传附件" :maxCount="1"
:dataList="item" tip="支持文件类型大小不超过100M"></upload>
<upload @changeInfoList='changeInfoList' :title='item.name' accept='.pdf,.ppt,.xlsx,.doc,.docx' :list="item" v-else-if="item.name == '使用手册'" type="文件" btnName="上传附件" :maxCount="1" :dataList="item" :busType="2"
tip="支持文件类型大小不超过100M"></upload>
<upload @changeInfoList='changeInfoList' :title='item.name' accept='.mp4' :list="[]" v-else-if="item.type == 'video'" type="视频" btnName="上传视频" :maxCount="1" :dataList="item"
<upload @changeInfoList='changeInfoList' :title='item.name' accept='.mp4' :list="item" v-else-if="item.type == 'video'" type="视频" btnName="上传视频" :maxCount="1" :dataList="item"
tip="支持视频类型大小不超过100M"></upload>
<input-select-checkbox :list="[]" v-else-if="item.type == 'text'" type="disabled" :data="item" :name="item.name" value="组件服务"></input-select-checkbox>
<input-select-checkbox :list="[]" v-else-if="item.type == 'text2'" type="disabled" :data="item" :name="item.name" :value="type"></input-select-checkbox>
@ -31,7 +33,7 @@
</div>
</template>
<template v-else>
<special :configure='judgmentType.filter(item => item.name==child.name)[0]' @changeInfoList='changeInfoList'></special>
<special :configure='judgmentType.filter(item => item.name==child.name)[0]' :showData='child' @changeInfoList='changeInfoList'></special>
</template>
</div>
</div>