main
cc 2024-03-25 15:05:30 +00:00
parent d86054b091
commit 92fe94f3d1
1 changed files with 121 additions and 70 deletions

View File

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