灵山运营端前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

139 lines
3.3 KiB

<template>
<div>
<c-dialog :title="'修改配置信息'"
:visible="diaVisible"
:dialogHeight="0.8"
:width="45"
@ok="save"
@cancel="diaCancel">
<div style="margin:30px">
<c-form ref="ref_form"
keyword="ConfigForm"
:labelWidth="150"
:itemWidth="'300px'"
:method="'U'"
:option-data="optionData"></c-form>
</div>
</c-dialog>
</div>
</template>
<script>
/* eslint-disable */
import CForm from '@c/CForm'
import CDialog from '@c/CDialog'
import { mapGetters } from 'vuex'
import { Loading } from 'element-ui' // 引入Loading服务
let loading // 加载动画
export default {
data () {
return {
diaVisible: false,
customerId: '',//父组件传来的
formData: {},
optionData: {
}
}
},
components: {
CForm, CDialog
},
mounted () {
},
computed: {
tableHeight () {
return this.clientHeight - 60 - 80 - 80 - 50 - 400
},
...mapGetters(['clientHeight']),
dataRule () {
return {
logo: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
]
}
}
},
methods: {
// eslint-disable-next-line
initData (row) {
this.diaVisible = true
this.customerId = row.customerId
this.$nextTick(() => {
this.loadData()
})
},
loadData () {
this.startLoading()
// let url = 'https://nei.netease.com/api/apimock-v2/e3b1d0eb88e905f6c7ee559b2d6bb7ad/oper/crm/customer/getcustomerparameter'
let url = '/oper/crm/customer/getcustomerparameter'
let params = {
customerId: this.customerId
}
// 表单对象
window.app.ajax.post(url, params,
(data, rspMsg) => {
this.endLoading()
this.formData = data
this.$refs['ref_form'].assign(data)
},
(rspMsg, data) => {
this.endLoading()
this.$message.error(rspMsg)
})
},
save () {
this.$refs['ref_form'].validate((valid) => {
if (valid) {
this.startLoading()
// let url = 'https://nei.netease.com/api/apimock-v2/e3b1d0eb88e905f6c7ee559b2d6bb7ad/oper/crm/customer/updatecustomerparameter'
let url = '/oper/crm/customer/updatecustomerparameter'
// 表单对象
let _data = this.$refs['ref_form'].model
window.app.ajax.post(url, _data,
(data, rspMsg) => {
this.endLoading()
this.$message.success('修改成功')
this.diaCancel()
this.$emit('refresh')
},
(rspMsg, data) => {
this.endLoading()
this.$message.error(rspMsg)
})
}
})
},
diaCancel () {
this.diaVisible = false
},
// 开启加载动画
startLoading () {
loading = Loading.service({
lock: true, // 是否锁定
text: '正在加载……', // 加载中需要显示的文字
background: 'rgba(0,0,0,.7)' // 背景颜色
})
},
// 结束加载动画
endLoading () {
// clearTimeout(timer);
if (loading) {
loading.close()
}
}
}
}
</script>