Browse Source

点位,材料

ops-management-platform-frontend-dev
wbc 2 months ago
parent
commit
c5ae9de3e9
  1. 5
      src/views/IO/delayPatrol/waitAudit/api.ts
  2. 20
      src/views/IO/delayPatrol/waitAudit/faultModal.vue
  3. 4
      src/views/IO/delayPatrol/waitPatrol/api.ts
  4. 35
      src/views/IO/delayPatrol/waitPatrol/data.ts
  5. 20
      src/views/IO/delayPatrol/waitPatrol/faultModal.vue
  6. 49
      src/views/IO/delayPatrol/waitPatrol/index.vue
  7. 2
      src/views/project/IOCheck/checkManage/data.ts
  8. 88
      src/views/project/contractManage/index.vue
  9. 68
      src/views/property/meterial/addModal.vue
  10. 48
      src/views/property/meterial/api.ts
  11. 2
      src/views/property/meterial/data.ts
  12. 146
      src/views/property/meterial/index.vue
  13. 105
      src/views/property/point/addModal.vue
  14. 9
      src/views/property/point/api.ts
  15. 18
      src/views/property/point/index.vue

5
src/views/IO/delayPatrol/waitAudit/api.ts

@ -6,6 +6,7 @@ enum Api {
getSubcategoryType = '/platform/subcategoryType/list', getSubcategoryType = '/platform/subcategoryType/list',
workOrderAdd = '/platform/workOrder/add', workOrderAdd = '/platform/workOrder/add',
getProjectInfo = '/platform/projectInfo/getNames', getProjectInfo = '/platform/projectInfo/getNames',
getOrganizationType = '/platform/organizationType/list',
} }
export function list(params:any) { export function list(params:any) {
@ -38,3 +39,7 @@ export function workOrderAdd(data: any) {
export function getProjectInfo() { export function getProjectInfo() {
return defHttp.get({ url: Api.getProjectInfo }); return defHttp.get({ url: Api.getProjectInfo });
} }
export function getOrganizationType() {
return defHttp.get({ url: Api.getOrganizationType });
}

20
src/views/IO/delayPatrol/waitAudit/faultModal.vue

@ -70,7 +70,15 @@
<a-row :gutter="[16, 16]"> <a-row :gutter="[16, 16]">
<a-col :span="12"> <a-col :span="12">
<a-form-item label="所属机构" name="organizationName"> <a-form-item label="所属机构" name="organizationName">
<a-input v-model:value="form.organizationName" /> <a-select
v-model:value="form.organizationName"
:options="organizationNameOptions"
:fieldNames="{
label: 'organizationName',
value: 'organizationName',
options: 'options',
}"
/>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12">
@ -138,7 +146,7 @@
<script> <script>
import { reactive, ref } from 'vue'; import { reactive, ref } from 'vue';
import { getInfo, getSubcategoryType, workOrderAdd,getProjectInfo } from './api'; import { getInfo, getSubcategoryType, workOrderAdd,getProjectInfo,getOrganizationType } from './api';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
import AMapLoader from '@amap/amap-jsapi-loader'; import AMapLoader from '@amap/amap-jsapi-loader';
export default { export default {
@ -168,7 +176,11 @@
const res = await getProjectInfo(); const res = await getProjectInfo();
projectNameOptions.value = res projectNameOptions.value = res
} }
const organizationNameOptions = ref([])
const getOrganizationNameOptions= async () =>{
const res = await getOrganizationType();
organizationNameOptions.value = res.rows
}
const responseLevelOptions = [ const responseLevelOptions = [
{ {
value: 0, value: 0,
@ -226,6 +238,7 @@
visible.value = true; visible.value = true;
getFaultSubcategoryOptions() getFaultSubcategoryOptions()
getProjectNameOptions() getProjectNameOptions()
getOrganizationNameOptions()
}; };
const handleOk = () => { const handleOk = () => {
@ -276,6 +289,7 @@
faultSubcategoryOptions, faultSubcategoryOptions,
faultLocationOptions, faultLocationOptions,
projectNameOptions, projectNameOptions,
organizationNameOptions,
faultLocationChange faultLocationChange
}; };
}, },

4
src/views/IO/delayPatrol/waitPatrol/api.ts

@ -6,6 +6,7 @@ enum Api {
getSubcategoryType = '/platform/subcategoryType/list', getSubcategoryType = '/platform/subcategoryType/list',
workOrderAdd = '/platform/workOrder/add', workOrderAdd = '/platform/workOrder/add',
getProjectInfo = '/platform/projectInfo/getNames', getProjectInfo = '/platform/projectInfo/getNames',
getOrganizationType = '/platform/organizationType/list',
} }
export function list(params:any) { export function list(params:any) {
@ -37,3 +38,6 @@ export function workOrderAdd(data: any) {
export function getProjectInfo() { export function getProjectInfo() {
return defHttp.get({ url: Api.getProjectInfo }); return defHttp.get({ url: Api.getProjectInfo });
} }
export function getOrganizationType() {
return defHttp.get({ url: Api.getOrganizationType });
}

35
src/views/IO/delayPatrol/waitPatrol/data.ts

@ -45,9 +45,34 @@ export const formSchemas: FormSchema[] = [
// }, // },
// }, // },
{ {
field: 'plaDate', field: '[scheduleStartDate, scheduleEndDate]',
label: '计划日期', label: '计划日期',
component: 'RangePicker', component: 'RangePicker',
componentProps: {
format: 'YYYY-MM-DD',
valueFormat:'YYYY-MM-DD'
},
},
{
field: 'status',
label: '状态',
component: 'Select',
componentProps: {
options:[
{
value: 0,
label:'未开始'
},
{
value: 1,
label:'进行中'
},
{
value: 2,
label:'已完成'
},
]
}
}, },
{ {
field: 'deliverContent', field: 'deliverContent',
@ -129,7 +154,13 @@ export const columns: BasicColumn[] = [
title: '状态', title: '状态',
dataIndex: 'status', dataIndex: 'status',
customRender: ({ value }) => { customRender: ({ value }) => {
return value == 0 ? '启用' : '禁用'; if (value == 0) {
return '未开始';
} else if (value == 1) {
return '进行中';
} else if (value == 2) {
return '已完成';
}
}, },
}, },
]; ];

20
src/views/IO/delayPatrol/waitPatrol/faultModal.vue

@ -70,7 +70,15 @@
<a-row :gutter="[16, 16]"> <a-row :gutter="[16, 16]">
<a-col :span="12"> <a-col :span="12">
<a-form-item label="所属机构" name="organizationName"> <a-form-item label="所属机构" name="organizationName">
<a-input v-model:value="form.organizationName" /> <a-select
v-model:value="form.organizationName"
:options="organizationNameOptions"
:fieldNames="{
label: 'organizationName',
value: 'organizationName',
options: 'options',
}"
/>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12">
@ -138,7 +146,7 @@
<script> <script>
import { reactive, ref } from 'vue'; import { reactive, ref } from 'vue';
import { getInfo, getSubcategoryType, workOrderAdd,getProjectInfo } from './api'; import { getInfo, getSubcategoryType, workOrderAdd,getProjectInfo,getOrganizationType } from './api';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
import AMapLoader from '@amap/amap-jsapi-loader'; import AMapLoader from '@amap/amap-jsapi-loader';
export default { export default {
@ -168,7 +176,11 @@
const res = await getProjectInfo(); const res = await getProjectInfo();
projectNameOptions.value = res projectNameOptions.value = res
} }
const organizationNameOptions = ref([])
const getOrganizationNameOptions= async () =>{
const res = await getOrganizationType();
organizationNameOptions.value = res.rows
}
const responseLevelOptions = [ const responseLevelOptions = [
{ {
value: 0, value: 0,
@ -226,6 +238,7 @@
visible.value = true; visible.value = true;
getFaultSubcategoryOptions() getFaultSubcategoryOptions()
getProjectNameOptions() getProjectNameOptions()
getOrganizationNameOptions()
}; };
const handleOk = () => { const handleOk = () => {
@ -276,6 +289,7 @@
faultSubcategoryOptions, faultSubcategoryOptions,
faultLocationOptions, faultLocationOptions,
projectNameOptions, projectNameOptions,
organizationNameOptions,
faultLocationChange faultLocationChange
}; };
}, },

49
src/views/IO/delayPatrol/waitPatrol/index.vue

@ -2,7 +2,10 @@
<PageWrapper dense> <PageWrapper dense>
<BasicTable @register="registerTable"> <BasicTable @register="registerTable">
<template #toolbar> <template #toolbar>
<a-button type="primary" @click="handleReport">上报</a-button> <a-button type="primary" @click="changeDate(3)">近三天</a-button>
<a-button type="primary" @click="changeDate(7)">近七天</a-button>
<a-button type="primary" @click="changeDate(30)">近一月</a-button>
<a-button type="primary" danger @click="handleReport">上报</a-button>
</template> </template>
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="column && record && column.key === 'action'"> <template v-if="column && record && column.key === 'action'">
@ -21,11 +24,11 @@
import { list } from './api'; import { list } from './api';
import { formSchemas, columns } from './data'; import { formSchemas, columns } from './data';
import detailDrawer from './detailDrawer.vue'; import detailDrawer from './detailDrawer.vue';
import { ref } from 'vue'; import { ref, onMounted } from 'vue';
import faultModal from './faultModal.vue' import faultModal from './faultModal.vue';
import dayjs from 'dayjs';
defineOptions({ name: 'WaitPatrol' }); defineOptions({ name: 'WaitPatrol' });
const [registerTable, { reload, getForm }] = useTable({
const [registerTable] = useTable({
rowSelection: { rowSelection: {
type: 'checkbox', type: 'checkbox',
}, },
@ -59,9 +62,39 @@
detailDrawerRef.value.showDrawer(); detailDrawerRef.value.showDrawer();
}; };
const faultModalRef = ref(); const faultModalRef = ref();
const handleReport = () =>{ const handleReport = () => {
faultModalRef.value.showModal() faultModalRef.value.showModal();
} };
let selectDateRange = ref<any>([]);
const changeDate = async (type: any) => {
const today = dayjs().format('YYYY-MM-DD');
const selectDay = dayjs().add(type, 'day').format('YYYY-MM-DD');
selectDateRange.value = [today, selectDay];
await getForm().setFieldsValue({
scheduleStartDate: today,
scheduleEndDate: selectDay,
});
reload();
localStorage.setItem(
'currentDate',
JSON.stringify({ scheduleStartDate: today, scheduleEndDate: selectDay }),
);
};
const beforDateSearch = async (date: any) => {
await getForm().setFieldsValue({
scheduleStartDate: date[0],
scheduleEndDate: date[1],
});
reload();
};
onMounted(async () => {
const currentDate = JSON.parse(localStorage.getItem('currentDate'));
console.log(currentDate)
await getForm().setFieldsValue({
scheduleStartDate: currentDate[0],
scheduleEndDate: currentDate[1],
});
});
</script> </script>
<style scoped></style> <style scoped></style>

2
src/views/project/IOCheck/checkManage/data.ts

@ -48,6 +48,6 @@ export const columns: BasicColumn[] = [
}, },
{ {
title: '创建日期', title: '创建日期',
dataIndex: 'createDate', dataIndex: 'createTime',
}, },
]; ];

88
src/views/project/contractManage/index.vue

@ -26,9 +26,9 @@
title="服务目录配置" title="服务目录配置"
@ok="serviceSubmit" @ok="serviceSubmit"
@cancel="closeService" @cancel="closeService"
width="30%" width="80%"
> >
<a-form :model="serviceForm" layout="vertical" :rules="serviceRules" ref="serviceRef"> <a-form :model="serviceForm" layout="vertical" :rules="serviceRules" ref="serviceRef" >
<a-row :gutter="[16, 16]"> <a-row :gutter="[16, 16]">
<a-col :span="24"> <a-col :span="24">
<a-form-item label="合同名称" name="contractId"> <a-form-item label="合同名称" name="contractId">
@ -64,26 +64,18 @@
</a-row> </a-row>
<a-row> <a-row>
<a-col :span="24"> <a-col :span="24">
<a-form-item label="目录名称" name="serviceProjectList"> <a-form-item label="自动生成" name="auto">
<a-select <a-switch v-model:checked="serviceForm.auto" />
v-model:value="serviceForm.serviceProjectList"
mode="multiple"
:options="serviceProjectOptions"
placeholder="请选择"
:fieldNames="{
value: 'id',
label: 'serviceProject',
options: 'options',
}"
/>
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
<a-row> <a-row>
<a-col :span="24"> <a-col :span="24">
<a-form-item label="自动生成" name="auto"> <a-table :columns="serviceColumns"
<a-switch v-model:checked="serviceForm.auto" /> :data-source="serviceProjectOptions"
</a-form-item> :row-selection="serviceRowSelection"
rowKey="id"
/>
</a-col> </a-col>
</a-row> </a-row>
</a-form> </a-form>
@ -163,6 +155,7 @@
const serviceSubmit = () => { const serviceSubmit = () => {
serviceRef.value.validate().then((valid: any) => { serviceRef.value.validate().then((valid: any) => {
if (valid) { if (valid) {
if(serviceForm.serviceProjectList&&serviceForm.serviceProjectList.length>0){
let params = { let params = {
contractId: serviceForm.contractId, contractId: serviceForm.contractId,
categoryId: serviceForm.categoryId, categoryId: serviceForm.categoryId,
@ -179,13 +172,16 @@
closeService(); closeService();
}); });
} }
}else{
message.warning('请选择服务协议')
}
} }
}); });
}; };
const serviceRules = { const serviceRules = {
contractId: [{ required: true, message: '请选择' }], contractId: [{ required: true, message: '请选择' }],
categoryId: [{ required: true, message: '请选择' }], categoryId: [{ required: true, message: '请选择' }],
serviceProjectList:[{ required: true, message: '请选择' }]
}; };
const addService = () => { const addService = () => {
serviceVisible.value = true; serviceVisible.value = true;
@ -194,6 +190,7 @@
const closeService = () => { const closeService = () => {
serviceVisible.value = false; serviceVisible.value = false;
serviceRef.value.resetFields() serviceRef.value.resetFields()
serviceForm.serviceProjectList = []
}; };
const contractOptions = ref([]); const contractOptions = ref([]);
const getContractOptions = () => { const getContractOptions = () => {
@ -217,6 +214,61 @@
getCategoryOptions(); getCategoryOptions();
getContractOptions(); getContractOptions();
}; };
//
const serviceColumns = [
{
title: '交付内容',
dataIndex: 'deliverContent',
key: 'deliverContent',
},
{
title: '服务项目',
dataIndex: 'serviceProject',
key: 'serviceProject',
},
{
title: '代码',
dataIndex: 'code',
key: 'code',
},
{
title: '服务内容',
dataIndex: 'serviceContent',
key: 'serviceContent',
},
{
title: '相应级别',
dataIndex: 'responseLevel',
key: 'responseLevel',
},
{
title: '服务频率',
dataIndex: 'frequency',
key: 'frequency',
},
{
title: '请求类型',
dataIndex: 'responseType',
key: 'responseType',
},
{
title: '交付方式',
dataIndex: 'deliverType',
key: 'deliverType',
},
{
title: '交付成果',
dataIndex: 'deliverResult',
key: 'deliverResult',
},
]
const serviceRowSelection = ref(
{
onChange:(selectedRowKeys:any,selectedRows:any)=>{
serviceForm.serviceProjectList = selectedRowKeys
}
}
)
</script> </script>
<style scoped></style> <style scoped></style>

68
src/views/property/meterial/addModal.vue

@ -1,6 +1,6 @@
<template> <template>
<a-modal v-model:open="visible" :title="title" @ok="handleOk" width="50%"> <a-modal v-model:open="visible" :title="title" @ok="handleOk" width="50%">
<a-form :model="form" layout="vertical"> <a-form :model="form" layout="vertical" ref="formRef" :rules="rules">
<a-row :gutter="[16, 16]"> <a-row :gutter="[16, 16]">
<a-col :span="24"> <a-col :span="24">
<a-form-item label="名称" name="name"> <a-form-item label="名称" name="name">
@ -56,7 +56,12 @@
<script> <script>
import { reactive, ref } from 'vue'; import { reactive, ref } from 'vue';
import { message } from 'ant-design-vue';
import {
getInfo,
add,
update,
} from './api';
export default { export default {
setup() { setup() {
const title = ref('新增'); const title = ref('新增');
@ -69,34 +74,74 @@
price: '', price: '',
amount: '', amount: '',
standards: '', standards: '',
projectId:null,
id:null
}); });
// //
const statusOptions = [ const statusOptions = [
{ {
value: 0, value: 0,
label: '用', label: '用',
}, },
{ {
value: 1, value: 1,
label: '用', label: '用',
}, },
]; ];
const showModal = (type, id) => { const showModal = async(type, id,projectId) => {
console.log(projectId)
visible.value = true;
if (type == 1) { if (type == 1) {
title.value = '新增'; title.value = '新增';
} else if (type == 2) { } else if (type == 2) {
title.value = '编辑'; title.value = '编辑';
console.log(id); const data = await getInfo(id);
for (let i in form) {
form[i] = data[i];
} }
visible.value = true; }
form.projectId = projectId
}; };
const handleOk = () => { const handleOk = () => {
console.log('Form Data:', form); formRef.value.validate().then((valid) => {
// if (valid) {
if (title.value == '新增') {
let params = {};
for (let i in form) {
params[i] = form[i];
}
add(params).then((_) => {
message.success('新增成功');
visible.value = false;
});
} else {
let params = {};
for (let i in form) {
params[i] = form[i];
}
update(params).then((_) => {
message.success('编辑成功');
visible.value = false;
});
}
}
});
};
const closeModal = () => {
formRef.value.resetFields();
visible.value = false; visible.value = false;
}; };
const formRef = ref()
const rules = {
name: [{ required: true, message: '请输入' }],
status: [{ required: true, message: '请选择' }],
remark: [{ required: true, message: '请输入' }],
unit: [{ required: true, message: '请输入' }],
price: [{ required: true, message: '请输入' }],
amount: [{ required: true, message: '请输入' }],
standards: [{ required: true, message: '请输入' }],
};
return { return {
visible, visible,
title, title,
@ -104,6 +149,9 @@
showModal, showModal,
handleOk, handleOk,
statusOptions, statusOptions,
closeModal,
formRef,
rules
}; };
}, },
}; };

