room
							parent
							
								
									d86054b091
								
							
						
					
					
						commit
						92fe94f3d1
					
				| 
						 | 
				
			
			@ -15,10 +15,10 @@
 | 
			
		|||
            </div>
 | 
			
		||||
            <div class="room-list">
 | 
			
		||||
                <div v-for="(item, index) in project.content" :key="index" class="room-span" @click="select_room(item)"
 | 
			
		||||
                    :class="{ 'selectDiv': item.room_name === currentRoom.room_name }">
 | 
			
		||||
                    :class="{ 'selectDiv': item.room_name === current_room_info.room_name }">
 | 
			
		||||
                    <span>{{ item.room_name }}</span>
 | 
			
		||||
                    <span>{{ item.room_count }}</span>
 | 
			
		||||
                    <el-button :icon="Delete" circle @click="delet_room(item)"/>
 | 
			
		||||
                    <el-button :icon="Delete" circle @click="delet_room(item)" />
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
        </el-card>
 | 
			
		||||
| 
						 | 
				
			
			@ -28,11 +28,11 @@
 | 
			
		|||
                <div class="flex-center bar">
 | 
			
		||||
                    <div class="div300">
 | 
			
		||||
                        <span>房型名称:</span>
 | 
			
		||||
                        <el-input v-model="currentRoom.room_name" placeholder="请输入房型名称" />
 | 
			
		||||
                        <el-input v-model="current_room_info.room_name" placeholder="请输入房型名称" />
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="div300">
 | 
			
		||||
                        <span>房型数量:</span>
 | 
			
		||||
                        <el-input-number v-model="currentRoom.room_count" :min="1" :max="10"
 | 
			
		||||
                        <el-input-number v-model="current_room_info.room_count" :min="1" :max="1000"
 | 
			
		||||
                            label="描述文字"></el-input-number>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
| 
						 | 
				
			
			@ -40,34 +40,58 @@
 | 
			
		|||
            <div class="div-2">
 | 
			
		||||
                <span class="name name2">灯光信息</span>
 | 
			
		||||
                <div class="flex-center bar">
 | 
			
		||||
                    <div v-for="(item, i) in lightArr" :key="item.label">
 | 
			
		||||
                        <p>{{ item.label }}</p>
 | 
			
		||||
                        <p>
 | 
			
		||||
                            <el-input-number v-model="currentRoom['lightNum'+ item.value]" :min="1" :max="100"></el-input-number>
 | 
			
		||||
                        </p>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <p>开关回路</p>
 | 
			
		||||
                    <p>
 | 
			
		||||
                        <el-input-number v-model="current_room_info.light_info.switching_circuit" :min="1"
 | 
			
		||||
                            :max="100"></el-input-number>
 | 
			
		||||
                    </p>
 | 
			
		||||
                    <p>0-10V调光</p>
 | 
			
		||||
                    <p>
 | 
			
		||||
                        <el-input-number v-model="current_room_info.light_info.dimming_10v" :min="1"
 | 
			
		||||
                            :max="100"></el-input-number>
 | 
			
		||||
                    </p>
 | 
			
		||||
                    <p>前沿调光</p>
 | 
			
		||||
                    <p>
 | 
			
		||||
                        <el-input-number v-model="current_room_info.light_info.dimming_leading_edge" :min="1"
 | 
			
		||||
                            :max="100"></el-input-number>
 | 
			
		||||
                    </p>
 | 
			
		||||
                    <p>后沿调光</p>
 | 
			
		||||
                    <p>
 | 
			
		||||
                        <el-input-number v-model="current_room_info.light_info.dimming_trailing_edge" :min="1"
 | 
			
		||||
                            :max="100"></el-input-number>
 | 
			
		||||
                    </p>
 | 
			
		||||
                    <p>DALI灯</p>
 | 
			
		||||
                    <p>
 | 
			
		||||
                        <el-input-number v-model="current_room_info.light_info.DALI" :min="1"
 | 
			
		||||
                            :max="100"></el-input-number>
 | 
			
		||||
                    </p>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="div-3">
 | 
			
		||||
                <span class="name name3">空调信息</span>
 | 
			
		||||
                <div class="flex-center bar">
 | 
			
		||||
                    <div>盘管类型</div>
 | 
			
		||||
                    <el-radio-group v-model="currentRoom.type1">
 | 
			
		||||
                        <el-radio :value="item.value" :key="item.value" v-for="(item, index) in radioGroup1">{{ item.label
 | 
			
		||||
                        }}</el-radio>
 | 
			
		||||
                    <el-radio-group v-model="current_room_info.type1">
 | 
			
		||||
                        <el-radio :value="item.value" :key="item.value" v-for="(item, index) in radioGroup1">{{
 | 
			
		||||
                    item.label
 | 
			
		||||
                }}</el-radio>
 | 
			
		||||
                    </el-radio-group>
 | 
			
		||||
                    <el-radio-group v-model="currentRoom.type2">
 | 
			
		||||
                        <el-radio :value="item.value" :key="item.value" v-for="(item, index) in radioGroup2">{{ item.label
 | 
			
		||||
                        }}</el-radio>
 | 
			
		||||
                    <el-radio-group v-model="current_room_info.type2">
 | 
			
		||||
                        <el-radio :value="item.value" :key="item.value" v-for="(item, index) in radioGroup2">{{
 | 
			
		||||
                    item.label
 | 
			
		||||
                }}</el-radio>
 | 
			
		||||
                    </el-radio-group>
 | 
			
		||||
                    <el-radio-group v-model="currentRoom.type3">
 | 
			
		||||
                        <el-radio :value="item.value" :key="item.value" v-for="(item, index) in radioGroup3">{{ item.label
 | 
			
		||||
                        }}</el-radio>
 | 
			
		||||
                    <el-radio-group v-model="current_room_info.type3">
 | 
			
		||||
                        <el-radio :value="item.value" :key="item.value" v-for="(item, index) in radioGroup3">{{
 | 
			
		||||
                    item.label
 | 
			
		||||
                }}</el-radio>
 | 
			
		||||
                    </el-radio-group>
 | 
			
		||||
                    <div>
 | 
			
		||||
                        <p>温控器数量</p>
 | 
			
		||||
                        <p>
 | 
			
		||||
                            <el-input-number v-model="currentRoom.num1" :min="1" :max="100"></el-input-number>
 | 
			
		||||
                            <el-input-number v-model="current_room_info.num1" :min="1" :max="100"></el-input-number>
 | 
			
		||||
                        </p>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
