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