后台挂载 新增必填字段校验,列表按必填进行展示
This commit is contained in:
parent
3675a618bf
commit
b7fd109210
|
@ -2,7 +2,7 @@ import Cookies from 'js-cookie'
|
|||
import qs from 'qs'
|
||||
import { deepClone } from '@/utils/form-generator/index'
|
||||
export default {
|
||||
data() {
|
||||
data () {
|
||||
/* eslint-disable */
|
||||
return {
|
||||
// 设置属性
|
||||
|
@ -38,19 +38,19 @@ export default {
|
|||
}
|
||||
/* eslint-enable */
|
||||
},
|
||||
created() {
|
||||
created () {
|
||||
if (this.mixinViewModuleOptions.createdIsNeed) {
|
||||
this.query()
|
||||
}
|
||||
},
|
||||
activated() {
|
||||
activated () {
|
||||
if (this.mixinViewModuleOptions.activatedIsNeed) {
|
||||
this.query()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 获取数据列表
|
||||
query() {
|
||||
query () {
|
||||
this.dataListLoading = true
|
||||
this.$http.get(
|
||||
this.mixinViewModuleOptions.getDataListURL + '?' + qs.stringify({
|
||||
|
@ -109,11 +109,15 @@ export default {
|
|||
}
|
||||
|
||||
console.log('数据列表', this.dataList, this.mixinViewModuleOptions.getDataListURL)
|
||||
// if (this.dataList[0].type === '组件服务') {
|
||||
// this.dataList.map(val => {
|
||||
// val.infoList = val.infoList.filter(item => item.attrType === '部署位置' || item.attrType === '组件类型' || item.attrType === '应用领域')
|
||||
// })
|
||||
// }
|
||||
if (this.dataList[0].type === '组件服务') {
|
||||
this.dataList.map(val => {
|
||||
val.infoList2 = val.infoList.filter(item => item.attrType === '应用领域' || item.attrType === '组件类型')
|
||||
})
|
||||
} else if (this.dataList[0].type === '应用资源') {
|
||||
this.dataList.map(val => {
|
||||
val.infoList2 = val.infoList.filter(item => item.attrType === '应用领域')
|
||||
})
|
||||
}
|
||||
if (this.mixinViewModuleOptions.requestCallback) {
|
||||
this.mixinViewModuleOptions.requestCallback(res.data)
|
||||
}
|
||||
|
@ -123,11 +127,11 @@ export default {
|
|||
})
|
||||
},
|
||||
// 多选
|
||||
dataListSelectionChangeHandle(val) {
|
||||
dataListSelectionChangeHandle (val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
// 排序
|
||||
dataListSortChangeHandle(data) {
|
||||
dataListSortChangeHandle (data) {
|
||||
if (!data.order || !data.prop) {
|
||||
this.order = ''
|
||||
this.orderField = ''
|
||||
|
@ -138,13 +142,13 @@ export default {
|
|||
this.query()
|
||||
},
|
||||
// 分页, 每页条数
|
||||
pageSizeChangeHandle(val) {
|
||||
pageSizeChangeHandle (val) {
|
||||
this.page = 1
|
||||
this.limit = val
|
||||
this.query()
|
||||
},
|
||||
// 分页, 当前页
|
||||
pageCurrentChangeHandle(val) {
|
||||
pageCurrentChangeHandle (val) {
|
||||
this.page = val
|
||||
this.query()
|
||||
},
|
||||
|
@ -153,7 +157,7 @@ export default {
|
|||
this.query()
|
||||
},
|
||||
// 新增
|
||||
addOrUpdateHandle(id) {
|
||||
addOrUpdateHandle (id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.disabled = false
|
||||
this.$nextTick(() => {
|
||||
|
@ -164,7 +168,7 @@ export default {
|
|||
},
|
||||
|
||||
// 组件服务新增
|
||||
addOrUpdateHandleAI(id) {
|
||||
addOrUpdateHandleAI (id) {
|
||||
// const infoList = []
|
||||
let showList = []
|
||||
this.$http.get('category/getCategoryTree').then(({ data: res }) => {
|
||||
|
@ -222,7 +226,7 @@ export default {
|
|||
}, 100)
|
||||
},
|
||||
// 应用资源新增
|
||||
addOrUpdateHandleServe(id) {
|
||||
addOrUpdateHandleServe (id) {
|
||||
// const infoList = []
|
||||
let showList = []
|
||||
this.$http.get('category/getCategoryTree').then(({ data: res }) => {
|
||||
|
@ -280,7 +284,7 @@ export default {
|
|||
}, 100)
|
||||
},
|
||||
// 修改
|
||||
UpdateHandle(val) {
|
||||
UpdateHandle (val) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.disabled = false
|
||||
const cloneVal = deepClone(val)
|
||||
|
@ -305,7 +309,7 @@ export default {
|
|||
})
|
||||
},
|
||||
// 关闭当前窗口
|
||||
closeCurrentTab(data) {
|
||||
closeCurrentTab (data) {
|
||||
var tabName = this.$store.state.contentTabsActiveName
|
||||
this.$store.state.contentTabs = this.$store.state.contentTabs.filter(item => item.name !== tabName)
|
||||
if (this.$store.state.contentTabs.length <= 0) {
|
||||
|
@ -317,7 +321,7 @@ export default {
|
|||
}
|
||||
},
|
||||
// 删除
|
||||
deleteHandle(id) {
|
||||
deleteHandle (id) {
|
||||
if (this.mixinViewModuleOptions.deleteIsBatch && !id && this.dataListSelections.length <= 0) {
|
||||
return this.$message({
|
||||
message: this.$t('prompt.deleteBatch'),
|
||||
|
@ -351,7 +355,7 @@ export default {
|
|||
}).catch(() => { })
|
||||
},
|
||||
|
||||
deleteHandle2(id) {
|
||||
deleteHandle2 (id) {
|
||||
console.log('删除========================》', id, this.dataListSelections)
|
||||
const ids = []
|
||||
if (id) {
|
||||
|
@ -369,7 +373,7 @@ export default {
|
|||
})
|
||||
},
|
||||
// 导出
|
||||
exportHandle() {
|
||||
exportHandle () {
|
||||
var params = qs.stringify({
|
||||
token: Cookies.get('ucsToken'),
|
||||
...this.dataForm
|
||||
|
|
|
@ -66,6 +66,38 @@
|
|||
header-align="center"
|
||||
align="center"
|
||||
></af-table-column>
|
||||
<af-table-column
|
||||
:show-overflow-tooltip="true"
|
||||
width="280"
|
||||
prop="description"
|
||||
label="组件描述"
|
||||
header-align="center"
|
||||
align="center"
|
||||
></af-table-column>
|
||||
<af-table-column
|
||||
:show-overflow-tooltip="true"
|
||||
width="280"
|
||||
prop="deptName"
|
||||
label="归属部门"
|
||||
header-align="center"
|
||||
align="center"
|
||||
></af-table-column>
|
||||
<af-table-column
|
||||
:show-overflow-tooltip="true"
|
||||
width="280"
|
||||
prop="deptContacts"
|
||||
label="部门联系人"
|
||||
header-align="center"
|
||||
align="center"
|
||||
></af-table-column>
|
||||
<af-table-column
|
||||
:show-overflow-tooltip="true"
|
||||
width="280"
|
||||
prop="deptPhone"
|
||||
label="部门联系人电话"
|
||||
header-align="center"
|
||||
align="center"
|
||||
></af-table-column>
|
||||
<af-table-column
|
||||
:show-overflow-tooltip="true"
|
||||
width="280"
|
||||
|
@ -74,18 +106,18 @@
|
|||
header-align="center"
|
||||
align="center"
|
||||
></af-table-column>
|
||||
<template v-if="dataList[0] && dataList[0].infoList">
|
||||
<template v-if="dataList[0] && dataList[0].infoList2">
|
||||
<af-table-column
|
||||
:show-overflow-tooltip="true"
|
||||
width="300"
|
||||
v-for="(item, index) in dataList[0].infoList"
|
||||
v-for="(item, index) in dataList[0].infoList2"
|
||||
:key="index"
|
||||
:label="item.attrType"
|
||||
header-align="center"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ findValue(scope.row.infoList, item.attrType) }}
|
||||
{{ findValue(scope.row.infoList2, item.attrType) }}
|
||||
</template>
|
||||
</af-table-column>
|
||||
</template>
|
||||
|
@ -187,10 +219,14 @@
|
|||
width="50%"
|
||||
>
|
||||
<putOnTheShelf
|
||||
ref="putOnTheShelf"
|
||||
:putOnTheShelfList="putOnTheShelfList"
|
||||
@changeInfoList="changeInfoList"
|
||||
:type="radio"
|
||||
:typeInput="typeInput"
|
||||
:required="required"
|
||||
:notFilled="notFilled"
|
||||
@submitData="submitData"
|
||||
></putOnTheShelf>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="clear">取 消</el-button>
|
||||
|
@ -211,6 +247,8 @@ export default {
|
|||
mixins: [mixinViewModule],
|
||||
data () {
|
||||
return {
|
||||
required: ['归属部门', '部门联系人', '部门联系人电话', '应用领域', '共享条件', '算法名称', '算法描述', '图层名称', '图层描述', '组件名称', '组件描述', '组件地址', '服务地址', '服务接口', '接口请求方式', '算法类别'],
|
||||
notFilled: [],
|
||||
insertList: [],
|
||||
putOnTheShelfList: [],
|
||||
radio: '',
|
||||
|
@ -300,19 +338,18 @@ export default {
|
|||
this.dataList = this.mixinViewModuleOptions.getDataListIsPage
|
||||
? res.data.list
|
||||
: res.data
|
||||
// this.dataList.map((item, index) => {
|
||||
// const dataListSinforList = []
|
||||
// item.infoList.map((itemson, indexson) => {
|
||||
// if (
|
||||
// itemson.attrType === '部署位置' ||
|
||||
// itemson.attrType === '组件类型' ||
|
||||
// itemson.attrType === '应用领域'
|
||||
// ) {
|
||||
// dataListSinforList.push(itemson)
|
||||
// }
|
||||
// })
|
||||
// this.dataList[index].infoList = dataListSinforList
|
||||
// })
|
||||
this.dataList.map((item, index) => {
|
||||
const dataListSinforList = []
|
||||
item.infoList.map((itemson, indexson) => {
|
||||
if (
|
||||
itemson.attrType === '应用领域' ||
|
||||
itemson.attrType === '组件类型'
|
||||
) {
|
||||
dataListSinforList.push(itemson)
|
||||
}
|
||||
})
|
||||
this.dataList[index].infoList2 = dataListSinforList
|
||||
})
|
||||
console.log('this.dataList', this.dataList)
|
||||
this.total = this.mixinViewModuleOptions.getDataListIsPage
|
||||
? res.data.total
|
||||
|
@ -387,19 +424,18 @@ export default {
|
|||
this.mixinViewModuleOptions.requestCallback(res.data)
|
||||
}
|
||||
this.dataListLoading = false
|
||||
// this.dataList.map((item, index) => {
|
||||
// const dataListSinforList = []
|
||||
// item.infoList.map((itemson, indexson) => {
|
||||
// if (
|
||||
// itemson.attrType === '部署位置' ||
|
||||
// itemson.attrType === '组件类型' ||
|
||||
// itemson.attrType === '应用领域'
|
||||
// ) {
|
||||
// dataListSinforList.push(itemson)
|
||||
// }
|
||||
// })
|
||||
// this.dataList[index].infoList = dataListSinforList
|
||||
// })
|
||||
this.dataList.map((item, index) => {
|
||||
const dataListSinforList = []
|
||||
item.infoList.map((itemson, indexson) => {
|
||||
if (
|
||||
itemson.attrType === '应用领域' ||
|
||||
itemson.attrType === '组件类型'
|
||||
) {
|
||||
dataListSinforList.push(itemson)
|
||||
}
|
||||
})
|
||||
this.dataList[index].infoList2 = dataListSinforList
|
||||
})
|
||||
} else {
|
||||
this.$message.error('未查询到相关信息')
|
||||
this.reset()
|
||||
|
@ -448,6 +484,7 @@ export default {
|
|||
// 新上架
|
||||
clear () {
|
||||
console.log('清空----------------------------------------')
|
||||
this.notFilled = []
|
||||
this.showPutOnTheShelfFlag = false
|
||||
this.showPutOnTheShelfFlag2 = false
|
||||
this.insertList = []
|
||||
|
@ -490,8 +527,24 @@ export default {
|
|||
)
|
||||
this.submitFrom.infoList.push(obj)
|
||||
},
|
||||
changeAdd () {
|
||||
const arr = []
|
||||
switch (this.radio) {
|
||||
case '智能算法':
|
||||
arr.push('算法优势')
|
||||
arr.push('计费标准信息')
|
||||
break
|
||||
case '开发组件':
|
||||
case '业务组件':
|
||||
arr.push('功能介绍')
|
||||
break
|
||||
}
|
||||
arr.push('应用场景')
|
||||
arr.push('常见问题')
|
||||
this.$refs.putOnTheShelf.submit(arr)
|
||||
},
|
||||
submitData () {
|
||||
console.log('提交11111111111===============>', this.putOnTheShelfList)
|
||||
console.log('提交11111111111===============>', this.putOnTheShelfList, this.submitFrom)
|
||||
const arr = []
|
||||
this.putOnTheShelfList.map((item) => {
|
||||
item.children.map((child) => {
|
||||
|
@ -527,7 +580,7 @@ export default {
|
|||
(item) => item.attrType !== val.name
|
||||
)
|
||||
}
|
||||
if (val.note1) {
|
||||
if (val.note1 == '' || val.note1) {
|
||||
switch (val.name) {
|
||||
case '算法名称':
|
||||
case '应用名称':
|
||||
|
@ -603,51 +656,94 @@ export default {
|
|||
this.submitFrom.infoList = this.submitFrom.infoList.sort(
|
||||
(a, b) => arr.indexOf(a.attrType) - arr.indexOf(b.attrType)
|
||||
)
|
||||
if (this.submitFrom.id) {
|
||||
// 解决编辑无组件类型
|
||||
this.submitFrom.infoList.map((val) => {
|
||||
if (val.attrType === '组件类型') {
|
||||
val.attrValue = this.radio
|
||||
}
|
||||
this.notFilled = []
|
||||
if (!this.submitFrom.name) {
|
||||
this.notFilled.push('算法名称')
|
||||
this.notFilled.push('图层名称')
|
||||
this.notFilled.push('组件名称')
|
||||
}
|
||||
if (!this.submitFrom.description) {
|
||||
this.notFilled.push('算法描述')
|
||||
this.notFilled.push('图层描述')
|
||||
this.notFilled.push('组件描述')
|
||||
}
|
||||
if (!this.submitFrom.shareCondition) {
|
||||
this.notFilled.push('共享条件')
|
||||
}
|
||||
if (!this.submitFrom.deptContacts) {
|
||||
this.notFilled.push('部门联系人')
|
||||
}
|
||||
if (!this.submitFrom.deptPhone) {
|
||||
this.notFilled.push('部门联系人电话')
|
||||
}
|
||||
if (this.radio === '智能算法' && !this.submitFrom.apiUrl) {
|
||||
this.notFilled.push('服务接口')
|
||||
}
|
||||
if (this.radio === '智能算法' && !this.submitFrom.apiMethodType) {
|
||||
this.notFilled.push('接口请求方式')
|
||||
}
|
||||
if (this.radio === '智能算法' && (!this.submitFrom.infoList.filter(val => val.attrType === '算法类别')[0] || !this.submitFrom.infoList.filter(val => val.attrType === '算法类别')[0].attrValue)) {
|
||||
this.notFilled.push('算法类别')
|
||||
}
|
||||
if (!this.submitFrom.infoList.filter(val => val.attrType === '应用领域')[0] || !this.submitFrom.infoList.filter(val => val.attrType === '应用领域')[0].attrValue) {
|
||||
this.notFilled.push('应用领域')
|
||||
}
|
||||
if (this.radio === '图层服务' && (!this.submitFrom.infoList.filter(val => val.attrType === '服务地址')[0] || !this.submitFrom.infoList.filter(val => val.attrType === '服务地址')[0].attrValue)) {
|
||||
this.notFilled.push('服务地址')
|
||||
}
|
||||
if ((this.radio === '业务组件' || this.radio === '开发组件') && (!this.submitFrom.infoList.filter(val => val.attrType === '组件地址')[0] || !this.submitFrom.infoList.filter(val => val.attrType === '组件地址')[0].attrValue)) {
|
||||
this.notFilled.push('组件地址')
|
||||
}
|
||||
console.log(this.submitFrom, this.notFilled, '表单验证')
|
||||
if (this.notFilled.length > 0) {
|
||||
this.$message({
|
||||
message: '请填写必填字段!',
|
||||
type: 'warning'
|
||||
})
|
||||
console.log('编辑===============>', this.submitFrom)
|
||||
console.log(this.submitFrom.infoList, '===============abc')
|
||||
// 去重
|
||||
const newArr = this.submitFrom.infoList.filter(
|
||||
(element, index, self) => {
|
||||
return (
|
||||
self.findIndex((x) => x.attrType === element.attrType) === index
|
||||
)
|
||||
}
|
||||
)
|
||||
this.submitFrom.infoList = newArr
|
||||
console.log(
|
||||
this.submitFrom.infoList,
|
||||
'====================================wpwpwp'
|
||||
)
|
||||
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()
|
||||
if (this.submitFrom.id) {
|
||||
// 解决编辑无组件类型
|
||||
this.submitFrom.infoList.map((val) => {
|
||||
if (val.attrType === '组件类型') {
|
||||
val.attrValue = this.radio
|
||||
}
|
||||
})
|
||||
.catch(() => {})
|
||||
console.log('编辑===============>', this.submitFrom)
|
||||
console.log(this.submitFrom.infoList, '===============abc')
|
||||
// 去重
|
||||
const newArr = this.submitFrom.infoList.filter(
|
||||
(element, index, self) => {
|
||||
return (
|
||||
self.findIndex((x) => x.attrType === element.attrType) === index
|
||||
)
|
||||
}
|
||||
)
|
||||
this.submitFrom.infoList = newArr
|
||||
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 {
|
||||
console.log('提交11111111111===============>', this.putOnTheShelfList, this.submitFrom)
|
||||
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(() => {})
|
||||
}
|
||||
}
|
||||
},
|
||||
// 新修改
|
||||
|
|
|
@ -66,9 +66,49 @@
|
|||
header-align="center"
|
||||
align="center"
|
||||
></el-table-column>
|
||||
<template v-if="dataList[0] && dataList[0].infoList">
|
||||
<af-table-column
|
||||
:show-overflow-tooltip="true"
|
||||
width="280"
|
||||
prop="description"
|
||||
label="应用描述"
|
||||
header-align="center"
|
||||
align="center"
|
||||
></af-table-column>
|
||||
<af-table-column
|
||||
:show-overflow-tooltip="true"
|
||||
width="280"
|
||||
prop="deptName"
|
||||
label="归属部门"
|
||||
header-align="center"
|
||||
align="center"
|
||||
></af-table-column>
|
||||
<af-table-column
|
||||
:show-overflow-tooltip="true"
|
||||
width="280"
|
||||
prop="deptContacts"
|
||||
label="部门联系人"
|
||||
header-align="center"
|
||||
align="center"
|
||||
></af-table-column>
|
||||
<af-table-column
|
||||
:show-overflow-tooltip="true"
|
||||
width="280"
|
||||
prop="deptPhone"
|
||||
label="部门联系人电话"
|
||||
header-align="center"
|
||||
align="center"
|
||||
></af-table-column>
|
||||
<af-table-column
|
||||
:show-overflow-tooltip="true"
|
||||
width="280"
|
||||
prop="shareCondition"
|
||||
label="共享条件"
|
||||
header-align="center"
|
||||
align="center"
|
||||
></af-table-column>
|
||||
<template v-if="dataList[0] && dataList[0].infoList2">
|
||||
<el-table-column
|
||||
v-for="(item, index) in dataList[0].infoList"
|
||||
v-for="(item, index) in dataList[0].infoList2"
|
||||
:key="index"
|
||||
:label="item.attrType"
|
||||
header-align="center"
|
||||
|
@ -76,7 +116,7 @@
|
|||
:show-overflow-tooltip="true"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ findValue(scope.row.infoList, item.attrType) }}
|
||||
{{ findValue(scope.row.infoList2, item.attrType) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
|
@ -169,7 +209,7 @@
|
|||
:destroy-on-close='true'
|
||||
:before-close='clear'
|
||||
width="50%">
|
||||
<putOnTheShelf :putOnTheShelfList='putOnTheShelfList' @changeInfoList='changeInfoList' :type='radio' :typeInput='typeInput'></putOnTheShelf>
|
||||
<putOnTheShelf :required="required" :notFilled="notFilled":putOnTheShelfList='putOnTheShelfList' @changeInfoList='changeInfoList' :type='radio' :typeInput='typeInput'></putOnTheShelf>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="clear">取 消</el-button>
|
||||
<el-button type="primary" @click="submitData">确 定</el-button>
|
||||
|
@ -191,6 +231,8 @@ export default {
|
|||
mixins: [mixinViewModule],
|
||||
data () {
|
||||
return {
|
||||
required: ['归属部门', '部门联系人', '部门联系人电话', '应用领域', '共享条件', '应用名称', '应用描述', '应用状态', '应用类型'],
|
||||
notFilled: [],
|
||||
mixinViewModuleOptions: {
|
||||
getDataListURL: '/resource/page',
|
||||
getDataListIsPage: true,
|
||||
|
@ -282,6 +324,17 @@ export default {
|
|||
this.mixinViewModuleOptions.requestCallback(res.data)
|
||||
}
|
||||
this.dataListLoading = false
|
||||
this.dataList.map((item, index) => {
|
||||
const dataListSinforList = []
|
||||
item.infoList.map((itemson, indexson) => {
|
||||
if (
|
||||
itemson.attrType === '应用领域'
|
||||
) {
|
||||
dataListSinforList.push(itemson)
|
||||
}
|
||||
})
|
||||
this.dataList[index].infoList2 = dataListSinforList
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
this.dataListLoading = false
|
||||
|
@ -347,6 +400,17 @@ export default {
|
|||
this.mixinViewModuleOptions.requestCallback(res.data)
|
||||
}
|
||||
this.dataListLoading = false
|
||||
this.dataList.map((item, index) => {
|
||||
const dataListSinforList = []
|
||||
item.infoList.map((itemson, indexson) => {
|
||||
if (
|
||||
itemson.attrType === '应用领域'
|
||||
) {
|
||||
dataListSinforList.push(itemson)
|
||||
}
|
||||
})
|
||||
this.dataList[index].infoList2 = dataListSinforList
|
||||
})
|
||||
} else {
|
||||
this.$message.error('未查询到相关信息')
|
||||
this.reset()
|
||||
|
@ -485,6 +549,7 @@ export default {
|
|||
},
|
||||
// 新上架
|
||||
clear () {
|
||||
this.notFilled = []
|
||||
this.showPutOnTheShelfFlag2 = false
|
||||
this.insertList = []
|
||||
this.putOnTheShelfList = []
|
||||
|
@ -517,7 +582,6 @@ export default {
|
|||
this.submitFrom.infoList.push(obj)
|
||||
},
|
||||
submitData () {
|
||||
this.showPutOnTheShelfFlag2 = false
|
||||
const arr = []
|
||||
this.putOnTheShelfList.map(item => {
|
||||
item.children.map(child => {
|
||||
|
@ -537,7 +601,7 @@ export default {
|
|||
if (val.type === 'input' || val.type === 'textArea' || val.type === 'select' || val.type === 'checkBox' || val.type === 'radio') {
|
||||
this.submitFrom.infoList = this.submitFrom.infoList.filter((item) => item.attrType !== val.name)
|
||||
}
|
||||
if (val.note1) {
|
||||
if (val.note1 || val.note1) {
|
||||
switch (val.name) {
|
||||
case '算法名称':
|
||||
case '应用名称':
|
||||
|
@ -603,37 +667,74 @@ export default {
|
|||
})
|
||||
})
|
||||
this.submitFrom.infoList = this.submitFrom.infoList.sort((a, b) => arr.indexOf(a.attrType) - arr.indexOf(b.attrType))
|
||||
if (this.submitFrom.id) {
|
||||
// 解决编辑无组件类型
|
||||
this.submitFrom.infoList.map(val => {
|
||||
if (val.attrType === '组件类型') {
|
||||
val.attrValue = this.radio
|
||||
}
|
||||
this.notFilled = []
|
||||
console.log(this.submitFrom, '表单验证')
|
||||
if (!this.submitFrom.name) {
|
||||
this.notFilled.push('应用名称')
|
||||
}
|
||||
if (!this.submitFrom.description) {
|
||||
this.notFilled.push('应用描述')
|
||||
}
|
||||
if (!this.submitFrom.shareCondition) {
|
||||
this.notFilled.push('共享条件')
|
||||
}
|
||||
if (!this.submitFrom.deptContacts) {
|
||||
this.notFilled.push('部门联系人')
|
||||
}
|
||||
if (!this.submitFrom.deptPhone) {
|
||||
this.notFilled.push('部门联系人电话')
|
||||
}
|
||||
if (!this.submitFrom.infoList.filter(val => val.attrType == '应用领域')[0] || !this.submitFrom.infoList.filter(val => val.attrType == '应用领域')[0].attrValue) {
|
||||
this.notFilled.push('应用领域')
|
||||
}
|
||||
if (!this.submitFrom.infoList.filter(val => val.attrType == '应用状态')[0] || !this.submitFrom.infoList.filter(val => val.attrType == '应用状态')[0].attrValue) {
|
||||
this.notFilled.push('应用状态')
|
||||
}
|
||||
if (!this.submitFrom.infoList.filter(val => val.attrType == '应用类型')[0] || !this.submitFrom.infoList.filter(val => val.attrType == '应用类型')[0].attrValue) {
|
||||
this.notFilled.push('应用类型')
|
||||
}
|
||||
if (this.notFilled.length > 0) {
|
||||
this.$message({
|
||||
message: '请填写必填字段!',
|
||||
type: 'warning'
|
||||
})
|
||||
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()
|
||||
if (this.submitFrom.id) {
|
||||
// 解决编辑无组件类型
|
||||
this.submitFrom.infoList.map(val => {
|
||||
if (val.attrType === '组件类型') {
|
||||
val.attrValue = this.radio
|
||||
}
|
||||
})
|
||||
.catch(() => {})
|
||||
console.log('编辑===============>', this.submitFrom)
|
||||
this.$http
|
||||
.put('/resource/update', this.submitFrom)
|
||||
.then(({ data: res }) => {
|
||||
if (res.code !== 0) {
|
||||
this.$message.error('修改失败!')
|
||||
this.showPutOnTheShelfFlag2 = false
|
||||
} else {
|
||||
this.$message.success('修改成功!')
|
||||
this.showPutOnTheShelfFlag2 = false
|
||||
this.clear()
|
||||
}
|
||||
})
|
||||
.catch(() => {})
|
||||
} else {
|
||||
this.$http
|
||||
.post('/resource/insert?source= b', this.submitFrom)
|
||||
.then(({ data: res }) => {
|
||||
if (res.code !== 0) {
|
||||
this.$message.error('上架失败!')
|
||||
this.showPutOnTheShelfFlag2 = false
|
||||
} else {
|
||||
this.$message.success('上架成功!')
|
||||
this.showPutOnTheShelfFlag2 = false
|
||||
this.clear()
|
||||
}
|
||||
})
|
||||
.catch(() => {})
|
||||
}
|
||||
}
|
||||
},
|
||||
// 新修改
|
||||
|
|
|
@ -16,12 +16,13 @@ js:
|
|||
<template>
|
||||
<div id="inputSelectCheckbox">
|
||||
<!-- input框 -->
|
||||
<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" @change="changeIiem(name,data.note1)"/>
|
||||
<!-- 下拉框 -->
|
||||
<el-select
|
||||
v-else-if="(type === 'select' && name !== '归属部门' && name !== '使用方式') || type == 'radio'"
|
||||
style="width: 240px"
|
||||
v-model:value="data.note1"
|
||||
@change="changeIiem(name,data.note1)"
|
||||
:placeholder="'请选择' + name">
|
||||
<el-option
|
||||
:value="itemSelect.dictLabel"
|
||||
|
@ -36,6 +37,7 @@ js:
|
|||
v-model:value="data.note1"
|
||||
filterable
|
||||
placeholder="请输入关键词"
|
||||
@change="changeIiem(name,data.note1)"
|
||||
:loading="loading">
|
||||
<el-option
|
||||
v-for="(itemSelect) in options"
|
||||
|
@ -73,12 +75,13 @@ js:
|
|||
v-model="value"
|
||||
:placeholder="'请输入' + name"
|
||||
:disabled="true"
|
||||
@change="changeIiem(name,data.note1)"
|
||||
/>
|
||||
<!-- 单选 -->
|
||||
<!-- <el-radio-group v-model:value="data.note1" v-else-if="type == 'radio'">
|
||||
<el-radio v-for="item in options" :label="item.dictLabel" :key="item.dictLabel">{{item.dictLabel}}</el-radio>
|
||||
</el-radio-group> -->
|
||||
<a-textarea v-else-if="type == 'textArea'" v-model:value="data.note1" :showCount="true" :maxlength="200" :placeholder="'请填写' + name" />
|
||||
<a-textarea v-else-if="type == 'textArea'" @change="changeIiem(name,data.note1)" v-model:value="data.note1" :showCount="true" :maxlength="200" :placeholder="'请填写' + name" />
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
|
@ -92,6 +95,7 @@ export default {
|
|||
data: Array,
|
||||
name: String,
|
||||
value: String,
|
||||
changeField: Array,
|
||||
options: {
|
||||
type: Array,
|
||||
default: null
|
||||
|
@ -108,6 +112,15 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
changeIiem (name, value) {
|
||||
if (value && value !== '' && this.changeField.indexOf(name) == -1) {
|
||||
this.changeField.push(name)
|
||||
} else if (!value || value == '') {
|
||||
if (this.changeField.indexOf(name) > -1) {
|
||||
this.changeField.splice(this.changeField.indexOf(name), 1)
|
||||
}
|
||||
}
|
||||
},
|
||||
selectOptions () {
|
||||
if (this.data.isLinkToDic === 'true' && this.data.linkValue) {
|
||||
this.$http
|
||||
|
@ -140,7 +153,7 @@ export default {
|
|||
// dataList.push(element)
|
||||
// })
|
||||
// this.options = dataList
|
||||
if (!this.data.note1) {
|
||||
if (this.data.note1 == null) {
|
||||
this.$http.get('/sys/user/info').then(({ data: res }) => {
|
||||
console.log(res.data)
|
||||
this.data.note1 = res.data.realName || ''
|
||||
|
@ -154,7 +167,7 @@ export default {
|
|||
// dataList.push(element)
|
||||
// })
|
||||
// this.options = dataList
|
||||
if (!this.data.note1) {
|
||||
if (this.data.note1 == null) {
|
||||
this.$http.get('/sys/user/info').then(({ data: res }) => {
|
||||
console.log(res.data)
|
||||
this.data.note1 = res.data.mobile || ''
|
||||
|
@ -172,6 +185,13 @@ export default {
|
|||
}
|
||||
})
|
||||
this.data.note1 = str
|
||||
if (str !== '' && this.changeField.indexOf('应用领域') == -1) {
|
||||
this.changeField.push('应用领域')
|
||||
} else if (str == '') {
|
||||
if (this.changeField.indexOf('应用领域') > -1) {
|
||||
this.changeField.splice(this.changeField.indexOf('应用领域'), 1)
|
||||
}
|
||||
}
|
||||
},
|
||||
showTypeClick (e) {
|
||||
this.showType = e
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @Author: hisense.liangjunhua
|
||||
* @Date: 2022-07-08 09:54:50
|
||||
* @LastEditors: hisense.liangjunhua
|
||||
* @LastEditTime: 2022-07-11 16:18:00
|
||||
* @LastEditTime: 2022-07-25 11:20:25
|
||||
* @Description: 多条数据特殊处理
|
||||
-->
|
||||
<template>
|
||||
|
@ -33,7 +33,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="add">添加更多{{ configure.name }}</div>
|
||||
<!-- <div class="add">添加更多{{ configure.name }}</div> -->
|
||||
<div class="form" v-for="(val, index) in configure.list" :key="'key3' + val.name + index">
|
||||
<span>{{ val.name }}</span>
|
||||
<a-input v-model:value="val.note1" ::maxlength="24" :placeholder="'请填写' + val.name + ',不超过24个字符'"
|
||||
|
@ -42,7 +42,7 @@
|
|||
<a-input
|
||||
v-model:value="val.note1"
|
||||
:placeholder="'请填写' + val.name"
|
||||
style="width: calc(100% - 150px);"
|
||||
style="width: 570px;"
|
||||
/>
|
||||
<span style="width: 2.5rem; padding-left: 0.1rem">
|
||||
{{
|
||||
|
@ -93,7 +93,8 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
add (title) {
|
||||
add (title, addFlag, submitFlag) {
|
||||
console.log(title, addFlag, submitFlag)
|
||||
const list = this.configure.list
|
||||
let flag = true
|
||||
list.forEach((item) => {
|
||||
|
@ -142,10 +143,23 @@ export default {
|
|||
})
|
||||
list.forEach((item) => {
|
||||
item.note1 = ''
|
||||
this.showKey++
|
||||
})
|
||||
this.showKey++
|
||||
if (addFlag && submitFlag) {
|
||||
this.$emit('submitData')
|
||||
}
|
||||
} else {
|
||||
this.$message.warning('请填写完整')
|
||||
if (!addFlag) {
|
||||
this.$message.warning('请填写完整')
|
||||
} else {
|
||||
list.forEach((item) => {
|
||||
item.note1 = ''
|
||||
this.showKey++
|
||||
})
|
||||
if (submitFlag) {
|
||||
this.$emit('submitData')
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
del (title, index) {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @Author: hisense.liangjunhua
|
||||
* @Date: 2022-07-08 09:48:52
|
||||
* @LastEditors: hisense.liangjunhua
|
||||
* @LastEditTime: 2022-07-11 15:11:10
|
||||
* @LastEditTime: 2022-07-25 15:57:25
|
||||
* @Description: 告诉大家这是什么
|
||||
-->
|
||||
<template>
|
||||
|
@ -21,7 +21,11 @@
|
|||
(showTypeName == 'SDK' && item.name == '接口请求方式') ||
|
||||
(showTypeName == 'SDK' && item.name == '服务接口')
|
||||
)">
|
||||
<span >{{ item.name }}</span>
|
||||
<div class="box">
|
||||
<div>
|
||||
<span class="required" v-if="required.indexOf(item.name) > -1">*</span>
|
||||
{{ item.name }}
|
||||
</div>
|
||||
<!-- <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"
|
||||
|
@ -34,17 +38,20 @@
|
|||
tip="支持视频类型,大小不超过100M"></upload>
|
||||
<upload @changeInfoList='changeInfoList' :title='item.name' accept='.zip' :list="item" v-else-if="item.type == 'package'" type="安装包" btnName="上传安装包" :maxCount="1" :dataList="item"
|
||||
tip="支持.zip类型,大小不超过100M"></upload>
|
||||
<input-select-checkbox :list="[]" v-else-if="item.type == 'AbilityType'" type="disabled" :data="item" :name="item.name" :value="typeInput"></input-select-checkbox>
|
||||
<input-select-checkbox :list="[]" v-else-if="item.type == 'ComponentType'" type="disabled" :data="item" :name="item.name" :value="type"></input-select-checkbox>
|
||||
<input-select-checkbox :list="[]" v-else-if="item.type == 'input'" type="input" :data="item" :name="item.name"></input-select-checkbox>
|
||||
<input-select-checkbox :list="[]" v-else-if="item.type == 'select'" type="select" :data="item" :name="item.name" :options="item.options" @show-type="showType"></input-select-checkbox>
|
||||
<input-select-checkbox :list="[]" v-else-if="item.type == 'checkBox'" type="checkBox" :data="item" :name="item.name" :options="item.options"></input-select-checkbox>
|
||||
<input-select-checkbox :list="[]" v-else-if="item.type == 'radio'" type="radio" :data="item" :name="item.name" :options="item.options"></input-select-checkbox>
|
||||
<input-select-checkbox :list="[]" v-else-if="item.type == 'textArea'" type="textArea" :data="item" :name="item.name"></input-select-checkbox>
|
||||
<input-select-checkbox :changeField='changeField' :list="[]" v-else-if="item.type == 'AbilityType'" type="disabled" :data="item" :name="item.name" :value="typeInput"></input-select-checkbox>
|
||||
<input-select-checkbox :changeField='changeField' :list="[]" v-else-if="item.type == 'ComponentType'" type="disabled" :data="item" :name="item.name" :value="type"></input-select-checkbox>
|
||||
<input-select-checkbox :changeField='changeField' :list="[]" v-else-if="item.type == 'input'" type="input" :data="item" :name="item.name"></input-select-checkbox>
|
||||
<input-select-checkbox :changeField='changeField' :list="[]" v-else-if="item.type == 'select'" type="select" :data="item" :name="item.name" :options="item.options" @show-type="showType"></input-select-checkbox>
|
||||
<input-select-checkbox :changeField='changeField' :list="[]" v-else-if="item.type == 'checkBox'" type="checkBox" :data="item" :name="item.name" :options="item.options"></input-select-checkbox>
|
||||
<input-select-checkbox :changeField='changeField' :list="[]" v-else-if="item.type == 'radio'" type="radio" :data="item" :name="item.name" :options="item.options"></input-select-checkbox>
|
||||
<input-select-checkbox :changeField='changeField' :list="[]" v-else-if="item.type == 'textArea'" type="textArea" :data="item" :name="item.name"></input-select-checkbox>
|
||||
</div>
|
||||
<div class="requiredTips" v-show="notFilled.indexOf(item.name) > -1 && (item.type=='input' || item.type=='textArea') && changeField.indexOf(item.name) == -1">请填写{{item.name}}!</div>
|
||||
<div class="requiredTips" v-show="notFilled.indexOf(item.name) > -1 && (item.type=='select' || item.type=='checkBox' || item.type=='radio') && changeField.indexOf(item.name) == -1">请选择{{item.name}}!</div>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<special :configure='judgmentType.filter(item => item.name==child.name)[0]' :showData='child' @changeInfoList='changeInfoList'></special>
|
||||
<special @submitData="submitData" ref="specialRef" :configure='judgmentType.filter(item => item.name==child.name)[0]' :showData='child' @changeInfoList='changeInfoList'></special>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -64,10 +71,13 @@ export default {
|
|||
props: {
|
||||
type: String,
|
||||
putOnTheShelfList: Array,
|
||||
typeInput: String
|
||||
typeInput: String,
|
||||
required: Array,
|
||||
notFilled: Array
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
changeField: [],
|
||||
judgmentType: [
|
||||
{
|
||||
name: '算法优势',
|
||||
|
@ -182,6 +192,21 @@ export default {
|
|||
this.defaultContent()
|
||||
},
|
||||
methods: {
|
||||
// 提交
|
||||
submit (arr) {
|
||||
console.log('提交', arr.length, this.$refs.specialRef)
|
||||
arr.map((val, index) => {
|
||||
if (index === arr.length - 1) {
|
||||
this.$refs.specialRef[index].add(val, true, true)
|
||||
} else {
|
||||
this.$refs.specialRef[index].add(val, true, false)
|
||||
}
|
||||
})
|
||||
},
|
||||
submitData () {
|
||||
// console.log('触发提交')
|
||||
this.$emit('submitData')
|
||||
},
|
||||
changeInfoList (obj) {
|
||||
this.$emit('changeInfoList', obj)
|
||||
},
|
||||
|
@ -241,11 +266,27 @@ export default {
|
|||
}
|
||||
}
|
||||
.item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin: 25px 0;
|
||||
& > span:nth-of-type(1) {
|
||||
width: 105px;
|
||||
position: relative;
|
||||
.box{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin: 25px 0;
|
||||
& > div:nth-of-type(1) {
|
||||
width: 105px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.required{
|
||||
color: #f56c6c;
|
||||
margin-right: 3px;
|
||||
}
|
||||
}
|
||||
.requiredTips{
|
||||
font-size: 14px;
|
||||
color: #f56c6c;
|
||||
position: absolute;
|
||||
bottom:-20px;
|
||||
left:110px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
Loading…
Reference in New Issue