11 changed files with 334 additions and 988 deletions
@ -1,313 +0,0 @@ |
|||
<template> |
|||
<el-dialog :visible.sync="visible" |
|||
:title="'修改Footbar'" |
|||
:close-on-click-modal="false" |
|||
:before-close="handleClose" |
|||
:close-on-press-escape="false" |
|||
:width="60+'%'" |
|||
:top="'30px'"> |
|||
<el-form :inline="true" |
|||
:model="dataForm" |
|||
:rules="dataRule" |
|||
ref="dataForm" |
|||
:label-width="'120px'"> |
|||
<el-form-item label="默认导航栏名称"> |
|||
<div class="item_width_1"> |
|||
<span>{{dataForm.defaultName}}</span> |
|||
</div> |
|||
</el-form-item> |
|||
<el-form-item label="导航栏名称" |
|||
prop="barName"> |
|||
<el-tooltip class="item" |
|||
effect="dark" |
|||
content="请输入2-5个字" |
|||
placement="bottom-start"> |
|||
<el-input class="item_width_1" |
|||
:maxlength="5" |
|||
:minlength="2" |
|||
v-model="dataForm.barName" |
|||
placeholder="导航栏名称"></el-input> |
|||
</el-tooltip> |
|||
</el-form-item> |
|||
<el-form-item label="默认页面标题"> |
|||
<div class="item_width_1"> |
|||
<span>{{dataForm.defaultPageTitle}}</span> |
|||
</div> |
|||
</el-form-item> |
|||
<el-form-item label="页面标题" |
|||
prop="pageTitle"> |
|||
<el-tooltip class="item" |
|||
effect="dark" |
|||
content="请输入2-10个字" |
|||
placement="bottom-start"> |
|||
<el-input class="item_width_1" |
|||
:maxlength="10" |
|||
:minlength="2" |
|||
v-model="dataForm.pageTitle" |
|||
placeholder="页面标题"></el-input> |
|||
</el-tooltip> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="App类型" |
|||
prop="appType"> |
|||
<el-select :disabled="type==='U'" |
|||
class="item_width_1" |
|||
v-model="dataForm.appType" |
|||
placeholder="请选择" |
|||
clearable> |
|||
<el-option v-for="item in fromAppList" |
|||
:key="item.dictValue" |
|||
:label="item.dictName" |
|||
:value="item.dictValue"> |
|||
</el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
|
|||
<el-form-item prop="iconPath" |
|||
label="图标"> |
|||
<el-upload class="item_width_1 avatar-uploader" |
|||
:action="uploadUlr" |
|||
:show-file-list="false" |
|||
:on-success="function (res, file) { return handleImgSuccess(res, file, '')}" |
|||
:before-upload="beforeImgUpload"> |
|||
<img v-if="dataForm.iconPath" |
|||
:src="dataForm.iconPath" |
|||
style="width:70px;height:70px" |
|||
class="function-icon"> |
|||
<i v-else |
|||
class="el-icon-plus avatar-uploader-icon"></i> |
|||
</el-upload> |
|||
</el-form-item> |
|||
|
|||
<el-form-item prop="selectedIconPath" |
|||
label="选中图标"> |
|||
<el-upload class="item_width_1 avatar-uploader" |
|||
:action="uploadUlr" |
|||
:show-file-list="false" |
|||
:on-success="function (res, file) { return handleImgSuccess(res, file, 'sel')}" |
|||
:before-upload="beforeImgUpload"> |
|||
<img v-if="dataForm.selectedIconPath" |
|||
:src="dataForm.selectedIconPath" |
|||
style="width:70px;height:70px" |
|||
class="function-icon"> |
|||
<i v-else |
|||
class="el-icon-plus avatar-uploader-icon"></i> |
|||
</el-upload> |
|||
</el-form-item> |
|||
|
|||
</el-form> |
|||
<template slot="footer"> |
|||
<el-button @click="visible = false">{{ $t('cancel') }}</el-button> |
|||
<el-button type="primary" |
|||
@click="saveForm()">{{ $t('confirm') }}</el-button> |
|||
</template> |
|||
</el-dialog> |
|||
</template> |
|||
|
|||
<script> |
|||
import { Loading } from 'element-ui' // 引入Loading服务 |
|||
|
|||
let loading// 加载动画 |
|||
export default { |
|||
data () { |
|||
return { |
|||
visible: false, |
|||
type: '', // 操作类型A/U |
|||
id: '', // 父组件传来功能id |
|||
dataForm: { |
|||
customerId: '', |
|||
barName: '', |
|||
barKey: '', |
|||
appType: '', |
|||
pageTitle: '', |
|||
iconPath: '', |
|||
selectedIconPath: '' |
|||
|
|||
}, |
|||
uploadUlr: window.SITE_CONFIG['apiURL'] + '/oss/file/uploadqrcodeV2', |
|||
fromAppList: [ |
|||
{ |
|||
'dictName': '工作端', |
|||
'dictValue': 'gov' |
|||
}, { |
|||
'dictName': '居民端', |
|||
'dictValue': 'resi' |
|||
} |
|||
] |
|||
} |
|||
}, |
|||
created () { |
|||
// this.queryFunctionList() |
|||
}, |
|||
computed: { |
|||
dataRule () { |
|||
return { |
|||
barKey: [ |
|||
{ required: true, message: 'Key不能为空', trigger: 'blur' } |
|||
], |
|||
barName: [ |
|||
{ required: true, message: '导航栏标题不能为空', trigger: 'blur' }, |
|||
{ min: 2, max: 5, message: '导航栏标题长度在 2 到 5 个字符', trigger: 'blur' } |
|||
], |
|||
appType: [ |
|||
{ required: true, message: '类型不能为空', trigger: 'blur' } |
|||
], |
|||
pageTitle: [ |
|||
{ required: true, message: '页面标题不能为空', trigger: 'blur' }, |
|||
{ min: 2, max: 10, message: '页面标题长度在 2 到 10 个字符', trigger: 'blur' } |
|||
] |
|||
// iconPath: [ |
|||
// { required: true, message: '图标不能为空', trigger: 'blur' } |
|||
// ], |
|||
// selectedIconPath: [ |
|||
// { required: true, message: '选中图标不能为空', trigger: 'blur' } |
|||
// ] |
|||
} |
|||
} |
|||
}, |
|||
methods: { |
|||
init (id, type, appType) { |
|||
this.type = type |
|||
this.visible = true |
|||
this.id = id |
|||
|
|||
if (type === 'A') { |
|||
this.dataForm = { |
|||
customerId: '', |
|||
barName: '', |
|||
barKey: '', |
|||
appType: appType, |
|||
pageTitle: '', |
|||
iconPath: '', |
|||
selectedIconPath: '' |
|||
} |
|||
|
|||
} else { |
|||
this.loadFormData() |
|||
} |
|||
}, |
|||
|
|||
loadFormData () { |
|||
|
|||
// const url = 'https://nei.netease.com/api/apimock-v2/e3b1d0eb88e905f6c7ee559b2d6bb7ad/oper/customize/customerfootbar/footbardetail' |
|||
const url = '/oper/customize/customerfootbar/footbardetail' |
|||
let _data = { |
|||
id: this.id |
|||
} |
|||
this.startLoading() |
|||
window.app.ajax.post(url, _data, |
|||
(data, rspMsg) => { |
|||
this.endLoading() |
|||
this.dataForm = data |
|||
|
|||
}, |
|||
(rspMsg, data) => { |
|||
this.endLoading() |
|||
this.$message.error(rspMsg) |
|||
}) |
|||
}, |
|||
|
|||
// 上传大图标成功 |
|||
handleImgSuccess (res, file, type) { |
|||
if (res.code === 0 && res.msg === 'success') { |
|||
if (type === 'sel') { |
|||
this.dataForm.selectedIconPath = res.data.url |
|||
} else if (type === 'small') { |
|||
this.dataForm.iconPath = res.data.url |
|||
} |
|||
} else { |
|||
this.$message.error(res.msg) |
|||
} |
|||
}, |
|||
|
|||
beforeImgUpload (file) { |
|||
// const isPNG = file.type === 'image/png' |
|||
const isLt1M = file.size / 1024 < 20 |
|||
|
|||
// if (!isPNG) { |
|||
// this.$message.error('上传图片只能是 PNG 格式!') |
|||
// } |
|||
if (!isLt1M) { |
|||
this.$message.error('上传图片大小不能超过 1MB!') |
|||
} |
|||
// return isPNG && isLt1M |
|||
return isLt1M |
|||
}, |
|||
|
|||
saveForm () { |
|||
this.$refs['dataForm'].validate((valid, messageObj) => { |
|||
|
|||
if (!valid) { |
|||
app.util.validateRule(messageObj) |
|||
} else { |
|||
|
|||
let url = '' |
|||
if (this.type === 'U') { |
|||
url = '/oper/customize/customerfootbar/updatefootbar' |
|||
// url = 'https://nei.netease.com/api/apimock-v2/e3b1d0eb88e905f6c7ee559b2d6bb7ad/oper/customize/customerfootbar/updatefootbar' |
|||
} else { |
|||
// url = 'https://nei.netease.com/api/apimock-v2/e3b1d0eb88e905f6c7ee559b2d6bb7ad/oper/customize/customerfootbar/createfootbar' |
|||
url = '/oper/customize/customerfootbar/createfootbar' |
|||
this.dataForm.id = '' |
|||
this.dataForm.customerId = 'default' |
|||
} |
|||
window.app.ajax.post(url, this.dataForm, |
|||
(data, rspMsg) => { |
|||
this.$message({ |
|||
type: 'success', |
|||
message: '保存成功' |
|||
}) |
|||
this.$emit('editDiaOK') |
|||
this.visible = false |
|||
}, |
|||
(rspMsg, data) => { |
|||
this.endLoading() |
|||
this.$message.error(rspMsg) |
|||
}) |
|||
} |
|||
}) |
|||
}, |
|||
handleClose () { |
|||
this.visible = false |
|||
}, |
|||
|
|||
// 开启加载动画 |
|||
startLoading () { |
|||
loading = Loading.service({ |
|||
lock: true, // 是否锁定 |
|||
text: '正在加载……', // 加载中需要显示的文字 |
|||
background: 'rgba(0,0,0,.7)' // 背景颜色 |
|||
}) |
|||
}, |
|||
// 结束加载动画 |
|||
endLoading () { |
|||
// clearTimeout(timer); |
|||
if (loading) { |
|||
loading.close() |
|||
} |
|||
} |
|||
|
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped> |
|||
.function-icon { |
|||
width: 28px; |
|||
} |
|||
.item_width_1 { |
|||
width: 300px; |
|||
} |
|||
.item_width_2 { |
|||
width: 500px; |
|||
} |
|||
.block { |
|||
display: block; |
|||
} |
|||
.btn_serve { |
|||
float: left; |
|||
margin-top: 4px; |
|||
margin-left: 10px; |
|||
vertical-align: bottom; |
|||
} |
|||
</style> |
@ -1,332 +0,0 @@ |
|||
<template> |
|||
<div> |
|||
|
|||
<div class="div_btn"> |
|||
<span style="margin-right:20px">{{customerName}}</span> |
|||
<el-button type="default" |
|||
size="mini" |
|||
@click="diaCancel">取消返回</el-button> |
|||
<el-button type="primary" |
|||
size="mini" |
|||
@click="addShow">自定义初始化</el-button> |
|||
|
|||
</div> |
|||
<el-tabs v-model="activeName" |
|||
@tab-click="tabClick" |
|||
class="el-tabs"> |
|||
<el-tab-pane label="居民端" |
|||
name="resi"> |
|||
|
|||
<c-table column-type="index" |
|||
ref="table_resi" |
|||
:url="tableUrl" |
|||
:params="tableParamsResi" |
|||
:operationWidth="80" |
|||
keyword="FootBarCustomize" |
|||
:operations="operations" |
|||
:orderOperations="orderOperations" |
|||
:tableHeight="tableHeight" |
|||
@editShow="editShow" |
|||
@changeState="changeState" |
|||
@moveUp="moveUp"> |
|||
</c-table> |
|||
</el-tab-pane> |
|||
<el-tab-pane label="工作端" |
|||
name="gov"> |
|||
<c-table column-type="index" |
|||
ref="table_work" |
|||
:url="tableUrl" |
|||
:params="tableParamsWork" |
|||
:operationWidth="80" |
|||
keyword="FootBar" |
|||
:operations="operations" |
|||
:orderOperations="orderOperations" |
|||
:tableHeight="tableHeight" |
|||
@editShow="editShow" |
|||
@changeState="changeState" |
|||
@moveUp="moveUp"> |
|||
</c-table> |
|||
</el-tab-pane> |
|||
</el-tabs> |
|||
|
|||
<edit ref="ref_edit" |
|||
@editDiaOK="editDiaOK"> |
|||
|
|||
</edit> |
|||
|
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import CDialog from '@c/CDialog' |
|||
import CTable from '@c/CTableNoPage' |
|||
import Edit from './FootbarEdit' |
|||
|
|||
import { mapGetters } from 'vuex' |
|||
import { Loading } from 'element-ui' // 引入Loading服务 |
|||
|
|||
let loading// 加载动画 |
|||
|
|||
export default { |
|||
data () { |
|||
return { |
|||
activeName: 'resi', |
|||
customerId: '', // 客户id,父组件传 |
|||
customerName: '', // 客户名称,父组件传 |
|||
|
|||
// 查询相关 |
|||
tableParamsWork: { |
|||
appType: 'gov', |
|||
}, |
|||
tableParamsResi: { |
|||
appType: 'resi', |
|||
}, |
|||
tableData: [], |
|||
// 列表相关 |
|||
tableUrl: 'https://nei.netease.com/api/apimock-v2/e3b1d0eb88e905f6c7ee559b2d6bb7ad/oper/customize/customerfootbar/customerfootbars', |
|||
// tableUrl: '/oper/customize/customerfootbar/customerfootbars', |
|||
|
|||
operations: [ |
|||
{ |
|||
lable: (display) => { |
|||
if (display === 0) { |
|||
return '隐藏' |
|||
} else { |
|||
return '显示' |
|||
} |
|||
}, // 按钮显示名称 |
|||
|
|||
size: 'mini', |
|||
style: 'margin: 0 6px;', |
|||
type: 'text', |
|||
slot: '', |
|||
plain: false, |
|||
methodName: 'changeState', // 回调方法名称 |
|||
isShow: (row) => { |
|||
return true |
|||
} |
|||
}, |
|||
{ |
|||
lable: '修改', // 按钮显示名称 |
|||
size: 'mini', |
|||
style: 'margin: 0 6px;', |
|||
type: 'text', |
|||
slot: '', |
|||
plain: false, |
|||
methodName: 'editShow', // 回调方法名称 |
|||
isShow: (row) => { |
|||
return true |
|||
} |
|||
} |
|||
], |
|||
orderOperations: [ |
|||
|
|||
{ |
|||
style: 'width=100px;height=100px', |
|||
type: 'text', |
|||
icon: "el-icon-top", |
|||
methodName: 'moveUp', // 回调方法名称 |
|||
isShow: (row) => { |
|||
return true |
|||
} |
|||
}, |
|||
], |
|||
|
|||
// 查询栏下拉框数据 |
|||
form: { |
|||
dataUrl: [], // 下拉框/单选框/复选框等获取数据的url |
|||
data: { // 全部下拉框数据 |
|||
fromApp: [ |
|||
{ |
|||
value: 'resi', |
|||
label: '居民端' |
|||
}, |
|||
{ |
|||
value: 'gov', |
|||
label: '工作端' |
|||
} |
|||
] |
|||
|
|||
} |
|||
} |
|||
} |
|||
}, |
|||
components: { |
|||
CDialog, CTable, Edit |
|||
}, |
|||
|
|||
mounted () { |
|||
|
|||
}, |
|||
computed: { |
|||
tableHeight () { |
|||
return this.clientHeight - 60 - 80 - 80 |
|||
}, |
|||
...mapGetters(['clientHeight', 'env']) |
|||
}, |
|||
activated () { |
|||
|
|||
this.$nextTick(() => { |
|||
if (this.activeName === 'gov') { |
|||
this.$refs['table_work'].doLayout() // 解决表格错位 |
|||
} else if (this.activeName === 'resi') { |
|||
this.$refs['table_resi'].doLayout() // 解决表格错位 |
|||
} |
|||
|
|||
|
|||
}) |
|||
}, |
|||
methods: { |
|||
initData (customerId, customerName) { |
|||
this.customerId = customerId |
|||
this.customerName = customerName |
|||
this.tableParamsWork.customerId = customerId |
|||
this.tableParamsResi.customerId = customerId |
|||
this.loadResiTableData() |
|||
}, |
|||
// 刷新 |
|||
refresh () { |
|||
|
|||
if (this.activeName === 'gov') { |
|||
this.loadWorkTableData() // 获取表格数据 |
|||
} else if (this.activeName === 'resi') { |
|||
this.loadResiTableData() // 获取表格数据 |
|||
} |
|||
}, |
|||
tabClick (tab) { |
|||
if (tab.name === 'gov') { |
|||
this.loadWorkTableData() // 获取表格数据 |
|||
} |
|||
if (tab.name === 'resi') { |
|||
this.loadResiTableData() // 获取表格数据 |
|||
} |
|||
}, |
|||
// 加载列表数据 |
|||
loadWorkTableData () { |
|||
this.$nextTick(() => { |
|||
this.$refs['table_work'].loadData() // 获取表格数据 |
|||
}) |
|||
}, |
|||
// 加载列表数据 |
|||
loadResiTableData () { |
|||
this.$nextTick(() => { |
|||
this.$refs['table_resi'].loadData() // 获取表格数据 |
|||
}) |
|||
}, |
|||
// 新增 |
|||
addShow () { |
|||
this.$refs['ref_edit'].init('', 'A', this.activeName) |
|||
}, |
|||
// 编辑 |
|||
editShow (row) { |
|||
this.$refs['ref_edit'].init(row.id, 'U') |
|||
}, |
|||
// 改变状态 |
|||
changeState (row, index) { |
|||
let display = row.display === 0 ? 1 : 0 |
|||
const url = 'https://nei.netease.com/api/apimock-v2/e3b1d0eb88e905f6c7ee559b2d6bb7ad/oper/customize/customerfootbar/updatedisplaystatus' |
|||
// const url = '/oper/customize/customerfootbar/updatedisplaystatus' |
|||
const param = { |
|||
id: row.id, |
|||
display: display |
|||
} |
|||
window.app.ajax.post(url, param, |
|||
(data, rspMsg) => { |
|||
this.$message.success('操作成功' + rspMsg) |
|||
this.refresh() |
|||
}, |
|||
(rspMsg, data) => { |
|||
this.$message.error(rspMsg) |
|||
}) |
|||
}, |
|||
// 上移 |
|||
moveUp (row, index) { |
|||
|
|||
if (index > 0) { |
|||
this.tableData = this.$refs.table.getTableData() // 获取表格数据 |
|||
//console.log(this.tableData) |
|||
this.startLoading() |
|||
let resultList = [] |
|||
let one = {} |
|||
for (let i = 0; i < this.tableData.length; i++) { |
|||
let obj = {} |
|||
// eslint-disable-next-line |
|||
// debugger |
|||
if (i === index - 1) { |
|||
one.id = this.tableData[i].id |
|||
one.orderIndex = index |
|||
} else if (i === index) { |
|||
obj.id = this.tableData[i].id |
|||
obj.orderIndex = index - 1 |
|||
resultList.push(obj) |
|||
resultList.push(one) |
|||
} else { |
|||
obj.id = this.tableData[i].id |
|||
obj.orderIndex = i |
|||
resultList.push(obj) |
|||
} |
|||
} |
|||
//console.log(resultList) |
|||
|
|||
// const url = 'https://nei.netease.com/api/apimock-v2/e3b1d0eb88e905f6c7ee559b2d6bb7ad/oper/customize/customerfunctiondetail/updatedisplayorder' |
|||
const url = '/oper/customize/customerfunctiondetail/updatedisplayorder' |
|||
window.app.ajax.post(url, resultList, |
|||
(data, rspMsg) => { |
|||
this.endLoading() |
|||
this.loadTableData() |
|||
}, |
|||
(rspMsg, data) => { |
|||
this.endLoading() |
|||
this.$message.error(rspMsg) |
|||
}) |
|||
|
|||
} else { |
|||
this.$message.warning('无法上移') |
|||
|
|||
return false |
|||
} |
|||
}, |
|||
|
|||
// 取消 |
|||
diaCancel () { |
|||
this.$emit('cancleBack') |
|||
}, |
|||
|
|||
editDiaOK () { |
|||
this.refresh() |
|||
}, |
|||
editDiaCancel () { |
|||
|
|||
}, |
|||
|
|||
async renderSelData () { // 渲染下拉框/单选框/复选框等数据 |
|||
|
|||
}, |
|||
|
|||
// 开启加载动画 |
|||
startLoading () { |
|||
loading = Loading.service({ |
|||
lock: true, // 是否锁定 |
|||
text: '正在加载……', // 加载中需要显示的文字 |
|||
background: 'rgba(0,0,0,.7)' // 背景颜色 |
|||
}) |
|||
}, |
|||
// 结束加载动画 |
|||
endLoading () { |
|||
// clearTimeout(timer); |
|||
if (loading) { |
|||
loading.close() |
|||
} |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
<style> |
|||
.div_btn { |
|||
z-index: 10; |
|||
position: absolute; |
|||
right: 40px; |
|||
top: 35px; |
|||
/* margin: 0 0 20px 0; */ |
|||
} |
|||
</style> |
@ -1,290 +0,0 @@ |
|||
<template> |
|||
<div> |
|||
|
|||
<div class="div_btn"> |
|||
<span style="margin-right:20px">{{customerName}}</span> |
|||
<el-button type="default" |
|||
size="mini" |
|||
@click="diaCancel">取消返回</el-button> |
|||
<el-button type="primary" |
|||
size="mini" |
|||
@click="addShow">自定义初始化</el-button> |
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import CDialog from '@c/CDialog' |
|||
import CTable from '@c/CTableNoPage' |
|||
import Edit from './FootbarEdit' |
|||
|
|||
import { mapGetters } from 'vuex' |
|||
import { Loading } from 'element-ui' // 引入Loading服务 |
|||
|
|||
let loading// 加载动画 |
|||
|
|||
export default { |
|||
data () { |
|||
return { |
|||
activeName: 'resi', |
|||
customerId: '', // 客户id,父组件传 |
|||
customerName: '', // 客户名称,父组件传 |
|||
|
|||
// 查询相关 |
|||
tableParamsWork: { |
|||
appType: 'gov', |
|||
}, |
|||
tableParamsResi: { |
|||
appType: 'resi', |
|||
}, |
|||
tableData: [], |
|||
// 列表相关 |
|||
tableUrl: 'https://nei.netease.com/api/apimock-v2/e3b1d0eb88e905f6c7ee559b2d6bb7ad/oper/customize/customerfootbar/customerfootbars', |
|||
// tableUrl: '/oper/customize/customerfootbar/customerfootbars', |
|||
|
|||
operations: [ |
|||
{ |
|||
lable: (display) => { |
|||
if (display === 0) { |
|||
return '隐藏' |
|||
} else { |
|||
return '显示' |
|||
} |
|||
}, // 按钮显示名称 |
|||
|
|||
size: 'mini', |
|||
style: 'margin: 0 6px;', |
|||
type: 'text', |
|||
slot: '', |
|||
plain: false, |
|||
methodName: 'changeState', // 回调方法名称 |
|||
isShow: (row) => { |
|||
return true |
|||
} |
|||
}, |
|||
{ |
|||
lable: '修改', // 按钮显示名称 |
|||
size: 'mini', |
|||
style: 'margin: 0 6px;', |
|||
type: 'text', |
|||
slot: '', |
|||
plain: false, |
|||
methodName: 'editShow', // 回调方法名称 |
|||
isShow: (row) => { |
|||
return true |
|||
} |
|||
} |
|||
], |
|||
orderOperations: [ |
|||
|
|||
{ |
|||
style: 'width=100px;height=100px', |
|||
type: 'text', |
|||
icon: "el-icon-top", |
|||
methodName: 'moveUp', // 回调方法名称 |
|||
isShow: (row) => { |
|||
return true |
|||
} |
|||
}, |
|||
], |
|||
|
|||
// 查询栏下拉框数据 |
|||
form: { |
|||
dataUrl: [], // 下拉框/单选框/复选框等获取数据的url |
|||
data: { // 全部下拉框数据 |
|||
fromApp: [ |
|||
{ |
|||
value: 'resi', |
|||
label: '居民端' |
|||
}, |
|||
{ |
|||
value: 'gov', |
|||
label: '工作端' |
|||
} |
|||
] |
|||
|
|||
} |
|||
} |
|||
} |
|||
}, |
|||
components: { |
|||
CDialog, CTable, Edit |
|||
}, |
|||
|
|||
mounted () { |
|||
|
|||
}, |
|||
computed: { |
|||
tableHeight () { |
|||
return this.clientHeight - 60 - 80 - 80 |
|||
}, |
|||
...mapGetters(['clientHeight', 'env']) |
|||
}, |
|||
activated () { |
|||
|
|||
this.$nextTick(() => { |
|||
if (this.activeName === 'gov') { |
|||
this.$refs['table_work'].doLayout() // 解决表格错位 |
|||
} else if (this.activeName === 'resi') { |
|||
this.$refs['table_resi'].doLayout() // 解决表格错位 |
|||
} |
|||
|
|||
|
|||
}) |
|||
}, |
|||
methods: { |
|||
initData (customerId, customerName) { |
|||
this.customerId = customerId |
|||
this.customerName = customerName |
|||
this.tableParamsWork.customerId = customerId |
|||
this.tableParamsResi.customerId = customerId |
|||
this.loadResiTableData() |
|||
}, |
|||
// 刷新 |
|||
refresh () { |
|||
|
|||
if (this.activeName === 'gov') { |
|||
this.loadWorkTableData() // 获取表格数据 |
|||
} else if (this.activeName === 'resi') { |
|||
this.loadResiTableData() // 获取表格数据 |
|||
} |
|||
}, |
|||
tabClick (tab) { |
|||
if (tab.name === 'gov') { |
|||
this.loadWorkTableData() // 获取表格数据 |
|||
} |
|||
if (tab.name === 'resi') { |
|||
this.loadResiTableData() // 获取表格数据 |
|||
} |
|||
}, |
|||
// 加载列表数据 |
|||
loadWorkTableData () { |
|||
this.$nextTick(() => { |
|||
this.$refs['table_work'].loadData() // 获取表格数据 |
|||
}) |
|||
}, |
|||
// 加载列表数据 |
|||
loadResiTableData () { |
|||
this.$nextTick(() => { |
|||
this.$refs['table_resi'].loadData() // 获取表格数据 |
|||
}) |
|||
}, |
|||
// 新增 |
|||
addShow () { |
|||
this.$refs['ref_edit'].init('', 'A', this.activeName) |
|||
}, |
|||
// 编辑 |
|||
editShow (row) { |
|||
this.$refs['ref_edit'].init(row.id, 'U') |
|||
}, |
|||
// 改变状态 |
|||
changeState (row, index) { |
|||
let display = row.display === 0 ? 1 : 0 |
|||
const url = 'https://nei.netease.com/api/apimock-v2/e3b1d0eb88e905f6c7ee559b2d6bb7ad/oper/customize/customerfootbar/updatedisplaystatus' |
|||
// const url = '/oper/customize/customerfootbar/updatedisplaystatus' |
|||
const param = { |
|||
id: row.id, |
|||
display: display |
|||
} |
|||
window.app.ajax.post(url, param, |
|||
(data, rspMsg) => { |
|||
this.$message.success('操作成功' + rspMsg) |
|||
this.refresh() |
|||
}, |
|||
(rspMsg, data) => { |
|||
this.$message.error(rspMsg) |
|||
}) |
|||
}, |
|||
// 上移 |
|||
moveUp (row, index) { |
|||
|
|||
if (index > 0) { |
|||
this.tableData = this.$refs.table.getTableData() // 获取表格数据 |
|||
//console.log(this.tableData) |
|||
this.startLoading() |
|||
let resultList = [] |
|||
let one = {} |
|||
for (let i = 0; i < this.tableData.length; i++) { |
|||
let obj = {} |
|||
// eslint-disable-next-line |
|||
// debugger |
|||
if (i === index - 1) { |
|||
one.id = this.tableData[i].id |
|||
one.orderIndex = index |
|||
} else if (i === index) { |
|||
obj.id = this.tableData[i].id |
|||
obj.orderIndex = index - 1 |
|||
resultList.push(obj) |
|||
resultList.push(one) |
|||
} else { |
|||
obj.id = this.tableData[i].id |
|||
obj.orderIndex = i |
|||
resultList.push(obj) |
|||
} |
|||
} |
|||
//console.log(resultList) |
|||
|
|||
// const url = 'https://nei.netease.com/api/apimock-v2/e3b1d0eb88e905f6c7ee559b2d6bb7ad/oper/customize/customerfunctiondetail/updatedisplayorder' |
|||
const url = '/oper/customize/customerfunctiondetail/updatedisplayorder' |
|||
window.app.ajax.post(url, resultList, |
|||
(data, rspMsg) => { |
|||
this.endLoading() |
|||
this.loadTableData() |
|||
}, |
|||
(rspMsg, data) => { |
|||
this.endLoading() |
|||
this.$message.error(rspMsg) |
|||
}) |
|||
|
|||
} else { |
|||
this.$message.warning('无法上移') |
|||
|
|||
return false |
|||
} |
|||
}, |
|||
|
|||
// 取消 |
|||
diaCancel () { |
|||
this.$emit('cancleBack') |
|||
}, |
|||
|
|||
editDiaOK () { |
|||
this.refresh() |
|||
}, |
|||
editDiaCancel () { |
|||
|
|||
}, |
|||
|
|||
async renderSelData () { // 渲染下拉框/单选框/复选框等数据 |
|||
|
|||
}, |
|||
|
|||
// 开启加载动画 |
|||
startLoading () { |
|||
loading = Loading.service({ |
|||
lock: true, // 是否锁定 |
|||
text: '正在加载……', // 加载中需要显示的文字 |
|||
background: 'rgba(0,0,0,.7)' // 背景颜色 |
|||
}) |
|||
}, |
|||
// 结束加载动画 |
|||
endLoading () { |
|||
// clearTimeout(timer); |
|||
if (loading) { |
|||
loading.close() |
|||
} |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
<style> |
|||
.div_btn { |
|||
z-index: 10; |
|||
position: absolute; |
|||
right: 40px; |
|||
top: 35px; |
|||
/* margin: 0 0 20px 0; */ |
|||
} |
|||
</style> |
@ -0,0 +1,204 @@ |
|||
<template> |
|||
<el-dialog :visible.sync="visible" |
|||
:title="title" |
|||
:close-on-click-modal="false" |
|||
:before-close="handleClose" |
|||
:close-on-press-escape="false" |
|||
:width="diaWidth+'%'" |
|||
:top="diaTop"> |
|||
<el-row class="wrap" |
|||
:gutter="24"> |
|||
<el-col :span="12"> |
|||
<el-card class="box-card"> |
|||
<div slot="header" |
|||
class="clearfix"> |
|||
<span>同步列表(客户已有的Footbar同部为默认配置)</span> |
|||
|
|||
</div> |
|||
<el-table id="have_table" |
|||
ref="table" |
|||
:height="tableHeight" |
|||
:data="allHaveList" |
|||
border |
|||
@select="handleSelect" |
|||
@select-all="handleSelectAll"> |
|||
|
|||
<el-table-column type="selection"></el-table-column> |
|||
|
|||
<el-table-column label="名称" |
|||
align="center" |
|||
header-align="center"> |
|||
|
|||
</el-table-column> |
|||
</el-table> |
|||
</el-card> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<el-card class="box-card"> |
|||
<div slot="header" |
|||
class="clearfix"> |
|||
<span>采集列表(客户的Footbar同部为默认配置)</span> |
|||
|
|||
</div> |
|||
<!-- <div class="div_list"></div> --> |
|||
<el-table id="have_table" |
|||
ref="table" |
|||
:height="tableHeight" |
|||
:data="allNoList" |
|||
border |
|||
v-loading="tableLoading" |
|||
@select="handleSelect" |
|||
@select-all="handleSelectAll"> |
|||
|
|||
<el-table-column type="selection"></el-table-column> |
|||
|
|||
<el-table-column label="名称" |
|||
align="center" |
|||
header-align="center"> |
|||
|
|||
</el-table-column> |
|||
</el-table> |
|||
</el-card> |
|||
</el-col> |
|||
</el-row> |
|||
|
|||
<template slot="footer"> |
|||
<el-button @click="visible = false">{{ $t('cancel') }}</el-button> |
|||
<el-button type="primary" |
|||
@click="saveBar()">{{ $t('confirm') }}</el-button> |
|||
</template> |
|||
</el-dialog> |
|||
</template> |
|||
|
|||
<script> |
|||
import { mapGetters } from 'vuex' |
|||
import { Loading } from 'element-ui' // 引入Loading服务 |
|||
import { requestPost } from "@/js/dai/request"; |
|||
|
|||
let loading// 加载动画 |
|||
export default { |
|||
data () { |
|||
return { |
|||
visible: false, |
|||
tableLoading: false, |
|||
customerId: "", |
|||
appType: "", |
|||
|
|||
allHaveList: [],//全部已有的bar |
|||
allNoList: [],//全部没有的bar |
|||
syncBarKeyList: [],//要同步的bar |
|||
addBarKeyList: []//要增加的bar |
|||
|
|||
} |
|||
}, |
|||
created () { |
|||
// this.queryFunctionList() |
|||
}, |
|||
computed: { |
|||
cardHeight () { |
|||
return this.clientHeight - 60 - 80 - 80 - 280 |
|||
}, |
|||
tableHeight () { |
|||
return this.clientHeight - 60 - 80 - 80 - 280 - 100 |
|||
}, |
|||
...mapGetters(['clientHeight', 'env']) |
|||
}, |
|||
methods: { |
|||
init (customerId, appType, allHaveList) { |
|||
this.customerId = customerId |
|||
this.appType = appType |
|||
this.allHaveList = allHaveList |
|||
|
|||
this.visible = true |
|||
this.loadNoBarList() |
|||
}, |
|||
|
|||
// 选中复选框 |
|||
handleSelect (selection, row) { |
|||
debugger |
|||
|
|||
}, |
|||
// 全选复选框 |
|||
handleSelectAll (selection) { |
|||
debugger |
|||
|
|||
}, |
|||
|
|||
async loadNoBarList () { |
|||
|
|||
const url = '/oper/customize/customerfootbar/getNotOnlineFootBars' |
|||
let params = { |
|||
appType: this.appType, |
|||
customerId: this.customerId, |
|||
} |
|||
this.startLoading() |
|||
this.tableLoading = true |
|||
const { data, code, msg } = await requestPost(url, params) |
|||
if (code === 0) { |
|||
|
|||
if (data) { |
|||
this.allNoList = data |
|||
} |
|||
} else { |
|||
this.$message.error(msg) |
|||
} |
|||
this.endLoading() |
|||
this.tableLoading = false |
|||
}, |
|||
|
|||
async saveBar () { |
|||
const url = '/oper/customize/customerfootbar/syncfootbar4customer' |
|||
let params = { |
|||
appType: this.appType, |
|||
customerId: this.customerId, |
|||
syncBarKeyList: this.syncBarKeyList, |
|||
addBarKeyList: this.addBarKeyList, |
|||
} |
|||
this.startLoading() |
|||
const { data, code, msg } = await requestPost(url, params) |
|||
if (code === 0) { |
|||
|
|||
this.$message({ |
|||
type: 'success', |
|||
message: '保存成功' |
|||
}) |
|||
this.$emit('dialogOk') |
|||
this.visible = false |
|||
} else { |
|||
this.$message.error(msg) |
|||
} |
|||
|
|||
|
|||
}, |
|||
handleClose () { |
|||
this.visible = false |
|||
}, |
|||
|
|||
// 开启加载动画 |
|||
startLoading () { |
|||
loading = Loading.service({ |
|||
lock: true, // 是否锁定 |
|||
text: '正在加载……', // 加载中需要显示的文字 |
|||
background: 'rgba(0,0,0,.7)' // 背景颜色 |
|||
}) |
|||
}, |
|||
// 结束加载动画 |
|||
endLoading () { |
|||
// clearTimeout(timer); |
|||
if (loading) { |
|||
loading.close() |
|||
} |
|||
} |
|||
|
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped> |
|||
.wrap { |
|||
height: 400px; |
|||
} |
|||
.div_list { |
|||
height: 300px; |
|||
} |
|||
</style> |
Loading…
Reference in new issue