DeviceModal.vue 9.7 KB

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