From 1094076235c6765ee0b527272d476df227d690ff Mon Sep 17 00:00:00 2001 From: zouyu <2723363702@qq.com> Date: 星期三, 01 十一月 2023 14:13:25 +0800 Subject: [PATCH] modified: src/api/quality/finishedProduct.js deleted: src/const/crud/quality/rawMaterial.js modified: src/views/quality/finishedProductInspection/finishedProductInspectionAdd.vue deleted: src/views/quality/finishedProductInspection/finishedProductInspectionLook.vue deleted: src/views/quality/finishedProductInspection/finishedProductInspectionUp.vue modified: src/views/quality/finishedProductInspection/index.vue new file: src/views/quality/package/index.vue modified: src/views/quality/rawMaterial/rawMaterial-form.vue --- src/views/quality/finishedProductInspection/finishedProductInspectionAdd.vue | 383 ++++++++++++++++++++++++----------------------------- 1 files changed, 174 insertions(+), 209 deletions(-) diff --git a/src/views/quality/finishedProductInspection/finishedProductInspectionAdd.vue b/src/views/quality/finishedProductInspection/finishedProductInspectionAdd.vue index 3115e72..f3a7a4c 100644 --- a/src/views/quality/finishedProductInspection/finishedProductInspectionAdd.vue +++ b/src/views/quality/finishedProductInspection/finishedProductInspectionAdd.vue @@ -4,10 +4,10 @@ <div class="page-header"> <div class="header-left"> <a @click="$router.go(-1)"><i class="icon-btn-back"></i></a> - <h2>缂栬緫-浜у搧妫�楠�</h2> + <h2>缂栬緫-浜у搧妫�楠屽崟</h2> </div> <div class="btn-group header-right"> - <el-button @click="addTestProject">鐢熸垚妫�楠岄」鐩�</el-button> + <el-button @click="addTestProject" v-if="processInspectVo.id==null">鐢熸垚妫�楠岄」鐩�</el-button> </div> </div> <div class="page-main"> @@ -18,7 +18,8 @@ <el-row> <el-col :span="6"> <el-form-item label="璁㈠崟鍙凤細"> - <el-input @blur="selectInfoByOrderId" v-model="processInspectVo.orderNumber" placeholder="璇疯緭鍏ヨ鍗曞彿" autocomplete="off" /> + <el-input @blur="selectInfoByOrderId" :disabled="processInspectVo.id != null" + v-model="processInspectVo.orderNumber" placeholder="璇疯緭鍏ヨ鍗曞彿" autocomplete="off" /> </el-form-item> </el-col> <el-col :span="6"> @@ -43,7 +44,7 @@ <el-row> <el-col :span="6"> <el-form-item label="浜у搧鍚嶇О锛�"> - <el-select style="width: 100%" @change="changeOptionsSamplename" + <el-select style="width: 100%" @change="changeOptionsSamplename" :disabled="processInspectVo.id != null" v-model="processInspectVo.material" size="small" placeholder="璇烽�夋嫨浜у搧鍚嶇О"> <el-option v-for="(item,index) in optionsSamplename" :key="index" :label="item.material" :value="item.materialCode"> @@ -74,7 +75,7 @@ <el-col :span="6"> <el-form-item label="鏁伴噺锛�"> <el-input v-model="processInspectVo.quantity" placeholder="璇疯緭鍏ユ暟閲�" - autocomplete="off" /> + autocomplete="off" :disabled="processInspectVo.id != null" /> </el-form-item> </el-col> </el-row> @@ -82,91 +83,85 @@ </el-form> </div> <div class="finishedProduct-detail"> - <el-row style="width:100%;z-index: 10;height:50px;"> + <el-row style="width:100%;z-index: 10;height:30px;"> <el-col :span="12" class="inspectionProject_span">妫�楠岄」鐩�</el-col> <el-col :span="12" class="inspectionProject_span" style="text-align: right;"> - <el-button size="mini" @click="clickAddInspectionColumn()">娣诲姞妫�楠屽�煎垪</el-button> - <el-button size="mini" @click="clickDeleteInspectionColumn()">鍒犻櫎妫�楠屽�煎垪</el-button> + <el-button size="mini" @click="clickAddInspectionColumn()">娣诲姞妫�娴嬪�煎垪</el-button> + <el-button size="mini" @click="clickDeleteInspectionColumn()">鍒犻櫎妫�娴嬪�煎垪</el-button> </el-col> </el-row> <el-row style="width:100%;"> <el-col :span="24"> - <el-table border :data="inspectionItems" max-height="400" height="calc(100vh - 550px)" + <el-table border :data="inspectionItems" height="400" :header-cell-style="{textAlign:'center',color:'black',backgroundColor:'#fafafa'}" - :cell-style="{textAlign:'center'}" row-key="iid" + :cell-style="{textAlign:'center'}" row-key="iid" default-expand-all style="width: 100%" ref="table" :tree-props="{children: 'children', hasChildren: 'hasChildren'}"> <el-table-column type="index" label="搴忓彿" width="60"></el-table-column> - <el-table-column label="椤圭洰" prop="father"></el-table-column> - <el-table-column prop="iname" label="鎸囨爣"></el-table-column> - <el-table-column prop="iunit" label="鍗曚綅"></el-table-column> - <el-table-column prop="required" label="鏍囧噯鍊�"></el-table-column> + <el-table-column label="椤圭洰" prop="father" width="240" ></el-table-column> + <el-table-column prop="iname" label="鎸囨爣" width="240" ></el-table-column> + <el-table-column prop="iunit" label="鍗曚綅" width="240" ></el-table-column> + <el-table-column prop="required" label="鏍囧噯鍊�" width="240" ></el-table-column> <el-table-column prop="inspectionValue" v-for="(item, index) in empiricalValueAdd" :key="index" label="妫�娴嬪��" - min-width="100" style="text-align: center;"> + width="240" style="text-align: center;"> <template slot-scope="scope"> - <el-tooltip :disabled="scope.row.dname != null" class="item" effect="dark" content="璇峰厛閫夋嫨璁惧锛�" + <el-tooltip v-if="scope.row.iname!=null" :disabled="scope.row.eId != null" + class="item" effect="dark" content="璇峰厛閫夋嫨璁惧锛�" placement="top-start"> - <!-- <el-input :disabled="scope.row.dname === null" v-model="scope.row.empiricalValueAddss[index]" - @blur="changeState(scope.row, index)" placeholder="璇疯緭鍏ユ娴嬪��"></el-input> --> + <el-input :disabled="scope.row.eId == null" v-model="scope.row.empiricalValueAddss[index]" + @blur="changeState(scope.row, index)" placeholder="璇疯緭鍏ユ娴嬪��"></el-input> </el-tooltip> </template> </el-table-column> - <el-table-column prop="dname" label="璇曢獙璁惧" min-width="100"> + <el-table-column prop="deviceName" label="璇曢獙璁惧" min-width="250"> <template slot-scope="scope"> - <el-button v-if="!scope.row.isSelectDevice" type="text" @click="clickTableSelect(scope)">{{ - scope.row.dname == null ? "璇烽�夋嫨" : scope.row.dname - }}</el-button> - <el-select v-if="scope.row.isSelectDevice" style="width: 100%;" @change="clickNodeSure(scope.row)" v-model="filterText" placeholder="璇烽�夋嫨"> - <el-option v-for="item in materialOptions" :key="item.id" :label="item.device" :value="item.id"> - </el-option> + <el-select style="width:100%" v-model="scope.row.eId" + v-if="scope.row.iname != null" filterable @change="updateDevice(scope.row)"> + <el-option v-for="(item,index) in deviceList" + :key="index" :value="item.id" :label="item.number +'-'+ item.name"></el-option> </el-select> - </template> - </el-table-column> - <el-table-column prop="deviceName" label="璇曢獙璁惧" min-width="260"> - <template slot-scope="scope"> - <el-select style="width:100%" v-model="scope.row.equipmentId" filterable @change="updateDevice(scope.row)"> - <el-option v-for="(item,index) in deviceList" - :key="index" :value="item.id" :label="item.number +'-'+ item.name"></el-option> - </el-select> </template> </el-table-column> <el-table-column label="缁撹" fixed="right" min-width="100"> <template slot-scope="scope"> - <span style="color: #34BD66;" v-if="scope.row.result === 1">鍚堟牸</span> - <span style="color: #E84738;" v-else-if="scope.row.result === 0">涓嶅悎鏍�</span> - <span v-show="scope.row.result === null">鏆傛湭缁撹</span> + <div v-if="scope.row.iname!=null"> + <span style="color: #34BD66;" v-if="scope.row.iresult == 1">鍚堟牸</span> + <span style="color: #E84738;" v-else-if="scope.row.iresult == 0">涓嶅悎鏍�</span> + <span v-else>鏆傛棤缁撹</span> + </div> </template> </el-table-column> </el-table> </el-col> </el-row> </div> - <div class="finishedProduct-detail"> + <div class="finishedProduct-result"> <el-row style="width:100%"> <el-col :span="24">妫�娴嬬粨鏋�</el-col> </el-row> - <el-row style="width:100%;margin-top:-180px"> + <el-row style="width:100%;"> <el-col :span="24"> - <el-table border max-height="400" :data="inspectionResultForm" + <el-table border height="90" :data="inspectionResultForm" :header-cell-style="{textAlign:'center',color:'black',backgroundColor:'#fafafa'}" :cell-style="{textAlign:'center'}"> - <el-table-column prop="id" label="鐗╂枡缂栧彿"></el-table-column> - <el-table-column prop="name" label="鐗╂枡鍚嶇О"></el-table-column> - <el-table-column prop="inspecter" label="妫�楠屽憳"></el-table-column> - <el-table-column prop="conclusion" label="妫�楠岀粨璁�"></el-table-column> - <el-table-column prop="operation" label="涓婃姤"></el-table-column> + <el-table-column prop="materialCode" label="鐗╂枡缂栧彿"></el-table-column> + <el-table-column prop="material" label="鐗╂枡鍚嶇О"></el-table-column> + <el-table-column prop="userName" label="妫�楠屽憳"></el-table-column> + <el-table-column prop="result" label="妫�楠岀粨璁�"> + <template slot-scope="scope"> + <el-tag type="success" v-if="scope.row.result == 1">鍚堟牸</el-tag> + <el-tag type="danger" v-else-if="scope.row.result == 0">涓嶅悎鏍�</el-tag> + </template> + </el-table-column> + <el-table-column label="鎿嶄綔"> + <template> + <el-button type="text" @click="submitSave()" size="small">涓婃姤</el-button> + </template> + </el-table-column> </el-table> </el-col> </el-row> </div> </div> - <el-dialog title="璇烽�夋嫨璁惧" :visible.sync="centerDialogVisible" width="20%"> - <div class="div_device_dialog"> - <el-select style="width: 100%;" @change="clickNodeSure()" v-model="filterText" placeholder="璇烽�夋嫨"> - <el-option v-for="item in materialOptions" :key="item.id" :label="item.device" :value="item.id"> - </el-option> - </el-select> - </div> - </el-dialog> </div> </template> @@ -174,39 +169,22 @@ import { chooseMater, addFinish, - queryById, } from '@/api/quality/finishedProduct' -import { updateDeviceById,selectDevice } from '@/api/quality/rawMaterial' + queryById, + updateDeviceById, + updateFinishedInsProduct, + updateFinishedInspectById, + } from '@/api/quality/finishedProduct' +import { selectDevice } from '@/api/quality/rawMaterial' export default { data() { return { deviceList: [], hasChildren: true, - showUp: false, - isAddProject: false, - showLook: false, - detailId: 0, - rowInfp: {}, - search: { - countSize: 10, - pageSize: 1, - result: "", // 妫�娴嬬姸鎬� - name: "", // 浜у搧鍚嶇О - techfather: "" // 宸ュ簭 - }, optionsSamplename: [], - inspectionTable: [], - tableColumn: [], - optionSoptionSprocesses: [], - optionTechnology: [], - inspectionTableTotal: 0, - pageSize: 10, - currentPage: 1, - treeProject: [], // 娣诲姞鍒� empiricalValueAdd: 1, // 缂栬緫鏃跺瓨鍌ㄦ渶闀跨殑鍒楁暟瀛楋紝鍋氬垹闄ゅ垽鏂� empiricalValueAddMaxNumber: 0, - showAddPage: false, processInspectVo: { id: null, material: null, @@ -220,56 +198,9 @@ unit: null, technologyId: null }, - InspectioniD: null, - addInspectionform: [ - { - number: "", - username: "", - projectname: "", - tracenumber: "", - code: "", - class: "", - specificationmodel: "", - unit: "", - quantity: "", - group: "", - worker: "", - machine: "" - }] - , inspectionItems: [], // 鏂板妫�楠岄」鐩〃鏍� - inspectionResultForm: [ - { - id: "", - name: "", - inspecter: "", - conclusion: "", - operation: "" - } - ], - options: [], - value: "", - rowList: [], - spanArr: [], - position: 0, - // 璁惧閫夋嫨鏍戞樉绀� - centerDialogVisible: false, - filterText: "", - materialOptions: [], - defaultProps: { - // 璁惧鏍戞暟鎹缃� - children: "children", - label: "name" - }, - nodeData: { - id: 0, - name: null - }, // node鐐瑰嚮淇濆瓨褰撳墠鐐瑰嚮鏁版嵁 - clickSelectDevice: { - index: null, // 鐐瑰嚮閫夋嫨瀛樺偍褰撳墠琛岀储寮� - rpId: null // 鐐瑰嚮閫夋嫨瀛樺偍褰撳墠琛岄」鐩甀d - } - }; + inspectionResultForm: [], + } }, watch: { }, @@ -282,20 +213,101 @@ }, mounted() { this.getDeviceList() + this.processInspectVo.id = this.$route.query.id + this.init() }, methods: { + submitSave(){ + let pro = 0 + this.inspectionItems.forEach(item => { + if(item.children){ + let arr = item.children.filter(obj=>{ + return obj.iresult == 0; + }) + console.log("aaa--",arr,arr.length) + pro+=arr.length + } + }) + if (pro > 0) { + this.$prompt('璇疯緭鍏ヤ笉鍚堟牸鏁伴噺', '涓嶅悎鏍兼暟閲�', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + inputPattern: /^\d+$/, + inputErrorMessage: '璇疯緭鍏ユ纭暟瀛楁牸寮�' + }).then(({ value }) => { + let data = { + id: this.processInspectVo.id, + number: value + } + updateFinishedInspectById(data).then(res => { + this.$message.success("涓婃姤鎴愬姛"); + }); + }).catch(() => {}); + }else{ + updateFinishedInspectById({id:this.processInspectVo.id,number:0}).then(res => { + this.$message.success("涓婃姤鎴愬姛"); + }); + } + this.init() + }, + init(){ + let id = this.processInspectVo.id + if(id != null){ + queryById(id).then(res=>{ + let result = res.data.data + this.processInspectVo.orderNumber = result.orderNumber + this.processInspectVo.mcode = result.materialCode + this.processInspectVo.prname = result.customerName + this.processInspectVo.sname = result.projectName + this.processInspectVo.material = result.material + this.processInspectVo.specificationsModel = result.specs + this.processInspectVo.unit = result.punit + this.processInspectVo.quantity = result.quantity + let resultVal = 1 + let userList = [] + result.children.forEach(item=>{ + item.iid = Math.random() + if(item.children != undefined){ + item.children.forEach(obj=>{ + let arr = [] + if(obj.userName){ + userList.push(obj.userName) + } + if(obj.inspectionValue){ + arr = obj.inspectionValue.split(",") + } + if(obj.iresult && obj.iresult == 0){ + resultVal = 0 + } + obj.empiricalValueAddss = arr + if(arr.length > this.empiricalValueAdd){ + this.empiricalValueAdd = arr.length + } + }) + } + }) + this.inspectionItems = result.children + this.inspectionResultForm = [{ + materialCode: result.materialCode, + material: result.material, + userName: Array.from(new Set(userList)).join(","), + result: resultVal, + }] + }).catch(error=>{ + console.log(error) + }) + } + }, getDeviceList(){ selectDevice(null).then(res=>{ - this.deviceList = res.data.data + this.deviceList = res.data.data }) }, updateDevice(row){ - if(this.dataForm.id != null){ - updateDeviceById({equiomentId:row.equipmentId,rpId:row.rpId}).then(res=>{ + updateDeviceById({equiomentId:row.eId,fpid:row.iId}).then(res=>{ }).catch(error=>{ console.log(error) }) - } }, changeOptionsSamplename(val) { let sample = this.optionsSamplename.filter(o => { @@ -307,65 +319,29 @@ this.processInspectVo.specificationsModel = sample.specs this.processInspectVo.unit = sample.unit }, - handleClick(row) { - this.rowInfp = row - this.showLook = true - }, - updateInsInfo(row) { - this.rowInfp = row - this.showUp = true - }, - searchPro() { - this.search.countSize = this.pageSize - this.search.pageSize = this.currentPage - this.defaultInitializationTable() - }, - // 鐐瑰嚮琛ㄦ牸閫夋嫨瑙﹀彂 - clickTableSelect(scope) { - if(this.clickSelectDevice.index!=null){ - this.$set(this.inspectionItems[this.clickSelectDevice.index],'isSelectDevice',false) - } - this.clickSelectDevice.index = scope.$index; - this.clickSelectDevice.rpId = scope.row.id; - this.getOptions(scope.row); - }, changeState(row, index) { - if (row.did != null && row.did != '') { - // let val = row.empiricalValueAddss.filter(item => { - // return item != '' && item != null - // }) - // let eq = val.filter(item => { - // return /^[^><=]/.test(item) - // }) - // if (eq.length > 0) { - // this.$message({ - // message: "妫�娴嬪�糩" + eq + "]鏍煎紡棣栦綅搴斿寘鍚�>,<鎴栬��=", - // type: 'warning' - // }); - // return - // } + if (row.iid != null && row.iid != '') { let str = "" row.empiricalValueAddss.forEach(e => { str += e + "," }) - if (str.slice(0, -1) === '' || str.slice(0, -1) === null || str.slice(0, -1) === undefined) { + str = str.slice(0,-1); + if (str === undefined || str === '' || str === null ) { return } - this.$axios.post(this.$api.url.inspectionItemlose_focus_update, { - deviceId: row.did, - inspectionItemId: row.id, - inspectionValue: str.slice(0, -1) - }, { - headers: { "Content-Type": "application/json" } - }).then(res => { - row.result = res.data.result - row.username = res.data.username + let obj = { + equiomentId: row.eId, + fpid: row.iid, + inspectionValue: str + } + updateFinishedInsProduct(obj).then(res=>{ + if(res.data.code == 0){ + this.$message.success("鏇存柊鎴愬姛") + }else{ + this.$message.error("鏇存柊澶辫触") + } + this.init() }) - } else { - this.$message({ - message: '璇烽�夋嫨鎷╄澶囷紒', - type: 'warning' - }); } }, addTestProject() { @@ -388,6 +364,11 @@ let proList = response.data.data.children proList.forEach(item=>{ item.iid = Math.random(); + if(item.children != undefined){ + item.children.forEach(obj=>{ + obj.empiricalValueAddss = [] + }) + } }) this.inspectionItems = proList }).catch(error=>{ @@ -421,34 +402,6 @@ } }) }, - // 琛ㄦ牸鍒濆鍖栨帴鍙� - defaultInitializationTable() { - // this.$axios - // .post(this.$api.url.selectProcessInspectsList, this.search) - // .then(res => { - // this.inspectionTableTotal = res.data.total; - // this.inspectionTable = res.data.row; - // }); - }, - // 娣诲姞琛� - clickAddLine() { - let obj = { - material: "", - materialCode: "", - orderNumber: "", - quantity: 0, - specificationsModel: "", - techfather: "", - techname: "", - technologyId: 0, - unit: "" - }; - this.inspectionItems.push(obj); - }, - // 鍒犻櫎琛� - clickDeleteline(scope) { - this.inspectionItems.splice(scope.$index, 1); - }, // 鍒犻櫎妫�楠屽�煎垪 clickDeleteInspectionColumn() { if (this.empiricalValueAdd - 1 === 0) { @@ -456,7 +409,7 @@ if (this.empiricalValueAddMaxNumber != this.empiricalValueAdd - 1) { this.empiricalValueAdd = this.empiricalValueAdd - 1; this.inspectionItems.forEach(i => { - i.testValueList.splice(this.empiricalValueAdd, 1); + i.empiricalValueAddss.splice(this.empiricalValueAdd, 1); }); } } @@ -472,7 +425,19 @@ <style scoped> .finishedProduct-detail { width: 100%; - height: 460px; + height: 470px; + padding: 10px 20px; + display: flex; + border: 1px solid #ddd; + background-color: #fff; + margin-top: 10px; + box-sizing: border-box; + flex-wrap: wrap; +} + +.finishedProduct-result { + width: 100%; + height: 150px; padding: 10px 20px; display: flex; border: 1px solid #ddd; -- Gitblit v1.9.3