Browse Source

多公司页面,营业期限调整

lxf 1 year ago
parent
commit
ba23864740
1 changed files with 36 additions and 69 deletions
  1. 36 69
      src/views/publicModule/companyConfig/index.vue

+ 36 - 69
src/views/publicModule/companyConfig/index.vue

@@ -19,53 +19,34 @@
             action: () => openModal('add'),
           },
         ]"
-        @get-list="getList"
-      >
-        <template #timeSlot="{ item }">
-          {{ item.startDate }} - {{ item.stopDate }}
-        </template>
+        @get-list="getList">
+        <template #timeSlot="{ item }"> {{ item.startDate }} - {{ item.stopDate }} </template>
       </byTable>
     </div>
-    <el-dialog
-      :title="modalType == 'add' ? '添加公司' : '编辑公司'"
-      v-model="dialogVisible"
-      width="800"
-      v-loading="loading"
-    >
-      <byForm
-        :formConfig="formConfig"
-        :formOption="formOption"
-        v-model="formData.data"
-        :rules="rules"
-        ref="byform"
-      >
-        <template #timeGange>
-          <el-date-picker
-            v-model="formData.data.timeArr"
-            type="daterange"
-            unlink-panels
-            range-separator="To"
-            start-placeholder="开始日期"
-            end-placeholder="结束日期"
-            value-format="YYYY-MM-DD"
-          />
+    <el-dialog :title="modalType == 'add' ? '添加公司' : '编辑公司'" v-model="dialogVisible" width="800" v-loading="loading">
+      <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="byform">
+        <template #timeGanger>
+          <div style="width: 100%">
+            <el-row :gutter="10">
+              <el-col :span="11">
+                <el-input v-model="formData.data.startDate" placeholder="请输入" />
+              </el-col>
+              <el-col :span="2" style="text-align: center"> To </el-col>
+              <el-col :span="11">
+                <el-input v-model="formData.data.stopDate" placeholder="请输入" />
+              </el-col>
+            </el-row>
+          </div>
         </template>
       </byForm>
       <template #footer>
         <el-button @click="dialogVisible = false" size="large">取 消</el-button>
-        <el-button
-          type="primary"
-          @click="submitForm('byform')"
-          size="large"
-          :loading="submitLoading"
-        >
-          确 定
-        </el-button>
+        <el-button type="primary" @click="submitForm('byform')" size="large" :loading="submitLoading"> 确 定 </el-button>
       </template>
     </el-dialog>
   </div>
 </template>
-  
+
 <script setup>
 /* eslint-disable vue/no-unused-components */
 import { ElMessage, ElMessageBox } from "element-plus";
@@ -183,15 +164,11 @@ const config = computed(() => {
             el: "button",
             click() {
               // 弹窗提示是否删除
-              ElMessageBox.confirm(
-                "此操作将永久删除该数据, 是否继续?",
-                "提示",
-                {
-                  confirmButtonText: "确定",
-                  cancelButtonText: "取消",
-                  type: "warning",
-                }
-              ).then(() => {
+              ElMessageBox.confirm("此操作将永久删除该数据, 是否继续?", "提示", {
+                confirmButtonText: "确定",
+                cancelButtonText: "取消",
+                type: "warning",
+              }).then(() => {
                 // 删除
                 proxy
                   .post("/corporation/delete", {
@@ -261,7 +238,7 @@ const formConfig = reactive([
   },
   {
     type: "slot",
-    slotName: "timeGange",
+    slotName: "timeGanger",
     prop: "startDate",
     label: "营业期限",
   },
@@ -294,23 +271,19 @@ const formConfig = reactive([
 const getList = async (req) => {
   sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
   loading.value = true;
-  proxy
-    .post("/corporation/page", sourceList.value.pagination)
-    .then((message) => {
-      console.log(message);
-      sourceList.value.data = message.rows;
-      sourceList.value.pagination.total = message.total;
-      setTimeout(() => {
-        loading.value = false;
-      }, 200);
-    });
+  proxy.post("/corporation/page", sourceList.value.pagination).then((message) => {
+    console.log(message);
+    sourceList.value.data = message.rows;
+    sourceList.value.pagination.total = message.total;
+    setTimeout(() => {
+      loading.value = false;
+    }, 200);
+  });
 };
 const openModal = () => {
   dialogVisible.value = true;
   modalType.value = "add";
-  formData.data = {
-    timeArr: [],
-  };
+  formData.data = {};
 };
 const selection = ref({
   data: [],
@@ -321,11 +294,7 @@ const select = (_selection, row) => {
 };
 const submitForm = () => {
   console.log(byform.value);
-  byform.value.handleSubmit((valid) => {
-    if (formData.data.timeArr.length > 0) {
-      formData.data.startDate = formData.data.timeArr[0];
-      formData.data.stopDate = formData.data.timeArr[1];
-    }
+  byform.value.handleSubmit(() => {
     submitLoading.value = true;
     proxy.post("/corporation/" + modalType.value, formData.data).then(
       (res) => {
@@ -346,11 +315,9 @@ const getDtl = (row) => {
   dialogVisible.value = true;
   modalType.value = "edit";
   proxy.post("/corporation/detail", { id: row.id }).then((res) => {
-    res.timeArr = [res.startDate, res.stopDate];
     res.type = res.type + "";
     res.taxpayerQualification = res.taxpayerQualification + "";
     formData.data = res;
-    console.log(formData.data.timeArr, "ws");
   });
 };
 
@@ -393,9 +360,9 @@ const getDict = () => {
 getList();
 getDict();
 </script>
-  
+
 <style lang="scss" scoped>
 .tenant {
   padding: 20px;
 }
-</style>
+</style>