| 
						 | 
				
			
			@ -76,20 +100,21 @@
 | 
			
		|||
                <span class="name name4">面板信息</span>
 | 
			
		||||
                <div class="flex-center bar">
 | 
			
		||||
                    <div>面板类型</div>
 | 
			
		||||
                    <el-radio-group v-model="currentRoom.type4">
 | 
			
		||||
                        <el-radio :value="item.value" :key="item.value" v-for="(item, index) in radioGroup4">{{ item.label
 | 
			
		||||
                        }}</el-radio>
 | 
			
		||||
                    <el-radio-group v-model="current_room_info.type4">
 | 
			
		||||
                        <el-radio :value="item.value" :key="item.value" v-for="(item, index) in radioGroup4">{{
 | 
			
		||||
                    item.label
 | 
			
		||||
                }}</el-radio>
 | 
			
		||||
                    </el-radio-group>
 | 
			
		||||
                    <div>
 | 
			
		||||
                        <p>面板数量</p>
 | 
			
		||||
                        <p>
 | 
			
		||||
                            <el-input-number v-model="currentRoom.mbnum" :min="1" :max="100"></el-input-number>
 | 
			
		||||
                            <el-input-number v-model="current_room_info.mbnum" :min="1" :max="100"></el-input-number>
 | 
			
		||||
                        </p>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div>
 | 
			
		||||
                        <p>按钮数量</p>
 | 
			
		||||
                        <p>
 | 
			
		||||
                            <el-input-number v-model="currentRoom.btnnum" :min="1" :max="100"></el-input-number>
 | 
			
		||||
                            <el-input-number v-model="current_room_info.btnnum" :min="1" :max="100"></el-input-number>
 | 
			
		||||
                        </p>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
| 
						 | 
				
			
			@ -98,20 +123,21 @@
 | 
			
		|||
                <span class="name name5">窗帘信息</span>
 | 
			
		||||
                <div class="flex-center bar">
 | 
			
		||||
                    <div>窗帘类型</div>
 | 
			
		||||
                    <el-radio-group v-model="currentRoom.type5">
 | 
			
		||||
                        <el-radio :value="item.value" :key="item.value" v-for="(item, index) in radioGroup5">{{ item.label
 | 
			
		||||
                        }}</el-radio>
 | 
			
		||||
                    <el-radio-group v-model="current_room_info.type5">
 | 
			
		||||
                        <el-radio :value="item.value" :key="item.value" v-for="(item, index) in radioGroup5">{{
 | 
			
		||||
                    item.label
 | 
			
		||||
                }}</el-radio>
 | 
			
		||||
                    </el-radio-group>
 | 
			
		||||
                    <div>
 | 
			
		||||
                        <p>窗帘数量</p>
 | 
			
		||||
                        <p>
 | 
			
		||||
                            <el-input-number v-model="currentRoom.chlnum" :min="1" :max="100"></el-input-number>
 | 
			
		||||
                            <el-input-number v-model="current_room_info.chlnum" :min="1" :max="100"></el-input-number>
 | 
			
		||||
                        </p>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div>
 | 
			
		||||
                        <p>窗纱数量</p>
 | 
			
		||||
                        <p>
 | 
			
		||||
                            <el-input-number v-model="currentRoom.chshnum" :min="1" :max="100"></el-input-number>
 | 
			
		||||
                            <el-input-number v-model="current_room_info.chshnum" :min="1" :max="100"></el-input-number>
 | 
			
		||||
                        </p>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
