|
@@ -78,7 +78,13 @@ export const columns: BasicColumn[] = [
|
|
|
dataIndex: 'fireAlarm',
|
|
dataIndex: 'fireAlarm',
|
|
|
width: 100,
|
|
width: 100,
|
|
|
customRender({ record }) {
|
|
customRender({ record }) {
|
|
|
- return tagCellRender(record.fireAlarm);
|
|
|
|
|
|
|
+ const riskMap = {
|
|
|
|
|
+ '1': '低风险',
|
|
|
|
|
+ '2': '一般风险',
|
|
|
|
|
+ '3': '较高风险',
|
|
|
|
|
+ '4': '高风险',
|
|
|
|
|
+ };
|
|
|
|
|
+ return alarmCellRender(record.fireAlarm, (r) => riskMap[r.alarmName] || r.alarmName);
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
@@ -86,7 +92,8 @@ export const columns: BasicColumn[] = [
|
|
|
dataIndex: 'leakageAlarm',
|
|
dataIndex: 'leakageAlarm',
|
|
|
width: 100,
|
|
width: 100,
|
|
|
customRender({ record }) {
|
|
customRender({ record }) {
|
|
|
- return tagCellRender(record.leakageAlarm);
|
|
|
|
|
|
|
+ // return alarmTextRender(record.leakageAlarm?.alarmLevel, record.leakageAlarm?.split('-')[0]);
|
|
|
|
|
+ return alarmCellRender(record.leakageAlarm, (r) => r.alarmName.split('-')[1]);
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
@@ -94,7 +101,13 @@ export const columns: BasicColumn[] = [
|
|
|
dataIndex: 'sourcePressureAlarm',
|
|
dataIndex: 'sourcePressureAlarm',
|
|
|
width: 100,
|
|
width: 100,
|
|
|
customRender({ record }) {
|
|
customRender({ record }) {
|
|
|
- return tagCellRender(record.sourcePressureAlarm);
|
|
|
|
|
|
|
+ const riskMap = {
|
|
|
|
|
+ '1': '低风险',
|
|
|
|
|
+ '2': '一般风险',
|
|
|
|
|
+ '3': '较高风险',
|
|
|
|
|
+ '4': '高风险',
|
|
|
|
|
+ };
|
|
|
|
|
+ return alarmCellRender(record.sourcePressureAlarm, (r) => riskMap[r.alarmName] || r.alarmName);
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
@@ -102,7 +115,7 @@ export const columns: BasicColumn[] = [
|
|
|
dataIndex: 'unsealAlarm',
|
|
dataIndex: 'unsealAlarm',
|
|
|
width: 100,
|
|
width: 100,
|
|
|
customRender({ record }) {
|
|
customRender({ record }) {
|
|
|
- return tagCellRender(record.unsealAlarm);
|
|
|
|
|
|
|
+ return alarmCellRender(record.unsealAlarm);
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
// {
|
|
// {
|
|
@@ -505,19 +518,28 @@ export const treeData: TreeItem[] = [
|
|
|
|
|
|
|
|
function getTagType(level: string) {
|
|
function getTagType(level: string) {
|
|
|
switch (level) {
|
|
switch (level) {
|
|
|
- case '1':
|
|
|
|
|
- return 'red';
|
|
|
|
|
- case '2':
|
|
|
|
|
- return 'volcano';
|
|
|
|
|
- case '3':
|
|
|
|
|
- return 'orange';
|
|
|
|
|
case '4':
|
|
case '4':
|
|
|
- return 'success';
|
|
|
|
|
|
|
+ return '#f5222d';
|
|
|
|
|
+ case '3':
|
|
|
|
|
+ return '#fa5914';
|
|
|
|
|
+ case '2':
|
|
|
|
|
+ return '#faad14';
|
|
|
|
|
+ case '1':
|
|
|
|
|
+ return '#208840';
|
|
|
default:
|
|
default:
|
|
|
- return 'default';
|
|
|
|
|
|
|
+ return 'inhert';
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-export function tagCellRender(record: any) {
|
|
|
|
|
- if (!record) return h(Tag, { bordered: false, color: 'default' }, () => '-');
|
|
|
|
|
- return h(Tag, { bordered: false, color: getTagType(record.alarmLevel) }, () => record.alarmName);
|
|
|
|
|
|
|
+
|
|
|
|
|
+export function alarmCellRender(
|
|
|
|
|
+ record: any,
|
|
|
|
|
+ valFn: (record: any) => string = (r) => r.alarmName,
|
|
|
|
|
+ lvFn: (record: any) => string = (r) => r.alarmLevel
|
|
|
|
|
+) {
|
|
|
|
|
+ // if (!record) return h(Tag, { bordered: false, color: 'default' }, () => '-');
|
|
|
|
|
+ // return h(Tag, { bordered: false, color: getTagType(record.alarmLevel) }, () => record.alarmName);
|
|
|
|
|
+ if (!record) return h('span', '-');
|
|
|
|
|
+ const val = valFn(record);
|
|
|
|
|
+ const lv = lvFn(record);
|
|
|
|
|
+ return h('span', { style: { color: getTagType(lv) } }, val);
|
|
|
}
|
|
}
|