From ba9feade5bf2759e64815e72e2b247d9a8b9c27e Mon Sep 17 00:00:00 2001 From: wwl <xchao828@163.com> Date: 星期三, 02 四月 2025 14:40:37 +0800 Subject: [PATCH] 1 --- src/views/system/comp/index.vue | 229 +++++++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 180 insertions(+), 49 deletions(-) diff --git a/src/views/system/comp/index.vue b/src/views/system/comp/index.vue index 2e9b8d3..cf73da0 100644 --- a/src/views/system/comp/index.vue +++ b/src/views/system/comp/index.vue @@ -1,5 +1,45 @@ <template> <div class="app-container"> + <el-dialog title="閫夋嫨濂楅" :visible.sync="taocan" width="70%" height="700px" :close-on-click-modal="false"> + <el-form :model="queryParam" ref="queryForm" size="small" :inline="true" label-width="auto"> + <el-form-item label="濂楅鍚嶇О" prop="pacName"> + <el-input + v-model="queryParam.pacName" + placeholder="璇疯緭鍏ュ椁愬悕绉�" + clearable + @keyup.enter.native="handle" + style="width: 200px" + /> + </el-form-item> + <el-form-item> + <el-button + type="primary" + icon="el-icon-search" + size="mini" + @click="handle" + >鎼滅储</el-button> + </el-form-item> + </el-form> + <el-table + v-loading="loading" + element-loading-text="姝e湪鍔犺浇涓�..." + element-loading-spinner="el-icon-loading" + border + :data="newpacName1" + @selection-change="handleSelectionChange1" + height="450px" + ref="tb" + > + <el-table-column type="selection" width="40px" align="center" label="閫夋嫨" /> + <el-table-column label="濂楅鍚嶇О" align="center" prop="pacName" width="120px" /> + <el-table-column label="濂楅浠锋牸" align="center" prop="price" width="120px" /> + <el-table-column label="濂楅鏄庣粏" align="center" prop="allProName" :show-overflow-tooltip="true" /> + </el-table> + <span slot="footer" class="dialog-footer"> + <el-button @click="cancel1">鍙� 娑�</el-button> + <el-button type="primary" @click="submit">纭� 瀹�</el-button> + </span> +</el-dialog> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px" @submit.native.prevent> <el-form-item label="鍗曚綅鍚嶇О" prop="cnName"> @@ -289,8 +329,10 @@ </template> </el-table-column> </el-table> - <div style="font-size: 16px;margin-top: 10px;">褰撳墠椤圭洰鏉℃暟锛�<span style="font-weight: 700;">{{ OnenewpacName.length }}</span>鏉�</div> - + <div style="font-size: 16px;margin-top: 10px;">褰撳墠椤圭洰鏉℃暟锛�<span style="font-weight: 700;">{{ + OnenewpacName.length + }}</span>鏉�</div> + </el-col> <el-col :span="2" :xs="24"> <div style="margin: 240% 16%"> @@ -300,6 +342,9 @@ <el-col :span="8" :xs="24"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px" @submit.native.prevent> + <el-form-item> + <el-button type="primary" @click="Package" size="mini" style="margin-right: 20px">閫夋嫨濂楅</el-button> + </el-form-item> <el-form-item label="椤圭洰鍚嶇О" prop="proName"> <el-input ref="inputName" v-model="queryParams.proName" placeholder="璇疯緭鍏ラ」鐩悕绉�" clearable @keyup.enter.native="handleSearchFor" style="width: 140px" /> @@ -370,8 +415,10 @@ </template> </el-table-column> </el-table> - <div style="font-size: 16px;margin-top: 10px;">褰撳墠椤圭洰鏉℃暟锛�<span style="font-weight: 700;">{{ OnenewpacName.length }}</span>鏉�</div> - + <div style="font-size: 16px;margin-top: 10px;">褰撳墠椤圭洰鏉℃暟锛�<span style="font-weight: 700;">{{ + OnenewpacName.length + }}</span>鏉�</div> + </el-col> <el-col :span="2" :xs="24"> <div style="margin: 240% 16%" class="btntoleft"> @@ -386,6 +433,10 @@ <el-col :span="7" :xs="24"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px" @submit.native.prevent> + <el-form-item> + <el-button type="primary" @click="Package" size="mini" style="margin-right: 20px">閫夋嫨濂楅</el-button> + </el-form-item> + <el-form-item label="椤圭洰鍚嶇О" prop="proName"> <el-input ref="inputName" v-model="queryParams.proName" placeholder="璇疯緭鍏ラ」鐩悕绉�" clearable @keyup.enter.native="handleSearchFor" style="width: 140px" /> @@ -459,8 +510,10 @@ </template> </el-table-column> </el-table> - <div style="font-size: 16px;margin-top: 10px;">褰撳墠椤圭洰鏉℃暟锛�<span style="font-weight: 700;">{{ OnenewpacName.length }}</span>鏉�</div> - + <div style="font-size: 16px;margin-top: 10px;">褰撳墠椤圭洰鏉℃暟锛�<span style="font-weight: 700;">{{ + OnenewpacName.length + }}</span>鏉�</div> + </el-col> <el-col :span="2" :xs="24"> <div style="margin: 240% 16%"> @@ -472,6 +525,9 @@ <el-col :span="8" :xs="24"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px" @submit.native.prevent> + <el-form-item> + <el-button type="primary" @click="Package" size="mini" style="margin-right: 20px">閫夋嫨濂楅</el-button> + </el-form-item> <el-form-item label="椤圭洰鍚嶇О" prop="proName"> <el-input ref="inputName" v-model="queryParams.proName" placeholder="璇疯緭鍏ラ」鐩悕绉�" clearable @keyup.enter.native="handleSearchFor" style="width: 140px" /> @@ -582,8 +638,9 @@ getPackageList, delegrouping, getDetails, + } from "@/api/system/comp"; -import { deptTreeSelect, projectGetList, getconfigKey } from "@/api/system/tijian"; +import { deptTreeSelect, projectGetList, getconfigKey,} from "@/api/system/tijian"; import { getInfo } from "@/api/login"; export default { name: "Comp", @@ -605,6 +662,15 @@ } }; return { + + newpacName1: [], + taocan: false, + queryParam: { + pageNum: 1, + pageSize: 10, + pacName: null, + pacRemark: null, + }, // 閬僵灞� loading: true, Treedata: [], @@ -737,6 +803,71 @@ this.getList(); }, methods: { + handleSelectionChange1(selection) { + // 瀹炵幇鍗曢�夐�昏緫 + if (selection.length > 1) { + const lastSelected = selection[selection.length - 1]; + this.$refs.tb.clearSelection(); + this.$refs.tb.toggleRowSelection(lastSelected, true); + this.selectedPackage = lastSelected; + } else if (selection.length === 1) { + this.selectedPackage = selection[0]; + } else { + this.selectedPackage = null; + } +}, + +submit() { + if (!this.selectedPackage) { + this.$modal.msgError("璇峰厛閫夋嫨涓�涓椁�"); + return; + } + + // 娓呯┖宸︿晶琛ㄦ牸 + this.OnenewpacName = []; + + // 鑾峰彇閫変腑鐨勫椁愰」鐩垪琛� + const newProjects = this.selectedPackage.tjProjectList || []; + + // 灏嗛�変腑鐨勫椁愰」鐩坊鍔犲埌宸︿晶琛ㄦ牸 + this.loading = true; + newProjects.forEach(project => { + // 涓烘瘡涓」鐩缃粯璁ゆ姌鎵e拰鐜颁环 + this.$set(project, 'limits', 10); // 榛樿鎶樻墸 10锛堝嵆鍘熶环锛� + this.$set(project, 'ysPrice', project.proPrice); // 鐜颁环鍒濆鍖栦负鍘熶环 + this.OnenewpacName.push(project); + }); + + // 鏇存柊鎬讳环鍜岀幇浠� + this.queryParams.price = this.OnenewpacName.reduce((sum, item) => { + return sum + (item.proPrice || 0); + }, 0); + + this.queryParams.xianprice = this.OnenewpacName.reduce((sum, item) => { + return sum + (item.ysPrice || 0); + }, 0); + + // 鏇存柊浼樻儬鍊� + this.youhui = this.queryParams.price > 0 + ? (Math.floor((this.queryParams.xianprice / this.queryParams.price) * 100) / 100) * 10 + : 0; + + // 鍏抽棴瀵硅瘽妗� + this.taocan = false; + this.loading = false; + this.$modal.msgSuccess("娣诲姞鎴愬姛"); +}, + cancel1() { + this.taocan = false; + }, + Package() { + this.taocan = true; + deptTreeSelect(this.forms.sex).then((res) => { + if (res.rows) { + this.newpacName1 = res.rows + } + }); + }, handleManualChange(row) { console.log("杩欐槸涓诲姩鍑哄彂鐨�"); this.updateProPrice(row); @@ -985,49 +1116,49 @@ }, numberChangeXianPrice(currentValue, oldValue) { - // 濡傛灉鐜颁环娌℃湁鍙樺寲锛岀洿鎺ヨ繑鍥� - if (this.queryParams.xianprice === this.lastXianPrice || !this.queryParams.xianprice) { - return; - } - - this.$confirm("纭畾淇敼鎵�鏈夊瓙椤圭殑鎶樻墸鍚楋紵", "鎻愮ず", { - confirmButtonText: "纭畾", - cancelButtonText: "鍙栨秷", - type: "warning", - }) - .then(() => { - // 纭繚淇敼鎶樻墸鐨勫�� - this.youhui = currentValue; - - let totalYsprice = new Big(0); // 鍒濆鍖栨�� ysprice - // 閬嶅巻姣忎釜椤圭洰锛屾洿鏂版瘡涓瓙椤圭殑浠锋牸 - this.OnenewpacName.forEach((item) => { - item.limits = this.youhui; - const proPrice = new Big(item.proPrice); - const limits = new Big(item.limits); - const result = proPrice.times(limits.div(10)); // ordPrice * (discount / 10) - item.ysPrice = result.toNumber(); - totalYsprice = totalYsprice.plus(new Big(item.ysPrice)); - }); - // 濡傛灉鎬荤殑 ysPrice 鍜屾煡璇㈠弬鏁颁腑鐨� xianprice 涓嶄竴鑷达紝杩涜璋冩暣 - if (!totalYsprice.eq(this.queryParams.xianprice)) { - const diff = new Big(this.queryParams.xianprice).minus(totalYsprice); - // 濡傛灉 OnenewpacName 鏁扮粍涓嶄负绌猴紝璋冩暣鏈�鍚庝竴椤圭殑 ysPrice - if (this.OnenewpacName.length > 0) { - const lastItem = this.OnenewpacName[this.OnenewpacName.length - 1]; - const newYsPrice = new Big(lastItem.ysPrice).plus(diff).toNumber(); - // 浣跨敤 $set 纭繚鍝嶅簲鎬ф洿鏂� - this.$set(this.OnenewpacName[this.OnenewpacName.length - 1], 'ysPrice', newYsPrice); - } + // 濡傛灉鐜颁环娌℃湁鍙樺寲锛岀洿鎺ヨ繑鍥� + if (this.queryParams.xianprice === this.lastXianPrice || !this.queryParams.xianprice) { + return; } - // 鏇存柊 lastXianPrice 浠ヤ究涓嬫姣旇緝 - this.lastXianPrice = this.queryParams.xianprice; - }) - .catch(() => { - // 濡傛灉鍙栨秷淇敼锛屾仮澶嶅師鏈夌殑浼樻儬鍊� - this.youhui = oldValue; - }); -}, + + this.$confirm("纭畾淇敼鎵�鏈夊瓙椤圭殑鎶樻墸鍚楋紵", "鎻愮ず", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning", + }) + .then(() => { + // 纭繚淇敼鎶樻墸鐨勫�� + this.youhui = currentValue; + + let totalYsprice = new Big(0); // 鍒濆鍖栨�� ysprice + // 閬嶅巻姣忎釜椤圭洰锛屾洿鏂版瘡涓瓙椤圭殑浠锋牸 + this.OnenewpacName.forEach((item) => { + item.limits = this.youhui; + const proPrice = new Big(item.proPrice); + const limits = new Big(item.limits); + const result = proPrice.times(limits.div(10)); // ordPrice * (discount / 10) + item.ysPrice = result.toNumber(); + totalYsprice = totalYsprice.plus(new Big(item.ysPrice)); + }); + // 濡傛灉鎬荤殑 ysPrice 鍜屾煡璇㈠弬鏁颁腑鐨� xianprice 涓嶄竴鑷达紝杩涜璋冩暣 + if (!totalYsprice.eq(this.queryParams.xianprice)) { + const diff = new Big(this.queryParams.xianprice).minus(totalYsprice); + // 濡傛灉 OnenewpacName 鏁扮粍涓嶄负绌猴紝璋冩暣鏈�鍚庝竴椤圭殑 ysPrice + if (this.OnenewpacName.length > 0) { + const lastItem = this.OnenewpacName[this.OnenewpacName.length - 1]; + const newYsPrice = new Big(lastItem.ysPrice).plus(diff).toNumber(); + // 浣跨敤 $set 纭繚鍝嶅簲鎬ф洿鏂� + this.$set(this.OnenewpacName[this.OnenewpacName.length - 1], 'ysPrice', newYsPrice); + } + } + // 鏇存柊 lastXianPrice 浠ヤ究涓嬫姣旇緝 + this.lastXianPrice = this.queryParams.xianprice; + }) + .catch(() => { + // 濡傛灉鍙栨秷淇敼锛屾仮澶嶅師鏈夌殑浼樻儬鍊� + this.youhui = oldValue; + }); + }, changegroupingName() { -- Gitblit v1.8.0