From aca7c994977ecb1cc8fb3b7740a04192135a40a9 Mon Sep 17 00:00:00 2001 From: zouyu <2723363702@qq.com> Date: 星期一, 04 九月 2023 15:04:20 +0800 Subject: [PATCH] modified: .env.development modified: src/views/CNAS/nonConformanceManage/index.vue modified: src/views/CNAS/reviewAnnualPlan/index.vue modified: src/views/CNAS/satisfactionSurveys/index.vue modified: src/views/experiment/checkTheReport/index.vue modified: src/views/experiment/inspectionApplication/index.vue modified: src/views/experiment/nonConformanceReview/index.vue modified: src/views/experiment/nonConformingFeedback/index.vue modified: src/views/experiment/reportAuditing/index.vue modified: src/views/inspectionManagement/commissionInspection/index.vue modified: src/views/inspectionManagement/reportForInspection/index.vue modified: src/views/laboratory/ledger/index.vue modified: src/views/laboratory/measure/index.vue modified: src/views/laboratory/personnel/index.vue modified: src/views/laboratory/role/index.vue modified: src/views/message/toDo/index.vue --- src/views/inspectionManagement/reportForInspection/index.vue | 1134 ++++++++++++++++++++++++++++++++--------------------------- 1 files changed, 620 insertions(+), 514 deletions(-) diff --git a/src/views/inspectionManagement/reportForInspection/index.vue b/src/views/inspectionManagement/reportForInspection/index.vue index e48728d..1a39e40 100644 --- a/src/views/inspectionManagement/reportForInspection/index.vue +++ b/src/views/inspectionManagement/reportForInspection/index.vue @@ -1,524 +1,630 @@ <template> - <div class="content-main"> - <div class="rawPage" v-if="!showNewPage"> - <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> - </el-form-item> - <el-form-item label="鏉愭枡鍚嶇О:" class="sermargin"> - <el-input - 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-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-form-item> - <el-form-item> - <el-button type="primary" @click="search">鏌ヨ</el-button> - <el-button type="primary" plain @click="reset">閲嶇疆</el-button> - </el-form-item> - </el-form> - </div> - <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="showNewPage = true" 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="800" - :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%" - > - <el-table-column - type="selection" - min-width="10%" - /> - <el-table-column - type="index" - label="搴忓彿" - min-width="8%" - /> - <el-table-column - prop="createTime" - 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="specificationsModels" - label="瑙勬牸鍨嬪彿" - min-width="12%" - /> - <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 - prop="surveyor" - label="妫�楠屼汉" - min-width="8%" - /> - <el-table-column - prop="dateSurvey" - label="妫�楠屾棩鏈�" - min-width="8%" - /> - <el-table-column - prop="condition" - label="鐘舵��" - min-width="8%" - > - <template slot-scope="scope"> - <span :style="{ color: scope.row.condition === 1 ? 'green' : 'red' }"> - {{ scope.row.condition === 1 ? '宸叉娴�':'鏈娴�' }} - </span> - </template> - </el-table-column> - </el-table> - <!-- 鍒嗛〉鍣� --> - <div> - <el-pagination - @size-change="handleSizeChange" - @current-change="handleCurrentChange" - :current-page="currentPage" - :page-sizes="[5, 10, 15, 20]" - :page-size="pageSize" - layout="total, sizes, prev, pager, next, jumper" - :total="total"> - </el-pagination> - </div> - </div> - </div> - </div> - - <!-- 鐢熸垚鎶ユ鍗� --> - <div class="newPage" v-if="showNewPage"> - <!-- 鏂板椤甸潰 --> - <div class="inspectionForm"> - <el-form :model="inspectionForm" ref="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.createTime" disabled autocomplete="off" /> - </el-form-item> - </el-col> - <el-col :span="8"> - <el-form-item label="渚涘簲鍟嗗悕绉帮細"> - <el-input style="width: 180px;" :value="inspectionForm.supplier_name" disabled autocomplete="off" /> </el-form-item> - </el-col> - <el-col :span="8"> - <el-form-item label="鏍峰搧缂栧彿锛�"> - <el-input style="width: 180px;" :value="inspectionForm.materialCoding" 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.materialName" disabled autocomplete="off" /> - </el-form-item> - </el-col> - <el-col :span="8"> - <el-form-item label="瑙勬牸鍨嬪彿锛�"> - <el-input style="width: 180px;" :value="inspectionForm.specificationsModels" 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.quantity" disabled autocomplete="off" /> - </el-form-item> - </el-col> - <el-col :span="8"> - <el-form-item label="鎶ユ鏃ユ湡锛�" > - <el-input style="width: 180px;" :value="inspectionForm.dateSurvey" disabled autocomplete="off" /> - </el-form-item> - </el-col> - <el-col :span="8"> - <el-form-item label="鎶ユ浜猴細"> - <el-input style="width: 180px;" :value="inspectionForm.surveyor" 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="project" label="椤圭洰" width="250"></el-table-column> - <el-table-column prop="unit" label="鍗曚綅" width="125"></el-table-column> - <el-table-column prop="standardVal" label="鏍囧噯鍊�" width="125"></el-table-column> - <el-table-column prop="controlVal" label="鍐呮祴鍊�" width="125"></el-table-column> - <el-table-column prop="detectionVal" label="妫�楠屽��" width="125"></el-table-column> - <el-table-column prop="checker" label="妫�楠屼汉"> - <template slot-scope="scope"> - <el-select v-model="scope.row.checker" size="small" slot="append" style="width: 260px;"> - <el-option v-for="item in checkeroptions" :key="item.value" :label="item.label">{{ item.label }}</el-option> - </el-select> - </template> - </el-table-column> - <el-table-column prop="device" label="璇曢獙璁惧"> - <template slot-scope="scope"> - <el-select v-model="scope.row.device" size="small" slot="append" style="width: 260px;"> - <el-option v-for="item in deviceoptions" :key="item.value" :label="item.label">{{ item.label }}</el-option> - </el-select> - </template> - </el-table-column> - </el-table> - </div> - </div> - </div> + <div class="content-main"> + <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> + </el-form-item> + <el-form-item label="鏉愭枡鍚嶇О:" class="sermargin"> + <el-input 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-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-date-picker 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-form-item> + </el-form> + </div> + <el-dialog title="鏂板鍘熸潗鏂欐姤妫�" :visible.sync="addReportVisible" width="40%"> + <el-form ref="addMaterialForm" :rules="insertRule" :model="insertData" :inline="true" label-position="right" + label-width="100px"> + <el-form-item label="鏉ユ枡鏃ユ湡:" prop="fromDate"> + <el-date-picker v-model="insertData.fromDate" type="date" value-format="yyyy-MM-dd"></el-date-picker> + </el-form-item> + <el-form-item label="渚涜揣鍟嗗悕绉�:" prop="supplierName"> + <el-input v-model="insertData.supplierName" /> + </el-form-item> + <el-form-item label="鏉愭枡鍚嶇О:" prop="mName"> + <el-select v-model="insertData.mName" placeholder="璇烽�夋嫨鏉愭枡鍚嶇О" @change="(val)=>{getSpecification(val)}"> + <el-option v-for="(item,index) in materialList" :key="index" :label="item.name" + :value="item.id"></el-option> + </el-select> + </el-form-item> + <el-form-item label="鏉愭枡缂栫爜:" prop="mCode"> + <el-input disabled v-model="insertData.mCode" /> + </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> + </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" min="0" v-model="insertData.num"/> + </el-form-item> + </el-form> + <span slot="footer" class="dialog-footer"> + <el-button @click="addReportVisible = false">鍙� 娑�</el-button> + <el-button type="primary" @click="insert()">纭� 瀹�</el-button> + </span> + </el-dialog> + <div class="library-table"> + <div class="table-header"> + <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="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"> + <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="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="specificationsModels" label="瑙勬牸鍨嬪彿" min-width="12%" /> + <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 prop="surveyor" 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' }"> + {{ scope.row.type === 1 ? '宸叉姤妫�':'鏈姤妫�' }} + </span> + </template> + </el-table-column> + <el-table-column label="鎿嶄綔" min-width="8%"> + <template slot-scope="scope"> + <el-button type="text" size="small" @click="removeFun(scope.row,scope.$index)">鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + <!-- 鍒嗛〉鍣� --> + <div> + <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" + :current-page="currentPage" :page-sizes="[10, 15, 20,30]" :page-size="pageSize" + layout="total, sizes, prev, pager, next, jumper" :total="total"> + </el-pagination> + </div> + </div> + </div> + </div> + <el-dialog title="閫夋嫨鏃ユ湡" :visible.sync="addReportDialog" width="60%"> + <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-date-picker> + </el-form-item> + <el-form-item label="褰撳墠鐗堟湰" label-width="100px" prop="version"> + <el-select @change="changeVersionFun" v-model="addInspectionForm.version" placeholder="璇烽�夋嫨鐗堟湰"> + <el-option v-for="item in chooseVersion" :key="item.value" :label="item.label" :value="item.value" ></el-option> + </el-select> + </el-form-item> + </el-form> + <el-table + style="width:90%;margin-left:5%" + :data="standardLibraryData" row-key="id" border + default-expand-all ref="multipleTable" + :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"> + <el-table-column type="index" width="50px" label="搴忓彿"></el-table-column> + <el-table-column label="椤圭洰鍚嶇О" prop="name" sortable></el-table-column> + <el-table-column prop="unit" label="鍗曚綅" sortable></el-table-column> + <el-table-column label="鏍囧噯鍊�" prop="required" sortable></el-table-column> + <el-table-column prop="internal" label="鍐呮帶鍊�" sortable></el-table-column> + </el-table> + <div slot="footer" class="dialog-footer"> + <el-button @click="resetForm('addInspectionForm')">鍙� 娑�</el-button> + <el-button type="primary" @click="confirmBtn('addInspectionForm')">纭� 瀹�</el-button> + </div> + </el-dialog> + </div> </template> <script> -import { getRawMaterialList } from '@/api/inspection/rawmaterial' -export default { - data() { - return { - form: [], - searchData: { - code: '', - name: '', - state: '', - date: '' - }, - options: [{ - value: 0, - label: '鍏ㄩ儴' - }, { - value: 1, - label: '宸叉楠�' - }, { - value: 2, - label: '寰呮楠�' - }], - deviceoptions:[{ - value: 0, - label: '鎷夊姏鏈�' - },{ - value: 1, - label: '鎷栨媺鏈�' - }], - checkeroptions:[{ - value: 0, - label: '榛勫皬鏄�' - },{ - value: 1, - label: '寮犱笁' - }], - radioOptions:[{ - label: '鍏ㄩ儴', - value: 0 - },{ - value: 1, - label: '宸叉楠�' - },{ - value: 2, - label: '寰呮楠�' - }], - radioValue: 0, - 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 - }], - currentPage: 1, - pageSize: 5, - total:20, - data: '', - showNewPage: false, - inspectionForm:{ - 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', - }, - inspectionItems:[{ - project:'瀵肩嚎澶栧緞', - unit: 'mm', - standardVal: '30.0', - controlVal: '30.0', - detectionVal: '30.0', - device:'', - checker: '', - },{ - project:'瀵肩嚎澶栧緞', - unit: 'mm', - standardVal: '30.0', - controlVal: '30.0', - detectionVal: '30.0', - device:'', - checker: '' - },{ - project:'瀵肩嚎澶栧緞', - unit: 'mm', - standardVal: '30.0', - controlVal: '30.0', - detectionVal: '30.0', - device:'', - checker: '' - },{ - project:'瀵肩嚎澶栧緞', - unit: 'mm', - standardVal: '30.0', - controlVal: '30.0', - detectionVal: '30.0', - device:'', - checker: '' - },{ - project:'瀵肩嚎澶栧緞', - unit: 'mm', - standardVal: '30.0', - controlVal: '30.0', - detectionVal: '30.0', - device:'', - checker: '' - },{ - project:'瀵肩嚎澶栧緞', - unit: 'mm', - standardVal: '30.0', - controlVal: '30.0', - detectionVal: '30.0', - device:'', - checker: '' - }] - } - }, - created(){ - this.getRawMaterialList() - }, - methods: { - // 鑾峰彇鍒嗛〉鍒楄〃鏁版嵁 - async getRawMaterialList(){ - const res = await getRawMaterialList({pageNo: this.currentPage,pageSize:this.pageSize}) - // console.log(res) - this.inspectionTable = res.data.row - this.data = res.data.row - this.total = res.data.total - }, - async search(){ - this.radioValue = this.searchData.state - const res = await getRawMaterialList({condition: this.searchData.state, - createTime:this.searchData.date, - materialCoding:this.searchData.code, - materialName: this.searchData.name, - pageNo: this.currentPage, - pageSize: this.pageSize - }) - // console.log(res) - this.inspectionTable = res.data.row - this.data = res.data.row - this.total = res.data.total - }, - reset(){ - this.searchData = { - code: '', - name: '', - state: '', - date: '' - } - this.getRawMaterialList() - }, - radioclick(){ - this.searchData.state = this.radioValue - // console.log(this.radioValue) - this.inspectionTable = this.data.filter((item)=>{ - return item.condition === this.radioValue - }) - if(this.radioValue === 0){ - this.inspectionTable = this.data - } - this.total = this.inspectionTable.length - }, - // 姣忛〉鏉℃暟鏀瑰彉鏃惰Е鍙� 閫夋嫨涓�椤垫樉绀哄灏戣 - handleSizeChange(val) { - console.log(`姣忛〉 ${val} 鏉) - this.pageSize = val - this.getRawMaterialList({pageNo: this.currentPage,pageSize:this.pageSize}) - }, - // 褰撳墠椤垫敼鍙樻椂瑙﹀彂 璺宠浆鍏朵粬椤� - handleCurrentChange(val) { - console.log(`褰撳墠椤�: ${val}`) - this.currentPage = val - this.getRawMaterialList({pageNo: this.currentPage,pageSize:this.pageSize}) - } - } -} + import { + getRawMaterialList, + addInspect, + selectInspectsListById, + selectUser, + selectEquipment, + deleteMaterial, + addMaterial, + getMaterielName, + getSpecification, + getChooseVersion, + lookProByVer + } from '@/api/inspection/rawmaterial' + export default { + data() { + return { + standardLibraryData:[], + chooseVersion: [], + addInspectionForm: { + inspectionDate: [], + version: null + }, + addInspectionFormRules: { + inspectionDate: [{ + required: true, + message: '璇烽�夋嫨鏃ユ湡鍖洪棿', + trigger: 'change' + }], + }, + addReportDialog: false, + insertData: {}, + addReportVisible: false, + checked: false, + resultData: {}, + checkData: [], + form: [], + searchData: { + code: '', + name: '', + state: '', + date: '' + }, + childrenOptions: [{ + value: 'zhinan', + label: '鎸囧崡', + children: [{ + value: 'shejiyuanze', + label: '璁捐鍘熷垯', + children: [{ + value: 'yizhi', + label: '涓�鑷�' + }, { + value: 'fankui', + label: '鍙嶉' + }, { + value: 'xiaolv', + label: '鏁堢巼' + }, { + value: 'kekong', + label: '鍙帶' + }] + }] + }], + options: [{ + value: null, + label: '鍏ㄩ儴' + }, { + value: 1, + label: '宸叉姤妫�' + }, { + value: 0, + label: '鏈姤妫�' + }], + radioOptions: [{ + label: '鍏ㄩ儴', + value: null + }, { + value: 1, + label: '宸叉姤妫�' + }, { + value: 0, + label: '鏈姤妫�' + }], + radioValue: null, + inspectionTable: [], + currentPage: 1, + pageSize: 10, + total: 20, + data: '', + insertRule: { + fromDate: [{ + required: true, + message: '璇烽�夋嫨鏉ユ枡鏃ユ湡', + trigger: 'blur' + }], + supplierName: [{ + required: true, + message: '璇疯緭鍏ヤ緵搴斿晢鍚嶇О', + trigger: 'blur' + }], + mName: [{ + required: true, + message: '璇烽�夋嫨鐗╂枡鍚嶇О', + trigger: 'blur' + }], + mCode: [{ + required: true, + message: '璇烽�夋嫨鐗╂枡', + trigger: 'blur' + }], + specificationsNumber: [{ + required: true, + message: '璇烽�夋嫨瑙勬牸鍨嬪彿', + trigger: 'blur' + }], + unit: [{ + required: true, + message: '璇疯緭鍏ュ崟浣�', + trigger: 'blur' + }], + num: [{ + required: true, + message: '璇疯緭鍏ユ姤妫�鏁伴噺', + trigger: 'blur' + }] + }, + materialList: [] + } + }, + created() { + this.getRawMaterialList() + }, + mounted() { + this.getMaterielName(); + }, + watch:{ + addReportDialog(newVal){ + if(newVal === false){ + this.resetForm("addInspectionForm"); + } + } + }, + methods: { + handleChange() { + + }, + async deleteMaterialFun(row, index) { + let formData = new FormData(); + formData.append("deleteId", row.id) + await deleteMaterial(formData).then(() => { + this.inspectionTable.splice(index, 1); + this.$message.success("鍒犻櫎鎴愬姛"); + }).catch(error => { + this.$message.error(error.message); + }); + }, + resetForm(formName) { + this.addInspectionForm.inspectionDate = [], + this.$refs[formName].resetFields(); + this.addReportDialog = false + }, + removeFun(row, index) { + this.$confirm('纭鍒犻櫎璇ユ暟鎹悧?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + this.deleteMaterialFun(row, index); + }).catch(() => {}); + }, + checkSelect(row) { + if (row.type === 1) { + return false; + } else { + return true; + } + }, + handleSelectionChange(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 { + if (this.checkData.length > 1) { + this.$message.error("鏈�澶氶�夋嫨涓�鏉℃暟鎹�!"); + } else { + 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)=>{ + 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, + "specificationsId": val.specificationsId, + "startTime": dateArr[0], + "supplier": val.supplierName, + "type": val.type, + "unit": val.unit, + "version": this.addInspectionForm.version + } + // this.createReport(obj); + console.log("obj---",obj); + this.addReportDialog = false; + } + })); + }, + //鐢熸垚鎶ユ鍗� + async createReport(param) { + await addInspect(param).then(res =>{ + this.search(); + this.$message.success('鎶ユ鎴愬姛') + this.$router.push(`/experiment/Viewdetails/${res.data}`) + }).catch(error =>{ + this.$message.error('鎶ユ澶辫触') + }); + }, + // 鑾峰彇鍒嗛〉鍒楄〃鏁版嵁 + async getRawMaterialList() { + const res = await getRawMaterialList({ + pageNo: this.currentPage, + pageSize: this.pageSize + }) + this.inspectionTable = res.data.row + this.data = res.data.row + this.total = res.data.total + }, + async search() { + this.radioValue = this.searchData.state + const res = await getRawMaterialList({ + type: this.searchData.state, + createTime: this.searchData.date, + materialCoding: this.searchData.code, + materialName: this.searchData.name, + pageNo: this.currentPage, + pageSize: this.pageSize + }) + this.inspectionTable = res.data.row + this.data = res.data.row + this.total = res.data.total + }, + reset() { + this.searchData = { + code: '', + name: '', + state: '', + date: '' + } + this.getRawMaterialList() + }, + // 姣忛〉鏉℃暟鏀瑰彉鏃惰Е鍙� 閫夋嫨涓�椤垫樉绀哄灏戣 + handleSizeChange(val) { + this.pageSize = val + this.getRawMaterialList({ + pageNo: this.currentPage, + pageSize: this.pageSize + }) + }, + // 褰撳墠椤垫敼鍙樻椂瑙﹀彂 璺宠浆鍏朵粬椤� + handleCurrentChange(val) { + this.currentPage = val + this.getRawMaterialList({ + pageNo: this.currentPage, + pageSize: this.pageSize + }) + }, + insert() { + this.$refs['addMaterialForm'].validate((valid) => { + if (valid) { + 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], + "supplierName": this.insertData.supplierName, + "type": 0, + "unit": this.insertData.unit + } + this.materialList.forEach(a => { + if (a.id == str.materialName) { + str.materialName = a.name + } + }) + addMaterial(str).then(res => { + this.$message.success('娣诲姞鎴愬姛') + this.addReportVisible = false + this.getRawMaterialList() + }) + } else { + return false; + } + }); + }, + getMaterielName() { + getMaterielName().then(res => { + this.materialList = res.data + }) + }, + getSpecification(val) { + this.materialList.forEach(a => { + if (a.id == val) { + this.insertData.mCode = a.code + } + }) + getSpecification({ + materialId: val + }).then(res => { + this.childrenOptions = JSON.parse(JSON.stringify(res.data).replaceAll('specifications', '').replaceAll( + 'model', '')) + }) + } + } + } </script> -<style scoped> -.content-main{ - height: 100%; - .top-bar{ - margin: -25px -15px; - background: #fff; - display: flex; - justify-content: space-between; - padding: 5px 24px 0px 24px; - .sermargin{ - margin-right: 60px; - } -} -.rightBtn{ - background-color: rgb(1, 102, 226); -} -.library-table{ - background-color: #fff; - flex: 1; - margin: 0px -15px; - margin-top: 40px; - display: flex; - flex-direction: column; - .table-header{ - padding: 20px; - display: flex; - justify-content: space-between; - .el-form-item{ - margin-bottom: 30px !important; +<style scoped lang="scss"> + .content-main { + height: 100%; + + .top-bar { + margin: -25px -15px; + background: #fff; + display: flex; + justify-content: space-between; + padding: 24px 24px 0px 24px; + + .sermargin { + margin-right: 60px; + } + } + + .rightBtn { + background-color: rgb(1, 102, 226); + } + + .library-table { + background-color: #fff; + flex: 1; + margin: 0px -15px; + margin-top: 40px; + display: flex; + flex-direction: column; + + .table-header { + width: 100%; + height: 70px; + padding: 20px; + display: flex; + justify-content: space-between; + .generateInsp{ + position: relative; + left: 92%; } - } - .table-box{ - padding: 0px 20px; - margin-top: 0px; - flex: 1; - background: #fff; - /* padding: 20px 20px 10px 20px; */ - display: flex; - flex-direction: column; - .el-table { - flex: 1; - } - >div:nth-child(2){ - display: flex; - justify-content: end; - margin: 10px 0; - } - } - } -.checked { - color: green; -} + .el-form-item { + margin-bottom: 30px !important; + } + } -.unchecked { - color: red; -} + .table-box { + padding: 0px 20px; + margin-top: 0px; + flex: 1; + background: #fff; + /* padding: 20px 20px 10px 20px; */ + display: flex; + flex-direction: column; -.newPage{ - margin: -25px -15px; - .inspectionForm{ - background-color:#fff; - .formwrapper{ - margin-left: 80px; - padding:10px 0px; - } - } - .inspectionProject{ - margin:10px 0px; - .header{ - display:flex; - justify-content: space-between; - padding-top: -3px; - padding-bottom: 3px; - } - .el-table{ - padding: 10px 10px; - height: 65vh; - overflow-y: auto; - } - } -} -} + .el-table { + flex: 1; + } -</style> + >div:nth-child(2) { + display: flex; + justify-content: end; + margin: 10px 0; + } + } + } + + .checked { + color: green; + } + + .unchecked { + color: red; + } + + .newPage { + margin: -25px -15px; + + .inspectionForm { + background-color: #fff; + + .formwrapper { + margin-left: 80px; + padding: 10px 0px; + } + } + + .inspectionProject { + margin: 10px 0px; + + .header { + display: flex; + justify-content: space-between; + padding-top: -3px; + padding-bottom: 3px; + } + + .el-table { + padding: 10px 10px; + height: 65vh; + overflow-y: auto; + } + } + } + } +</style> \ No newline at end of file -- Gitblit v1.9.3