From 6ecc790c14ac7d22aeaab5512b0093931620a310 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期四, 31 八月 2023 09:19:24 +0800
Subject: [PATCH] modified: .env.development
---
src/views/inspectionManagement/reportForInspection/index.vue | 417 +++++++++++++++++++++++++++++++++++++++--------------------
1 files changed, 274 insertions(+), 143 deletions(-)
diff --git a/src/views/inspectionManagement/reportForInspection/index.vue b/src/views/inspectionManagement/reportForInspection/index.vue
index b71f993..09a6b65 100644
--- a/src/views/inspectionManagement/reportForInspection/index.vue
+++ b/src/views/inspectionManagement/reportForInspection/index.vue
@@ -48,18 +48,36 @@
title="鏂板鍘熸潗鏂欐姤妫�"
:visible.sync="addReportVisible"
width="40%">
- <el-form v-model="insertData" label-position="left" label-width="80px">
- <el-form-item label="鏍囧噯绫诲瀷">
- <el-input v-model="insertData.materialName" />
+ <el-form v-model="insertData" :inline="true" label-position="right" label-width="80px">
+ <el-form-item label="鏉ユ枡鏃ユ湡:">
+ <el-date-picker
+ v-model="insertData.fromDate"
+ type="date"
+ value-format="yyyy-MM-dd"
+ ></el-date-picker>
</el-form-item>
- <el-form-item label="鐗╂枡鍚嶇О">
- <el-input v-model="insertData.materialName" />
+ <el-form-item label="渚涜揣鍟嗗悕绉�:">
+ <el-input v-model="insertData.supplierName" />
</el-form-item>
- <el-form-item label="鎵ц鏍囧噯">
- <el-input v-model="insertData.standardName" />
+ <el-form-item label="鏉愭枡鍚嶇О:">
+ <el-select v-model="insertData.mName" placeholder="璇烽�夋嫨鏉愭枡鍚嶇О">
+ <el-option v-for="(item,index) in 5" :key="index" :label="item" :value="item"></el-option>
+ </el-select>
</el-form-item>
- <el-form-item label="瑙勬牸鍨嬪彿">
- <el-input v-model="insertData.specificationsName" />
+ <el-form-item label="鏉愭枡缂栫爜:">
+ <el-input disabled v-model="insertData.mCode" />
+ </el-form-item>
+ <el-form-item label="瑙勬牸鍨嬪彿:">
+ <el-cascader
+ v-model="insertData.specificationsNumber"
+ :options="childrenOptions"
+ @change="handleChange"></el-cascader>
+ </el-form-item>
+ <el-form-item label="鍗曚綅:">
+ <el-input type="text" v-model="insertData.unit" />
+ </el-form-item>
+ <el-form-item label="鏁伴噺:">
+ <el-input type="number" v-model="insertData.num" />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
@@ -77,7 +95,6 @@
<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
@@ -164,7 +181,7 @@
label="鎿嶄綔"
min-width="8%">
<template slot-scope="scope">
- <el-button type="text" size="small" @click="removeFun(scope.row)">鍒犻櫎</el-button>
+ <el-button type="text" size="small" @click="removeFun(scope.row,scope.$index)">鍒犻櫎</el-button>
</template>
</el-table-column>
</el-table>
@@ -183,12 +200,35 @@
</div>
</div>
</div>
+ <el-dialog title="閫夋嫨鏃ユ湡" :visible.sync="addReportDialog" width="30%">
+ <el-form :model="addInspectionForm" :rules="addInspectionFormRules" rule="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 v-model="addInspectionForm.version" placeholder="璇烽�夋嫨鐗堟湰">
+ <el-option v-for="(item,index) in 5" :key="index" :value="item" :label="item"></el-option>
+ </el-select>
+ </el-form-item>
+ </el-form>
+ <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 class="newPage" v-if="showNewPage">
<!-- 鏂板椤甸潰 -->
<div class="inspectionForm">
- <el-form :model="inspectionForm" ref="inspectionForm" label-position="right" label-width="100px" size="mini" >
+ <el-form :model="inspectionForm" label-position="right" label-width="100px" size="mini" >
<div class="formwrapper">
<el-row>
<el-col :span="8">
@@ -264,17 +304,17 @@
<el-table-column prop="testValue" label="妫�楠屽��" width="125"></el-table-column>
<el-table-column prop="userName" label="妫�楠屼汉">
<template slot-scope="scope">
- <el-select v-model="scope.row.checker" size="small" slot="append" style="width: 260px;">
- <el-option v-for="(item,index) in checkeroptions" :key="index" :value="item.value" :label="item.label">{{ item.label }}</el-option>
+ <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 v-model="scope.row.device" size="small" slot="append" style="width: 260px;">
- <el-option v-for="(item,index) in deviceoptions" :key="index" :value="item.value" :label="item.label">{{ item.label }}</el-option>
+ <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>
+ </template>
</el-table-column>
</el-table>
</div>
@@ -283,13 +323,28 @@
</template>
<script>
-import { getRawMaterialList,addInspect,selectInspectsListById } from '@/api/inspection/rawmaterial'
+import { getRawMaterialList,
+ addInspect,
+ selectInspectsListById,
+ selectUser,
+ selectEquipment,
+ deleteMaterial,
+ addMaterial
+ } from '@/api/inspection/rawmaterial'
export default {
data() {
return {
- insertData:{
-
+ userName: "",
+ devices: "",
+ addInspectionForm: {
+ inspectionDate: ['2023-08-01','2023-08-31'],
+ version: 5
},
+ addInspectionFormRules: {
+ inspectionDate: [{required: true, message: '璇烽�夋嫨鏃ユ湡鍖洪棿', trigger: 'change' }],
+ },
+ addReportDialog: false,
+ insertData:{},
addReportVisible: false,
checked: false,
resultData : {},
@@ -301,15 +356,36 @@
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: 0,
+ value: null,
label: '鍏ㄩ儴'
}, {
value: 1,
- label: '宸叉楠�'
+ label: '宸叉姤妫�'
}, {
- value: 2,
- label: '寰呮楠�'
+ value: 0,
+ label: '鏈姤妫�'
}],
deviceoptions:[{
value: 0,
@@ -327,15 +403,15 @@
}],
radioOptions:[{
label: '鍏ㄩ儴',
- value: 0
+ value: null
},{
value: 1,
- label: '宸叉楠�'
+ label: '宸叉姤妫�'
},{
- value: 2,
- label: '寰呮楠�'
+ value: 0,
+ label: '鏈姤妫�'
}],
- radioValue: 0,
+ radioValue: null,
inspectionTable: [{
createTime: '2023-07-28',
supplier_name: '鍥界綉灞变笢鐪佺數鍔涙湁闄愬叕鍙�',
@@ -355,23 +431,60 @@
data: '',
showNewPage: false,
inspectionForm:{},
- inspectionItems:[]
+ inspectionItems:[{
+ index: 1,
+ name: "aaa",
+ unit: "KB",
+ required: "1",
+ internal: "2",
+ testValue: "3",
+ userName:"",
+ device: ""
+ }]
}
},
created(){
this.getRawMaterialList()
},
+ mounted(){
+
+ },
methods: {
- removeFun(row){
+ 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);
+ });
+ },
+ 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.addReportDialog = false
+ },
+ removeFun(row,index){
this.$confirm('纭鍒犻櫎璇ユ暟鎹悧?', '鎻愮ず', {
confirmButtonText: '纭畾',
cancelButtonText: '鍙栨秷',
type: 'warning'
}).then(() => {
- this.$message({
- type: 'success',
- message: '鍒犻櫎鎴愬姛!'
- });
+ console.log(row.id);
+ this.deleteMaterialFun(row,index);
}).catch(() => {});
},
checkSelect(row,index){
@@ -383,21 +496,26 @@
},
handleSelectionChange(val){
this.checkData = val;
- console.log(val);
},
//鐢熸垚鎶ユ鍗曟寜閽�
addReportBtn(){
- let arr = this.checkData;
- if(arr.length < 1){
- this.$message.error("璇烽�夋嫨涓�鏉℃暟鎹�!");
- }else{
- if(arr.length > 1){
- this.$message.error("鏈�澶氶�夋嫨涓�鏉℃暟鎹�!");
+ if(this.checkData.length < 1){
+ this.$message.error("璇烽�夋嫨涓�鏉℃暟鎹�!");
}else{
+ if(this.checkData.length > 1){
+ this.$message.error("鏈�澶氶�夋嫨涓�鏉℃暟鎹�!");
+ }else{
+ this.addReportDialog = true;
+ }
+ }
+ },
+ //鐢熸垚鎶ユ鍗曠‘璁ゆ寜閽�
+ confirmBtn(formName){
+ let dateArr = this.addInspectionForm.inspectionDate;
//娣诲姞鎶ユ鍗�
- let val = arr[0];
+ let val = this.checkData[0];
let obj = {
- "endTime": val.dateSurvey,
+ "endTime": dateArr[1],
"experiment": "",
"formTime": val.createTime,
"id": val.id,
@@ -405,21 +523,21 @@
"name": val.materialName,
"num": val.quantity,
"specifications": val.specificationsModels,
- "startTime": val.inspectionDate,
+ "startTime": dateArr[0],
"supplier": val.supplierName,
"type": val.type,
"unit": val.unit,
"version": val.version
}
- this.createReport(obj);
+ // this.createReport(obj);
+ this.addReportDialog = false;
+ this.initNewSelection();
this.showNewPage = true;
- }
- }
},
//鐢熸垚鎶ヤ环鍗�
async createReport(param){
- await addInspect(param);
- const res2 = await selectInspectsListById({ id : 59});
+ let res = await addInspect(param);
+ const res2 = await selectInspectsListById({ id : res.data});
this.resultData = res2.data;
this.inspectionForm = res2.data;
this.inspectionItems = res2.data.insProducts;
@@ -428,22 +546,19 @@
// 鑾峰彇鍒嗛〉鍒楄〃鏁版嵁
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
- console.log(res.data.row);
this.total = res.data.total
},
async search(){
this.radioValue = this.searchData.state
- const res = await getRawMaterialList({condition: 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
})
- // console.log(res)
this.inspectionTable = res.data.row
this.data = res.data.row
this.total = res.data.total
@@ -458,25 +573,27 @@
this.getRawMaterialList()
},
radioclick(){
- this.searchData.state = this.radioValue
- // console.log(this.radioValue)
- this.inspectionTable = this.data.filter((item)=>{
- return item.condition === this.radioValue
- })
+ console.log(this.inspectionTable);
if(this.radioValue === 0){
- this.inspectionTable = this.data
+
}
- this.total = this.inspectionTable.length
+ },
+ getAllTableData(){
+ this.getRawMaterialList()
+ },
+ getCheckData(){
+
+ },
+ getUnCheckData(){
+
},
// 姣忛〉鏉℃暟鏀瑰彉鏃惰Е鍙� 閫夋嫨涓�椤垫樉绀哄灏戣
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})
}
@@ -485,86 +602,100 @@
</script>
<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{
- padding: 20px;
- display: flex;
- justify-content: space-between;
- .el-form-item{
- margin-bottom: 30px !important;
- }
- }
- .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;
-}
+ .content-main {
+ height: 100%;
-.unchecked {
- color: red;
-}
+ .top-bar {
+ margin: -25px -15px;
+ background: #fff;
+ display: flex;
+ justify-content: space-between;
+ padding: 24px 24px 0px 24px;
-.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;
- }
- }
-}
-}
+ .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;
+ }
+ }
+
+ .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;
+ }
+
+ .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>
--
Gitblit v1.9.3