<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="105px">
|
<div class="form">
|
<el-row>
|
<el-col :span="12">
|
<el-form-item label="机构名称" prop="orgName">
|
<el-input
|
v-model="form.orgName"
|
:disabled="disabled"
|
></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="机构编码" prop="orgCode">
|
<el-input
|
v-model="form.orgCode"
|
:disabled="disabled"
|
></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="12">
|
<el-form-item label="权重" prop="weight">
|
<el-input v-model="form.weight" :disabled="disabled"></el-input>
|
</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>
|
<el-row>
|
<el-col :span="12">
|
<el-form-item label="生效日期" prop="validDate">
|
<el-date-picker
|
v-model="form.validDate"
|
type="datetime"
|
placeholder="选择日期时间"
|
>
|
</el-date-picker>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="失效日期" prop="invalidDate">
|
<el-date-picker
|
v-model="form.invalidDate"
|
type="datetime"
|
placeholder="选择日期时间"
|
>
|
</el-date-picker>
|
</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 { addOrg, updateOrg } 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: {
|
status: "01",
|
validDate: new Date(),
|
invalidDate: new Date(),
|
},
|
rules: {
|
orgName: { required: true, message: "此项为必填项", trigger: "blur" },
|
orgCode: { required: true, message: "此项为必填项", trigger: "blur" },
|
weight: { required: true, message: "此项为必填项", trigger: "blur" },
|
type: { required: true, message: "此项为必填项", trigger: "select" },
|
status: { required: true, message: "此项为必填项", trigger: "select" },
|
validDate: { required: true, message: "此项为必填项", trigger: "blur" },
|
invalidDate: {
|
required: true,
|
message: "此项为必填项",
|
trigger: "blur",
|
},
|
},
|
title: "编辑",
|
};
|
},
|
computed: {
|
disabled() {
|
return this.type === 0 ? true : false;
|
},
|
},
|
methods: {
|
initInfo(title, data) {
|
this.title = title;
|
this.show = true;
|
this.queryAccountList();
|
this.form = { ...this.form, ...data };
|
},
|
|
// 主体下拉列表
|
async queryAccountList() {
|
const res = await queryAccountList().request({});
|
console.log(res);
|
const { list } = res;
|
this.accountList = list;
|
// this.updateValue('channelCode', { options: list })
|
},
|
manualstatusChange(e) {
|
// 审批拒绝,意见必填
|
this.$refs.form.clearValidate("manualdesc");
|
this.rules.manualdesc.required = e == 4;
|
this.required = e == 4;
|
},
|
handleClose() {
|
this.form = {
|
status: "01",
|
stubType: "00",
|
sentType: "02",
|
};
|
this.$refs.form.resetFields();
|
this.show = false;
|
},
|
handleSubmit() {
|
this.$refs["form"].validate(async (valid) => {
|
if (valid) {
|
let { form } = this;
|
const params = {
|
orgName: form.orgName,
|
orgCode: form.orgCode,
|
weight: form.weight,
|
status: form.status,
|
validDate: form.validDate,
|
invalidDate: form.invalidDate,
|
validDate: dayjs(form.validDate).format("YYYY-MM-DD HH:mm:ss"),
|
invalidDate: dayjs(form.invalidDate).format("YYYY-MM-DD HH:mm:ss"),
|
};
|
let res =
|
this.type === 1
|
? await addOrg({ ...params })
|
: await updateOrg({ ...params, id: form.id });
|
if (res.code === "200") {
|
console.log(1234444);
|
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%;
|
}
|
|
>>> .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>
|