Files
SaaS-lib/hx-ai-intelligent/src/view/equipmentControl/planToAdd/index.vue

89 lines
2.5 KiB
Vue
Raw Normal View History

2024-08-09 15:44:09 +08:00
<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>
2024-08-09 15:44:09 +08:00
import { tableConfig } from './config';
import { ref, onMounted } from 'vue';
import NsModalFrom from '/@/components/ns-modal-form.vue';
import { planToAddApi } from '/@/api/planToAdd';
2024-08-09 16:23:06 +08:00
import { NsMessage } from '/nerv-lib/component';
2024-08-09 15:44:09 +08:00
//页面 创建
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
2024-08-09 16:23:06 +08:00
? record.startTime.substring(0, 10) + ' - ' + record.endTime.substring(0, 10)
2024-08-09 15:44:09 +08:00
: '未配置时间';
};
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: {
2024-08-09 16:23:06 +08:00
valueFormat: 'YYYY-MM-DD hh:mm:ss',
2024-08-09 15:44:09 +08:00
placeholder: ['开始日期', '结束日期'],
},
rules: [
{
required: true,
message: '请选择执行时间',
},
],
},
],
extraModalConfig: {
bodyStyle: { paddingBottom: 0 },
},
success: (data: any) => {
2024-08-09 16:23:06 +08:00
if (data.msg === 'success') {
mainRef.value?.nsTableRef.reload();
} else {
NsMessage.error(data.msg);
}
2024-08-09 15:44:09 +08:00
},
});
//创建页面调用方法
onMounted(() => {});
2024-08-09 15:44:09 +08:00
const config = tableConfig(
orgId.value,
projectId.value,
mainRef,
nsModalFormConfig,
modalFormRef,
);
defineOptions({
name: 'LedgerIndex', // 与页面路由name一致缓存才可生效
});
</script>
2024-08-09 15:44:09 +08:00
<style lang="less" scoped>
:deep(.ns-table-search),
:deep(.ns-part-tree),
:deep(.ns-table-main) {
box-shadow: @ns-content-box-shadow;
}
</style>