From ce3be66189098e60bac79251d44ae390fa0450d7 Mon Sep 17 00:00:00 2001
From: Fixiaobai <fixiaobai@163.com>
Date: 星期三, 06 九月 2023 15:45:06 +0800
Subject: [PATCH] modified: src/views/experiment/planAssignments/plan.vue
---
src/views/inspectionManagement/reportForInspection/index.vue | 203 +++++++++++++++++++++++++++++---------------------
1 files changed, 118 insertions(+), 85 deletions(-)
diff --git a/src/views/inspectionManagement/reportForInspection/index.vue b/src/views/inspectionManagement/reportForInspection/index.vue
index 2b88e61..f61d75c 100644
--- a/src/views/inspectionManagement/reportForInspection/index.vue
+++ b/src/views/inspectionManagement/reportForInspection/index.vue
@@ -8,7 +8,7 @@
</el-input>
</el-form-item>
<el-form-item label="鏉愭枡鍚嶇О:" class="sermargin">
- <el-input v-model="searchData.name" class="input-form" placeholder="璇疯緭鍏�">
+ <el-input v-model="searchData.name" class="input-form" placeholder="璇疯緭鍏ユ潗鏂欏悕绉�">
</el-input>
</el-form-item>
<el-form-item label="鐘舵��:" class="sermargin">
@@ -18,8 +18,8 @@
</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 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>
@@ -48,13 +48,13 @@
</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">
@@ -70,9 +70,11 @@
</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%" />
@@ -83,8 +85,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' }">
@@ -154,6 +156,7 @@
getChooseVersion,
lookProByVer
} from '@/api/inspection/rawmaterial'
+import ItemVue from '@/layout/components/Sidebar/Item.vue'
export default {
data() {
return {
@@ -276,6 +279,13 @@
mounted() {
this.getMaterielName();
},
+ watch:{
+ addReportDialog(newVal){
+ if(newVal === false){
+ this.resetForm("addInspectionForm");
+ }
+ }
+ },
methods: {
handleChange() {
@@ -312,11 +322,14 @@
}
},
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() {
@@ -326,86 +339,94 @@
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() {
@@ -459,13 +480,25 @@
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
--
Gitblit v1.9.3