48
src/views/property/meterial/api.ts

@ -1,58 +1,36 @@
import { ID, IDS, PageQuery, commonExport } from '@/api/base'; import { ID, IDS, commonExport } from '@/api/base';
import { defHttp } from '@/utils/http/axios'; import { defHttp } from '@/utils/http/axios';
import { Dayjs } from 'dayjs';
enum Api { enum Api {
root = '/workflow/leave', root = '/platform/matrialInfo',
list = '/workflow/leave/list', list = '/platform/matrialInfo/list',
tree = '/platform/projectCategoryPoint/queryAll',
export = '/workflow/leave/export', export = '/workflow/leave/export',
} }
export interface Leave { export function list(params: any) {
id: string; return defHttp.get({ url: Api.list, params });
leaveType: string;
startDate: string;
endDate: string;
leaveDays: number;
remark: string;
processInstanceVo?: any;
dateTime?: [string, string] | [Dayjs, Dayjs];
} }
export function tree() {
export interface Resp { return defHttp.get({ url: Api.tree });
createDept: number;
createBy: number;
createTime: string;
updateBy: number;
updateTime: string;
id: string;
leaveType: string;
startDate: string;
endDate: string;
leaveDays: number;
remark?: any;
}
export function list(params?: PageQuery) {
return defHttp.get<Leave[]>({ url: Api.list, params });
} }
export function exportExcel(data: any) { export function exportExcel(data: any) {
return commonExport(Api.export, data); return commonExport(Api.export, data);
} }
export function getInfo(id: ID) { export function getInfo(id: ID) {
return defHttp.get<Leave>({ url: `${Api.root}/${id}` }); return defHttp.get({ url: `${Api.root}/${id}` });
} }
export function add(data: any) { export function add(data: any) {
return defHttp.post<Resp>({ url: Api.root, data }); return defHttp.post({ url: Api.root, data });
} }
export function update(data: any) { export function update(data: any) {
return defHttp.put<Resp>({ url: Api.root, data }); return defHttp.put({ url: Api.root, data });
} }
export function removeByIds(ids: IDS) { export function removeByIds(ids: IDS) {
return defHttp.deleteWithMsg<void>({ url: `${Api.root}/${ids.join(',')}` }); return defHttp.deleteWithMsg({ url: `${Api.root}/${ids.join(',')}` });
} }

