| | |
| | | <el-form v-model="detailInfo" label-position="right" label-width="120px" > |
| | | <el-row> |
| | | <el-col :span="7"> |
| | | <el-form-item label="来料日期:"> |
| | | <el-input v-if="detailId!==null" :disabled="detailId!==null" v-model="detailInfo.formTime"></el-input> |
| | | <el-date-picker |
| | | v-else |
| | | type="date" |
| | | v-model="detailInfo.formTime" |
| | | placeholder="选择日期"> |
| | | </el-date-picker> |
| | | <el-form-item label="原材料名称:"> |
| | | <el-input v-if="detailId!==null" :disabled="detailId!==null" v-model="detailInfo.name"></el-input> |
| | | <el-select @change="checkRawName" v-else placeholder="请选择项目名称" v-model="detailInfo.name"> |
| | | <el-option v-for="item in materialOptions" :key="item.id" :label="item.name" :value="item.name"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | |
| | | </el-col> |
| | | <el-col :span="7"> |
| | | <el-form-item label="规格型号:"> |
| | | <el-input :disabled="detailId!==null" v-model="detailInfo.specifications"></el-input> |
| | | <el-input v-if="detailId!==null" :disabled="detailId!==null" v-model="detailInfo.specifications"></el-input> |
| | | <el-cascader |
| | | placeholder="请选择规格型号" |
| | | v-else |
| | | :disabled="specificationOptions.length===0" |
| | | :props="{label:'name',value:'name'}" |
| | | v-model="detailInfo.specificationsArr" |
| | | :options="specificationOptions" |
| | | ></el-cascader> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="7"> |
| | | <el-form-item label="原材料编码:"> |
| | | <el-input :disabled="detailId!==null" v-model="detailInfo.code"></el-input> |
| | | <el-input disabled v-model="detailInfo.code"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="7"> |
| | | <el-form-item label="原材料名称:"> |
| | | <el-input :disabled="detailId!==null" v-model="detailInfo.name"></el-input> |
| | | <el-form-item label="来料日期:"> |
| | | <el-input v-if="detailId!==null" :disabled="detailId!==null" v-model="detailInfo.formTime"></el-input> |
| | | <el-date-picker |
| | | v-else |
| | | type="date" |
| | | value-format="yyyy-MM-dd" |
| | | v-model="detailInfo.formTime" |
| | | placeholder="选择日期"> |
| | | </el-date-picker> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="7"> |
| | |
| | | label="检验员" |
| | | width="542"> |
| | | <template slot-scope="scope"> |
| | | <span v-for="item in scope.row.names" :key="item.username" :style="{marginRight:'8px'}">{{item}}</span> |
| | | <span v-for="item in scope.row.names" :key="item&&item.userName" :style="{marginRight:'8px'}">{{item}}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | |
| | | conclusion.name = this.detailInfo.name |
| | | conclusion.code = this.detailInfo.code |
| | | conclusion.names= [...new Set(this.projectTable.map(item=>item.userName))] |
| | | console.log(this.projectTable.filter(item=>item.testState===0)) |
| | | if(this.projectTable.filter(item=>item.testState===null).length){ |
| | | console.log(conclusion,this.projectTable) |
| | | console.log(this.projectTable.filter(item=>item.testState===null).length) |
| | | if(this.projectTable.filter(item=>item.testState===null).length===this.projectTable.length){ |
| | | conclusion.testState = null |
| | | return [conclusion] |
| | | } |
| | |
| | | // 新建检验单参数对象 |
| | | rawInsParams:{}, |
| | | // 项目名称options |
| | | materialOptions:[] |
| | | materialOptions:[], |
| | | specificationOptions:[] |
| | | |
| | | } |
| | | }, |
| | | methods:{ |
| | |
| | | const {data} = await this.$axios.get(this.$api.url.selectRawInspectsListById+`${this.detailId}`,{params:{id:this.detailId}}) |
| | | this.detailInfo = data |
| | | this.projectTable = data.rawInsProducts |
| | | // console.log(this.projectTable) |
| | | console.log(data) |
| | | }, |
| | | // 新增检验单 |
| | | addNewRawInspect() { |
| | | console.log(this.detailInfo) |
| | | async addNewRawInspect() { |
| | | this.detailInfo.specifications = this.detailInfo.specificationsArr.join("-") |
| | | // const time = this.detailInfo.formTime |
| | | // this.detailInfo.formTime = `${time.getFullYear()}-${time.getMonth() + 1 < 10 ? '0' + (time.getMonth() + 1) : time.getMonth() + 1}-${time.getDate() < 10 ? '0' + time.getDate() : time.getDate()}` |
| | | const res = await this.$axios.post(this.$api.url.addRawInspects,{...this.detailInfo},{headers:{'Content-Type':'application/json'}}) |
| | | console.log(res) |
| | | this.detailId = res.data |
| | | this.getDetailInfo() |
| | | |
| | | this.$message.success('提交成功') |
| | | }, |
| | | // 修改项目的检测值改变结论 |
| | | async changeState(row){ |
| | |
| | | this.getDetailInfo() |
| | | }, |
| | | async getOptions() { |
| | | const {data} = await this.$axios.get(this.$api.url.listMaterial) |
| | | // const {data} = await this.$axios.get(this.$api.url.listMaterial) |
| | | // this.materialOptions = data |
| | | const {data} = await this.$axios.get(this.$api.url.selectRawMaterial) |
| | | this.materialOptions = data |
| | | console.log(this.materialOptions) |
| | | }, |
| | | checkRawName(data) { |
| | | console.log('选择原材料名称',data) |
| | | this.materialOptions.forEach(item=>{ |
| | | if(item.name===data){ |
| | | console.log(item.id) |
| | | this.detailInfo.code = item.code |
| | | this.$axios.get(this.$api.url.selectSpBySt,{params:{id:item.id}}).then(res=>{ |
| | | this.specificationOptions= res.data |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | } |