| | |
| | | </div> |
| | | <div style="margin-top: 10px"> |
| | | <el-table |
| | | ref="tableDataRef" |
| | | ref="multipleTable" |
| | | :data="JYTableData" |
| | | :height="(tableHeight-195)+'px'" |
| | | border |
| | |
| | | highlight-current-row |
| | | :header-cell-style="this.$headerCellStyle" |
| | | :cell-style="this.$cellStyle" |
| | | @selection-change="handleSelectionChange" |
| | | > |
| | | <el-table-column |
| | | type="index" |
| | |
| | | <!-- />--> |
| | | <el-table-column |
| | | prop="code" |
| | | label="检验项目名称(名称)" |
| | | label="检验项目编码(名称)" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <div v-if="row.isVisible===0" style="display: flex;"> |
| | |
| | | </el-table-column> |
| | | |
| | | <el-table-column |
| | | prop="reslut" |
| | | prop="result" |
| | | label="检验结果" |
| | | width="100" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <el-radio-group v-model="row.reslut" size="small" @change="a=>changeRadioValue(a,row)"> |
| | | <el-radio-button style="box-shadow: none" :label="0" @click.native.prevent="clickRadio(0,row)"> |
| | | 合格 |
| | | </el-radio-button> |
| | | <el-radio-button style="box-shadow: none" :label="1" @click.native.prevent="clickRadio(1,row)"> |
| | | 不良 |
| | | </el-radio-button> |
| | | </el-radio-group> |
| | | <div v-if="row.result==='OK'">合格</div> |
| | | <div v-if="row.result==='NG'">不良</div> |
| | | </template> |
| | | |
| | | <!-- <template slot-scope="{row}">--> |
| | | <!-- <el-radio-group--> |
| | | <!-- v-model="row.result"--> |
| | | <!-- size="small"--> |
| | | <!-- @change="a=>changeRadioValue(a,row)"--> |
| | | <!-- >--> |
| | | <!-- <el-radio--> |
| | | <!-- :label="0"--> |
| | | <!-- @change="clickRadio(0,row)"--> |
| | | <!-- >--> |
| | | <!-- 合格--> |
| | | <!-- </el-radio>--> |
| | | <!-- <el-radio--> |
| | | <!-- :label="1"--> |
| | | <!-- @change="clickRadio(1,row)"--> |
| | | <!-- >--> |
| | | <!-- 不良--> |
| | | <!-- </el-radio>--> |
| | | <!-- </el-radio-group>--> |
| | | <!-- </template>--> |
| | | |
| | | </el-table-column> |
| | | |
| | | <el-table-column |
| | | type="selection" |
| | | width="55" |
| | | /> |
| | | |
| | | <el-table-column |
| | | label="操作" |
| | |
| | | </div> |
| | | |
| | | <div style="display: flex;margin: 30px 0;align-items: center"> |
| | | <el-button type="primary">首检保存</el-button> |
| | | <el-button type="primary" style="margin-left: 50px">巡检保存</el-button> |
| | | <el-button type="primary" style="margin-left: 50px">完工检保存</el-button> |
| | | <el-button type="info" style="margin-left: 50px">取消</el-button> |
| | | <el-button type="primary" @click="submitButton('FirstCheck')">首检保存</el-button> |
| | | <el-button type="primary" style="margin-left: 50px" @click="submitButton('PatroCheck')">巡检保存</el-button> |
| | | <el-button type="primary" style="margin-left: 50px" @click="submitButton('EndCheck')">完工检保存</el-button> |
| | | <el-button type="info" style="margin-left: 50px" @click="submitButton('Cancel')">取消</el-button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | // const SER_HZ = /^[\u4e00-\u9fa5]+$/ |
| | | import $ from 'jquery' |
| | | import { |
| | | DeleteStepCheckStaned, |
| | | MesOrderStepCheckItemList, |
| | | MesOrderStepCheckSearch, |
| | | MesOrderStepCheckSelect, |
| | | MesOrderStepCheckSelect, SaveMesOrderStepCheckItem, |
| | | StepCheckItemSelect |
| | | } from '@/api/zlgl' |
| | | import { MesOrderSelectUser } from '@/api/scgl' |
| | |
| | | mainHeight: 0, |
| | | tableHeight: 0, |
| | | form: { // 工序 |
| | | orderstepqrcode: 'MO-2022-07-0001_1;001', // 扫描的二维码信息 |
| | | // MO-2022-07-0001_1;001 |
| | | orderstepqrcode: '', // 扫描的二维码信息 |
| | | wo_code: '', // 工单编码 |
| | | partcode: '', // 产品编码 |
| | | partname: '', // 产品名称 |
| | |
| | | |
| | | JYTableData: [], // 检验项信息表格 |
| | | JYSelectArr: [], // 检验下拉数组 |
| | | JYSelectedArr: [] // 已选检验项目数组 |
| | | // checkresultArr:[ |
| | | // {''} |
| | | // ] |
| | | JYSelectedArr: [], // 已选检验项目数组 |
| | | multipleSelection: []// 表格多选框 |
| | | } |
| | | }, |
| | | created() { |
| | |
| | | let number = Math.random() * Math.random()// 作为删除时的标识符 |
| | | number = number === 0 ? (10 + Math.random()) : number |
| | | |
| | | item.reslut = 0 // 0合格 1不良 |
| | | // item.result = 0 // 0合格 1不良 |
| | | item.result = 'NG' |
| | | |
| | | item.isVisible = 0 |
| | | item.number = number |
| | | this.JYSelectedArr.push(item.code) |
| | | }) |
| | | }, |
| | | changeRadioValue(val, row) { |
| | | console.log(val, row) |
| | | }, |
| | | clickRadio(e, row) { |
| | | console.log(e, row, 1) |
| | | row.reslut = row.reslut === 0 ? 1 : 0 |
| | | // this.JYTableData.forEach(item => { |
| | | // if (row.code === item.code) { |
| | | // item.reslut = row.reslut === 0 ? 1 : 0 |
| | | // } |
| | | // }) |
| | | // e === row.reslut ? row.reslut = null : row.reslut = e |
| | | // this.$nextTick(() => { |
| | | // row.reslut = row.reslut === 0 ? 1 : 0 |
| | | // }) |
| | | // |
| | | // this.$forceUpdate() |
| | | |
| | | // this.$refs.tableDataRef.toggleRowSelection(row, false) |
| | | }, |
| | | |
| | | reslutChange(val, row) { |
| | | |
| | | }, |
| | | xxxx(val) { |
| | | console.log(val) |
| | | }, |
| | | changeSelect(val, row) { |
| | | console.log(val, row) |
| | | }, |
| | | changSwitch(val, row) { |
| | | console.log(val) |
| | | // row.result = val |
| | | // this.JYTableData.forEach(item => { |
| | | // if (row.code === item.code) { |
| | | // item.reslut = val === 'NG' ? 'OK' : 'NG' |
| | | // } |
| | | // }) |
| | | |
| | | // row.reslut = !row.reslut |
| | | // this.handleValue(row) |
| | | }, |
| | | handleValue(row) { |
| | | this.JYTableData.forEach(item => { |
| | | if (item.code === row.code) { |
| | | item.reslut = item.reslut === 'OK' ? 'NG' : 'OK' |
| | | // changeRadioValue(val, row) { |
| | | // console.log(val, row.result, 20000) |
| | | // }, |
| | | // clickRadio(e, row) { |
| | | // console.log(e, row.result, 10000) |
| | | // row.result = e |
| | | // }, |
| | | handleSelectionChange(val) { |
| | | this.multipleSelection = val |
| | | const arr = this.multipleSelection.map(i => i.number) |
| | | this.JYTableData.forEach(it => { |
| | | if (arr.includes(it.number)) { |
| | | it.result = 'OK' |
| | | } else { |
| | | it.result = 'NG' |
| | | } |
| | | }) |
| | | if (this.multipleSelection.length > 0) { |
| | | if (this.multipleSelection.length === this.JYTableData.length) { |
| | | this.checkResult = 'OK' |
| | | } else { |
| | | this.checkResult = 'NG' |
| | | } |
| | | } else { |
| | | this.checkResult = '' |
| | | } |
| | | }, |
| | | // |
| | | // 检验项目编码(名称) |
| | | changeCode(val, row) { |
| | | row.stepcheckitem_desc = this.JYSelectArr.find(it => it.code === val).descr |
| | | row.name = this.JYSelectArr.find(it => it.code === val).name |
| | |
| | | |
| | | let number = Math.random() * Math.random()// 作为删除时的标识符 |
| | | number = number === 0 ? (10 + Math.random()) : number |
| | | const data = { code: '', name: '', stepcheckitem_desc: '', isVisible: 1, number } |
| | | const data = { result: 'NG', code: '', name: '', stepcheckitem_desc: '', isVisible: 1, number } |
| | | this.JYTableData.push(data) |
| | | }, |
| | | |
| | | // 确认 |
| | | confirm(row) { |
| | | if (row.code === '') { |
| | | return this.$message.info('检验标准编码(名称)不能为空!') |
| | | return this.$message.info('检验项目编码(名称)不能为空!') |
| | | } |
| | | |
| | | if (this.JYSelectedArr.find(item => item === row.code) !== undefined) { |
| | | return this.$message.info('检验标准编码(名称)不能重复!') |
| | | return this.$message.info('检验项目编码(名称)不能重复!') |
| | | } else { |
| | | this.JYSelectedArr.push(row.code) |
| | | } |
| | | |
| | | this.JYTableData.forEach((item, index) => { |
| | | if (item.number === row.number) { |
| | | item.isVisible = 0 |
| | | this.JYTableData.splice(index, 1, { |
| | | number: row.number, |
| | | code: row.code, |
| | | name: row.name, |
| | | isVisible: 0, |
| | | reslut: row.reslut, |
| | | stepcheckitem_desc: row.stepcheckitem_desc |
| | | }) |
| | | item.code = row.code |
| | | item.name = row.name |
| | | item.result = row.result |
| | | item.stepcheckitem_desc = row.stepcheckitem_desc |
| | | } |
| | | }) |
| | | |
| | | console.log(this.JYTableData) |
| | | if (this.multipleSelection.length > 0) { |
| | | if (this.multipleSelection.length === this.JYTableData.length) { |
| | | this.checkResult = 'OK' |
| | | } else { |
| | | this.checkResult = 'NG' |
| | | } |
| | | } else { |
| | | this.checkResult = '' |
| | | } |
| | | }, |
| | | // 取消 |
| | | cancel(row) { |
| | |
| | | } |
| | | }) |
| | | }, |
| | | // 提交 |
| | | submitButton(val) { |
| | | console.log(val) |
| | | if (val !== 'Cancel') { |
| | | const text = val === 'FirstCheck' ? '首检保存' : (val === 'PatroCheck' ? '巡检保存' : '完工检保存') |
| | | this.$confirm('是否确认' + text + '?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | const arr = [] |
| | | this.JYTableData.forEach((item, index) => { |
| | | arr.push({ |
| | | code: item.code, |
| | | name: item.name, |
| | | seq: (index + 1), |
| | | descr: item.stepcheckitem_desc, |
| | | checkresult: item.result |
| | | }) |
| | | }) |
| | | const data = { |
| | | 'mesordercode': this.form.wo_code, // 工单编号 |
| | | 'partcode': this.form.partcode, // 产品编码 |
| | | 'stepcode': this.form.stepcode, // 工序编码 |
| | | 'checkstanedcode': this.checkStandard, // 检验标准编码 |
| | | 'checkusercode': this.checkUser, // 检验人员编码 |
| | | 'checktypecode': val, // 检验类型编码 |
| | | 'checkresult': this.checkResult, // 检验结果(OK(合格) NG(不良)) |
| | | 'checkdescr': this.checkdescr, // 检验描述 |
| | | 'data': arr |
| | | } |
| | | const res = SaveMesOrderStepCheckItem(data) |
| | | if (res.code === '200') { |
| | | this.$message.success(text + '成功!') |
| | | this.clearContent() |
| | | this.getFocus() |
| | | } |
| | | }).catch(() => { |
| | | this.$message.info('已取消保存') |
| | | }) |
| | | } else { |
| | | this.clearContent() |
| | | this.getFocus() |
| | | } |
| | | }, |
| | | // 清空页面内容 |
| | | clearContent() { |
| | | this.JYTableData = [] |
| | | this.multipleSelection = [] |
| | | this.checkdescr = '' |
| | | this.checkUser = '' |
| | | this.checkResult = '' |
| | | this.checkStandard = '' |
| | | this.form.orderstepqrcode = '' |
| | | this.form.wo_code = '' |
| | | this.form.partcode = '' |
| | | this.form.partname = '' |
| | | this.form.partspec = '' |
| | | this.form.stepcode = '' |
| | | this.form.stepname = '' |
| | | }, |
| | | // 获取页面高度 |
| | | getHeight() { |
| | | this.$nextTick(() => { |