后台 上架功能开发

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

View File

@ -19,14 +19,14 @@
$t("export") $t("export")
}}</el-button> }}</el-button>
</el-form-item> </el-form-item>
<el-form-item> <!-- <el-form-item>
<el-button <el-button
v-if="$hasPermission('ability:bsabilityai:save')" v-if="$hasPermission('ability:bsabilityai:save')"
type="primary" type="primary"
@click="addOrUpdateHandleAI()" @click="addOrUpdateHandleAI()"
>挂接</el-button >挂接</el-button
> >
</el-form-item> </el-form-item> -->
<el-form-item> <el-form-item>
<el-button <el-button
type="primary" type="primary"
@ -90,12 +90,19 @@
width="150" width="150"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <!-- <el-button
v-if="$hasPermission('ability:bsabilityai:update')" v-if="$hasPermission('ability:bsabilityai:update')"
type="text" type="text"
size="small" size="small"
@click="UpdateHandle(scope.row)" @click="UpdateHandle(scope.row)"
>{{ $t("update") }}</el-button >{{ $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 <el-button
v-if="$hasPermission('ability:bsabilityai:delete')" v-if="$hasPermission('ability:bsabilityai:delete')"
@ -150,7 +157,7 @@
</span> </span>
</el-dialog> </el-dialog>
<el-dialog <el-dialog
:title="'上架'+radio" :title="submitFrom.id?'修改'+radio:'上架'+radio"
:visible.sync="showPutOnTheShelfFlag2" :visible.sync="showPutOnTheShelfFlag2"
:close-on-click-modal='false' :close-on-click-modal='false'
:close-on-press-escape='false' :close-on-press-escape='false'
@ -289,7 +296,6 @@ export default {
// this.addOrUpdateHandle(id) // this.addOrUpdateHandle(id)
this.addOrUpdateVisible = true this.addOrUpdateVisible = true
this.disabled = false this.disabled = false
console.log('显示数据=============》', val)
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.addOrUpdate.UpdateState = false this.$refs.addOrUpdate.UpdateState = false
this.$refs.addOrUpdate.dataFormShowDetails = val this.$refs.addOrUpdate.dataFormShowDetails = val
@ -298,7 +304,6 @@ export default {
this.disabled = true this.disabled = true
}, },
showDocument (val) { showDocument (val) {
console.log(val)
window.open( window.open(
window.SITE_CONFIG.frontUrl + '?id=' + val.id + '&&type=' + val.type, window.SITE_CONFIG.frontUrl + '?id=' + val.id + '&&type=' + val.type,
'_blank' '_blank'
@ -324,7 +329,6 @@ export default {
}) })
) )
.then(({ data: res }) => { .then(({ data: res }) => {
console.log('res', res)
if (res.code !== 0) { if (res.code !== 0) {
this.dataList = [] this.dataList = []
this.total = 0 this.total = 0
@ -354,32 +358,11 @@ export default {
fullScreen () { fullScreen () {
if (window.outerHeight === screen.availHeight) { if (window.outerHeight === screen.availHeight) {
if (window.outerWidth === screen.availWidth) { if (window.outerWidth === screen.availWidth) {
console.log(
'全屏1',
window.outerHeight,
screen.availHeight,
window.outerWidth,
screen.availWidth
)
this.qp = false this.qp = false
} else { } else {
console.log(
'不是全屏2',
window.outerHeight,
screen.availHeight,
window.outerWidth,
screen.availWidth
)
this.qp = true this.qp = true
} }
} else { } else {
console.log(
'不是全屏3',
window.outerHeight,
screen.availHeight,
window.outerWidth,
screen.availWidth
)
this.qp = true this.qp = true
} }
}, },
@ -400,7 +383,7 @@ export default {
handleIsShowRelatePopup (type) { handleIsShowRelatePopup (type) {
this.relateApplicationVisible = type this.relateApplicationVisible = type
}, },
// //
clear () { clear () {
this.showPutOnTheShelfFlag = false this.showPutOnTheShelfFlag = false
this.showPutOnTheShelfFlag2 = false this.showPutOnTheShelfFlag2 = false
@ -417,6 +400,7 @@ export default {
} }
] ]
} }
this.reset()
}, },
showPutOnTheShelf () { showPutOnTheShelf () {
this.showPutOnTheShelfFlag = true this.showPutOnTheShelfFlag = true
@ -429,9 +413,9 @@ export default {
this.showPutOnTheShelfFlag2 = true this.showPutOnTheShelfFlag2 = true
this.submitFrom.infoList[0].attrValue = this.radio this.submitFrom.infoList[0].attrValue = this.radio
this.putOnTheShelfList = this.insertList.children.filter(item => item.name === this.radio)[0].children this.putOnTheShelfList = this.insertList.children.filter(item => item.name === this.radio)[0].children
console.log('radio', this.radio)
}, },
changeInfoList (obj) { changeInfoList (obj) {
console.log(obj, this.submitFrom)
this.submitFrom.infoList = this.submitFrom.infoList.filter((item) => item.attrType !== obj.attrType) this.submitFrom.infoList = this.submitFrom.infoList.filter((item) => item.attrType !== obj.attrType)
this.submitFrom.infoList.push(obj) this.submitFrom.infoList.push(obj)
}, },
@ -483,12 +467,20 @@ export default {
case '部门联系人电话': case '部门联系人电话':
this.submitFrom.deptPhone = val.note1 this.submitFrom.deptPhone = val.note1
break break
case '归属部门':
this.submitFrom.deptId = val.note1
break
case '能力类型':
this.submitFrom.type = val.note1
break
default: default:
if (val.type !== 'image' && val.type !== 'file' && val.type !== 'video') {
this.submitFrom.infoList.push({ this.submitFrom.infoList.push({
attrType: val.name, attrType: val.name,
attrValue: val.note1, attrValue: val.note1,
delFlag: 0 delFlag: 0
}) })
}
break break
} }
} }
@ -497,7 +489,124 @@ export default {
}) })
}) })
this.submitFrom.infoList = this.submitFrom.infoList.sort((a, b) => arr.indexOf(a.attrType) - arr.indexOf(b.attrType)) 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: { methods: {
onSuccess (res, file) { onSuccess (res, file) {
console.log('limit', this.limit)
console.log(res, file, this.child)
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error('上传图片失败') return this.$message.error('上传图片失败')
} }
@ -88,10 +86,8 @@ export default {
} else { } else {
this.child.note1 = arr.join(';') this.child.note1 = arr.join(';')
} }
console.log(this.child.note1)
}, },
onPreview (file) { onPreview (file) {
console.log('点击预览===============>', file)
window.open(file.response.data) window.open(file.response.data)
}, },
onExceed (files, fileList) { onExceed (files, fileList) {

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
* @Author: hisense.liangjunhua * @Author: hisense.liangjunhua
* @Date: 2022-07-08 09:48:52 * @Date: 2022-07-08 09:48:52
* @LastEditors: hisense.liangjunhua * @LastEditors: hisense.liangjunhua
* @LastEditTime: 2022-07-09 10:57:07 * @LastEditTime: 2022-07-11 15:11:10
* @Description: 告诉大家这是什么 * @Description: 告诉大家这是什么
--> -->
<template> <template>
@ -13,13 +13,15 @@
<div class="top">{{child.name}}</div> <div class="top">{{child.name}}</div>
<div v-for="item in child.children" :key="item.id" class='item'> <div v-for="item in child.children" :key="item.id" class='item'>
<span v-if="item.name != '来源应用'">{{ item.name }}</span> <span v-if="item.name != '来源应用'">{{ item.name }}</span>
<upload :list="[]" v-if="item.type == 'image'" type="图片" btnName="上传图片" :maxCount="1" :data="item" <!-- <upload :list="[]" v-if="item.type == 'image'" type="图片" btnName="上传图片" :maxCount="1" :data="item"
tip="支持图片类型大小不超过100M"></upload> 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 @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> :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> 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> 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 == '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> <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> </div>
</template> </template>
<template v-else> <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> </template>
</div> </div>
</div> </div>