提交修改

This commit is contained in:
quyixiao 2020-08-31 10:44:09 +08:00
parent 5e0744f246
commit af936d4bf3
3 changed files with 128 additions and 4 deletions

View File

@ -63,3 +63,11 @@ export const deleteRecord = params => {
export const preWeightCheck = params => {
return http({url: '/lz_management/user/lzresultrecord/preWeightCheck', method: 'post', params})
}
export const getMyDate = params => {
return http({url: '/lz_management/get/date', method: 'post', params})
}
export const updateDate = params => {
return http({url: '/lz_management/get/updateDate', method: 'post', params})
}

View File

@ -0,0 +1,94 @@
<template>
<el-dialog
:title="'' "
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="80px">
<el-form-item label="月份" >
<el-select v-model="dataForm.monthTime" placeholder="请选择">
<el-option
v-for="item in dataList"
:key="item.key"
:label="item.value"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="commitRecord()">确认</el-button>
</span>
</el-dialog>
</template>
<script>
import {getMyDate, updateDate} from '@/api/api_result'
export default {
data () {
return {
visible: false,
recordResultId: 0,
dataList: [{value: '2017-03', key: '2017-04'}],
dataForm: {
monthTime: ''
},
dataRule: {}
}
},
mounted () {
},
computed: {},
methods: {
async init (recordResultId) {
this.recordResultId = recordResultId
this.visible = true
this.$nextTick(async () => {
this.$refs['dataForm'].resetFields()
getMyDate({
'recordResultId': this.recordResultId
}).then(data => {
if (data && data.code === 0) {
this.dataList = data.list
this.dataForm.monthTime = this.dataList[0].value
} else {
this.alertInfo(data.msg)
}
})
})
},
alertInfo (msg) {
this.$message({
message: msg,
type: 'success',
duration: 1500,
onClose: () => {
}
})
},
commitRecord () {
updateDate({
'recordResultId': this.recordResultId,
'monthTime': this.dataForm.monthTime
}).then(data => {
if (data && data.code === 0) {
this.$emit('refreshDataList', this.recordResultId)
this.visible = false
this.alertInfo('更新成功')
} else {
this.alertInfo(data.msg)
}
})
},
stringIsNull (str) {
if (typeof str === 'undefined' || str === null || str === '') {
return true
}
return false
}
}
}
</script>

View File

@ -63,7 +63,7 @@
<el-table-column prop="monthTime" header-align="center" align="center" label="月份">
<template slot-scope="scope">
<div class="conatnt-name">
<span>{{ scope.row.monthTime | formaterDate }}</span>
<a class="formaterDateCss" @click="handleDateAddOrUpdate(scope.row.id)">{{ scope.row.monthTime | formaterDate }}</a>
</div>
</template>
</el-table-column>
@ -107,12 +107,14 @@
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
<date-add-or-update v-if="dateAddOrUpdateVisible" ref="dateAddOrUpdate" @refreshDataList="getDataList"></date-add-or-update>
</div>
</template>
<script>
import AddOrUpdate from './lzresultrecord-add-or-update'
import DateAddOrUpdate from './date-add-or-update'
import {apiGetResultRecordList, departmentQuery, deleteRecord} from '@/api/api_result'
import {getDataForMonth} from '@/utils'
@ -186,13 +188,15 @@ export default {
departmentList1: [],
departmentList2: [],
departmentList3: [],
addOrUpdateVisible: false
addOrUpdateVisible: false,
dateAddOrUpdateVisible: false
}
},
computed: {},
components: {
AddOrUpdate
AddOrUpdate,
DateAddOrUpdate
},
activated () {
this.getDataList()
@ -297,6 +301,14 @@ export default {
this.mainTabsActiveName = this.$route.name
})
},
handleDateAddOrUpdate (id) {
this.dateAddOrUpdateVisible = true
this.$nextTick(() => {
setTimeout(() => {
this.$refs.dateAddOrUpdate.init(id)
}, 500)
})
},
//
deleteHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
@ -337,5 +349,15 @@ export default {
.btn-box{
margin-bottom: 10px;
}
.formaterDateCss{
cursor: pointer;
color: blue;
}
.formaterDateCss :hover{
text-decoration: underline;
}
</style>