add:设备告警网关告警对接 接口
This commit is contained in:
@@ -0,0 +1,170 @@
|
||||
<template>
|
||||
<ns-drawer
|
||||
v-model:visible="visible"
|
||||
width="550"
|
||||
:title="' '"
|
||||
:footer-style="{ textAlign: 'right' }"
|
||||
:ok="btnClick"
|
||||
:cancel="handleClose"
|
||||
placement="right"
|
||||
@close="handleClose">
|
||||
<a-tabs>
|
||||
<a-tab-pane key="1" tab="更新状态">
|
||||
<div style="width: 100%; padding: 24px">
|
||||
<a-form ref="formRef" :model="infoObject">
|
||||
<a-form-item ref="state" label="当前状态" name="state">
|
||||
<a-select
|
||||
v-model:value="infoObject.state"
|
||||
show-search
|
||||
placeholder="请选择当前状态"
|
||||
style="width: 85%"
|
||||
:options="stateOptions"
|
||||
:disabled="showEdit" />
|
||||
<ns-icon
|
||||
size="20"
|
||||
@click="changeShowEdit"
|
||||
style="margin-left: 20px"
|
||||
:name="showEdit ? 'bianji' : 'baocun'" />
|
||||
</a-form-item>
|
||||
<a-form-item label="备注" name="remarks">
|
||||
<a-textarea
|
||||
v-model:value="infoObject.remarks"
|
||||
placeholder="请输入异常描述"
|
||||
:disabled="showEdit"
|
||||
style="width: 85%"
|
||||
:autoSize="{ minRows: 4, maxRows: 4 }" />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</div>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="2" tab="状态流程">
|
||||
<!-- 自动生成工单 -->
|
||||
<div v-if="infoObject.createWorkOrder === 1"> xxxx </div>
|
||||
<!-- 没有自动生成工单 -->
|
||||
<NsSteps v-else v-bind="config" />
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
<template #footer>
|
||||
<a-button type="primary" @click="btnClick">确定</a-button>
|
||||
</template>
|
||||
</ns-drawer>
|
||||
</template>
|
||||
<script>
|
||||
import { defineComponent } from 'vue';
|
||||
import { ref } from 'vue';
|
||||
import NsSteps from '/@/components/ns-steps.vue';
|
||||
import { NsMessage } from '/nerv-lib/component';
|
||||
import { http } from '/nerv-lib/util';
|
||||
import { energyAlarmApi } from '/@/api/alarmManagement/energyAlarm';
|
||||
|
||||
export default defineComponent({
|
||||
components: { NsSteps },
|
||||
|
||||
setup(props, { emit }) {
|
||||
const visible = ref(false);
|
||||
const showEdit = ref(true);
|
||||
const infoObject = ref({});
|
||||
const equipmentAlarm = ref({});
|
||||
const stateOptions = ref();
|
||||
const logList = ref([]);
|
||||
const config = ref({
|
||||
size: logList.value.length,
|
||||
dataSource: logList.value,
|
||||
});
|
||||
const handleClose = () => {
|
||||
showEdit.value = true;
|
||||
equipmentAlarm.value = {};
|
||||
infoObject.value = {};
|
||||
visible.value = false;
|
||||
};
|
||||
const btnClick = () => {
|
||||
delete infoObject.value.createTime;
|
||||
infoObject.value.alarmEquipmentLogId = equipmentAlarm.value.id;
|
||||
if (equipmentAlarm.value.createWorkOrder === 0) {
|
||||
http.post(energyAlarmApi.noCreatOrUpdateLog, infoObject.value).then((res) => {
|
||||
if (res.msg === 'success') {
|
||||
NsMessage.success('操作成功');
|
||||
showEdit.value = true;
|
||||
equipmentAlarm.value = {};
|
||||
infoObject.value = {};
|
||||
visible.value = false;
|
||||
emit('logAdd', null);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
//修改状态
|
||||
const changeShowEdit = () => {
|
||||
// 未生成工单
|
||||
if (equipmentAlarm.value.createWorkOrder === 0) {
|
||||
showEdit.value = !showEdit.value;
|
||||
}
|
||||
};
|
||||
const toggle = async (data) => {
|
||||
equipmentAlarm.value = { ...data };
|
||||
visible.value = true;
|
||||
if (equipmentAlarm.value.createWorkOrder === 1) {
|
||||
stateOptions.value = [
|
||||
{ value: 1, label: '待处理' },
|
||||
{ value: 2, label: '处理中' },
|
||||
{ value: 3, label: '已完成' },
|
||||
{ value: 4, label: '超时' },
|
||||
{ value: 5, label: '已关闭' },
|
||||
];
|
||||
} else {
|
||||
stateOptions.value = [
|
||||
{ value: 1, label: '待处理' },
|
||||
{ value: 2, label: '处理中' },
|
||||
{ value: 3, label: '已完成' },
|
||||
{ value: 5, label: '已关闭' },
|
||||
];
|
||||
}
|
||||
console.log(data, 'data');
|
||||
await http
|
||||
.post(energyAlarmApi.getSelectAlarmEquipmentLogStatusProcess, {
|
||||
alarmEquipmentLogId: data.id,
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.msg === 'success') {
|
||||
logList.value = res.data;
|
||||
infoObject.value = { ...logList.value[0] };
|
||||
infoObject.value.state = infoObject.value.state.value;
|
||||
let colorMap = {
|
||||
1: '#ff7602',
|
||||
2: '#00a1e6',
|
||||
3: '#04d919',
|
||||
4: '#d9001b',
|
||||
5: '#a6a6a6',
|
||||
};
|
||||
logList.value.forEach((item) => {
|
||||
item.stateName = item.state.label;
|
||||
item.color = colorMap[item.state.value];
|
||||
item.src = 'state-' + item.state.value;
|
||||
});
|
||||
config.value.dataSource = logList.value;
|
||||
}
|
||||
});
|
||||
};
|
||||
return {
|
||||
infoObject,
|
||||
changeShowEdit,
|
||||
showEdit,
|
||||
equipmentAlarm,
|
||||
stateOptions,
|
||||
btnClick,
|
||||
visible,
|
||||
logList,
|
||||
config,
|
||||
handleClose,
|
||||
toggle,
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
<style scoped lang="less">
|
||||
:deep(.ant-form-item-label) {
|
||||
z-index: 20;
|
||||
text-align: right;
|
||||
width: 17%;
|
||||
}
|
||||
</style>
|
Reference in New Issue
Block a user