|
|
@ -1,12 +1,33 @@ |
|
|
|
<template> |
|
|
|
<ns-view-list-table ref="mainRef" v-bind="config"> |
|
|
|
<template #bodyCell="{ record, column }"> |
|
|
|
<template v-if="column.dataIndex === 'executionTime'"> |
|
|
|
{{ getData(record) }} |
|
|
|
<div style="width: 100%; height: 100%; position: relative"> |
|
|
|
<ns-view-list-table ref="mainRef" v-bind="config"> |
|
|
|
<template #bodyCell="{ record, column }"> |
|
|
|
<template v-if="column.dataIndex === 'executionTime'"> |
|
|
|
{{ getData(record) }} |
|
|
|
</template> |
|
|
|
<template v-if="column.dataIndex === 'executeStatus'"> |
|
|
|
<div |
|
|
|
:style="{ |
|
|
|
color: { |
|
|
|
'0': '#ccc', |
|
|
|
'1': 'rgba(255, 165, 0, 1)', |
|
|
|
'2': 'rgb(57, 215, 187)', |
|
|
|
'3': 'rgb(255, 0, 0)', |
|
|
|
}[record.executeStatus.value], |
|
|
|
}"> |
|
|
|
{{ record.executeStatus.label }}</div |
|
|
|
> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</ns-view-list-table> |
|
|
|
<NsModalFrom ref="modalFormRef" v-bind="nsModalFormConfig" /> |
|
|
|
</ns-view-list-table> |
|
|
|
<a-button |
|
|
|
type="primary" |
|
|
|
style="position: absolute; bottom: 20px; height: 30px; left: 13%" |
|
|
|
@click="addPlan" |
|
|
|
>添加</a-button |
|
|
|
> |
|
|
|
<NsModalFrom ref="modalFormRef" v-bind="nsModalFormConfig" /> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
<script lang="ts" setup> |
|
|
|
import { ref, onMounted } from 'vue'; |
|
|
@ -14,6 +35,7 @@ |
|
|
|
import { planToAddApi } from '/@/api/planToAdd'; |
|
|
|
import { NsMessage } from '/nerv-lib/component'; |
|
|
|
import { getEnum } from '/@/api'; |
|
|
|
import { http } from '/nerv-lib/util'; |
|
|
|
|
|
|
|
//页面 创建 |
|
|
|
const orgId = ref(''); |
|
|
@ -24,6 +46,24 @@ |
|
|
|
projectId.value = results.projectId; |
|
|
|
const mainRef = ref(null); |
|
|
|
const modalFormRef = ref(null); |
|
|
|
const addPlan = () => { |
|
|
|
if (mainRef.value.nsTableRef.treeElRef.selectedRow.node.planLib) { |
|
|
|
http |
|
|
|
.get(planToAddApi.addPlan, { |
|
|
|
libId: mainRef.value.nsTableRef.treeElRef.selectedRow.node.planLib.id, |
|
|
|
}) |
|
|
|
.then((res) => { |
|
|
|
if (res.msg === 'success') { |
|
|
|
NsMessage.success('添加成功'); |
|
|
|
mainRef.value?.nsTableRef.reload(); |
|
|
|
} else { |
|
|
|
NsMessage.error(res.msg); |
|
|
|
} |
|
|
|
}); |
|
|
|
} else { |
|
|
|
NsMessage.warning('只有最后一级才能添加'); |
|
|
|
} |
|
|
|
}; |
|
|
|
const getData = (record: any) => { |
|
|
|
return record.startTime |
|
|
|
? record.startTime.substring(0, 10) + ' - ' + record.endTime.substring(0, 10) |
|
|
@ -67,8 +107,6 @@ |
|
|
|
success: (data: any) => { |
|
|
|
if (data.msg === 'success') { |
|
|
|
mainRef.value?.nsTableRef.reload(); |
|
|
|
} else { |
|
|
|
NsMessage.error(data.msg); |
|
|
|
} |
|
|
|
}, |
|
|
|
}); |
|
|
@ -81,7 +119,7 @@ |
|
|
|
config.value = { |
|
|
|
title: '计划库', |
|
|
|
api: planToAddApi.getActivatedPlanListByTree, |
|
|
|
params: { orgId, projectId, ctrlType: enumData.data[0].value }, |
|
|
|
params: { orgId, projectId }, |
|
|
|
treeConfig: { |
|
|
|
defaultExpandAll: true, |
|
|
|
header: { |
|
|
@ -90,20 +128,13 @@ |
|
|
|
}, |
|
|
|
params: { projectId, ctrlType: enumData.data[0].value }, |
|
|
|
dynamicParams: { |
|
|
|
id: 'id', |
|
|
|
pid: 'pid', |
|
|
|
level: 'level', |
|
|
|
projectId: 'projectId', |
|
|
|
ctrlType: 'ctrlType', |
|
|
|
treeId: 'id', |
|
|
|
}, |
|
|
|
api: planToAddApi.getActivatedPlanTree, |
|
|
|
fieldNames: { |
|
|
|
title: 'name', |
|
|
|
key: 'id', |
|
|
|
pid: 'pid', |
|
|
|
level: 'level', |
|
|
|
projectId: 'projectId', |
|
|
|
ctrlType: 'ctrlType', |
|
|
|
children: 'childList', |
|
|
|
}, |
|
|
|
formConfig: { |
|
|
@ -151,6 +182,10 @@ |
|
|
|
dataIndex: 'planName', |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '执行状态', |
|
|
|
dataIndex: 'executeStatus', |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '执行时间', |
|
|
|
dataIndex: 'executionTime', |
|
|
|
}, |
|
|
@ -166,9 +201,8 @@ |
|
|
|
name: 'energyAlarmEdit', |
|
|
|
dynamicParams: ['uuid', 'appealType'], |
|
|
|
handle: (data: any) => { |
|
|
|
console.log(mainRef.value, '数据'); |
|
|
|
if (data?.executeStatus?.value === 2) { |
|
|
|
NsMessage.warning('当前计划正在执行,无法进行编辑。如需编辑,请先停止计划.'); |
|
|
|
NsMessage.warning('当前计划正在执行,无法进行编辑。如需编辑,请先停止计划。'); |
|
|
|
} else { |
|
|
|
const obj = { ...data }; |
|
|
|
nsModalFormConfig.value.title = '编辑'; |
|
|
@ -192,7 +226,7 @@ |
|
|
|
dynamicParams: ['uuid', 'appealType'], |
|
|
|
confirm: true, |
|
|
|
handle: (data: any) => { |
|
|
|
http.post(planToAddApi.updPlan, [data.id]).then((res) => { |
|
|
|
http.post(planToAddApi.delPlan, [data.id]).then((res) => { |
|
|
|
if (res.msg === 'success') { |
|
|
|
NsMessage.success('操作成功'); |
|
|
|
mainRef.value?.nsTableRef.reload(); |
|
|
|