DeviceModalLeather.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. <template>
  2. <BasicModal
  3. v-bind="$attrs"
  4. @register="registerModalLeather"
  5. :title="title"
  6. width="1000px"
  7. :showCancelBtn="false"
  8. :showOkBtn="false"
  9. :footer="null"
  10. :destroyOnClose="true"
  11. :mask-closable="false"
  12. @cancel="closeModalFn"
  13. >
  14. <a-tabs v-if="props.showTab" v-model:activeKey="activeKey">
  15. <a-tab-pane key="1" tab="基本信息" force-render>
  16. <FormModal :deviceType="deviceType" :record="deviceData" @save-or-update="(values) => emit('saveOrUpdate', values)" />
  17. </a-tab-pane>
  18. <!-- <a-tab-pane key="10" v-if="deviceType == 'fanlocal' || deviceType == 'fanmain'" tab="风机曲线" force-render>
  19. <FanLineModal :record="deviceData" />
  20. </a-tab-pane> -->
  21. <a-tab-pane key="11" tab="报表录入">
  22. <DeviceReportInfo v-if="activeKey == '11'" />
  23. </a-tab-pane>
  24. <a-tab-pane key="2" tab="点表关联">
  25. <PointTable
  26. :columns="pointColumns"
  27. :pointType="deviceData.strtype"
  28. :deviceId="deviceData.id"
  29. :valuetype="9"
  30. @save="savePointData"
  31. @delete="deletePointById"
  32. />
  33. </a-tab-pane>
  34. <a-tab-pane key="8" tab="虚拟点表配置">
  35. <PointTable
  36. :columns="simulationColumns"
  37. :pointType="deviceData.strtype"
  38. :deviceId="deviceData.id"
  39. :valuetype="4"
  40. @save="savePointData"
  41. @delete="deletePointById"
  42. />
  43. </a-tab-pane>
  44. <a-tab-pane key="3" tab="关联设备" v-if="deviceType == 'managesys'">
  45. <WorkFacePointTable :columns="linkColumns" :deviceId="deviceData.id" @save="savePointData" @delete="deletePointById" />
  46. </a-tab-pane>
  47. <a-tab-pane key="12" tab="关联报表" v-if="deviceType == 'managesys'">
  48. <WorkFaceReportTable :columns="reportColumns" :device="deviceData" />
  49. </a-tab-pane>
  50. <a-tab-pane key="4" tab="预警条目管理">
  51. <ManagerWarningDeviceTable v-if="activeKey == '4'" :deviceId="deviceData.id" />
  52. </a-tab-pane>
  53. <a-tab-pane key="5" :tab="deviceType !== 'managesys' ? '点位(报警)配置' : '配置预警设备'">
  54. <template v-if="activeKey == '5'">
  55. <WarningTable v-if="deviceType !== 'managesys'" :deviceId="deviceData.id" :pointType="deviceData.strtype" />
  56. <BackWindDeviceTable v-else :deviceId="deviceData.id" />
  57. </template>
  58. </a-tab-pane>
  59. <a-tab-pane v-if="deviceType == 'managesys'" key="6" tab="配置控制设备">
  60. <template v-if="activeKey == '6'">
  61. <WarningTable v-if="deviceType !== 'managesys'" :deviceId="deviceData.id" :pointType="deviceData.strtype" />
  62. <ManagerWarningTable v-else :deviceId="deviceData.id" />
  63. </template>
  64. </a-tab-pane>
  65. <a-tab-pane v-if="deviceType == 'managesys'" key="14" tab="配置预警解除后控制设备">
  66. <template v-if="activeKey == '14'">
  67. <ManagerWarningTable :deviceId="deviceData.id" :monitor-type="3" />
  68. </template>
  69. </a-tab-pane>
  70. <a-tab-pane key="7" tab="摄像头配置">
  71. <EditRowTable
  72. :columns="cameraColumns"
  73. :list="cameraList"
  74. :params="{ deviceid: deviceData.id }"
  75. @save-or-update="saveCameraData"
  76. @delete-by-id="deleteCameraById"
  77. :isAdd="true"
  78. />
  79. </a-tab-pane>
  80. <a-tab-pane key="9" :tab="'预案管理'">
  81. <AccidentPlanTable :deviceId="deviceData.id" />
  82. </a-tab-pane>
  83. <a-tab-pane v-if="deviceType == 'led'" key="10" :tab="'节目管理'">
  84. <LEDPlaylistTable :deviceId="deviceData.id" />
  85. </a-tab-pane>
  86. <a-tab-pane key="13" :tab="'故障配置管理'">
  87. <FaultConfigTable :deviceId="deviceData.id" />
  88. </a-tab-pane>
  89. <!-- <a-tab-pane key="9" tab="预警指标修改">
  90. <template v-if="activeKey == '9'">
  91. <editWarnTable></editWarnTable>
  92. </template>
  93. </a-tab-pane> -->
  94. </a-tabs>
  95. <FormModal v-else :record="record" @save-or-update="(values) => emit('saveOrUpdate', values)" />
  96. </BasicModal>
  97. </template>
  98. <script lang="ts" setup>
  99. import { computed, unref, inject, reactive, ref, watch } from 'vue';
  100. import { BasicModal, useModalInner } from '/@/components/Modal';
  101. import EditRowTable from '../../comment/EditRowTable.vue';
  102. import PointTable from './pointTabel/PointTable.vue';
  103. import WarningTable from './warningTabel/index.vue';
  104. import ManagerWarningTable from './warningTabel/index1.vue';
  105. import ManagerWarningDeviceTable from './warningTabel/indexLeather.vue';
  106. import BackWindDeviceTable from './warningTabel/index3.vue';
  107. import AccidentPlanTable from './warningTabel/index4.vue';
  108. import LEDPlaylistTable from './warningTabel/index5.vue';
  109. import WorkFacePointTable from './pointTabel/WorkFacePointTable.vue';
  110. import WorkFaceReportTable from './pointTabel/WorkFaceReportTable.vue';
  111. import DeviceReportInfo from './DeviceReportInfo.vue';
  112. import FaultConfigTable from './faultConfigTable/index.vue';
  113. // import editWarnTable from './editWarnTable/index.vue'
  114. import FanLineModal from './FanLineModal.vue';
  115. import FormModal from './FormModal.vue';
  116. import { cloneDeep } from 'lodash-es';
  117. import { columns as pointColumns, workFaceColumns, simulationColumns, reportColumns } from './pointTabel/point.data';
  118. import { saveOrUpdate as pointSaveOrUpdate, deleteById as pointDeleteById } from './pointTabel/point.api';
  119. import { columns as cameraColumns } from './cameraTabel/camera.data';
  120. import { list as cameraList, saveOrUpdate as cameraSaveOrUpdate, deleteById as cameraDeleteById } from './cameraTabel/camera.api';
  121. const props = defineProps({
  122. showTab: { type: Boolean, required: true },
  123. // deviceType: { type: String },
  124. });
  125. // 声明Emits
  126. const emit = defineEmits(['saveOrUpdate', 'register', 'closeModal']);
  127. const isUpdate = inject('isUpdate');
  128. const deviceData = inject('formData') as any;
  129. const deviceType = inject('deviceType') as any;
  130. const record = reactive({});
  131. const activeKey = ref('1');
  132. const linkColumns = ref<any[]>([]);
  133. const [registerModalLeather, { setModalProps, closeModal: closeModalLeather }] = useModalInner(async (data) => {
  134. setModalProps({ confirmLoading: false });
  135. Object.assign(deviceData, data.record);
  136. });
  137. //设置标题
  138. const title = computed(() => {
  139. if (!unref(isUpdate)) {
  140. if (deviceData.strname || deviceData.systemname) {
  141. return `新增(${deviceData.strname || deviceData.systemname})`;
  142. }
  143. return `新增`;
  144. } else {
  145. if (deviceData['strtype'] == 'sys_majorpath') {
  146. linkColumns.value = [
  147. ...workFaceColumns,
  148. ...[
  149. {
  150. title: '是否在关键通风路线上',
  151. width: 100,
  152. dataIndex: 'pathflag',
  153. edit: true,
  154. editComponent: 'Switch',
  155. editValueMap: (value) => {
  156. return value ? '是' : '否';
  157. },
  158. },
  159. {
  160. title: '传感器类型',
  161. width: 100,
  162. dataIndex: 'sensorType',
  163. edit: true,
  164. editComponent: 'Select',
  165. editComponentProps: {
  166. options: [
  167. {
  168. label: '多参',
  169. value: '1',
  170. },
  171. {
  172. label: '测风',
  173. value: '2',
  174. },
  175. ],
  176. },
  177. },
  178. {
  179. title: '风向',
  180. width: 100,
  181. dataIndex: 'winddir',
  182. edit: true,
  183. editComponent: 'Select',
  184. editComponentProps: {
  185. options: [
  186. {
  187. label: '进风',
  188. value: '1',
  189. },
  190. {
  191. label: '用风',
  192. value: '2',
  193. },
  194. {
  195. label: '回风',
  196. value: '3',
  197. },
  198. ],
  199. },
  200. },
  201. {
  202. title: '是否总风量',
  203. width: 100,
  204. dataIndex: 'windflag',
  205. edit: true,
  206. editComponent: 'Switch',
  207. editValueMap: (value) => {
  208. return value ? '是' : '否';
  209. },
  210. },
  211. {
  212. title: '路线名称',
  213. width: 100,
  214. dataIndex: 'des',
  215. edit: true,
  216. editComponent: 'Input',
  217. },
  218. {
  219. title: ' 阻力值',
  220. width: 100,
  221. dataIndex: 'testDrag',
  222. edit: true,
  223. editComponent: 'InputNumber',
  224. },
  225. ],
  226. ];
  227. } else {
  228. linkColumns.value = [...workFaceColumns];
  229. }
  230. if (deviceData.strname || deviceData.systemname) {
  231. return `编辑(${deviceData.strname || deviceData.systemname})`;
  232. }
  233. return `编辑`;
  234. }
  235. });
  236. const closeModalFn = () => {
  237. activeKey.value = '1';
  238. closeModalLeather();
  239. emit('closeModal');
  240. };
  241. const savePointData = (data) => {
  242. const record = cloneDeep(data.editValueRefs);
  243. pointSaveOrUpdate(Object.assign(record, { id: data.id, deviceId: deviceData.id }), data.id);
  244. };
  245. const saveCameraData = (data: any, reload: Function) => {
  246. cameraSaveOrUpdate(Object.assign({ ...data }, { id: data.id, deviceid: deviceData.id }), data.id);
  247. };
  248. const deletePointById = (id, reload) => {
  249. pointDeleteById({ id: id }, reload);
  250. };
  251. const deleteCameraById = (id, reload) => {
  252. cameraDeleteById({ id: id }, reload);
  253. };
  254. </script>
  255. <style scoped lang="less">
  256. ::v-deep .suffix {
  257. height: 32px;
  258. line-height: 32px;
  259. margin-left: 5px;
  260. color: #fff;
  261. }
  262. </style>