<template>
|
<div>
|
<el-dialog
|
:title="title"
|
center
|
width="850px"
|
:visible.sync="show"
|
:close-on-click-modal="false"
|
@close="handleClose"
|
>
|
<el-form :model="form" :rules="rules" ref="form" label-width="125px">
|
<div class="form">
|
<el-row>
|
<el-col :span="12">
|
<el-form-item label="模板名称" prop="channelName">
|
<el-input
|
v-model="form.channelName"
|
:disabled="disabled"
|
></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="模板编号" prop="channelCode">
|
<el-input v-model="form.channelCode" :disabled="disabled"></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="12">
|
<el-form-item label="url网址" prop="url">
|
<el-input v-model="form.url" :disabled="disabled"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="通知方式" prop="urlType">
|
<el-select v-model="form.urlType" placeholder="请选择">
|
<el-option label="url直连" value="U"></el-option>
|
<el-option label="Eurake服务名" value="S"></el-option>
|
<el-option label="mq回調" value="MQ"></el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="12">
|
<el-form-item label="通知状态" prop="notityStatus">
|
<el-select v-model="form.notityStatus" placeholder="请选择">
|
<el-option label="有效" value="01"></el-option>
|
<el-option label="无效" value="02"></el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="渠道状态" prop="status">
|
<el-select v-model="form.status" placeholder="请选择">
|
<el-option label="有效" value="01"></el-option>
|
<el-option label="无效" value="02"></el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</div>
|
</el-form>
|
<div slot="footer" class="dialog-footer">
|
<el-button size="mini" @click="handleClose">{{
|
!disabled ? "取消" : "关闭"
|
}}</el-button>
|
<el-button
|
class="blueBtn"
|
type="primary"
|
size="mini"
|
v-if="!disabled"
|
@click="handleSubmit"
|
>确定</el-button
|
>
|
</div>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
import common from "@/utils/common";
|
import * as dayjs from 'dayjs'
|
import { addChannel, updateChannel } from "@/api/dreamSend";
|
import queryAccountList from "@dreamSend/model/queryAccountList";
|
|
export default {
|
props: {
|
// 1 新增 2 编辑 0查看
|
type: {
|
type: Number,
|
default: 0,
|
},
|
},
|
data: function () {
|
return {
|
show: false,
|
required: true,
|
accountList: [],
|
|
form: {
|
urlType: "U",
|
notityStatus: "01",
|
status: "01",
|
},
|
rules: {
|
channelName: { required: true, message: "此项为必填项", trigger: "blur" },
|
channelCode: { required: true, message: "此项为必填项", trigger: "blur" },
|
url: { required: true, message: "此项为必填项", trigger: "blur" },
|
urlType: { required: true, message: "此项为必填项", trigger: "select" },
|
notityStatus: { required: true, message: "此项为必填项", trigger: "select" },
|
status: { required: true, message: "此项为必填项", trigger: "select" },
|
},
|
title: "编辑",
|
};
|
},
|
computed: {
|
disabled() {
|
return this.type === 0 ? true : false;
|
},
|
channelList() {
|
return this.$parent.smsChannel || []
|
}
|
},
|
methods: {
|
initInfo(title, data) {
|
this.title = title;
|
this.show = true;
|
this.form = { ...this.form, ...data };
|
},
|
|
handleClose() {
|
this.form = {
|
urlType: "U",
|
notityStatus: "01",
|
status: "01",
|
};
|
this.$refs.form.resetFields();
|
this.show = false;
|
},
|
handleSubmit() {
|
this.$refs["form"].validate(async (valid) => {
|
if (valid) {
|
let {form} = this
|
const parmas = {
|
channelCode: form.channelCode,
|
channelName: form.channelName,
|
notityStatus: form.notityStatus,
|
status: form.status,
|
url: form.url,
|
urlType: form.urlType
|
}
|
let res = this.type === 1 ? await addChannel({ ...parmas }) : await updateChannel({ ...parmas, id: form.id })
|
if (res.code === "200") {
|
this.$refs.form.resetFields();
|
this.show = false;
|
this.$message.success(res.message || '保存成功!');
|
this.$emit("submit");
|
}
|
} else {
|
return false;
|
}
|
});
|
},
|
},
|
};
|
</script>
|
|
<style lang="stylus" scoped>
|
>>> .el-dialog__header {
|
padding-top: 40px;
|
|
.el-dialog__title {
|
font-size: 18px;
|
// font-family PingFangSC-Medium,PingFangSC
|
font-weight: bold;
|
color: #222222;
|
line-height: 25px;
|
}
|
}
|
|
>>> .el-select {
|
width: 100%;
|
}
|
|
.labels >>> .el-form-item__label {
|
line-height: 1.2;
|
padding: 4px 6px;
|
}
|
|
>>> .el-dialog__footer {
|
padding-bottom: 30px;
|
|
.dialog-footer {
|
button {
|
width: 120px;
|
height: 30px;
|
}
|
|
.blueBtn {
|
background-color: rgba(0, 129, 240, 1);
|
border-radius: 4px;
|
color: rgba(255, 255, 255, 1);
|
padding: 0;
|
|
span {
|
font-size: 14px;
|
height: 20px;
|
font-weight: 400;
|
line-height: 20px;
|
}
|
}
|
}
|
}
|
</style>
|