| | |
| | | <div class="top-bar"> |
| | | <el-form ref="form" :inline="true" :model="searchData"> |
| | | <el-form-item label="材料编码:" position="left" class="sermargin"> |
| | | <el-input v-model="searchData.code" class="input-form" placeholder="请输入"> |
| | | <el-input size="small" v-model="searchData.code" class="input-form" placeholder="请输入"> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="材料名称:" class="sermargin"> |
| | | <el-input v-model="searchData.name" class="input-form" placeholder="请输入"> |
| | | <el-input size="small" v-model="searchData.name" class="input-form" placeholder="请输入材料名称"> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="状态:" class="sermargin"> |
| | | <el-select v-model="searchData.state" placeholder="全部"> |
| | | <el-select size="small" v-model="searchData.state" placeholder="全部"> |
| | | <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="来料日期:" style="margin-right: 20px;"> |
| | | <el-input v-model="searchData.date" class="input-form" placeholder="请输入"> |
| | | </el-input> |
| | | <el-date-picker size="small" value-format="yyyy-MM-dd" v-model="searchData.date" class="input-form" placeholder="请选择来料日期"> |
| | | </el-date-picker> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="search">查询</el-button> |
| | | <el-button type="primary" plain @click="reset">重置</el-button> |
| | | <el-button type="primary" icon="el-icon-plus" @click="addReportVisible = true">新增</el-button> |
| | | <el-button size="small" type="primary" @click="search">查询</el-button> |
| | | <el-button size="small" type="primary" plain @click="reset">重置</el-button> |
| | | <el-button size="small" type="primary" icon="el-icon-plus" @click="addReportVisible = true">新增</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | |
| | | </el-form-item> |
| | | <el-form-item label="规格型号:" prop="specificationsNumber"> |
| | | <el-cascader v-model="insertData.specificationsNumber" :options="childrenOptions" |
| | | :props="{label: 'Name', value: 'Name'}" separator="-"></el-cascader> |
| | | :props="{label: 'Name', value: 'Id'}" separator="-"></el-cascader> |
| | | </el-form-item> |
| | | <el-form-item label="单位:" prop="unit"> |
| | | <el-input type="text" v-model="insertData.unit" /> |
| | | </el-form-item> |
| | | <el-form-item label="数量:" prop="num"> |
| | | <el-input type="number" v-model="insertData.num"/> |
| | | <el-input type="number" min="0" v-model="insertData.num"/> |
| | | </el-form-item> |
| | | </el-form> |
| | | <span slot="footer" class="dialog-footer"> |
| | |
| | | </div> |
| | | </div> |
| | | <div class="table-box"> |
| | | <el-table ref="inspectionTable" :max-height="600" :cell-style="{textAlign: 'center'}" |
| | | :header-cell-style="{border:'0px',background:'#f5f7fa',color:'#606266',boxShadow: 'inset 0 1px 0 #ebeef5',textAlign: 'center'}" |
| | | :data="inspectionTable" style="width: 100%" @selection-change="handleSelectionChange"> |
| | | <el-table ref="inspectionTable" :max-height="450" :cell-style="{textAlign: 'left'}" |
| | | :header-cell-style="{border:'0px',background:'#f5f7fa',color:'#606266',boxShadow: 'inset 0 1px 0 #ebeef5',textAlign: 'left'}" |
| | | :data="inspectionTable" style="width: 100%" @selection-change="handleSelectionChange" |
| | | :default-sort = "{prop: 'createTime', order: 'descending'}" |
| | | > |
| | | <el-table-column type="selection" :selectable="checkSelect" min-width="5%"></el-table-column> |
| | | <el-table-column type="index" label="序号" min-width="8%" /> |
| | | <el-table-column prop="dateSurvey" label="来料日期" min-width="8%" /> |
| | |
| | | <el-table-column prop="unit" label="单位" min-width="5%" /> |
| | | <el-table-column prop="quantity" label="数量" min-width="5%" /> |
| | | <el-table-column prop="inspectionDate" label="报检日期" min-width="8%" /> |
| | | <el-table-column v-if="1===0" prop="createTime" label="日期" min-width="8%" /> |
| | | <el-table-column prop="surveyor" label="检验人" min-width="8%" /> |
| | | <el-table-column prop="insTime" label="检验日期" min-width="8%" /> |
| | | <el-table-column prop="type" label="状态" min-width="8%"> |
| | | <template slot-scope="scope"> |
| | | <span :style="{ color: scope.row.type === 1 ? 'green' : 'red' }"> |
| | |
| | | getChooseVersion, |
| | | lookProByVer |
| | | } from '@/api/inspection/rawmaterial' |
| | | import ItemVue from '@/layout/components/Sidebar/Item.vue' |
| | | export default { |
| | | data() { |
| | | return { |
| | |
| | | mounted() { |
| | | this.getMaterielName(); |
| | | }, |
| | | watch:{ |
| | | addReportDialog(newVal){ |
| | | if(newVal === false){ |
| | | this.resetForm("addInspectionForm"); |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | handleChange() { |
| | | |
| | |
| | | } |
| | | }, |
| | | handleSelectionChange(val) { |
| | | if (val.length > 1) { |
| | | if (val.length > 1) { |
| | | let data = val.pop(); |
| | | this.$refs.inspectionTable.clearSelection(); |
| | | this.$refs.inspectionTable.toggleRowSelection(val.pop()) |
| | | this.$refs.inspectionTable.toggleRowSelection(data); |
| | | this.checkData = new Array(data); |
| | | }else{ |
| | | this.checkData = val; |
| | | } |
| | | this.checkData = val; |
| | | }, |
| | | //生成报检单按钮 |
| | | addReportBtn() { |
| | |
| | | if (this.checkData.length > 1) { |
| | | this.$message.error("最多选择一条数据!"); |
| | | } else { |
| | | let mcode = this.checkData[0].materialCoding; |
| | | let name = this.checkData[0].materialName; |
| | | let specifications = this.checkData[0].specificationsModels; |
| | | this.getChooseVersionFun(mcode,name,specifications); |
| | | let mcode = this.checkData[0].materialCoding; |
| | | let name = this.checkData[0].materialName; |
| | | let speId = this.checkData[0].specificationsId; |
| | | this.getChooseVersionFun(mcode,name,speId); |
| | | this.addReportDialog = true; |
| | | } |
| | | } |
| | | }, |
| | | changeVersionFun(){ |
| | | let mCode = this.checkData[0].materialCoding; |
| | | let name = this.checkData[0].materialName; |
| | | let specifications = this.checkData[0].specificationsModels; |
| | | let version = this.addInspectionForm.version; |
| | | this.getProByVersion(mCode,name,specifications,version); |
| | | }, |
| | | //获取版本下的标准库数据 |
| | | async getProByVersion(mCode,name,specifications,version){ |
| | | var vm = this; |
| | | await lookProByVer({ |
| | | mcode : mCode, |
| | | name : name, |
| | | specifications : specifications, |
| | | version: version |
| | | }).then((res)=>{ |
| | | vm.standardLibraryData = res.data; |
| | | }) |
| | | |
| | | }, |
| | | //获取版本列表 |
| | | async getChooseVersionFun(mCode,name,specifications){ |
| | | var vm = this; |
| | | this.chooseVersion = []; |
| | | await getChooseVersion({ |
| | | mcode : mCode, |
| | | name : name, |
| | | specifications : specifications |
| | | }).then((res)=>{ |
| | | vm.getProByVersion(mCode,name,specifications,res.data[0]) |
| | | for(let i=0;i<res.data.length;i++){ |
| | | vm.chooseVersion.push({ |
| | | value: res.data[i], |
| | | label: "V"+res.data[i] |
| | | }); |
| | | } |
| | | vm.addInspectionForm.version = res.data[0]; |
| | | }); |
| | | }, |
| | | changeVersionFun(){ |
| | | let mCode = this.checkData[0].materialCoding; |
| | | let name = this.checkData[0].materialName; |
| | | let specifications = this.checkData[0].specificationsModels; |
| | | let version = this.addInspectionForm.version; |
| | | this.getProByVersion(mCode,name,specifications,version); |
| | | }, |
| | | //获取版本下的标准库数据 |
| | | async getProByVersion(mCode,name,specifications,version){ |
| | | var vm = this; |
| | | await lookProByVer({ |
| | | mcode : mCode, |
| | | name : name, |
| | | specifications : specifications, |
| | | version: version |
| | | }).then((res)=>{ |
| | | var arr = res.data; |
| | | for(var i=0;i<arr.length;i++){ |
| | | arr[i].id = "0" + i; |
| | | } |
| | | vm.standardLibraryData = arr; |
| | | }) |
| | | |
| | | }, |
| | | //获取版本列表 |
| | | async getChooseVersionFun(mCode,name,specifications){ |
| | | var vm = this; |
| | | this.chooseVersion = []; |
| | | await getChooseVersion({ |
| | | mcode : mCode, |
| | | name : name, |
| | | specifications : specifications |
| | | }).then((res)=>{ |
| | | vm.getProByVersion(mCode,name,specifications,res.data[0]) |
| | | for(let i=0;i<res.data.length;i++){ |
| | | vm.chooseVersion.push({ |
| | | value: res.data[i], |
| | | label: "V"+res.data[i] |
| | | }); |
| | | } |
| | | vm.addInspectionForm.version = res.data[0]; |
| | | }); |
| | | }, |
| | | //生成报检单确认按钮 |
| | | confirmBtn(formName) { |
| | | this.$refs[formName].validate((valid=>{ |
| | | if(valid){ |
| | | let dateArr = this.addInspectionForm.inspectionDate; |
| | | //添加报检单 |
| | | let val = this.checkData[0]; |
| | | let obj = { |
| | | "endTime": dateArr[1], |
| | | "experiment": "", |
| | | "formTime": val.createTime, |
| | | "id": val.id, |
| | | "mcode": val.materialCoding, |
| | | "name": val.materialName, |
| | | "num": val.quantity, |
| | | "specifications": val.specificationsModels, |
| | | "startTime": dateArr[0], |
| | | "supplier": val.supplierName, |
| | | "type": val.type, |
| | | "unit": val.unit, |
| | | "version": this.addInspectionForm.version |
| | | } |
| | | this.createReport(obj); |
| | | this.addReportDialog = false; |
| | | } |
| | | })); |
| | | this.$refs[formName].validate((valid=>{ |
| | | if(valid){ |
| | | let dateArr = this.addInspectionForm.inspectionDate; |
| | | //添加报检单 |
| | | let val = this.checkData[0]; |
| | | let obj = { |
| | | "endTime": dateArr[1], |
| | | "experiment": "", |
| | | "formTime": val.createTime, |
| | | "id": val.id, |
| | | "mcode": val.materialCoding, |
| | | "name": val.materialName, |
| | | "num": val.quantity, |
| | | "specifications": val.specificationsModels, |
| | | "specificationsId": val.specificationsId, |
| | | "startTime": dateArr[0], |
| | | "supplier": val.supplierName, |
| | | "type": val.type, |
| | | "unit": val.unit, |
| | | "version": this.addInspectionForm.version |
| | | } |
| | | this.createReport(obj); |
| | | this.addReportDialog = false; |
| | | } |
| | | })); |
| | | }, |
| | | //生成报检单 |
| | | async createReport(param) { |
| | | let res = await addInspect(param); |
| | | if(res.data==null)return |
| | | this.$message.success('报检成功') |
| | | this.$router.push(`/experiment/Viewdetails/${res.data}`) |
| | | await addInspect(param).then(res =>{ |
| | | this.search(); |
| | | this.$message.success('报检成功') |
| | | this.$router.push(`/experiment/Viewdetails/${res.data}`) |
| | | }).catch(error =>{ |
| | | this.$message.error('报检失败') |
| | | }); |
| | | }, |
| | | // 获取分页列表数据 |
| | | async getRawMaterialList() { |
| | |
| | | insert() { |
| | | this.$refs['addMaterialForm'].validate((valid) => { |
| | | if (valid) { |
| | | console.log(this.childrenOptions); |
| | | console.log(this.insertData); |
| | | let f=this.childrenOptions.filter(item=>{ |
| | | return item.Id===this.insertData.specificationsNumber[0] |
| | | })[0] |
| | | console.log(f); |
| | | let fatherName=f.Name; |
| | | let c=f.children.filter(item=>{ |
| | | return item.Id===this.insertData.specificationsNumber[1] |
| | | })[0] |
| | | let sonName=c.Name |
| | | let specificationsId=c.Id; |
| | | var str = { |
| | | "dateSurvey": this.insertData.fromDate, |
| | | "materialCoding": this.insertData.mCode, |
| | | "materialName": this.insertData.mName, |
| | | "quantity": this.insertData.num, |
| | | "specificationsModels": this.insertData.specificationsNumber[0] + '-' + this.insertData |
| | | .specificationsNumber[1], |
| | | "specificationsModels": fatherName+ '-' + sonName, |
| | | "specificationsId": specificationsId, |
| | | "supplierName": this.insertData.supplierName, |
| | | "type": 0, |
| | | "unit": this.insertData.unit |