From 861e1c1428046b348f7e963025a454e710792815 Mon Sep 17 00:00:00 2001 From: 李林 <z1292839451@163.com> Date: 星期四, 17 八月 2023 12:54:15 +0800 Subject: [PATCH] 增加菜单,增加销售管理 --- src/main.js | 125 +++++++++-------- src/router/index.js | 13 - src/view/index.vue | 158 ++++++++++++++++++++++ src/assets/api/controller.js | 3 src/components/view/sale.vue | 75 +++++++++- 5 files changed, 287 insertions(+), 87 deletions(-) diff --git a/src/assets/api/controller.js b/src/assets/api/controller.js index adf82c7..60376ec 100644 --- a/src/assets/api/controller.js +++ b/src/assets/api/controller.js @@ -48,7 +48,8 @@ ...finishedIns, selectSaleList: "sale/selectSaleList", //鏌ヨ閿�鍞崟鍒楄〃 selectSaleDatilById: "sale/selectSaleDatilById", //鏍规嵁閿�鍞崟id鏌ョ湅璇︽儏, - addSale: "sale/addSale", //鏂板閿�鍞崟 + addSale: "sale/addSale", //鏂板閿�鍞崟, + seleRepe: "sale/seleRepe", //鏌ヨ鎴愬搧搴撳瓨 } diff --git a/src/components/view/sale.vue b/src/components/view/sale.vue index c229b1f..e46f70c 100644 --- a/src/components/view/sale.vue +++ b/src/components/view/sale.vue @@ -115,7 +115,7 @@ <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 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">鍒犻櫎</el-button> <el-button icon="el-icon-download">瀵煎嚭</el-button> @@ -281,7 +281,7 @@ </el-dialog> </div> <div class="select-model"> - <el-dialog title="閿�鍞柊澧�" :visible.sync="addDia" width="750px"> + <el-dialog title="閿�鍞柊澧�" :visible.sync="addDia" width="800px"> <div class="body"> <div class="head">鍩烘湰淇℃伅</div> <div class="content"> @@ -346,23 +346,27 @@ <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-select v-model="scope.row.name" size="small" clearable placeholder="璇疯緭鍏ヤ骇鍝佸悕绉�" + @change="((index)=>{upRepe(index, scope.$index)})"> + <el-option v-for="(a, ai) in repeList" :key="ai" :label="a.name" :value="ai"></el-option> + </el-select> </template> </el-table-column> <el-table-column prop="specifications" label="瑙勬牸鍨嬪彿" width="200"> <template slot-scope="scope"> - <el-input v-model="scope.row.specifications" size="small" clearable placeholder="璇疯緭鍏ヨ鏍煎瀷鍙�"></el-input> + <el-input v-model="scope.row.specifications" size="small" readonly></el-input> </template> </el-table-column> <el-table-column prop="unit" label="鍗曚綅"> <template slot-scope="scope"> - <el-input v-model="scope.row.unit" size="small" clearable placeholder="璇疯緭鍏�"></el-input> + <el-input v-model="scope.row.unit" size="small" readonly></el-input> </template> </el-table-column> <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="scope.row.number = isNaN(scope.row.number)?0:scope.row.number" clearable + placeholder="璇疯緭鍏�"></el-input> </template> </el-table-column> <el-table-column prop="price" label="鍗曚环"> @@ -399,10 +403,20 @@ 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: [] } }, mounted() { @@ -462,6 +476,36 @@ this.addData.saleMaterialList.push({}) }, addSale() { + 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 + } + } + for (var b = 0; b < this.addData.saleMaterialList.length; b++) { + console.log(this.addData.saleMaterialList[b]); + if (Object.getOwnPropertyNames(this.addData.saleMaterialList[b]).length==0) { + this.addData.saleMaterialList.splice(b, 1) + b-- + if (b < 0) { + this.$message.error('浜у搧淇℃伅涓嶈兘涓虹┖') + return + } + } else { + for (var c in this.addData.saleMaterialList[b]) { + if (this.addData.saleMaterialList[b][c] == null || this.addData.saleMaterialList[b][c] == {} || Object + .getOwnPropertyNames(this.addData.saleMaterialList[b]).length != 5) { + this.$message.error('浜у搧淇℃伅鏈夊繀濉」鏈~鍐�') + return + } + } + } + } + console.log(this.addData); this.axios.post(this.$api.url.addSale, this.addData, { headers: { 'Content-Type': 'application/json' @@ -469,6 +513,21 @@ }).then(res => { console.log(res); }) + }, + openAddDia() { + this.addDia = !(this.addDia) + this.$axios.post(this.$api.url.seleRepe).then(res => { + this.repeList = res.data + }) + }, + 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 + } } } } diff --git a/src/main.js b/src/main.js index 3b771af..f5b6bda 100644 --- a/src/main.js +++ b/src/main.js @@ -12,6 +12,9 @@ import swal from 'sweetalert' Vue.prototype.LOCATIONVUE = "http://127.0.0.1:80/"; //鍓嶇鏈湴绔彛 +Vue.prototype.HaveJson = (val) => { + return JSON.parse(JSON.stringify(val)) +} Vue.use(VueAxios, axios) Vue.config.productionTip = false @@ -30,70 +33,70 @@ Vue.prototype.$axios = axios import { - Message + Message } from 'element-ui'; axios.interceptors.request.use(function(config) { - let tk = sessionStorage.getItem("token") - let token; - if (tk != undefined && tk != '') { - token = tk - } - if (token) { - config.headers['token'] = "" + token - // config.headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8' - // config.headers['Content-Type'] = 'application/json' - } - // console.log(config) - if (config.method === 'post' || config.method === 'put') { - - config.data = qs.stringify(config.data) - } - if(config.headers['Content-Type'] =='application/json'){ - config.data = qs.parse(config.data) - // console.log(config.data) - } - - return config + let tk = sessionStorage.getItem("token") + let token; + if (tk != undefined && tk != '') { + token = tk + } + if (token) { + config.headers['token'] = "" + token + // config.headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8' + // config.headers['Content-Type'] = 'application/json' + } + // console.log(config) + if (config.method === 'post' || config.method === 'put') { + + config.data = qs.stringify(config.data) + } + if (config.headers['Content-Type'] == 'application/json') { + config.data = qs.parse(config.data) + // console.log(config.data) + } + + return config }, function(error) { - return Promise.reject(error) + return Promise.reject(error) }) axios.interceptors.response.use(res => { - return res.data + return res.data }, async function(err) { - if (JSON.stringify(err).indexOf('timeout of') > -1) { - Message.error('璇锋眰瓒呮椂锛岃妫�鏌ョ綉缁滆缃�') - } else if (JSON.stringify(err).indexOf('ERR_CONNECTION_RESET') > -1 || JSON.stringify(err).indexOf( - 'Network Error') > -1) { - Message.error('缃戠粶杩炴帴閿欒') - } else if (err.response.status == "503") { - Message.error('鏈嶅姟鏈搷搴�') - } else if (err.response.status == "404") { - Message.error('璇锋眰澶辫触锛岄摼鎺ュ湴鍧�涓嶅瓨鍦�') - } else if (err.response.status == "403") { - Message.error('token涓嶅瓨鍦�') - }else if (err.response.status == "402") { - Message.error('鏃犳晥绛惧悕锛岃閲嶆柊鐧诲綍') - localStorage.removeItem('autoenter') - window.location.href = '/enter' - } else if (err.response.status == "401") { - await axios.post(javaApi + "user/refresh", { - reToken: sessionStorage.getItem('reToken') - }).then(res => { - if (res.data.code==201) { - Message.error('璁よ瘉澶辫触锛岄渶瑕侀噸鏂扮櫥褰�') - localStorage.removeItem('autoenter') - window.location.href = '/enter' - return Promise.reject(err) - } - sessionStorage.setItem('token', res.data.token) - sessionStorage.setItem('reToken', res.data.reToken) - }) - return axios(err.config) - } else if (err.response.status == "500") { - Message.error('鏈嶅姟绔嚭鐜伴敊璇�') - } - return Promise.reject(err) + if (JSON.stringify(err).indexOf('timeout of') > -1) { + Message.error('璇锋眰瓒呮椂锛岃妫�鏌ョ綉缁滆缃�') + } else if (JSON.stringify(err).indexOf('ERR_CONNECTION_RESET') > -1 || JSON.stringify(err).indexOf( + 'Network Error') > -1) { + Message.error('缃戠粶杩炴帴閿欒') + } else if (err.response.status == "503") { + Message.error('鏈嶅姟鏈搷搴�') + } else if (err.response.status == "404") { + Message.error('璇锋眰澶辫触锛岄摼鎺ュ湴鍧�涓嶅瓨鍦�') + } else if (err.response.status == "403") { + Message.error('token涓嶅瓨鍦�') + } else if (err.response.status == "402") { + Message.error('鏃犳晥绛惧悕锛岃閲嶆柊鐧诲綍') + localStorage.removeItem('autoenter') + window.location.href = '/enter' + } else if (err.response.status == "401") { + await axios.post(javaApi + "user/refresh", { + reToken: sessionStorage.getItem('reToken') + }).then(res => { + if (res.data.code == 201) { + Message.error('璁よ瘉澶辫触锛岄渶瑕侀噸鏂扮櫥褰�') + localStorage.removeItem('autoenter') + window.location.href = '/enter' + return Promise.reject(err) + } + sessionStorage.setItem('token', res.data.token) + sessionStorage.setItem('reToken', res.data.reToken) + }) + return axios(err.config) + } else if (err.response.status == "500") { + Message.error('鏈嶅姟绔嚭鐜伴敊璇�') + } + return Promise.reject(err) }) // 璺敱鎷︽埅鍣� @@ -111,7 +114,7 @@ // }); new Vue({ - el: '#app', - router, - render: h => h(App) -}); + el: '#app', + router, + render: h => h(App) +}); \ No newline at end of file diff --git a/src/router/index.js b/src/router/index.js index 0bd135d..354b9ff 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -23,18 +23,5 @@ { path: "/enter", component: () => import("../view/enter.vue") - }, - // 娣诲姞璁¢噺妯″潡 - { - path: "/measure", - components: Index, - redirect: "/manage", - children: [ - { - path: "/manage", - name: "MeasureManage", - component: () => import('../components/view/measure/index.vue') - } - ] }] }) \ No newline at end of file diff --git a/src/view/index.vue b/src/view/index.vue index 3d5a9e8..7da206b 100644 --- a/src/view/index.vue +++ b/src/view/index.vue @@ -67,7 +67,7 @@ color: #fff; width: 68px; height: 68px; - margin: 20px 0; + margin: 8px 0; cursor: pointer; display: flex; align-items: center; @@ -319,6 +319,74 @@ } ] }, + { + k: 4, + v: "鐢熶骇绠$悊", + i: "font icon-shouye", + c: [ + { + k: 12, + v: "鐢熶骇璁㈠崟", + i: "font icon-shouye", + u: "" + }, + { + k: 13, + v: "鐢熶骇璁″垝", + i: "font icon-shouye", + u: "" + }, + { + k: 14, + v: "鐢熶骇鎶ュ伐", + i: "font icon-shouye", + u: "" + } + ] + }, + { + k: 5, + v: "WMS绠$悊", + i: "font icon-shouye", + c: [ + { + k: 15, + v: "鍘熸潗鏂欏簱瀛�", + i: "font icon-shouye", + u: "" + }, + { + k: 16, + v: "鍥炲崟绠$悊", + i: "font icon-shouye", + u: "" + }, + { + k: 17, + v: "鍗婃垚鍝佸簱瀛�", + i: "font icon-shouye", + u: "" + }, + { + k: 18, + v: "鎴愬搧搴撳瓨", + i: "font icon-shouye", + u: "" + }, + { + k: 19, + v: "鎴愬搧鍙戣揣", + i: "font icon-shouye", + u: "" + }, + { + k: 20, + v: "鎴愬搧鍏ュ簱", + i: "font icon-shouye", + u: "" + } + ] + }, { k: 1, v: "鎶�鏈鐞�", @@ -390,9 +458,83 @@ v: "璁¢噺绠$悊", i: "font icon-shouye", u: "measurementManagement" + }, + { + k: 10.1, + v: "宸℃", + i: "font icon-shouye", + u: "" + }, + { + k: 10.2, + v: "涓嶅悎鏍煎搧澶勭疆", + i: "font icon-shouye", + u: "" } ] - } + }, + { + k: 6, + v: "鏍哥畻绠$悊", + i: "font icon-shouye", + c: [ + { + k: 21, + v: "浜ч噺宸ヨ祫", + i: "font icon-shouye", + u: "" + }, + { + k: 22, + v: "鍛樺伐鍑哄嫟", + i: "font icon-shouye", + u: "" + } + ] + }, + { + k: 7, + v: "鍩虹鏁版嵁", + i: "font icon-shouye", + c: [ + { + k: 23, + v: "宸ュ簭缁存姢", + i: "font icon-shouye", + u: "" + }, + { + k: 24, + v: "鑷缁存姢", + i: "font icon-shouye", + u: "" + }, + { + k: 25, + v: "鎶�鏈寚鏍囩淮鎶�", + i: "font icon-shouye", + u: "" + }, + { + k: 26, + v: "宸ヨ壓璺嚎缁存姢", + i: "font icon-shouye", + u: "" + }, + { + k: 27, + v: "璁惧缁存姢", + i: "font icon-shouye", + u: "" + }, + { + k: 28, + v: "鐗╂枡娓呭崟缁存姢", + i: "font icon-shouye", + u: "" + } + ] + } ], activeBox: 0, activeP: 0, @@ -445,11 +587,19 @@ this.activeBox = 0; } else if (num > 0 && num <= 2) { this.activeBox = 1; - } else if (num > 2 && num <= 10) { + } else if (num > 2 && num < 11) { this.activeBox = 2; } else if (num == 11) { this.activeBox = 3; - } + } else if (num > 11 && num <=14){ + this.activeBox = 4; + } else if (num>14 && num<=20){ + this.activeBox = 5 + } else if (num>20 && num<=22){ + this.activeBox = 6 + } else if (num>22 && num<=28){ + this.activeBox = 7 + } }, out() { sessionStorage.clear(); -- Gitblit v1.9.3