| 
						 | 
				
			
			@ -123,12 +149,13 @@
 | 
			
		|||
                        <div v-for="(item, i) in otherArr" :key="item.label">
 | 
			
		||||
                            <p>{{ item.label }}</p>
 | 
			
		||||
                            <p>
 | 
			
		||||
                                <el-input-number v-model="currentRoom['otherNum'+ item.value]" :min="1" :max="100"></el-input-number>
 | 
			
		||||
                                <el-input-number v-model="current_room_info['otherNum' + item.value]" :min="1"
 | 
			
		||||
                                    :max="100"></el-input-number>
 | 
			
		||||
                            </p>
 | 
			
		||||
                        </div>
 | 
			
		||||
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <el-checkbox-group v-model="currentRoom.checkone" class="rules-label">
 | 
			
		||||
                    <el-checkbox-group v-model="current_room_info.checkone" class="rules-label">
 | 
			
		||||
                        <el-checkbox v-for="(item, i) in checkList" :label="item.label" :key="item.value"
 | 
			
		||||
                            :value="item.value">
 | 
			
		||||
                            {{ item.label }}
 | 
			
		||||
| 
						 | 
				
			
			@ -141,7 +168,7 @@
 | 
			
		|||
                <span class="name name7">备注</span>
 | 
			
		||||
                <div class="con-div100">
 | 
			
		||||
                    <div class="flex-center bar">
 | 
			
		||||
                        <el-input type="textarea" v-model="currentRoom.desc"></el-input>
 | 
			
		||||
                        <el-input type="textarea" v-model="current_room_info.desc"></el-input>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
| 
						 | 
				
			
			@ -150,12 +177,15 @@
 | 
			
		|||
</template>
 | 
			
		||||
<script setup>
 | 
			
		||||
import { Delete } from '@element-plus/icons-vue'
 | 
			
		||||
import { onMounted, ref, reactive } from 'vue'
 | 
			
		||||
import { usrRoomStore } from '../store/project'
 | 
			
		||||
import { onMounted, reactive } from 'vue'
 | 
			
		||||
import { Plus } from '@element-plus/icons-vue'
 | 
			
		||||
import myApi from "@/api/myApi.js";
 | 
			
		||||
import { useRoute, useRouter } from 'vue-router'
 | 
			
		||||
import { ElMessage,ElMessageBox } from "element-plus";
 | 
			
		||||
import { ElMessage } from "element-plus";
 | 
			
		||||
 | 
			
		||||
import bcrypt from 'bcryptjs'
 | 
			
		||||
 | 
			
		||||
console.log(bcrypt.hashSync("aaa"))
 | 
			
		||||
const router = useRouter()
 | 
			
		||||
