add:节日计划
This commit is contained in:
6
hx-ai-intelligent/src/api/planToAdd.ts
Normal file
6
hx-ai-intelligent/src/api/planToAdd.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export enum planToAddApi {
|
||||
getActivatedPlanTree = '/carbon-smart/deviceCtrlPlan/getActivatedPlanTree', //计划树
|
||||
getActivatedPlanListByTree = '/carbon-smart/deviceCtrlPlan/getActivatedPlanListByTree', //计划列表
|
||||
updPlan = '', //修改计划
|
||||
delPlan = '', //修改计划
|
||||
}
|
149
hx-ai-intelligent/src/view/equipmentControl/planToAdd/config.ts
Normal file
149
hx-ai-intelligent/src/view/equipmentControl/planToAdd/config.ts
Normal file
@@ -0,0 +1,149 @@
|
||||
import { planToAddApi } from '/@/api/planToAdd';
|
||||
import { ref } from 'vue';
|
||||
import { http } from '/nerv-lib/util';
|
||||
import { getEnum } from '/@/api';
|
||||
import { NsMessage } from '/nerv-lib/component';
|
||||
|
||||
export const tableConfig = (
|
||||
orgId: any,
|
||||
projectId: any,
|
||||
mainRef: any,
|
||||
nsModalFormConfig: any,
|
||||
modalFormRef: any,
|
||||
) => {
|
||||
return ref({
|
||||
title: '计划库',
|
||||
api: planToAddApi.getActivatedPlanListByTree,
|
||||
params: { orgId, projectId, deviceType: '1' },
|
||||
treeConfig: {
|
||||
defaultExpandAll: true,
|
||||
header: {
|
||||
icon: 'name',
|
||||
title: '执行计划',
|
||||
},
|
||||
params: { projectId, deviceType: '1' },
|
||||
dynamicParams: {
|
||||
id: 'id',
|
||||
pid: 'pid',
|
||||
level: 'level',
|
||||
projectId: 'projectId',
|
||||
deviceType: 'deviceType',
|
||||
},
|
||||
api: planToAddApi.getActivatedPlanTree,
|
||||
fieldNames: {
|
||||
title: 'name',
|
||||
key: 'id',
|
||||
pid: 'pid',
|
||||
level: 'level',
|
||||
projectId: 'projectId',
|
||||
deviceType: 'deviceType',
|
||||
children: 'childList',
|
||||
},
|
||||
formConfig: {
|
||||
schemas: [
|
||||
{
|
||||
field: 'deviceType',
|
||||
label: '告警优先级',
|
||||
component: 'nsSelectApi',
|
||||
autoSubmit: true,
|
||||
componentProps: {
|
||||
api: () => getEnum({ params: { enumType: 'CtrlDeviceType' } }),
|
||||
immediate: true,
|
||||
resultField: 'data',
|
||||
labelField: 'label',
|
||||
valueField: 'value',
|
||||
placeholder: '请选择告警优先级',
|
||||
showSearch: true,
|
||||
autoSelectFirst: true,
|
||||
filterOption: (input: string, option: any) => {
|
||||
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
rowSelection: null,
|
||||
columns: [
|
||||
{
|
||||
title: '执行顺序',
|
||||
dataIndex: 'address',
|
||||
width: 100,
|
||||
customRender: (text: any) => {
|
||||
return text.index + 1;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '计划类型',
|
||||
dataIndex: 'planGroupName',
|
||||
},
|
||||
{
|
||||
title: '计划名称',
|
||||
dataIndex: 'planName',
|
||||
},
|
||||
{
|
||||
title: '执行时间',
|
||||
dataIndex: 'executionTime',
|
||||
},
|
||||
],
|
||||
columnActions: {
|
||||
title: '操作',
|
||||
actions: [
|
||||
{
|
||||
label: '编辑',
|
||||
name: 'energyAlarmEdit',
|
||||
dynamicParams: ['uuid', 'appealType'],
|
||||
handle: (data: any) => {
|
||||
const obj = { ...data };
|
||||
nsModalFormConfig.value.title = '编辑';
|
||||
setTimeout(() => {
|
||||
nsModalFormConfig.value.data = {
|
||||
id: obj.id,
|
||||
};
|
||||
if (obj.startTime) {
|
||||
nsModalFormConfig.value.data.createTime = obj.startTime
|
||||
? [obj.startTime, obj.endTime]
|
||||
: [];
|
||||
}
|
||||
}, 1);
|
||||
modalFormRef.value?.toggle();
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
name: 'energyAlarmDel',
|
||||
dynamicParams: ['uuid', 'appealType'],
|
||||
confirm: true,
|
||||
handle: (data: any) => {
|
||||
http.post(planToAddApi.delPlan, { id: data.id, orgId: data.orgId }).then((res) => {
|
||||
if (res.msg === 'success') {
|
||||
NsMessage.success('操作成功');
|
||||
mainRef.value?.nsTableRef.reload();
|
||||
} else {
|
||||
NsMessage.error(res.msg);
|
||||
}
|
||||
});
|
||||
console.log(data, '删除');
|
||||
mainRef.value?.nsTableRef.reload();
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
formConfig: {
|
||||
schemas: [
|
||||
{
|
||||
field: 'planName',
|
||||
label: '计划标题',
|
||||
component: 'NsInput',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: '请输入计划关键字',
|
||||
},
|
||||
},
|
||||
],
|
||||
params: {},
|
||||
},
|
||||
// pagination: { pageSizeOptions: false },
|
||||
rowKey: 'uuid',
|
||||
});
|
||||
};
|
@@ -1,7 +1,83 @@
|
||||
<template> xxxxx </template>
|
||||
<template>
|
||||
<ns-view-list-table ref="mainRef" v-bind="config">
|
||||
<template #bodyCell="{ record, column }">
|
||||
<template v-if="column.dataIndex === 'executionTime'">
|
||||
{{ getData(record) }}
|
||||
</template>
|
||||
</template>
|
||||
</ns-view-list-table>
|
||||
<NsModalFrom ref="modalFormRef" v-bind="nsModalFormConfig" />
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref, onMounted, onUnmounted } from 'vue';
|
||||
|
||||
import { tableConfig } from './config';
|
||||
import { ref, onMounted } from 'vue';
|
||||
import NsModalFrom from '/@/components/ns-modal-form.vue';
|
||||
import { planToAddApi } from '/@/api/planToAdd';
|
||||
//页面 创建
|
||||
const orgId = ref('');
|
||||
const projectId = ref('');
|
||||
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
|
||||
orgId.value = result;
|
||||
const results = JSON.parse(sessionStorage.getItem('/hx-ai-intelligent/')!);
|
||||
projectId.value = results.projectId;
|
||||
const mainRef = ref(null);
|
||||
const modalFormRef = ref(null);
|
||||
const getData = (record: any) => {
|
||||
return record.startTime
|
||||
? record.startTime.substring(0, 10) + ' - ' + record.endTime.substring(0, 10)
|
||||
: '未配置时间';
|
||||
};
|
||||
const nsModalFormConfig = ref({
|
||||
api: planToAddApi.updPlan,
|
||||
data: {},
|
||||
title: '编辑',
|
||||
schemas: [
|
||||
{ field: 'id', component: 'NsInput', show: false },
|
||||
{ field: 'orgId', component: 'NsInput', show: false },
|
||||
{
|
||||
field: 'createTime',
|
||||
label: '执行时间',
|
||||
component: 'NsRangePicker',
|
||||
allowClear: true,
|
||||
fieldMap: ['startTime', 'endTime'],
|
||||
componentProps: {
|
||||
valueFormat: 'YYYY-MM-DD',
|
||||
placeholder: ['开始日期', '结束日期'],
|
||||
},
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择执行时间',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
extraModalConfig: {
|
||||
bodyStyle: { paddingBottom: 0 },
|
||||
},
|
||||
success: (data: any) => {
|
||||
console.log(data, '数据');
|
||||
mainRef.value?.nsTableRef.reload();
|
||||
},
|
||||
});
|
||||
//创建页面调用方法
|
||||
onMounted(() => {});
|
||||
onUnmounted(() => {});
|
||||
const config = tableConfig(
|
||||
orgId.value,
|
||||
projectId.value,
|
||||
mainRef,
|
||||
nsModalFormConfig,
|
||||
modalFormRef,
|
||||
);
|
||||
|
||||
defineOptions({
|
||||
name: 'LedgerIndex', // 与页面路由name一致缓存才可生效
|
||||
});
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
:deep(.ns-table-search),
|
||||
:deep(.ns-part-tree),
|
||||
:deep(.ns-table-main) {
|
||||
box-shadow: @ns-content-box-shadow;
|
||||
}
|
||||
</style>
|
||||
|
Reference in New Issue
Block a user