door-content-r.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <template>
  2. <div class="door-content-r">
  3. <div class="content-r-btn">
  4. <a-button type="primary" @click="handlerOpenOrClose('open')">
  5. <SvgIcon class="icon-style" size="14" color="#30b3fc" name="open-door" />
  6. 同步开启
  7. </a-button>
  8. <a-button type="primary" style="margin: 0px 10px" @click="handlerOpenOrClose('close')">
  9. <SvgIcon class="icon-style" size="14" color="#30b3fc" name="close-door" />
  10. 同步关闭
  11. </a-button>
  12. <a-button type="primary" @click="handlerTimeSet">
  13. <SvgIcon class="icon-style" size="14" color="#30b3fc" name="time-setting-door" />
  14. 定时设置
  15. </a-button>
  16. <a-button style="margin: 0px 10px" type="primary" @click="handlerOperation">操作日志</a-button>
  17. </div>
  18. <div class="content-r-container">
  19. <div class="content-r-box" v-for="(item, index) in infoDatas" :key="index">
  20. <div class="box-title">
  21. <div class="title-text">{{ item.strinstallpos }}</div>
  22. <div class="title-detail" @click="handlerDetail(item.deviceID)">详情</div>
  23. </div>
  24. <div class="box-content">
  25. <!-- 二三维信息 -->
  26. <!-- <gateDualSVG v-if="item.ndoorcount == '2'" :ref="`modelRef${index}`" :indexCode="index"></gateDualSVG>
  27. <gateSVG v-if="item.ndoorcount == '1'" :ref="`modelRef${index}`" :indexCode="index"></gateSVG> -->
  28. <!-- <component :ref="`modelRef${index}`" :indexCode="index"
  29. :is="getModelComponent(globalConfig.is2DModel, item.deviceType)" /> -->
  30. <gateDualSVG v-if="item.ndoorcount == '2'" :ref="(el) => setChildRef(el, index)" :indexCode="index">
  31. </gateDualSVG>
  32. <gateSVG v-if="item.ndoorcount == '1'" :ref="(el) => setChildRef(el, index)" :indexCode="index"></gateSVG>
  33. </div>
  34. <img src="@/assets/images/camera.png" alt="" @click="handlerCamera(item, index)" />
  35. </div>
  36. </div>
  37. <!-- 同步开启/关闭弹窗 -->
  38. <syncModal :visible="visible" @handleCancel="handleCancel" @handleOk="handleOk"></syncModal>
  39. <!-- 定时设置弹窗 -->
  40. <timeSetModal :visibleTime="visibleTime" @handleCancelTime="handleCancelTime" @handleOk="handleOkTime">
  41. </timeSetModal>
  42. <!--30s延时提示弹窗-->
  43. <tipModal></tipModal>
  44. <!-- 摄像头信息 -->
  45. <Modal :visible="modalVisible" :centered="true" :destroyOnClose="true" @cancel="handleCancelCamera">
  46. <CameraModal :cameraData="cameraData"></CameraModal>
  47. </Modal>
  48. <!-- 操作日志 -->
  49. <operationModal :visible="visibleOperation" @handleCancel="handleCancelOperation">
  50. </operationModal>
  51. </div>
  52. </template>
  53. <script setup lang="ts">
  54. import { reactive, ref, inject, watch, nextTick } from 'vue';
  55. import syncModal from './syncModal.vue';
  56. import timeSetModal from './timeSetModal.vue';
  57. import CameraModal from './cameraModal.vue';
  58. import Modal from './Modal.vue';
  59. import tipModal from './tipModal.vue'
  60. import gateDualSVG from './gateDualSVG.vue'
  61. import gateSVG from './gateSVG.vue'
  62. import operationModal from './operationModal.vue'
  63. import { useRouter } from 'vue-router';
  64. import { devicecontrol, insertSyncRule, GetSyncRule } from '../airdoor.api'
  65. // import { getModelComponent } from '../airdoor.data'
  66. import { useMessage } from '/@/hooks/web/useMessage';
  67. import { SvgIcon } from '/@/components/Icon';
  68. let props = defineProps({
  69. infoData: {
  70. type: Array,
  71. default: () => {
  72. return [];
  73. },
  74. },
  75. });
  76. const { createMessage } = useMessage();
  77. const globalConfig = inject<any>('globalConfig');
  78. let router = useRouter();
  79. let infoDatas = ref<any[]>([])
  80. //同步开启/关闭弹窗-控制显示与隐藏
  81. let visible = ref(false);
  82. let visibleStatus = ref('')
  83. //设置定时弹窗-控制显示与影藏
  84. let visibleTime = ref(false);
  85. let Ids = ref('')
  86. //摄像头-控制显示与隐藏
  87. let modalVisible = ref(false);
  88. let cameraData = reactive({})
  89. //操作日志弹窗显示/关闭
  90. let visibleOperation = ref(false)
  91. const childRefs = ref<any[]>([])
  92. const setChildRef = (el, index) => {
  93. childRefs.value[index] = el
  94. }
  95. //同步开启/关闭--弹窗
  96. function handlerOpenOrClose(data) {
  97. visible.value = true;
  98. visibleStatus.value = data
  99. }
  100. //确定
  101. async function handleOk(param) {
  102. let deviceStr = infoDatas.value.map(v => v.deviceID).join(',')
  103. let paramcode = visibleStatus.value == 'open' ? 'sameTimeOpen' : 'sameTimeClose'
  104. let res = await devicecontrol({ deviceids: deviceStr, paramcode: paramcode, password: param.pass || globalConfig?.simulatedPassword })
  105. if (res) {
  106. visible.value = param.visib
  107. visibleStatus.value = ''
  108. }
  109. }
  110. //取消
  111. function handleCancel(param) {
  112. visible.value = param;
  113. visibleStatus.value = ''
  114. }
  115. //定时设置
  116. async function handlerTimeSet() {
  117. visibleTime.value = true;
  118. let res = await GetSyncRule({})
  119. Ids.value = res[0]['id'] || ''
  120. console.log(res, '读取规则')
  121. }
  122. //确定
  123. async function handleOkTime(param) {
  124. console.log(param, '定时参数---')
  125. let start_time = `${param.formState.hourS}:${param.formState.minuteS}:${param.formState.secondS}`
  126. let end_time = `${param.formState.hourE}:${param.formState.minuteE}:${param.formState.secondE}`
  127. let enabled = param.formState.checked ? '1' : '0'
  128. let res = await insertSyncRule({ startTime: start_time, endTime: end_time, enabled: enabled, id: Ids.value, password: param.formState.passWord })
  129. console.log(res, '设置定时---')
  130. if (res) {
  131. visibleTime.value = param.visib
  132. Ids.value = ''
  133. createMessage.success('设置定时成功!');
  134. }
  135. }
  136. //取消
  137. function handleCancelTime(param) {
  138. visibleTime.value = param;
  139. }
  140. //详情跳转
  141. function handlerDetail(id) {
  142. router.push(`/monitorChannel/monitor-gate?id=${id}&deviceType=gate`);
  143. }
  144. //摄像头切换
  145. function handlerCamera(item, index) {
  146. modalVisible.value = true;
  147. cameraData = Object.assign({}, item)
  148. }
  149. //摄像头弹窗关闭
  150. function handleCancelCamera(param) {
  151. modalVisible.value = param;
  152. }
  153. //操作日志弹窗-打开
  154. function handlerOperation() {
  155. visibleOperation.value = true
  156. }
  157. //操作日志弹窗-关闭
  158. function handleCancelOperation(param) {
  159. visibleOperation.value = param
  160. }
  161. //模型动画
  162. function monitorAnimation(selectData, index) {
  163. childRefs.value[index]?.animate?.(selectData.frontGateOpen == '1', selectData.midGateOpen == '1', selectData.rearGateOpen == '1');
  164. }
  165. watch(() => props.infoData, (newV, oldV) => {
  166. console.log(newV, 'new---')
  167. infoDatas.value = newV
  168. if (newV.length) {
  169. nextTick(() => {
  170. newV.forEach((el: any, index: number) => {
  171. el = Object.assign(el, el.readData)
  172. monitorAnimation(el, index);
  173. })
  174. })
  175. }
  176. })
  177. </script>
  178. <style lang="less" scoped>
  179. @import '/@/design/theme.less';
  180. @{theme-deepblue} {
  181. .door-content-r {
  182. --image-camera_bg: url('/@/assets/images/themify/deepblue/vent/camera_bg.png');
  183. --image-btn: url(/@/assets/images/themify/deepblue/files/details/btn.png);
  184. }
  185. }
  186. .door-content-r {
  187. --image-camera_bg: url('/@/assets/images/vent/camera_bg.png');
  188. --image-btn: url(/@/assets/images/files/details/btn.png);
  189. width: 100%;
  190. height: 100%;
  191. .icon-style {
  192. margin-right: 5px;
  193. }
  194. .content-r-btn {
  195. width: 100%;
  196. height: 40px;
  197. padding: 0px 10px;
  198. display: flex;
  199. // align-items: center;
  200. }
  201. .content-r-container {
  202. width: 100%;
  203. height: calc(100% - 40px);
  204. display: flex;
  205. justify-content: flex-start;
  206. flex-wrap: wrap;
  207. .content-r-box {
  208. position: relative;
  209. width: 376px;
  210. height: 270px;
  211. margin: 10px 5px;
  212. background: var(--image-camera_bg);
  213. background-size: 100% 100%;
  214. .box-title {
  215. position: absolute;
  216. left: 50%;
  217. top: 12px;
  218. transform: translate(-50%, 0);
  219. width: 95%;
  220. height: 28px;
  221. line-height: 28px;
  222. text-align: center;
  223. color: #fff;
  224. background-color: rgba(51, 211, 255, 0.2);
  225. }
  226. .title-detail {
  227. position: absolute;
  228. right: 12px;
  229. top: 0px;
  230. color: rgba(60, 242, 255);
  231. font-size: 12px;
  232. cursor: pointer;
  233. }
  234. .box-content {
  235. position: absolute;
  236. left: 50%;
  237. top: 40px;
  238. transform: translate(-50%, 0);
  239. width: 95%;
  240. height: calc(100% - 40px);
  241. }
  242. img {
  243. position: absolute;
  244. right: 20px;
  245. bottom: 15px;
  246. width: 20px;
  247. height: 20px;
  248. cursor: pointer;
  249. }
  250. }
  251. }
  252. }
  253. ::v-deep .zxm-btn-primary {
  254. background-color: transparent;
  255. border: none;
  256. background: var(--image-btn) no-repeat !important;
  257. background-size: 100% 100% !important;
  258. }
  259. </style>