123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <template>
- <el-dialog :title="title" :visible.sync="dialogVisible" width="45%" @close="handleClose" id="messageDialog">
- <el-row>
- <formItems :type="'Floor'" ref="formItems"></formItems>
- </el-row>
- <span slot="footer" class="dialog-footer">
- <el-button size="small" @click="dialogVisible=false">取消</el-button>
- <el-button size="small" type="primary" @click="confirm">确认</el-button>
- </span>
- </el-dialog>
- </template>
- <script>
- import {manageCreateFloor, manageUpdateFloor} from "@/api/scan/request";
- import formItems from "@/components/ready/buildfloor/formItems";
- import tools from "@/utils/buildfloor/tools";
- export default {
- props: {
- title: {
- default: '提示'
- },
- type: {
- default: 'Floor'
- },
- curBuildId: {
- default: ''
- },
- curFloorId: {
- default: ''
- }
- },
- components: {
- formItems
- },
- data() {
- return {
- dialogVisible: false, //弹窗显示与隐藏
- floorData: {}
- };
- },
- methods: {
- showDialog(data) {
- this.floorData = data || {};
- this.floorData = tools.desFormatData(this.floorData)
- this.timeoutSetVal()
- this.dialogVisible = true;
- },
- timeoutSetVal() {
- setTimeout(() => {
- if (this.$refs.formItems) {
- this.$refs.formItems.form = this.floorData
- } else {
- this.timeoutSetVal()
- }
- }, 500)
- },
- handleClose() { },
- //创建
- confirm() {
- this.$refs.formItems.submitForm(this.save)
- },
- save() {
- let form = this.$refs.formItems.form
- let newform = tools.formatData(form)
- newform.BuildID = this.curBuildId
- let Param = {
- Content: [newform]
- }
- if (newform.FloorID) {
- manageUpdateFloor(Param, res => {
- this.$message.success('更新成功')
- this.$emit('refresh')
- this.dialogVisible = false;
- })
- } else {
- manageCreateFloor(Param, res => {
- this.$message.success('创建成功')
- this.$emit('refresh')
- this.dialogVisible = false;
- })
- }
- }
- },
- mounted() { },
- created() { }
- };
- </script>
- <style lang="scss" scoped>
- #messageDialog {
- /deep/ .el-dialog__body {
- height: 420px;
- overflow: auto;
- }
- .el-form-item {
- /deep/ label.el-form-item__label {
- font-size: 12px;
- }
- }
- /deep/ .FloorTypeSelect .el-form-item__content {
- width: 200px;
- }
- }
- </style>
|