123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953 |
- <template>
- <div class="work-content">
- <div class="work-space">
- <div class="space-title">{{ spaceInfo.spaceName }} 申请延时</div>
-
- </div>
-
- <div class="add-time" id="addTimeId">
- <div class="date_box" v-if="dateArr && dateArr.length">
- <div
- class="date-item"
- :class="item.isActive ? 'date-item-active' : ''"
- @click.stop="checkDate(item, index)"
- :key="'date' + index"
- v-for="(item, index) in dateArr"
- >
- <span>{{ item.week }}</span>
- <span>{{ item.day }}</span>
- </div>
- </div>
- <div class="sliders-list" id="sliderListId">
- <template v-for="(item, index) in nowTimerArr" :key="'slider' + index">
- <div class="sliders-wrapper" id="slidersWrapperId">
- <div class="sliders">
- <div class="label" v-show="index === 0 || index % 2 === 0">
- {{ item.timer }}
- </div>
- <div
- class="slider-box"
- @click="checkSlider(item, index)"
- :data-index="index"
- ></div>
- </div>
- </div>
- </template>
-
- <template v-if="approvalData && approvalData.length">
- <div
- class="approval-status"
- style="width: 60px"
- :key="'approval' + index"
- @click="checkApprovalStatus(item, $event)"
- :style="{
- left: item.left + 'px',
- background: item.bg,
- }"
- v-for="(item, index) in approvalData"
- >
- {{ item.text }}
- </div>
- </template>
- <div class="slider-btn" id="sliderBtnId" @click="triggerDelTime">
- <div class="start" id="startId"></div>
- <div class="end-box" id="endBoxId">
- <div class="end" id="endId"></div>
- <div class="end-radio" id="endRadioId"></div>
- </div>
- </div>
- </div>
- </div>
- <div class="add-time-btn">
- <div class="cancel-btn" @click="closeWorkTimer">取消</div>
- <div
- class="comfirm-btn"
- :class="formBtn ? 'comfirm-btn-diabled' : ''"
- @click="addWorkTimer"
- >
- 提交申请
- </div>
- </div>
-
- <div class="device-title" v-if="isLight || isAir">
- <span class="line"></span>
- <span class="text">预约开启设备</span>
- <span class="line"></span>
- </div>
- <div class="work-device">
- <template v-if="isAir">
- <div class="row-title">空调</div>
- <div class="device-box">
- <template
- v-for="(item, index) in nowData.equipmentList"
- :key="'eq' + index"
- >
- <div
- class="device-row"
- :style="{ width: airNum == 1 ? '98%' : '48%' }"
- v-if="item.equipmentCategory !== 'SELTLT'"
- @click="checkEquipment(item)"
- >
- <div class="row-item">
- <span>{{ item.localName }}</span>
- <img
- :src="
- item.isCheck
- ? parseImgUrl('ipdImages', 'check-open.svg')
- : parseImgUrl('ipdImages', 'check-close.svg')
- "
- alt=""
- />
- </div>
- </div>
- </template>
- </div>
- </template>
- <template v-if="isLight">
- <div class="row-title">照明</div>
- <div class="device-box">
- <template
- v-for="(item, index) in nowData.equipmentList"
- :key="'eq' + index"
- >
- <div
- class="device-row"
- :style="{ width: lightNum == 1 ? '98%' : '48%' }"
- v-if="item.equipmentCategory === 'SELTLT'"
- @click="checkEquipment(item)"
- >
- <div class="row-item">
- <span>{{ item.localName }}</span>
- <img
- :src="
- item.isCheck
- ? parseImgUrl('ipdImages', 'check-open.svg')
- : parseImgUrl('ipdImages', 'check-close.svg')
- "
- alt=""
- />
- </div>
- </div>
- </template>
- </div>
- </template>
- <div class="device-tip" v-if="isAir">
- <span>计费方式:</span>
- <p>
- <span> * </span>
- 空调延时采用后付费方式,系统将根据您申请的时间产生延时费用。预约时间下您可自由开启空间下的设备。
- </p>
- <p>
- 收费标准按开机设备对应空间的面积计费,空调加时费用按0.4元/m²·h进行计费,照明设备延时使用不计费。
- </p>
- <p>
- 如您提前结束工作,请点击“我要离开”按钮,系统会自动调整设备关闭时间,感谢与您一同共创可持续的办公环境。
- </p>
- </div>
- </div>
- <van-loading class="temp-loading" v-if="showLoading" />
- </div>
- </template>
- <script lang="ts">
- import { Dialog, Slider, Loading } from "vant";
- import {
- defineComponent,
- reactive,
- toRefs,
- ref,
- onBeforeMount,
- onMounted,
- onUpdated,
- nextTick,
- watch,
- getCurrentInstance,
- } from "vue";
- import { swiper } from "@/utils/swiper";
- import {
- formatDate,
- formatDateStr,
- getDate,
- getNowTime,
- getRelNowTime,
- getTimers,
- getUserInfo,
- getWeekDate,
- parseImgUrl,
- } from "@/utils";
- import { myTime } from "@/model/workTimeData";
- import { propsToAttrMap } from "@vue/shared";
- import { isTemplateElement } from "@babel/types";
- import {
- saveBatchCustomScene,
- setallLampHttp,
- setSpaceCondtioners,
- } from "@/apis/envmonitor";
- import { number } from "echarts";
- export default defineComponent({
- components: {
- VanSlider: Slider,
- },
- props: {
- workkArr: {
- type: Array,
- default: () => [],
- },
- projectId: {
- type: String,
- default: () => "",
- },
- spaceInfo: {
- type: Object,
- default: () => {},
- },
- enterType: {
- type: Number,
- default: () => 1,
- },
- deviceItem: {
- type: Object,
- default: () => null,
- },
- seviceEquipmentList: {
-
- type: Array,
- default: () => [],
- },
- },
- setup(props, context) {
- const proxyGlobal: any = getCurrentInstance();
- const screenInfo: any = {
- screenWidth: 0,
- screenHeight: 0,
- };
- let dateArr: any = [];
- let myTimeArr: any = [];
- let timerArr: any = getTimers();
- let nowTimerArr: any = [];
- let nowData: any = {};
- let approvalData: any = [];
- let redUrl: any = `${parseImgUrl("ipdImages", "time-check.svg")}`;
- let bgRed: any = `linear-gradient(0deg, rgba(255, 0, 0, 0.2), rgba(255, 0, 0, 0.2)), url(${redUrl})`;
- const userInfo: any = getUserInfo();
- const proxyData = reactive({
- userInfo: userInfo,
- seviceEquipmentList: props.seviceEquipmentList,
- parseImgUrl: parseImgUrl,
- isEvent: false,
- screenInfo: screenInfo,
- projectId: props.projectId,
- workkArr: props.workkArr,
- bgRed: bgRed,
- startIndex: 0,
- endIndex: 0,
- nowData: nowData,
- nowTimerArr: nowTimerArr,
- timerArr: timerArr,
- startLen: 0,
- formBtn: false,
- showLoading: false,
- deviceItem: props.deviceItem,
- enterType: props.enterType,
- setScreennWidth() {
- let addTimeEl: any = document.querySelector("#addTimeId");
- proxyData.screenInfo.screenWidth = addTimeEl.offsetWidth;
- },
-
- getNowIndex() {
-
-
-
-
- let nowIndex: any = getNowTime()[1];
- return nowIndex;
- },
-
- getTomorrowIndex() {
- let nowIndex: any = 0;
- if (proxyData.nowData.week === "今天") {
- nowIndex = getNowTime()[1];
- }
- return nowIndex;
- },
-
- getTimerIndex(timerArr: any, val: any) {
- let cusIndex: any = 0;
- timerArr.map((time: any, index: any) => {
- if (time.formatTimer == val) {
- cusIndex = index;
- }
- });
- return cusIndex;
- },
-
- getNowPerstion(timerArr: any) {
- let nowIndex: any = proxyData.getNowIndex();
- let obj: any = {
- nowIndex: nowIndex,
- len: 4,
- };
- let formatTimer: any = timerArr[nowIndex].formatTimer;
- let cusStartTime: any = proxyData.parseCusStartTime(
- proxyData.nowData.cusStartTime
- );
- let cusEndTime: any = proxyData.parseCusEndTime(
- proxyData.nowData.cusEndTime
- );
- let spaceCustomContentList: any =
- proxyData.nowData.spaceCustomContentList || [];
-
- if (formatTimer >= cusStartTime && formatTimer <= cusEndTime) {
-
-
- timerArr.map((item: any, index: any) => {
- if (item.formatTimer === cusEndTime) {
- obj.nowIndex = index;
- }
- });
- let endFormatTimer: any = timerArr[nowIndex + obj.len].formatTimer;
- spaceCustomContentList.map((item: any) => {
- let startTime: any = proxyData.parseCusStartTime(item.startTime);
- if (startTime > cusEndTime && endFormatTimer > startTime) {
- let cusIndex: any = proxyData.getTimerIndex(timerArr, startTime);
- obj.len =
- cusIndex - obj.nowIndex > 0 ? cusIndex - obj.nowIndex : 0;
- }
- });
- } else if (formatTimer < cusStartTime) {
- console.log("在当前的服务定制之前---4");
- timerArr.map((item: any, index: any) => {
- if (item.formatTimer === cusStartTime) {
- obj.len = index - nowIndex;
- if (obj.len > 4) {
- obj.len = 4;
- }
- }
- });
- } else if (formatTimer >= cusEndTime) {
-
-
- console.log("在当前的服务定制之后---4");
- let endFormatTimer: any = timerArr[nowIndex + obj.len].formatTimer;
- spaceCustomContentList.map((item: any) => {
- let startTime: any = proxyData.parseCusStartTime(item.startTime);
- if (startTime > cusEndTime && endFormatTimer > startTime) {
- let cusIndex: any = proxyData.getTimerIndex(timerArr, startTime);
- obj.len =
- cusIndex - obj.nowIndex > 0 ? cusIndex - obj.nowIndex : 0;
- }
- });
- }
- return obj;
- },
-
- setNowBarPerstion(timerArr: any) {
- let sliderList: any = document.querySelector("#sliderListId");
- let sliderWidth: any = proxyData.getSliderWapperWidth();
- sliderList.style.width = sliderWidth * timerArr.length + "px";
- let index: any = proxyData.getNowPerstion(timerArr).nowIndex;
- let len: any = proxyData.getNowPerstion(timerArr).len;
- let sliderLeft: any = sliderWidth * index;
- if (
- sliderLeft >
- proxyData.screenInfo.screenWidth +
- proxyData.screenInfo.screenWidth / 2
- ) {
- sliderLeft = sliderLeft - sliderWidth;
- }
- sliderList.style.left = -sliderLeft + "px";
- proxyData.setOptionnalPerstion(index, len);
- },
- sliderSwiper() {
-
- let sliderList: any = document.querySelector("#sliderListId");
- let slidersWrapper: any = document.querySelector("#slidersWrapperId");
- let leftInit: any = 0;
- let width: any =
- sliderList.offsetWidth - proxyData.screenInfo.screenWidth;
- sliderList.addEventListener("touchstart", function (e: any) {
- leftInit = isNaN(parseInt(sliderList.style.left))
- ? 0
- : parseInt(sliderList.style.left);
- leftInit = Math.abs(leftInit);
- });
- swiper(sliderList, {
- swipeLeft: function (e: any) {
- if (!proxyData.checkMoveTarget(e)) {
- let left: any = isNaN(parseInt(sliderList.style.left))
- ? 0
- : parseInt(sliderList.style.left);
- left = Math.abs(left);
- if (left >= width) {
- sliderList.style.left = -width + "px";
- } else {
- sliderList.style.left =
- -leftInit - Math.abs(e.mation.moveX - e.mation.startX) + "px";
- }
- }
- },
- swipeRight: function (e: any) {
- if (!proxyData.checkMoveTarget(e)) {
- let left: any = isNaN(parseInt(sliderList.style.left))
- ? 0
- : parseInt(sliderList.style.left);
- if (left >= 0) {
- sliderList.style.left = 0 + "px";
- } else {
- sliderList.style.left =
- -leftInit + Math.abs(e.mation.moveX - e.mation.startX) + "px";
- }
- }
- },
- });
- },
-
- checkMoveTarget(el: any) {
- let endBox: any = document.querySelector("#endBoxId");
- let endEnd: any = document.querySelector("#endId");
- let endRadio: any = document.querySelector("#endRadioId");
- if (
- el.target === endBox ||
- el.target === endEnd ||
- el.target === endRadio
- ) {
- return true;
- }
- return false;
- },
-
- checkPersionService() {
- let flag: any = false;
- for (let i = proxyData.startIndex; i < proxyData.endIndex; i++) {
- if (proxyData.nowTimerArr[i].isServiceTime) {
- flag = true;
- break;
- }
- }
- proxyData.formBtn = flag;
- },
- cancelRemoveListener() {
- let endBox: any = document.querySelector("#endBoxId");
- endBox.removeEventListener("touchstart", function (e: any) {}, false);
- endBox.removeEventListener("touchend", function (e: any) {}, false);
- endBox.removeEventListener("touchmove", function (e: any) {}, false);
- let sliderList: any = document.querySelector("#sliderListId");
- sliderList.removeEventListener(
- "touchstart",
- function (e: any) {},
- false
- );
- sliderList.removeEventListener("touchend", function (e: any) {}, false);
- sliderList.removeEventListener(
- "touchmove",
- function (e: any) {},
- false
- );
- },
-
- endBoxSwiper() {
- let sliderList: any = document.querySelector("#sliderListId");
- let endBox: any = document.querySelector("#endBoxId");
- let sliderBtnEl: any = document.querySelector("#sliderBtnId");
- let startEl: any = document.querySelector("#startId");
- let sliderBoxEl: any = document.querySelectorAll(".slider-box")[0];
- let sliderInitLeft: any = 0;
- let sliderBtnLeft: any = 0;
- let screenLeft: any = 0;
- let startElLeft: any = 0;
- let sliderBtnWidth: any = 0;
- let sliderBoxWidth: any = 0;
- let direction: any = 0;
- let isMove: any = false;
- endBox.addEventListener("touchstart", function (e: any) {
- isMove = false;
- startElLeft = isNaN(parseInt(startEl.style.left))
- ? 0
- : parseInt(startEl.style.left);
-
-
-
- sliderBtnLeft = isNaN(parseInt(sliderBtnEl.style.left))
- ? 0
- : parseInt(sliderBtnEl.style.left);
-
- sliderBtnWidth = sliderBtnEl.offsetWidth;
- sliderBoxWidth = sliderBoxEl.offsetWidth;
- });
- endBox.addEventListener("touchend", function (e: any) {
-
- if (isMove) {
- sliderBtnWidth = sliderBtnEl.offsetWidth;
- let index: any = Math.ceil(
- sliderBtnWidth / sliderBoxEl.offsetWidth
- );
- if (proxyData.startIndex + index >= proxyData.timerArr.length - 1) {
- index = proxyData.timerArr.length - 1 - proxyData.startIndex;
- }
- sliderBtnEl.style.width = sliderBoxEl.offsetWidth * index + "px";
- sliderBtnEl.style.background = `rgba(0,0,0,0.2)`;
-
- proxyData.setOptionnalPerstion(proxyData.startIndex, index);
- isMove = false;
-
- proxyData.checkPersionService();
- }
- });
- swiper(endBox, {
- swipeLeft: function (e: any) {
- if (proxyData.checkMoveTarget(e)) {
- direction = 0;
- isMove = true;
- let moveRealX: any = Math.abs(e.mation.moveX - e.mation.startX);
- let sliderLeft: any = isNaN(parseInt(sliderList.style.left))
- ? 0
- : parseInt(sliderList.style.left);
- sliderLeft = Math.abs(sliderLeft);
- let width: any = sliderBoxEl.offsetWidth;
- if (sliderBtnWidth - moveRealX <= width) {
- sliderBtnEl.style.width = width + "px";
- } else {
- sliderBtnEl.style.width = sliderBtnWidth - moveRealX + "px";
- proxyData.cancelSliderBoxColor();
- }
- let bg: any = parseImgUrl("ipdImages", "time-wait.svg");
- sliderBtnEl.style.background = `linear-gradient(0deg, rgba(0, 255, 163, 0.2), rgba(0, 255, 163, 0.2))`;
- if (
- sliderBtnLeft + (sliderBtnWidth - moveRealX) - sliderBoxWidth <
- sliderLeft
- ) {
- let left: any =
- -sliderLeft +
- (sliderLeft +
- sliderBoxWidth -
- (sliderBtnLeft + sliderBtnWidth - moveRealX));
- if (left > 0) {
- sliderList.style.left = 0 + "px";
- } else {
- sliderList.style.left = left + "px";
- }
- }
- }
- },
- swipeRight: function (e: any) {
- if (proxyData.checkMoveTarget(e)) {
- isMove = true;
- direction = 1;
- let moveRealX: any = Math.abs(e.mation.moveX - e.mation.startX);
- sliderBtnEl.style.background = `linear-gradient(0deg, rgba(0, 255, 163, 0.2), rgba(0, 255, 163, 0.2))`;
- let sliderLeft: any = isNaN(parseInt(sliderList.style.left))
- ? 0
- : parseInt(sliderList.style.left);
- sliderLeft = Math.abs(sliderLeft);
- let width: any =
- sliderList.offsetWidth - proxyData.screenInfo.screenWidth;
- screenLeft = sliderLeft + proxyData.screenInfo.screenWidth;
- if (
- sliderBtnLeft +
- sliderBtnWidth +
- moveRealX +
- sliderBoxEl.offsetWidth * 2 >=
- screenLeft
- ) {
- let left: any =
- -sliderLeft -
- (sliderBtnLeft +
- sliderBtnWidth +
- moveRealX +
- sliderBoxEl.offsetWidth * 2 -
- screenLeft);
- sliderList.style.left = left + "px";
- if (sliderLeft >= width) {
- sliderList.style.left = -width + "px";
- }
- }
- if (
- sliderBtnLeft +
- sliderBtnWidth +
- moveRealX +
- sliderBoxEl.offsetWidth >=
- sliderList.offsetWidth
- ) {
- sliderBtnEl.style.width =
- sliderList.offsetWidth -
- sliderBtnLeft -
- sliderBoxEl.offsetWidth +
- "px";
- } else {
- sliderBtnEl.style.width = sliderBtnWidth + moveRealX + "px";
- }
- }
- },
- });
- },
- cancelSliderBoxColor() {
- let sliderBoxArr: any = document.querySelectorAll(".slider-box");
- for (let i = 0; i < sliderBoxArr.length; i++) {
- if (!proxyData.nowTimerArr[i].isCheck) {
- if (
- i >= proxyData.startIndex &&
- i < proxyData.startIndex + proxyData.startLen
- ) {
- sliderBoxArr[i].style.background =
- "linear-gradient(0deg, rgba(0, 255, 163, 0.2), rgba(0, 255, 163, 0.2))";
- }
- }
- }
- },
-
- setOptionnalPerstion(index: any, len: any = 1) {
-
- let sliderList: any = document.querySelector("#sliderListId");
- proxyData.startIndex = index;
- proxyData.startLen = len;
- proxyData.endIndex = proxyData.startIndex + len;
- let slidersWrapper: any = document.querySelector("#slidersWrapperId");
- let slidersWrapperWidth: any =
- slidersWrapper.getBoundingClientRect().width;
- let sliderBtnEl: any = document.querySelector("#sliderBtnId");
- let endEnd: any = document.querySelector("#endBoxId");
- let sliderBoxArr: any = document.querySelectorAll(".slider-box");
- let parseIndex = proxyData.getTomorrowIndex();
- for (let i = 0; i < sliderBoxArr.length; i++) {
- if (i >= parseIndex) {
- sliderBoxArr[i].style.background = "transparent";
- }
- }
- let bg: any = parseImgUrl("ipdImages", "time-wait.svg");
- for (let i = 0; i < len; i++) {
- sliderBoxArr[
- index + i
- ].style.background = `linear-gradient(0deg, rgba(0, 255, 163, 0.2), rgba(0, 255, 163, 0.2)), url(${bg})`;
- }
- sliderBtnEl.style.width = slidersWrapperWidth * len + "px";
- sliderBtnEl.style.background = `rgba(0,0,0,0.2)`;
- let left: any = slidersWrapperWidth * index;
- sliderBtnEl.style.left = left + "px";
-
- proxyData.setCheckTimeStyle();
-
- proxyData.setServiceTimerStyle();
-
- proxyData.setPastTime();
- },
-
- setPastTime() {
-
- if (proxyData.nowData.week === "今天") {
- let index: any = proxyData.getNowIndex();
- let sliderBoxArr: any = document.querySelectorAll(".slider-box");
- for (let i = 0; i < sliderBoxArr.length; i++) {
- if (i < index) {
- sliderBoxArr[i].style.background = `rgba(196, 196, 196, 0.2)`;
- }
- }
- }
- },
-
- setCheckTimeStyle() {
- let timerArr: any = proxyData.nowTimerArr;
- let sliderBoxArr: any = document.querySelectorAll(".slider-box");
- for (let i = 0; i < timerArr.length; i++) {
- if (timerArr[i].isCheck) {
- sliderBoxArr[i].style.background = proxyData.bgRed;
- }
- }
- },
-
- setServiceTimerStyle() {
- let timerArr: any = proxyData.nowTimerArr;
-
- let sliderBoxArr: any = document.querySelectorAll(".slider-box");
- for (let i = 0; i < timerArr.length; i++) {
- if (timerArr[i].isServiceTime) {
- sliderBoxArr[i].style.background = `rgba(196, 196, 196, 0.2)`;
- }
- }
- },
-
- parseCusStartTime(time: any) {
- let newTime: any = time;
- if (time) {
- let minute: any = (time / 100) % 100;
- if (minute) {
- let temTimeInt: any = time / 10000;
- temTimeInt = parseInt(temTimeInt);
- if (minute < 30) {
- if (temTimeInt < 10) {
- newTime = "0" + temTimeInt + "30" + "00";
- } else {
- newTime = temTimeInt + "30" + "00";
- }
- } else if (minute > 30) {
- temTimeInt = temTimeInt + 1;
- if (temTimeInt < 10) {
- newTime = "0" + temTimeInt + "00" + "00";
- } else {
- newTime = temTimeInt + "00" + "00";
- }
- }
- }
- }
- return newTime;
- },
-
- parseCusEndTime(time: any) {
- let newTime: any = time;
- if (time) {
- let minute: any = (time / 100) % 100;
- if (minute) {
- let temTimeInt: any = time / 10000;
- temTimeInt = parseInt(temTimeInt);
- if (minute < 30) {
- if (temTimeInt < 10) {
- newTime = "0" + temTimeInt + "00" + "00";
- } else {
- newTime = temTimeInt + "00" + "00";
- }
- } else if (minute > 30) {
- if (temTimeInt < 10) {
- newTime = "0" + temTimeInt + "30" + "00";
- } else {
- newTime = temTimeInt + "30" + "00";
- }
- }
- }
- }
- return newTime;
- },
-
- checkSlider(item: any, index: any) {
- if (index === proxyData.nowTimerArr.length - 1) {
- return;
- }
-
- proxyData.formBtn = false;
- let nowIndex: any = proxyData.getNowIndex();
- if (proxyData.nowData.week === "今天" && index < nowIndex) {
- return;
- }
- let spaceCustomContentList: any =
- proxyData.nowData.spaceCustomContentList || [];
- let formatTimer: any = proxyData.nowTimerArr[index].formatTimer;
- let flag: any = false;
- spaceCustomContentList.map((spaceCustom: any) => {
- let startTime: any = proxyData.parseCusStartTime(
- spaceCustom.startTime
- );
- let endTime: any = proxyData.parseCusEndTime(spaceCustom.endTime);
- if (formatTimer >= startTime && formatTimer < endTime) {
- flag = true;
- }
- });
- if (flag) {
- return;
- }
- proxyData.setOptionnalPerstion(index);
- },
-
- dateArr: dateArr,
- myTimeArr: myTimeArr,
- isAir: false,
- isLight: false,
- lightNum: 0,
- airNum: 0,
-
- formateEquipment() {
-
- proxyData.isLight = false;
- proxyData.isAir = false;
- proxyData.lightNum = 0;
- proxyData.airNum = 0;
- if (
- proxyData.nowData &&
- proxyData.nowData.equipmentList &&
- proxyData.nowData.equipmentList.length
- ) {
- if (proxyData.enterType === 1) {
-
- proxyData.nowData.equipmentList.map((item: any) => {
- item.isCheck = true;
- });
- } else if (proxyData.enterType === 2) {
-
- if (proxyData.deviceItem && proxyData.deviceItem.id) {
- proxyData.nowData.equipmentList.map((item: any) => {
- if (
- item.equipmentCategory !== "SELTLT" &&
- proxyData.deviceItem.id == item.id
- ) {
- item.isCheck = true;
- } else {
- item.isCheck = false;
- }
- });
- } else {
- proxyData.nowData.equipmentList.map((item: any) => {
- if (item.equipmentCategory !== "SELTLT") {
- item.isCheck = true;
- } else {
- item.isCheck = false;
- }
- });
- }
- } else {
-
- if (proxyData.deviceItem && proxyData.deviceItem.id) {
- proxyData.nowData.equipmentList.map((item: any) => {
- if (
- item.equipmentCategory === "SELTLT" &&
- proxyData.deviceItem.id == item.id
- ) {
- item.isCheck = true;
- } else {
- item.isCheck = false;
- }
- });
- } else {
- proxyData.nowData.equipmentList.map((item: any) => {
- if (item.equipmentCategory === "SELTLT") {
- item.isCheck = true;
- } else {
- item.isCheck = false;
- }
- });
- }
- }
-
- proxyData.nowData.equipmentList.map((item: any) => {
- if (item.equipmentCategory == "SELTLT") {
- proxyData.isLight = true;
- proxyData.lightNum++;
- }
- if (item.equipmentCategory !== "SELTLT") {
- proxyData.isAir = true;
- proxyData.airNum++;
- }
- });
- }
- },
-
- isCusTimeBefore(spaceCustomContentList: any, time: any) {
- let flag: any = false;
- spaceCustomContentList.map((item: any) => {
- if (time < item.startTime) {
- flag = true;
- }
- });
- return flag;
- },
-
- setWorkTimeList() {
- proxyData.isUpdate = false;
- proxyGlobal.proxy.$loadinngEnd();
- let data: any = proxyData.workkArr;
- proxyData.dateArr = [];
- let nowDate: any = formatDate("YYYY-MM-DD");
- for (let i = 0; i < data.length; i++) {
- let date: any = formatDateStr(data[i].date);
- let spaceCustomContentList: any =
- data[i].spaceCustomContentList || [];
- let week: any = getWeekDate(new Date(date).getDay());
- if (date === nowDate) {
- week = "今天";
- }
- let timerArr: any = [];
- for (let i = 0; i < proxyData.timerArr.length; i++) {
- let obj: any = {
- timer: proxyData.timerArr[i],
- isCheck: false,
- isServiceTime: false,
- formatTimer: proxyData.timerArr[i].replace(/[:]/g, "") + "00",
- };
- timerArr.push(obj);
- }
- let customSceneList: any = data[i]?.customSceneList ?? [];
- customSceneList.map((custom: any) => {
- for (let j = 0; j < timerArr.length; j++) {
- if (
- proxyData.isCusTimeBefore(
- spaceCustomContentList,
- custom.endTime
- )
- ) {
-
- let tempStartTime: any = proxyData.parseCusStartTime(
- custom.startTime
- );
- let tempEndTime: any = proxyData.parseCusStartTime(
- custom.endTime
- );
- if (
- timerArr[j].formatTimer >= tempStartTime &&
- timerArr[j].formatTimer < tempEndTime
- ) {
- timerArr[j].isCheck = true;
- }
- } else {
-
-
- let tempStartTime: any = proxyData.parseCusEndTime(
- custom.startTime
- );
- let tempEndTime: any = proxyData.parseCusEndTime(
- custom.endTime
- );
- if (
- timerArr[j].formatTimer >= tempStartTime &&
- timerArr[j].formatTimer < tempEndTime
- ) {
- timerArr[j].isCheck = true;
- }
- }
- }
- });
- spaceCustomContentList.map((spaceCustom: any) => {
- let startTime: any = proxyData.parseCusStartTime(
- spaceCustom.startTime
- );
- let endTime: any = proxyData.parseCusEndTime(spaceCustom.endTime);
- console.log("t==", endTime);
-
- if (startTime && endTime) {
-
- timerArr.map((item: any) => {
- if (
- item.formatTimer >= startTime &&
- item.formatTimer < endTime
- ) {
- item.isServiceTime = true;
- }
- });
- }
- });
- proxyData.dateArr.push({
- date: date,
- isActive: false,
- equipmentList: data[i].equipmentList || [],
- oldDate: data[i].date,
- objectId: data[i].objectId,
- cusStartTime: data[i].cusStartTime,
- customSceneList: customSceneList,
- cusEndTime: data[i].cusEndTime,
- spaceCustomContentList: data[i].spaceCustomContentList || [],
- day: getDate(new Date(date)),
- week: week,
- timerArr: timerArr,
- });
- }
-
- proxyData.dateArr.map((item: any, index: any) => {
- if (index === proxyData.activeIndex) {
- proxyData.checkDate(item, index);
- return;
- }
- });
- },
- clearTimerBoxStyle() {
- proxyData.dateArr.map((elItem: any) => {
- elItem.isActive = false;
- });
- let timerArr: any = proxyData.nowTimerArr;
- let sliderBoxArr: any = document.querySelectorAll(".slider-box");
- for (let i = 0; i < timerArr.length; i++) {
- sliderBoxArr[i].style.background = `transparent`;
- }
-
-
- },
-
- activeIndex: 0,
-
- checkApprovalStatus(item: any, e: any) {
- if (e.target) {
- let targetWidth: any = e.target.offsetWidth * 0.7;
- let left: any = item.left - targetWidth * 1.5 + e.offsetX;
- let sliderBoxEl: any = document.querySelectorAll(".slider-box")[0];
- let sliderWidth: any = sliderBoxEl.offsetWidth;
- let index: any = Math.ceil(left / sliderWidth);
- proxyData.checkSlider({}, index);
- }
- },
- approvalData: approvalData,
-
- getSliderWapperWidth() {
- let slidersWrapper: any = document.querySelector("#slidersWrapperId");
- let slidersWrapperWidth: any =
- slidersWrapper.getBoundingClientRect().width;
- return slidersWrapperWidth;
- },
-
- formateApproveStatusPerstion() {
- if (proxyData.nowData) {
- let spaceCustomContentList: any =
- proxyData.nowData.customSceneList || [];
- let slidersWrapperWidth: any = proxyData.getSliderWapperWidth();
- proxyData.approvalData = [];
- for (let i = 0; i < spaceCustomContentList.length; i++) {
- let item: any = spaceCustomContentList[i];
-
- let obj: any = {
- left: 0,
- bg: "",
- index: 0,
- approvalStatus: item.approvalStatus,
- text: "",
- };
- if (item.approvalStatus == 0) {
- obj.text = "待审批";
- obj.bg = "rgba(65, 107, 255, 0.6)";
- } else if (item.approvalStatus == 1) {
- obj.text = "已通过";
- obj.bg = "rgba(24, 196, 93, 0.6)";
- } else if (item.approvalStatus == 2) {
- obj.text = "已拒绝";
- obj.bg = "rgba(255, 54, 54, 0.6)";
- }
-
-
-
-
- if (obj.text) {
- let startTime: any = proxyData.parseCusStartTime(item.startTime);
- let endTime: any = proxyData.parseCusEndTime(item.endTime);
- let relNowTime: any = getRelNowTime();
- let timerArr: any = proxyData.nowTimerArr;
- let leftStart: any = 0;
- let leftEnd: any = 0;
- timerArr.map((timer: any, index: any) => {
- if (timer.formatTimer == startTime) {
- if (slidersWrapperWidth) {
- leftStart = slidersWrapperWidth * index;
- }
- }
- if (timer.formatTimer == endTime) {
- if (slidersWrapperWidth) {
- leftEnd = slidersWrapperWidth * index;
- }
- }
- });
- obj.left = leftStart + (leftEnd - leftStart) * 0.5 - 30;
- if (relNowTime < endTime) {
- proxyData.approvalData.push(obj);
- }
- }
- }
- }
- },
- checkDate(item: any, index: any) {
- proxyData.clearTimerBoxStyle();
- item.isActive = true;
- proxyData.activeIndex = index;
- proxyData.nowTimerArr = proxyData.dateArr[index].timerArr;
- proxyData.nowData = proxyData.dateArr[index];
-
- proxyData.formateEquipment();
- nextTick(() => {
- proxyData.setNowBarPerstion(proxyData.nowTimerArr);
- let nowIndex: any = proxyData.getNowIndex();
-
- proxyData.setCheckTimeStyle();
-
- proxyData.setServiceTimerStyle();
- if (proxyData.nowData.week === "今天") {
- proxyData.setPastTime();
- }
-
- proxyData.formateApproveStatusPerstion();
- if (!proxyData.isEvent) {
- proxyData.changeEl();
- proxyData.isEvent = true;
- }
- });
- },
-
- flag: false,
- changeEl() {
-
-
- proxyData.setScreennWidth();
- proxyData.sliderSwiper();
- proxyData.endBoxSwiper();
- },
-
- formateAddTimer() {
- let customSceneList: any = proxyData.nowData.customSceneList;
- let timerArr: any = proxyData.nowData.timerArr;
- let startTime: any = timerArr[proxyData.startIndex].formatTimer;
- let endTime: any = timerArr[proxyData.endIndex].formatTimer;
-
- let delTimerArr: any = [];
-
- customSceneList.map((item: any, index: any) => {
-
-
-
- if (startTime < item.startTime) {
- if (endTime < item.startTime) {
- } else if (endTime >= item.startTime) {
-
- let delObj: any = proxyData.formaTimeObj(
- item,
- "1",
- item.startTime,
- item.endTime
- );
- delTimerArr.push(delObj);
- startTime = startTime;
- endTime = endTime;
- }
- } else if (startTime >= item.startTime && startTime < item.endTime) {
- if (endTime <= item.endTime) {
- let delObj: any = proxyData.formaTimeObj(
- item,
- "1",
- item.startTime,
- item.endTime
- );
- delTimerArr.push(delObj);
- startTime = startTime;
- endTime = endTime;
- } else if (endTime > item.endTime) {
- let delObj: any = proxyData.formaTimeObj(
- item,
- "1",
- item.startTime,
- item.endTime
- );
- delTimerArr.push(delObj);
- startTime = item.startTime;
- endTime = endTime;
- }
- } else if (startTime >= item.endTime) {
- if (startTime === item.endTime) {
- let delObj: any = proxyData.formaTimeObj(
- item,
- "1",
- item.startTime,
- item.endTime
- );
- delTimerArr.push(delObj);
- startTime = item.startTime;
- endTime = endTime;
- }
- } else if (startTime === item.startTime && endTime === item.endTime) {
-
- }
- });
-
- let cusStartTime: any = proxyData.parseCusStartTime(
- proxyData.nowData.cusStartTime
- );
- let cusEndTime: any = proxyData.parseCusEndTime(
- proxyData.nowData.cusEndTime
- );
- if (startTime < cusStartTime && endTime <= cusStartTime) {
- if (endTime === cusStartTime) {
- endTime = proxyData.nowData.cusStartTime;
- }
- } else if (startTime >= cusEndTime) {
- if (startTime === cusEndTime) {
- startTime = proxyData.nowData.cusEndTime;
- }
- }
- let relNowTime: any = getRelNowTime();
- let type = "0";
- if (
- proxyData.nowData.week === "今天" &&
- relNowTime >= startTime &&
- relNowTime <= endTime
- ) {
- type = "2";
- }
-
- let addObj: any = proxyData.formaTimeObj(
- customSceneList[0],
- type,
- startTime,
- endTime
- );
- delTimerArr.push(addObj);
- let formTimeArr: any = delTimerArr;
- return formTimeArr;
- },
-
- formaTimeObj(item: any, type: any, startTime: any, endTime: any) {
- console.log(item);
- let obj: any = {
- projectId: proxyData.projectId,
- sceneEquipList:
- item && item.sceneEquipList ? item.sceneEquipList : [],
- objectId: proxyData.nowData.objectId,
- sourceType: proxyData.userInfo.pubname,
- startDate: proxyData.nowData.oldDate,
- endDate: proxyData.nowData.oldDate,
- startTime: startTime,
- endTime: endTime,
- type: type,
- userId: proxyData.userInfo.userId,
- userPhone: proxyData.userInfo.userPhone,
- customSceneEqType: "ALL",
- userName: proxyData.userInfo.userName,
- };
- if (type === "1") {
- obj.id = item.id;
- }
- return obj;
- },
-
- formateDelTimer() {
- let timerArr: any = proxyData.nowData.timerArr;
- let endIndex: any = proxyData.endIndex > 0 ? proxyData.endIndex - 1 : 0;
-
-
- if (
- timerArr[proxyData.startIndex].isCheck &&
- timerArr[endIndex].isCheck
- ) {
- let customSceneList: any = proxyData.nowData.customSceneList || [];
- let startTime: any = timerArr[proxyData.startIndex].formatTimer;
- let endTime: any = timerArr[proxyData.endIndex].formatTimer;
- let delTimerArr: any = [];
- let addTimeArr: any = [];
-
- for (let i = 0; i < customSceneList.length; i++) {
- let item: any = customSceneList[i];
- let index: any = i;
- if (item.startTime === startTime && item.endTime === endTime) {
-
-
- let delObj: any = proxyData.formaTimeObj(
- item,
- "1",
- item.startTime,
- item.endTime
- );
- delTimerArr.push(delObj);
- break;
- } else if (item.startTime < startTime) {
- if (item.endTime <= endTime) {
- let delObj: any = proxyData.formaTimeObj(
- item,
- "1",
- item.startTime,
- item.endTime
- );
- delTimerArr.push(delObj);
- let addObj: any = proxyData.formaTimeObj(
- customSceneList[0],
- "0",
- item.startTime,
- startTime
- );
- addTimeArr.push(addObj);
- } else if (item.endTime > endTime) {
- let delObj: any = proxyData.formaTimeObj(
- item,
- "1",
- item.startTime,
- item.endTime
- );
- delTimerArr.push(delObj);
- let addObj1: any = proxyData.formaTimeObj(
- customSceneList[0],
- "0",
- item.startTime,
- startTime
- );
- addTimeArr.push(addObj1);
- let addObj2: any = proxyData.formaTimeObj(
- customSceneList[0],
- "0",
- endTime,
- item.endTime
- );
- addTimeArr.push(addObj2);
- }
- } else if (item.startTime === item.startTime) {
- if (item.endTime <= endTime) {
-
- let delObj: any = proxyData.formaTimeObj(
- item,
- "1",
- item.startTime,
- item.endTime
- );
- delTimerArr.push(delObj);
- } else if (item.endTime > endTime) {
- let delObj: any = proxyData.formaTimeObj(
- item,
- "1",
- item.startTime,
- item.endTime
- );
- delTimerArr.push(delObj);
- let addObj1: any = proxyData.formaTimeObj(
- customSceneList[0],
- "0",
- endTime,
- item.endTime
- );
- addTimeArr.push(addObj1);
- }
- } else if (item.startTime > startTime) {
- if (item.endTime <= endTime) {
-
- let delObj: any = proxyData.formaTimeObj(
- item,
- "1",
- item.startTime,
- item.endTime
- );
- delTimerArr.push(delObj);
- } else if (item.endTime > endTime) {
- let delObj: any = proxyData.formaTimeObj(
- item,
- "1",
- item.startTime,
- item.endTime
- );
- delTimerArr.push(delObj);
- let addObj1: any = proxyData.formaTimeObj(
- customSceneList[0],
- "0",
- endTime,
- item.endTime
- );
- addTimeArr.push(addObj1);
- }
- }
- }
-
- let delStartTime: any = 0;
- let formTimeArr: any = addTimeArr.concat(delTimerArr);
- let realTime: any = getRelNowTime();
- formTimeArr.map((item: any, index: any) => {
- if (item.type == "1") {
-
- if (realTime >= item.startTime && realTime <= item.endTime) {
- item.type = "3";
- delStartTime = item.startTime;
- item.endTimeReal = realTime;
- }
- }
- });
- formTimeArr.map((item: any, index: any) => {
- if (item.type == "0" && delStartTime) {
- if (item.startTime == delStartTime) {
- formTimeArr.splice(index, 1);
- }
- }
- });
- return formTimeArr;
- } else {
- return [];
- }
- },
-
- closeWorkTimer() {
- proxyData.formBtn = false;
- context.emit("closeWork");
- },
-
- removeDuplicateObj(arr: any) {
- let obj = {};
- arr = arr.reduce((newArr: any, next: any) => {
- obj[next.objectId]
- ? ""
- : (obj[next.objectId] = true && newArr.push(next));
- return newArr;
- }, []);
- return arr;
- },
- checkEquipment(item: any) {
- item.isCheck = !item.isCheck;
- },
-
- delSpaceNoCtrDevice(formTimerArr: any) {
- formTimerArr.map((item: any) => {
- let sceneEquipList: any = item.sceneEquipList || [];
- let seviceEquipmentList: any = proxyData.seviceEquipmentList;
- if (item.type == "2" && sceneEquipList.length) {
- sceneEquipList.map((scene: any, index: any) => {
- let flag: any = false;
- for (let i = 0; i < seviceEquipmentList.length; i++) {
- if (
- scene.objectId == seviceEquipmentList[i].id &&
- seviceEquipmentList[i].isExeSpaceTime
- ) {
- flag = true;
- }
- if (flag) {
- break;
- }
- }
- if (!flag) {
- item.sceneEquipList.splice(index, 1);
- }
- });
- }
- });
- },
-
- addWorkTimer() {
- let formTimerArr: any = proxyData.formateAddTimer();
- let sceneEquipList: any = [];
- proxyData.nowData.equipmentList.map((item: any) => {
- if (item.isCheck) {
- let obj: any = {
- projectId: item.projectId,
- objectId: item.id,
- type: item.equipmentCategory,
- };
- sceneEquipList.push(obj);
- }
- });
- if (formTimerArr && formTimerArr.length == 2) {
- if (
- formTimerArr[1].startTime >= formTimerArr[0].startTime &&
- formTimerArr[1].endTime <= formTimerArr[0].endTime
- ) {
- } else {
- formTimerArr.map((item: any) => {
- if (item.type == "1") {
- if (item.sceneEquipList && item.sceneEquipList.length) {
- item.sceneEquipList.map((scene: any) => {
- let obj: any = {
- projectId: scene.projectId,
- objectId: scene.objectId,
- type: scene.type,
- };
- sceneEquipList.push(obj);
- });
- }
- }
- });
- }
- }
- sceneEquipList = proxyData.removeDuplicateObj(sceneEquipList);
- formTimerArr.map((item: any) => {
- if (item.type == "0" || item.type == "2") {
- item.sceneEquipList = sceneEquipList;
- }
- });
-
- proxyData.delSpaceNoCtrDevice(formTimerArr);
-
- proxyData.saveBatchCustomScene(formTimerArr);
-
-
- },
-
- openDeviceAll(formTimerArr: any) {
- let sceneEquipList: any = [];
- formTimerArr.map((item: any) => {
- if (item.type == "2") {
- sceneEquipList = sceneEquipList.concat(item.sceneEquipList);
- }
- });
- sceneEquipList = proxyData.removeDuplicateObj(sceneEquipList);
-
- let airDevice: any = [];
- let lightDevice: any = [];
- sceneEquipList.map((item: any) => {
- if (item.type == "SELTLT") {
- let obj: any = {
- id: item.objectId,
- switch: true,
- };
- lightDevice.push(obj);
- } else {
- let obj: any = {
- id: item.objectId,
- code: "EquipSwitchSet",
- value: "1",
- };
- airDevice.push(obj);
- }
- });
- proxyData.setSpaceCondtioners(airDevice);
- proxyData.setallLampHttp(lightDevice);
- },
-
- setSpaceCondtioners(data: any) {
- setSpaceCondtioners(data)
- .then((res) => {})
- .catch(() => {});
- },
-
- setallLampHttp(data: any) {
- setallLampHttp(data)
- .then((res) => {})
- .catch(() => {});
- },
-
- saveBatchCustomScene(formTimerArr: any, type: any = 1) {
-
- proxyData.showLoading = true;
- proxyData.formBtn = true;
- saveBatchCustomScene(formTimerArr)
- .then((res) => {
- context.emit("closeWork");
- proxyData.showLoading = false;
- proxyData.formBtn = false;
- })
- .catch(() => {
-
- context.emit("closeWork");
- proxyData.showLoading = false;
- proxyData.formBtn = false;
- });
- },
-
- isUpdate: false,
- triggerDelTime() {
- let formTimeArr: any = proxyData.formateDelTimer();
- console.log("需要删除的数据---");
- console.log(formTimeArr);
- if (formTimeArr && formTimeArr.length) {
-
-
-
- Dialog.confirm({
- title: "确认",
- message: "确定删除当前时间吗?",
- })
- .then(() => {
- let sceneEquipList: any = [];
- formTimeArr.map((item: any) => {
- if (item.type == "1") {
- if (item.sceneEquipList) {
- item.sceneEquipList.map((scene: any) => {
- let obj: any = {
- projectId: scene.projectId,
- objectId: scene.objectId,
- type: scene.type,
- };
- sceneEquipList.push(obj);
- });
- }
- }
- });
- sceneEquipList = proxyData.removeDuplicateObj(sceneEquipList);
- formTimeArr.map((item: any) => {
- if (item.type !== "1") {
- item.sceneEquipList = sceneEquipList;
- }
- });
- proxyData.saveBatchCustomScene(formTimeArr, 2);
- })
- .catch(() => {
-
- });
- }
- },
- });
- watch(
- props,
- (newProps: any) => {
- proxyData.workkArr = newProps.workkArr;
- proxyData.projectId = newProps.projectId;
- proxyData.enterType = newProps.enterType;
- proxyData.deviceItem = newProps.deviceItem;
- proxyData.seviceEquipmentList = newProps.seviceEquipmentList;
- console.log("弹窗变化了-----==");
-
- },
- {
- deep: true,
- immediate: true,
- }
- );
- onMounted(() => {
-
-
-
- proxyData.setWorkTimeList();
- });
- return {
- ...toRefs(proxyData),
- };
- },
- });
- </script>
- <style lang="scss" scoped>
- .work-content {
- position: relative;
- height: 100%;
- width: 100%;
- overflow: hidden;
- background: #fff;
- }
- .work-space {
- width: 100%;
- // padding-left: 10px;
- .space-title {
- padding-bottom: 10px;
- font-family: "Noto Sans SC";
- font-style: normal;
- font-weight: 500;
- font-size: 22px;
- line-height: 31px;
- color: #000000;
- }
- .tip {
- padding-bottom: 20px;
- font-family: "Noto Sans SC";
- font-style: normal;
- font-weight: 400;
- font-size: 12px;
- line-height: 17px;
- color: #8d9399;
- }
- }
- .add-time {
- width: 100%;
- // height: 80%;
- background: #fff;
- box-sizing: border-box;
- // padding: 10px;
- overflow: hidden;
- .date_box {
- display: flex;
- justify-content: space-between;
- width: 100%;
- padding-bottom: 5px;
- .date-item {
- padding-top: 10px;
- width: 50px;
- height: 60px;
- box-sizing: border-box;
- border: 1px solid #eff0f1;
- border-radius: 16px;
- span {
- display: block;
- width: 100%;
- text-align: center;
- &:nth-child(1) {
- font-family: "Noto Sans SC";
- padding-bottom: 6px;
- font-style: normal;
- font-weight: 400;
- font-size: 14px;
- line-height: 14px;
- transform: scale(0.8);
- text-align: center;
- color: #8d9399;
- }
- &:nth-child(2) {
- font-family: "Persagy";
- font-style: normal;
- font-weight: 700;
- font-size: 16px;
- // line-height: 19px;
- text-align: center;
- color: #000000;
- }
- }
- }
- .date-item-active {
- background: rgba(206, 159, 39, 0.4);
- border: none;
- }
- }
- .sliders-list {
- position: relative;
- margin-top: 5px;
- height: 135px;
- white-space: nowrap;
- overflow-x: auto;
- overflow-y: hidden;
- .approval-status {
- position: absolute;
- font-family: "Montserrat";
- top: 64px;
- z-index: 444;
- height: 30px;
- line-height: 30px;
- border-radius: 10px;
- font-size: 12px;
- transform: scale(0.7);
- font-weight: 500;
- text-align: center;
- color: #ffffff;
- }
- &::-webkit-scrollbar {
- display: none;
- }
- .sliders-wrapper {
- display: inline-block;
- box-sizing: border-box;
- width: 72px;
- height: 135px;
- //border-bottom: 1px solid #ECEFF4;
- &:nth-child(2n + 1) {
- border-left: 1px solid #eceff4;
- }
- .sliders {
- position: relative;
- // width: 36px;
- width: 100%;
- height: 100%;
- .label {
- position: absolute;
- height: 34px;
- left: 0px;
- top: 5px;
- font-family: "PingFang SC";
- font-style: normal;
- font-weight: 400;
- font-size: 10px;
- line-height: 14px;
- padding-left: 5px;
- color: #8d9399;
- }
- .slider-box {
- position: absolute;
- //width: 100%;
- width: 72px;
- height: 100px;
- left: -1px;
- // top:25px;
- bottom: 0px;
- //background: linear-gradient(0deg, rgba(255, 0, 0, 0.2), rgba(255, 0, 0, 0.2));
- }
- }
- }
- .slider-btn {
- position: absolute;
- height: 100px;
- //left: 40px;
- top: 35px;
- .start {
- position: absolute;
- width: 2px;
- top: 0;
- height: 100px;
- left: 0px;
- //left: 176px;
- background: #04b49c;
- }
- .end-box {
- position: absolute;
- top: 0;
- width: 20px;
- height: 100px;
- right: -8px;
- z-index: 999;
- //left: 286px;
- .end {
- position: absolute;
- top: 0;
- left: 10px;
- width: 2px;
- height: 100px;
- background: #04b49c;
- }
- .end-radio {
- width: 22px;
- position: absolute;
- top: 37px;
- left: -1px;
- height: 22px;
- background: #ffffff;
- border-radius: 50%;
- box-shadow: 0px 1px 2px rgba(4, 38, 0, 0.2);
- }
- }
- }
- }
- }
- .add-time-btn {
- position: absolute;
- bottom: 5px;
- left: 50%;
- transform: translateX(-50%);
- display: flex;
- justify-content: space-between;
- // padding-top: 10px;
- text-align: center;
- .cancel-btn {
- // width: 32%;
- width: 170px;
- height: 50px;
- line-height: 50px;
- background: #ffffff;
- border: 1px solid #c3c7cb;
- border-radius: 25px;
- font-size: 16px;
- margin-right: 20px;
- font-weight: 400;
- color: #1f2529;
- }
- .comfirm-btn {
- // width: 52%;
- width: 265px;
- height: 50px;
- line-height: 50px;
- font-weight: 400;
- font-size: 16px;
- text-align: center;
- background: #ce9f27;
- border-radius: 25px;
- color: #fff;
- }
- .comfirm-btn-diabled {
- background: rgba(196, 196, 196, 0.2);
- color: #1f2529;
- }
- }
- .work-device {
- // padding-top: 10px;
- height: 36vh;
- overflow-y: auto;
- .device-tip {
- padding-top: 20px;
- font-weight: 400;
- font-size: 12px;
- color: #8d9399;
- span {
- display: inline-block;
- padding-bottom: 10px;
- }
- p {
- line-height: 24px;
- }
- }
- }
- .device-box {
- // display: flex;
- // justify-content: space-between;
- .device-row {
- display: inline-block;
- width: 48%;
- font-family: "PingFang SC";
- font-style: normal;
- font-weight: 400;
- font-size: 14px;
- padding: 10px;
- color: #1b2129;
- background: #f7f9fa;
- border-radius: 4px;
- margin-top: 10px;
- margin-bottom: 10px;
- line-height: 20px;
- &:nth-child(2n + 1) {
- margin-right: 2%;
- }
- .row-item {
- display: flex;
- justify-content: space-between;
- }
- span {
- display: inline-block;
- font-family: "PingFang SC";
- font-style: normal;
- font-weight: 400;
- font-size: 12px;
- }
- img {
- width: 25px;
- height: 25px;
- }
- }
- }
- .row-title {
- display: block;
- font-weight: 500;
- font-size: 14px;
- line-height: 14px;
- color: #000000;
- padding-top: 4px;
- }
- .device-title {
- display: flex;
- justify-content: space-between;
- padding-top: 20px;
- padding-bottom: 5px;
- text-align: center;
- .line {
- display: inline-block;
- flex: 1;
- height: 0px;
- border: 1px solid #e1e5eb;
- }
- .text {
- display: inline-block;
- width: 142px;
- vertical-align: middle;
- font-family: "PingFang SC";
- font-style: normal;
- font-weight: 400;
- font-size: 12px;
- color: #8d9399;
- text-align: center;
- margin-top: -6px;
- }
- }
- </style>
|