From 02b7655966b254a1c2b9f59006d52deb71aff3f4 Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期二, 14 十一月 2023 11:30:49 +0800
Subject: [PATCH] 选择供应商组件优化、列表公共组件优化、创建采购单
---
src/assets/style/reset-element.scss | 4 +
src/views/supplierManage/supplier/index.vue | 39 ++++++++++--
src/components/makepager/TableCommonView.vue | 68 +++++++++++-----------
src/components/layout/components/appsidebar/index.vue | 4
src/views/purchaseManage/purchase/components/SelectSupplierDialog.vue | 59 +++++++++++--------
5 files changed, 106 insertions(+), 68 deletions(-)
diff --git a/src/assets/style/reset-element.scss b/src/assets/style/reset-element.scss
index b064e86..0fae205 100644
--- a/src/assets/style/reset-element.scss
+++ b/src/assets/style/reset-element.scss
@@ -28,3 +28,7 @@
.el-drawer__wrapper {
z-index: 9999 !important;
}
+// 棰滆壊
+.el-table .onSelect {
+ background: #ebf2ff;
+}
diff --git a/src/components/layout/components/appsidebar/index.vue b/src/components/layout/components/appsidebar/index.vue
index 4aaecf5..96653ac 100644
--- a/src/components/layout/components/appsidebar/index.vue
+++ b/src/components/layout/components/appsidebar/index.vue
@@ -29,9 +29,9 @@
<span>閲囪喘绠$悊</span>
</template>
<el-menu-item index="/purchaseManage/purchase">閲囪喘璁㈠崟</el-menu-item>
- <el-menu-item index="/purchaseManage/quality">閲囪喘璐ㄦ鍗�</el-menu-item>
+ <!-- <el-menu-item index="/purchaseManage/quality">閲囪喘璐ㄦ鍗�</el-menu-item> -->
<!-- <el-menu-item index="/purchaseManage/warehouse">閲囪喘鍏ュ簱鍗�</el-menu-item> -->
- <el-menu-item index="/purchaseManage/returned">閲囪喘閫�璐у崟</el-menu-item>
+ <!-- <el-menu-item index="/purchaseManage/returned">閲囪喘閫�璐у崟</el-menu-item> -->
</el-submenu>
<el-submenu index="3">
<template slot="title">
diff --git a/src/components/makepager/TableCommonView.vue b/src/components/makepager/TableCommonView.vue
index d037c30..a8e9b4c 100644
--- a/src/components/makepager/TableCommonView.vue
+++ b/src/components/makepager/TableCommonView.vue
@@ -11,7 +11,7 @@
:lazy="tableList.lazy"
size="mini"
@selection-change="handleSelectionChange"
- :header-cell-style="{ background: '#f1f3f8', color: '#000009' , 'font-size': '14px'}"
+ :header-cell-style="{ background: '#f1f3f8', color: '#000009', 'font-size': '14px' }"
:highlight-current-row="tableList.highlight"
:row-class-name="tableRowClassName"
@row-click="tableRowClick"
@@ -20,7 +20,8 @@
:tree-props="{ children: 'child', hasChildren: 'hasChildren' }"
>
<el-table-column align="center" v-if="tableList.selectBox" type="selection" width="40"> </el-table-column>
- <el-table-column align="center" v-if="tableList.selectIndex" type="index" label="搴忓彿" width="50"> </el-table-column>
+ <el-table-column align="center" v-if="tableList.selectIndex" type="index" label="搴忓彿" width="50">
+ </el-table-column>
<template v-for="(item, i) in tableList.tableColumn">
<el-table-column
align="center"
@@ -37,19 +38,22 @@
<span v-if="item.price">{{ "锟�" + number_format(scope.row[item.prop], 2, ".", ",") }}</span>
<div v-else-if="item.status" :class="scope.row.status">{{ scope.row[item.prop] }}</div>
<span v-else-if="item.isTime">{{
- dateFormat("YYYY-mm-dd HH:MM:SS", scope.row[item.prop]) === "1900-01-01 00:06:26"
- ? "--"
- : dateFormat("YYYY-mm-dd HH:MM:SS", scope.row[item.prop])
- }}</span>
- <span v-else-if="item.isClick && scope.row[item.prop]" class="sel-name" @click="selCommonClick(scope.row)">{{
- scope.row[item.prop]
- }}</span>
+ dateFormat("YYYY-mm-dd HH:MM:SS", scope.row[item.prop]) === "1900-01-01 00:06:26"
+ ? "--"
+ : dateFormat("YYYY-mm-dd HH:MM:SS", scope.row[item.prop])
+ }}</span>
+ <span
+ v-else-if="item.isClick && scope.row[item.prop]"
+ class="sel-name"
+ @click="selCommonClick(scope.row)"
+ >{{ scope.row[item.prop] }}</span
+ >
<span v-else-if="item.isFirst">{{ scope.row[item.prop] ? "鏄�" : "鍚�" }}</span>
<span
- v-else-if="item.isCommonClick && scope.row[item.prop]"
- class="sel-name"
- @click="selCommonClick(scope.row)"
- >{{ scope.row[item.prop] }}</span
+ v-else-if="item.isCommonClick && scope.row[item.prop]"
+ class="sel-name"
+ @click="selCommonClick(scope.row)"
+ >{{ scope.row[item.prop] }}</span
>
<div v-else-if="item.isProductName" class="product-view">
<ul v-if="scope.row.products && scope.row.products.length > 0">
@@ -103,15 +107,8 @@
<div class="overSpread1" v-show="iscolopen" @click="onMaskClick"></div>
<div class="styleBtn">
<i @click="checkCol()" class="label">...</i>
- <el-checkbox-group
- v-model="showcol"
- v-show="iscolopen"
- class="checkbox-group"
- @change="selectCheckBoxList"
- >
- <el-checkbox v-for="item in tableList.allcol" :label="item" :key="item"
- >{{ item }}
- </el-checkbox>
+ <el-checkbox-group v-model="showcol" v-show="iscolopen" class="checkbox-group" @change="selectCheckBoxList">
+ <el-checkbox v-for="item in tableList.allcol" :label="item" :key="item">{{ item }} </el-checkbox>
</el-checkbox-group>
</div>
</div>
@@ -160,27 +157,27 @@
data() {
return {
iscolopen: false,
- showcol:[]
+ showcol: []
}
},
watch: {
- 'tableList.showcol':{
- handler(newVal){
- this.showcol=newVal
+ "tableList.showcol": {
+ handler(newVal) {
+ this.showcol = newVal
},
- immediate:true
+ immediate: true
}
},
computed: {},
methods: {
onMaskClick() {
- this.iscolopen = false;
+ this.iscolopen = false
},
checkCol() {
- this.iscolopen = !this.iscolopen;
+ this.iscolopen = !this.iscolopen
},
selectCheckBoxList(val) {
- this.$emit("selTableCol", val);
+ this.$emit("selTableCol", val)
},
handleReserve(row) {
return row._id ? row._id : row.id
@@ -316,6 +313,10 @@
selCommonClick(row) {
this.$emit("selCommonClick", row)
},
+ // 琛岀偣鍑�
+ tableRowClick(row, column, event) {
+ this.$emit("tableRowClick", row, column, event)
+ },
// 鍗曢�夎鐩稿叧
tableRowClassName({ row }) {
if (Object.keys(this.selectClassRow).length > 0) {
@@ -324,9 +325,6 @@
}
}
this.$emit("tableRowClassName", row)
- },
- tableRowClick(row) {
- this.$emit("tableRowClick", row)
}
}
}
@@ -398,8 +396,8 @@
text-align: center;
}
-::v-deep{
- .el-table .cell .el-button--text.el-button--small{
+::v-deep {
+ .el-table .cell .el-button--text.el-button--small {
padding: 4px 0;
}
}
diff --git a/src/views/purchaseManage/purchase/components/SelectSupplierDialog.vue b/src/views/purchaseManage/purchase/components/SelectSupplierDialog.vue
index 0c11b8c..9e553ad 100644
--- a/src/views/purchaseManage/purchase/components/SelectSupplierDialog.vue
+++ b/src/views/purchaseManage/purchase/components/SelectSupplierDialog.vue
@@ -31,7 +31,9 @@
>
</TableCommonView>
<div slot="footer" class="dialog-footer">
- <div class="remark">璇存槑锛氭敮鎸佸瀛楁妯$硦鏌ヨ锛屼粎鏄剧ず绗﹀悎鏉′欢鐨勫墠5鏉℃暟鎹�</div>
+ <div class="btn-pager">
+ <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
+ </div>
</div>
</div>
</el-dialog>
@@ -40,8 +42,11 @@
<script>
import { getSupplierList } from "@/api/supplierManage/supplier"
+import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
+
export default {
name: "EditSelClientDialog",
+ mixins: [pageMixin],
props: {
editCommonConfig: {
type: Object,
@@ -58,7 +63,7 @@
computed: {},
data() {
return {
- dialogWidth: "50%",
+ dialogWidth: "40%",
editConfig: this.editCommonConfig,
queryInput: "",
select: "1",
@@ -69,8 +74,8 @@
tableList: {},
search_map: {},
tableColumn: [
- { label: "渚涘簲鍟嗙紪鍙�", prop: "number", min: 190, isCommonClick: true },
- { label: "渚涘簲鍟嗗悕绉�", prop: "name", min: 130 },
+ { label: "渚涘簲鍟嗙紪鍙�", prop: "number", min: 190 },
+ { label: "渚涘簲鍟嗗悕绉�", prop: "name", min: 130, isCommonClick: true },
{ label: "渚涘簲鍟嗙被鍨�", prop: "supplierType", min: 130 },
{ label: "鎵�灞炶涓�", prop: "industry", min: 130 },
{ label: "鑱旂郴浜�", prop: "contact", min: 130 },
@@ -78,25 +83,23 @@
{ label: "鐘舵��", prop: "status_name", min: 130 },
{ label: "鍒涘缓鏃堕棿", prop: "member_name", min: 130 }
],
- showCol: ['渚涘簲鍟嗙紪鍙�', '渚涘簲鍟嗗悕绉�', '渚涘簲鍟嗙被鍨�', '鎵�灞炶涓�', '鑱旂郴浜�', '鑱旂郴鐢佃瘽','鐘舵��','鍒涘缓鏃堕棿']
-
+ showCol: ["渚涘簲鍟嗙紪鍙�", "渚涘簲鍟嗗悕绉�", "渚涘簲鍟嗙被鍨�", "鑱旂郴浜�", "鑱旂郴鐢佃瘽", "鐘舵��"]
}
},
created() {
this.setTable()
this.getData()
},
- mounted(){
- },
+ mounted() {},
methods: {
setTable() {
this.tableList = {
tableInfomation: [],
- tableColumn:this.setColumnVisible(this.showCol),
+ tableColumn: this.setColumnVisible(this.showCol),
showcol: this.showCol,
- allcol:[]
+ allcol: []
}
- this.tableList.allcol = this.tableList.tableColumn.filter(ele=>!ele.default).map(ele=>ele.label);
+ this.tableList.allcol = this.tableList.tableColumn.filter((ele) => !ele.default).map((ele) => ele.label)
this.searchOptions = []
for (let i = 0; i < this.tableList.tableColumn.length; i++) {
const label = this.tableList.tableColumn[i].label
@@ -105,14 +108,14 @@
}
},
selTableCol(val) {
- this.showcol = val;
- this.tableList.tableColumn = this.setColumnVisible(val);
+ this.showcol = val
+ this.tableList.tableColumn = this.setColumnVisible(val)
},
- setColumnVisible(showCol){
- return this.tableColumn.map(ele=>{
+ setColumnVisible(showCol) {
+ return this.tableColumn.map((ele) => {
return {
...ele,
- isShowColumn:showCol.includes(ele.label)
+ isShowColumn: showCol.includes(ele.label)
}
})
},
@@ -122,22 +125,23 @@
// 璇锋眰鏁版嵁
async getData(val, content) {
this.loading = true
+
await getSupplierList({
[val]: content,
- page:1,
- pageSize: 10
+ page: this.pagerOptions.currPage,
+ pageSize: this.pagerOptions.pageSize
})
.then((res) => {
- if (res.data.code == 200) {
- if (res.data.data.list && res.data.data.list.length > 0) {
- const list = res.data.data.list.map((item) => {
+ if (res.code == 200) {
+ if (res.data.list && res.data.list.length > 0) {
+ const list = res.data.list.map((item) => {
return {
...item,
status_name: item.status === 0 ? "鏈惎鐢�" : "鍚敤"
}
})
- // this.tableList.tableInfomation = list.slice(0, 5) || []
this.tableList.tableInfomation = list
+ this.pagerOptions.totalCount = res.data.total
} else {
this.tableList.tableInfomation = []
}
@@ -192,9 +196,16 @@
cursor: pointer;
}
.dialog-footer {
- height: 40px;
- line-height: 40px;
+ height: 50px;
+ line-height: 50px;
color: red;
+ .btn-pager {
+ display: flex;
+ margin-top: 0px;
+ .page {
+ margin-left: auto;
+ }
+ }
}
::v-deep {
.input-with-select .el-input-group__prepend {
diff --git a/src/views/supplierManage/supplier/index.vue b/src/views/supplierManage/supplier/index.vue
index e1e85eb..8383a57 100644
--- a/src/views/supplierManage/supplier/index.vue
+++ b/src/views/supplierManage/supplier/index.vue
@@ -22,8 +22,9 @@
ref="tableSupplier"
:table-list="tableList"
@selCommonClick="selCommonClick"
- @tableRowClick="tableRowClick"
@selTableCol="selTableCol"
+ @tableRowClick="tableRowClick"
+ :selectClassRow="selectRow"
>
<template slot="tableButton">
<el-table-column label="鎿嶄綔" width="100">
@@ -62,7 +63,7 @@
>
<template slot="leftButton">
<div class="sub-title"><span class="sub-title-decorator"></span>鍙彁渚涚殑浜у搧</div>
- <el-button type="primary" size="mini">鍒涘缓閲囪喘鍗�</el-button>
+ <el-button type="primary" size="mini" @click="creatPurchase">鍒涘缓閲囪喘鍗�</el-button>
</template>
<template slot="rightButton">
<el-button type="primary" size="mini" @click="addNewProductClick">娣诲姞鏂颁骇鍝�</el-button>
@@ -110,6 +111,8 @@
<RaleteSupplierList v-if="raleteSupplierConfig.visible" :common-config="raleteSupplierConfig" />
<!-- 娣诲姞鏂颁骇鍝� -->
<AddNewProduct v-if="newProductConfig.visible" :add-common-config="newProductConfig" />
+ <!-- 鏂板缓/缂栬緫 -->
+ <AddPurchase v-if="editPurchaseConfig.visible" :edit-common-config="editPurchaseConfig" />
</div>
</template>
@@ -121,11 +124,12 @@
import RaleteSupplierList from "@/views/supplierManage/supplier/RaleteSupplierList"
import AddNewProduct from "@/views/supplierManage/supplier/AddNewProduct"
import { getProductList, deleteProduct } from "@/api/productManage/product"
+import AddPurchase from "@/views/purchaseManage/purchase/components/AddPurchase"
export default {
name: "SupplierManage",
props: {},
- components: { DetailSupplier, AddSupplier, RaleteSupplierList, AddNewProduct },
+ components: { DetailSupplier, AddSupplier, RaleteSupplierList, AddNewProduct, AddPurchase },
mixins: [pageMixin],
computed: {},
data() {
@@ -180,7 +184,16 @@
{ label: "閲囪喘浠锋牸", prop: "purchasePrice", min: 130 },
{ label: "渚涜揣鏃堕暱(澶�)", prop: "deliveryTime", min: 130 },
{ label: "鐗╂祦鏃堕暱(澶�)", prop: "shippingDuration", min: 130 }
- ]
+ ],
+ editPurchaseConfig: {
+ // 鍒涘缓閲囪喘
+ visible: false,
+ title: "鍒涘缓",
+ infomation: {
+ supplierName: ""
+ }
+ },
+ selectRow: {}
}
},
created() {
@@ -269,6 +282,7 @@
const list = res.data.list.map((item) => {
return {
...item,
+ id: item.ID,
status_name: item.status === 0 ? "鏈惎鐢�" : "鍚敤"
}
})
@@ -277,12 +291,13 @@
this.pagerOptions.totalCount = res.data.total
if (list && list.length > 0) {
this.supplierId = this.tableList.tableInfomation[0].ID
+ this.selectRow = this.tableList.tableInfomation.length > 0 ? this.tableList.tableInfomation[0] : {}
} else {
this.supplierId = 0
}
- this.$nextTick(() => {
- this.$refs.tableSupplier.$refs.table.setCurrentRow(this.tableList.tableInfomation[0])
- })
+ // this.$nextTick(() => {
+ // this.$refs.tableSupplier.$refs.table.setCurrentRow(this.tableList.tableInfomation[0])
+ // })
// 閲嶆柊鑾峰彇渚涘簲鍟嗗垪琛ㄥ悗搴旇閲嶇疆浜у搧鍒楄〃椤电爜
this.productPagerOptions.currPage = 1
@@ -401,6 +416,7 @@
tableRowClick(row) {
console.log(row)
this.productPagerOptions.currPage = 1
+ this.selectRow = row
this.supplierId = row.ID
this.getProductList()
},
@@ -419,6 +435,15 @@
currentProductHandler(val) {
this.productPagerOptions.currPage = val
this.getProductList()
+ },
+ // 鍒涘缓閲囪喘鍗�
+ creatPurchase() {
+ this.editPurchaseConfig.visible = true
+ this.editPurchaseConfig.title = "鍒涘缓"
+ this.editPurchaseConfig.infomation = {
+ supplierId: this.selectRow.ID,
+ supplierName: this.selectRow.name
+ }
}
}
}
--
Gitblit v1.8.0