Browse Source

服务设置 域名设置组件

pull/87/head
pengda 15 hours ago
parent
commit
7113ce5e25
  1. 39
      src/components/domainBind.vue

39
src/components/domainBind.vue

@ -1,7 +1,7 @@
<template> <template>
<div> <div>
<el-form class="el-row demo-ruleForm" ref="formRef"> <el-form class="el-row demo-ruleForm" ref="formRef" v-if="domainOptions.length>0">
<GuipFormItem column="column" class="combo-formItem w540" v-if="domainOptions" :label="label" :class="label ? '' : 'combo-formItem-nolabel'"> <GuipFormItem column="column" class="combo-formItem w540" :label="label" :class="label ? '' : 'combo-formItem-nolabel'">
<div slot="formDom" class="self-drop-wrap flex w540"> <div slot="formDom" class="self-drop-wrap flex w540">
<GuipInput v-model="prefix" style="width: 60%;" placeholder="仅支持数字、字母" @blur="inputEnd"></GuipInput> <GuipInput v-model="prefix" style="width: 60%;" placeholder="仅支持数字、字母" @blur="inputEnd"></GuipInput>
<!-- 只用作选中内容展示 --> <!-- 只用作选中内容展示 -->
@ -85,7 +85,7 @@ import CustomDropdown from "@/components/CustomDropdown.vue";
export default { export default {
name: 'domainBind', name: 'domainBind',
props:['label', 'options'], props:['label'],
components: { components: {
CustomDropdown, GuipFormItem, CustomDropdown, GuipFormItem,
GuipButton, GuipButton,
@ -121,15 +121,6 @@ export default {
} }
}, },
watch: { watch: {
options: {
immediate: true,
handler(newVal) {
this.domainOptions = newVal;
if (newVal.length>0) {
this.domain = newVal[0].value
}
},
},
formData: { formData: {
deep: true, deep: true,
handler() { handler() {
@ -139,7 +130,30 @@ export default {
} }
} }
}, },
mounted(){
this.getDomainList()
},
methods:{ methods:{
getDomainList() {
const that = this
that.$http('POST', '/agentnew/ajax_get_private_domains', {}, {
headers: {
'Auth': this.token
}
}).then(response => {
if(response.status){
this.domain = response.data[0]
that.domainOptions = response.data.map(item => ({
label: item,
value: item
}));
return true
}
that.$message.error(response.info);
}).catch(error => {
console.error(error, 'error')
})
},
toggleDrop(e) { toggleDrop(e) {
this.$refs.dropDomain.toggleDropdown(e) this.$refs.dropDomain.toggleDropdown(e)
}, },
@ -223,7 +237,6 @@ export default {
label: that.formData.domain, label: that.formData.domain,
value: that.formData.domain value: that.formData.domain
}) })
that.$emit('handleOptions', that.domainOptions)
that.show_step = false that.show_step = false
that.dialogVisible = false that.dialogVisible = false
that.$message.success('添加成功'); that.$message.success('添加成功');

Loading…
Cancel
Save