From cd24c776d772c7ad797891afd779b3b072293ec2 Mon Sep 17 00:00:00 2001
From: zrlibs <jesting_rr@163.com>
Date: 星期五, 21 三月 2025 17:35:07 +0800
Subject: [PATCH] fixed

---
 src/views/examples/report.vue |  292 +++++++++++++++++++++++-----------------------------------
 1 files changed, 116 insertions(+), 176 deletions(-)

diff --git a/src/views/examples/report.vue b/src/views/examples/report.vue
index 5f41da9..1103947 100644
--- a/src/views/examples/report.vue
+++ b/src/views/examples/report.vue
@@ -1,141 +1,21 @@
 <template>
   <div class="example-report-view" ref="refView">
-    <div class="search-form">
-      <Form :model="form" :label-width="110">
-        <Row>
-          <Col span="6">
-            <FormItem label="渚涘簲鍟嗙紪鐮侊細">
-              <Input v-model="form.SupplierCode" size="small">
-                <template #suffix>
-                  <Icon type="ios-more" />
-                </template>
-              </Input>
-            </FormItem>
-          </Col>
-          <Col span="6">
-            <FormItem label="渚涘簲鍟嗗悕绉帮細">
-              <Input v-model="form.SupplierName" size="small"></Input>
-            </FormItem>
-          </Col>
-          <Col span="6">
-            <FormItem label="ASN鍗曞彿锛�>
-              <Input v-model="form.ASNCode" size="small">
-                <template #suffix> <Icon type="ios-more" /> </template
-              ></Input>
-            </FormItem>
-          </Col>
-          <Col span="6">
-            <FormItem label="瀛樿揣锛�>
-              <Input v-model="form.Invertory" size="small">
-                <template #suffix> <Icon type="ios-more" /> </template
-              ></Input>
-            </FormItem>
-          </Col>
-        </Row>
-        <Row>
-          <Col span="6">
-            <FormItem label="浠h喘璁㈠崟鍙凤細">
-              <Input v-model="form.PurchaseOrderNo" size="small">
-                <template #suffix> <Icon type="ios-more" /> </template
-              ></Input>
-            </FormItem>
-          </Col>
-          <Col span="12">
-            <FormItem label="璁㈠崟浜ゆ湡锛�>
-              <DatePicker
-                type="daterange"
-                v-model="form.OrderDate"
-                separator=" 鑷�"
-                size="small"
-                style="width: 100%"
-              ></DatePicker>
-            </FormItem>
-          </Col>
-          <Col span="6">
-            <FormItem label="鐘舵�锛�>
-              <Select v-model="form.State" size="small">
-                <Option :value="0">涓�/Option>
-                <Option :value="1">浜�/Option>
-                <Option :value="2">涓�/Option>
-              </Select>
-            </FormItem>
-          </Col>
-        </Row>
-        <Row>
-          <Col span="6">
-            <FormItem label="閲囪喘鍛橈細">
-              <Input v-model="form.Purchase" size="small"></Input>
-            </FormItem>
-          </Col>
-          <Col span="6">
-            <FormItem label="閲囪喘绫诲瀷锛�>
-              <Select v-model="form.PurchaseType" size="small">
-                <Option :value="0">涓�/Option>
-                <Option :value="1">浜�/Option>
-                <Option :value="2">涓�/Option>
-              </Select>
-            </FormItem>
-          </Col>
-          <Col span="6">
-            <FormItem label="鍗曟嵁绫诲瀷锛�>
-              <Select v-model="form.DocumentType" size="small">
-                <Option :value="0">涓�/Option>
-                <Option :value="1">浜�/Option>
-                <Option :value="2">涓�/Option>
-              </Select>
-            </FormItem>
-          </Col>
-          <Col span="6">
-            <FormItem label="鍏抽棴鐘舵�锛�>
-              <Select v-model="form.CloseState" size="small">
-                <Option :value="0">涓�/Option>
-                <Option :value="1">浜�/Option>
-                <Option :value="2">涓�/Option>
-              </Select>
-            </FormItem>
-          </Col>
-        </Row>
-        <Row>
-          <Col span="6">
-            <FormItem label="鏄惁鍒拌揣瀹屾垚锛�>
-              <Select v-model="form.IsArrived" size="small">
-                <Option :value="0">涓�/Option>
-                <Option :value="1">浜�/Option>
-                <Option :value="2">涓�/Option>
-              </Select>
-            </FormItem>
-          </Col>
-          <Col span="6">
-            <FormItem label="ASN鍒涘缓鏃ユ湡锛�>
-              <DatePicker type="date" v-model="form.CreateTime" size="small" />
-            </FormItem>
-          </Col>
-        </Row>
-      </Form>
-    </div>
-    <div class="buttons">
-      <Space>
-        <Button type="primary" size="small" @click="onSearchClick">鏌ヨ</Button>
-        <Button type="primary" size="small" @click="onClearClick">娓呯┖</Button>
-        <Button type="success" size="small" @click="onExportClick">瀵煎嚭</Button>
-      </Space>
-    </div>
-    <div class="table">
-      <DataTable
-        :tableHeight="tableHeight"
-        :columns="columns"
-        :data="data"
-        :page="page"
-        :limit="limit"
-        :limits="limits"
-        :total="total"
-        :loading="loading"
-        @on-change="onPageChange"
-        @on-page-size-change="onPageSizeChange"
-        @on-prev="onPrev"
-        @on-next="onNext"
-      ></DataTable>
-    </div>
+    <DataTable
+      :height="height"
+      :formObject="formObject"
+      :buttons="buttons"
+      :columns="columns"
+      :data="data"
+      :page="page"
+      :limit="limit"
+      :limits="limits"
+      :total="total"
+      :loading="loading"
+      @on-change="onPageChange"
+      @on-page-size-change="onPageSizeChange"
+      @on-prev="onPrev"
+      @on-next="onNext"
+    ></DataTable>
   </div>
 </template>
 
@@ -150,25 +30,27 @@
   },
   data() {
     return {
+      formObject: {
+        options: {},
+        items: [],
+      },
+      buttons: [
+        {
+          showName: "鏌ヨ",
+          onClick: () => this.onSearchClick(),
+        },
+        {
+          showName: "娓呯┖",
+          onClick: () => this.onClearClick(),
+        },
+        {
+          showName: "瀵煎嚭",
+          onClick: () => this.onExportClick(),
+        },
+      ],
       columns: [],
       data: [],
-      tableHeight: 0,
-      // 鏌ヨ琛ㄥ崟鐨勫畾涔�-      form: {
-        SupplierCode: "",
-        ASNName: "",
-        ASNCode: "",
-        Invertory: "",
-        PurchaseOrderNo: "",
-        OrderDate: [],
-        State: "",
-        Purchase: "",
-        PurchaseType: "",
-        DocumentType: "",
-        CloseState: "",
-        IsArrived: "",
-        ASNCreateDate: "",
-      },
+      height: 0,
       // 鍒嗛〉鍙傛暟
       page: 1,
       limit: 30,
@@ -178,6 +60,85 @@
     };
   },
   methods: {
+    async loadForm() {
+      this.formObject.options = {
+        labelWidth: 110,
+      };
+      this.formObject.items = [
+        {
+          label: "渚涘簲鍟嗙紪鐮侊細",
+          field: "SupplierCode",
+          value: "",
+          type: "input",
+          suffix: "ios-more",
+          span: 6,
+          onSuffixClick: () => {},
+        },
+        {
+          label: "渚涘簲鍟嗗悕绉帮細",
+          field: "SupplierName",
+          value: "",
+          type: "input",
+          suffix: "ios-more",
+          span: 6,
+          onSuffixClick: () => {},
+        },
+        {
+          label: "ASN鍗曞彿锛�,
+          field: "ASNCode",
+          value: "",
+          type: "input",
+          suffix: "ios-more",
+          span: 6,
+          onSuffixClick: () => {},
+        },
+        {
+          label: "瀛樿揣锛�,
+          field: "Invertory",
+          value: "",
+          type: "input",
+          suffix: "ios-more",
+          span: 6,
+          onSuffixClick: () => {},
+        },
+        {
+          label: "浠h喘璁㈠崟鍙凤細",
+          field: "PurchaseOrderNo",
+          value: "",
+          type: "input",
+          suffix: "ios-more",
+          span: 6,
+          onSuffixClick: () => {},
+        },
+        {
+          label: "璁㈠崟浜ゆ湡锛�,
+          field: "OrderDate",
+          value: "",
+          type: "daterange",
+          span: 12,
+          onChange: () => {},
+        },
+        {
+          label: "鐘舵�锛�,
+          field: "State",
+          value: "",
+          type: "input",
+          span: 6,
+          options: [
+            { labe: "涓�, value: 1 },
+            { labe: "浜�, value: 2 },
+            { labe: "涓�, value: 3 },
+          ],
+        },
+        {
+          label: "閲囪喘鍛橈細",
+          field: "Purchase",
+          value: "",
+          type: "input",
+          span: 6,
+        },
+      ];
+    },
     async loadColumns() {
       this.columns = [
         {
@@ -320,13 +281,7 @@
       });
     },
     resize() {
-      let height =
-        this.refView.clientHeight -
-        this.$el.querySelector(".search-form").clientHeight -
-        this.$el.querySelector(".buttons").clientHeight -
-        9 -
-        9;
-      this.tableHeight = height;
+      this.height = this.refView.clientHeight - 20;
     },
     onSearchClick() {
       alert(JSON.stringify(this.form, "", "    "));
@@ -368,6 +323,7 @@
     },
   },
   async mounted() {
+    await this.loadForm();
     await this.loadColumns();
     this.loadData();
     this.$nextTick(() => {
@@ -384,21 +340,5 @@
 <style lang="less">
 .example-report-view {
   height: 100%;
-  .search-form,
-  .buttons {
-    margin-bottom: 9px;
-  }
-  .table {
-    height: calc(100% - 170px);
-  }
-  .ivu-form .ivu-form-item-label,
-  .ivu-checkbox-wrapper {
-    font-size: 12px;
-  }
-  .ivu-input-wrapper {
-    .ivu-icon {
-      cursor: pointer;
-    }
-  }
 }
 </style>
\ No newline at end of file

--
Gitblit v1.9.1