const route = useRoute()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -165,36 +195,41 @@ const project = reactive({
 | 
			
		|||
    content: [],
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
const room_info = reactive({
 | 
			
		||||
const current_room_info = reactive({
 | 
			
		||||
    room_name: '',
 | 
			
		||||
    room_count: 1,
 | 
			
		||||
    lightNum0: 1, // 开关回路
 | 
			
		||||
    lightNum1: 1,//0-10V调光
 | 
			
		||||
    lightNum2: 1,//前沿调光
 | 
			
		||||
    lightNum3: 1,//后沿调光
 | 
			
		||||
    lightNum4:1, //DALI灯
 | 
			
		||||
    type1: 0,// 盘管类型
 | 
			
		||||
    type2: 0,
 | 
			
		||||
    type3: 0,
 | 
			
		||||
    num1: 1, // 温室器数量
 | 
			
		||||
    type4: 0,// 面板类型
 | 
			
		||||
    type5: 0,// 窗帘类型
 | 
			
		||||
    mbnum: 0,// 面板数量
 | 
			
		||||
    btnnum: 0,// 按钮数量
 | 
			
		||||
    chlnum: 0,// 窗帘数量
 | 
			
		||||
    chshnum: 0,// 窗纱数量
 | 
			
		||||
    checkone: [0,1],// 其他信息
 | 
			
		||||
    desc: '', // 备注,
 | 
			
		||||
    otherNum0: 1,
 | 
			
		||||
    otherNum1: 1,
 | 
			
		||||
    otherNum2: 1,
 | 
			
		||||
    otherNum3: 1,
 | 
			
		||||
    otherNum4: 1
 | 
			
		||||
 | 
			
		||||
    light_info: {
 | 
			
		||||
        switching_circuit: 0,
 | 
			
		||||
        dimming_10v: 0,
 | 
			
		||||
        dimming_leading_edge: 0,
 | 
			
		||||
        dimming_trailing_edge: 0,
 | 
			
		||||
        DALI: 0,
 | 
			
		||||
    },
 | 
			
		||||
    fcu_info: {
 | 
			
		||||
        fcu_type: 0,
 | 
			
		||||
        pipe_type: 0,
 | 
			
		||||
        valve_type: 0,
 | 
			
		||||
        fcu_count: 0,
 | 
			
		||||
        thermostat_count: 0,
 | 
			
		||||
    },
 | 
			
		||||
    panel_info: {
 | 
			
		||||
        panel_type: 0,
 | 
			
		||||
        panel_count: 0,
 | 
			
		||||
        panel_button_count: 0,
 | 
			
		||||
    },
 | 
			
		||||
    curtain_info: {
 | 
			
		||||
        curtain_type: 0,
 | 
			
		||||
        curtain_count: 0,
 | 
			
		||||
        sheer_curtain_count: 0,
 | 
			
		||||
    },
 | 
			
		||||
    other: {
 | 
			
		||||
        DND: false,
 | 
			
		||||
        MUR: false,
 | 
			
		||||
        SOS: false,
 | 
			
		||||
    },
 | 
			
		||||
    desc: ''
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
var currentRoom = ref({});
 | 
			
		||||
const get_project = async () => {
 | 
			
		||||
    const param = {
 | 
			
		||||
        action: 100,
 | 
			
		||||
| 
						 | 
				
			
			@ -220,7 +255,7 @@ const get_project = async () => {
 | 
			
		|||
    }
 | 
			
		||||
}
 | 
			
		||||
const delet_room = (item) => {
 | 
			
		||||
    if(project.content.length === 1) {
 | 
			
		||||
    if (project.content.length === 1) {
 | 
			
		||||
        ElMessage.warning('至少保留一个。。')
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -234,16 +269,17 @@ onMounted(() => {
 | 
			
		|||
});
 | 
			
		||||
 | 
			
		||||
const select_room = (item) => {
 | 
			
		||||
    currentRoom.value = item;
 | 
			
		||||
    for (const key in item) {
 | 
			
		||||
        current_room_info[key] = item[key];
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
const add_room = () => {
 | 
			
		||||
    if (!Array.isArray(project.content)) {
 | 
			
		||||
        project.content = []
 | 
			
		||||
    }
 | 
			
		||||
    let target=JSON.parse(JSON.stringify(room_info));
 | 
			
		||||
    target.room_name = "房型" + (project.content.length + 1);
 | 
			
		||||
    let target = JSON.parse(JSON.stringify(current_room_info));
 | 
			
		||||
    target.room_name = "房型" + generateShortUUID();
 | 
			
		||||
    project.content.push(target);
 | 
			
		||||
    console.log(1, project.content);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const save_room = async () => {
 | 
			
		||||
| 
						 | 
				
			
			@ -267,6 +303,18 @@ const save_room = async () => {
 | 
			
		|||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function generateShortUUID() {
 | 
			
		||||
  let uuid = '';
 | 
			
		||||
  const possible = '0123456789ABCDEF';
 | 
			
		||||
 | 
			
		||||
  for (let i = 0; i < 8; i++) {
 | 
			
		||||
    uuid += possible.charAt(Math.floor(Math.random() * possible.length));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return uuid;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
const goHome = () => {
 | 
			
		||||
    save_room();
 | 
			
		||||
    router.push('home');
 | 
			
		||||
| 
						 | 
				
			
			@ -393,13 +441,15 @@ const checkList = reactive([{
 | 
			
		|||
                    width: 30%;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            .title {
 | 
			
		||||
                line-height: 48px;
 | 
			
		||||
                font-size: 24px;
 | 
			
		||||
                font-weight: 500;
 | 
			
		||||
            }
 | 
			
		||||
            .el-divider{ 
 | 
			
		||||
                background-color:#409eff;
 | 
			
		||||
 | 
			
		||||
            .el-divider {
 | 
			
		||||
                background-color: #409eff;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -540,4 +590,5 @@ const checkList = reactive([{
 | 
			
		|||
        color: #fff;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}</style>
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
		Loading…
	
		Reference in New Issue