From c35ccb51c02c8852e345b831ef5d2dd96c2cf500 Mon Sep 17 00:00:00 2001 From: haoxuan <haoxuan> Date: 星期三, 30 八月 2023 16:39:33 +0800 Subject: [PATCH] Merge branch 'master' of ssh://192.168.5.5:29418/web/SRM --- src/views/supplierManage/supplier/index.vue | 193 ++++++++++++++++++++++++++++------------------- 1 files changed, 114 insertions(+), 79 deletions(-) diff --git a/src/views/supplierManage/supplier/index.vue b/src/views/supplierManage/supplier/index.vue index 00e1117..77a5721 100644 --- a/src/views/supplierManage/supplier/index.vue +++ b/src/views/supplierManage/supplier/index.vue @@ -13,29 +13,49 @@ </div> </div> <template> - <TableCommonView - ref="tableListRef" - :table-list="tableList" - @selCommonClick="selCommonClick" - @getSelectArray="getSelectArray" + <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' }" > - <template slot="tableButton"> - <el-table-column label="鎿嶄綔" width="120"> - <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> - <!-- <el-button @click="delClick(scope.row.id)" type="text" size="small">鍒犻櫎</el-button> --> - </template> - </el-table-column> - </template> - </TableCommonView> + <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" + > + <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> + </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> <div class="btn-pager"> <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" /> </div> @@ -60,7 +80,7 @@ </div> <template> <TableCommonView - ref="tableListRef" + ref="tableListProduct" :table-list="productTableList" @selCommonClick="selCommonClick" @getSelectArray="getSelectArray" @@ -71,7 +91,6 @@ <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> - <!-- <el-button @click="delClick(scope.row.id)" type="text" size="small">鍒犻櫎</el-button> --> </template> </el-table-column> </template> @@ -99,6 +118,7 @@ import AddSupplier from "@/views/supplierManage/supplier/AddSupplier" import RaleteSupplierList from "@/views/supplierManage/supplier/RaleteSupplierList" import AddNewProduct from "@/views/supplierManage/supplier/AddNewProduct" +import { getProductList, deleteProduct } from "@/api/productManage/product" export default { name: "SupplierManage", @@ -135,7 +155,8 @@ currPage: 1, pageSize: 10, totalCount: 0 - } + }, + supplierId: 0 } }, created() { @@ -148,6 +169,7 @@ this.tableList = { tableInfomation: [], selectIndex: true, + ref: "tableListRef", tableColumn: [ { label: "渚涘簲鍟嗙紪鍙�", prop: "number", min: 190, isCommonClick: true }, { label: "渚涘簲鍟嗗悕绉�", prop: "name", min: 130 }, @@ -168,21 +190,17 @@ }, setProductTable() { this.productTableList = { - tableInfomation: [ - { - number: "aaaaa" - } - ], + tableInfomation: [], selectBox: true, selectIndex: true, tableColumn: [ { label: "浜у搧缂栫爜", prop: "number", min: 190 }, { label: "浜у搧鍚嶇О", prop: "name", min: 130 }, - { label: "浜у搧瑙勬牸", prop: "contact_name", min: 130 }, - { label: "鍗曚綅", prop: "contact_phone", min: 130 }, - { label: "閲囪喘浠锋牸", prop: "sales_resources", min: 130 }, - { label: "渚涜揣鏃堕暱(澶�)", prop: "province", min: 130 }, - { label: "鐗╂祦鏃堕暱(澶�)", prop: "city", min: 130 } + { label: "浜у搧瑙勬牸", prop: "specifications", min: 130 }, + { label: "鍗曚綅", prop: "unit", min: 130 }, + { label: "閲囪喘浠锋牸", prop: "purchasePrice", min: 130 }, + { label: "渚涜揣鏃堕暱(澶�)", prop: "deliveryTime", min: 130 }, + { label: "鐗╂祦鏃堕暱(澶�)", prop: "shippingDuration", min: 130 } ] } this.searchProductOptions = [] @@ -193,15 +211,8 @@ } }, // 璇锋眰鏁版嵁 - async getData(val, content, searchName) { - if (searchName === "渚涘簲鍟�") { - this.getSupplierList(val, content) - } else if (searchName === "浜у搧") { - this.getProductList(val, content) - } else { - this.getSupplierList() - this.getProductList() - } + async getData(val, content) { + this.getSupplierList(val, content) }, // 渚涘簲鍟嗗垪琛� async getSupplierList(val, content) { @@ -220,40 +231,58 @@ }) this.tableList.tableInfomation = list || [] this.pagerOptions.totalCount = res.data.data.total + if (list && list.length > 0) { + this.supplierId = this.tableList.tableInfomation[0].ID + } else { + this.supplierId = 0 + } + this.$nextTick(() => { + this.$refs.tableSupplier.setCurrentRow(this.tableList.tableInfomation[0]) + }) + this.getProductList() } }) }, // 浜у搧鍒楄〃 async getProductList(val, content) { console.log(val, content) - // await getProductList({ - // [val]: content, - // page: this.productPagerOptions.currPage, - // pageSize: this.productPagerOptions.pageSize - // }).then((res) => { - // console.log(res.data) - // }) + await getProductList({ + [val]: content, + supplierId: this.supplierId, + page: this.productPagerOptions.currPage, + pageSize: this.productPagerOptions.pageSize + }).then((res) => { + console.log(res.data) + const list = res.data.data.list.map((item) => { + return { + ...item + } + }) + this.productTableList.tableInfomation = list || [] + this.productPagerOptions.totalCount = res.data.data.total + }) }, // 鎼滅储渚涘簲鍟� searchClick(val, content) { console.log(val, content) - this.getData(val.value, content, "渚涘簲鍟�") + this.getSupplierList(val.value, content) }, resetClick() { - this.getData("", "", "渚涘簲鍟�") + this.getSupplierList() }, // 鎼滅储浜у搧 searchProductClick(val, content) { console.log(val, content) - this.getData(val.value, content, "浜у搧") + this.getProductList(val.value, content) }, resetProductClick() { - this.getData("", "", "浜у搧") + this.getProductList() }, // 鏂板缓渚涘簲鍟� addBtnClick() { this.editConfig.visible = true this.editConfig.title = "鏂板缓" + this.editConfig.infomation = { fileId: 0 } }, // 鍚敤渚涘簲鍟� async enableClick(row, value) { @@ -270,10 +299,9 @@ }, // 淇敼渚涘簲鍟� modifyClick(row) { - console.log(row) this.editConfig.visible = true this.editConfig.title = "淇敼" - this.editConfig.infomation = { ...row } + this.editConfig.infomation = { ...row, file_name: row.contract.fileName } }, // 鐩稿叧渚涘簲鍟� raleteClick(row) { @@ -285,36 +313,34 @@ addNewProductClick() { this.newProductConfig.visible = true this.newProductConfig.title = "娣诲姞" + this.newProductConfig.infomation = { supplierId: this.supplierId } }, // 淇敼浜у搧 editClick(row) { console.log(row) this.newProductConfig.visible = true - // this.newProductConfig.title = "淇敼" + this.newProductConfig.title = "淇敼" + this.newProductConfig.infomation = { ...row } }, // 鍒犻櫎 - delClick() { - if (this.selValueList && this.selValueList.length > 0) { - this.$confirm("鏄惁纭鍒犻櫎?", "璀﹀憡", { - confirmButtonText: "纭畾", - cancelButtonText: "鍙栨秷", - type: "warning" - }) - .then(() => { - console.log("dddd") - // deleteSupplier({ id: this.selValueList }).then((response) => { - // if (response.code === 200) { - // this.$message.success("鍒犻櫎鎴愬姛") - // this.getData() - // } else { - // this.$message.warning("鍒犻櫎澶辫触") - // } - // }) + delClick(row) { + this.$confirm("鏄惁纭鍒犻櫎?", "璀﹀憡", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }) + .then(() => { + console.log("dddd") + deleteProduct({ id: row.ID }).then((response) => { + if (response.code === 200) { + this.$message.success("鍒犻櫎鎴愬姛") + this.getProductList() + } else { + this.$message.warning("鍒犻櫎澶辫触") + } }) - .catch(() => {}) - } else { - this.$message.warning("璇疯嚦灏戦�夋嫨涓�鏉¤褰�") - } + }) + .catch(() => {}) }, getSelectArray(val) { console.log(val) @@ -323,6 +349,11 @@ return item.id }) this.selValueList = list + }, + tableRowClick(row) { + console.log(row) + this.supplierId = row.ID + this.getProductList() }, // 璇︽儏 selCommonClick(row) { @@ -347,6 +378,10 @@ margin-right: 20px; } } + .sel-name { + color: $color-primary; + cursor: pointer; + } .btn-pager { display: flex; .page { -- Gitblit v1.8.0