Commit 45e2d73c by wangweidong

整体优化

parent 1e18d408
...@@ -67,6 +67,7 @@ export default { ...@@ -67,6 +67,7 @@ export default {
https https
.post('meter/v1/sample/add_send_entrust', JSON.stringify(data)) .post('meter/v1/sample/add_send_entrust', JSON.stringify(data))
.then(res => res), .then(res => res),
addSample: data => http.post('meter/v1/sample/', data).then(res => res),
saveSampleEnv: data => saveSampleEnv: data =>
http http
.put('meter/v1/sample/save_sample_env/' + data.ids, data.obj) .put('meter/v1/sample/save_sample_env/' + data.ids, data.obj)
......
...@@ -46,10 +46,7 @@ ...@@ -46,10 +46,7 @@
sortable sortable
> >
<template v-slot="{ row }"> <template v-slot="{ row }">
<div v-if="item.key === 'name'" :style="{color:colorComputed(row.planEndDate)}"> <div v-if="item.date">{{row[item.key]?$dateformat(row[item.key],'yyyy-mm-dd'):''}}</div>
{{row.name}}
</div>
<div v-else-if="item.date">{{row[item.key]?$dateformat(row[item.key],'yyyy-mm-dd'):''}}</div>
<div v-else-if="item.key==='progress'">{{row[item.key].display}}</div> <div v-else-if="item.key==='progress'">{{row[item.key].display}}</div>
<div v-else>{{row[item.key]}}</div> <div v-else>{{row[item.key]}}</div>
</template> </template>
...@@ -159,15 +156,6 @@ export default { ...@@ -159,15 +156,6 @@ export default {
computed: { computed: {
tableHeight: function() { tableHeight: function() {
return this.$tableHeight('tabSearch') return this.$tableHeight('tabSearch')
},
colorComputed() {
return function(val) {
return val - new Date().getTime() > this.detectionDate * 86400000
? '#606266'
: val - new Date().getTime() <= 0
? '#eb6877'
: '#f90'
}
} }
}, },
mounted() { mounted() {
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
* 添加编辑环境检测项目包 * 添加编辑环境检测项目包
*/ */
import ModalFooter from '../../components/base/modalFooter' import ModalFooter from '../../components/base/modalFooter'
import { meterAptitude } from '../../api' import { meterAptitude, meterSample } from '../../api'
import EditModal from './go-out-test/EditModal' import EditModal from './go-out-test/EditModal'
export default { export default {
...@@ -72,6 +72,7 @@ export default { ...@@ -72,6 +72,7 @@ export default {
modalTitle: '', modalTitle: '',
formObj: { formObj: {
verification: '', verification: '',
aptitudeId: '',
name: '', name: '',
spec: '', spec: '',
factoryNumber: '', factoryNumber: '',
...@@ -110,12 +111,12 @@ export default { ...@@ -110,12 +111,12 @@ export default {
}, },
_backData(data) { _backData(data) {
this.formObj.name = data.name this.formObj.name = data.name
this.formObj.aptitudeId = data.id
this.formObj.verification = data.code + data.basis this.formObj.verification = data.code + data.basis
console.log('返回的数据')
console.log(data)
}, },
_save: async function(data) { _save: async function(data) {
const result = await meterAptitude.save(data) console.log(data)
const result = await meterSample.addSample(data)
console.log(result) console.log(result)
if (result) { if (result) {
this._resultChange('添加成功!') this._resultChange('添加成功!')
...@@ -149,25 +150,11 @@ export default { ...@@ -149,25 +150,11 @@ export default {
if (this.$string(this.id).isEmpty()) { if (this.$string(this.id).isEmpty()) {
// 添加 // 添加
const saveData = this.formObj const saveData = this.formObj
console.log(saveData) this._save(saveData)
// this._save(saveData)
} else { } else {
// 编辑 // 编辑
this._edit({ id: this.formObj.id, obj: data }) this._edit({ id: this.formObj.id, obj: data })
} }
// if (this.$string(this.id).isEmpty()) {
// // 添加
// this.$store.dispatch('FoodJudgeBasis/add', data).then(() => {
// this._resultChange('添加成功!')
// })
// } else {
// // 编辑
// this.$store
// .dispatch('FoodJudgeBasis/edit', { id: this.id, obj: data })
// .then(() => {
// this._resultChange('编辑成功!')
// })
// }
} else { } else {
this.$refs.footerModal._hideLoading() this.$refs.footerModal._hideLoading()
this.$Message.error('表单验证失败!') this.$Message.error('表单验证失败!')
......
...@@ -46,10 +46,7 @@ ...@@ -46,10 +46,7 @@
sortable sortable
> >
<template v-slot="{ row }"> <template v-slot="{ row }">
<div v-if="item.key === 'name'" :style="{color:colorComputed(row.planEndDate)}"> <div v-if="item.date">{{row[item.key]?$dateformat(row[item.key],'yyyy-mm-dd'):''}}</div>
{{row.name}}
</div>
<div v-else-if="item.date">{{row[item.key]?$dateformat(row[item.key],'yyyy-mm-dd'):''}}</div>
<div v-else-if="item.key==='progress'">{{row[item.key].display}}</div> <div v-else-if="item.key==='progress'">{{row[item.key].display}}</div>
<div v-else>{{row[item.key]}}</div> <div v-else>{{row[item.key]}}</div>
</template> </template>
...@@ -166,15 +163,6 @@ export default { ...@@ -166,15 +163,6 @@ export default {
computed: { computed: {
tableHeight: function() { tableHeight: function() {
return this.$tableHeight('tabSearch') return this.$tableHeight('tabSearch')
},
colorComputed() {
return function(val) {
return val - new Date().getTime() > this.detectionDate * 86400000
? '#606266'
: val - new Date().getTime() <= 0
? '#eb6877'
: '#f90'
}
} }
}, },
mounted() { mounted() {
......
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