From 46124fe454f90d24171ebc5be0d9cfe2ab22cbc5 Mon Sep 17 00:00:00 2001 From: doum <doum> Date: 星期一, 13 十月 2025 09:47:51 +0800 Subject: [PATCH] 最新版本541200007 --- admin/src/components/business/OperaJkSketchResultWindow.vue | 276 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 228 insertions(+), 48 deletions(-) diff --git a/admin/src/components/business/OperaJkSketchResultWindow.vue b/admin/src/components/business/OperaJkSketchResultWindow.vue index 2bf3c7c..961e82f 100644 --- a/admin/src/components/business/OperaJkSketchResultWindow.vue +++ b/admin/src/components/business/OperaJkSketchResultWindow.vue @@ -1,82 +1,262 @@ <template> - <el-dialog - class="center-title" + <GlobalWindow :title="title" - width="500px" - top="30vh" + width="100%" :visible.sync="visible" :confirm-working="isWorking" @confirm="confirm" > - <p class="tip-warn"><i class="el-icon-warning"></i>瀵煎叆璇存槑锛�<br> - 1.璇峰厛涓嬭浇鏂囦欢妯℃澘锛屽苟鎸夌収妯℃澘瑕佸幓濉啓琛ㄦ牸鍐呭;<br> - 2.姣忔瀵煎叆閿�鍞鍗曡〃绀哄嵆鍒犻櫎涔嬪墠瀵煎叆姝ゆ鐩稿簲鏃ユ湡鐨勮鍗曡褰曪紝浠ユ娆″鍏ョ殑鏁版嵁涓轰富;<br> - </p> - <el-form class="demo-form-inline" > - <el-form-item label="绾胯矾淇℃伅" required> - <div style="width: 100%;display: flex;align-items: center;"> - <el-button type="primary" @click="clickRef">鐐瑰嚮涓婁紶</el-button> - <el-button type="text" @click="exportTemplate">鐐瑰嚮涓嬭浇妯$増.EXCEL</el-button> + <div style="display: block;margin-bottom: 30px;"> + <div style="display: block;font-size: 16px;font-weight: 600;margin-bottom: 20px;">涓荤嚎璺俊鎭�</div> + <div style="display: flex;"> + <div style="flex: 1">閫佽揣鏃ユ湡锛歿{model.dateInfo ||''}}</div> + <div style="flex: 1">涓荤嚎璺細{{model.categoryName ||''}}</div> + <div style="flex: 1">瀹㈡埛鏁帮細{{model.orderNum ||'-'}}</div> + <div style="flex: 1">閫佽揣閲�(鏉�)锛歿{model.totalNum ||'-'}}</div> + </div> + <div style="display: flex;margin-top: 30px"> + <div style="flex: 1">浼樺寲鏃堕棿锛歿{model.planLineDate ||''}} - {{model.planLineEndDate ||''}}</div> + </div> + <div style="display: flex;margin-top: 20px" class="orange"> + <div style="flex: 1">浼樺寲缁撴灉锛氫紭鍖栧墠鎬昏矾绋� <span class="red" style="font-weight: bold"> {{((model.originDistance ||0)/1000).toFixed(2)}}</span> 鍏噷锛屼紭鍖栧悗鎬昏矾绋�<span class="green" style="font-weight: bold"> {{((model.distance ||0)/1000).toFixed(2)}} </span> 鍏噷</div> + </div> + </div> + <div style="display: block"> + <div style="display: block;font-size: 16px;font-weight: 600;margin-bottom: 10px;">绾胯矾鏄庣粏</div> + <div> + <el-table :data="dataList" stripe :row-class-name="tableRowClassName"> + <el-table-column prop="dateInfo" label="閫佽揣鏃ユ湡" min-width="130px"></el-table-column> + <el-table-column prop="lineName" label="閫佽揣绾胯矾" min-width="130px"> </el-table-column> + <el-table-column prop="orderNum" label="瀹㈡埛鏁�(鎴�)" min-width="130px"> </el-table-column> + <el-table-column prop="totalNum" label="閫佽揣閲�(鏉�)" min-width="130px"></el-table-column> + <el-table-column prop="carCode" label="杞︾墝鍙�" min-width="100px"></el-table-column> + <el-table-column prop="memberName" label="閫佽揣鍙告満" min-width="100px"></el-table-column> + <el-table-column prop="distance" label="鎬昏矾绋�(鍏噷)" min-width="100px"> + <template slot-scope="{row}"> + {{((row.distance ||0)/1000).toFixed(2)}} + </template> + </el-table-column> + <el-table-column + label="鎿嶄綔" + min-width="120" + align="left" + fixed="right" + > + <template slot-scope="{row}"> + <el-button type="text" @click="updateDo(row)" icon="el-icon-edit" style="color: #0d68ff" v-if="!updating" >寰皟</el-button> + <template v-else-if="updating && currentRow.id ===row.id" > + <el-button type="text" style="color: #13ce66" >鏈溅</el-button> + <el-button type="text" @click="cancelDo(row)" icon="el-icon-delete" style="color: red" >鍙栨秷</el-button> + </template> + <el-button type="text" @click="addDo(row)" icon="el-icon-plus" style="color: red" v-else-if="updating && currentRow.id !==row.id" >鍔犲叆</el-button> + </template> + </el-table-column> + </el-table> + </div> + </div> + + <div style="display: block;margin-top: 30px;border: 1px solid #f2f2f2;padding: 10px" v-if="updating"> + <div style="display: block;font-size: 16px;font-weight: 600;margin-bottom: 10px;">{{currentRow.lineName}} - 瀹㈡埛鏄庣粏</div> + <div> + <p class="tip-warn"><i class="el-icon-warning"></i>鎿嶄綔璇存槑锛�<br> + 1.璇烽�夋嫨鑻ュ共瀹㈡埛淇℃伅锛岀偣鍑讳笂杩板叾浠栫嚎璺悗鐨�<span class="red">銆愬姞鍏ャ��</span>鎸夐挳锛屽皢閫変腑鐨勫鎴风Щ鍔犲埌瀵瑰簲绾胯矾涓�;<br> + 2.鐐瑰嚮鏈溅绾胯矾鍚庣殑<span class="red">銆愬彇娑堛��</span>鎸夐挳锛屽彲鎾ら攢鏈溅寰皟鎿嶄綔;<br> + </p> + <el-table :data="paginatedData" stripe @selection-change="handleSelectionChange">> + <el-table-column type="selection" width="55"></el-table-column> + <el-table-column prop="code" label="瀹㈡埛绠�鐮�" min-width="130px"></el-table-column> + <el-table-column prop="name" label="瀹㈡埛鍚嶇О" min-width="130px"> </el-table-column> + <el-table-column prop="totalNum" label="閫佽揣閲�(鏉�)" min-width="130px"></el-table-column> + <el-table-column prop="location" label="瀹㈡埛鍦板潃" min-width="200px" show-tooltip-when-overflow></el-table-column> + <el-table-column prop="latitude" label="缁忕含搴�" min-width="200px"> + <template slot-scope="{row}"> + {{(row.longitude || 0).toFixed(6)}},{{(row.latitude || 0).toFixed(6)}} + </template> + </el-table-column> + </el-table> + <div class="table-pagination"> + <el-pagination + @current-change="handleCurrentChange" + :current-page="currentPage" + :page-size="pageSize" + layout="total, prev, pager, next, jumper" + :total="totalItems"> + </el-pagination> </div> - <div style="font-size: 14px; color: black;" v-if="fileName">{{fileName}}</div> - </el-form-item> - </el-form> - <input type="file" style="position: fixed; left: 0; top: -50px;" accept=".xlsx" ref="fileExcel" @change="result" /> + </div> + </div> <template v-slot:footer> + <el-button @click="confirmDo" type="primary" v-if="buttonName!==''">{{ buttonName||'纭' }}</el-button> <el-button @click="visible=false">杩斿洖</el-button> </template> - </el-dialog> + </GlobalWindow> </template> <script> import BaseOpera from '@/components/base/BaseOpera' import GlobalWindow from '@/components/common/GlobalWindow' -import { importExcel } from '@/api/business/jkLine' +import { allList as customerList } from '@/api/business/jkSketchCustomer' export default { + name: 'OperaJkSketchLineWindow', extends: BaseOpera, - // eslint-disable-next-line vue/no-unused-components components: { GlobalWindow }, data () { return { - importing:false, - fileName: '' + // 琛ㄥ崟鏁版嵁 + updating: false, + currentRow: null, + model: { + }, + buttonName: '', + dataList: [], + currentPage: 1, + pageSize: 10, + totalItems: 0, // 鎬绘暟鎹潯鐩暟 + allCustomerList: [], + tableData: [], // 鎵�鏈夋暟鎹� + selectRows: [] + } + }, + created () { + this.config({ + api: '/business/jkSketchLine', + 'field.id': 'id' + }) + }, + computed: { + paginatedData () { + const start = (this.currentPage - 1) * this.pageSize + const end = start + this.pageSize + return this.tableData.slice(start, end) } }, methods: { - open (title) { - this.title = title - this.fileName = '' + confirmDo () { + + }, + open (title, target) { + this.title = title + target.categoryName this.visible = true + this.model = target + this.updating = false + this.selectRows = [] + this.tableData = [] + this.allCustomerList = [] + this.currentRow = null + this.loadList() }, - // 瀵煎嚭妯℃澘 - exportTemplate () { - // 鎶曚繚鐢宠 - window.open('/template/jkLineTemplate.xlsx') + updateDo (row) { + this.currentRow = row + this.tableData = row.customerList || [] + this.totalItems = this.tableData.length + this.currentPage = 1 + this.selectRows = [] + this.updating = true }, - clickRef () { - this.$refs.fileExcel.click() + cancelDo (row) { + this.selectRows = [] + this.currentRow = null + this.updating = false }, - result (e) { - const data = new FormData() - data.append('file', e.target.files[0]) - importExcel(data) + addDo (row) { + if (!this.selectRows || !this.selectRows.length) { + this.$message.error('瀵逛笉璧凤紝璇疯嚦灏戦�夋嫨鏈変竴鏉″鎴疯褰曞姞鍏ヨ璺嚎锛�') + return + } + const tarray = [] + let tNum = 0 + this.currentRow.customerList.forEach(item => { + let flag = false + this.selectRows.forEach(item1 => { + if (item.id === item1.id) { + flag = true + } + }) + if (!flag) { + tNum += (item.totalNum || 0) + tarray.push(item) + } + }) + if(tarray.length === 0){ + this.$message.error('瀵逛笉璧凤紝鏈溅绾胯矾鑷冲皯鐣欏瓨涓�涓鎴蜂俊鎭紝鏃犳硶鍏ㄩ儴娓呯┖锛�') + return + } + var rArray = row.customerList || [] + rArray = rArray.push(...this.selectRows) + let ttNum = 0 + rArray.forEach(item => { + ttNum += (item.totalNum || 0) + }) + if(tarray.length >= (row.maxCustomer||0)){ + this.$message.error('瀵逛笉璧凤紝鍔犲叆鐨勭嚎璺渶澶ф敮鎸�'+ (row.maxOrderNum||0) + '瀹㈡埛锛�') + return + } + if(ttNum >= (row.maxOrder||0)){ + this.$message.error('瀵逛笉璧凤紝鍔犲叆鐨勭嚎璺渶澶ф敮鎸�'+ (row.maxOrder||0) + '閫佽揣閲忥紒') + return + } + this.currentRow.customerList = tarray + this.currentRow.orderNum = this.currentRow.customerList.length + this.currentRow.totalNum = tNum + row.customerList = rArray + row.orderNum = row.customerList.length + row.totalNum = ttNum + this.currentRow = null + this.updating = false + this.buttonName = '淇濆瓨璋冩暣寮�濮嬩紭鍖�' + }, + handleSelectionChange (rows) { + this.selectRows = rows + }, + loadCustomerList () { + customerList({ sketchId: this.model.id }) .then(res => { - this.$message.success('瀵煎叆鎴愬姛') - this.$emit('success') - this.visible = false + this.allCustomerList = res + if (this.allCustomerList && this.allCustomerList.length) { + this.dataList.forEach(item => { + var tarray = [] + this.allCustomerList.forEach(item1 => { + if (item.id === item1.sketchLineId) { + tarray.push(item1) + } + }) + item.customerList = tarray + }) + } }) - .catch(err => { - // this.$message.error(err) - this.fileName = '' - }) - .finally(() => { - this.$refs.fileExcel.value = null - }) + }, + loadList () { + this.api.allList({ + sketchId: this.model.id + }).then(res => { + this.dataList = res + this.loadCustomerList() + }) + }, + tableRowClassName ({ row, rowIndex }) { + if (this.currentRow && row.id === this.currentRow.id) { + return 'warning-row' + } else { + return 'success-row' + } + }, + handleCurrentChange (newPage) { + this.currentPage = newPage } } } </script> - -<style lang="scss" scoped> - +<style lang="scss"> +.el-table .warning-row { + background: rgba(161, 231, 20, 0.2) !important; + td{ + background: rgba(161, 231, 20, 0.2) !important; + } +} +.el-table .success-row { + background: #f0f9eb !important; + td{ + background: #f0f9eb !important; + } +} </style> -- Gitblit v1.9.3