2
src/views/property/meterial/data.ts

@ -39,7 +39,7 @@ export const columns: BasicColumn[] = [
}, },
{ {
title: '创建日期', title: '创建日期',
dataIndex: 'createDate', dataIndex: 'createTime',
}, },
{ {
title: '备注', title: '备注',

146
src/views/property/meterial/index.vue

@ -2,28 +2,37 @@
<PageWrapper dense> <PageWrapper dense>
<a-row> <a-row>
<a-col :span="4" style="margin-top: 1%"> <a-col :span="4" style="margin-top: 1%">
<a-tree :show-line="true" :show-icon="true" :tree-data="treeData" @select="onSelect"> <a-tree
<template #title="{ dataRef }"> :show-icon="true"
<template v-if="dataRef.key === '0-0-0-1'"> :tree-data="treeData"
<div>multiple line title</div> v-model:selectedKeys="checkedTree"
<div>multiple line title</div> @select="onSelect"
</template> :fieldNames="{
<template v-else>{{ dataRef.title }}</template> children: 'children',
</template> title: 'projectName',
</a-tree> key: 'projectId',
disabled: 'disabled',
}"
/>
</a-col> </a-col>
<a-col :span="20"> <a-col :span="20">
<BasicTable @register="registerTable"> <BasicTable @register="registerTable">
<template #toolbar> <template #toolbar>
<a-button type="primary" @click="handleAdd">新增</a-button> <a-button type="primary" @click="handleAdd" v-if="checkedTree[0]">新增</a-button>
<a-button type="primary" @click="handleAdd">导入</a-button> <a-button type="primary">导入</a-button>
<a-button type="primary" @click="handleAdd">导出</a-button> <a-button type="primary">导出</a-button>
</template> </template>
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="column && record && column.key === 'action'"> <template v-if="column && record && column.key === 'action'">
<a-button type="link" @click="handleEdit(record.id)">编辑</a-button> <a-button type="link" @click="handleEdit(record.id)">编辑</a-button>
<a-button type="link" @click="handleDelete(record.id)">删除</a-button> <a-popconfirm
<a-button type="link" @click="handleEdit(record.id)">禁用/启用</a-button> title="确定要删除吗?"
ok-text="是"
cancel-text="否"
@confirm="handleDelete(record.id)"
>
<a-button type="link">删除</a-button>
</a-popconfirm>
</template> </template>
</template> </template>
</BasicTable> </BasicTable>
@ -36,12 +45,12 @@
<script setup lang="ts"> <script setup lang="ts">
import { PageWrapper } from '@/components/Page'; import { PageWrapper } from '@/components/Page';
import { BasicTable, useTable } from '@/components/Table'; import { BasicTable, useTable } from '@/components/Table';
import { list } from './api'; import { list, tree,removeByIds } from './api';
import { formSchemas, columns } from './data'; import { formSchemas, columns } from './data';
import addModal from './addModal.vue'; import addModal from './addModal.vue';
import { ref } from 'vue'; import { ref, onMounted } from 'vue';
defineOptions({ name: 'Meterial' }); defineOptions({ name: 'meterial' });
const [registerTable, { reload }] = useTable({ const [registerTable, { reload }] = useTable({
rowSelection: { rowSelection: {
@ -62,9 +71,16 @@
lg: 6, lg: 6,
}, },
}, },
beforeFetch(params: any) {
if (checkedTree.value.length === 1) {
params.projectId = checkedTree.value[0];
}
return params;
},
immediate: false,
columns: columns, columns: columns,
actionColumn: { actionColumn: {
width: 200, width: 300,
title: '操作', title: '操作',
key: 'action', key: 'action',
fixed: 'right', fixed: 'right',
@ -73,88 +89,36 @@
// //
const addModalRef = ref(); const addModalRef = ref();
const handleAdd = () => { const handleAdd = () => {
addModalRef.value.showModal(1); addModalRef.value.showModal(1, null, checkedTree.value[0]);
}; };
const handleEdit = (id: any) => { const handleEdit = (id: any) => {
addModalRef.value.showModal(2, id); addModalRef.value.showModal(2, id, checkedTree.value[0]);
}; };
const handleDelete = (id: any) => { const handleDelete = async (id: any) => {
addModalRef.value.showModal(2, id); await removeByIds([id]);
reload();
}; };
//tree //tree
const treeData = ref([ const checkedTree = ref([]);
{ const treeData = ref([]);
title: 'parent 1', const getTree = async () => {
key: '0-0', const res = await tree();
children: [ treeData.value = res;
{ treeData.value.forEach((i: any) => {
title: 'parent 1-0', i.disabled = true;
key: '0-0-0', });
children: [ console.log(res);
{ };
title: 'leaf',
key: '0-0-0-0',
},
{
key: '0-0-0-1',
},
{
title: 'leaf',
key: '0-0-0-2',
},
],
},
{
title: 'parent 1-1',
key: '0-0-1',
children: [
{
title: 'leaf',
key: '0-0-1-0',
},
],
},
{
title: 'parent 1-2',
key: '0-0-2',
children: [
{
title: 'leaf 1',
key: '0-0-2-0',
},
{
title: 'leaf 2',
key: '0-0-2-1',
},
],
},
],
},
{
title: 'parent 2',
key: '0-1',
children: [
{
title: 'parent 2-0',
key: '0-1-0',
children: [
{
title: 'leaf',
key: '0-1-0-0',
},
{
title: 'leaf',
key: '0-1-0-1',
},
],
},
],
},
]);
const onSelect = (selectedKeys: any, info: any) => { const onSelect = (selectedKeys: any, info: any) => {
console.log('selected', selectedKeys, info); console.log('selected', selectedKeys, info);
console.log(checkedTree.value);
reload(); reload();
}; };
onMounted(() => {
getTree();
});
//
</script> </script>
<style scoped></style> <style scoped></style>

105
src/views/property/point/addModal.vue

@ -1,6 +1,6 @@
<template> <template>
<a-modal v-model:open="visible" :title="title" @ok="handleOk" width="50%"> <a-modal v-model:open="visible" :title="title" @ok="handleOk" width="50%">
<a-form :model="form" layout="vertical"> <a-form :model="form" layout="vertical" ref="formRef" :rules="rules">
<a-row :gutter="[16, 16]"> <a-row :gutter="[16, 16]">
<a-col :span="24"> <a-col :span="24">
<a-form-item label="项目名称" name="projectName"> <a-form-item label="项目名称" name="projectName">
@ -8,6 +8,11 @@
v-model:value="form.projectName" v-model:value="form.projectName"
:options="projectNameOptions" :options="projectNameOptions"
placeholder="请选择" placeholder="请选择"
:fieldNames="{
label: 'projectName',
value: 'projectName',
options: 'options',
}"
/> />
</a-form-item> </a-form-item>
</a-col> </a-col>
@ -17,8 +22,12 @@
<a-form-item label="所属机构" name="organizationName"> <a-form-item label="所属机构" name="organizationName">
<a-select <a-select
v-model:value="form.organizationName" v-model:value="form.organizationName"
:options="projectNameOptions" :options="organizationNameOptions"
placeholder="请选择" :fieldNames="{
label: 'organizationName',
value: 'organizationName',
options: 'options',
}"
/> />
</a-form-item> </a-form-item>
</a-col> </a-col>
@ -57,7 +66,14 @@
<script> <script>
import { reactive, ref } from 'vue'; import { reactive, ref } from 'vue';
import { message } from 'ant-design-vue';
import {
getInfo,
add,
update,
getProjectInfo,
getOrganizationType
} from './api';
export default { export default {
setup() { setup() {
const title = ref('新增'); const title = ref('新增');
@ -69,38 +85,75 @@
maintenanceUnit: '', maintenanceUnit: '',
address: '', address: '',
pointName: '', pointName: '',
id:null
}); });
// //
const projectNameOptions = [ //
{ const projectNameOptions = ref([])
value: '1', const getProjectNameOptions= async () =>{
label: 'a', const res = await getProjectInfo();
}, projectNameOptions.value = res
{ }
value: '2', const organizationNameOptions = ref([])
label: 'b', const getOrganizationNameOptions= async () =>{
}, const res = await getOrganizationType();
{ organizationNameOptions.value = res.rows
value: '3', }
label: 'c', const showModal = async(type, id,projectId) => {
}, console.log(projectId)
]; visible.value = true;
const showModal = (type, id) => {
if (type == 1) { if (type == 1) {
title.value = '新增'; title.value = '新增';
} else if (type == 2) { } else if (type == 2) {
title.value = '编辑'; title.value = '编辑';
console.log(id); const data = await getInfo(id);
for (let i in form) {
form[i] = data[i];
} }
visible.value = true; }
form.projectId = projectId
getProjectNameOptions()
getOrganizationNameOptions()
}; };
const handleOk = () => { const handleOk = () => {
console.log('Form Data:', form); formRef.value.validate().then((valid) => {
// if (valid) {
if (title.value == '新增') {
let params = {};
for (let i in form) {
params[i] = form[i];
}
add(params).then((_) => {
message.success('新增成功');
visible.value = false;
});
} else {
let params = {};
for (let i in form) {
params[i] = form[i];
}
update(params).then((_) => {
message.success('编辑成功');
visible.value = false;
});
}
}
});
};
const closeModal = () => {
formRef.value.resetFields();
visible.value = false; visible.value = false;
}; };
const formRef = ref()
const rules = {
projectName: [{ required: true, message: '请选择' }],
organizationName: [{ required: true, message: '请选择' }],
remark: [{ required: true, message: '请输入' }],
maintenanceUnit: [{ required: true, message: '请输入' }],
address: [{ required: true, message: '请输入' }],
pointName: [{ required: true, message: '请输入' }],
};
return { return {
visible, visible,
title, title,
@ -108,6 +161,10 @@
showModal, showModal,
handleOk, handleOk,
projectNameOptions, projectNameOptions,
organizationNameOptions,
closeModal,
formRef,
rules
}; };
}, },
}; };

