<!--服务管理新增弹窗--> <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 v-model="managementInfo.serviceCode" title="服务编号" placeholder="请输入服务编号" width="300px" class="inputWidth" style="justify-content: space-between" /> </div> <div class="inputBox"> <red-star /> <input-vue v-model="managementInfo.serviceName" title="服务名称" placeholder="请输入服务名称" width="300px" class="inputWidth" style="justify-content: space-between" /> </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-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 v-model="managementInfo.description" title="服务描述" width="300px" class="inputWidth" style="justify-content: space-between" placeholder="请输入服务描述" /> </div> <div class="inputBox"> <red-star /> <input-vue title="服务时间" class="inputWidth" style="justify-content: space-between" > <el-date-picker v-model="managementInfo.serviceTime" style="width: 300px" type="date" placeholder="选择日期" format="yyyy - MM - dd " value-format="yyyy-MM-dd" /> </input-vue> </div> <div class="inputBox"> <input-vue title="备注" class="inputWidth" style="justify-content: space-between" > <el-input v-model="managementInfo.remark" type="textarea" style="width: 300px" :rows="2" placeholder="请输入内容" /> </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: '' }, data() { return { serverType: [], managementInfo: { serviceCode: '', serviceName: '', typeCode: '', description: '', serviceTime: '', remark: '' } } }, 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 } }, mounted() { TM_list().then((res) => { console.log(res) this.serverType = res }) }, 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() } }) } } } } </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>