From d1fad869b261b62ab6037e5c0f641ff63d50f24b Mon Sep 17 00:00:00 2001 From: yangfeng <wanwan926_4@163.com> Date: 星期五, 15 九月 2023 15:09:13 +0800 Subject: [PATCH] 产品类别列表及对应产品列表、新建页面和FromBtnsView公共组件开发 --- src/views/overview/OverviewListView.vue | 31 - src/router/product/index.js | 18 + src/components/index.js | 3 src/views/productManage/productCategory/ProductList.vue | 218 ++++++++++++ src/components/makepager/StatusCommonView.vue | 12 src/router/index.js | 7 src/views/productManage/product/AddProductDialog.vue | 59 --- src/views/productManage/productCategory/index.vue | 132 +++++++ src/components/makepager/TableCommonView.vue | 6 src/assets/style/index.scss | 3 src/views/productManage/productCategory/AddProductCategoryDialog.vue | 349 ++++++++++++++++++++ src/components/layout/components/appsidebar/index.vue | 6 src/components/makepager/FormBtnsView.vue | 153 +++++++++ 13 files changed, 906 insertions(+), 91 deletions(-) diff --git a/src/assets/style/index.scss b/src/assets/style/index.scss index dd1639e..86a266b 100644 --- a/src/assets/style/index.scss +++ b/src/assets/style/index.scss @@ -189,5 +189,8 @@ height: calc(100% - 120px); background: #fff; border-radius: 12px; + .table { + height: calc(100% - 55px); + } } } diff --git a/src/components/index.js b/src/components/index.js index 99b05a3..292af99 100644 --- a/src/components/index.js +++ b/src/components/index.js @@ -3,8 +3,9 @@ import PagerView from "@/components/makepager/pager/PagerView" import TableCommonView from "@/components/makepager/TableCommonView" import StatusCommonView from "@/components/makepager/StatusCommonView" +import FormBtnsView from "@/components/makepager/FormBtnsView" -const components = [SearchCommonView, PagerView, TableCommonView, StatusCommonView] +const components = [SearchCommonView, PagerView, TableCommonView, StatusCommonView, FormBtnsView] components.forEach((component) => { Vue.component(component.name, component) }) diff --git a/src/components/layout/components/appsidebar/index.vue b/src/components/layout/components/appsidebar/index.vue index 2721f3a..f662cb6 100644 --- a/src/components/layout/components/appsidebar/index.vue +++ b/src/components/layout/components/appsidebar/index.vue @@ -29,15 +29,15 @@ <span>浜у搧</span> </template> <el-menu-item index="/productManage/product">浜у搧</el-menu-item> - <el-menu-item index="/purchaseManage/quality">浜у搧绫诲埆</el-menu-item> + <el-menu-item index="/productManage/productCategory">浜у搧绫诲埆</el-menu-item> </el-submenu> <el-submenu index="3"> <template slot="title"> <i class="el-icon-setting icon"></i> <span>鎿嶄綔</span> </template> - <el-menu-item index="/productManage/product">琛ヨ揣</el-menu-item> - <el-menu-item index="/productManage/product">搴撳瓨璋冩暣</el-menu-item> + <!-- <el-menu-item index="/productManage/product">琛ヨ揣</el-menu-item> + <el-menu-item index="/productManage/product">搴撳瓨璋冩暣</el-menu-item> --> <el-menu-item index="/productManage/product">璋冩嫧</el-menu-item> <el-menu-item index="/productManage/product">鎶ュ簾</el-menu-item> </el-submenu> diff --git a/src/components/makepager/FormBtnsView.vue b/src/components/makepager/FormBtnsView.vue new file mode 100644 index 0000000..982a477 --- /dev/null +++ b/src/components/makepager/FormBtnsView.vue @@ -0,0 +1,153 @@ +<template> + <div class="content-number"> + <div v-if="!showProduct && !showWarehouse && !showPosition" class="sub-number"> + <div class="left"><i class="el-icon-s-fold"></i></div> + <div class="right"> + <div class="right-label">{{ 0 }}</div> + <div class="right-label">棰濆鐨勪环鏍�</div> + </div> + </div> + <div v-if="!showProduct && !showWarehouse && !showPosition" class="sub-number"> + <div class="left"><i class="el-icon-present"></i></div> + <div class="right"> + <div class="right-label">{{ "0.00" + "浠�" }}</div> + <div class="right-label">鍦ㄦ墜</div> + </div> + </div> + <div v-if="!showProduct && !showWarehouse && !showPosition" class="sub-number"> + <div class="left"><i class="el-icon-present"></i></div> + <div class="right"> + <div class="right-label">{{ "0.00" + "浠�" }}</div> + <div class="right-label">棰勬祴</div> + </div> + </div> + <div + v-if="!showProduct && !showWarehouse && !showPosition" + class="sub-number" + @click="inOutBoundClick" + style="cursor: pointer" + > + <div class="left icon-view"><i class="el-icon-sort"></i></div> + <div class="right"> + <div class="right-label">{{ "杩�: " + 0 }}</div> + <div class="right-label">{{ "鍑�: " + 0 }}</div> + </div> + </div> + <div v-if="!showProduct && !showWarehouse && !showPosition" class="sub-number"> + <div class="left"><i class="el-icon-refresh"></i></div> + <div class="right"> + <div class="right-label">{{ 0 }}</div> + <div class="right-label">閲嶈璐ц鍒�</div> + </div> + </div> + <div v-if="showProduct" class="sub-number right-border" @click="productClick" style="cursor: pointer"> + <div class="left"><i class="el-icon-s-fold"></i></div> + <div class="right"> + <div class="right-label">{{ 0 }}</div> + <div class="right-label">浜у搧</div> + </div> + </div> + <div v-if="!showWarehouse" class="sub-number"> + <div class="left"><i class="el-icon-help"></i></div> + <div class="right"> + <div class="right-one">涓婃灦瑙勫垯</div> + </div> + </div> + <div v-if="!showProduct && !showWarehouse && !showPosition" class="sub-number"> + <div class="left"><i class="el-icon-s-data"></i></div> + <div class="right"> + <div class="right-label">{{ "0.00" + "浠�" }}</div> + <div class="right-label">宸插敭</div> + </div> + </div> + <div v-if="!showProduct && !showWarehouse && !showPosition" class="sub-number"> + <div class="left"><i class="el-icon-bank-card"></i></div> + <div class="right"> + <div class="right-label">{{ "0.00" + "浠�" }}</div> + <div class="right-label">宸查噰璐�</div> + </div> + </div> + <div v-if="showPosition" class="sub-number"> + <div class="left"><i class="el-icon-help"></i></div> + <div class="right"> + <div class="right-one">褰撳墠搴撳瓨</div> + </div> + </div> + <div v-if="showWarehouse" class="sub-number"> + <div class="left"><i class="el-icon-help"></i></div> + <div class="right"> + <div class="right-one">璺嚎</div> + </div> + </div> + </div> +</template> +<script> +export default { + name: "FormBtnsView", + props: { + showProduct: { + type: Boolean, + default: false + }, + showWarehouse: { + type: Boolean, + default: false + }, + showPosition: { + type: Boolean, + default: false + } + }, + data() { + return {} + }, + methods: { + // 杩涘嚭 + inOutBoundClick() { + this.$emit("inOutBoundClick") + }, + // 浜у搧 + productClick() { + this.$emit("productClick") + } + } +} +</script> + +<!-- Add "scoped" attribute to limit CSS to this component only --> +<style lang="scss" scoped> +.content-number { + display: flex; + justify-content: right; + height: 44px; + border-bottom: 1px solid #e9e9e9; + font-size: 13px; + .sub-number { + width: 12.5%; + border-right: 1px solid #e9e9e9; + display: flex; + padding: 3px 9px; + .left { + margin-top: 3px; + font-size: 22px; + font-weight: 600; + } + .icon-view { + transform: rotate(270deg); + } + .right { + margin-left: 6px; + .right-label { + color: #495057; + } + .right-one { + height: 38px; + line-height: 38px; + } + } + } + .right-border { + border-left: 1px solid #e9e9e9; + } +} +</style> diff --git a/src/components/makepager/StatusCommonView.vue b/src/components/makepager/StatusCommonView.vue index d8b23c8..dd91c7d 100644 --- a/src/components/makepager/StatusCommonView.vue +++ b/src/components/makepager/StatusCommonView.vue @@ -60,13 +60,13 @@ } }, data() { - return { - delClick() { - this.$emit("delClick") - } - } + return {} }, - methods: {} + methods: { + delClick() { + this.$emit("delClick") + } + } } </script> diff --git a/src/components/makepager/TableCommonView.vue b/src/components/makepager/TableCommonView.vue index 1627f0d..10a0bca 100644 --- a/src/components/makepager/TableCommonView.vue +++ b/src/components/makepager/TableCommonView.vue @@ -79,7 +79,7 @@ </div> </el-table> <div class="overSpread1" v-show="iscolopen" @click="onMaskClick"></div> - <div class="styleBtn"> + <div v-if="showCheckcol" class="styleBtn"> <i @click="checkcol()" class="label">...</i> <el-checkbox-group v-model="showcolList" v-show="iscolopen" class="checkbox-group" @change="selCeckBoxList"> <el-checkbox v-for="item in tableList.allcol" :label="item" :key="item">{{ item }} </el-checkbox> @@ -133,6 +133,10 @@ default: () => { return {} } + }, + showCheckcol: { + type: Boolean, + default: true } }, data() { diff --git a/src/router/index.js b/src/router/index.js index b12b86e..1650b9d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -97,7 +97,12 @@ const router = createRouter() router.afterEach((to, from, next) => { - if ((to.path === "/overview/overviewList" || to.path === "/reportForm/inOutboundDetail") && to.query.name) { + if ( + (to.path === "/overview/overviewList" || + to.path === "/reportForm/inOutboundDetail" || + to.path === "/productManage/productList") && + to.query.name + ) { console.log(from, next) to.meta.title = to.query.name document.title = to.meta.title diff --git a/src/router/product/index.js b/src/router/product/index.js index b132e6c..a869524 100644 --- a/src/router/product/index.js +++ b/src/router/product/index.js @@ -2,6 +2,8 @@ const product = (resolve) => require(["@/views/productManage/product/index"], resolve) // 浜у搧 const inOutboundDetail = (resolve) => require(["@/views/reportForm/inboundOutboundDetail/index"], resolve) // 鍑哄叆搴撴槑缁� +const productCategory = (resolve) => require(["@/views/productManage/productCategory/index"], resolve) // 浜у搧绫诲埆 +const productList = (resolve) => require(["@/views/productManage/productCategory/ProductList"], resolve) // 浜у搧绫诲埆-浜у搧 const appconfig = [ { @@ -13,12 +15,28 @@ } }, { + path: "/productManage/productCategory", + name: "productCategory", + component: productCategory, + meta: { + title: "浜у搧绫诲埆" + } + }, + { path: "/reportForm/inOutboundDetail", name: "inOutboundDetail", component: inOutboundDetail, meta: { title: "鍑哄叆搴撴槑缁�" } + }, + { + path: "/productManage/productList", + name: "productList", + component: productList, + meta: { + title: "浜у搧" + } } ] diff --git a/src/views/overview/OverviewListView.vue b/src/views/overview/OverviewListView.vue index 348e6ee..b8044ad 100644 --- a/src/views/overview/OverviewListView.vue +++ b/src/views/overview/OverviewListView.vue @@ -10,12 +10,14 @@ /> </div> <div class="list-view"> - <TableCommonView - ref="tableListRef" - :table-list="tableList" - @selTableCol="selTableCol" - @tableRowClick="tableRowClick" - ></TableCommonView> + <div class="table"> + <TableCommonView + ref="tableListRef" + :table-list="tableList" + @selTableCol="selTableCol" + @tableRowClick="tableRowClick" + ></TableCommonView> + </div> <div class="btn-pager"> <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" /> </div> @@ -208,19 +210,4 @@ </script> <!-- Add "scoped" attribute to limit CSS to this component only --> -<style lang="scss" scoped> -// .rightContent { -// height: 100%; -// background: #e6ecf2; -// padding: 10px; -// .top { -// margin-bottom: 20px; -// height: 60px; -// background: #fff; -// border-radius: 8px; -// } -// .list-view { -// height: calc(100% - 120px); -// } -// } -</style> +<style lang="scss" scoped></style> diff --git a/src/views/productManage/product/AddProductDialog.vue b/src/views/productManage/product/AddProductDialog.vue index 7320da8..b71c4a6 100644 --- a/src/views/productManage/product/AddProductDialog.vue +++ b/src/views/productManage/product/AddProductDialog.vue @@ -38,63 +38,7 @@ </div> <div class="basic-info"> - <div class="content-number"> - <div class="sub-number"> - <div class="left"><i class="el-icon-s-fold"></i></div> - <div class="right"> - <div class="right-label">{{ 0 }}</div> - <div class="right-label">棰濆鐨勪环鏍�</div> - </div> - </div> - <div class="sub-number"> - <div class="left"><i class="el-icon-present"></i></div> - <div class="right"> - <div class="right-label">{{ "0.00" + "浠�" }}</div> - <div class="right-label">鍦ㄦ墜</div> - </div> - </div> - <div class="sub-number"> - <div class="left"><i class="el-icon-present"></i></div> - <div class="right"> - <div class="right-label">{{ "0.00" + "浠�" }}</div> - <div class="right-label">棰勬祴</div> - </div> - </div> - <div class="sub-number" @click="inOutBoundClick" style="cursor: pointer"> - <div class="left icon-view"><i class="el-icon-sort"></i></div> - <div class="right"> - <div class="right-label">{{ "杩�: " + 0 }}</div> - <div class="right-label">{{ "鍑�: " + 0 }}</div> - </div> - </div> - <div class="sub-number"> - <div class="left"><i class="el-icon-refresh"></i></div> - <div class="right"> - <div class="right-label">{{ 0 }}</div> - <div class="right-label">閲嶈璐ц鍒�</div> - </div> - </div> - <div class="sub-number"> - <div class="left"><i class="el-icon-help"></i></div> - <div class="right"> - <div class="right-one">涓婃灦瑙勫垯</div> - </div> - </div> - <div class="sub-number"> - <div class="left"><i class="el-icon-s-data"></i></div> - <div class="right"> - <div class="right-label">{{ "0.00" + "浠�" }}</div> - <div class="right-label">宸插敭</div> - </div> - </div> - <div class="sub-number"> - <div class="left"><i class="el-icon-bank-card"></i></div> - <div class="right"> - <div class="right-label">{{ "0.00" + "浠�" }}</div> - <div class="right-label">宸查噰璐�</div> - </div> - </div> - </div> + <FormBtnsView @inOutBoundClick="inOutBoundClick" /> <div class="basic-info-view"> <el-row> <el-col :span="20"> @@ -464,6 +408,7 @@ <script> import CommonFormTableView from "@/components/makepager/CommonFormTableView" + let inputElement = null export default { name: "AddProductDialog", diff --git a/src/views/productManage/productCategory/AddProductCategoryDialog.vue b/src/views/productManage/productCategory/AddProductCategoryDialog.vue new file mode 100644 index 0000000..32c5b96 --- /dev/null +++ b/src/views/productManage/productCategory/AddProductCategoryDialog.vue @@ -0,0 +1,349 @@ +<template> + <div class="add-common"> + <el-dialog + :title="editCommonConfig.title + '浜у搧绫诲埆'" + :visible.sync="editConfig.visible" + :width="dialogWidth" + :before-close="handleClose" + > + <!-- 澶� --> + <div slot="title" class="dialog-header"> + <span>{{ editCommonConfig.title + "浜у搧绫诲埆" }}</span> + <div class="header_btns"> + <!-- <span class="btn"> + <i class="el-icon-printer"></i> + <span>鎵撳嵃</span> + </span> --> + <span class="btn" style="margin-left: 15px"> + <i class="el-icon-s-tools"></i> + <span>鍔ㄤ綔</span> + </span> + <el-button v-if="showEdit" plain size="mini" style="margin-left: 15px" @click="editClick">缂栬緫</el-button> + </div> + </div> + <!-- 鍐呭 --> + <el-form + ref="form" + :model="editConfig.infomation" + :rules="rules" + label-position="left" + label-width="110px" + size="mini" + style="height: 60vh; overflow-x: hidden" + > + <div class="basic-info"> + <FormBtnsView :showProduct="true" @productClick="productClick" /> + <div class="basic-info-view"> + <el-row> + <el-col :span="24"> + <div style="margin-left: 20px">绫诲埆</div> + <el-form-item label="" prop="client_name" label-width="20px"> + <el-input + v-model="editConfig.infomation.client_name" + placeholder="" + :disabled="!showFooter" + style="width: 85%" + ></el-input> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="涓婄骇鍝佺被" prop="client_name" style="margin-left: 20px"> + <el-select + v-model="editConfig.infomation.memberId" + placeholder="璇烽�夋嫨" + size="mini" + style="width: 45%" + :disabled="!showFooter" + > + <el-option v-for="item in memberOptions" :key="item.id" :label="item.username" :value="item.id"> + </el-option> + </el-select> + </el-form-item> + </el-col> + </el-row> + </div> + <div class="bottom"> + <div class="purchase-view"> + <div class="left"> + <div class="second-label">鐗╂祦</div> + <el-form-item label="璺嚎" prop="client_name" style="margin-left: 20px"> + <el-select + v-model="editConfig.infomation.memberId" + multiple + placeholder="璇烽�夋嫨" + size="mini" + style="width: 63%" + :disabled="!showFooter" + > + <el-option v-for="item in memberOptions" :key="item.id" :label="item.username" :value="item.id"> + </el-option> + </el-select> + </el-form-item> + <el-form-item label="寮哄埗涓嬫灦绛栫暐" prop="client_name" style="margin-left: 20px"> + <el-select + v-model="editConfig.infomation.memberId" + multiple + placeholder="璇烽�夋嫨" + size="mini" + style="width: 63%" + :disabled="!showFooter" + > + <el-option v-for="item in memberOptions" :key="item.id" :label="item.username" :value="item.id"> + </el-option> + </el-select> + </el-form-item> + </div> + <div class="right"> + <div class="second-label">搴撳瓨璁′环</div> + <el-form-item label="鎴愭湰鏂规硶" prop="client_name" style="margin-left: 20px"> + <el-select + v-model="editConfig.infomation.memberId" + multiple + placeholder="璇烽�夋嫨" + size="mini" + style="width: 63%" + :disabled="!showFooter" + > + <el-option v-for="item in memberOptions" :key="item.id" :label="item.username" :value="item.id"> + </el-option> + </el-select> + </el-form-item> + <el-form-item label="搴撳瓨璁′环" prop="client_name" style="margin-left: 20px"> + <el-select + v-model="editConfig.infomation.memberId" + multiple + placeholder="璇烽�夋嫨" + size="mini" + style="width: 63%" + :disabled="!showFooter" + > + <el-option v-for="item in memberOptions" :key="item.id" :label="item.username" :value="item.id"> + </el-option> + </el-select> + </el-form-item> + </div> + </div> + </div> + </div> + </el-form> + <!-- 灏� --> + <div v-if="showFooter" slot="footer" class="dialog-footer"> + <!-- <el-button type="primary" size="small" @click="editConfig.visible = false">淇濆苟鎻愪氦瀹℃壒</el-button> --> + <el-button type="primary" size="small" @click="saveClick('form')">淇濆瓨</el-button> + <el-button size="small" @click="editConfig.visible = false">鍙栨秷</el-button> + </div> + </el-dialog> + </div> +</template> + +<script> +export default { + name: "AddProductCategoryDialog", + props: { + editCommonConfig: { + type: Object, + default: () => { + return { + visible: false, + title: "鏂板缓", + infomation: { type: [] } + } + } + } + }, + components: {}, + computed: {}, + data() { + return { + dialogWidth: "50%", + editConfig: this.editCommonConfig, + rules: { + client_name: [{ required: true, message: "璇烽�夋嫨瀹㈡埛鍚嶇О", trigger: "change" }], + number: [{ required: true, message: "璇疯緭鍏ラ��娆惧崟缂栧彿", trigger: "blur" }], + refundDate: [{ required: true, message: "璇烽�夋嫨閫�娆炬棩鏈�", trigger: "change" }], + memberId: [{ required: true, message: "璇烽�夋嫨閿�鍞礋璐d汉", trigger: "change" }], + sale_return_nunber: [{ required: true, message: "璇烽�夋嫨閿�鍞��璐у崟", trigger: "change" }] + }, + memberOptions: [], + paymentTypeListOptions: [], + showButton: true, + showEdit: false, // 鏄惁鏄剧ず缂栬緫鎸夐挳 + isDelClick: false, // 鍒犻櫎鎸夐挳鏄惁鍙偣鍑� + showFooter: false // 鏄惁鏄剧ず鍙栨秷淇濆瓨 + } + }, + created() { + this.setBottonView() + }, + methods: { + // 璁剧疆鍒犻櫎/鎵撳嵃/缂栬緫鏄惁鏄剧ず + setBottonView() { + if (this.editConfig.title === "鏂板缓") { + this.showButton = false + this.showEdit = false + this.showFooter = true + } else { + this.showEdit = true + this.showFooter = false + } + }, + // 鍏抽棴 + handleClose() { + this.editConfig.visible = false + }, + // 缂栬緫 + editClick() { + this.showEdit = false + this.showButton = false + this.showFooter = true + }, + // 淇濆瓨 + saveClick() {}, + // 鍒犻櫎 + delClick() {}, + // 浜у搧 + productClick() { + this.$router.push({ path: "/productManage/productList", query: { name: "浜у搧" } }) + } + } +} +</script> + +<!-- Add "scoped" attribute to limit CSS to this component only --> +<style lang="scss" scoped> +.dialog-header { + display: flex; + align-items: center; + font-size: 14px; + color: #333; + .header_btns { + margin-left: auto; + margin-right: 60px; + .btn { + cursor: no-drop; + } + } +} +.content-btn { + height: 37px; + line-height: 37px; + padding-left: 20px; + border-bottom: 1px solid #e9e9e9; +} +.basic-info { + height: calc(100% - 80px); + overflow: auto; + margin: 20px; + border: 1px solid #dcdfe6; + box-shadow: inset 0 0 2px #dee2e6; + -moz-box-shadow: inset 0 0 2px #dee2e6; + -webkit-box-shadow: inset 0 0 2px #dee2e6; + .content-number { + display: flex; + justify-content: right; + height: 44px; + border-bottom: 1px solid #e9e9e9; + font-size: 13px; + .sub-number { + width: 12.5%; + border-right: 1px solid #e9e9e9; + display: flex; + padding: 3px 9px; + .left { + margin-top: 3px; + font-size: 22px; + font-weight: 600; + } + .icon-view { + transform: rotate(270deg); + } + .right { + margin-left: 6px; + .right-label { + color: #495057; + } + .right-one { + height: 38px; + line-height: 38px; + } + } + } + } + .basic-info-view { + margin-top: 20px; + .upload { + position: relative; + width: 90px; + height: 90px; + margin-left: 40px; + border: 1px dotted #d9d9d9; + border-radius: 4px; + .upload-icon { + position: absolute; + top: 40%; + right: 43%; + } + } + } + .purchase-view { + display: flex; + .left { + width: 50%; + } + .right { + width: 50%; + } + } + .second-label { + margin-left: 20px; + border-bottom: 1px solid #d9d9d9; + margin-bottom: 10px; + } + .list-item { + width: 300px; + } + .avatar-uploader .el-upload { + border: 1px dashed #d9d9d9; + border-radius: 6px; + cursor: pointer; + position: relative; + overflow: hidden; + } + .avatar-uploader .el-upload:hover { + border-color: #409eff; + } + .avatar-uploader-icon { + font-size: 28px; + color: #8c939d; + width: 178px; + height: 178px; + line-height: 178px; + text-align: center; + } + .avatar { + width: 178px; + height: 178px; + display: block; + } +} +::v-deep { + .el-dialog__headerbtn { + position: absolute; + top: 18px; + } + .el-button { + &:hover { + border: 1px solid #dcdfe6; + color: #333; + } + } + .el-tabs--card > .el-tabs__header .el-tabs__nav { + margin-left: 20px; + } + .el-tabs__item { + height: 30px; + line-height: 30px; + font-size: 13px; + } +} +</style> diff --git a/src/views/productManage/productCategory/ProductList.vue b/src/views/productManage/productCategory/ProductList.vue new file mode 100644 index 0000000..1ab6b68 --- /dev/null +++ b/src/views/productManage/productCategory/ProductList.vue @@ -0,0 +1,218 @@ +<template> + <div class="rightContent"> + <div class="top"> + <SearchCommonView + :add-title="'鏂板缓'" + :placeholder="'璇疯緭鍏ヤ骇鍝佸悕绉�'" + :amount-view="false" + @addCommonClick="addBtnClick" + @searchClick="searchClick" + /> + </div> + <div class="list-view"> + <div class="table"> + <TableCommonView + ref="tableListRef" + :table-list="tableList" + @selTableCol="selTableCol" + @tableRowClick="tableRowClick" + > + </TableCommonView> + </div> + <div class="btn-pager"> + <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" /> + </div> + </div> + <!-- 鏂板缓/缂栬緫 --> + <AddProductDialog v-if="editConfig.visible" :edit-common-config="editConfig" /> + </div> +</template> + +<script> +import pageMixin from "@/components/makepager/pager/mixin/pageMixin" +import { getProductList } from "@/api/product/product" +// import DetailProduct from "@/views/productManage/product/DetailProduct" +import AddProductDialog from "@/views/productManage/product/AddProductDialog" + +export default { + name: "ProductList", + props: {}, + components: { AddProductDialog }, + mixins: [pageMixin], + computed: {}, + data() { + return { + tableList: {}, + showcol: ["鍐呴儴鍙傝��", "璐熻矗浜�", "浜у搧鏍囩", "閿�鍞环鏍�", "鎴愭湰", "鍦ㄥ簱鏁伴噺", "棰勬祴鏁伴噺", "璁¢噺鍗曚綅"], + searchOptions: [], + commonDetail: { + visible: false, + title: "鏂板缓", + infomation: {} + }, + editConfig: { + visible: false, + title: "鏂板缓", + infomation: {} + }, + isIconIndex: "1", // 1 鍥炬爣 2 鍒楄〃 + url: "https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg" + } + }, + created() { + this.setTable() + this.getData() + }, + methods: { + setTable() { + this.tableList = { + tableInfomation: [], + selectBox: true, + showcol: this.showcol, + allcol: [], + tableColumn: this.setTableColumn(this.showcol) + } + let allcol = [] + for (let i = 0; i < this.tableList.tableColumn.length; i++) { + if (!this.tableList.tableColumn[i].default) { + const label = this.tableList.tableColumn[i].label + allcol.push(label) + } + } + this.tableList.allcol = allcol + }, + setTableColumn(showcol) { + let tableColumn = [ + { + label: "浜у搧鍚嶇О", + prop: "id", + isShowColumn: true, + default: true + }, + { + label: "鍐呴儴鍙傝��", + prop: "deviceName", + isShowColumn: showcol.includes("鍐呴儴鍙傝��"), + default: false + }, + { + label: "璐熻矗浜�", + prop: "id", + isShowColumn: true, + default: true + }, + { + label: "浜у搧鏍囩", + prop: "deviceId", + isShowColumn: showcol.includes("浜у搧鏍囩"), + default: false + }, + { + label: "鏉$爜", + prop: "shopName", + isShowColumn: showcol.includes("鏉$爜"), + default: false + }, + { + label: "鍏徃", + prop: "shopName", + isShowColumn: showcol.includes("鍏徃"), + default: false + }, + { + label: "閿�鍞环鏍�", + prop: "faultLevel", + isShowColumn: showcol.includes("閿�鍞环鏍�"), + default: false + }, + { + label: "鎴愭湰", + prop: "status", + isShowColumn: showcol.includes("鎴愭湰"), + default: false, + status: true + }, + { + label: "浜у搧绫诲埆", + prop: "faultTime", + isShowColumn: showcol.includes("浜у搧绫诲埆"), + default: false + }, + { + label: "浜у搧绫诲瀷", + prop: "shopName", + isShowColumn: showcol.includes("浜у搧绫诲瀷"), + default: false + }, + { + label: "鍦ㄥ簱鏁伴噺", + prop: "faultLevel", + isShowColumn: showcol.includes("鍦ㄥ簱鏁伴噺"), + default: false + }, + { + label: "棰勬祴鏁伴噺", + prop: "status", + isShowColumn: showcol.includes("棰勬祴鏁伴噺"), + default: false, + status: true + }, + { + label: "璁¢噺鍗曚綅", + prop: "faultTime", + isShowColumn: showcol.includes("璁¢噺鍗曚綅"), + default: false + } + ] + return tableColumn + }, + selTableCol(val) { + this.showcol = val + this.tableList.tableColumn = this.setTableColumn(val) + }, + // 璇锋眰鏁版嵁 + async getData(val, content) { + await getProductList({ + [val]: content, + page: this.pagerOptions.currPage, + pageSize: this.pagerOptions.pageSize + }).then((res) => { + if (res.data.code === 200) { + const list = res.data.data.list.map((item) => { + return { + ...item, + supplierNumber: item.supplier.number + } + }) + this.tableList.tableInfomation = list || [] + this.pagerOptions.totalCount = res.data.data.total + } + }) + }, + // 鎼滅储 + searchClick(val) { + console.log(val) + this.getData() + }, + // 鏂板缓 + addBtnClick() { + this.editConfig.visible = true + this.editConfig.title = "鏂板缓" + }, + // 琛岀偣鍑� + tableRowClick(row) { + console.log(row) + this.editConfig.visible = true + this.editConfig.title = "缂栬緫" + this.editConfig.infomation = { ...row } + }, + // 鍒囨崲鍒楄〃灞曠幇褰㈠紡 + selIconSwitchClick(value) { + this.isIconIndex = value + } + } +} +</script> + +<!-- Add "scoped" attribute to limit CSS to this component only --> +<style lang="scss" scoped></style> diff --git a/src/views/productManage/productCategory/index.vue b/src/views/productManage/productCategory/index.vue new file mode 100644 index 0000000..cdaaf4d --- /dev/null +++ b/src/views/productManage/productCategory/index.vue @@ -0,0 +1,132 @@ +<template> + <div class="rightContent"> + <div class="top"> + <SearchCommonView + :add-title="'鏂板缓'" + :placeholder="'璇疯緭鍏ュ崟鍙�'" + :amount-view="false" + @addCommonClick="addBtnClick" + @searchClick="getList" + /> + </div> + <div class="list-view"> + <TableCommonView + ref="tableListRef" + :table-list="tableList" + :show-checkcol="false" + @tableRowClick="tableRowClick" + ></TableCommonView> + <div class="btn-pager"> + <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" /> + </div> + </div> + <!-- 鏂板缓/缂栬緫 --> + <AddProductCategoryDialog v-if="editConfig.visible" :edit-common-config="editConfig" /> + </div> +</template> + +<script> +import pageMixin from "@/components/makepager/pager/mixin/pageMixin" +import { getProductList } from "@/api/product/product" +// import DetailProduct from "@/views/productManage/product/DetailProduct" +import AddProductCategoryDialog from "@/views/productManage/productCategory/AddProductCategoryDialog" + +export default { + name: "ProductCategory", + props: {}, + components: { AddProductCategoryDialog }, + mixins: [pageMixin], + computed: {}, + data() { + return { + tableList: {}, + searchOptions: [], + commonDetail: { + visible: false, + title: "鏂板缓", + infomation: {} + }, + editConfig: { + visible: false, + title: "鏂板缓", + infomation: {} + } + } + }, + created() { + this.setTable() + this.getData() + }, + methods: { + setTable() { + this.tableList = { + tableInfomation: [], + selectBox: true, + tableColumn: [ + { + label: "浜у搧绫诲瀷", + prop: "id", + isShowColumn: true, + default: true + } + ] + } + }, + // 璇锋眰鏁版嵁 + async getData(val, content) { + await getProductList({ + [val]: content, + page: this.pagerOptions.currPage, + pageSize: this.pagerOptions.pageSize + }).then((res) => { + if (res.data.code === 200) { + const list = res.data.data.list.map((item) => { + return { + ...item, + supplierNumber: item.supplier.number, + status: "灏辩华", + preTime: "2023-09-04 11:20:00" + } + }) + this.tableList.tableInfomation = list || [] + this.pagerOptions.totalCount = res.data.data.total + } + }) + }, + // 鎼滅储 + getList(val) { + console.log(val) + }, + // 琛岀偣鍑� + tableRowClick(row) { + console.log(row) + this.editConfig.visible = true + this.editConfig.title = "缂栬緫" + this.editConfig.infomation = { ...row } + }, + // 鏂板缓 + addBtnClick() { + this.editConfig.visible = true + this.editConfig.title = "鏂板缓" + } + } +} +</script> + +<!-- Add "scoped" attribute to limit CSS to this component only --> +<style lang="scss" scoped> +// .rightContent { +// height: 100%; +// background: #e6ecf2; +// padding: 10px; +// .top { +// margin-bottom: 20px; +// height: 60px; +// background: #fff; +// border-radius: 8px; +// } +// .list-view { +// height: calc(100% - 120px); +// } +// } +</style> -- Gitblit v1.8.0