增删改查over
This commit is contained in:
@@ -19,7 +19,13 @@ const removeBatchRoadSoundBill = function (ids) {
|
|||||||
const updateRoadSoundBill = function (data) {
|
const updateRoadSoundBill = function (data) {
|
||||||
return axios.put("/collect/sound/road/bill",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';
|
const pageRoadSoundUrl = '/collect/sound/road/page';
|
||||||
// 添加
|
// 添加
|
||||||
@@ -46,6 +52,8 @@ export {
|
|||||||
removeRoadSoundBill,
|
removeRoadSoundBill,
|
||||||
updateRoadSoundBill,
|
updateRoadSoundBill,
|
||||||
removeBatchRoadSoundBill,
|
removeBatchRoadSoundBill,
|
||||||
|
verifyRoadSoundBill,
|
||||||
|
getRoadSoundBill,
|
||||||
pageRoadSoundUrl,
|
pageRoadSoundUrl,
|
||||||
saveRoadSound,
|
saveRoadSound,
|
||||||
removeRoadSound,
|
removeRoadSound,
|
||||||
|
|||||||
@@ -4,17 +4,25 @@
|
|||||||
<!-- 搜索表单 -->
|
<!-- 搜索表单 -->
|
||||||
<a-form :model="where" :labelCol="{ offset: 1}">
|
<a-form :model="where" :labelCol="{ offset: 1}">
|
||||||
<a-row>
|
<a-row>
|
||||||
<a-col :lg="8" :md="12" :sm="24" :xs="24">
|
<a-col :lg="6" :md="12" :sm="24" :xs="24">
|
||||||
|
<a-form-item label="审核状态:">
|
||||||
|
<a-select v-model:value="where.checked" allowClear placeholder="全部">
|
||||||
|
<a-select-option value="1">已审核</a-select-option>
|
||||||
|
<a-select-option value="0">未审核</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :lg="6" :md="12" :sm="24" :xs="24">
|
||||||
<a-form-item label="表格名称:">
|
<a-form-item label="表格名称:">
|
||||||
<a-input v-model:value.trim="where.billName" placeholder="请输入" allow-clear />
|
<a-input v-model:value.trim="where.billName" placeholder="请输入" allow-clear />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :lg="8" :md="12" :sm="24" :xs="24">
|
<a-col :lg="6" :md="12" :sm="24" :xs="24">
|
||||||
<a-form-item label="上报时间:">
|
<a-form-item label="上报时间:">
|
||||||
<a-range-picker separator="/" v-model:value="where.createTime" />
|
<a-range-picker separator="~" v-model:value="reportTimeScope" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :lg="8" :md="12" :sm="24" :xs="24">
|
<a-col :lg="6" :md="12" :sm="24" :xs="24">
|
||||||
<a-form-item class="ele-text-right" :wrapper-col="{span: 24}">
|
<a-form-item class="ele-text-right" :wrapper-col="{span: 24}">
|
||||||
<a-space>
|
<a-space>
|
||||||
<a-button type="primary" @click="reload">查询</a-button>
|
<a-button type="primary" @click="reload">查询</a-button>
|
||||||
@@ -22,7 +30,7 @@
|
|||||||
</a-space>
|
</a-space>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
|
||||||
</a-row>
|
</a-row>
|
||||||
</a-form>
|
</a-form>
|
||||||
<!-- 表格 -->
|
<!-- 表格 -->
|
||||||
@@ -51,17 +59,34 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
<template #reportTime="{ text, record }">
|
||||||
|
<div class="editable-cell">
|
||||||
|
<div v-if="editableData[record.roadSoundBillId]" class="editable-cell-input-wrapper">
|
||||||
|
<a-date-picker v-model:value="editableData[record.roadSoundBillId].reportTime"></a-date-picker>
|
||||||
|
<!-- <a-input v-model:value="editableData[record.roadSoundBillId].reportTime" @pressEnter="save(record)" /> -->
|
||||||
|
<check-outlined class="editable-cell-icon-check" @click="save(record)" />
|
||||||
|
</div>
|
||||||
|
<div v-else class="editable-cell-text-wrapper">
|
||||||
|
{{ $util.toDateString(text,'yyyy-MM-dd') || ' ' }}
|
||||||
|
<edit-outlined class="editable-cell-icon" @click="edit(record)" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template #checked="{text}">
|
||||||
|
<span>
|
||||||
|
<a-tag v-if="text" color="green">已审核</a-tag>
|
||||||
|
<a-tag v-else color="orange">未审核</a-tag>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
<template #action="{ record }">
|
<template #action="{ record }">
|
||||||
<a-space>
|
<a-space>
|
||||||
|
<a-button @click="detail(record)" shape="round" size="small">查看</a-button>
|
||||||
<a-button @click="detail(record)" shape="round" size="small">查看</a-button>
|
<a-popconfirm :title="`审核通过后将无法修改,确认?`" ok-text="Yes" cancel-text="No" @confirm="verify(record)">
|
||||||
<a-popconfirm :title="`审核通过后将无法修改,确认?`" ok-text="Yes" cancel-text="No" @confirm="remove(record)">
|
|
||||||
<a-button type="primary" shape="round" size="small">审核</a-button>
|
<a-button type="primary" shape="round" size="small">审核</a-button>
|
||||||
</a-popconfirm>
|
</a-popconfirm>
|
||||||
<a-popconfirm :title="`确认删除${record.billName}吗?`" ok-text="Yes" cancel-text="No" @confirm="remove(record)">
|
<a-popconfirm :title="`确认删除${record.billName}吗?`" ok-text="Yes" cancel-text="No" @confirm="remove(record)">
|
||||||
<a-button type="primary" danger shape="round" size="small">删除</a-button>
|
<a-button type="primary" danger shape="round" size="small">删除</a-button>
|
||||||
</a-popconfirm>
|
</a-popconfirm>
|
||||||
|
|
||||||
</a-space>
|
</a-space>
|
||||||
</template>
|
</template>
|
||||||
</ele-pro-table>
|
</ele-pro-table>
|
||||||
@@ -82,9 +107,11 @@
|
|||||||
saveRoadSoundBill,
|
saveRoadSoundBill,
|
||||||
removeRoadSoundBill,
|
removeRoadSoundBill,
|
||||||
removeBatchRoadSoundBill,
|
removeBatchRoadSoundBill,
|
||||||
updateRoadSoundBill
|
updateRoadSoundBill,
|
||||||
|
verifyRoadSoundBill
|
||||||
} from "@/api/ecology/road_sound";
|
} from "@/api/ecology/road_sound";
|
||||||
import utils from "./utils";
|
import utils from "./utils";
|
||||||
|
import moment from "moment";
|
||||||
export default {
|
export default {
|
||||||
name: 'RoadSound',
|
name: 'RoadSound',
|
||||||
components: {
|
components: {
|
||||||
@@ -131,9 +158,12 @@
|
|||||||
title: '上报时间',
|
title: '上报时间',
|
||||||
dataIndex: 'reportTime',
|
dataIndex: 'reportTime',
|
||||||
sorter: true,
|
sorter: true,
|
||||||
customRender: ({
|
slots: {
|
||||||
text
|
customRender: 'reportTime',
|
||||||
}) => this.$util.toDateString(text)
|
},
|
||||||
|
// customRender: ({
|
||||||
|
// text
|
||||||
|
// }) => this.$util.toDateString(text)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '导入时间',
|
title: '导入时间',
|
||||||
@@ -143,6 +173,15 @@
|
|||||||
text
|
text
|
||||||
}) => this.$util.toDateString(text)
|
}) => this.$util.toDateString(text)
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: '审核状态',
|
||||||
|
dataIndex: 'checked',
|
||||||
|
sorter: true,
|
||||||
|
slots: {
|
||||||
|
customRender: 'checked',
|
||||||
|
},
|
||||||
|
|
||||||
|
},
|
||||||
// {
|
// {
|
||||||
// title: '更新时间',
|
// title: '更新时间',
|
||||||
// dataIndex: 'updateTime',
|
// dataIndex: 'updateTime',
|
||||||
@@ -163,6 +202,7 @@
|
|||||||
],
|
],
|
||||||
// 表格搜索条件
|
// 表格搜索条件
|
||||||
where: {},
|
where: {},
|
||||||
|
reportTimeScope: [],
|
||||||
// 表格选中数据
|
// 表格选中数据
|
||||||
selectionList: [],
|
selectionList: [],
|
||||||
editableData: {},
|
editableData: {},
|
||||||
@@ -175,6 +215,12 @@
|
|||||||
|
|
||||||
/* 刷新表格 */
|
/* 刷新表格 */
|
||||||
reload() {
|
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({
|
this.$refs.table.reload({
|
||||||
where: this.where
|
where: this.where
|
||||||
});
|
});
|
||||||
@@ -182,6 +228,7 @@
|
|||||||
/* 重置搜索 */
|
/* 重置搜索 */
|
||||||
reset() {
|
reset() {
|
||||||
this.where = {};
|
this.where = {};
|
||||||
|
this.reportTimeScope = [];
|
||||||
this.reload();
|
this.reload();
|
||||||
},
|
},
|
||||||
detail(record) {
|
detail(record) {
|
||||||
@@ -191,26 +238,53 @@
|
|||||||
},
|
},
|
||||||
edit(record) {
|
edit(record) {
|
||||||
this.editableData[record.roadSoundBillId] = _.cloneDeep(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) {
|
save(record) {
|
||||||
const hide = this.$message.loading('请求中..', 0);
|
|
||||||
const {
|
let {
|
||||||
roadSoundBillId,
|
roadSoundBillId,
|
||||||
billName
|
billName,
|
||||||
|
reportTime
|
||||||
} = this.editableData[record.roadSoundBillId];
|
} = 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({
|
updateRoadSoundBill({
|
||||||
roadSoundBillId,
|
roadSoundBillId,
|
||||||
billName
|
billName,
|
||||||
|
reportTime
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res.data.code == 0) {
|
if (res.data.code == 0) {
|
||||||
this.$message.success(res.data.msg);
|
this.$message.success(res.data.msg);
|
||||||
record.billName = billName;
|
record.billName = billName;
|
||||||
|
record.reportTime = reportTime
|
||||||
} else {
|
} else {
|
||||||
this.$message.error(res.data.msg);
|
this.$message.error(res.data.msg);
|
||||||
}
|
}
|
||||||
}).catch(e => {
|
}).catch(e => {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
// this.$message.error(e.msg);
|
this.$message.error(e.message);
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
delete this.editableData[record.roadSoundBillId]
|
delete this.editableData[record.roadSoundBillId]
|
||||||
hide()
|
hide()
|
||||||
|
|||||||
@@ -6,8 +6,26 @@
|
|||||||
:wrapper-col="{md: {span: 18}, sm: {span: 24}}">
|
:wrapper-col="{md: {span: 18}, sm: {span: 24}}">
|
||||||
<a-row>
|
<a-row>
|
||||||
<a-col :lg="6" :md="12" :sm="24" :xs="24">
|
<a-col :lg="6" :md="12" :sm="24" :xs="24">
|
||||||
<a-form-item label="菜单名称:">
|
<a-form-item label="测点名称:">
|
||||||
<a-input v-model:value.trim="where.title" placeholder="请输入" allow-clear />
|
<a-input v-model:value.trim="where.place" placeholder="请输入测点名称" allow-clear />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :lg="6" :md="12" :sm="24" :xs="24">
|
||||||
|
<a-form-item label="路段:">
|
||||||
|
<a-input v-model:value.trim="where.road" placeholder="请输入路段名称" allow-clear />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :lg="6" :md="12" :sm="24" :xs="24">
|
||||||
|
<a-form-item label="城区">
|
||||||
|
<a-input v-model:value.trim="where.area" placeholder="请输入城区名称" allow-clear />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :lg="6" :md="12" :sm="24" :xs="24">
|
||||||
|
<a-form-item class="ele-text-right" :wrapper-col="{span: 24}">
|
||||||
|
<a-space>
|
||||||
|
<a-button type="primary" @click="reload">查询</a-button>
|
||||||
|
<a-button @click="reset">重置</a-button>
|
||||||
|
</a-space>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
@@ -123,7 +141,7 @@
|
|||||||
<!-- 表格 -->
|
<!-- 表格 -->
|
||||||
<ele-pro-table v-model:selection="selectionList" ref="table" row-key="roadSoundId" :datasource="url"
|
<ele-pro-table v-model:selection="selectionList" ref="table" row-key="roadSoundId" :datasource="url"
|
||||||
:columns="columns" :where="where" :scroll="{x: 'max-content'}">
|
:columns="columns" :where="where" :scroll="{x: 'max-content'}">
|
||||||
<template #toolbar>
|
<template v-if="bill.checked != 1" #toolbar>
|
||||||
<a-space>
|
<a-space>
|
||||||
<a-button @click="openEdit" type="primary">新增</a-button>
|
<a-button @click="openEdit" type="primary">新增</a-button>
|
||||||
<a-popconfirm :disabled="selectionList.length == 0" :title="`确认删除${selectionList.length}条数据吗?`"
|
<a-popconfirm :disabled="selectionList.length == 0" :title="`确认删除${selectionList.length}条数据吗?`"
|
||||||
@@ -156,6 +174,7 @@
|
|||||||
removeRoadSound,
|
removeRoadSound,
|
||||||
removeBatchRoadSound,
|
removeBatchRoadSound,
|
||||||
updateRoadSound,
|
updateRoadSound,
|
||||||
|
getRoadSoundBill
|
||||||
} from "@/api/ecology/road_sound";
|
} from "@/api/ecology/road_sound";
|
||||||
import locale from 'ant-design-vue/es/date-picker/locale/zh_CN';
|
import locale from 'ant-design-vue/es/date-picker/locale/zh_CN';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
@@ -170,21 +189,12 @@
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
locale,
|
locale,
|
||||||
|
bill:{},
|
||||||
// 表格数据接口
|
// 表格数据接口
|
||||||
url: pageRoadSoundUrl,
|
url: pageRoadSoundUrl,
|
||||||
selection: [],
|
selection: [],
|
||||||
// 表格列配置
|
// 表格列配置
|
||||||
columns: [
|
columns: [
|
||||||
// {
|
|
||||||
// title: '序号',
|
|
||||||
// key: 'index',
|
|
||||||
// dataIndex: 'index',
|
|
||||||
// width: 48,
|
|
||||||
// align: 'center',
|
|
||||||
// customRender: ({
|
|
||||||
// index
|
|
||||||
// }) => index + 1
|
|
||||||
// },
|
|
||||||
{
|
{
|
||||||
title: '监测日期',
|
title: '监测日期',
|
||||||
dataIndex: 'monitorTime',
|
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: {
|
methods: {
|
||||||
/* 刷新表格 */
|
/* 刷新表格 */
|
||||||
reload() {
|
reload() {
|
||||||
|
|||||||
Reference in New Issue
Block a user