From 5702e02e6c31fd972d7a00042cce8ca4c4777166 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期四, 14 九月 2023 13:01:42 +0800
Subject: [PATCH] modified: src/App.vue modified: src/components/view/standard-table/material.vue modified: src/components/view/standard-table/target.vue modified: src/components/view/standard-table/technology.vue modified: src/components/view/standard.vue
---
src/components/view/sale.vue | 218 +++++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 189 insertions(+), 29 deletions(-)
diff --git a/src/components/view/sale.vue b/src/components/view/sale.vue
index c229b1f..b106e8f 100644
--- a/src/components/view/sale.vue
+++ b/src/components/view/sale.vue
@@ -50,7 +50,7 @@
.select-model .body {
padding: 0 20px;
color: #333;
- max-height: 70vh;
+ max-height: 72vh;
overflow-y: auto;
}
@@ -115,9 +115,9 @@
<el-row>
<el-col :span="12" style="line-height: 32px;">閿�鍞鐞�</el-col>
<el-col :span="12" style="text-align: right;">
- <el-button type="primary" icon="el-icon-plus" @click="addDia= true">鏂板</el-button>
- <el-button icon="el-icon-edit-outline">淇敼</el-button>
- <el-button icon="el-icon-delete">鍒犻櫎</el-button>
+ <el-button type="primary" icon="el-icon-plus" @click="openAddDia">鏂板</el-button>
+ <!-- <el-button icon="el-icon-edit-outline">淇敼</el-button> -->
+ <el-button icon="el-icon-delete" @click="delSales">鍒犻櫎</el-button>
<el-button icon="el-icon-download">瀵煎嚭</el-button>
</el-col>
</el-row>
@@ -132,9 +132,8 @@
<span>鐘舵�侊細</span>
<el-select v-model="search.type" size="small" placeholder="璇烽�夋嫨" style="width: 224px;margin-right: 30px;">
<el-option label="鍏ㄩ儴" :value="null"></el-option>
- <el-option label="閫氳繃" :value="0"></el-option>
- <el-option label="涓嶉�氳繃" :value="1"></el-option>
- <el-option label="鏈鏍�" :value="2"></el-option>
+ <el-option label="閫氳繃" :value="1"></el-option>
+ <el-option label="涓嶉�氳繃" :value="0"></el-option>
</el-select>
<span>浜よ揣鏃ユ湡锛�</span>
<el-date-picker v-model="search.delTime" size="small" placeholder="璇疯緭鍏�" style="width: 224px;margin-right: 30px;"
@@ -145,8 +144,9 @@
</el-button>
</div>
<div class="thing">
- <el-table :data="tableData" border style="width: 100%;overflow-y: auto;min-height: calc(100% - 50px)"
- max-height="calc(100% - 50px)" @selection-change="handleSelectionChange" default-expand-all row-key="id">
+ <el-table ref="tableData" :data="tableData" border
+ style="width: 100%;overflow-y: auto;min-height: calc(100% - 50px)" max-height="calc(100% - 50px)"
+ @selection-change="handleSelectionChange" default-expand-all row-key="id">
<el-table-column type="selection" width="50">
</el-table-column>
<el-table-column type="index" label="搴忓彿" width="65">
@@ -171,16 +171,17 @@
<el-table-column label="鎿嶄綔" width="220">
<template slot-scope="scope">
<span class="table_do" @click="changeShowDetail(scope.row)"> 鏌ョ湅璇︽儏 </span>
- <span class="table_do" v-if="scope.row.type==null"> 瀹℃牳 </span>
+ <span class="table_do" v-if="scope.row.type==null" @click="saleCheck(scope)"> 瀹℃牳 </span>
<span class="table_do" v-else> </span>
- <span class="table_do"> 缂栬緫 </span>
- <span class="table_do"> 鍒犻櫎 </span>
+ <span class="table_do" v-if="scope.row.type==null" @click="openUpDia(scope.row.id)"> 缂栬緫 </span>
+ <span class="table_do" v-else> </span>
+ <span class="table_do" @click="delSale(scope.$index)"> 鍒犻櫎 </span>
</template>
</el-table-column>
</el-table>
<el-col style="height: 50px;display: flex;align-items: center;justify-content: right;">
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
- :page-sizes="[1,10, 20, 30, 50]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper"
+ :page-sizes="[10, 20, 30, 50]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper"
:total="countSize">
</el-pagination>
</el-col>
@@ -208,7 +209,7 @@
<el-col :span="3" :offset="2">鐘舵��</el-col>
<el-col :span="8">
<div class="value" v-if="oneData.type == 1" style="color: #34BD66;">閫氳繃</div>
- <div class="value" v-else-if="oneData.type == 2" style="color: #E84738;">涓嶉�氳繃</div>
+ <div class="value" v-else-if="oneData.type == 0" style="color: #E84738;">涓嶉�氳繃</div>
<div class="value" v-else> </div>
</el-col>
</el-row>
@@ -238,7 +239,7 @@
<el-row style="line-height: 30px;margin: 15px 0;">
<el-col :span="3">涓氬姟鍛�</el-col>
<el-col :span="8">
- <div class="value">{{JSON.parse(oneData.saleman)}}</div>
+ <div class="value">{{oneData.saleman}}</div>
</el-col>
<el-col :span="3" :offset="2">涓嬪崟浜�</el-col>
<el-col :span="8">
@@ -252,13 +253,13 @@
</el-col>
<el-col :span="3" :offset="2">瀹℃牳浜�</el-col>
<el-col :span="8">
- <div class="value">{{JSON.parse(oneData.checkname)}}</div>
+ <div class="value">{{oneData.checkname==null?' ': oneData.checkname}}</div>
</el-col>
</el-row>
<el-row style="line-height: 30px;margin: 15px 0;">
<el-col :span="3">瀹℃牳鏃ユ湡</el-col>
<el-col :span="8">
- <div class="value">{{oneData.checkTime}}</div>
+ <div class="value">{{oneData.checkTime==null?' ': oneData.checkTime}}</div>
</el-col>
</el-row>
</div>
@@ -281,7 +282,7 @@
</el-dialog>
</div>
<div class="select-model">
- <el-dialog title="閿�鍞柊澧�" :visible.sync="addDia" width="750px">
+ <el-dialog :title="`閿�鍞�${upDia==true?'淇敼':'鏂板'}`" :visible.sync="addDia" width="850px">
<div class="body">
<div class="head">鍩烘湰淇℃伅</div>
<div class="content">
@@ -346,10 +347,11 @@
<el-table :data="addData.saleMaterialList" border style="width: 100%">
<el-table-column prop="name" label="浜у搧鍚嶇О" width="180">
<template slot-scope="scope">
- <el-input v-model="scope.row.name" size="small" clearable placeholder="璇疯緭鍏ヤ骇鍝佸悕绉�"></el-input>
+ <el-input v-model="scope.row.name" size="small" clearable placeholder="璇疯緭鍏ヤ骇鍝佸悕绉�">
+ </el-input>
</template>
</el-table-column>
- <el-table-column prop="specifications" label="瑙勬牸鍨嬪彿" width="200">
+ <el-table-column prop="specifications" label="瑙勬牸鍨嬪彿" width="180">
<template slot-scope="scope">
<el-input v-model="scope.row.specifications" size="small" clearable placeholder="璇疯緭鍏ヨ鏍煎瀷鍙�"></el-input>
</template>
@@ -362,7 +364,8 @@
<el-table-column prop="number" label="鏁伴噺">
<template slot-scope="scope">
<el-input v-model.number="scope.row.number" size="small"
- @change="scope.row.number = isNaN(scope.row.number)?0:scope.row.number" clearable placeholder="璇疯緭鍏�"></el-input>
+ @change="(val)=>scope.row.number = isNaN(val)?null:val" clearable
+ placeholder="璇疯緭鍏�"></el-input>
</template>
</el-table-column>
<el-table-column prop="price" label="鍗曚环">
@@ -370,11 +373,17 @@
<el-input v-model="scope.row.price" size="small" clearable placeholder="璇疯緭鍏�"></el-input>
</template>
</el-table-column>
+ <el-table-column prop="price" label="鎿嶄綔" width="65px">
+ <template slot-scope="scope">
+ <el-button type="text" @click.native.prevent="deleteRow(scope.$index, addData.saleMaterialList)">鍒犻櫎</el-button>
+ </template>
+ </el-table-column>
</el-table>
</div>
</div>
<span slot="footer" class="dialog-footer">
- <el-button type="primary" @click="addSale">纭� 瀹�</el-button>
+ <el-button v-if="upDia==false" type="primary" @click="addSale">纭� 瀹�</el-button>
+ <el-button v-else-if="upDia==true" type="primary" @click="upSale">纭� 瀹�</el-button>
<el-button @click="addDia = false">鍙� 娑�</el-button>
</span>
</el-dialog>
@@ -393,16 +402,27 @@
delTime: null
},
tableData: [],
- selects: [],
+ selects: '',
currentPage: 1,
countSize: 0,
pageSize: 10,
selectDia: false,
oneData: null,
- addDia: true,
+ addDia: false,
addData: {
+ orderNumber: null,
+ code: null,
+ name: null,
+ proname: null,
+ adress: null,
+ username: null,
+ delTime: null,
+ orderName: null,
+ phone: null,
saleMaterialList: []
- }
+ },
+ repeList: [],
+ upDia: false
}
},
mounted() {
@@ -410,7 +430,13 @@
},
methods: {
handleSelectionChange(val) {
- this.selects = val;
+ this.selects = ''
+ val.forEach((a, ai)=>{
+ this.selects += a.id
+ if(ai!=val.length-1){
+ this.selects += ','
+ }
+ })
},
handleSizeChange(val) {
this.pageSize = val
@@ -436,7 +462,7 @@
})
},
clean() {
- this.selects = []
+ this.selects = ''
this.currentPage = 1
this.countSize = 0
this.pageSize = 10
@@ -444,7 +470,8 @@
formTime: null,
createTime: null,
insState: 2,
- judgeState: 2
+ judgeState: 2,
+ type: null
}
this.selectRawInspectsList()
},
@@ -462,12 +489,145 @@
this.addData.saleMaterialList.push({})
},
addSale() {
+ for (var b = 0; b < this.addData.saleMaterialList.length; b++) {
+ if (Object.keys(this.addData.saleMaterialList[b]).length == 0) {
+ this.addData.saleMaterialList.splice(b, 1)
+ b--
+ } else {
+ for (var c in this.addData.saleMaterialList[b]) {
+ if (this.addData.saleMaterialList[b][c] == null || this.addData.saleMaterialList[b][c] == '' || Object
+ .keys(this.addData.saleMaterialList[b]).length != 5) {
+ this.$message.error('浜у搧淇℃伅鏈夊繀濉」鏈~鍐�')
+ return
+ }
+ }
+ }
+ }
+ for (var a in this.addData) {
+ if (this.addData[a] == null || this.addData[a] == '') {
+ if (a == 'saleMaterialList') {
+ this.$message.error('浜у搧淇℃伅涓嶈兘涓虹┖')
+ } else {
+ this.$message.error('閿�鍞鍗曟湁蹇呭~椤规湭濉啓')
+ }
+ return
+ }
+ }
this.axios.post(this.$api.url.addSale, this.addData, {
headers: {
'Content-Type': 'application/json'
}
}).then(res => {
- console.log(res);
+ this.$message.success('娣诲姞鎴愬姛')
+ this.addDia = false
+ this.selectRawInspectsList()
+ })
+ },
+ openAddDia() {
+ this.addDia = !(this.addDia)
+ this.upDia = false
+ },
+ upRepe(index, i) {
+ var data = this.repeList[index]
+ if (data == undefined) {
+ this.addData.saleMaterialList[i] = {}
+ } else {
+ this.addData.saleMaterialList[i].unit = data.unit
+ this.addData.saleMaterialList[i].specifications = data.specifications
+ }
+ },
+ saleCheck(ob) {
+ this.$confirm(`璁㈠崟${ob.row.code}鐨勪俊鎭槸鍚﹂�氳繃`, '閿�鍞鍗曞鏍�', {
+ distinguishCancelAndClose: true,
+ confirmButtonText: '閫氳繃',
+ cancelButtonText: '涓嶉�氳繃'
+ }).then(res => {
+ this.$axios.post(this.$api.url.saleCheck, {
+ id: ob.row.id,
+ type: 1
+ }).then(res => {
+ this.selectRawInspectsList()
+ })
+ }).catch(e => {
+ if (e == 'cancel') {
+ this.$axios.post(this.$api.url.saleCheck, {
+ id: ob.row.id,
+ type: 0
+ }).then(res => {
+ this.selectRawInspectsList()
+ })
+ }
+ })
+ },
+ openUpDia(index) {
+ this.addDia = true
+ this.upDia = true
+ this.axios.get(this.$api.url.selectSaleDatilById, {
+ params: {
+ id: index
+ }
+ }).then(res => {
+ this.addData = res.data
+ this.addData.id = index
+ })
+ },
+ upSale() {
+ for (var b = 0; b < this.addData.saleMaterialList.length; b++) {
+ if (Object.keys(this.addData.saleMaterialList[b]).length == 0) {
+ this.addData.saleMaterialList.splice(b, 1)
+ b--
+ } else {
+ for (var c in this.addData.saleMaterialList[b]) {
+ if (this.addData.saleMaterialList[b][c] == null || this.addData.saleMaterialList[b][c] == '' || Object
+ .keys(this.addData.saleMaterialList[b]).length != 6) {
+ this.$message.error('浜у搧淇℃伅鏈夊繀濉」鏈~鍐�')
+ return
+ }
+ }
+ }
+ }
+ for (var a in this.addData) {
+ console.log(a);
+ if ((this.addData[a] == null || this.addData[a] == '') && a!='checkname' && a!='checkTime' && a != 'type') {
+ if (a == 'saleMaterialList') {
+ this.$message.error('浜у搧淇℃伅涓嶈兘涓虹┖')
+ } else {
+ this.$message.error('閿�鍞鍗曟湁蹇呭~椤规湭濉啓')
+ }
+ return
+ }
+ }
+ this.axios.post(this.$api.url.updateSaleById, {
+ id: this.addData.id,
+ str: JSON.stringify(this.addData)
+ }).then(res => {
+ this.$message.success('缂栬緫鎴愬姛')
+ this.addDia = false
+ this.upDia = false
+ this.selectRawInspectsList()
+ })
+ },
+ deleteRow(index, rows) {
+ rows.splice(index, 1);
+ },
+ delSale(index){
+ this.axios.post(this.$api.url.delSale, {
+ id: this.tableData[index].id,
+ }).then(res => {
+ this.$message.success('鍒犻櫎鎴愬姛')
+ this.tableData.splice(index, 1)
+ })
+ },
+ delSales(){
+ if(this.selects=='') {
+ this.$message.warning('璇烽�夋嫨涓�鏉℃暟鎹垹闄�')
+ return
+ }
+ this.axios.post(this.$api.url.delAllSale,{
+ ids: this.selects
+ }).then(res=>{
+ this.$message.success('鍒犻櫎鎴愬姛')
+ this.selectRawInspectsList()
})
}
}
--
Gitblit v1.9.3