From 29b5ffe318b8ab32865ebebedd865ea2aa3f6c7e Mon Sep 17 00:00:00 2001 From: yangfeng <wanwan926_4@163.com> Date: 星期三, 06 九月 2023 17:45:31 +0800 Subject: [PATCH] 供应商列表相关bug修复及样式调整 --- src/components/makepager/pager/PagerView.vue | 13 + src/views/supplierManage/supplier/index.vue | 132 +++++----- src/components/makepager/TableCommonView.vue | 41 ++ src/assets/style/index.scss | 161 +++++++------ src/views/supplierManage/supplier/AddNewProduct.vue | 69 +++-- src/components/layout/components/appHeader/index.vue | 1 src/views/purchaseManage/purchase/index.vue | 171 +++++++------- src/components/makepager/CommonFormTableView.vue | 114 +++++---- src/components/layout/components/AppMain.vue | 2 9 files changed, 373 insertions(+), 331 deletions(-) diff --git a/src/assets/style/index.scss b/src/assets/style/index.scss index bed3e65..d4cf06e 100644 --- a/src/assets/style/index.scss +++ b/src/assets/style/index.scss @@ -12,117 +12,126 @@ outline: 0; } // 闂磋窛 -.margin_left_3px{ - margin-left:3px; +.margin_left_3px { + margin-left: 3px; } -.margin_left_5px{ - margin-left:5px; +.margin_left_5px { + margin-left: 5px; } -.margin_left_10px{ - margin-left:10px; +.margin_left_10px { + margin-left: 10px; } -.margin_left_15px{ - margin-left:15px; +.margin_left_15px { + margin-left: 15px; } -.margin_left_20px{ - margin-left:20px; +.margin_left_20px { + margin-left: 20px; } -.margin_right_5px{ - margin-right:5px; +.margin_right_5px { + margin-right: 5px; } -.margin_right_10px{ - margin-right:10px; +.margin_right_10px { + margin-right: 10px; } -.margin_right_15px{ - margin-right:15px!important; +.margin_right_15px { + margin-right: 15px !important; } -.margin_right_20px{ - margin-right:20px; +.margin_right_20px { + margin-right: 20px; } -.margin_right_40px{ - margin-right:40px; +.margin_right_40px { + margin-right: 40px; } -.margin_top_10px{ - margin-top:10px; +.margin_top_10px { + margin-top: 10px; } -.margin_top_20px{ - margin-top:20px; +.margin_top_20px { + margin-top: 20px; } -.margin_top_30px{ - margin-top:30px; +.margin_top_30px { + margin-top: 30px; } -.margin_top_35px{ - margin-top:35px; +.margin_top_35px { + margin-top: 35px; } -.margin_top_40px{ - margin-top:40px; +.margin_top_40px { + margin-top: 40px; } -.margin_bottom_2px{ - margin-bottom:2px; +.margin_bottom_2px { + margin-bottom: 2px; } -.margin_bottom_10px{ - margin-bottom:10px!important; +.margin_bottom_10px { + margin-bottom: 10px !important; } -.margin_bottom_15px{ - margin-bottom:15px!important; +.margin_bottom_15px { + margin-bottom: 15px !important; } -.margin_bottom_20px{ - margin-bottom:20px!important; +.margin_bottom_20px { + margin-bottom: 20px !important; } -.margin_bottom_30px{ - margin-bottom:30px!important; +.margin_bottom_30px { + margin-bottom: 30px !important; } -.margin_bottom_40px{ - margin-bottom:40px!important; +.margin_bottom_40px { + margin-bottom: 40px !important; } -.margin_bottom_50px{ - margin-bottom:50px!important; +.margin_bottom_50px { + margin-bottom: 50px !important; } -// -.float_left{ - float:left; +// +.float_left { + float: left; } -.float_right{ - float:right; +.float_right { + float: right; } -// -.line_height_32px{ - line-height:32px; +// +.line_height_32px { + line-height: 32px; } -.text_indent_20{ - text-indent:20px; +.text_indent_20 { + text-indent: 20px; } -.text_indent_30{ - text-indent:30px; +.text_indent_30 { + text-indent: 30px; } // 瀛椾綋澶у皬 -.font_size_12{ - font-size:12px; +.font_size_12 { + font-size: 12px; } -.font_size_13{ - font-size:13px; +.font_size_13 { + font-size: 13px; } -.font_size_14{ - font-size:14px; +.font_size_14 { + font-size: 14px; } -.font_size_15{ - font-size:15px; +.font_size_15 { + font-size: 15px; } -.font_size_16{ - font-size:16px; +.font_size_16 { + font-size: 16px; } -.font_size_18{ - font-size:18px; +.font_size_18 { + font-size: 18px; } -.font_size_20{ - font-size:20px!important; +.font_size_20 { + font-size: 20px !important; } -.font_size_30{ - font-size:30px!important; +.font_size_30 { + font-size: 30px !important; } -.font_size_40{ - font-size:40px!important; +.font_size_40 { + font-size: 40px !important; } -.cursor_pointer{ +.cursor_pointer { cursor: pointer; -} \ No newline at end of file +} + +.btn-pager { + display: flex; + margin-top: 10px; + // background: #fff; + .page { + margin-left: auto; + } +} diff --git a/src/components/layout/components/AppMain.vue b/src/components/layout/components/AppMain.vue index e0694e9..1572948 100644 --- a/src/components/layout/components/AppMain.vue +++ b/src/components/layout/components/AppMain.vue @@ -33,7 +33,7 @@ width: calc(100% - 210px); .app-main-content { width: 100%; - overflow-y: auto; + overflow-y: hidden; } } </style> diff --git a/src/components/layout/components/appHeader/index.vue b/src/components/layout/components/appHeader/index.vue index 71492a6..e83742e 100644 --- a/src/components/layout/components/appHeader/index.vue +++ b/src/components/layout/components/appHeader/index.vue @@ -41,6 +41,7 @@ line-height: 55px; background-color: #fff; margin-bottom: 10px; + margin-left: -10px; .header-title { margin-left: 16px; font-size: 16px; diff --git a/src/components/makepager/CommonFormTableView.vue b/src/components/makepager/CommonFormTableView.vue index 348fce9..41cbeef 100644 --- a/src/components/makepager/CommonFormTableView.vue +++ b/src/components/makepager/CommonFormTableView.vue @@ -1,12 +1,20 @@ <template> <div class="page-view"> - <el-form ref="form" :model="tableList" :show-message="false" label-position="right" - > - <el-table :data="tableList.tableData" style="width: 100%" - :show-summary="showSummary.show" - :summary-method="getSummaries" - :span-method="arraySpanMethod"> - <el-table-column type="index" v-if="tableList.tableColumn.length>0" label="缂栧彿" width="50" align="center"></el-table-column> + <el-form ref="form" :model="tableList" :show-message="false" label-position="right"> + <el-table + :data="tableList.tableData" + style="width: 100%" + :show-summary="showSummary.show" + :summary-method="getSummaries" + :span-method="arraySpanMethod" + > + <el-table-column + type="index" + v-if="tableList.tableColumn.length > 0" + label="缂栧彿" + width="50" + align="center" + ></el-table-column> <el-table-column v-for="(item, i) in tableList.tableColumn" :key="i" @@ -47,7 +55,7 @@ v-model="scope.row[item.prop]" :fetch-suggestions="querySearchAsync" value-key="name" - style='width:calc(100% - 70px)' + style="width: calc(100% - 70px)" size="mini" @select=" (val) => { @@ -55,13 +63,13 @@ } " ></el-autocomplete> - <div class="common-select-btn" @click="selClientClick(scope.row, item.prop,scope)"> + <div class="common-select-btn" @click="selClientClick(scope.row, item.prop, scope)"> <i class="el-icon-circle-plus-outline" title="閫夋嫨"></i> </div> - <div class="common-select-btn" @click="clearupClient(scope.row,scope)"> + <div class="common-select-btn" @click="clearupClient(scope.row, scope)"> <i class="el-icon-remove-outline" title="娓呴櫎"></i> </div> - <div class="common-select-btn" v-if="scope.$index!=0" @click="deleteClient(scope.row,scope)"> + <div class="common-select-btn" v-if="scope.$index != 0" @click="deleteClient(scope.row, scope)"> <i class="el-icon-delete" title="鍒犻櫎"></i> </div> </div> @@ -102,9 +110,9 @@ :prop="'tableData.' + scope.$index + '.' + item.prop" :rules="[{ required: item.isRequird ? true : false, message: '杈撳叆涓嶈兘涓虹┖' }]" > - <template v-if="item.multiply"> + <template v-if="item.multiply"> <el-input-number - :value="scope.row[showSummary.multiply[0]]*scope.row[showSummary.multiply[1]]" + :value="scope.row[showSummary.multiply[0]] * scope.row[showSummary.multiply[1]]" placeholder="" :disabled="item.disabled" :min="0" @@ -118,22 +126,22 @@ } " ></el-input-number> - </template> - <template v-else> - <el-input-number - v-model="scope.row[item.prop]" - placeholder="" - :min="0" - :precision="2" - :controls="false" - size="mini" - style="width: 100%; margin-right: 5px" - @change=" - (val) => { - commonInputChange(val, item.prop, scope.row) - } - " - ></el-input-number> + </template> + <template v-else> + <el-input-number + v-model="scope.row[item.prop]" + placeholder="" + :min="0" + :precision="2" + :controls="false" + size="mini" + style="width: 100%; margin-right: 5px" + @change=" + (val) => { + commonInputChange(val, item.prop, scope.row) + } + " + ></el-input-number> </template> </el-form-item> <span v-else>{{ scope.row[item.prop] }}</span> @@ -158,7 +166,7 @@ </template> <script> -import { getProductListFromGrpc,getProductList } from "@/api/productManage/product" +import { getProductListFromGrpc, getProductList } from "@/api/productManage/product" import SelectCommonDialog from "@/views/other/commonDialog/SelectCommonDialog" export default { name: "CommmonFormTableView", @@ -168,9 +176,9 @@ type: Boolean, default: false }, - sign:{ - type:String, - default:'' + sign: { + type: String, + default: "" }, productTableList: { type: Object, @@ -192,7 +200,7 @@ total: false, refundable: false, sumProp: [], - multiply:[], + multiply: [], titleProp: ["#", "浜у搧鍚嶇О"], mergeNumber: 1 } @@ -201,7 +209,7 @@ recalculateShow: { type: [Boolean], defalut: true - }, + } }, data() { return { @@ -221,15 +229,15 @@ this.tableList = this.productTableList }, computed: {}, - watch:{ - productTableList(){ + watch: { + productTableList() { this.tableList = this.productTableList } }, methods: { // 浜у搧鍚嶇О async getProductList() { - let fn = this.sign == "purchase" ? getProductList : getProductListFromGrpc; + let fn = this.sign == "purchase" ? getProductList : getProductListFromGrpc await fn({ page: 1, pageSize: 100 @@ -298,7 +306,7 @@ } if (column.property === "total") { this.total = sums[index] - this.$emit('getSummaries',this.total) + this.$emit("getSummaries", this.total) } }) return sums @@ -394,7 +402,7 @@ } this.$emit("selCommonName", selRow) }, - selClientClick(row, prop,scope) { + selClientClick(row, prop, scope) { console.log(row, prop) this.productIndex = scope.$index this.editSelCommonConfig.title = "浜у搧鍚嶇О" @@ -426,21 +434,20 @@ ite.unit = item.unit ite.deliveryTime = item.deliveryTime ite.shippingDuration = item.shippingDuration - this.$set(this.tableList.tableData,index,ite) + this.$set(this.tableList.tableData, index, ite) this.$forceUpdate() } }) - - - console.log(this.tableList.tableData,'=====chanp') + + console.log(this.tableList.tableData, "=====chanp") } }, // 娓呴櫎宸查�夋嫨鐢ㄦ埛 - clearupClient(row,scope) { + clearupClient(row, scope) { this.productIndex = scope.$index this.tableList.tableData.map((ite, index) => { console.log(scope.$index) - if (scope.$index && scope.$index >= 0) { + if (scope.$index && scope.$index >= 0) { if (index === this.productIndex) { ite.name = "" ite.amount = 1 @@ -462,14 +469,13 @@ }) this.$emit("clearupProduct", this.tableList.tableData) }, - deleteClient(row,scope){ - if(this.tableList.tableData.length==1){ - this.$message.error('鑷冲皯淇濈暀涓�鏉★紝涓嶈兘鍒櫎浜嗭紒') - return true; + deleteClient(row, scope) { + if (this.tableList.tableData.length == 1) { + this.$message.error("鑷冲皯淇濈暀涓�鏉★紝涓嶈兘鍒櫎浜嗭紒") + return true } - this.tableList.tableData.splice(scope.$index,1) - }, - + this.tableList.tableData.splice(scope.$index, 1) + } } } </script> @@ -477,7 +483,7 @@ <!-- Add "scoped" attribute to limit CSS to this component only --> <style lang="scss" scoped> .page-view { - min-width:100px; + min-width: 100px; .el-form-item { margin-bottom: 0; .custom-name { diff --git a/src/components/makepager/TableCommonView.vue b/src/components/makepager/TableCommonView.vue index ac0e306..be81c3c 100644 --- a/src/components/makepager/TableCommonView.vue +++ b/src/components/makepager/TableCommonView.vue @@ -6,12 +6,17 @@ :data="tableList.tableInfomation" tooltip-effect="dark" style="width: 100%" + :height="'calc(100% - 0px)'" + :max-height="tableList.maxHeight" :lazy="tableList.lazy" - :show-summary="showSummary.show" - :summary-method="getSummaries" - :span-method="arraySpanMethod" @selection-change="handleSelectionChange" - :header-cell-style="{ background: '#ECF4FF', color: '#666' }" + :header-cell-style="{ background: '#f1f3f8', color: '#000009' }" + :highlight-current-row="tableList.highlight" + :row-class-name="tableRowClassName" + @row-click="tableRowClick" + :row-key="tableList.key" + :default-expand-all="tableList.isDefaultExpandAll" + :tree-props="{ children: 'child', hasChildren: 'hasChildren' }" > <el-table-column v-if="tableList.selectBox" type="selection" width="40"> </el-table-column> <el-table-column v-if="tableList.selectIndex" type="index" label="搴忓彿" width="50"> </el-table-column> @@ -122,6 +127,13 @@ totalName: "鏈〉鎬昏" } } + }, + // 閫変腑鐨勬牱寮� + selectClassRow: { + type: Object, + default: () => { + return {} + } } }, data() { @@ -130,10 +142,6 @@ computed: {}, mounted() {}, methods: { - tableRowClick(row) { - console.log(row) - this.$emit("tableRowClick", row) - }, handleReserve(row) { return row._id ? row._id : row.id }, @@ -267,6 +275,18 @@ // 鍏叡璇︽儏 selCommonClick(row) { this.$emit("selCommonClick", row) + }, + // 鍗曢�夎鐩稿叧 + tableRowClassName({ row }) { + if (Object.keys(this.selectClassRow).length > 0) { + if (row.id == this.selectClassRow.id) { + return "onSelect" + } + } + this.$emit("tableRowClassName", row) + }, + tableRowClick(row) { + this.$emit("tableRowClick", row) } } } @@ -278,6 +298,7 @@ // margin-top: 20px; margin-right: 10px; // margin-bottom: 40px; + height: 100%; .blue { width: 70px; text-align: center; @@ -311,8 +332,8 @@ } } ::v-deep { - .el-table__footer-wrapper { - tbody td.el-table__cell{ + .el-table__footer-wrapper { + tbody td.el-table__cell { background-color: #fff; font-weight: bold; } diff --git a/src/components/makepager/pager/PagerView.vue b/src/components/makepager/pager/PagerView.vue index df8eae2..ac30707 100644 --- a/src/components/makepager/pager/PagerView.vue +++ b/src/components/makepager/pager/PagerView.vue @@ -1,6 +1,7 @@ <template> <div class="page-view"> <el-pagination + background :current-page="pagerOptions.currPage" :page-sizes="pageSizes" :page-size="pagerOptions.pageSize" @@ -9,6 +10,16 @@ v-on="$listeners" > </el-pagination> + <!-- :current-page.sync="searchParam.page" + :page-size="searchParam.pageSize" + background + :page-sizes="[15, 30]" + layout="total, sizes, prev, pager, next, jumper" + :total="total" + @current-change="changePage" + @size-change="handleSizeChange" + @prev-click="prevPage" + @next-click="nextPage" --> </div> </template> @@ -22,7 +33,7 @@ }, layout: { type: String, - default: "total, sizes, prev, pager, next" + default: "total, sizes, prev, pager, next, jumper" }, pagerOptions: { type: Object, diff --git a/src/views/purchaseManage/purchase/index.vue b/src/views/purchaseManage/purchase/index.vue index 7f4dfa0..9154e05 100644 --- a/src/views/purchaseManage/purchase/index.vue +++ b/src/views/purchaseManage/purchase/index.vue @@ -15,7 +15,7 @@ </div> <template> <TableCommonView - class="content-table" + class="content-table" ref="tableListRef" :table-list="tableList" @selCommonClick="selCommonClick" @@ -23,15 +23,15 @@ <template slot="tableButton"> <el-table-column label="鐘舵��" width="120"> <template slot-scope="scope"> - {{ getpurchaseStatus(scope.row.status) }} + {{ getpurchaseStatus(scope.row.status) }} </template> </el-table-column> <el-table-column label="鎿嶄綔" width="120" fixed="right"> <template slot-scope="scope"> - <el-button type="text" size="small" @click="editClick(scope.row)" style="margin-right: 5px" + <el-button type="text" size="small" @click="editClick(scope.row)" style="margin-right: 5px" >缂栬緫</el-button > - <el-button @click="submitClick(scope.row)" type="text" size="small">鎻愪氦</el-button> + <el-button @click="submitClick(scope.row)" type="text" size="small">鎻愪氦</el-button> </template> </el-table-column> </template> @@ -41,48 +41,45 @@ </div> </template> </div> - + <!-- 鏂板缓/缂栬緫閿�鍞嚎绱� --> <!-- <AddSalesLeadDialog v-if="editSalesLeadConfig.visible" :edit-rightContent-config="editSalesLeadConfig" /> --> <!-- 璇︽儏 --> - <DetailSupplier v-if="commonDetail.visible" :common-detail="commonDetail" /> + <DetailSupplier v-if="commonDetail.visible" :common-detail="commonDetail" /> <!-- 鏂板缓/缂栬緫 --> <AddPurchase v-if="editConfig.visible" :edit-common-config="editConfig" /> </div> </template> <script> - import pageMixin from "@/components/makepager/pager/mixin/pageMixin" -import { - getPurchaseList,getPurchaseInfo,submitPurchase, -} from "@/api/purchaseManage/purchase"; +import { getPurchaseList, getPurchaseInfo, submitPurchase } from "@/api/purchaseManage/purchase" import DetailSupplier from "@/views/purchaseManage/purchase/DetailSupplier" import AddPurchase from "@/views/purchaseManage/purchase/components/AddPurchase" -import { getDataByType } from "@/api/data"; +import { getDataByType } from "@/api/data" export default { name: "SupplierManage", props: {}, - components: { DetailSupplier,AddPurchase }, + components: { DetailSupplier, AddPurchase }, mixins: [pageMixin], computed: {}, data() { return { - tableLoading:false, + tableLoading: false, tableList: {}, // 鍒楄〃 selValueList: [], commonDetail: { visible: false, infomation: {} }, - search:'', - editRow:{}, + search: "", + editRow: {}, editConfig: { visible: false, title: "鍒涘缓", infomation: {} }, - purchaseStatusList:getDataByType('purchaseStatus'), + purchaseStatusList: getDataByType("purchaseStatus") } }, created() { @@ -94,11 +91,11 @@ if (val) { for (let i in this.purchaseStatusList) { if (this.purchaseStatusList[i].id == val) { - return this.purchaseStatusList[i].name; + return this.purchaseStatusList[i].name } } } else { - return "--"; + return "--" } }, setTable() { @@ -107,13 +104,13 @@ selectIndex: true, tableColumn: [ { label: "閲囪喘鍗曞彿", prop: "number", min: 150, isCommonClick: true }, - { label: "閲囪喘鍗曞悕绉�", prop: "name", min: 130, isCommonClick: true}, + { label: "閲囪喘鍗曞悕绉�", prop: "name", min: 130, isCommonClick: true }, { label: "鍗曟嵁绫诲瀷", prop: "orderType", min: 130 }, { label: "渚涘簲鍟嗗悕绉�", prop: "contact", min: 130 }, { label: "閲囪喘鏁伴噺", prop: "quantity", min: 130 }, { label: "鏀惰揣浠撳簱", prop: "warehouse", min: 130 }, { label: "缁忓姙浜�", prop: "handledBy", min: 130 }, - { label: "鍒跺崟浜�", prop: "creator", min: 130 }, + { label: "鍒跺崟浜�", prop: "creator", min: 130 } ] } }, @@ -138,11 +135,11 @@ // 鎼滅储 searchClick(val, content) { console.log(val, content) - this.search = content + this.search = content this.getData() }, resetClick() { - this.search = '' + this.search = "" this.getData() }, // 鏂板缓 @@ -152,89 +149,88 @@ this.editConfig.visible = true this.editConfig.title = "鍒涘缓" this.editConfig.infomation = { - productList:[], - purchaseTypeId:'', - supplierId:'', - supplierName:'', - orderSource:'鎵嬪姩鍒涘缓', - name:'', - contact:'', - phone:'', - signingDate:'', - deliveryDate:'', - remark:'', - wholeDiscountType:null, - wholeDiscount:0, - priceAdjustmentType:null, - priceAdjustment:0, - realTotalPrice:0, - } + productList: [], + purchaseTypeId: "", + supplierId: "", + supplierName: "", + orderSource: "鎵嬪姩鍒涘缓", + name: "", + contact: "", + phone: "", + signingDate: "", + deliveryDate: "", + remark: "", + wholeDiscountType: null, + wholeDiscount: 0, + priceAdjustmentType: null, + priceAdjustment: 0, + realTotalPrice: 0 + } }, - + // 缂栬緫 - editClick(row){ - this.tableLoading=true - getPurchaseInfo({id:row.ID}).then((res) => { + editClick(row) { + this.tableLoading = true + getPurchaseInfo({ id: row.ID }).then((res) => { if (res.code == 200) { - this.tableLoading=false + this.tableLoading = false this.editConfig.visible = true this.editConfig.title = "缂栬緫" - this.editConfig.infomation = { - productList:res.data.productList, - supplierName:res.data.purchase.supplier.name, - ...res.data.purchase, - } - }else{ - this.$message.error(res.msg?res.msg+',':''+'鑾峰彇淇℃伅澶辫触锛�') + this.editConfig.infomation = { + productList: res.data.productList, + supplierName: res.data.purchase.supplier.name, + ...res.data.purchase + } + } else { + this.$message.error(res.msg ? res.msg + "," : "" + "鑾峰彇淇℃伅澶辫触锛�") } }) - setTimeout(()=>{ - this.tableLoading=false - },3000) + setTimeout(() => { + this.tableLoading = false + }, 3000) // this.editRow = row; // this.$refs.add.islook = true; - }, // 纭鍙戣揣 submitClick(row) { - this.$confirm("鏄惁鎻愪氦?", "鎻愮ず", { - confirmButtonText: "纭畾", - cancelButtonText: "鍙栨秷", - type: "warning" - }) - .then(() => { - console.log("dddd") - submitPurchase({ id: row.ID }).then((response) => { - if (response.code === 200) { - this.$message.success("鎻愪氦鎴愬姛") - this.getData() - } else { - this.$message.warning("鎻愪氦澶辫触") - } - }) + this.$confirm("鏄惁鎻愪氦?", "鎻愮ず", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }) + .then(() => { + console.log("dddd") + submitPurchase({ id: row.ID }).then((response) => { + if (response.code === 200) { + this.$message.success("鎻愪氦鎴愬姛") + this.getData() + } else { + this.$message.warning("鎻愪氦澶辫触") + } }) - .catch(() => {}) + }) + .catch(() => {}) }, - + // 璇︽儏 selCommonClick(row) { console.log(row) - this.tableLoading=true - getPurchaseInfo({id:row.ID}).then((res) => { + this.tableLoading = true + getPurchaseInfo({ id: row.ID }).then((res) => { if (res.code == 200) { - this.tableLoading=false + this.tableLoading = false this.commonDetail.visible = true - this.commonDetail.infomation = { - productList:res.data.productList, + this.commonDetail.infomation = { + productList: res.data.productList, ...res.data.purchase - } - }else{ - this.$message.error(res.msg?res.msg+',':''+'鑾峰彇淇℃伅澶辫触锛�') + } + } else { + this.$message.error(res.msg ? res.msg + "," : "" + "鑾峰彇淇℃伅澶辫触锛�") } }) - setTimeout(()=>{ - this.tableLoading=false - },3000) + setTimeout(() => { + this.tableLoading = false + }, 3000) } } } @@ -243,10 +239,10 @@ <!-- Add "scoped" attribute to limit CSS to this component only --> <style lang="scss" scoped> .rightContent { - width:100%; - height:calc(100% - 10px); + width: 100%; + height: calc(100% - 10px); .content-box { - height:100%; + height: 100%; .supplier-search { display: flex; align-items: center; @@ -255,11 +251,12 @@ margin-right: 20px; } } - .content-table{ + .content-table { // height:calc(100% - 60px - 42px); } .btn-pager { display: flex; + // background: #fff; .page { margin-left: auto; } diff --git a/src/views/supplierManage/supplier/AddNewProduct.vue b/src/views/supplierManage/supplier/AddNewProduct.vue index 0478e65..d5e590c 100644 --- a/src/views/supplierManage/supplier/AddNewProduct.vue +++ b/src/views/supplierManage/supplier/AddNewProduct.vue @@ -14,6 +14,7 @@ <div class="basic-info-title">浜у搧淇℃伅</div> <div class="basic-info-view"> <CommonFormTableView + ref="productTable" :product-table-list="productTableList" :detail-enter="detailEnter" @inputContent="inputContent" @@ -78,41 +79,45 @@ }, // 淇濆瓨 saveClick() { - console.log(this.editConfig.infomation) - for (let i = 0; i < this.tableData.length; i++) { - if (this.tableData[i].name.length === 0) { - this.isNoProduct = true - break - } else { - this.isNoProduct = false - } - } - if (this.isNoProduct) { - this.$message.error("浜у搧鍚嶇О涓嶈兘涓虹┖") - } else { - if (this.editConfig.title === "娣诲姞") { - createProduct({ - list: this.tableData - }).then((res) => { - console.log(res) - this.editConfig.visible = false - if (res.code === 200) { - this.$message.success("娣诲姞鎴愬姛") - this.$parent.getProductList() + this.$refs.productTable.$refs.form.validate((valid) => { + if (valid) { + console.log(this.editConfig.infomation) + for (let i = 0; i < this.tableData.length; i++) { + if (this.tableData[i].name.length === 0) { + this.isNoProduct = true + break + } else { + this.isNoProduct = false } - }) - } else { - const params = this.saveParams() - updateProduct(params).then((res) => { - console.log(res) - this.editConfig.visible = false - if (res.code === 200) { - this.$message.success("缂栬緫鎴愬姛") - this.$parent.getProductList() + } + if (this.isNoProduct) { + this.$message.error("浜у搧鍚嶇О涓嶈兘涓虹┖") + } else { + if (this.editConfig.title === "娣诲姞") { + createProduct({ + list: this.tableData + }).then((res) => { + console.log(res) + this.editConfig.visible = false + if (res.code === 200) { + this.$message.success("娣诲姞鎴愬姛") + this.$parent.getProductList() + } + }) + } else { + const params = this.saveParams() + updateProduct(params).then((res) => { + console.log(res) + this.editConfig.visible = false + if (res.code === 200) { + this.$message.success("缂栬緫鎴愬姛") + this.$parent.getProductList() + } + }) } - }) + } } - } + }) }, saveParams() { let data = this.editConfig.infomation diff --git a/src/views/supplierManage/supplier/index.vue b/src/views/supplierManage/supplier/index.vue index 2562d39..d5d4eb0 100644 --- a/src/views/supplierManage/supplier/index.vue +++ b/src/views/supplierManage/supplier/index.vue @@ -13,49 +13,30 @@ </div> </div> <template> - <el-table - ref="tableSupplier" - border - :data="tableList.tableInfomation" - tooltip-effect="dark" - style="width: 100%" - :lazy="tableList.lazy" - highlight-current-row - @row-click="tableRowClick" - :header-cell-style="{ background: '#ECF4FF', color: '#666' }" - > - <el-table-column type="index" label="搴忓彿" width="50"> </el-table-column> - <el-table-column - v-for="(item, i) in tableList.tableColumn" - :key="i" - :prop="item.prop" - :label="item.label" - :width="item.width" - :min-width="item.min" - show-overflow-tooltip - :sortable="item.sortable" + <div class="list-view"> + <TableCommonView + ref="tableSupplier" + :table-list="tableList" + @selCommonClick="selCommonClick" + @tableRowClick="tableRowClick" > - <template slot-scope="scope"> - <div v-if="item.status" :class="scope.row.status">{{ scope.row[item.prop] }}</div> - <span - v-else-if="item.isCommonClick && scope.row[item.prop]" - class="sel-name" - @click="selCommonClick(scope.row)" - >{{ scope.row[item.prop] }}</span - > - <span v-else>{{ scope.row[item.prop] ? scope.row[item.prop] : "--" }}</span> + <template slot="tableButton"> + <el-table-column label="鎿嶄綔" width="100"> + <template slot-scope="scope"> + <el-button + v-if="scope.row.status === 0" + @click="enableClick(scope.row, '鍚敤')" + type="text" + size="small" + >鍚敤</el-button + > + <el-button v-else @click="enableClick(scope.row, '鍋滅敤')" type="text" size="small">鍋滅敤</el-button> + <el-button @click="modifyClick(scope.row)" type="text" size="small">淇敼</el-button> + </template> + </el-table-column> </template> - </el-table-column> - <el-table-column label="鎿嶄綔" width="100"> - <template slot-scope="scope"> - <el-button v-if="scope.row.status === 0" @click="enableClick(scope.row, '鍚敤')" type="text" size="small" - >鍚敤</el-button - > - <el-button v-else @click="enableClick(scope.row, '鍋滅敤')" type="text" size="small">鍋滅敤</el-button> - <el-button @click="modifyClick(scope.row)" type="text" size="small">淇敼</el-button> - </template> - </el-table-column> - </el-table> + </TableCommonView> + </div> <div class="btn-pager"> <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" /> </div> @@ -79,22 +60,24 @@ </div> </div> <template> - <TableCommonView - ref="tableListProduct" - :table-list="productTableList" - @selCommonClick="selCommonClick" - @getSelectArray="getSelectArray" - > - <template slot="tableButton"> - <el-table-column label="鎿嶄綔" width="170"> - <template slot-scope="scope"> - <el-button @click="raleteClick(scope.row)" type="text" size="small">鐩稿叧渚涘簲鍟�</el-button> - <el-button @click="editClick(scope.row)" type="text" size="small">淇敼</el-button> - <el-button @click="delClick(scope.row)" type="text" size="small">鍒犻櫎</el-button> - </template> - </el-table-column> - </template> - </TableCommonView> + <div class="list-view"> + <TableCommonView + ref="tableListProduct" + :table-list="productTableList" + @selCommonClick="selCommonClick" + @getSelectArray="getSelectArray" + > + <template slot="tableButton"> + <el-table-column label="鎿嶄綔" width="170"> + <template slot-scope="scope"> + <el-button @click="raleteClick(scope.row)" type="text" size="small">鐩稿叧渚涘簲鍟�</el-button> + <el-button @click="editClick(scope.row)" type="text" size="small">淇敼</el-button> + <el-button @click="delClick(scope.row)" type="text" size="small">鍒犻櫎</el-button> + </template> + </el-table-column> + </template> + </TableCommonView> + </div> <div class="btn-pager"> <PagerView class="page" :pager-options="productPagerOptions" v-on="pagerEvents" /> </div> @@ -169,6 +152,7 @@ this.tableList = { tableInfomation: [], selectIndex: true, + highlight: true, ref: "tableListRef", tableColumn: [ { label: "渚涘簲鍟嗙紪鍙�", prop: "number", min: 190, isCommonClick: true }, @@ -237,7 +221,7 @@ this.supplierId = 0 } this.$nextTick(() => { - this.$refs.tableSupplier.setCurrentRow(this.tableList.tableInfomation[0]) + this.$refs.tableSupplier.$refs.table.setCurrentRow(this.tableList.tableInfomation[0]) }) this.getProductList() } @@ -367,8 +351,16 @@ <!-- Add "scoped" attribute to limit CSS to this component only --> <style lang="scss" scoped> .rightContent { + height: 100%; + background: #f0f2f5; + padding: 10px; .top { margin-bottom: 20px; + height: 55%; + background: #fff; + .list-view { + height: calc(100% - 120px); + } .supplier-search { display: flex; align-items: center; @@ -381,14 +373,20 @@ color: $color-primary; cursor: pointer; } - .btn-pager { - display: flex; - .page { - margin-left: auto; - } - } + // .btn-pager { + // display: flex; + // .page { + // margin-left: auto; + // } + // } } .bottom { + margin-top: 20px; + height: calc(40% - 0px); + background: #fff; + .list-view { + height: calc(100% - 120px); + } .product-search { display: flex; align-items: center; @@ -398,12 +396,6 @@ .add-view { margin-left: 20px; margin-right: 20px; - } - } - .btn-pager { - display: flex; - .page { - margin-left: auto; } } } -- Gitblit v1.8.0