diff --git a/packages/screen/src/component/DetailInfoBox/DetailInfoBox.vue b/packages/screen/src/component/DetailInfoBox/DetailInfoBox.vue new file mode 100644 index 0000000..dc80f9a --- /dev/null +++ b/packages/screen/src/component/DetailInfoBox/DetailInfoBox.vue @@ -0,0 +1,103 @@ + + + \ No newline at end of file diff --git a/packages/screen/src/component/DynamicForm/DynamicForm.vue b/packages/screen/src/component/DynamicForm/DynamicForm.vue new file mode 100644 index 0000000..6df6571 --- /dev/null +++ b/packages/screen/src/component/DynamicForm/DynamicForm.vue @@ -0,0 +1,91 @@ + + + \ No newline at end of file diff --git a/packages/screen/src/component/MyDialog/index.vue b/packages/screen/src/component/MyDialog/index.vue index 37bcd0a..3384227 100644 --- a/packages/screen/src/component/MyDialog/index.vue +++ b/packages/screen/src/component/MyDialog/index.vue @@ -15,8 +15,8 @@ @@ -60,7 +60,7 @@ const props = defineProps({ }, onConfirmName: { type: String, - default: "确认", + default: "保存", }, onCancelName: { type: String, @@ -73,5 +73,13 @@ const normalizedComponent = computed(() => ); - \ No newline at end of file diff --git a/packages/screen/src/views/EquipmentManagement/addDialog.vue b/packages/screen/src/views/EquipmentManagement/addDialog.vue index 19c47d7..b6ad467 100644 --- a/packages/screen/src/views/EquipmentManagement/addDialog.vue +++ b/packages/screen/src/views/EquipmentManagement/addDialog.vue @@ -1,81 +1,103 @@ - - - - \ No newline at end of file diff --git a/packages/screen/src/views/EquipmentManagement/detailDialog.vue b/packages/screen/src/views/EquipmentManagement/detailDialog.vue index 202eda0..4db1af3 100644 --- a/packages/screen/src/views/EquipmentManagement/detailDialog.vue +++ b/packages/screen/src/views/EquipmentManagement/detailDialog.vue @@ -1,82 +1,268 @@ - \ No newline at end of file diff --git a/packages/screen/src/views/EquipmentManagement/index.js b/packages/screen/src/views/EquipmentManagement/index.js index ea1b30b..ace9c52 100644 --- a/packages/screen/src/views/EquipmentManagement/index.js +++ b/packages/screen/src/views/EquipmentManagement/index.js @@ -5,6 +5,7 @@ import DetailDialog from "./detailDialog.vue"; import EditDialog from "./editDialog.vue"; import AddDialog from "./addDialog.vue"; import { useRoute } from 'vue-router' +import { formatDate } from '../../../../shared/utils' const treeData = ref([]); const treeProps = { @@ -15,6 +16,7 @@ const treeProps = { const filterText = ref(''); // 树节点过滤条件 const tableData = ref([]); const qxmc = ref(''); // 区县名称 +const selectedYHZData = ref(null); // 被选中的养护站数据 const yhzid = ref(''); // 养护站id const filterData = reactive({ sbmc: '', @@ -44,6 +46,7 @@ const model = reactive({ }); // 弹窗内容 const dialogType = ref(''); // 弹窗类型 const dialogRef = ref(null); // 弹窗实例 +const detailDialogRef = ref(null); // 详情信息弹窗 const INIT_FORM = { rid: "", @@ -109,7 +112,12 @@ const getTreeData = async () => { children: qx.yhzList.map(site => ({ id: site.id, name: `${site.mc}(${site.sbsl})`, - type: 'site' + type: 'site', + qxmc: qx.qxmc, + rawName: site.mc, + jd: site.jd, + wd: site.wd, + sbwz: qx.qxmc })), rawName: qx.qxmc, // 原始名称 }) @@ -130,18 +138,21 @@ const handleNodeClick = (data, node) => { console.log('树节点关闭', node.expanded) yhzid.value = ''; // 重置养护站id qxmc.value = ''; // 重置区县名称 + selectedYHZData.value = null; return; } if (data.type === 'area') { console.log('你点击的是区县', data.id) yhzid.value = ''; // 重置养护站id qxmc.value = data.id; // 保存区县名称 + selectedYHZData.value = null } if (data.type === 'site') { console.log('你点击的是站点', data.name) yhzid.value = data.id; // 保存养护站id qxmc.value = ''; // 重置区县名称 + selectedYHZData.value = data } }; @@ -205,6 +216,11 @@ const columns = [ { prop: 'gzrq', label: '购置日期', + width: 160, + render: (row) => { + const el = h('span', null, [row.gzrq ? formatDate(row.gzrq) : '']) + return el + } }, { prop: 'gmfy', @@ -214,6 +230,14 @@ const columns = [ prop: 'qxmc', label: '所属区县', }, + { + label: '上传时间', + width: 160, + render: (row) => { + const el = h('span', null, [row.tjsj ? formatDate(row.tjsj) : '']) + return el + } + }, { label: "操作", fixed: "right", @@ -232,18 +256,18 @@ const columns = [ }, () => "详情" ), - h( - ElButton, - { - type: "primary", - link: true, - onClick: async () => { - dialogType.value = 'edit' - await getDetailData(row); - }, - }, - () => "编辑" - ), + // h( + // ElButton, + // { + // type: "primary", + // link: true, + // onClick: async () => { + // dialogType.value = 'edit' + // await getDetailData(row); + // }, + // }, + // () => "编辑" + // ), h( ElButton, { @@ -317,20 +341,9 @@ const getDetailData = async (row) => { } if (res.code === '00000') { if (dialogType.value === 'detail') { - model.title = `设备详情`; - model.content = DetailDialog; - model.props = { - detailData: res.data.equipment, - }; - model.onCancel = () => { - dialogType.value = ''; - modelVisible.value = false; - }; - model.onConfirm = () => { - dialogType.value = ''; - modelVisible.value = false; - }; - modelVisible.value = true; + // 打开详情 + detailDialogRef.value.showDialog(res.data) + } if (dialogType.value === 'edit') { model.title = `编辑设备`; @@ -365,8 +378,16 @@ const getDetailData = async (row) => { const openAddEquipmentModel = () => { model.title = `新增设备`; model.content = AddDialog; - Object.assign(form, INIT_FORM); + const extraData = { + jd: selectedYHZData.value.jd, + wd: selectedYHZData.value.wd, + yhzid: selectedYHZData.value.id, + qxmc: selectedYHZData.value.qxmc, + sbwz: selectedYHZData.value.sbwz, + } + Object.assign(form, INIT_FORM, extraData); model.props = { + yhzData: selectedYHZData, detailData: {}, form: form, }; @@ -380,7 +401,9 @@ const openAddEquipmentModel = () => { const res = await request({ url: '/snow-ops-platform/yjsb/add', method: 'POST', - data: toRaw(form), + data: { + equipment: toRaw(form) + }, }); if (res.code === '00000') { ElMessage.success('新增成功'); @@ -457,7 +480,7 @@ export default () => { await getTreeData(); await getyhzsbList(); const rowData = (decodeURIComponent(route.params.data)); - if (rowData !== 'undefined' && rowData!== 'null' && rowData !== '' ) { + if (rowData !== 'undefined' && rowData !== 'null' && rowData !== '') { const JSONData = JSON.parse(rowData); filterText.value = JSONData.mc; }; @@ -478,5 +501,8 @@ export default () => { dialogRef, model, openAddEquipmentModel, + + selectedYHZData, + detailDialogRef } } \ No newline at end of file diff --git a/packages/screen/src/views/EquipmentManagement/index.vue b/packages/screen/src/views/EquipmentManagement/index.vue index bec07ff..56ccd75 100644 --- a/packages/screen/src/views/EquipmentManagement/index.vue +++ b/packages/screen/src/views/EquipmentManagement/index.vue @@ -50,6 +50,7 @@
+ +