|
|
@ -1,50 +1,16 @@ |
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<div> |
|
|
|
<div> |
|
|
|
<!-- |
|
|
|
<!-- |
|
|
|
模块type: introduce | customList | form | forms | column | columns | history |
|
|
|
模块type: introduce | form | forms | column | columns | history |
|
|
|
--> |
|
|
|
--> |
|
|
|
<el-dialog title="模块管理" |
|
|
|
<el-dialog title="模块管理" |
|
|
|
:visible.sync="visible" |
|
|
|
:visible.sync="visible" |
|
|
|
width="700px" |
|
|
|
:width="dialogWidth" |
|
|
|
custom-class="module" |
|
|
|
custom-class="module" |
|
|
|
:close-on-click-modal="false" |
|
|
|
:close-on-click-modal="false" |
|
|
|
:before-close="close"> |
|
|
|
:before-close="close"> |
|
|
|
<template v-if="data.type === 'introduce' || data.type === 'customList'"> |
|
|
|
<template v-if="data.type === 'introduce'"> |
|
|
|
<!-- introduce是可以设置图片和链接的,且大弹框内只会显示标题、图片、链接三个字段,其他能输入的字段只会在小弹框里显示; customList是纯输入框,会递归forms里面的字段显示在大弹框里面 --> |
|
|
|
<el-table class="module-table" |
|
|
|
<el-table v-if="data.type === 'customList'" |
|
|
|
|
|
|
|
class="module-table" |
|
|
|
|
|
|
|
:data="data.list" |
|
|
|
|
|
|
|
header-align="center" |
|
|
|
|
|
|
|
row-key="id"> |
|
|
|
|
|
|
|
<el-table-column type="index" |
|
|
|
|
|
|
|
width="60" |
|
|
|
|
|
|
|
label="序号" |
|
|
|
|
|
|
|
align="center"></el-table-column> |
|
|
|
|
|
|
|
<el-table-column v-for="(item, i) in data.forms" |
|
|
|
|
|
|
|
:key="i" |
|
|
|
|
|
|
|
:prop="item.prop" |
|
|
|
|
|
|
|
:label="item.label" |
|
|
|
|
|
|
|
min-width="120" |
|
|
|
|
|
|
|
align="center"> |
|
|
|
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
|
|
|
<el-input v-model="scope.row[item.prop]" |
|
|
|
|
|
|
|
:placeholder="'请输入' + item.label" |
|
|
|
|
|
|
|
maxlength="100"></el-input> |
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
</el-table-column> |
|
|
|
|
|
|
|
<el-table-column label="操作" |
|
|
|
|
|
|
|
width="60" |
|
|
|
|
|
|
|
align="center"> |
|
|
|
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
|
|
|
<div class="flex j-center a-center"> |
|
|
|
|
|
|
|
<i class="el-icon-delete del" |
|
|
|
|
|
|
|
@click="delRow(data.list, scope.$index)"></i> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
</el-table-column> |
|
|
|
|
|
|
|
</el-table> |
|
|
|
|
|
|
|
<el-table v-else |
|
|
|
|
|
|
|
class="module-table" |
|
|
|
|
|
|
|
:data="data.list" |
|
|
|
:data="data.list" |
|
|
|
header-align="center" |
|
|
|
header-align="center" |
|
|
|
row-key="id"> |
|
|
|
row-key="id"> |
|
|
@ -60,7 +26,7 @@ |
|
|
|
min-width="130" |
|
|
|
min-width="130" |
|
|
|
align="center"> |
|
|
|
align="center"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<div v-if="item.type === 'link'" |
|
|
|
<div v-if="item.type === 'link' && scope.row.link" |
|
|
|
class="link-wrap"> |
|
|
|
class="link-wrap"> |
|
|
|
<span>{{ scope.row.link.linkName }}</span> |
|
|
|
<span>{{ scope.row.link.linkName }}</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -75,12 +41,11 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
<p v-else>{{ scope.row[item.prop] }}</p> |
|
|
|
<p v-else>{{ scope.row[item.prop] }}</p> |
|
|
|
|
|
|
|
|
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table-column> |
|
|
|
|
|
|
|
|
|
|
|
<el-table-column label="操作" |
|
|
|
<el-table-column label="操作" |
|
|
|
width="100" |
|
|
|
:width="data.sort ? 150 : 100" |
|
|
|
align="center"> |
|
|
|
align="center"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<div class="flex a-center"> |
|
|
|
<div class="flex a-center"> |
|
|
@ -90,6 +55,14 @@ |
|
|
|
</el-switch> |
|
|
|
</el-switch> |
|
|
|
<i class="el-icon-edit-outline del" |
|
|
|
<i class="el-icon-edit-outline del" |
|
|
|
@click="editIntro(scope.row, scope.$index)"></i> |
|
|
|
@click="editIntro(scope.row, scope.$index)"></i> |
|
|
|
|
|
|
|
<template v-if="data.sort"> |
|
|
|
|
|
|
|
<i v-if="scope.$index != data.list.length - 1" |
|
|
|
|
|
|
|
class="el-icon-bottom del" |
|
|
|
|
|
|
|
@click="sort(1, scope.$index)"></i> |
|
|
|
|
|
|
|
<i v-if="scope.$index" |
|
|
|
|
|
|
|
class="el-icon-top del" |
|
|
|
|
|
|
|
@click="sort(0, scope.$index)"></i> |
|
|
|
|
|
|
|
</template> |
|
|
|
<i class="el-icon-delete del" |
|
|
|
<i class="el-icon-delete del" |
|
|
|
@click="delRow(data.list, scope.$index)"></i> |
|
|
|
@click="delRow(data.list, scope.$index)"></i> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -333,6 +306,7 @@ export default { |
|
|
|
token: Util.local.get(Setting.tokenKey) |
|
|
|
token: Util.local.get(Setting.tokenKey) |
|
|
|
}, |
|
|
|
}, |
|
|
|
isVideo: Util.isVideo, |
|
|
|
isVideo: Util.isVideo, |
|
|
|
|
|
|
|
dialogWidth: '800px', |
|
|
|
rules: {}, |
|
|
|
rules: {}, |
|
|
|
linkVisible: false, |
|
|
|
linkVisible: false, |
|
|
|
linkForm: {}, |
|
|
|
linkForm: {}, |
|
|
@ -404,7 +378,8 @@ export default { |
|
|
|
]), |
|
|
|
]), |
|
|
|
// 处理form表单参数 |
|
|
|
// 处理form表单参数 |
|
|
|
handleForm () { |
|
|
|
handleForm () { |
|
|
|
const { type, forms, form } = this.data |
|
|
|
const { type, forms, form, dialogWidth } = this.data |
|
|
|
|
|
|
|
this.fixed = false |
|
|
|
if (type === 'form' || type === 'forms') { |
|
|
|
if (type === 'form' || type === 'forms') { |
|
|
|
forms.map(e => { |
|
|
|
forms.map(e => { |
|
|
|
if (e.type === 'video' || e.type === 'media') { |
|
|
|
if (e.type === 'video' || e.type === 'media') { |
|
|
@ -449,7 +424,7 @@ export default { |
|
|
|
this.articleNums = nums |
|
|
|
this.articleNums = nums |
|
|
|
} |
|
|
|
} |
|
|
|
form && form.site && this.siteChange(form.site) |
|
|
|
form && form.site && this.siteChange(form.site) |
|
|
|
console.log(333, this.fixedNumber) |
|
|
|
this.dialogWidth = dialogWidth || '800px' |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 站点切换回调 |
|
|
|
// 站点切换回调 |
|
|
|
siteChange (siteId) { |
|
|
|
siteChange (siteId) { |
|
|
@ -484,9 +459,7 @@ export default { |
|
|
|
// 添加行 |
|
|
|
// 添加行 |
|
|
|
addRow () { |
|
|
|
addRow () { |
|
|
|
const { type } = this.data |
|
|
|
const { type } = this.data |
|
|
|
if (type === 'customList') { |
|
|
|
if (type === 'history') { |
|
|
|
this.data.list.push(JSON.parse(JSON.stringify(this.data.originForm))) |
|
|
|
|
|
|
|
} else if (type === 'history') { |
|
|
|
|
|
|
|
this.data.list.push(JSON.parse(JSON.stringify(this.data.historyForm))) |
|
|
|
this.data.list.push(JSON.parse(JSON.stringify(this.data.historyForm))) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.editIntro(this.data.originForm, -1) |
|
|
|
this.editIntro(this.data.originForm, -1) |
|
|
@ -561,6 +534,11 @@ export default { |
|
|
|
form[prop] = '' |
|
|
|
form[prop] = '' |
|
|
|
form.fileName = '' |
|
|
|
form.fileName = '' |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
// 排序 |
|
|
|
|
|
|
|
sort (type, i) { |
|
|
|
|
|
|
|
const item = this.data.list.splice(i, 1)[0] |
|
|
|
|
|
|
|
this.data.list.splice(i + (type ? 1 : -1), 0, item) |
|
|
|
|
|
|
|
}, |
|
|
|
// 删除行(通用) |
|
|
|
// 删除行(通用) |
|
|
|
delRow (list, i) { |
|
|
|
delRow (list, i) { |
|
|
|
this.$confirm('确定要删除吗?', '提示', { |
|
|
|
this.$confirm('确定要删除吗?', '提示', { |
|
|
|