configurationGlobal.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. <template>
  2. <el-form :inline="true" :model="formInline" label-position="top" class="form-inline">
  3. <div style="display: flex;flex-direction: column;height: 86vh">
  4. <div style="flex-grow: 1;">
  5. <div class="disposition-title">提示音配置</div>
  6. <el-row :gutter="20">
  7. <el-col :span="5">
  8. <el-form-item style="width: 250px">
  9. <el-checkbox v-model="formInline.isDutyPunctual" :disabled="isDisabled">正点值班时间提醒声音选择</el-checkbox>
  10. <el-select v-model="formInline.dutyPunctual" :disabled="isDisabled">
  11. <el-option label="传感器故障.wav" value="1"></el-option>
  12. </el-select>
  13. </el-form-item>
  14. </el-col>
  15. <el-col :span="5">
  16. <el-form-item style="width: 250px">
  17. <el-checkbox v-model="formInline.isInstrument" :disabled="isDisabled">仪器检定证提醒声音选择</el-checkbox>
  18. <el-select v-model="formInline.instrument" :disabled="isDisabled">
  19. <el-option label="传感器故障.wav" value="1"></el-option>
  20. </el-select>
  21. </el-form-item>
  22. </el-col>
  23. <el-col :span="5">
  24. <el-form-item style="width: 250px">
  25. <el-checkbox v-model="formInline.isDispatch" :disabled="isDisabled">自动编发报文提醒声音选择</el-checkbox>
  26. <el-select v-model="formInline.dispatch" :disabled="isDisabled">
  27. <el-option label="传感器故障.wav" value="1"></el-option>
  28. </el-select>
  29. </el-form-item>
  30. </el-col>
  31. <el-col :span="5">
  32. <el-form-item style="width: 250px">
  33. <el-checkbox v-model="formInline.isFailureSensor" :disabled="isDisabled">传感器故障提醒声音选择</el-checkbox>
  34. <el-select v-model="formInline.failureSensor" :disabled="isDisabled">
  35. <el-option label="传感器故障.wav" value="1"></el-option>
  36. </el-select>
  37. </el-form-item>
  38. </el-col>
  39. </el-row>
  40. <el-row :gutter="20">
  41. <el-col :span="5">
  42. <el-form-item style="width: 250px">
  43. <el-checkbox v-model="formInline.isFeatures" :disabled="isDisabled">要素缺测提醒声音选择</el-checkbox>
  44. <el-select v-model="formInline.features" :disabled="isDisabled">
  45. <el-option label="传感器故障.wav" value="1"></el-option>
  46. </el-select>
  47. </el-form-item>
  48. </el-col>
  49. <el-col :span="5">
  50. <el-form-item style="width: 250px">
  51. <el-checkbox v-model="formInline.isWeatherHazardous" :disabled="isDisabled">危险天气提醒声音选择</el-checkbox>
  52. <el-select v-model="formInline.weatherHazardous" :disabled="isDisabled">
  53. <el-option label="传感器故障.wav" value="1"></el-option>
  54. </el-select>
  55. </el-form-item>
  56. </el-col>
  57. <el-col :span="5">
  58. <el-form-item style="width: 250px">
  59. <el-checkbox v-model="formInline.isCommunication" :disabled="isDisabled">通讯故障提醒声音选择</el-checkbox>
  60. <el-select v-model="formInline.communication" :disabled="isDisabled">
  61. <el-option label="传感器故障.wav" value="1"></el-option>
  62. </el-select>
  63. </el-form-item>
  64. </el-col>
  65. <el-col :span="5">
  66. <el-form-item style="width: 250px">
  67. <el-checkbox v-model="formInline.isProcess" :disabled="isDisabled">进程管理提醒声音选择</el-checkbox>
  68. <el-select v-model="formInline.process" :disabled="isDisabled">
  69. <el-option label="传感器故障.wav" value="1"></el-option>
  70. </el-select>
  71. </el-form-item>
  72. </el-col>
  73. </el-row>
  74. <div class="disposition-title">全局策略配置</div>
  75. <el-row :gutter="20">
  76. <el-col :span="10">
  77. <el-form-item>
  78. <el-checkbox v-model="formInline.isVisibility" :disabled="isDisabled">能见度</el-checkbox>
  79. <el-input v-model="formInline.visibility" placeholder="请输入告警条件" :disabled="isDisabled"></el-input>
  80. <el-input v-model="formInline.visibility2" placeholder="请输入消警条件" style="margin-top: 10px" :disabled="isDisabled"></el-input>
  81. </el-form-item>
  82. </el-col>
  83. <el-col :span="10">
  84. <el-form-item>
  85. <el-checkbox v-model="formInline.isWindVelocity" :disabled="isDisabled">风速</el-checkbox>
  86. <el-input v-model="formInline.windVelocity" placeholder="请输入告警条件" :disabled="isDisabled"></el-input>
  87. <el-input v-model="formInline.windVelocity2" placeholder="请输入消警条件" style="margin-top: 10px" :disabled="isDisabled"></el-input>
  88. </el-form-item>
  89. </el-col>
  90. </el-row>
  91. <el-row :gutter="20">
  92. <el-col :span="10">
  93. <el-form-item>
  94. <el-checkbox v-model="formInline.isElectricField" :disabled="isDisabled">大气电场</el-checkbox>
  95. <el-input v-model="formInline.electricField" placeholder="请输入告警条件" :disabled="isDisabled"></el-input>
  96. <el-input v-model="formInline.electricField2" placeholder="请输入消警条件" style="margin-top: 10px" :disabled="isDisabled"></el-input>
  97. </el-form-item>
  98. </el-col>
  99. <el-col :span="10">
  100. <el-form-item>
  101. <el-checkbox v-model="formInline.isTemperature" :disabled="isDisabled">温度</el-checkbox>
  102. <el-input v-model="formInline.temperature" placeholder="请输入告警条件" :disabled="isDisabled"></el-input>
  103. <el-input v-model="formInline.temperature2" placeholder="请输入消警条件" style="margin-top: 10px" :disabled="isDisabled"></el-input>
  104. </el-form-item>
  105. </el-col>
  106. </el-row>
  107. <el-row :gutter="20">
  108. <el-col :span="10">
  109. <el-form-item>
  110. <el-checkbox v-model="formInline.isHumidity" :disabled="isDisabled">湿度</el-checkbox>
  111. <el-input v-model="formInline.humidity" placeholder="请输入告警条件" :disabled="isDisabled"></el-input>
  112. <el-input v-model="formInline.humidity2" placeholder="请输入消警条件" style="margin-top: 10px" :disabled="isDisabled"></el-input>
  113. </el-form-item>
  114. </el-col>
  115. <el-col :span="10">
  116. <el-form-item>
  117. <el-checkbox v-model="formInline.isRainfall" :disabled="isDisabled">雨量</el-checkbox>
  118. <el-input v-model="formInline.rainfall" placeholder="请输入告警条件" :disabled="isDisabled"></el-input>
  119. <el-input v-model="formInline.rainfall2" placeholder="请输入消警条件" style="margin-top: 10px" :disabled="isDisabled"></el-input>
  120. </el-form-item>
  121. </el-col>
  122. </el-row>
  123. <el-row :gutter="20">
  124. <el-col :span="10">
  125. <el-form-item>
  126. <el-checkbox v-model="formInline.isClouds" :disabled="isDisabled">云底高</el-checkbox>
  127. <el-input v-model="formInline.clouds" placeholder="请输入告警条件" :disabled="isDisabled"></el-input>
  128. <el-input v-model="formInline.clouds2" placeholder="请输入消警条件" style="margin-top: 10px" :disabled="isDisabled"></el-input>
  129. </el-form-item>
  130. </el-col>
  131. </el-row>
  132. </div>
  133. <div class="disposition-bottom">
  134. <el-button > 重置 </el-button>
  135. <el-button type="primary"> 确定 </el-button>
  136. </div>
  137. </div>
  138. </el-form>
  139. </template>
  140. <script setup lang="tsx">
  141. import {nextTick, onMounted, ref, watch} from "vue";
  142. import { defineModel } from 'vue';
  143. import {getRgDataList} from "@/api/modules/allData";
  144. const modelValue = defineModel();
  145. const isDisabled = ref(true)
  146. const formInline = ref<any>({
  147. user:"",
  148. region:"",
  149. checkboxValue: true,
  150. dutyPunctual:'',
  151. isDutyPunctual:false,
  152. instrument:'',
  153. isInstrument:false,
  154. dispatch:'',
  155. isDispatch:false,
  156. failureSensor:'',
  157. isFailureSensor:false,
  158. features:'',
  159. isFeatures:false,
  160. weatherHazardous:'',
  161. isWeatherHazardous: false,
  162. communication:'',
  163. isCommunication:false,
  164. process:'',
  165. isProcess:false,
  166. visibility: '',
  167. visibility2: '',
  168. isVisibility:false,
  169. windVelocity:'',
  170. windVelocity2:'',
  171. isWindVelocity:false,
  172. electricField:'',
  173. electricField2:'',
  174. isElectricField:false,
  175. temperature:'',
  176. temperature2:'',
  177. isTemperature: false,
  178. humidity:'',
  179. humidity2:'',
  180. isHumidity: false,
  181. rainfall:'',
  182. rainfall2:'',
  183. isRainfall:false,
  184. clouds:'',
  185. clouds2:'',
  186. isClouds:false
  187. })
  188. onMounted(() => {
  189. getAllRgDataList()
  190. });
  191. watch(modelValue, (newVal) => {
  192. // 在这里处理 modelValue 的变化
  193. dataProcessing()
  194. });
  195. const dataProcessing= async ()=>{
  196. modelValue.value.forEach(function(item) {
  197. const itemValue = item.item_value
  198. if (!itemValue) {
  199. return;
  200. }
  201. if(item.item_key==='28'){
  202. formInline.value.dutyPunctual = itemValue
  203. formInline.value.isDutyPunctual = true
  204. }
  205. if(item.item_key==='29'){
  206. formInline.value.instrument = itemValue
  207. formInline.value.isInstrument = true
  208. }
  209. if(item.item_key==='30'){
  210. formInline.value.dispatch = itemValue
  211. formInline.value.isDispatch = true
  212. }
  213. if(item.item_key==='31'){
  214. formInline.value.failureSensor = itemValue
  215. formInline.value.isFailureSensor = true
  216. }
  217. if(item.item_key==='32'){
  218. formInline.value.features = itemValue
  219. formInline.value.isFeatures = true
  220. }
  221. if(item.item_key==='33'){
  222. formInline.value.weatherHazardous = itemValue
  223. formInline.value.isWeatherHazardous = true
  224. }
  225. if(item.item_key==='34'){
  226. formInline.value.communication = itemValue
  227. formInline.value.isCommunication = true
  228. }
  229. if(item.item_key==='35'){
  230. formInline.value.process = itemValue
  231. formInline.value.isProcess = true
  232. }
  233. if(itemValue!=='NULLPTR' && item.item_key==='39'){
  234. const {data,data2} = parseItemValue(itemValue);
  235. formInline.value.visibility = data
  236. formInline.value.visibility2 = data2
  237. formInline.value.isVisibility = true
  238. }
  239. if(itemValue!=='NULLPTR' && item.item_key==='40'){
  240. const {data,data2} = parseItemValue(itemValue);
  241. formInline.value.windVelocity = data
  242. formInline.value.windVelocity2 = data2
  243. formInline.value.isWindVelocity= true
  244. }
  245. if(itemValue!=='NULLPTR' && item.item_key==='41'){
  246. const {data,data2} = parseItemValue(itemValue);
  247. formInline.value.electricField = data
  248. formInline.value.electricField2 = data2
  249. formInline.value.isElectricField = true
  250. }
  251. if(itemValue!=='NULLPTR' && item.item_key==='42'){
  252. const {data,data2} = parseItemValue(itemValue);
  253. formInline.value.temperature = data
  254. formInline.value.temperature2 = data2
  255. formInline.value.isTemperature = true
  256. }
  257. if(itemValue!=='NULLPTR' && item.item_key==='43'){
  258. const {data,data2} = parseItemValue(itemValue);
  259. formInline.value.humidity = data
  260. formInline.value.humidity2 = data2
  261. formInline.value.isHumidity = true
  262. }
  263. if(itemValue!=='NULLPTR' && item.item_key==='44'){
  264. const {data,data2} = parseItemValue(itemValue);
  265. formInline.value.rainfall = data
  266. formInline.value.rainfall2 = data2
  267. formInline.value.isRainfall = true
  268. }
  269. if(itemValue!=='NULLPTR' && item.item_key==='45'){
  270. const {data,data2} = parseItemValue(itemValue);
  271. formInline.value.clouds = data
  272. formInline.value.clouds2 = data2
  273. formInline.value.isClouds = true
  274. }
  275. });
  276. }
  277. const parseItemValue = (itemValue) => {
  278. const [alarm, alarmCondition, eliminate, eliminateCondition] = itemValue.split(';');
  279. const [relationshipAlarm, timeAlarm] = alarm.split('|');
  280. const [relationshipEliminate, timeEliminate] = eliminate.split('|');
  281. let data = undefined
  282. let data2 =undefined
  283. if(alarmCondition.includes('#')){
  284. const [conditionAlarm, conditionAlarm2] = alarmCondition.split('#');
  285. data = `${parseCondition(conditionAlarm)} ${parseCondition(conditionAlarm2)}`;
  286. }else {
  287. data = `${parseCondition(alarmCondition)}`;
  288. }
  289. if(eliminateCondition.includes('#')){
  290. const [conditionEliminate, conditionEliminate2] = eliminateCondition.split('#');
  291. data2 = `${parseCondition(conditionEliminate)} ${parseCondition(conditionEliminate2)}`;
  292. }else {
  293. data2 = `${parseCondition(eliminateCondition)}`;
  294. }
  295. return {
  296. relationshipAlarm,
  297. timeAlarm,
  298. relationshipEliminate,
  299. timeEliminate,
  300. data,
  301. data2
  302. };
  303. }
  304. const parseCondition = (condition) => {
  305. const [element, operator, value] = condition.split('|');
  306. return `${findDataName(element)} ${operatorDataName(operator)} ${value}`;
  307. };
  308. // 查询所有人工要素字典表
  309. const elementList =ref<any>([])
  310. const getAllRgDataList = async () => {
  311. const { data } = await getRgDataList();
  312. elementList.value = data.list
  313. dataProcessing()
  314. };
  315. const findDataName = (id) => {
  316. const item = elementList.value.find(item => item.data_id == parseInt(id));
  317. if (item) {
  318. return item.data_name;
  319. } else {
  320. return ''
  321. }
  322. };
  323. const operatorDataName = (id) => {
  324. const item = operatorList.find(item => item.value == parseInt(id));
  325. if (item) {
  326. return item.label;
  327. } else {
  328. return ''
  329. }
  330. };
  331. const operatorList= [
  332. {
  333. value: 0,
  334. label: '>',
  335. },
  336. {
  337. value: 1,
  338. label: '<',
  339. },
  340. {
  341. value: 3,
  342. label: '=',
  343. },
  344. {
  345. value: 4,
  346. label: '≠',
  347. }
  348. ]
  349. </script>
  350. <style scoped>
  351. </style>