Commit 9fd0f344 by zhuxiaomei

日期的处理

parent 1d20a92c
...@@ -810,10 +810,10 @@ ...@@ -810,10 +810,10 @@
sample: { sample: {
trademark: '', trademark: '',
qrcode: '', qrcode: '',
firstClass:'', firstClass: '',
secondClass:'', secondClass: '',
thirdClass:'', thirdClass: '',
fourthClass:'', fourthClass: '',
type: '', type: '',
typeRemark: '', typeRemark: '',
source: '', source: '',
...@@ -821,7 +821,7 @@ ...@@ -821,7 +821,7 @@
properties: '', properties: '',
propertiesRemark: '', propertiesRemark: '',
dateType: '', dateType: '',
sampleDate:'', sampleDate: '',
standard: '', standard: '',
batchNo: '', batchNo: '',
specification: '', specification: '',
...@@ -852,7 +852,7 @@ ...@@ -852,7 +852,7 @@
thirdPartyNatureList: ['委托', '代理', '经销', '进口', '其他'], thirdPartyNatureList: ['委托', '代理', '经销', '进口', '其他'],
storageCondition:[], storageCondition: [],
place: '', //1生产环节2流通环节3餐饮环节 值为“环节,地点” place: '', //1生产环节2流通环节3餐饮环节 值为“环节,地点”
placeRemark1: '', placeRemark1: '',
placeRemark2: '', placeRemark2: '',
...@@ -885,7 +885,7 @@ ...@@ -885,7 +885,7 @@
}, },
methods: { methods: {
_open() { _open() {
console.log(this.$route.query.id,'this.$route.query.id') console.log(this.$route.query.id, 'this.$route.query.id')
if (this.$route.query.id) { if (this.$route.query.id) {
this.id = this.$route.query.id this.id = this.$route.query.id
this._getData() this._getData()
...@@ -901,45 +901,49 @@ ...@@ -901,45 +901,49 @@
this.formObj[key] = result[key] this.formObj[key] = result[key]
} }
} }
for(let key in this.netTested){ for (let key in this.netTested) {
if(result.netTested[key]){ if (result.netTested[key]) {
this.netTested = result.netTested[key] this.netTested[key] = result.netTested[key]
}
} }
for (let key in this.sample) {
if (result.sample[key]) {
if (key === 'sampleDate') {
this.sample[key] = result.sample[key] ? this.$dateformat(result.sample[key], 'yyyy-mm-dd') : ''
} else {
this.sample[key] = result.sample[key]
} }
for(let key in this.sample){
if(result.sample[key]){
this.sample = result.sample[key]
} }
} }
this.testedType = result.testedType this.testedType = result.testedType
this.shelfId = result.shelfId this.shelfId = result.shelfId
} }
}, },
_valParams(){ _valParams() {
if(this.formObj.samplingNum===''){ if (this.formObj.samplingNum === '') {
this.$toast('请输入抽样单编号') this.$toast('请输入抽样单编号')
return true return true
} }
if(this.sample.firstClass===''){ if (this.sample.firstClass === '') {
this.$toast('请输入大类') this.$toast('请输入大类')
return true return true
} }
if(this.sample.secondClass===''){ if (this.sample.secondClass === '') {
this.$toast('请输入大亚类') this.$toast('请输入大亚类')
return true return true
} }
if(this.sample.thirdClass===''){ if (this.sample.thirdClass === '') {
this.$toast('请输入次亚类') this.$toast('请输入次亚类')
return true return true
} }
if(this.sample.fourthClass===''){ if (this.sample.fourthClass === '') {
this.$toast('请输入细类') this.$toast('请输入细类')
return true return true
} }
return false return false
}, },
_ok() { _ok() {
if(this._valParams()){ if (this._valParams()) {
return return
} }
let data = Object.assign({}, this.formObj, {nonNetTested: this.nonNetTested}, {sample: this.sample}) let data = Object.assign({}, this.formObj, {nonNetTested: this.nonNetTested}, {sample: this.sample})
...@@ -961,7 +965,7 @@ ...@@ -961,7 +965,7 @@
} }
data.shelfId = this.shelfId data.shelfId = this.shelfId
data.testedType = this.testedType data.testedType = this.testedType
console.log(this.testedType,'this.testedType') console.log(this.testedType, 'this.testedType')
if (this.id) { if (this.id) {
this._editSave(data) this._editSave(data)
} else { } else {
......
...@@ -809,7 +809,7 @@ ...@@ -809,7 +809,7 @@
sample: { sample: {
trademark: '', trademark: '',
num: '', num: '',
batchNo:'', batchNo: '',
firstClass: '', firstClass: '',
secondClass: '', secondClass: '',
thirdClass: '', thirdClass: '',
...@@ -821,7 +821,7 @@ ...@@ -821,7 +821,7 @@
properties: '', properties: '',
propertiesRemark: '', propertiesRemark: '',
dateType: '', dateType: '',
sampleDate:'', sampleDate: '',
shelfLife: '', shelfLife: '',
standard: '', standard: '',
qualityGrade: '', qualityGrade: '',
...@@ -879,12 +879,16 @@ ...@@ -879,12 +879,16 @@
} }
for (let key in this.netTested) { for (let key in this.netTested) {
if (result.netTested[key]) { if (result.netTested[key]) {
this.netTested = result.netTested[key] this.netTested[key] = result.netTested[key]
} }
} }
for (let key in this.sample) { for (let key in this.sample) {
if (result.sample[key]) { if (result.sample[key]) {
this.sample = result.sample[key] if (key === 'sampleDate') {
this.sample[key] = result.sample[key] ? this.$dateformat(result.sample[key], 'yyyy-mm-dd') : ''
} else {
this.sample[key] = result.sample[key]
}
} }
} }
this.testedType = result.testedType this.testedType = result.testedType
......
...@@ -904,9 +904,13 @@ ...@@ -904,9 +904,13 @@
} }
for(let key in this.sample){ for(let key in this.sample){
if(result.sample[key]){ if(result.sample[key]){
if (key === 'sampleDate') {
this.sample[key] = result.sample[key] ? this.$dateformat(result.sample[key], 'yyyy-mm-dd') : ''
} else {
this.sample[key] = result.sample[key] this.sample[key] = result.sample[key]
} }
} }
}
this.testedType = result.testedType this.testedType = result.testedType
this.shelfId = result.shelfId this.shelfId = result.shelfId
} }
......
...@@ -879,9 +879,13 @@ ...@@ -879,9 +879,13 @@
} }
for (let key in this.sample) { for (let key in this.sample) {
if (result.sample[key]) { if (result.sample[key]) {
if (key === 'sampleDate') {
this.sample[key] = result.sample[key] ? this.$dateformat(result.sample[key], 'yyyy-mm-dd') : ''
} else {
this.sample[key] = result.sample[key] this.sample[key] = result.sample[key]
} }
} }
}
this.testedType = result.testedType this.testedType = result.testedType
this.shelfId = result.shelfId this.shelfId = result.shelfId
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment