From dad44b84ab21f9d1f860760a045015f1cab0aaec Mon Sep 17 00:00:00 2001 From: zrlibs <jesting_rr@163.com> Date: 星期三, 19 三月 2025 10:57:14 +0800 Subject: [PATCH] fixed --- src/views/examples/report.vue | 384 ++++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 341 insertions(+), 43 deletions(-) diff --git a/src/views/examples/report.vue b/src/views/examples/report.vue index ced8fda..5f41da9 100644 --- a/src/views/examples/report.vue +++ b/src/views/examples/report.vue @@ -1,16 +1,148 @@ <template> <div class="example-report-view" ref="refView"> - <DataTable - :tableHeight="tableHeight" - :columns="columns" - :data="data" - ></DataTable> + <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> </div> </template> <script> import { ref } from "vue"; import DataTable from "@/components/examples/data-table.vue"; +import { exportExcel } from "./excel.js"; export default { name: "ExampleReportView", components: { @@ -21,73 +153,223 @@ columns: [], data: [], tableHeight: 0, + // 鏌ヨ琛ㄥ崟鐨勫畾涔�+ form: { + SupplierCode: "", + ASNName: "", + ASNCode: "", + Invertory: "", + PurchaseOrderNo: "", + OrderDate: [], + State: "", + Purchase: "", + PurchaseType: "", + DocumentType: "", + CloseState: "", + IsArrived: "", + ASNCreateDate: "", + }, + // 鍒嗛〉鍙傛暟 + page: 1, + limit: 30, + limits: [10, 20, 30], + total: 0, + loading: false, }; }, methods: { async loadColumns() { this.columns = [ { - type: "index", + key: "index", title: " ", render: (h, { index }) => { - return h(index); + return h("div", (this.page - 1) * this.limit + index + 1); }, - width: 50, + width: 40, + align: "center", }, { - key: "WH_Code", - title: "浠撳簱缂栫爜", - width: 150, + key: "ASNCode", + title: "ASN鍗曞彿", + width: 100, + sortable: true, + resizable: true, }, { - key: "WH_Name", - title: "浠撳簱鍚嶇О", + key: "CloseState", + title: "鍏抽棴鐘舵�", + width: 100, + sortable: true, + resizable: true, }, { - key: "WH_Leader", - title: "浠撳簱璐熻矗浜�, + key: "InventoryState", + title: "瀛樿揣鐘舵�", + width: 100, + sortable: true, + resizable: true, + }, + { + key: "InvertoryName", + title: "瀛樿揣鍚嶇О", + width: 100, + resizable: true, + }, + { + key: "SpecModel", + title: "瑙勬牸鍨嬪彿", + width: 100, + sortable: true, + resizable: true, + }, + { + key: "AuditState", + title: "瀹℃牳鐘舵�", + width: 100, + resizable: true, + }, + { + key: "SendDate", + title: "鍙戣揣鏃ユ湡", + width: 100, + sortable: true, + resizable: true, + }, + { + key: "SupplierCode", + title: "渚涘簲鍟嗙紪鐮�, + width: 100, + resizable: true, + }, + { + key: "SupplierName", + title: "渚涘簲鍟嗗悕绉�, + width: 100, + resizable: true, + }, + { + key: "Creator", + title: "鍒涘缓浜�, width: 100, }, { - key: "WH_Tel", - title: "浠撳簱鐢佃瘽", + key: "CreateTime", + title: "鍒涘缓鏃堕棿", width: 100, + sortable: true, }, { - key: "Address", - title: "鍦板潃", + key: "PurchasePoint", + title: "閲囪喘鐐�, width: 100, - }, - { - key: "TopLevelWH_Code", - title: "涓婄骇浠撳簱缂栫爜", - width: 100, - }, - { - key: "IsThisLevel", - title: "鏄惁鏈骇", - width: 70, - }, - { - key: "IsEscrow", - title: "鏄惁浠g", - width: 70, - }, - { - key: "IsEnable", - title: "鏄惁鍚敤", - width: 70, }, ]; }, - async loadData() {}, + // 鍔犺浇鏁版嵁琛�+ async loadData() { + let msg = this.$Message.loading("姝e湪鍔犺浇鏁版嵁..."); + this.loading = true; + + let { data, total } = await this.fakeDataList(); + + msg(); + + this.data = data; + this.total = total; + this.loading = false; + }, + // 鍔犺浇鍏ㄩ儴鏁版嵁(瀵煎嚭) + async loadAllData() { + let msg = this.$Message.loading("姝e湪鍔犺浇鏁版嵁..."); + this.loading = true; + + let { data } = await this.fakeDataList(this.total); + + msg(); + + this.loading = false; + + return data; + }, + // 娴嬭瘯鏁版嵁鍒楄〃 + fakeDataList(limit) { + return new Promise((resolve) => { + let total = 99; + let fakeList = []; + for (let i = 0; i < (limit || this.limit); i++) { + let row = { + ASNCode: `ASN鍗曞彿-${(this.page - 1) * this.limit + i + 1}`, + CloseState: `鍏抽棴鐘舵�-${(this.page - 1) * this.limit + i + 1}`, + InventoryState: `瀛樿揣鐘舵�-${(this.page - 1) * this.limit + i + 1}`, + InvertoryName: `瀛樿揣鍚嶇О-${(this.page - 1) * this.limit + i + 1}`, + SpecModel: `瑙勬牸鍨嬪彿-${(this.page - 1) * this.limit + i + 1}`, + AuditState: `瀹℃牳鐘舵�-${(this.page - 1) * this.limit + i + 1}`, + SendDate: `鍙戣揣鏃ユ湡-${(this.page - 1) * this.limit + i + 1}`, + SupplierCode: `渚涘簲鍟嗙紪鐮�${(this.page - 1) * this.limit + i + 1}`, + SupplierName: `渚涘簲鍟嗗悕绉�${(this.page - 1) * this.limit + i + 1}`, + Creator: `鍒涘缓浜�${(this.page - 1) * this.limit + i + 1}`, + CreateTime: `鍒涘缓鏃堕棿-${(this.page - 1) * this.limit + i + 1}`, + PurchasePoint: `閲囪喘鐐�${(this.page - 1) * this.limit + i + 1}`, + }; + if ((this.page - 1) * this.limit + i + 1 < 100) fakeList.push(row); + } + setTimeout(() => { + resolve({ data: fakeList, total }); + }, 1 * 1000); + }); + }, resize() { - this.tableHeight = this.refView.clientHeight; + let height = + this.refView.clientHeight - + this.$el.querySelector(".search-form").clientHeight - + this.$el.querySelector(".buttons").clientHeight - + 9 - + 9; + this.tableHeight = height; + }, + onSearchClick() { + alert(JSON.stringify(this.form, "", " ")); + }, + onClearClick() { + this.form.SupplierCode = ""; + this.form.ASNName = ""; + this.form.ASNCode = ""; + this.form.Invertory = ""; + this.form.PurchaseOrderNo = ""; + this.form.OrderDate = []; + this.form.State = ""; + this.form.Purchase = ""; + this.form.PurchaseType = ""; + this.form.DocumentType = ""; + this.form.CloseState = ""; + this.form.IsArrived = ""; + this.form.ASNCreateDate = ""; + }, + async onExportClick() { + let datas = await this.loadAllData(); + await exportExcel(this, datas); + }, + onPageChange(page) { + this.page = page; + this.loadData(); + }, + onPageSizeChange(limit) { + this.limit = limit; + this.loadData(); + }, + onPrev(page) { + this.page = page; + this.loadData(); + }, + onNext(page) { + this.page = page; + this.loadData(); }, }, async mounted() { await this.loadColumns(); - await this.loadData(); + this.loadData(); this.$nextTick(() => { this.resize(); }); @@ -99,8 +381,24 @@ }; </script> -<style lang="less" scoped> +<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