| | |
| | | </el-form> |
| | | </div> |
| | | <div class="packageInspect-detail"> |
| | | <el-row :gutter="10" style="width:100%;z-index: 10;height:50px;"> |
| | | <el-col :span="20">检验项目</el-col> |
| | | <el-col :span="2"> |
| | | <el-button v-if="resultVal=='' || resultVal==null" style="width:100%" size="small" @click="clickAddLine()">添加检验项目</el-button> |
| | | </el-col> |
| | | <el-col :span="2"> |
| | | <el-button v-if="resultVal=='' || resultVal==null" style="width:100%" type="primary" size="small" |
| | | <el-row :gutter="10" style="width:100%;z-index: 10;height:30px;"> |
| | | <el-col :span="12">检验项目</el-col> |
| | | <el-col :span="12" style="text-align: right;"> |
| | | <el-dropdown @command="handleCommand" v-if="isShow"> |
| | | <el-button size="mini" style="margin-right: 10px;" type="primary" > |
| | | 切换检验项模板<i class="el-icon-arrow-down el-icon--right"></i> |
| | | </el-button> |
| | | <el-dropdown-menu slot="dropdown"> |
| | | <el-dropdown-item :key="index" v-for="(item,index) in inspectMoulds" :command="item.father">{{item.father}}</el-dropdown-item> |
| | | </el-dropdown-menu> |
| | | </el-dropdown> |
| | | <el-button v-if="resultVal=='' || resultVal==null" size="mini" @click="clickAddLine()">添加检验项目</el-button> |
| | | <el-button v-if="resultVal=='' || resultVal==null" type="primary" size="mini" |
| | | @click="savePackIns()">保存</el-button> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | row-key="randomId" class="l-mes" |
| | | default-expand-all |
| | | :tree-props="{children: 'children', hasChildren: 'hasChildren'}"> |
| | | <el-table-column type="index" label="序号" width="60"> |
| | | <el-table-column type="index" prop="parentIndex" label="序号" width="60"> |
| | | <template scope="scope"> |
| | | <span v-if="scope.row.isIndex">{{scope.row.parentIndex}}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="name" label="项目" width="260"> |
| | | <el-table-column prop="name" label="项目" width="160"> |
| | | <template slot-scope="scope"> |
| | | <el-input :readonly="resultVal!=null" v-if="scope.row.children" class="inline-input" style="width:90%;" v-model="scope.row.name" |
| | | <el-input :readonly="resultVal!=null || !scope.row.isEdit" v-if="scope.row.children" class="inline-input" style="width:80%;" v-model="scope.row.name" |
| | | placeholder="请输入项目名称"></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="required" label="要求" width="260"> |
| | | <el-table-column prop="required" label="要求" width="160"> |
| | | <template slot-scope="scope"> |
| | | <div v-if="!scope.row.children"> |
| | | <el-input :readonly="resultVal!=null" v-model="scope.row.required" |
| | | placeholder="请输入要求"></el-input> |
| | | <el-tooltip :content="scope.row.required"> |
| | | <el-input :readonly="resultVal!=null || !scope.row.isEdit" |
| | | v-model="scope.row.required" |
| | | placeholder="请输入要求"></el-input> |
| | | </el-tooltip> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="note" label="检验描述" width="260" > |
| | | <el-table-column prop="note" label="检验描述" width="160"> |
| | | <template slot-scope="scope"> |
| | | <div v-if="!scope.row.children"> |
| | | <el-input :readonly="resultVal!=null" v-model="scope.row.note" placeholder="检验描述"></el-input> |
| | |
| | | <el-select style="width:100%" :disabled="resultVal!=null" @change="changeResult" v-model="scope.row.result" v-if="!scope.row.children"> |
| | | <el-option label="合格" value="合格"></el-option> |
| | | <el-option label="不合格" value="不合格"></el-option> |
| | | <el-option label="不适用" value="不适用"></el-option> |
| | | </el-select> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column v-if="resultVal=='' || resultVal==null" fixed="right" style="background-color: white;" label="操作" width="200"> |
| | | <template slot-scope="scope"> |
| | | <el-button v-if="scope.row.children" icon="el-icon-circle-plus-outline" type="text" @click="clickAddChildren(scope.row,scope.$index)">添加行</el-button> |
| | | <el-button v-if="!scope.row.children" icon="el-icon-circle-close" type="text" |
| | | <el-button v-if="scope.row.children && scope.row.isEdit" icon="el-icon-circle-plus-outline" type="text" @click="clickAddChildren(scope.row,scope.$index)">添加行</el-button> |
| | | <el-button v-if="!scope.row.children && scope.row.isEdit" icon="el-icon-circle-close" type="text" |
| | | @click="clickDelLine(scope.row,scope.$index,scope.row.children!=null)">取消</el-button> |
| | | <el-button v-if="scope.row.children" icon="el-icon-circle-close" type="text" |
| | | <el-button v-if="scope.row.children && scope.row.isEdit" icon="el-icon-circle-close" type="text" |
| | | @click="clickDelLine(scope.row,scope.$index,scope.row.children!=null)">删除项目</el-button> |
| | | |
| | | </template> |
| | |
| | | <el-table class="l-mes" border height="90" :data="conclusionTable" ref="conclusion" v-model="conclusion" |
| | | :header-cell-style="{textAlign:'center',color:'black',backgroundColor:'#fafafa'}" |
| | | :cell-style="{textAlign:'center'}"> |
| | | <el-table-column prop="packageNo" label="包装编号"></el-table-column> |
| | | <el-table-column prop="userName" label="检验员"></el-table-column> |
| | | <el-table-column prop="packageNo" label="包装编号" width="200" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="userName" label="检验员" width="200" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="result" label="检验结论"> |
| | | <template slot-scope="scope"> |
| | | <el-select :disabled="resultVal!=null" style="width:100%" v-model="scope.row.result"> |
| | |
| | | </el-row> |
| | | </div> |
| | | </div> |
| | | <el-dialog |
| | | title="提示" |
| | | :visible.sync="dialogVisible" |
| | | width="30%"> |
| | | <el-form :model="submitData" ref="form" label-width="100px" > |
| | | <el-form-item label="请输入行号" prop="lineNo" :rules="{required:true,message:'行号不能为空',trigger:'blur'}"> |
| | | <el-input v-model="submitData.lineNo" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="dialogVisible = false">取 消</el-button> |
| | | <el-button type="primary" @click="confirmSubmit(submitData,false)">确 定</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | updatePackageInspectById, |
| | | getCustomer, |
| | | } from '@/api/quality/packageInspect' |
| | | import {getAllTemplateByEnable} from '@/api/quality/packageInspectTemp' |
| | | export default { |
| | | computed:{}, |
| | | computed:{ |
| | | }, |
| | | components:{ |
| | | }, |
| | | data(){ |
| | | return{ |
| | | inspectMoulds: [], |
| | | isShow: true, |
| | | submitData: { |
| | | id:null, |
| | | result: null, |
| | | lineNo: null, |
| | | }, |
| | | dialogVisible: false, |
| | | loading: false, |
| | | resultVal: null, |
| | | dataForm:{ |
| | |
| | | this.resultVal=val |
| | | } |
| | | } |
| | | this.getAllInspect() |
| | | this.init() |
| | | |
| | | }, |
| | | watch:{ |
| | | dialogVisible(newVal){ |
| | | if(!newVal){ |
| | | this.$refs.form.resetFields(); |
| | | } |
| | | } |
| | | }, |
| | | methods:{ |
| | | checkShowState(){ |
| | | let num = 0 |
| | | this.list.forEach(ele=>{ |
| | | if(ele.children){ |
| | | ele.children.forEach(c=>{ |
| | | if(c.pid){ |
| | | num+=1 |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | this.isShow = num==0 |
| | | }, |
| | | getAllInspect(){ |
| | | getAllTemplateByEnable().then(res=>{ |
| | | if(res.status===200){ |
| | | this.inspectMoulds = res.data.data |
| | | } |
| | | }).catch(error=>{ |
| | | console.error(error) |
| | | }) |
| | | }, |
| | | handleCommand(command) { |
| | | this.inspectMoulds.forEach(ele=>{ |
| | | if(ele.father==command){ |
| | | this.init(ele.children) |
| | | } |
| | | }) |
| | | }, |
| | | changeResult(){ |
| | | let result = '' |
| | | let data = this.list |
| | | let passNum = 0 |
| | | let unPassNum = 0 |
| | | if(data){ |
| | | result='合格' |
| | | data.forEach(item=>{ |
| | | if(item.children){ |
| | | item.children.forEach(ele=>{ |
| | | if(ele.result=='不合格'){ |
| | | result='不合格' |
| | | unPassNum+=1 |
| | | } |
| | | if(ele.result=='合格'){ |
| | | passNum+=1 |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | result = (passNum+unPassNum)>0 ? unPassNum>0 ? '不合格' :'合格' : '' |
| | | this.conclusionTable[0].result = result |
| | | }, |
| | | //上报 |
| | |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | this.checkCustomer(_than.dataForm.id) |
| | | }).catch(() => {}) |
| | | }, |
| | | checkCustomer(id){ |
| | | const _than = this |
| | | if(id){ |
| | | getCustomer(id).then(res=>{ |
| | | _than.submitData.id = _than.dataForm.id, |
| | | _than.submitData.result = _than.conclusionTable[0].result, |
| | | getCustomer(_than.dataForm.id).then(res=>{ |
| | | if(res.status===200){ |
| | | console.log(res.data); |
| | | _than.confirmSubmit(_than.submitData,true) |
| | | } |
| | | }).catch(error=>{ |
| | | this.$prompt('请输入行号', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | inputPattern: /\S/, |
| | | inputErrorMessage: '行号不能为空' |
| | | }).then(({ value }) => { |
| | | let data = { |
| | | id: _than.dataForm.id, |
| | | result: _than.conclusionTable[0].result, |
| | | lineNo: value |
| | | } |
| | | updatePackageInspectById(data).then(res => { |
| | | if(res.data.code === 0){ |
| | | _than.resultVal = res.data.data |
| | | sessionStorage.setItem("packIns-resultVal-"+_than.dataForm.id,res.data.data) |
| | | _than.$message.success("上报成功"); |
| | | }else{ |
| | | _than.$message.error("上报失败",res.data.data); |
| | | } |
| | | }) |
| | | }).catch(() => { |
| | | }) |
| | | _than.dialogVisible = true |
| | | }) |
| | | |
| | | }).catch(() => {}) |
| | | }, |
| | | confirmSubmit(data,isOtc){ |
| | | const _than = this |
| | | let isSubmit = false |
| | | if(isOtc){ |
| | | isSubmit = true |
| | | }else{ |
| | | _than.$refs.form.validate(valid=>{ |
| | | if(valid){ |
| | | isSubmit = true |
| | | _than.dialogVisible = false |
| | | } |
| | | }) |
| | | } |
| | | if(isSubmit){ |
| | | updatePackageInspectById(data).then(res => { |
| | | if(res.data.code === 0){ |
| | | _than.resultVal = res.data.data |
| | | sessionStorage.setItem("packIns-resultVal-"+_than.dataForm.id,res.data.data) |
| | | _than.$message.success("上报成功"); |
| | | }else{ |
| | | _than.$message.error("上报失败",res.data.data); |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | |
| | | clickAddLine() { |
| | | this.list.push({ |
| | | name: '', |
| | | isIndex : true, |
| | | parentIndex : this.list.length + 1, |
| | | randomId: Math.random(), |
| | | isEdit: true, |
| | | children: [{ |
| | | name: '', |
| | | note: '', |
| | | required: '', |
| | | result: '', |
| | | randomId: Math.random(), |
| | | isEdit: true, |
| | | }] |
| | | }) |
| | | }, |
| | |
| | | required: '', |
| | | result: '', |
| | | randomId: Math.random(), |
| | | isEdit: true, |
| | | }) |
| | | }, |
| | | // 删除行 |
| | |
| | | }) |
| | | this.list[i].children.splice(childrenIndex,1) |
| | | } |
| | | this.changeResult() |
| | | }, |
| | | //保存检查项 |
| | | savePackIns(){ |
| | |
| | | updatePackageInsProduct(dataList).then(res=>{ |
| | | if(res.status===200){ |
| | | this.$message.success("保存成功") |
| | | this.init() |
| | | } |
| | | }).catch(error=>{ |
| | | console.log(error); |
| | |
| | | }) |
| | | } |
| | | }, |
| | | init(){ |
| | | if(this.dataForm.id){ |
| | | fetchListById(this.dataForm.id).then(res=>{ |
| | | init(dataList){ |
| | | const _than = this |
| | | if(_than.dataForm.id){ |
| | | fetchListById(_than.dataForm.id).then(res=>{ |
| | | let data = res.data.data |
| | | this.dataForm.packInsNo = data.packInsNo |
| | | this.dataForm.packageNo = data.packageNo |
| | | this.dataForm.contractNo = data.contractNo |
| | | this.dataForm.customerName = data.customerName |
| | | this.dataForm.projectName = data.projectName |
| | | this.dataForm.createTime = data.createTime |
| | | this.dataForm.createUser = data.createUser |
| | | this.list = [] |
| | | _than.dataForm.packInsNo = data.packInsNo |
| | | _than.dataForm.packageNo = data.packageNo |
| | | _than.dataForm.contractNo = data.contractNo |
| | | _than.dataForm.customerName = data.customerName |
| | | _than.dataForm.projectName = data.projectName |
| | | _than.dataForm.createTime = data.createTime |
| | | _than.dataForm.createUser = data.createUser |
| | | _than.list = [] |
| | | let userNameList = [] |
| | | data.packageInsProductS.forEach(item => { |
| | | if(dataList){ |
| | | let tempList = [] |
| | | dataList.forEach((ele,index)=>{ |
| | | let obj = { |
| | | randomId: Math.random(), |
| | | name: ele.inspectName, |
| | | isIndex: true, |
| | | parentIndex: index+1, |
| | | children: [] |
| | | } |
| | | if(ele.children){ |
| | | ele.children.forEach(e=>{ |
| | | obj.children.push({ |
| | | required: e.inspectRequired, |
| | | randomId: Math.random(), |
| | | isEdit: false, |
| | | note: '', |
| | | result: '' |
| | | }) |
| | | }) |
| | | } |
| | | tempList.push(obj) |
| | | }) |
| | | _than.list = tempList |
| | | } |
| | | data.packageInsProductS.forEach((item,index) => { |
| | | if (item.children) { |
| | | let ele = { |
| | | isIndex: true, |
| | | parentIndex: index+1, |
| | | isEdit: true, |
| | | randomId: Math.random(), |
| | | name: null, |
| | | children: [] |
| | |
| | | let o = { |
| | | name: item.name, |
| | | randomId: Math.random(), |
| | | isEdit: true, |
| | | required: obj.required, |
| | | pid: obj.pid, |
| | | note: obj.note?obj.note:'', |
| | |
| | | } |
| | | ele.children.push(o) |
| | | }) |
| | | this.list.push(ele) |
| | | _than.list.push(ele) |
| | | } |
| | | }) |
| | | this.conclusionTable = [{ |
| | | |
| | | _than.conclusionTable = [{ |
| | | packageNo: data.packageNo, |
| | | userName: Array.from(new Set(userNameList)).join(','), |
| | | result: null |
| | | }] |
| | | this.$nextTick(()=>{ |
| | | if(this.list.length>0){ |
| | | this.changeResult() |
| | | _than.$nextTick(()=>{ |
| | | if(_than.list.length>0){ |
| | | _than.changeResult() |
| | | _than.checkShowState() |
| | | } |
| | | }) |
| | | }).catch(error=>{ |
| | | this.$message.error("获取失败",error) |
| | | _than.$message.error("获取失败",error) |
| | | }) |
| | | }else{ |
| | | this.conclusionTable = [] |
| | | _than.conclusionTable = [] |
| | | } |
| | | }, |
| | | }, |