| | |
| | | <template> |
| | | <div class="content-main"> |
| | | <div class="rawPage" v-if="!showNewPage"> |
| | | <div class="rawPage"> |
| | | <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"> |
| | |
| | | </el-dialog> |
| | | <div class="library-table"> |
| | | <div class="table-header"> |
| | | <div class="search-bar"> |
| | | <el-radio-group v-model="radioValue" @change="radioclick"> |
| | | <el-radio-button v-for="option in radioOptions" :key="option.value" |
| | | :label="option.value">{{ option.label }}</el-radio-button> |
| | | </el-radio-group> |
| | | </div> |
| | | <div class="generateInsp"> |
| | | <el-button @click="addReportBtn" type="primary" size="mini" icon="el-icon-document" |
| | | style="background-color: rgb(1, 102, 226);">生成报检单</el-button> |
| | | </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-column type="selection" :selectable="checkSelect" min-width="5%"> |
| | | </el-table-column> |
| | | <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="createTime" label="来料日期" min-width="8%" /> |
| | | <el-table-column prop="dateSurvey" label="来料日期" min-width="8%" /> |
| | | <el-table-column prop="supplierName" label="供应商名称" min-width="12%" /> |
| | | <el-table-column prop="materialCoding" label="材料编码" min-width="8%" /> |
| | | <el-table-column prop="materialName" 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="dateSurvey" 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' }"> |
| | |
| | | </div> |
| | | </div> |
| | | <el-dialog title="选择日期" :visible.sync="addReportDialog" width="60%"> |
| | | <el-form :model="addInspectionForm" :rules="addInspectionFormRules" rule="addInspectionForm"> |
| | | <el-form :model="addInspectionForm" :rules="addInspectionFormRules" ref="addInspectionForm"> |
| | | <el-form-item label="检验日期" label-width="100px" prop="inspectionDate"> |
| | | <el-date-picker v-model="addInspectionForm.inspectionDate" type="daterange" value-format="yyyy-MM-dd" |
| | | range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"> |
| | |
| | | <el-button type="primary" @click="confirmBtn('addInspectionForm')">确 定</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | |
| | | <!-- 生成报检单 --> |
| | | <div class="newPage" v-if="showNewPage"> |
| | | <!-- 新增页面 --> |
| | | <div class="inspectionForm"> |
| | | <el-form :model="inspectionForm" label-position="right" label-width="100px" size="mini"> |
| | | <div class="formwrapper"> |
| | | <el-row> |
| | | <el-col :span="8"> |
| | | <el-form-item label="来料日期:"> |
| | | <el-input style="width: 180px;" :value="inspectionForm.formTime" disabled autocomplete="off" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="8"> |
| | | <el-form-item label="供应商名称:"> |
| | | <el-input style="width: 180px;" :value="inspectionForm.supplier" disabled autocomplete="off" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="8"> |
| | | <el-form-item label="样品编号:"> |
| | | <el-input style="width: 180px;" :value="inspectionForm.code" disabled autocomplete="off" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="8"> |
| | | <el-form-item label="样品名称:"> |
| | | <el-input style="width: 180px;" :value="inspectionForm.name" disabled autocomplete="off" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="8"> |
| | | <el-form-item label="规格型号:"> |
| | | <el-input style="width: 180px;" :value="inspectionForm.specifications" disabled autocomplete="off" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="8"> |
| | | <el-form-item label="单位:"> |
| | | <el-input style="width: 180px;" :value="inspectionForm.unit" disabled autocomplete="off" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="8"> |
| | | <el-form-item label="数量:"> |
| | | <el-input style="width: 180px;" :value="inspectionForm.num" disabled autocomplete="off" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="8"> |
| | | <el-form-item label="报检日期:"> |
| | | <el-input style="width: 180px;" :value="inspectionForm.endTime" disabled autocomplete="off" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="8"> |
| | | <el-form-item label="报检人:"> |
| | | <el-input style="width: 180px;" :value="inspectionForm.userName" disabled autocomplete="off" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | </el-form> |
| | | </div> |
| | | <div class="inspectionProject"> |
| | | <div class="header"> |
| | | <span style="font-size: 14px">检验项目</span> |
| | | <div> |
| | | <!-- <el-button type="primary" plain size="mini">保存</el-button> --> |
| | | <el-button @click="showNewPage = false" type="primary" plain size="mini" icon="el-icon-back">返回</el-button> |
| | | </div> |
| | | </div> |
| | | <el-table :max-height="800" :cell-style="{textAlign: 'center'}" |
| | | :header-cell-style="{border:'0px',background:'#f5f7fa',color:'#606266',boxShadow: 'inset 0 1px 0 #ebeef5',textAlign: 'center'}" |
| | | :data="inspectionItems"> |
| | | <el-table-column type="index" label="序号" width="60"></el-table-column> |
| | | <el-table-column prop="name" label="项目" width="250"></el-table-column> |
| | | <el-table-column prop="unit" label="单位" width="125"></el-table-column> |
| | | <el-table-column prop="required" label="标准值" width="125"></el-table-column> |
| | | <el-table-column prop="internal" label="内测值" width="125"></el-table-column> |
| | | <el-table-column prop="testValue" label="检验值" width="125"></el-table-column> |
| | | <el-table-column prop="userName" label="检验人"> |
| | | <template slot-scope="scope"> |
| | | <el-select @blur="blurOptions(scope.row)" v-model="scope.row.check" size="small" slot="append" |
| | | style="width: 260px;"> |
| | | <el-option v-for="(item,index) in checkeroptions" :key="index" :value="item.id" |
| | | :label="item.name"></el-option> |
| | | </el-select> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="device" label="试验设备"> |
| | | <template slot-scope="scope"> |
| | | <el-select @blur="blurOptions(scope.row)" v-model="scope.row.device" size="small" slot="append" |
| | | style="width: 260px;"> |
| | | <el-option v-for="(item,index) in deviceoptions" :key="index" :value="item.id" |
| | | :label="item.equipmentName"></el-option> |
| | | </el-select> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | getChooseVersion, |
| | | lookProByVer |
| | | } from '@/api/inspection/rawmaterial' |
| | | import ItemVue from '@/layout/components/Sidebar/Item.vue' |
| | | export default { |
| | | data() { |
| | | return { |
| | | standardLibraryData:[], |
| | | chooseVersion: [], |
| | | userName: "", |
| | | devices: "", |
| | | addInspectionForm: { |
| | | inspectionDate: [], |
| | | version: null |
| | |
| | | value: 0, |
| | | label: '未报检' |
| | | }], |
| | | deviceoptions: [{ |
| | | value: 0, |
| | | label: '拉力机' |
| | | }, { |
| | | value: 1, |
| | | label: '拖拉机' |
| | | }], |
| | | checkeroptions: [{ |
| | | value: 0, |
| | | label: '黄小明' |
| | | }, { |
| | | value: 1, |
| | | label: '张三' |
| | | }], |
| | | radioOptions: [{ |
| | | label: '全部', |
| | | value: null |
| | |
| | | label: '未报检' |
| | | }], |
| | | radioValue: null, |
| | | inspectionTable: [{ |
| | | createTime: '2023-07-28', |
| | | supplier_name: '国网山东省电力有限公司', |
| | | materialCoding: 'BP214274', |
| | | materialName: '铝包钢绞线', |
| | | specificationsModels: 'JLHA/G1A-185/30-26/7', |
| | | unit: '吨', |
| | | quantity: 21, |
| | | dateSurvey: '2023-08-02', |
| | | surveyor: '黄小明', |
| | | inspectionDate: '2023-12-09', |
| | | condition: 1 |
| | | }], |
| | | inspectionTable: [], |
| | | currentPage: 1, |
| | | pageSize: 10, |
| | | total: 20, |
| | | data: '', |
| | | showNewPage: false, |
| | | inspectionForm: {}, |
| | | inspectionItems: [{ |
| | | index: 1, |
| | | name: "aaa", |
| | | unit: "KB", |
| | | required: "1", |
| | | internal: "2", |
| | | testValue: "3", |
| | | userName: "", |
| | | device: "" |
| | | }], |
| | | insertRule: { |
| | | fromDate: [{ |
| | | required: true, |
| | |
| | | mounted() { |
| | | this.getMaterielName(); |
| | | }, |
| | | watch:{ |
| | | addReportDialog(newVal){ |
| | | if(newVal === false){ |
| | | this.resetForm("addInspectionForm"); |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | handleChange() { |
| | | |
| | |
| | | this.$message.error(error.message); |
| | | }); |
| | | }, |
| | | blurOptions(row) { |
| | | console.log("更新", row); |
| | | }, |
| | | async initNewSelection() { |
| | | const res = await selectUser(); |
| | | const res2 = await selectEquipment(); |
| | | this.checkeroptions = res.data; |
| | | this.deviceoptions = res2.data; |
| | | }, |
| | | resetForm(formName) { |
| | | // this.addInspectionForm.inspectionDate = [], |
| | | // this.$refs[formName].resetFields(); |
| | | this.addInspectionForm.inspectionDate = [], |
| | | this.$refs[formName].resetFields(); |
| | | this.addReportDialog = false |
| | | }, |
| | | removeFun(row, index) { |
| | |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | console.log(row.id); |
| | | this.deleteMaterialFun(row, index); |
| | | }).catch(() => {}); |
| | | }, |
| | | checkSelect(row, index) { |
| | | checkSelect(row) { |
| | | if (row.type === 1) { |
| | | return false; |
| | | } else { |
| | |
| | | } |
| | | }, |
| | | handleSelectionChange(val) { |
| | | this.checkData = val; |
| | | console.log(val); |
| | | if (val.length > 1) { |
| | | let data = val.pop(); |
| | | this.$refs.inspectionTable.clearSelection(); |
| | | this.$refs.inspectionTable.toggleRowSelection(data); |
| | | this.checkData = new Array(data); |
| | | }else{ |
| | | 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); |
| | | console.log(this.standardLibraryData); |
| | | 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)=>{ |
| | | console.log(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) { |
| | | let dateArr = this.addInspectionForm.inspectionDate; |
| | | //添加报检单 |
| | | let val = this.checkData[0]; |
| | | let obj = { |
| | | 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, |
| | |
| | | "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; |
| | | } |
| | | // this.createReport(obj); |
| | | this.addReportDialog = false; |
| | | this.initNewSelection(); |
| | | this.showNewPage = true; |
| | | })); |
| | | }, |
| | | //生成报检单 |
| | | async createReport(param) { |
| | | let res = await addInspect(param); |
| | | const res2 = await selectInspectsListById({ |
| | | id: res.data |
| | | await addInspect(param).then(res =>{ |
| | | this.search(); |
| | | this.$message.success('报检成功') |
| | | this.$router.push(`/experiment/Viewdetails/${res.data}`) |
| | | }).catch(error =>{ |
| | | this.$message.error('报检失败') |
| | | }); |
| | | this.resultData = res2.data; |
| | | this.inspectionForm = res2.data; |
| | | this.inspectionItems = res2.data.insProducts; |
| | | }, |
| | | // 获取分页列表数据 |
| | | async getRawMaterialList() { |
| | |
| | | } |
| | | this.getRawMaterialList() |
| | | }, |
| | | radioclick() { |
| | | console.log(this.inspectionTable); |
| | | if (this.radioValue === 0) { |
| | | |
| | | } |
| | | }, |
| | | getAllTableData() { |
| | | this.getRawMaterialList() |
| | | }, |
| | | getCheckData() { |
| | | |
| | | }, |
| | | getUnCheckData() { |
| | | |
| | | }, |
| | | // 每页条数改变时触发 选择一页显示多少行 |
| | | handleSizeChange(val) { |
| | | this.pageSize = val |
| | |
| | | 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 |
| | |
| | | flex-direction: column; |
| | | |
| | | .table-header { |
| | | width: 100%; |
| | | height: 70px; |
| | | padding: 20px; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | |
| | | .generateInsp{ |
| | | position: relative; |
| | | left: 92%; |
| | | } |
| | | .el-form-item { |
| | | margin-bottom: 30px !important; |
| | | } |