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.
264 lines
7.8 KiB
264 lines
7.8 KiB
|
5 years ago
|
<template>
|
||
|
|
<el-dialog :visible.sync="visible"
|
||
|
|
:title="'修改定制功能'"
|
||
|
|
:close-on-click-modal="false"
|
||
|
|
:before-close="handleClose"
|
||
|
|
:close-on-press-escape="false">
|
||
|
|
<el-form :inline="true"
|
||
|
|
:model="dataForm"
|
||
|
|
:rules="dataRule"
|
||
|
|
ref="dataForm"
|
||
|
|
:label-width="'120px'">
|
||
|
|
<el-form-item label="功能名称"
|
||
|
|
prop="customizedName">
|
||
|
|
<el-input class="item_width_1"
|
||
|
|
v-model="dataForm.customizedName"
|
||
|
|
placeholder="功能名称"></el-input>
|
||
|
|
</el-form-item>
|
||
|
|
<el-form-item label="来源"
|
||
|
|
prop="fromApp">
|
||
|
|
<el-select class="item_width_1"
|
||
|
|
v-model="dataForm.fromApp"
|
||
|
|
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 label="上架状态"
|
||
|
|
prop="shoppingStatus">
|
||
|
|
<el-select class="item_width_1"
|
||
|
|
v-model="dataForm.shoppingStatus"
|
||
|
|
placeholder="请选择"
|
||
|
|
clearable>
|
||
|
|
<el-option v-for="item in shoppingStatusList"
|
||
|
|
:key="item.dictValue"
|
||
|
|
:label="item.dictName"
|
||
|
|
:value="item.dictValue">
|
||
|
|
</el-option>
|
||
|
|
</el-select>
|
||
|
|
</el-form-item>
|
||
|
|
<el-form-item label="外链地址"
|
||
|
|
prop="targetLink">
|
||
|
|
<el-input class="item_width_1"
|
||
|
|
v-model="dataForm.targetLink"
|
||
|
|
placeholder="外链地址"></el-input>
|
||
|
|
</el-form-item>
|
||
|
|
|
||
|
|
<el-form-item prop="iconLargeImg"
|
||
|
|
label="大图标">
|
||
|
|
<el-upload class="item_width_1 avatar-uploader"
|
||
|
|
:action="uploadUlr"
|
||
|
|
:show-file-list="false"
|
||
|
|
:on-success="function (res, file) { return handleImgSuccess(res, file, 'large')}"
|
||
|
|
:before-upload="beforeImgUpload">
|
||
|
|
<img v-if="dataForm.iconLargeImg"
|
||
|
|
:src="dataForm.iconLargeImg"
|
||
|
|
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="iconSmallImg"
|
||
|
|
label="小图标">
|
||
|
|
<el-upload class="item_width_1 avatar-uploader"
|
||
|
|
:action="uploadUlr"
|
||
|
|
:show-file-list="false"
|
||
|
|
:on-success="function (res, file) { return handleImgSuccess(res, file, 'small')}"
|
||
|
|
:before-upload="beforeImgUpload">
|
||
|
|
<img v-if="dataForm.iconSmallImg"
|
||
|
|
:src="dataForm.iconSmallImg"
|
||
|
|
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 class="block"
|
||
|
|
label="业务域名"
|
||
|
|
prop="domainName">
|
||
|
|
<el-input class="item_width_2"
|
||
|
|
v-model="dataForm.domainName"
|
||
|
|
placeholder="业务域名"
|
||
|
|
type="textarea"></el-input>
|
||
|
|
</el-form-item>
|
||
|
|
<div slot="tip"
|
||
|
|
class="el-upload__tip">可写多个,用;分隔</div>
|
||
|
|
<el-form-item class="block"
|
||
|
|
label="功能说明"
|
||
|
|
prop="functionExplain">
|
||
|
|
<el-input class="item_width_2"
|
||
|
|
v-model="dataForm.functionExplain"
|
||
|
|
placeholder="功能说明"
|
||
|
|
type="textarea"></el-input>
|
||
|
|
</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>
|
||
|
|
|
||
|
|
export default {
|
||
|
|
data () {
|
||
|
|
return {
|
||
|
|
visible: false,
|
||
|
|
|
||
|
|
dataForm: {
|
||
|
|
functionId: '',
|
||
|
|
customizedName: '',
|
||
|
|
iconLargeImg: '',
|
||
|
|
iconSmallImg: '',
|
||
|
|
shoppingStatus: 1,
|
||
|
|
functionExplain: '',
|
||
|
|
targetLink: '',
|
||
|
|
domainName: '',
|
||
|
|
fromApp: 'resi'
|
||
|
|
},
|
||
|
|
uploadUlr: window.SITE_CONFIG['apiURL'] + '/oss/file/function/upload',
|
||
|
|
fromAppList: [
|
||
|
|
{
|
||
|
|
'dictName': '工作端',
|
||
|
|
'dictValue': 'gov'
|
||
|
|
}, {
|
||
|
|
'dictName': '居民端',
|
||
|
|
'dictValue': 'resi'
|
||
|
|
}
|
||
|
|
],
|
||
|
|
shoppingStatusList: [
|
||
|
|
{
|
||
|
|
'dictName': '下架',
|
||
|
|
'dictValue': '0'
|
||
|
|
}, {
|
||
|
|
'dictName': '上架',
|
||
|
|
'dictValue': '1'
|
||
|
|
}
|
||
|
|
]
|
||
|
|
}
|
||
|
|
},
|
||
|
|
created () {
|
||
|
|
// this.queryFunctionList()
|
||
|
|
},
|
||
|
|
computed: {
|
||
|
|
dataRule () {
|
||
|
|
return {
|
||
|
|
customizedName: [
|
||
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
||
|
|
],
|
||
|
|
iconLargeImg: [
|
||
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
||
|
|
],
|
||
|
|
iconSmallImg: [
|
||
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
||
|
|
],
|
||
|
|
fromApp: [
|
||
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
||
|
|
],
|
||
|
|
shoppingStatus: [
|
||
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
||
|
|
],
|
||
|
|
functionExplain: [
|
||
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
||
|
|
],
|
||
|
|
targetLink: [
|
||
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
||
|
|
]
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
methods: {
|
||
|
|
init (dataForm) {
|
||
|
|
console.log(dataForm)
|
||
|
|
this.visible = true
|
||
|
|
// this.dataForm=dataForm
|
||
|
|
|
||
|
|
this.$nextTick(() => {
|
||
|
|
Object.assign(this.dataForm, dataForm)
|
||
|
|
})
|
||
|
|
},
|
||
|
|
|
||
|
|
// 上传大图标成功
|
||
|
|
handleImgSuccess (res, file, type) {
|
||
|
|
if (res.code === 0 && res.msg === 'success') {
|
||
|
|
if (type === 'large') {
|
||
|
|
this.dataForm.iconLargeImg = res.data.url
|
||
|
|
} else if (type === 'small') {
|
||
|
|
this.dataForm.iconSmallImg = res.data.url
|
||
|
|
}
|
||
|
|
} else {
|
||
|
|
this.$message.error(res.msg)
|
||
|
|
}
|
||
|
|
},
|
||
|
|
|
||
|
|
beforeImgUpload (file) {
|
||
|
|
// const isPNG = file.type === 'image/png'
|
||
|
|
const isLt1M = file.size / 1024 / 1024 < 1
|
||
|
|
|
||
|
|
// if (!isPNG) {
|
||
|
|
// this.$message.error('上传图片只能是 PNG 格式!')
|
||
|
|
// }
|
||
|
|
if (!isLt1M) {
|
||
|
|
this.$message.error('上传图片大小不能超过 1MB!')
|
||
|
|
}
|
||
|
|
// return isPNG && isLt1M
|
||
|
|
return isLt1M
|
||
|
|
},
|
||
|
|
|
||
|
|
saveForm () {
|
||
|
|
this.$refs['dataForm'].validate((valid) => {
|
||
|
|
if (!valid) {
|
||
|
|
this.$message.error('表单验证失败!')
|
||
|
|
} else {
|
||
|
|
console.log(this.dataForm)
|
||
|
|
const url = 'https://nei.netease.com/api/apimock-v2/e3b1d0eb88e905f6c7ee559b2d6bb7ad/oper/customize/functioncustomized/updatecustomized'
|
||
|
|
// const url = '/oper/customize/functioncustomized/updatecustomized'
|
||
|
|
window.app.ajax.post(url, this.dataForm,
|
||
|
|
(data, rspMsg) => {
|
||
|
|
this.$message({
|
||
|
|
type: 'success',
|
||
|
|
message: '保存成功'
|
||
|
|
})
|
||
|
|
this.visible = false
|
||
|
|
this.$emit('editDiaOK')
|
||
|
|
},
|
||
|
|
(rspMsg, data) => {
|
||
|
|
this.endLoading()
|
||
|
|
this.$message.error(rspMsg)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
})
|
||
|
|
},
|
||
|
|
handleClose () {
|
||
|
|
this.visible = false
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|
||
|
|
</script>
|
||
|
|
|
||
|
|
<style scoped>
|
||
|
|
.function-icon {
|
||
|
|
width: 28px;
|
||
|
|
}
|
||
|
|
.item_width_1 {
|
||
|
|
width: 300px;
|
||
|
|
}
|
||
|
|
.item_width_2 {
|
||
|
|
width: 700px;
|
||
|
|
}
|
||
|
|
.block {
|
||
|
|
display: block;
|
||
|
|
}
|
||
|
|
</style>
|