9
src/views/property/point/api.ts

@ -8,6 +8,8 @@ enum Api {
export = '/workflow/leave/export', export = '/workflow/leave/export',
getSubcategoryType = '/platform/subcategoryType/list', getSubcategoryType = '/platform/subcategoryType/list',
workOrderAdd = '/platform/workOrder/add', workOrderAdd = '/platform/workOrder/add',
getProjectInfo = '/platform/projectInfo/getNames',
getOrganizationType = '/platform/organizationType/list',
} }
export function list(params: any) { export function list(params: any) {
@ -42,3 +44,10 @@ export function getSubcategoryType() {
export function workOrderAdd(data: any) { export function workOrderAdd(data: any) {
return defHttp.post({ url: Api.workOrderAdd, data }); return defHttp.post({ url: Api.workOrderAdd, data });
} }
export function getProjectInfo() {
return defHttp.get({ url: Api.getProjectInfo });
}
export function getOrganizationType() {
return defHttp.get({ url: Api.getOrganizationType });
}

18
src/views/property/point/index.vue

@ -18,7 +18,7 @@
<a-col :span="20"> <a-col :span="20">
<BasicTable @register="registerTable"> <BasicTable @register="registerTable">
<template #toolbar> <template #toolbar>
<a-button type="primary" @click="handleAdd">新增</a-button> <a-button type="primary" @click="handleAdd" v-if="checkedTree[0]">新增</a-button>
<a-button type="primary">导入</a-button> <a-button type="primary">导入</a-button>
<a-button type="primary">点位导出</a-button> <a-button type="primary">点位导出</a-button>
@ -27,7 +27,14 @@
<template v-if="column && record && column.key === 'action'"> <template v-if="column && record && column.key === 'action'">
<a-button type="link" @click="showpointModal(record.id)">点位上报</a-button> <a-button type="link" @click="showpointModal(record.id)">点位上报</a-button>
<a-button type="link" @click="handleEdit(record.id)">编辑</a-button> <a-button type="link" @click="handleEdit(record.id)">编辑</a-button>
<a-button type="link" @click="handleDelete(record.id)">删除</a-button> <a-popconfirm
title="确定要删除吗?"
ok-text="是"
cancel-text="否"
@confirm="handleDelete(record.id)"
>
<a-button type="link">删除</a-button>
</a-popconfirm>
<a-button type="link" @click="handleDetail(record.id)">详情</a-button> <a-button type="link" @click="handleDetail(record.id)">详情</a-button>
</template> </template>
</template> </template>
@ -43,7 +50,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { PageWrapper } from '@/components/Page'; import { PageWrapper } from '@/components/Page';
import { BasicTable, useTable } from '@/components/Table'; import { BasicTable, useTable } from '@/components/Table';
import { list, tree } from './api'; import { list, tree,removeByIds} from './api';
import { formSchemas, columns } from './data'; import { formSchemas, columns } from './data';
import detailDrawer from './detailDrawer.vue'; import detailDrawer from './detailDrawer.vue';
import addModal from './addModal.vue'; import addModal from './addModal.vue';
@ -94,8 +101,9 @@
const handleEdit = (id: any) => { const handleEdit = (id: any) => {
addModalRef.value.showModal(2, id); addModalRef.value.showModal(2, id);
}; };
const handleDelete = (id: any) => { const handleDelete = async (id: any) => {
addModalRef.value.showModal(2, id); await removeByIds([id]);
reload();
}; };
// //
// //

Loading…
Cancel
Save