|
@@ -100,8 +100,8 @@
|
|
|
<el-form :inline="true" @submit.stop.prevent>
|
|
|
<el-form-item label="触发方式:" style="width: 100%;" prop="triggerMethod">
|
|
|
<el-radio-group v-model="Data.Filter.triggerMethod">
|
|
|
- <el-radio :label="0">其中之一条件满足即触发</el-radio>
|
|
|
- <el-radio :label="1">全部满足时触发</el-radio>
|
|
|
+ <el-radio label="其中之一条件满足即触发">其中之一条件满足即触发</el-radio>
|
|
|
+ <el-radio label="全部满足时触发">全部满足时触发</el-radio>
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
@@ -189,8 +189,8 @@
|
|
|
<el-form :inline="true" @submit.stop.prevent>
|
|
|
<el-form-item label="触发方式:" style="width: 100%;" prop="triggerMethod2">
|
|
|
<el-radio-group v-model="Data.Filter.triggerMethod2">
|
|
|
- <el-radio :label="0">其中之一条件满足即触发</el-radio>
|
|
|
- <el-radio :label="1">全部满足时触发</el-radio>
|
|
|
+ <el-radio label="其中之一条件满足即触发">其中之一条件满足即触发</el-radio>
|
|
|
+ <el-radio label="全部满足时触发">全部满足时触发</el-radio>
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
@@ -295,8 +295,8 @@ const Data = reactive({
|
|
|
regular: '',
|
|
|
isExclusive: false,
|
|
|
taskPriority: 1,
|
|
|
- triggerMethod: null,
|
|
|
- triggerMethod2: null,
|
|
|
+ triggerMethod: null, // 这里应根据实际情况设置默认值,比如0表示其中之一条件满足即触发
|
|
|
+ triggerMethod2: null, // 这里应根据实际情况设置默认值,比如0表示其中之一条件满足即触发
|
|
|
conditionsJson: '' as any,
|
|
|
MaintenanceJson: '' as any,
|
|
|
pushUserid: []
|
|
@@ -577,82 +577,58 @@ const submitForm = async () => {
|
|
|
* @param row
|
|
|
*/
|
|
|
const openDialog = (row: alarmRluesFilterModel) => {
|
|
|
- // 重置基本状态
|
|
|
- Data.radioValue1 = false
|
|
|
- Data.radioValue2 = false
|
|
|
- Data.showAlarmConditions = false
|
|
|
- Data.showRepairConditions = false
|
|
|
-
|
|
|
- // 初始化条件数组
|
|
|
- Data.condition = [{
|
|
|
- equipment: '',
|
|
|
- type: '',
|
|
|
- source: ''
|
|
|
- }]
|
|
|
- Data.condition2 = [{
|
|
|
- proType: '',
|
|
|
- proStatus: ''
|
|
|
- }]
|
|
|
-
|
|
|
- if (row) {
|
|
|
- // 深度复制所有属性
|
|
|
- Data.Filter = {
|
|
|
- ...row,
|
|
|
- // 处理数组属性
|
|
|
- roleMappingId: [...(row.roleMappingId || [])],
|
|
|
- pushTemplateMappingID: [...(row.pushTemplateMappingID || [])],
|
|
|
- pushUserid: [...(row.pushUserid || [])],
|
|
|
- // 确保关键字段有值
|
|
|
- ruleName: row.ruleName || '',
|
|
|
- labelId: row.labelId || null,
|
|
|
- // 处理触发方式类型
|
|
|
- triggerMethod: row.triggerMethod != null ? String(row.triggerMethod) : null,
|
|
|
- triggerMethod2: row.triggerMethod2 != null ? String(row.triggerMethod2) : null,
|
|
|
- // 处理互斥开关
|
|
|
- isExclusive: row.isExclusive === '是' || row.isExclusive === true
|
|
|
+ console.log(row)
|
|
|
+ if(row){
|
|
|
+ console.log(Data.Filter)
|
|
|
+ const { triggerMethod, triggerMethod2, ruleName, roleMappingId, labelId, ...rest } = Data.Filter;
|
|
|
+ Data.Filter = { ...rest, ...row };
|
|
|
+ Data.Filter.triggerMethod = triggerMethod || Data.Filter.triggerMethod;
|
|
|
+ Data.Filter.triggerMethod2 = triggerMethod2 || Data.Filter.triggerMethod2;
|
|
|
+ Data.Filter.roleMappingId = roleMappingId || Data.Filter.roleMappingId;
|
|
|
+ Data.Filter.labelId = labelId || Data.Filter.labelId;
|
|
|
+ Data.Filter.ruleName = ruleName || Data.Filter.ruleName;
|
|
|
+
|
|
|
+ if (Data.Filter.isExclusive == '是') {
|
|
|
+ Data.Filter.isExclusive = true;
|
|
|
+ } else {
|
|
|
+ Data.Filter.isExclusive = false;
|
|
|
}
|
|
|
-
|
|
|
- // 处理推送方式
|
|
|
- const temp = (row.pushMethod || '').split(',')
|
|
|
- Data.radioValue1 = temp.includes('微信') || temp.includes('wx')
|
|
|
- Data.radioValue2 = temp.includes('电子邮箱') || temp.includes('email')
|
|
|
-
|
|
|
- // 处理模板选择
|
|
|
- if (row.pushTemplateMappingID) {
|
|
|
- Data.mode1 = templateData.wxList.find((item: { id: number; }) =>
|
|
|
- row.pushTemplateMappingID?.includes(item.id))?.id || ''
|
|
|
- Data.mode2 = templateData.emailList.find((item: { id: number; }) =>
|
|
|
- row.pushTemplateMappingID?.includes(item.id))?.id || ''
|
|
|
+ const temp = <string[]>Data.Filter.pushMethod?.split(',');
|
|
|
+ for (var i = 0; i < temp.length; i++) {
|
|
|
+ if (temp[i] == '微信') {
|
|
|
+ Data.radioValue1 = true;
|
|
|
+ } else if (temp[i] == '电子邮箱') {
|
|
|
+ Data.radioValue2 = true;
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- // 解析条件数据
|
|
|
- try {
|
|
|
- // 报警条件
|
|
|
- if (row.conditionsJson) {
|
|
|
- const parsed = typeof row.conditionsJson === 'string'
|
|
|
- ? JSON.parse(row.conditionsJson)
|
|
|
- : row.conditionsJson
|
|
|
- if (parsed && parsed.length) {
|
|
|
- Data.condition = [...parsed]
|
|
|
- Data.showAlarmConditions = true
|
|
|
+
|
|
|
+ // 如果有条件数据,解析并显示
|
|
|
+ // 解析报警条件
|
|
|
+ if (row.conditionsJson) {
|
|
|
+ try {
|
|
|
+ const alarmConditions = JSON.parse(row.conditionsJson);
|
|
|
+ if (alarmConditions && alarmConditions.length > 0) {
|
|
|
+ Data.condition = alarmConditions;
|
|
|
+ Data.showAlarmConditions = true;
|
|
|
}
|
|
|
+ } catch (e) {
|
|
|
+ console.error('解析报警条件JSON失败:', e);
|
|
|
}
|
|
|
-
|
|
|
- // 维修条件
|
|
|
- if (row.MaintenanceJson) {
|
|
|
- const parsed = typeof row.MaintenanceJson === 'string'
|
|
|
- ? JSON.parse(row.MaintenanceJson)
|
|
|
- : row.MaintenanceJson
|
|
|
- if (parsed && parsed.length) {
|
|
|
- Data.condition2 = [...parsed]
|
|
|
- Data.showRepairConditions = true
|
|
|
+ }
|
|
|
+
|
|
|
+ // 解析维修条件
|
|
|
+ if (row.MaintenanceJson) {
|
|
|
+ try {
|
|
|
+ const repairConditions = JSON.parse(row.MaintenanceJson);
|
|
|
+ if (repairConditions && repairConditions.length > 0) {
|
|
|
+ Data.condition2 = repairConditions;
|
|
|
+ Data.showRepairConditions = true;
|
|
|
}
|
|
|
+ } catch (e) {
|
|
|
+ console.error('解析维修条件JSON失败:', e);
|
|
|
}
|
|
|
- } catch (e) {
|
|
|
- console.error('解析条件失败:', e)
|
|
|
}
|
|
|
} else {
|
|
|
- // 新规则初始化
|
|
|
Data.Filter = {
|
|
|
ruleName: '',
|
|
|
roleMappingId: [],
|
|
@@ -668,11 +644,11 @@ const openDialog = (row: alarmRluesFilterModel) => {
|
|
|
conditionsJson: null,
|
|
|
MaintenanceJson: null,
|
|
|
pushUserid: []
|
|
|
- }
|
|
|
+ } as unknown as alarmRluesFilterModel;
|
|
|
}
|
|
|
-
|
|
|
- Data.isShowDialog = true
|
|
|
-}
|
|
|
+
|
|
|
+ Data.isShowDialog = true;
|
|
|
+};
|
|
|
|
|
|
defineExpose({
|
|
|
openDialog,
|