From 1615528985f30b496d3c294e82136434ee36397c Mon Sep 17 00:00:00 2001
From: 李林 <z1292839451@163.com>
Date: 星期三, 09 八月 2023 17:54:23 +0800
Subject: [PATCH] 8.9编写销售管理
---
src/components/view/rawInsDetail.vue | 79 +++++++++++++++++++++++++++++----------
1 files changed, 59 insertions(+), 20 deletions(-)
diff --git a/src/components/view/rawInsDetail.vue b/src/components/view/rawInsDetail.vue
index 539c4f9..cfb744d 100644
--- a/src/components/view/rawInsDetail.vue
+++ b/src/components/view/rawInsDetail.vue
@@ -83,31 +83,44 @@
<el-form v-model="detailInfo" label-position="right" label-width="120px" >
<el-row>
<el-col :span="7">
- <el-form-item label="鏉ユ枡鏃ユ湡:">
- <el-input v-if="detailId!==null" :disabled="detailId!==null" v-model="detailInfo.formTime"></el-input>
- <el-date-picker
- v-else
- type="date"
- v-model="detailInfo.formTime"
- placeholder="閫夋嫨鏃ユ湡">
- </el-date-picker>
+ <el-form-item label="鍘熸潗鏂欏悕绉�:">
+ <el-input v-if="detailId!==null" :disabled="detailId!==null" v-model="detailInfo.name"></el-input>
+ <el-select @change="checkRawName" v-else placeholder="璇烽�夋嫨椤圭洰鍚嶇О" v-model="detailInfo.name">
+ <el-option v-for="item in materialOptions" :key="item.id" :label="item.name" :value="item.name"></el-option>
+ </el-select>
</el-form-item>
+
</el-col>
<el-col :span="7">
<el-form-item label="瑙勬牸鍨嬪彿:">
- <el-input :disabled="detailId!==null" v-model="detailInfo.specifications"></el-input>
+ <el-input v-if="detailId!==null" :disabled="detailId!==null" v-model="detailInfo.specifications"></el-input>
+ <el-cascader
+ placeholder="璇烽�夋嫨瑙勬牸鍨嬪彿"
+ v-else
+ :disabled="specificationOptions.length===0"
+ :props="{label:'name',value:'name'}"
+ v-model="detailInfo.specificationsArr"
+ :options="specificationOptions"
+ ></el-cascader>
</el-form-item>
</el-col>
<el-col :span="7">
<el-form-item label="鍘熸潗鏂欑紪鐮�:">
- <el-input :disabled="detailId!==null" v-model="detailInfo.code"></el-input>
+ <el-input disabled v-model="detailInfo.code"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="7">
- <el-form-item label="鍘熸潗鏂欏悕绉�:">
- <el-input :disabled="detailId!==null" v-model="detailInfo.name"></el-input>
+ <el-form-item label="鏉ユ枡鏃ユ湡:">
+ <el-input v-if="detailId!==null" :disabled="detailId!==null" v-model="detailInfo.formTime"></el-input>
+ <el-date-picker
+ v-else
+ type="date"
+ value-format="yyyy-MM-dd"
+ v-model="detailInfo.formTime"
+ placeholder="閫夋嫨鏃ユ湡">
+ </el-date-picker>
</el-form-item>
</el-col>
<el-col :span="7">
@@ -295,7 +308,7 @@
label="妫�楠屽憳"
width="542">
<template slot-scope="scope">
- <span v-for="item in scope.row.names" :key="item.username" :style="{marginRight:'8px'}">{{item}}</span>
+ <span v-for="item in scope.row.names" :key="item&&item.userName" :style="{marginRight:'8px'}">{{item}}</span>
</template>
</el-table-column>
<el-table-column
@@ -344,8 +357,9 @@
conclusion.name = this.detailInfo.name
conclusion.code = this.detailInfo.code
conclusion.names= [...new Set(this.projectTable.map(item=>item.userName))]
- console.log(this.projectTable.filter(item=>item.testState===0))
- if(this.projectTable.filter(item=>item.testState===null).length){
+ console.log(conclusion,this.projectTable)
+ console.log(this.projectTable.filter(item=>item.testState===null).length)
+ if(this.projectTable.filter(item=>item.testState===null).length===this.projectTable.length){
conclusion.testState = null
return [conclusion]
}
@@ -370,7 +384,9 @@
// 鏂板缓妫�楠屽崟鍙傛暟瀵硅薄
rawInsParams:{},
// 椤圭洰鍚嶇Оoptions
- materialOptions:[]
+ materialOptions:[],
+ specificationOptions:[]
+
}
},
methods:{
@@ -379,11 +395,19 @@
const {data} = await this.$axios.get(this.$api.url.selectRawInspectsListById+`${this.detailId}`,{params:{id:this.detailId}})
this.detailInfo = data
this.projectTable = data.rawInsProducts
- // console.log(this.projectTable)
+ console.log(data)
},
// 鏂板妫�楠屽崟
- addNewRawInspect() {
- console.log(this.detailInfo)
+ async addNewRawInspect() {
+ this.detailInfo.specifications = this.detailInfo.specificationsArr.join("-")
+ // const time = this.detailInfo.formTime
+ // this.detailInfo.formTime = `${time.getFullYear()}-${time.getMonth() + 1 < 10 ? '0' + (time.getMonth() + 1) : time.getMonth() + 1}-${time.getDate() < 10 ? '0' + time.getDate() : time.getDate()}`
+ const res = await this.$axios.post(this.$api.url.addRawInspects,{...this.detailInfo},{headers:{'Content-Type':'application/json'}})
+ console.log(res)
+ this.detailId = res.data
+ this.getDetailInfo()
+
+ this.$message.success('鎻愪氦鎴愬姛')
},
// 淇敼椤圭洰鐨勬娴嬪�兼敼鍙樼粨璁�
async changeState(row){
@@ -398,8 +422,23 @@
this.getDetailInfo()
},
async getOptions() {
- const {data} = await this.$axios.get(this.$api.url.listMaterial)
+ // const {data} = await this.$axios.get(this.$api.url.listMaterial)
+ // this.materialOptions = data
+ const {data} = await this.$axios.get(this.$api.url.selectRawMaterial)
this.materialOptions = data
+ console.log(this.materialOptions)
+ },
+ checkRawName(data) {
+ console.log('閫夋嫨鍘熸潗鏂欏悕绉�',data)
+ this.materialOptions.forEach(item=>{
+ if(item.name===data){
+ console.log(item.id)
+ this.detailInfo.code = item.code
+ this.$axios.get(this.$api.url.selectSpBySt,{params:{id:item.id}}).then(res=>{
+ this.specificationOptions= res.data
+ })
+ }
+ })
}
}
}
--
Gitblit v1.9.3