gemercheung 1 год назад
Родитель
Сommit
f5612dff42

+ 1 - 0
src/views/bulletin/decoration.vue

@@ -7,6 +7,7 @@
       </template>
       <template #action>
         <TableAction
+          centered
           :actions="[
             {
               icon: 'clarity:note-edit-line',

+ 28 - 7
src/views/map/addProjectModal.vue

@@ -8,6 +8,9 @@
             <a-button type="default" @click="$emit('open-map')">地图选择</a-button>
           </div>
         </template>
+        <!-- <template #isShow="{ record }">
+          <Switch v-model:checked="record.isShow" />
+        </template> -->
         <!-- <template #label="{ model, field }">
           {{ model[field] }}
         </template>
@@ -23,6 +26,7 @@
   import { BasicModal, useModalInner } from '/@/components/Modal';
   import { BasicForm, FormSchema, useForm } from '/@/components/Form/index';
   import { useI18n } from '/@/hooks/web/useI18n';
+  import { AddOptOrUpdateApi } from '/@/api/mapOpt/list';
 
   const { t } = useI18n();
   const schemas: FormSchema[] = [
@@ -30,6 +34,7 @@
       field: 'projectName',
       label: '项目名称',
       component: 'Input',
+      required: true,
       colProps: {
         span: 24,
       },
@@ -37,6 +42,7 @@
     {
       field: 'projectSn',
       label: '项目编号',
+      required: true,
       component: 'Input',
       colProps: {
         span: 24,
@@ -46,6 +52,7 @@
       field: 'location',
       label: '位置',
       component: 'Input',
+      required: false,
       slot: 'location',
       colProps: {
         span: 24,
@@ -55,12 +62,10 @@
       field: 'isShow',
       label: '是否展示',
       component: 'Switch',
+      defaultValue: true,
       colProps: {
         span: 24,
       },
-      componentProps: {
-        defaultChecked: true,
-      },
     },
   ];
 
@@ -74,15 +79,15 @@
         }>,
       },
     },
