From 7fbfeddedebd05e2d23ce411be887106d31e8eff Mon Sep 17 00:00:00 2001
From: zuozhengqing <a13193816592@163.com>
Date: 星期三, 27 三月 2024 15:02:18 +0800
Subject: [PATCH] 销售明细单产品列表添加动态表头,产品信息列表根据完成数量展示字体色
---
src/components/makepager/TableCommonView.vue | 15 +++
src/views/systemSet/commonSet/compontents/SystemParameterSet.vue | 7
src/assets/style/index.scss | 6
src/components/makepager/CommonFormTableView.vue | 61 ++++++++++++
src/views/sales/salesDetails/AddSalesDetailsDialog.vue | 135 ++++++++++++++++++++++-----
src/views/systemSet/commonSet/index.vue | 3
src/views/sales/salesDetails/index.vue | 48 ++++++++-
7 files changed, 237 insertions(+), 38 deletions(-)
diff --git a/src/assets/style/index.scss b/src/assets/style/index.scss
index 97be538..dfb14be 100644
--- a/src/assets/style/index.scss
+++ b/src/assets/style/index.scss
@@ -21,13 +21,13 @@
margin-right: 5px;
}
.success {
- background: #06c062;
+ color: #06c062;
}
.error {
- background: #f62f2f;
+ color: #f62f2f;
}
.warning-radio {
- background: #e6a23c;
+ color: #e6a23c;
}
.warning {
background: rgba(0, 0, 0, 0.4);
diff --git a/src/components/makepager/CommonFormTableView.vue b/src/components/makepager/CommonFormTableView.vue
index 0fb598e..ca08f1f 100644
--- a/src/components/makepager/CommonFormTableView.vue
+++ b/src/components/makepager/CommonFormTableView.vue
@@ -22,6 +22,7 @@
:label="item.label"
:width="item.width"
:min-width="item.min"
+ v-if="item.isShowColumn"
align="center"
>
<!-- 琛ㄥご鏍峰紡 -->
@@ -206,6 +207,12 @@
</el-table-column>
<slot name="tableButton" />
</el-table>
+ <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>
+ </div>
</el-form>
<div v-if="!detailEnter" style="margin: 10px">
<el-button size="small" type="primary" :disabled="!isOperate" @click="add">鏂板</el-button>
@@ -284,6 +291,8 @@
return {
tableData: [], // 鎺ュ彛杩斿洖鏁版嵁
isReturn: false,
+ allcol: [],
+ showcol: [],
tableColumn: [
// table琛ㄥ崟
{ label: "", prop: "", min: 200, tooltip: true }
@@ -316,7 +325,9 @@
infomation: {}
},
productIndex: 0,
- isRecalculate: true
+ isRecalculate: true,
+ iscolopen: false,
+ showcol: []
}
},
created() {
@@ -331,10 +342,22 @@
this.getTableInfo()
},
immediate: true
+ },
+ "productTableList.showcol": {
+ handler(newVal) {
+ this.showcol = newVal
+ },
+ immediate: true
}
},
computed: {},
methods: {
+ checkCol() {
+ this.iscolopen = !this.iscolopen
+ },
+ selectCheckBoxList(val) {
+ this.$emit("selTableCol", val)
+ },
getTableInfo(){
this.tableList = this.productTableList
if (this.tableList.tableData.length === 1 && this.tableList.tableData[0].name === "") {
@@ -617,6 +640,7 @@
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
.page-view {
+ position: relative;
.el-form-item {
margin-bottom: 0;
.custom-name {
@@ -649,5 +673,40 @@
// text-align: left;
text-align: center !important;
}
+ .styleBtn {
+ position: absolute;
+ width: 30px;
+ height: 36px;
+ // line-height: 26px;
+ // background: #06c062;
+ top: 0;
+ right: -6px;
+ z-index: 11;
+ .label {
+ position: absolute;
+ top: 6px;
+ font-size: 20px;
+ // line-height: 5px;
+ cursor: pointer;
+ color: #000;
+ transform: rotate(-90deg);
+ }
+ .checkbox-group {
+ width: 160px;
+ height: 300px;
+ overflow: auto;
+ display: flex;
+ flex-direction: column;
+ line-height: 25px;
+ background: #ffffff;
+ border-radius: 16px;
+ padding: 12px;
+ position: absolute;
+ right: 0;
+ top: 30px;
+ z-index: 99;
+ box-shadow: 0 0 2px 2px #f8f8f8;
+ }
+ }
}
</style>
diff --git a/src/components/makepager/TableCommonView.vue b/src/components/makepager/TableCommonView.vue
index 50ac390..4274752 100644
--- a/src/components/makepager/TableCommonView.vue
+++ b/src/components/makepager/TableCommonView.vue
@@ -126,6 +126,21 @@
item.getCallMethod(scope.row[item.prop], scope.row)
}}</span>
</div>
+ <span
+ v-else-if="item.isClass"
+ :class="
+ item.isClass
+ ? item.getClassName(scope.row[item.prop], scope.row)
+ : ''
+ "
+ >{{
+ scope.row[item.prop]
+ ? scope.row[item.prop]
+ : scope.row[item.prop] === 0
+ ? scope.row[item.prop]
+ : "--"
+ }}</span
+ >
<span v-else>{{ scope.row[item.prop] ? scope.row[item.prop] : "--" }}</span>
</template>
</el-table-column>
diff --git a/src/views/sales/salesDetails/AddSalesDetailsDialog.vue b/src/views/sales/salesDetails/AddSalesDetailsDialog.vue
index de79216..3422c40 100644
--- a/src/views/sales/salesDetails/AddSalesDetailsDialog.vue
+++ b/src/views/sales/salesDetails/AddSalesDetailsDialog.vue
@@ -442,6 +442,7 @@
@getSelectArray="getSelectArray"
@emptyProductClick="emptyProductClick"
@clearupProduct="clearupProduct"
+ @selTableCol="selTableCol"
></CommonFormTableView>
</div>
<!-- 閫夋嫨瀹℃壒娴佺▼ -->
@@ -534,6 +535,7 @@
import { getDataByType } from "@/api/data"
import { mapActions } from "vuex"
import { getQuotationList } from "@/api/sales/quotation"
+import { getSystemSet } from "@/api/systemSet/commonSet"
export default {
name: "AddSalesDetailsDialog",
@@ -635,7 +637,25 @@
disabledDate(time) {
return time.getTime() > Date.now()
}
- }
+ },
+ isRelevancyValue:"鏄�", //鏄惁鍚屾鎶ヤ环鍗�
+ isCollectionPlan:"鏄�", // 鏄惁鐢熸垚鏀舵璁″垝
+ isBjdRequird : false,
+ tableColumn: [
+ // { label: "#", prop: "productId", width: 40 },
+ { label: "浜у搧鍚嶇О", prop: "name", productName: true, isRequird: true, min: 110 },
+ { label: "瑙勬牸", prop: "specs" , },
+ { label: "鍨嬪彿", prop: "type" },
+ { label: "浜у搧缂栧彿", prop: "number" },
+ { label: "鍗曚綅", prop: "unit" },
+ { label: "閿�鍞崟浠�", prop: "price", inputFloat: !this.isBjdRequird, },
+ { label: "鎴愭湰鍗曚环", prop: "cost", input: !this.isBjdRequird },
+ { label: "姣涘埄", prop: "profit" },
+ { label: "姣涘埄鐜�(%)", prop: "margin", min: 90 },
+ { label: "鏁伴噺", prop: "amount", inputNumber: true, isRequird: true },
+ { label: "浠风◣鍚堣", prop: "total" }
+ ],
+ showCol: ["浜у搧鍚嶇О", "瑙勬牸", "鍨嬪彿", "浜у搧缂栧彿", "鍗曚綅", "閿�鍞崟浠�", "鎴愭湰鍗曚环","姣涘埄","姣涘埄鐜�(%)","鏁伴噺","浠风◣鍚堣"],
}
},
mounted(){
@@ -643,6 +663,7 @@
this.getQuotation()
},
created() {
+ this.getSystemSet()
if (this.editConfig.title !== "鏂板缓") {
this.productTableList.tableData = [
{
@@ -684,6 +705,41 @@
// },
methods: {
...mapActions(["getChanceFilter", "getSubunitFliter"]),
+ async getSystemSet(){
+ await getSystemSet().then((res) => {
+ if (res.code == 200) {
+ console.log(res,"resss")
+ if (res.data) {
+ this.isRelevancyValue = this.checkValueById(res.data.CRM, 5);
+ this.isCollectionPlan=this.checkValueById(res.data.CRM, 4);
+ console.log(this.isRelevancyValue,"鏄惁鍏宠仈")
+ }
+ }
+ })
+ },
+ setColumnVisible(showCol, tableColumn) {
+ return tableColumn.map((ele) => {
+ return {
+ ...ele,
+ isShowColumn: showCol.includes(ele.label)
+ }
+ })
+ },
+ selTableCol(val) {
+ this.showcol = val
+ this.productTableList.tableColumn = this.setColumnVisible(val, this.tableColumn)
+ },
+ checkValueById(data, id) {
+ for (const key in data) {
+ if (data.hasOwnProperty(key)) {
+ const obj = data[key];
+ if (obj.id === id) {
+ return obj.value;
+ }
+ }
+ }
+ return null; // 濡傛灉娌℃湁鎵惧埌鍖归厤鐨刬d锛屽垯杩斿洖null
+ },
formInfo() {
this.objCode.type = "閿�鍞槑缁嗙紪鐮�"
this.objCode.codeStandID = ""
@@ -754,7 +810,11 @@
amountTotal: this.amountTotal,
id: res.data.id
}
- this.$emit("addCollectionPlanClick", config)
+ if(this.isCollectionPlan==="鏄�"){
+ this.$emit("addCollectionPlanClick", config)
+ }else{
+ this.$parent.getData()
+ }
}
})
} else {
@@ -936,9 +996,11 @@
console.log("涓嬫媺妗嗙偣鍑�", item)
this.subbillId = item.id
this.editConfig.infomation.subbill_name = item.number
- } else if (value === "quotation") {
- this.productTableList.tableData = item.products
- this.tableData = item.products
+ } else if (value === "quotation") { //閿�鍞姤浠峰崟
+ if(this.isRelevancyValue==="鏄�"){
+ this.productTableList.tableData = item.products
+ this.tableData = item.products
+ }
this.editConfig.infomation.quotation_number = item.number
this.quotationId = item.id
//鍙嶅悜 瀹㈡埛鍚嶇О
@@ -978,6 +1040,7 @@
this.editSelCommonConfig.editVisible = true
}
},
+ // 鐐瑰嚮鍔犲彿
selClient(row, value) {
if (value === "client") {
this.editConfig.infomation.sale_chance_name = ""
@@ -1002,8 +1065,10 @@
this.editConfig.infomation.subbill_name = row.number
this.subbillId = row.id
} else if (value === "quotation") {
- this.productTableList.tableData = row.products
- this.tableData = row.products
+ if(this.isRelevancyValue==="鏄�"){
+ this.productTableList.tableData = row.products
+ this.tableData = row.products
+ }
this.editConfig.infomation.quotation_number = row.number
//鍙嶅悜 瀹㈡埛鍚嶇О
this.editConfig.infomation.client_name = row.client.name
@@ -1040,8 +1105,15 @@
this.editConfig.infomation.quotation_number = ""
this.quotationId = 0
}
- this.productTableList.tableData = []
- this.tableData = []
+ if(this.isRelevancyValue==="鏄�" && value === "quotation"){
+ this.productTableList.tableData = []
+ this.tableData = []
+ }else if(this.isRelevancyValue==="鍚�" && value === "quotation"){
+ console.log("false")
+ }else{
+ this.productTableList.tableData = []
+ this.tableData = []
+ }
},
// 娣诲姞闄勪欢
addAnnexClick() {},
@@ -1073,27 +1145,40 @@
this.getQuotation(this.editConfig.infomation.saleChanceId, "鍏ㄩ儴浜у搧")
}
// let productData = this.quotationList.products
- let isBjdRequird = false
+ this.isBjdRequird = false
if (this.autoCodeHeadersObj.Bjd == "yes") {
- isBjdRequird = true
+ this.isBjdRequird = true
}
this.productTableList = {
tableData: this.tableData,
isReturn: true,
- tableColumn: [
- // { label: "#", prop: "productId", width: 40 },
- { label: "浜у搧鍚嶇О", prop: "name", productName: true, isRequird: true, min: 110 },
- { label: "瑙勬牸", prop: "specs" },
- { label: "鍨嬪彿", prop: "type" },
- { label: "浜у搧缂栧彿", prop: "number" },
- { label: "鍗曚綅", prop: "unit" },
- { label: "閿�鍞崟浠�", prop: "price", inputFloat: !isBjdRequird, isRequird: true },
- { label: "鎴愭湰鍗曚环", prop: "cost", input: !isBjdRequird },
- { label: "姣涘埄", prop: "profit" },
- { label: "姣涘埄鐜�(%)", prop: "margin", min: 90 },
- { label: "鏁伴噺", prop: "amount", inputNumber: true, isRequird: true },
- { label: "浠风◣鍚堣", prop: "total" }
- ]
+ allcol: [],
+ showcol: this.showCol,
+ // tableColumn: [
+ // // { label: "#", prop: "productId", width: 40 },
+ // { label: "浜у搧鍚嶇О", prop: "name", productName: true, isRequird: true, min: 110 },
+ // { label: "瑙勬牸", prop: "specs" },
+ // { label: "鍨嬪彿", prop: "type" },
+ // { label: "浜у搧缂栧彿", prop: "number" },
+ // { label: "鍗曚綅", prop: "unit" },
+ // { label: "閿�鍞崟浠�", prop: "price", inputFloat: !this.isBjdRequird, },
+ // { label: "鎴愭湰鍗曚环", prop: "cost", input: !this.isBjdRequird },
+ // { label: "姣涘埄", prop: "profit" },
+ // { label: "姣涘埄鐜�(%)", prop: "margin", min: 90 },
+ // { label: "鏁伴噺", prop: "amount", inputNumber: true, isRequird: true },
+ // { label: "浠风◣鍚堣", prop: "total" }
+ // ],
+ tableColumn: this.setColumnVisible(this.showCol, this.tableColumn)
+ }
+ this.setTableList(this.productTableList)
+ },
+ setTableList(productTableList) {
+ productTableList.allcol = productTableList.tableColumn.filter((ele) => !ele.default).map((ele) => ele.label)
+ this.searchOptions = []
+ for (let i = 0; i < productTableList.tableColumn.length; i++) {
+ const label = productTableList.tableColumn[i].label
+ const value = productTableList.tableColumn[i].prop
+ this.searchOptions.push({ value: value, label: label })
}
},
// 浜у搧鍒楄〃杈撳叆
diff --git a/src/views/sales/salesDetails/index.vue b/src/views/sales/salesDetails/index.vue
index 928d62b..84a0db4 100644
--- a/src/views/sales/salesDetails/index.vue
+++ b/src/views/sales/salesDetails/index.vue
@@ -221,11 +221,26 @@
{ label: "浜у搧瑙勬牸", prop: "specs" },
{ label: "鍗曚綅", prop: "unit" },
{ label: "璁㈠崟鏁伴噺", prop: "amount" },
- { label: "宸插畬鎴愭暟閲�", prop: "finishAmount" },
- { label: "宸插彂璐ф暟閲�", prop: "deliveryAmount" },
- { label: "閲囪喘鏁伴噺", prop: "purchaseAmount" },
- { label: "鐢熶骇鏁伴噺", prop: "makeAmount" },
- { label: "濮斿鏁伴噺", prop: "outsourcingAmount" },
+ {
+ label: "宸插畬鎴愭暟閲�",
+ prop: "finishAmount",
+ isClass: true,
+ getClassName: this.getAmountClassName,
+ },
+ { label: "宸插彂璐ф暟閲�", prop: "deliveryAmount",
+ isClass: true,
+ getClassName: this.getAmountClassName, },
+ { label: "閲囪喘鏁伴噺",
+ isClass: true,
+ getClassName: this.getFinishAmountClassName,
+ prop: "purchaseAmount",
+ },
+ { label: "鐢熶骇鏁伴噺", prop: "makeAmount" ,
+ isClass: true,
+ getClassName: this.getFinishAmountClassName, },
+ { label: "濮斿鏁伴噺", prop: "outsourcingAmount",
+ isClass: true,
+ getClassName: this.getFinishAmountClassName, },
{ label: "閿�鍞崟浠�", prop: "price", price: true },
{ label: "鎴愭湰鍗曚环", prop: "cost" },
{ label: "姣涘埄", prop: "profit" },
@@ -483,6 +498,29 @@
this.getProjectList()
},
methods: {
+ getFinishAmountClassName(val, row) {
+ let parts = val.split("/");
+ let numerator = parseInt(parts[0], 10); // 鍒嗗瓙
+ let denominator = parseInt(parts[1], 10); // 鍒嗘瘝
+ let classname = "";
+ if (numerator / denominator === 0||numerator===0) {
+ classname = "error";
+ }else if(numerator / denominator === 1){
+ classname = "success";
+ }else if((numerator / denominator) > 0&&(numerator / denominator) <1){
+ classname = "warning-radio";
+ }
+ console.log(classname, numerator,denominator,"鐪嬩笅")
+ return classname;
+ },
+ getAmountClassName(val){
+ console.log(val,"val11")
+ let classname = "";
+ if(val===0){
+ classname = "error";
+ }
+ return classname;
+ },
getpurchaseStatus(val) {
if (val) {
for (let i in this.purchaseStatusList) {
diff --git a/src/views/systemSet/commonSet/compontents/SystemParameterSet.vue b/src/views/systemSet/commonSet/compontents/SystemParameterSet.vue
index dcfd8b1..39f899f 100644
--- a/src/views/systemSet/commonSet/compontents/SystemParameterSet.vue
+++ b/src/views/systemSet/commonSet/compontents/SystemParameterSet.vue
@@ -133,9 +133,10 @@
this.isBtnloading = true;
let arr = [];
arr = arr.concat(this.crmTableList.tableInfomation);
- for (let i in arr) {
- delete arr[i].id;
- }
+ // for (let i in arr) {
+ // delete arr[i].id;
+ // }
+ console.log(arr,'arr')
saveSystemSet({
sets: arr,
})
diff --git a/src/views/systemSet/commonSet/index.vue b/src/views/systemSet/commonSet/index.vue
index eb9a7d5..de7c8db 100644
--- a/src/views/systemSet/commonSet/index.vue
+++ b/src/views/systemSet/commonSet/index.vue
@@ -73,7 +73,8 @@
}
let item={
name:i,
- id:value+'&'+i,
+ // id:value+'&'+i,
+ id:data[i].id,
value:data[i].value,
type:data[i].type,
select:data[i].type=='select'?list:data[i].select,
--
Gitblit v1.8.0