From 6a64c08591da8dcddc48c7dd3c54db9a77831a22 Mon Sep 17 00:00:00 2001 From: 李林 <z1292839451@163.com> Date: 星期五, 18 八月 2023 11:54:11 +0800 Subject: [PATCH] 8.18改 --- src/components/view/record-content.vue | 236 ++++++++++++++++++++++++++ src/App.vue | 29 +++ src/view/index.vue | 50 +++-- src/assets/api/controller.js | 7 src/components/view/sale.vue | 187 +++++++++++++++----- 5 files changed, 438 insertions(+), 71 deletions(-) diff --git a/src/App.vue b/src/App.vue index 1783dc5..a5349ab 100644 --- a/src/App.vue +++ b/src/App.vue @@ -164,7 +164,7 @@ border: 0; } /* 鍏ㄥ眬妯℃�佹鏍峰紡 */ -.el-dialog__header { +.el-dialog__header,.el-message-box__header { box-sizing: border-box; height: 56px; border-bottom: 1px solid rgb(238, 238, 238); @@ -182,8 +182,24 @@ margin-left: 32px; margin-right: 8.5px; } + +.el-message-box__header::before { + content: ""; + display: inline-block; + width: 4px; + height: 30.24px; + background: rgb(0, 95, 201); + border-radius: 10px; + margin-left: 20px; + margin-right: 8.5px; +} + .el-dialog__header .el-dialog__title { font-size: 16px !important; +} + +.el-dialog__footer{ + padding-right: 40px; } .el-dialog__footer .el-button * { @@ -197,6 +213,17 @@ padding: 0 14px; } +.el-message-box__btns .el-button * { + font-size: 14px !important; +} + +.el-message-box__btns .el-button{ + height: 36px; + border: 1px solid rgba(190, 190, 190, 0.44); + box-shadow: 0px 2px 4px rgba(220, 220, 220, 0.41); + padding: 0 14px; +} + .el-button--primary { background: #004ea2; } diff --git a/src/assets/api/controller.js b/src/assets/api/controller.js index 60376ec..24911ea 100644 --- a/src/assets/api/controller.js +++ b/src/assets/api/controller.js @@ -48,8 +48,11 @@ ...finishedIns, selectSaleList: "sale/selectSaleList", //鏌ヨ閿�鍞崟鍒楄〃 selectSaleDatilById: "sale/selectSaleDatilById", //鏍规嵁閿�鍞崟id鏌ョ湅璇︽儏, - addSale: "sale/addSale", //鏂板閿�鍞崟, - seleRepe: "sale/seleRepe", //鏌ヨ鎴愬搧搴撳瓨 + addSale: "sale/addSale", //鏂板閿�鍞崟 + saleCheck: "sale/check", //瀹℃牳閿�鍞崟 + updateSaleById: "sale/updateSaleById", //鏍规嵁閿�鍞崟id淇敼璇︽儏淇℃伅 + delSale: "sale/delSale", //鏍规嵁閿�鍞崟id鍒犻櫎 + delAllSale: "sale/delAllSale", //鎵归噺鍒犻櫎閿�鍞崟 } diff --git a/src/components/view/record-content.vue b/src/components/view/record-content.vue new file mode 100644 index 0000000..88d9fb3 --- /dev/null +++ b/src/components/view/record-content.vue @@ -0,0 +1,236 @@ +<style scoped> + .title .el-button { + height: 32px; + border: 1px solid rgba(190, 190, 190, 0.44); + box-shadow: 0px 2px 4px rgba(220, 220, 220, 0.41); + padding: 0 12px; + } + + .title { + margin-bottom: 10px; + padding: 0 20px; + } + + .title * { + font-size: 16px; + } + + .choose { + padding: 21px 24px; + display: flex; + align-items: center; + background-color: #fff; + border-bottom: 3px solid rgb(245, 247, 251); + } + + .choose * { + font-size: 14px; + } + + .choose .el-button { + height: 32px; + border: 1px solid rgba(190, 190, 190, 0.44); + box-shadow: 0px 2px 4px rgba(220, 220, 220, 0.41); + padding: 0 12px; + } + + .thing { + width: calc(100% - 44px); + height: calc(100% - 42px - 82px - 66px); + background-color: #fff; + overflow: auto; + padding: 33px 22px; + } + + .table_do { + color: #004ea0; + cursor: pointer; + } +</style> +<style> + .record_content .title .el-button * { + font-size: 14px; + } + + .record_content .title .el-button--default { + color: #004EA2; + } + + .record_content .thing * { + font-size: 14px; + } + + .record_content .has-gutter .el-table__cell { + background-color: #F0F1F5 !important; + color: #333; + } + + .record_content .has-gutter .el-table__cell .cell { + font-size: 16px; + font-weight: 500; + } + + .record_content .cell { + color: #333; + padding-left: 17px !important; + } + + .record_content .el-table__body-wrapper { + height: 100%; + } + + .raw_ins .el-table__body { + height: 100%; + } +</style> + +<template> + <div class="record_content"> + <div class="title"> + <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" style="background: #004EA2;">鏂板</el-button> + <el-button icon="el-icon-edit-outline">淇敼</el-button> + <el-button icon="el-icon-delete">鍒犻櫎</el-button> + </el-col> + </el-row> + </div> + <div class="choose"> + <span>绫诲瀷锛�</span> + <el-select v-model="search.type" size="small" placeholder="璇烽�夋嫨" style="width: 224px;margin-right: 30px;"> + <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="3"></el-option> + </el-select> + <span>宸ュ簭锛�</span> + <el-select v-model="search.name" size="small" placeholder="璇烽�夋嫨" style="width: 224px;margin-right: 30px;"> + <el-option v-for="(a, ai) in process" key="ai" :label="a.name" :value="a.id"></el-option> + </el-select> + <el-button size="mini" @click="clean()"><span>閲� 缃�</span></el-button> + <el-button size="mini" type="primary" style="background: #004EA2;"><span>鏌� + 璇�</span></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 + :tree-props="{children: 'children', hasChildren: 'hasChildren'}" row-key="id"> + <el-table-column type="selection" width="50"> + </el-table-column> + <el-table-column type="index" label="搴忓彿" width="70"> + </el-table-column> + <el-table-column prop="name" label="宸ュ簭"> + <template slot-scope="scope"> + <span> + <font>{{scope.row.ids}}</font>{{scope.row.name}} + </span> + </template> + </el-table-column> + <el-table-column prop="address" label="澶囨敞"> + </el-table-column> + <el-table-column label="鎿嶄綔" width="130"> + <template slot-scope="scope"> + <span class="table_do">缂栬緫 </span> + <span class="table_do" @click="deleteRow(scope.$index, tableData)">鍒犻櫎</span> + </template> + </el-table-column> + </el-table> + </div> + </div> +</template> + +<script> + export default { + data() { + return { + search: { + type: 0, + name: null + }, + process: [], + tableData: [{ + id: 1, + date: '2016-05-02', + name: '鐜嬪皬铏�', + address: '涓婃捣甯傛櫘闄�鍖洪噾娌欐睙璺� 1518 寮�' + }, { + id: 2, + date: '2016-05-04', + name: '鐜嬪皬铏�', + address: '涓婃捣甯傛櫘闄�鍖洪噾娌欐睙璺� 1517 寮�' + }, { + id: 3, + date: '2016-05-01', + name: '鐜嬪皬铏�', + address: '涓婃捣甯傛櫘闄�鍖洪噾娌欐睙璺� 1519 寮�', + children: [{ + id: 31, + date: '2016-05-01', + name: '鐜嬪皬铏�', + address: '涓婃捣甯傛櫘闄�鍖洪噾娌欐睙璺� 1519 寮�', + children: [{ + id: 33, + date: '2016-05-01', + name: '鐜嬪皬铏�', + address: '涓婃捣甯傛櫘闄�鍖洪噾娌欐睙璺� 1519 寮�' + }, { + id: 34, + date: '2016-05-01', + name: '鐜嬪皬铏�', + address: '涓婃捣甯傛櫘闄�鍖洪噾娌欐睙璺� 1519 寮�' + }] + }, { + id: 32, + date: '2016-05-01', + name: '鐜嬪皬铏�', + address: '涓婃捣甯傛櫘闄�鍖洪噾娌欐睙璺� 1519 寮�' + }] + }, { + id: 4, + date: '2016-05-03', + name: '鐜嬪皬铏�', + address: '涓婃捣甯傛櫘闄�鍖洪噾娌欐睙璺� 1516 寮�' + }], + selects: [] + } + }, + mounted() { + this.selectDataList() + }, + methods: { + clean() { + this.search = { + type: null, + name: null + } + }, + selectDataList(){ + this.tableData.forEach(a=>{ + a.ids = '01' + if(a.children!=undefined){ + a.children.forEach(b=>{ + b.ids = '02' + if(b.children!=undefined){ + b.children.forEach(c=>{ + c.ids = '03' + }) + } + }) + } + }) + }, + handleSelectionChange(val) { + this.selects = val; + }, + del(ob) { + console.log(ob) + }, + deleteRow(index, rows) { + console.log(index); + console.log(rows); + rows.splice(index, 1); + } + } + } +</script> \ No newline at end of file diff --git a/src/components/view/sale.vue b/src/components/view/sale.vue index e46f70c..0df137d 100644 --- a/src/components/view/sale.vue +++ b/src/components/view/sale.vue @@ -116,8 +116,8 @@ <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="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-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> @@ -145,8 +145,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 +172,16 @@ <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" @click="openUpDia(scope.row.id)"> 缂栬緫 </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="800px"> + <el-dialog :title="`閿�鍞�${upDia==true?'淇敼':'鏂板'}`" :visible.sync="addDia" width="800px"> <div class="body"> <div class="head">鍩烘湰淇℃伅</div> <div class="content"> @@ -346,20 +347,18 @@ <el-table :data="addData.saleMaterialList" border style="width: 100%"> <el-table-column prop="name" label="浜у搧鍚嶇О" width="180"> <template slot-scope="scope"> - <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> + <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"> <template slot-scope="scope"> - <el-input v-model="scope.row.specifications" size="small" readonly></el-input> + <el-input v-model="scope.row.specifications" size="small" clearable placeholder="璇疯緭鍏ヨ鏍煎瀷鍙�"></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" readonly></el-input> + <el-input v-model="scope.row.unit" size="small" clearable placeholder="璇疯緭鍏�"></el-input> </template> </el-table-column> <el-table-column prop="number" label="鏁伴噺"> @@ -374,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> @@ -416,7 +421,8 @@ phone: null, saleMaterialList: [] }, - repeList: [] + repeList: [], + upDia: false } }, mounted() { @@ -424,7 +430,7 @@ }, methods: { handleSelectionChange(val) { - this.selects = val; + this.selects = val.id; }, handleSizeChange(val) { this.pageSize = val @@ -476,6 +482,20 @@ 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') { @@ -486,39 +506,19 @@ 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' } }).then(res => { - console.log(res); + this.$message.success('娣诲姞鎴愬姛') + this.addDia = false + this.selectRawInspectsList() }) }, openAddDia() { this.addDia = !(this.addDia) - this.$axios.post(this.$api.url.seleRepe).then(res => { - this.repeList = res.data - }) + this.upDia = false }, upRepe(index, i) { var data = this.repeList[index] @@ -528,6 +528,101 @@ 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() { + console.log(this.addData); + 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) { + if ((this.addData[a] == null || this.addData[a] == '') && 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(){ + console.log(this.selects); + this.axios.post(this.$api.url.delAllSale,{ + ids: this.selects + }, { + headers: { + 'Content-Type': 'application/json' + } + }).then(res=>{ + this.$message.success('鍒犻櫎鎴愬姛') + this.selectRawInspectsList() + }) } } } diff --git a/src/view/index.vue b/src/view/index.vue index 7da206b..e6a680e 100644 --- a/src/view/index.vue +++ b/src/view/index.vue @@ -320,6 +320,25 @@ ] }, { + k: 1, + v: "鎶�鏈鐞�", + i: "font icon-shouye", + c: [ + { + k: 1, + v: "鏍囧噯BOM", + i: "font icon-shouye", + u: "standard" + }, + { + k: 2, + v: "璁㈠崟BOM", + i: "font icon-shouye", + u: "technical" + } + ] + }, + { k: 4, v: "鐢熶骇绠$悊", i: "font icon-shouye", @@ -387,25 +406,6 @@ } ] }, - { - k: 1, - v: "鎶�鏈鐞�", - i: "font icon-shouye", - c: [ - { - k: 1, - v: "鏍囧噯BOM", - i: "font icon-shouye", - u: "standard" - }, - { - k: 2, - v: "鎶�鏈枃浠�", - i: "font icon-shouye", - u: "technical" - } - ] - }, { k: 2, v: "QMS绠$悊", @@ -499,13 +499,13 @@ c: [ { k: 23, - v: "宸ュ簭缁存姢", + v: "璁板綍鍐呭缁存姢", i: "font icon-shouye", - u: "" + u: "record-content" }, { k: 24, - v: "鑷缁存姢", + v: "鑷椤圭洰缁存姢", i: "font icon-shouye", u: "" }, @@ -532,6 +532,12 @@ v: "鐗╂枡娓呭崟缁存姢", i: "font icon-shouye", u: "" + }, + { + k: 29, + v: "宸℃椤圭洰缁存姢", + i: "font icon-shouye", + u: "" } ] } -- Gitblit v1.9.3