-    emits: ['register', 'success', 'open-map'],
-    setup(props) {
+    emits: ['register', 'success', 'open-map', 'reload'],
+    setup(props, { emit }) {
       // const { createMessage } = useMessage();
       const sceneNum = ref('');
       const location = computed(() =>
         props.currentLatLng ? `${props.currentLatLng?.lat}, ${props.currentLatLng?.lng}` : '',
       );
 
-      const [registerForm, { setFieldsValue }] = useForm({
+      const [registerForm, { setFieldsValue, validate }] = useForm({
         schemas: schemas,
         labelWidth: 100,
         showActionButtonGroup: false,
@@ -105,7 +110,23 @@
 
         sceneNum.value = data.num;
       }
-      const handleSubmit = async () => {};
+      const handleSubmit = async () => {
+        const data = await validate();
+        if (props.currentLatLng?.lat || props.currentLatLng?.lng) {
+        }
+        const pro = {
+          isShow: Number(data.isShow),
+          projectName: data.projectName,
+          projectSn: data.projectSn,
+          lat: props.currentLatLng?.lat,
+          long: props.currentLatLng?.lng,
+          alt: 0,
+        };
+        const res = await AddOptOrUpdateApi(pro);
+        console.log('data', res);
+        closeModal();
+        emit('reload');
+      };
 
       return {
         t,

+ 63 - 10
src/views/map/list.vue

@@ -4,10 +4,54 @@
       <template #toolbar>
         <a-button type="primary" @click="handleCreate">新增项目</a-button>
       </template>
+      <template #isShow="{ record }">
+        <Switch :checked="record.isShow" :checkedValue="1" :unCheckedValue="0" />
+      </template>
+
+      <template #createTime="{ record }">
+        <Time :value="record.createTime" mode="date" />
+      </template>
+
+      <template #action="{ record }">
+        {{ record }}
+        <TableAction
+          :actions="[
+            {
+              // color: 'warning',
+              // icon: 'mage:edit-fill',
+              label: '项目信息',
+              tooltip: '项目信息',
+              onClick: () => {},
+            },
+            {
+              // color: 'warning',
+              // icon: 'mage:edit-fill',
+              label: '场景管理',
+              tooltip: '场景管理',
+              onClick: () => {},
+            },
+            {
+              // color: 'warning',
+              // icon: 'mage:edit-fill',
+              label: '地图模式',
+              tooltip: '地图模式',
+              onClick: () => {},
+            },
+            {
+              color: 'error',
+              // icon: 'mage:edit-fill',
+              label: '删除',
+              tooltip: '地图模式',
+              onClick: () => {},
+            },
+          ]"
+        />
+      </template>
     </BasicTable>
     <AddProjectModal
       @register="registerAddProjectModal"
       @open-map="handleSelectMap"
+      @reload="reload"
       :currentLatLng="currentLatLng"
     />
     <MapSelectModal @register="registerMapSelectModal" @update="handleMapChose" />
@@ -15,9 +59,10 @@
 </template>
 <script lang="ts">
   import { defineComponent, computed, ref } from 'vue';
-  import { BasicTable, useTable, BasicColumn, FormProps } from '/@/components/Table';
+  import { BasicTable, useTable, TableAction, BasicColumn, FormProps } from '/@/components/Table';
   import { useMessage } from '/@/hooks/web/useMessage';
-
+  import { Switch } from 'ant-design-vue';
+  import { Time } from '/@/components/Time';
   import { useModal } from '/@/components/Modal';
 
   import { ListApi } from '/@/api/mapOpt/list';
@@ -32,7 +77,7 @@
   const isJA = computed(() => localeStore.getLocale === 'ja');
 
   export default defineComponent({
-    components: { BasicTable, AddProjectModal, MapSelectModal },
+    components: { BasicTable, AddProjectModal, MapSelectModal, Switch, Time, TableAction },
     setup() {
       const [registerAddProjectModal, { openModal: openAddProjectModal }] = useModal();
       const [registerMapSelectModal, { openModal: openMapModal }] = useModal();
@@ -49,18 +94,25 @@
         },
         {
           title: '项目名称',
-          dataIndex: 'companyName',
+          dataIndex: 'projectName',
           width: 100,
         },
         {
-          title: '创建时间',
-          dataIndex: 'userName',
+          title: '项目编号',
+          dataIndex: 'projectSn',
+          width: 100,
+        },
+        {
+          title: t('routes.staff.createTime'),
+          dataIndex: 'createTime',
+          slots: { customRender: 'createTime' },
           width: 200,
         },
         {
           title: '首页显示',
-          dataIndex: 'nickName',
-          width: 200,
+          dataIndex: 'isShow',
+          slots: { customRender: 'isShow' },
+          width: 100,
         },
 
         {
@@ -69,7 +121,7 @@
           slots: { customRender: 'action' },
           fixed: 'right',
           align: 'center',
-          width: isJA.value ? 160 : 80,
+          width: isJA.value ? 200 : 200,
         },
       ];
       const currentLatLng = ref();
@@ -88,7 +140,7 @@
         ],
       };
 
-      const [registerTable] = useTable({
+      const [registerTable, { reload }] = useTable({
         title: t('layout.mapOpt.title'),
         api: ListApi,
         columns: columns,
@@ -125,6 +177,7 @@
         handleSelectMap,
         handleMapChose,
         currentLatLng,
+        reload,
       };
     },
   });

+ 5 - 0
src/views/map/mapSelectModal.vue

@@ -7,6 +7,7 @@
     @cancel="handleCancel"
     :width="828"
     :minHeight="500"
+    @resize="handleRsize"
     centered
   >
     <GoogleMap
@@ -230,6 +231,9 @@
       const handleCancel = async () => {
         resetMapview();
       };
+      const handleRsize = () => {
+        console.log('handleRsize');
+      };
       return {
         t,
         register,
@@ -245,6 +249,7 @@
         center,
         searchMarker,
         handleCancel,
+        handleRsize,
         // searchMarkerShow,
       };
     },