<template> <el-dialog :title="title" width="520px" :visible.sync="isShowInfo" append-to-body @close="close" > <div class="brandDialog"> <div class="inputContent"> <div class="inputBox"> <red-star /> <input-vue title="服务编号" placeholder="请输入服务编号" width="300px" class="inputWidth" style="justify-content: space-between" v-model="managementInfo.serviceCode" ></input-vue> </div> <div class="inputBox"> <red-star /> <input-vue title="服务名称" placeholder="请输入服务名称" width="300px" class="inputWidth" style="justify-content: space-between" v-model="managementInfo.serviceName" ></input-vue> </div> <div class="inputBox"> <red-star /> <input-vue title="服务类型" placeholder="" class="inputWidth" style="justify-content: space-between" > <el-select v-model="managementInfo.typeCode" style="width: 300px" filterable placeholder="请选择" > <el-option v-for="item in serverType" :key="item.typeCode" :label="item.typeName" :value="item.typeCode" > </el-option> </el-select> </input-vue> </div> <!-- <div class="inputBox"> <red-star /> <input-vue title="资质要求" placeholder="" class="inputWidth" style="justify-content: space-between;"> <el-select v-model="managementInfo.serviceCode" style="width:300px" filterable multiple allow-create default-first-option placeholder="请输入" > <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" > </el-option> </el-select> </input-vue> </div> --> <div class="inputBox"> <red-star /> <input-vue title="服务描述" width="300px" class="inputWidth" style="justify-content: space-between" placeholder="请输入服务描述" v-model="managementInfo.description" > </input-vue> </div> <div class="inputBox"> <red-star /> <input-vue title="服务时间" class="inputWidth" style="justify-content: space-between" > <el-date-picker style="width: 300px" v-model="managementInfo.serviceTime" type="date" placeholder="选择日期" format="yyyy - MM - dd " value-format="yyyy-MM-dd"> </el-date-picker> </input-vue> </div> <div class="inputBox"> <input-vue title="备注" class="inputWidth" style="justify-content: space-between" > <el-input type="textarea" style="width: 300px" :rows="2" placeholder="请输入内容" v-model="managementInfo.remark" > </el-input> </input-vue> </div> </div> <div class="btnBox"> <el-button type="primary" class="save" @click="save">保存</el-button> <el-button type="info" class="close" @click="close">取消</el-button> </div> </div> </el-dialog> </template> <script> import InputVue from "../../input/inputVue.vue"; import DialogHeader from "../dialogHeader.vue"; import RedStar from "../../redStar.vue"; import { TM_list } from "../../../../api/server/TypeManagement"; import { M_add ,M_update} from "../../../../api/server/Management"; export default { components: { DialogHeader, RedStar, InputVue, }, props: { isShowInfo: { type: Boolean, default: true, }, title:'', dataInfo:'' }, mounted() { TM_list().then((res) => { console.log(res); this.serverType = res; }); }, data() { return { serverType: [], managementInfo: { serviceCode: "", serviceName: "", typeCode: "", description: "", serviceTime: "", remark: "", }, }; }, methods: { close() { this.$emit("close"); }, save() { if (this.title == "服务新增") { M_add(this.managementInfo).then((res) => { if (res != 0) { this.$message.success("新增成功"); this.close(); this.managementInfo = { serviceCode: "", serviceName: "", typeCode: "", description: "", serviceTime: "", remark: "", }; } }); }else{ // 编辑操作 M_update(this.managementInfo).then(res=>{ if(res!=''){ this.$message.success("跟新成功") this.close(); } }) } }, }, watch:{ dataInfo:{ handler(vls){ if(!vls.id)return this.managementInfo={ id:vls.id, serviceCode: vls.serviceCode, serviceName: vls.serviceName, typeCode: vls.typeCode, description: vls.description, serviceTime: vls.serviceTime, remark: vls.remark } }, deep:true, immediate:true } } }; </script> <style lang="scss" scoped> .brandDialog { width: 500px; .inputContent { padding: 20px; display: flex; flex-direction: column; justify-content: space-between; .inputBox { width: 100%; display: flex; align-items: center; } } .btnBox { padding: 30px; box-sizing: border-box; display: flex; align-items: center; justify-content: space-evenly; .save, .close { width: 100px; } } } </style>