diff --git a/src/api/ecology/road_sound.js b/src/api/ecology/road_sound.js index 0646bb8..fb55334 100644 --- a/src/api/ecology/road_sound.js +++ b/src/api/ecology/road_sound.js @@ -19,7 +19,13 @@ const removeBatchRoadSoundBill = function (ids) { const updateRoadSoundBill = function (data) { return axios.put("/collect/sound/road/bill",data) } - +// 审核 +const verifyRoadSoundBill = function (data) { + return axios.put("/collect/sound/road/bill/verify",data); +} +const getRoadSoundBill = function (id) { + return axios.get(`/collect/sound/road/bill/${id}`) +} // -------------------------数据--------------------- const pageRoadSoundUrl = '/collect/sound/road/page'; // 添加 @@ -46,6 +52,8 @@ export { removeRoadSoundBill, updateRoadSoundBill, removeBatchRoadSoundBill, + verifyRoadSoundBill, + getRoadSoundBill, pageRoadSoundUrl, saveRoadSound, removeRoadSound, diff --git a/src/views/collect/sound/road/index.vue b/src/views/collect/sound/road/index.vue index cbd9075..f07d1e1 100644 --- a/src/views/collect/sound/road/index.vue +++ b/src/views/collect/sound/road/index.vue @@ -4,17 +4,25 @@ - + + + + 已审核 + 未审核 + + + + - + - + - + 查询 @@ -22,7 +30,7 @@ - + @@ -51,17 +59,34 @@ + + + + + + + + + {{ $util.toDateString(text,'yyyy-MM-dd') || ' ' }} + + + + + + + 已审核 + 未审核 + + - - 查看 - + 查看 + 审核 删除 - @@ -82,9 +107,11 @@ saveRoadSoundBill, removeRoadSoundBill, removeBatchRoadSoundBill, - updateRoadSoundBill + updateRoadSoundBill, + verifyRoadSoundBill } from "@/api/ecology/road_sound"; import utils from "./utils"; + import moment from "moment"; export default { name: 'RoadSound', components: { @@ -131,9 +158,12 @@ title: '上报时间', dataIndex: 'reportTime', sorter: true, - customRender: ({ - text - }) => this.$util.toDateString(text) + slots: { + customRender: 'reportTime', + }, + // customRender: ({ + // text + // }) => this.$util.toDateString(text) }, { title: '导入时间', @@ -143,6 +173,15 @@ text }) => this.$util.toDateString(text) }, + { + title: '审核状态', + dataIndex: 'checked', + sorter: true, + slots: { + customRender: 'checked', + }, + + }, // { // title: '更新时间', // dataIndex: 'updateTime', @@ -163,6 +202,7 @@ ], // 表格搜索条件 where: {}, + reportTimeScope: [], // 表格选中数据 selectionList: [], editableData: {}, @@ -175,6 +215,12 @@ /* 刷新表格 */ reload() { + this.where.reportTimeStart = null; + this.where.reportTimeEnd = null; + if (this.reportTimeScope && this.reportTimeScope.length == 2) { + this.where.reportTimeStart = this.reportTimeScope[0].format("Y-M-D H:m:s") + this.where.reportTimeEnd = this.reportTimeScope[1].format("Y-M-D H:m:s") + } this.$refs.table.reload({ where: this.where }); @@ -182,6 +228,7 @@ /* 重置搜索 */ reset() { this.where = {}; + this.reportTimeScope = []; this.reload(); }, detail(record) { @@ -191,26 +238,53 @@ }, edit(record) { this.editableData[record.roadSoundBillId] = _.cloneDeep(record); + this.editableData[record.roadSoundBillId].reportTime = moment(this.editableData[record.roadSoundBillId] + .reportTime) + }, + verify(record) { + const hide = this.$message.loading('请求中..', 0); + verifyRoadSoundBill({roadSoundBillId:record.roadSoundBillId}).then(res => { + if (res.data.code == 0) { + record.checked = 1 + this.$message.success(res.data.msg); + } else { + this.$message.error(res.data.msg); + } + }).catch((e) => { + this.$message.error(e.message); + }).finally(() => { + hide(); + }) }, save(record) { - const hide = this.$message.loading('请求中..', 0); - const { + + let { roadSoundBillId, - billName + billName, + reportTime } = this.editableData[record.roadSoundBillId]; + if (!roadSoundBillId || !reportTime) { + this.$message.error('请填写完整信息再提交') + return + } + const hide = this.$message.loading('请求中..', 0); + reportTime = reportTime.format("x") + reportTime = Number(reportTime) updateRoadSoundBill({ roadSoundBillId, - billName + billName, + reportTime }).then(res => { if (res.data.code == 0) { this.$message.success(res.data.msg); record.billName = billName; + record.reportTime = reportTime } else { this.$message.error(res.data.msg); } }).catch(e => { console.log(e); - // this.$message.error(e.msg); + this.$message.error(e.message); }).finally(() => { delete this.editableData[record.roadSoundBillId] hide() diff --git a/src/views/collect/sound/road/table.vue b/src/views/collect/sound/road/table.vue index 12a3365..85c985f 100644 --- a/src/views/collect/sound/road/table.vue +++ b/src/views/collect/sound/road/table.vue @@ -6,8 +6,26 @@ :wrapper-col="{md: {span: 18}, sm: {span: 24}}"> - - + + + + + + + + + + + + + + + + + + 查询 + 重置 + @@ -123,7 +141,7 @@ - + 新增 index + 1 - // }, { title: '监测日期', dataIndex: 'monitorTime', @@ -317,6 +327,17 @@ }; }, + mounted(){ + const { + billId + } = this.$route.params + getRoadSoundBill(billId).then(res=>{ + this.bill = res.data.data + if(res.data.data.checked == 1){ + this.columns.splice(this.columns.length-1,1) + } + }) + }, methods: { /* 刷新表格 */ reload() {