main
bibi 3 years ago
parent 7a8fbb2b5a
commit da5102d6e6

@ -14,6 +14,7 @@
"less-loader": "5.0.0", "less-loader": "5.0.0",
"momen": "^0.0.1-security", "momen": "^0.0.1-security",
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
"qrcodejs2": "^0.0.2",
"vue": "^2.6.11", "vue": "^2.6.11",
"vue-router": "^3.5.3", "vue-router": "^3.5.3",
"vuex": "^3.6.2" "vuex": "^3.6.2"

@ -2,44 +2,51 @@ import httpService from "@/request"
// 路线 // 路线
export function routerList(params) { export function routeList(params) {
return httpService({ return httpService({
url: `/user/inspectionRouter/list`, url: `/user/inspectionRoute/list`,
method: 'get', method: 'get',
params: params, params: params,
}) })
} }
export function routerisEnable(params) { export function routeisEnable(params) {
return httpService({ return httpService({
url: `/user/inspectionRouter/isEnable`, url: `/user/inspectionRoute/isEnable`,
method: 'get', method: 'get',
params: params, params: params,
}) })
} }
export function routerInfo(params) { export function pointSelect(params) {
return httpService({ return httpService({
url: `/user/inspectionRouter/findById`, url: `/user/inspectionPoint/allList`,
method: 'get', method: 'get',
params: params, params: params,
}) })
} }
export function routerInsert(params) { export function routeInfo(params) {
return httpService({ return httpService({
url: `/user/inspectionRouter/insert`, url: `/user/inspectionRoute/findById`,
method: 'get',
params: params,
})
}
export function routeInsert(params) {
return httpService({
url: `/user/inspectionRoute/insert`,
method: 'post', method: 'post',
data: params, data: params,
}) })
} }
export function routerDel(params) { export function routeDel(params) {
return httpService({ return httpService({
url: `/user/inspectionRouter/delete`, url: `/user/inspectionRoute/delete`,
method: 'post', method: 'post',
data: params, data: params,
}) })
} }
export function routerUpdate(params) { export function routeUpdate(params) {
return httpService({ return httpService({
url: `/user/inspectionRouter/update`, url: `/user/inspectionRoute/update`,
method: 'post', method: 'post',
data: params, data: params,
}) })

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

@ -50,6 +50,14 @@ export default [
component: resolve => require(['@/views/Operation/InspectionManage/_inspectionPlan'], resolve), component: resolve => require(['@/views/Operation/InspectionManage/_inspectionPlan'], resolve),
meta: {title: '巡检计划'}, meta: {title: '巡检计划'},
}, },
{
path: '/InspectionManage/InspectionExecute',
name: "InspectionExecute",
title: "巡检记录",
hide: false,
component: resolve => require(['@/views/Operation/InspectionManage/_inspectionExecute/index.vue'], resolve),
meta: {title: '巡检记录'},
},
] ]
}, },
{ {

@ -0,0 +1,80 @@
export const formItem = [
{
type: 'select',
label:'资讯分类',
prop:'categoryId',
option:[],
placeholder:'请选择'
},
{
type: 'select',
label:'发布状态',
prop:'status',
option:[{ id:1,name:'未发布'},{ id:2,name:'已发布'},],
placeholder:'请选择状态'
},
{
type: 'time',
label:'创建时间',
start: 'createStartDate',
end:'createEndDate',
},
{
type: 'input',
label:'标题',
prop:'title',
placeholder:'请输入'
},
]
export const columns = [
{
title: "标题",
dataIndex: "title",
width: "10%",
},
{
title: "分类",
dataIndex: "categoryName",
width: "10%",
},
{
title: "发布状态",
dataIndex: "status",
width: "6%",
customRender: function (status) {
switch (status) {
case 1:
return '未发布'
case 2:
return '已发布'
}
}
},
{
title: "阅读量",
dataIndex: "viewsNum",
width: "10%",
},
{
title: "创建时间",
dataIndex: "createDate",
width: "12%",
},
{
title: "操作",
dataIndex: "action",
key: "action",
width: "180",
fixed: "right",
scopedSlots: { customRender: "action" },
},
]
export const pagination = {
current: 1,
total: 0,
pageSize: 10,
showTotal: (total) => `${total}`,
showSizeChanger: true,
showQuickJumper: true,
}

@ -0,0 +1,21 @@
export const form = {
id:undefined,
title:undefined,
categoryId:undefined,
status:undefined,
content:undefined,
imgUrls:[]
}
export const rules = {
title:[{required:true,message:'请输入标题',trigger:'blur'}],
categoryId:[{required:true,message:'请选择分类',trigger:'change'}],
status:[{required:true,message:'请选择',trigger:'change'}],
content:[{required:true,message:'请输入',trigger:'blur'}],
}
export const options = {
status:[
{ id:1, name:'未发布' },
{ id:2, name:'已发布' },
],
categoryId:[]
}

@ -0,0 +1,201 @@
<template>
<div>
<a-drawer
:title="title"
:width="720"
:visible="show"
:body-style="{ paddingBottom: '80px' }"
@close="addClose"
>
<div class="drawer-content">
基本信息
<a-divider></a-divider>
<a-form-model
ref="ruleForm"
:model="form"
:rules="rules"
layout="vertical"
>
<a-row>
<a-col :span="12">
<a-form-model-item prop="title" label="标题">
<a-input
v-model="form.title"
placeholder="请输入标题"
style="width: 80%"
></a-input>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item prop="categoryId" label="资讯分类">
<a-select
v-model="form.categoryId"
placeholder="请选择"
style="width: 80%"
>
<a-select-option
v-for="item in options.categoryId"
:key="item.id"
:value="item.id"
>{{ item.name }}</a-select-option
>
</a-select>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item prop="status" label="发布状态">
<a-select
v-model="form.status"
placeholder="请选择"
style="width: 80%"
>
<a-select-option
v-for="item in options.status"
:key="item.id"
:value="item.id"
>{{ item.name }}</a-select-option
>
</a-select>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item prop="content" label="内容">
<a-textarea
v-model="form.content"
placeholder="请输入内容"
style="width: 80%"
></a-textarea>
</a-form-model-item>
</a-col>
<a-col :span="24">
资讯封面图片
<commonUpload
:fileList="fileList"
@handleChange="handleChange"
></commonUpload>
</a-col>
</a-row>
</a-form-model>
</div>
<div class="drawer-footer">
<a-button :style="{ marginRight: '8px' }" @click="addClose">
关闭
</a-button>
<a-button type="primary" @click="submit"> </a-button>
</div>
</a-drawer>
</div>
</template>
<script>
import { form, rules, options } from "./form.js";
import {
newsInsert,
newsUpdate,
newsInfo,
itemSelect
} from "@/api/operation/news/index.js";
export default {
props: {
show: {
type: Boolean,
default: false,
},
editId: Number,
},
data() {
return {
title: "新增资讯",
form,
rules,
options,
fileList: [],
};
},
mounted() {
this.getItem();
},
methods: {
async getItem() {
let res = await itemSelect();
this.options.categoryId = res.data;
},
addClose() {
this.$refs.ruleForm.resetFields();
this.fileList = [];
this.form.imgUrls = [];
this.$emit("addClose");
},
success() {
this.$emit("success");
this.addClose();
},
submit() {
this.$refs.ruleForm.validate(async (valid) => {
if (valid) {
if (this.editId === null) {
let res = await newsInsert(this.form);
if (res.code === 200) {
this.$message.success(res.msg);
this.success();
} else {
this.$message.error(res.msg);
}
} else {
console.log(this.form);
let res = await newsUpdate(this.form);
if (res.code === 200) {
this.$message.success(res.msg);
this.success();
} else {
this.$message.error(res.msg);
}
}
}
});
},
handleChange(data) {
this.fileList = data;
if (data[0].status === "done") {
console.log("-------done-------");
this.form.imgUrls.push(data[0].response.data);
}
},
},
watch: {
editId: {
handler(val) {
if (val !== null) {
this.title = "修改资讯";
this.form.id = val;
newsInfo({ informationId: val }).then((res) => {
this.form = res.data;
if (res.data.imgList.length > 0) {
console.log(res.data.imgList);
const pic = [];
for (let item of res.data.imgList) {
let obj = {
name: item.url.split("_")[0] + "." + item.url.split(".")[1],
url: this.$ImgUrl(item.url),
uid: item.url.split("_")[1],
status: "done",
thumbUrl: this.$ImgUrl(item.url),
};
pic.push(obj);
}
this.fileList = pic;
} else {
this.form.imgUrls = [];
}
});
} else {
this.title = "新增资讯";
}
},
immediate: true,
},
},
};
</script>
<style></style>

@ -0,0 +1,190 @@
<template>
<div>
<div class="cardTitle">资讯管理</div>
<searchForm :formItem="formItem" @getSearch="getData($event)" @changeTime='changeTime'></searchForm>
<a-button style="margin: 10px" class="add-btn" @click="drawer.show = true"
>新增资讯</a-button
>
<a-table
:columns="columns"
:data-source="tableData"
:pagination="pagination"
:scroll="{ x: 2600 }"
@change="handleTableChange"
:row-selection="{
selectedRowKeys: selectedRowKeys,
onChange: selectionChoosed,
}"
:row-key="
(record, index) => {
return record.id;
}
"
>
<span slot="action" slot-scope="text, row">
<a-space>
<a class="ant-dropdown-link" @click="detail(row.id)"></a>
<a class="ant-dropdown-link" @click="edit(row.id)"></a>
<a class="ant-dropdown-link" @click="del([row.id])"></a>
</a-space>
</span>
</a-table>
<div class="action">
<a-dropdown :disabled="!hasSelected">
<a-menu slot="overlay" @click="handleMenuClick">
<a-menu-item key="del"> 批量删除 </a-menu-item>
</a-menu>
<a-button> 批量操作 <a-icon type="down" /> </a-button>
</a-dropdown>
<span style="margin-left: 8px">
<template v-if="hasSelected">
{{ `已选择 ${selectedRowKeys.length}` }}
</template>
</span>
</div>
<addForm
:show="drawer.show"
@success="success"
@addClose="addClose"
:editId="editId"
></addForm>
<detailForm :detailId="detailId" :show="drawer.detail" @detailClose="detailClose"></detailForm>
</div>
</template>
<script>
import { newsList, newsDel,itemSelect } from "@/api/operation/news/index.js";
import { formItem, columns, pagination } from "./depend/config";
import addForm from "./depend/form.vue";
import detailForm from "./depend/detail.vue";
export default {
components: {
addForm,
detailForm
},
data() {
return {
drawer: {
show: false,
detail:false
},
editId: null,
detailId:null,
tableData: [],
searchForm: {
activityAddress: undefined,
organizerName: undefined,
activityContact: undefined,
activityTel: undefined,
title: undefined,
status: undefined,
registrationStartTime: undefined,
registrationEndTime: undefined,
activityStartTime: undefined,
activityEndTime: undefined,
},
formItem,
columns,
pagination,
// index
selectedRowKeys: [],
};
},
mounted() {
this.getData();
this.getItem();
},
methods: {
async getData(data) {
if (data !== undefined) {
console.log(data);
this.searchForm = data;
console.log(this.searchForm);
}
let res = await newsList({
pageNum: this.pagination.current,
size: this.pagination.pageSize,
...this.searchForm
});
this.tableData = res.data.rows;
this.pagination.total = res.data.total;
this.selectedRowKeys=[]
},
async getItem(){
let res = await itemSelect()
this.formItem[0].option = res.data
},
changeTime(data,start,end){
console.log(start);
this.searchForm[start] = data[0]
this.searchForm[end] = data[1]
console.log(this.searchForm);
},
edit(id) {
this.editId = id;
this.drawer.show = true;
},
del(ids) {
console.log(ids);
this.$confirm({
title: "是否删除",
// okText:'',
// cancelText:'',
icon: "delete",
onOk: async () => {
let res = await newsDel({ informationIds: ids });
if (res.code === 200) {
this.$message.success(res.msg);
this.getData();
} else {
this.$message.error(res.msg);
}
},
});
},
selectionChoosed(data) {
this.selectedRowKeys = data;
},
handleMenuClick(data) {
console.log(data);
if (data.key === "del") {
this.del(this.selectedRowKeys);
}
},
handleTableChange(pagination) {
console.log(pagination);
const pager = { ...this.pagination };
pager.current = pagination.current;
pager.pageSize = pagination.pageSize;
this.pagination = pager;
this.getData();
},
addClose() {
this.drawer.show = false;
this.editId = null;
},
success() {
this.getData();
},
detail(id){
this.drawer.detail = true;
this.detailId = id;
},
detailClose(){
this.detailId = null;
this.drawer.detail = false;
}
},
computed: {
hasSelected() {
return this.selectedRowKeys.length > 0;
},
},
};
</script>
<style lang="less" scoped>
.table-img {
width: 40px;
height: 40px;
}
</style>

@ -1,66 +1,47 @@
export const formItem = [ export const formItem = [
{ {
type: 'select', type: 'input',
label:'资讯分类', label:'编号',
prop:'categoryId', prop:'code',
option:[], placeholder:'请输入'
placeholder:'请选择'
},
{
type: 'select',
label:'发布状态',
prop:'status',
option:[{ id:1,name:'未发布'},{ id:2,name:'已发布'},],
placeholder:'请选择状态'
},
{
type: 'time',
label:'创建时间',
start: 'createStartDate',
end:'createEndDate',
}, },
{ {
type: 'input', type: 'input',
label:'标题', label:'名称',
prop:'title', prop:'name',
placeholder:'请输入' placeholder:'请输入'
}, },
] ]
export const columns = [ export const columns = [
{ {
title: "标题", title: "路线编号",
dataIndex: "title", dataIndex: "code",
width: "10%", },
{
title: "路线名称",
dataIndex: "name",
},
{
title: "持续时间",
dataIndex: "spaceTime",
}, },
{ {
title: "分类", title: "创建时间",
dataIndex: "categoryName", dataIndex: "createDate",
width: "10%",
}, },
{ {
title: "发布状态", title: "状态",
dataIndex: "status", dataIndex: "status",
width: "6%", width: "6%",
customRender: function (status) { customRender: function (status) {
switch (status) { switch (status) {
case 1: case 1:
return '未发布' return '启用'
case 2: case 2:
return '已发布' return '停用'
} }
} }
}, },
{
title: "阅读量",
dataIndex: "viewsNum",
width: "10%",
},
{
title: "创建时间",
dataIndex: "createDate",
width: "12%",
},
{ {
title: "操作", title: "操作",
dataIndex: "action", dataIndex: "action",

@ -1,21 +1,21 @@
export const form = { export const form = {
id:undefined, id:undefined,
title:undefined, name:undefined,
categoryId:undefined, describes:undefined,
status:undefined, status:undefined,
content:undefined, spaceTime:undefined,
imgUrls:[] pointRouteList:[]
} }
export const rules = { export const rules = {
title:[{required:true,message:'请输入标题',trigger:'blur'}], name:[{required:true,message:'请输入路线名称',trigger:'blur'}],
categoryId:[{required:true,message:'请选择分类',trigger:'change'}], describes:[{required:true,message:'请输入描述',trigger:'blur'}],
status:[{required:true,message:'请选择',trigger:'change'}], status:[{required:true,message:'请选择',trigger:'change'}],
content:[{required:true,message:'请输入',trigger:'blur'}], spaceTime:[{required:true,message:'请输入持续时间',trigger:'blur'}],
} }
export const options = { export const options = {
status:[ status:[
{ id:1, name:'未发布' }, { id:1, name:'启用' },
{ id:2, name:'已发布' }, { id:2, name:'停用' },
], ],
categoryId:[] pointList:[]
} }

@ -16,65 +16,25 @@
:rules="rules" :rules="rules"
layout="vertical" layout="vertical"
> >
<a-row> <a-form-model-item prop='name' label='路线名称'>
<a-col :span="12"> <a-input v-model="form.name" placeholder="请输入" style="width:60%"></a-input>
<a-form-model-item prop="title" label="标题"> </a-form-model-item>
<a-input <a-form-model-item prop='describes' label='描述'>
v-model="form.title" <a-input v-model="form.describes" placeholder="请输入" style="width:60%"></a-input>
placeholder="请输入标题" </a-form-model-item>
style="width: 80%" <a-form-model-item prop='status' label='状态' v-if="title==='新增巡检路线'">
></a-input> <a-select v-model="form.status" placeholder="请输入" style="width:60%">
</a-form-model-item> <a-select-option v-for="item in options.status" :key="item.id" :value="item.id">{{item.name}}</a-select-option>
</a-col> </a-select>
<a-col :span="12"> </a-form-model-item>
<a-form-model-item prop="categoryId" label="资讯分类"> <a-form-model-item prop='spaceTime' label='持续时间'>
<a-select <a-input-number v-model="form.spaceTime" placeholder="请输入" style="width:60%"></a-input-number>
v-model="form.categoryId" </a-form-model-item>
placeholder="请选择" <a-form-model-item prop='pointRouteList' label='巡检路线'>
style="width: 80%" <a-select mode="multiple" v-model="selectPoint" placeholder="请选择" style="width:60%">
> <a-select-option v-for="item in options.pointList" :key="item.id" :value="item.id">{{item.name}}</a-select-option>
<a-select-option </a-select>
v-for="item in options.categoryId" </a-form-model-item>
:key="item.id"
:value="item.id"
>{{ item.name }}</a-select-option
>
</a-select>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item prop="status" label="发布状态">
<a-select
v-model="form.status"
placeholder="请选择"
style="width: 80%"
>
<a-select-option
v-for="item in options.status"
:key="item.id"
:value="item.id"
>{{ item.name }}</a-select-option
>
</a-select>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item prop="content" label="内容">
<a-textarea
v-model="form.content"
placeholder="请输入内容"
style="width: 80%"
></a-textarea>
</a-form-model-item>
</a-col>
<a-col :span="24">
资讯封面图片
<commonUpload
:fileList="fileList"
@handleChange="handleChange"
></commonUpload>
</a-col>
</a-row>
</a-form-model> </a-form-model>
</div> </div>
<div class="drawer-footer"> <div class="drawer-footer">
@ -90,11 +50,11 @@
<script> <script>
import { form, rules, options } from "./form.js"; import { form, rules, options } from "./form.js";
import { import {
newsInsert, routeInsert,
newsUpdate, routeUpdate,
newsInfo, routeInfo,
itemSelect pointSelect
} from "@/api/operation/news/index.js"; } from "@/api/operation/inspection/route.js";
export default { export default {
props: { props: {
show: { show: {
@ -105,25 +65,25 @@ export default {
}, },
data() { data() {
return { return {
title: "新增资讯", title: "新增巡检路线",
form, form,
rules, rules,
options, options,
fileList: [], selectPoint:[]
}; };
}, },
mounted() { mounted() {
this.getItem(); this.getPoint();
}, },
methods: { methods: {
async getItem() { async getPoint() {
let res = await itemSelect(); let res = await pointSelect();
this.options.categoryId = res.data; this.options.pointList = res.data;
}, },
addClose() { addClose() {
this.$refs.ruleForm.resetFields(); this.$refs.ruleForm.resetFields();
this.fileList = []; this.form.pointRouteList = [];
this.form.imgUrls = []; this.selectPoint = []
this.$emit("addClose"); this.$emit("addClose");
}, },
success() { success() {
@ -131,10 +91,14 @@ export default {
this.addClose(); this.addClose();
}, },
submit() { submit() {
this.form.pointRouteList = []
for(let k in this.selectPoint){
this.form.pointRouteList.push({inspectionPointId:this.selectPoint[k]});
}
this.$refs.ruleForm.validate(async (valid) => { this.$refs.ruleForm.validate(async (valid) => {
if (valid) { if (valid) {
if (this.editId === null) { if (this.editId === null) {
let res = await newsInsert(this.form); let res = await routeInsert(this.form);
if (res.code === 200) { if (res.code === 200) {
this.$message.success(res.msg); this.$message.success(res.msg);
this.success(); this.success();
@ -143,7 +107,7 @@ export default {
} }
} else { } else {
console.log(this.form); console.log(this.form);
let res = await newsUpdate(this.form); let res = await routeUpdate(this.form);
if (res.code === 200) { if (res.code === 200) {
this.$message.success(res.msg); this.$message.success(res.msg);
this.success(); this.success();
@ -154,42 +118,24 @@ export default {
} }
}); });
}, },
handleChange(data) {
this.fileList = data;
if (data[0].status === "done") {
console.log("-------done-------");
this.form.imgUrls.push(data[0].response.data);
}
},
}, },
watch: { watch: {
editId: { editId: {
handler(val) { handler(val) {
if (val !== null) { if (val !== null) {
this.title = "修改资讯"; this.title = "修改巡检路线";
this.selectPoint = []
this.form.id = val; this.form.id = val;
newsInfo({ informationId: val }).then((res) => { routeInfo({ routeId: val }).then((res) => {
this.form = res.data; this.form = res.data;
if (res.data.imgList.length > 0) { if(this.form.routePointList.length>0){
console.log(res.data.imgList); for(let item of this.form.routePointList){
const pic = []; this.selectPoint.push(item.id)
for (let item of res.data.imgList) {
let obj = {
name: item.url.split("_")[0] + "." + item.url.split(".")[1],
url: this.$ImgUrl(item.url),
uid: item.url.split("_")[1],
status: "done",
thumbUrl: this.$ImgUrl(item.url),
};
pic.push(obj);
} }
this.fileList = pic;
} else {
this.form.imgUrls = [];
} }
}); });
} else { } else {
this.title = "新增资讯"; this.title = "新增巡检路线";
} }
}, },
immediate: true, immediate: true,

@ -1,15 +1,14 @@
<template> <template>
<div> <div>
<div class="cardTitle">资讯管理</div> <div class="cardTitle">巡检路线</div>
<searchForm :formItem="formItem" @getSearch="getData($event)" @changeTime='changeTime'></searchForm> <searchForm :formItem="formItem" @getSearch="getData($event)"></searchForm>
<a-button style="margin: 10px" class="add-btn" @click="drawer.show = true" <a-button style="margin: 10px" class="add-btn" @click="drawer.show = true"
>新增资讯</a-button >新增路线</a-button
> >
<a-table <a-table
:columns="columns" :columns="columns"
:data-source="tableData" :data-source="tableData"
:pagination="pagination" :pagination="pagination"
:scroll="{ x: 2600 }"
@change="handleTableChange" @change="handleTableChange"
:row-selection="{ :row-selection="{
selectedRowKeys: selectedRowKeys, selectedRowKeys: selectedRowKeys,
@ -23,8 +22,9 @@
> >
<span slot="action" slot-scope="text, row"> <span slot="action" slot-scope="text, row">
<a-space> <a-space>
<a class="ant-dropdown-link" @click="detail(row.id)"></a>
<a class="ant-dropdown-link" @click="edit(row.id)"></a> <a class="ant-dropdown-link" @click="edit(row.id)"></a>
<a class="ant-dropdown-link" v-if="row.status===2" @click="enable(row.id)"></a>
<a class="ant-dropdown-link" v-else-if="row.status===1" @click="enable(row.id)"></a>
<a class="ant-dropdown-link" @click="del([row.id])"></a> <a class="ant-dropdown-link" @click="del([row.id])"></a>
</a-space> </a-space>
</span> </span>
@ -48,40 +48,27 @@
@addClose="addClose" @addClose="addClose"
:editId="editId" :editId="editId"
></addForm> ></addForm>
<detailForm :detailId="detailId" :show="drawer.detail" @detailClose="detailClose"></detailForm>
</div> </div>
</template> </template>
<script> <script>
import { newsList, newsDel,itemSelect } from "@/api/operation/news/index.js"; import { routeList, routeDel,routeisEnable } from "@/api/operation/inspection/route.js";
import { formItem, columns, pagination } from "./depend/config"; import { formItem, columns, pagination } from "./depend/config";
import addForm from "./depend/form.vue"; import addForm from "./depend/form.vue";
import detailForm from "./depend/detail.vue";
export default { export default {
components: { components: {
addForm, addForm,
detailForm
}, },
data() { data() {
return { return {
drawer: { drawer: {
show: false, show: false,
detail:false
}, },
editId: null, editId: null,
detailId:null,
tableData: [], tableData: [],
searchForm: { searchForm: {
activityAddress: undefined, code: undefined,
organizerName: undefined, name: undefined,
activityContact: undefined,
activityTel: undefined,
title: undefined,
status: undefined,
registrationStartTime: undefined,
registrationEndTime: undefined,
activityStartTime: undefined,
activityEndTime: undefined,
}, },
formItem, formItem,
columns, columns,
@ -92,7 +79,6 @@ export default {
}, },
mounted() { mounted() {
this.getData(); this.getData();
this.getItem();
}, },
methods: { methods: {
async getData(data) { async getData(data) {
@ -101,24 +87,14 @@ export default {
this.searchForm = data; this.searchForm = data;
console.log(this.searchForm); console.log(this.searchForm);
} }
let res = await newsList({ let res = await routeList({
pageNum: this.pagination.current, pageNum: this.pagination.current,
size: this.pagination.pageSize, size: this.pagination.pageSize,
...this.searchForm ...this.searchForm
}); });
this.tableData = res.data.rows; this.tableData = res.data.rows;
this.pagination.total = res.data.total; this.pagination.total = res.data.total;
this.selectedRowKeys=[] this.selectedRowKeys = []
},
async getItem(){
let res = await itemSelect()
this.formItem[0].option = res.data
},
changeTime(data,start,end){
console.log(start);
this.searchForm[start] = data[0]
this.searchForm[end] = data[1]
console.log(this.searchForm);
}, },
edit(id) { edit(id) {
this.editId = id; this.editId = id;
@ -132,7 +108,7 @@ export default {
// cancelText:'', // cancelText:'',
icon: "delete", icon: "delete",
onOk: async () => { onOk: async () => {
let res = await newsDel({ informationIds: ids }); let res = await routeDel({ ids: ids });
if (res.code === 200) { if (res.code === 200) {
this.$message.success(res.msg); this.$message.success(res.msg);
this.getData(); this.getData();
@ -142,6 +118,15 @@ export default {
}, },
}); });
}, },
async enable(id) {
let res = await routeisEnable({ routeId: id });
if (res.code === 200) {
this.$message.success(res.msg);
this.getData();
} else {
this.$message.error(res.msg);
}
},
selectionChoosed(data) { selectionChoosed(data) {
this.selectedRowKeys = data; this.selectedRowKeys = data;
}, },
@ -166,14 +151,6 @@ export default {
success() { success() {
this.getData(); this.getData();
}, },
detail(id){
this.drawer.detail = true;
this.detailId = id;
},
detailClose(){
this.detailId = null;
this.drawer.detail = false;
}
}, },
computed: { computed: {
hasSelected() { hasSelected() {

@ -1,71 +1,43 @@
export const formItem = [ export const formItem = [
{ {
type: 'select', type: 'input',
label:'资讯分类', label:'编号',
prop:'categoryId', prop:'code',
option:[], placeholder:'请输入'
placeholder:'请选择'
},
{
type: 'select',
label:'发布状态',
prop:'status',
option:[{ id:1,name:'未发布'},{ id:2,name:'已发布'},],
placeholder:'请选择状态'
},
{
type: 'time',
label:'创建时间',
start: 'createStartDate',
end:'createEndDate',
}, },
{ {
type: 'input', type: 'input',
label:'标题', label:'名称',
prop:'title', prop:'name',
placeholder:'请输入' placeholder:'请输入'
}, },
] ]
export const columns = [ export const columns = [
{ {
title: "标题", title: "编号",
dataIndex: "title", dataIndex: "code",
width: "10%",
}, },
{ {
title: "分类", title: "名称",
dataIndex: "categoryName", dataIndex: "name",
width: "10%",
}, },
{ {
title: "发布状态", title: "巡检模式",
dataIndex: "status", dataIndex: "type",
width: "6%", customRender: function (type) {
customRender: function (status) { return '扫码'
switch (status) {
case 1:
return '未发布'
case 2:
return '已发布'
}
} }
}, },
{
title: "阅读量",
dataIndex: "viewsNum",
width: "10%",
},
{ {
title: "创建时间", title: "创建时间",
dataIndex: "createDate", dataIndex: "createDate",
width: "12%",
}, },
{ {
title: "操作", title: "操作",
dataIndex: "action", dataIndex: "action",
key: "action", key: "action",
width: "180", width: "280",
fixed: "right", fixed: "right",
scopedSlots: { customRender: "action" }, scopedSlots: { customRender: "action" },
}, },

@ -1,111 +0,0 @@
<template>
<div>
<a-drawer
title="资讯-详情"
:width="720"
:visible="show"
:body-style="{ paddingBottom: '80px' }"
@close="detailClose"
>
<div class="drawer-content">
<div class="content-title">
{{ detailData.title }}
<a-tag color="blue">{{
detailData.status === 1 ? "未发布" : "已发布"
}}</a-tag>
</div>
<a-divider></a-divider>
<a-descriptions>
<a-descriptions-item label="资讯类型">
{{ detailData.categoryName }}
</a-descriptions-item>
<a-descriptions-item label="阅读量">
{{ detailData.viewsNum }}
</a-descriptions-item>
<a-descriptions-item label="创建人">
{{ detailData.createName }}
</a-descriptions-item>
<a-descriptions-item label="创建时间">
{{ detailData.createDate }}
</a-descriptions-item>
</a-descriptions>
<a-descriptions :column="1">
<a-descriptions-item label="资讯内容">
{{ detailData.content }}
</a-descriptions-item>
<a-descriptions-item label="公告封面图">
<img
v-for="(item, index) in detailData.imgList"
:key="index"
:src="$ImgUrl(item.url)"
class="content-img"
/>
</a-descriptions-item>
</a-descriptions>
</div>
<div class="drawer-footer">
<a-button :style="{ marginRight: '8px' }" @click="detailClose">
关闭
</a-button>
</div>
</a-drawer>
</div>
</template>
<script>
import { newsInfo } from "@/api/operation/news/index.js";
export default {
props: {
show: {
type: Boolean,
default: false,
},
detailId: Number,
},
data() {
return {
detailData: {},
};
},
mounted() {},
methods: {
detailClose() {
this.$emit("detailClose");
},
handleTableChange(pagination) {
console.log(pagination);
const pager = { ...this.pagination };
pager.current = pagination.current;
pager.pageSize = pagination.pageSize;
this.pagination = pager;
this.getData();
},
},
watch: {
detailId: {
handler(id) {
if (id !== null && id !== undefined) {
newsInfo({ informationId: id }).then((res) => {
this.detailData = res.data;
});
}
},
immediate: true,
},
},
};
</script>
<style lang="less" scoped>
.content-title {
color: #000000d9;
font-weight: 500;
font-size: 18px;
line-height: 25px;
}
.content-img {
width: 108px;
height: 86px;
}
</style>

@ -1,16 +1,14 @@
export const form = { export const form = {
id:undefined, id:undefined,
title:undefined, name:undefined,
categoryId:undefined, type:undefined,
status:undefined, longitude:undefined,
content:undefined, latitude:undefined,
imgUrls:[] itemsList:[]
} }
export const rules = { export const rules = {
title:[{required:true,message:'请输入标题',trigger:'blur'}], name:[{required:true,message:'请输入名称',trigger:'blur'}],
categoryId:[{required:true,message:'请选择分类',trigger:'change'}], type:[{required:true,message:'请选择分类',trigger:'change'}],
status:[{required:true,message:'请选择',trigger:'change'}],
content:[{required:true,message:'请输入',trigger:'blur'}],
} }
export const options = { export const options = {
status:[ status:[

@ -16,65 +16,30 @@
:rules="rules" :rules="rules"
layout="vertical" layout="vertical"
> >
<a-row> <a-form-model-item label="名称" prop="name">
<a-col :span="12"> <a-input v-model="form.name" style="width: 60%" placeholder="请输入"></a-input>
<a-form-model-item prop="title" label="标题"> </a-form-model-item>
<a-input <a-form-model-item label="类型" prop="type">
v-model="form.title" <a-select v-model="form.type" style="width: 60%" placeholder="请选择">
placeholder="请输入标题" <a-select-option :value="1">扫码</a-select-option>
style="width: 80%" </a-select>
></a-input> </a-form-model-item>
</a-form-model-item> <a-form-model-item label="经度" prop="longitude">
</a-col> <a-input v-model="form.longitude" style="width: 60%" placeholder="请输入"></a-input>
<a-col :span="12"> </a-form-model-item>
<a-form-model-item prop="categoryId" label="资讯分类"> <a-form-model-item label="纬度" prop="latitude">
<a-select <a-input v-model="form.latitude" style="width: 60%" placeholder="请输入"></a-input>
v-model="form.categoryId" </a-form-model-item>
placeholder="请选择" <a-form-model-item label="检查项">
style="width: 80%" <a-select
> style="width: 60%"
<a-select-option v-model="itemArray"
v-for="item in options.categoryId" mode="tags"
:key="item.id" :token-separators="[',']"
:value="item.id" @change="handleChange"
>{{ item.name }}</a-select-option >
> </a-select>
</a-select> </a-form-model-item>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item prop="status" label="发布状态">
<a-select
v-model="form.status"
placeholder="请选择"
style="width: 80%"
>
<a-select-option
v-for="item in options.status"
:key="item.id"
:value="item.id"
>{{ item.name }}</a-select-option
>
</a-select>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item prop="content" label="内容">
<a-textarea
v-model="form.content"
placeholder="请输入内容"
style="width: 80%"
></a-textarea>
</a-form-model-item>
</a-col>
<a-col :span="24">
资讯封面图片
<commonUpload
:fileList="fileList"
@handleChange="handleChange"
></commonUpload>
</a-col>
</a-row>
</a-form-model> </a-form-model>
</div> </div>
<div class="drawer-footer"> <div class="drawer-footer">
@ -90,11 +55,10 @@
<script> <script>
import { form, rules, options } from "./form.js"; import { form, rules, options } from "./form.js";
import { import {
newsInsert, pointInsert,
newsUpdate, pointUpdate,
newsInfo, pointInfo,
itemSelect } from "@/api/operation/inspection/point.js";
} from "@/api/operation/news/index.js";
export default { export default {
props: { props: {
show: { show: {
@ -105,25 +69,23 @@ export default {
}, },
data() { data() {
return { return {
title: "新增资讯", title: "新增巡检点",
form, form,
rules, rules,
options, options,
fileList: [], itemArray: [],
}; };
}, },
mounted() { mounted() {
this.getItem();
}, },
methods: { methods: {
async getItem() { handleChange(value) {
let res = await itemSelect(); console.log(`selected ${value}`);
this.options.categoryId = res.data;
}, },
addClose() { addClose() {
this.$refs.ruleForm.resetFields(); this.$refs.ruleForm.resetFields();
this.fileList = []; this.form.itemsList = [];
this.form.imgUrls = []; this.itemArray=[]
this.$emit("addClose"); this.$emit("addClose");
}, },
success() { success() {
@ -131,10 +93,15 @@ export default {
this.addClose(); this.addClose();
}, },
submit() { submit() {
this.form.itemsList = [];
for (let item in this.itemArray) {
console.log(this.itemArray[item]);
this.form.itemsList.push({ name: this.itemArray[item] });
}
this.$refs.ruleForm.validate(async (valid) => { this.$refs.ruleForm.validate(async (valid) => {
if (valid) { if (valid) {
if (this.editId === null) { if (this.editId === null) {
let res = await newsInsert(this.form); let res = await pointInsert(this.form);
if (res.code === 200) { if (res.code === 200) {
this.$message.success(res.msg); this.$message.success(res.msg);
this.success(); this.success();
@ -143,7 +110,7 @@ export default {
} }
} else { } else {
console.log(this.form); console.log(this.form);
let res = await newsUpdate(this.form); let res = await pointUpdate(this.form);
if (res.code === 200) { if (res.code === 200) {
this.$message.success(res.msg); this.$message.success(res.msg);
this.success(); this.success();
@ -154,42 +121,23 @@ export default {
} }
}); });
}, },
handleChange(data) {
this.fileList = data;
if (data[0].status === "done") {
console.log("-------done-------");
this.form.imgUrls.push(data[0].response.data);
}
},
}, },
watch: { watch: {
editId: { editId: {
handler(val) { handler(val) {
if (val !== null) { if (val !== null) {
this.title = "修改资讯"; this.itemArray = []
this.title = "修改巡检点";
this.form.id = val; this.form.id = val;
newsInfo({ informationId: val }).then((res) => { pointInfo({ inspectionId: val }).then((res) => {
this.form = res.data; this.form = res.data;
if (res.data.imgList.length > 0) { for(let k of this.form.checkItemsList){
console.log(res.data.imgList); // console.log(k.name);
const pic = []; this.itemArray.push(k.name)
for (let item of res.data.imgList) {
let obj = {
name: item.url.split("_")[0] + "." + item.url.split(".")[1],
url: this.$ImgUrl(item.url),
uid: item.url.split("_")[1],
status: "done",
thumbUrl: this.$ImgUrl(item.url),
};
pic.push(obj);
}
this.fileList = pic;
} else {
this.form.imgUrls = [];
} }
}); });
} else { } else {
this.title = "新增资讯"; this.title = "新增巡检点";
} }
}, },
immediate: true, immediate: true,

@ -1,7 +1,11 @@
<template> <template>
<div> <div>
<div class="cardTitle">巡检点</div> <div class="cardTitle">巡检点</div>
<searchForm :formItem="formItem" @getSearch="getData($event)" @changeTime='changeTime'></searchForm> <searchForm
:formItem="formItem"
@getSearch="getData($event)"
@changeTime="changeTime"
></searchForm>
<a-button style="margin: 10px" class="add-btn" @click="drawer.show = true" <a-button style="margin: 10px" class="add-btn" @click="drawer.show = true"
>新增巡更点</a-button >新增巡更点</a-button
> >
@ -9,7 +13,6 @@
:columns="columns" :columns="columns"
:data-source="tableData" :data-source="tableData"
:pagination="pagination" :pagination="pagination"
:scroll="{ x: 2600 }"
@change="handleTableChange" @change="handleTableChange"
:row-selection="{ :row-selection="{
selectedRowKeys: selectedRowKeys, selectedRowKeys: selectedRowKeys,
@ -23,9 +26,11 @@
> >
<span slot="action" slot-scope="text, row"> <span slot="action" slot-scope="text, row">
<a-space> <a-space>
<a class="ant-dropdown-link" @click="detail(row.id)"></a>
<a class="ant-dropdown-link" @click="edit(row.id)"></a> <a class="ant-dropdown-link" @click="edit(row.id)"></a>
<a class="ant-dropdown-link" @click="del([row.id])"></a> <a class="ant-dropdown-link" @click="del([row.id])"></a>
<a class="ant-dropdown-link" @click="qrCodeGeneration(row.code)"
>巡检点二维码</a
>
</a-space> </a-space>
</span> </span>
</a-table> </a-table>
@ -48,40 +53,41 @@
@addClose="addClose" @addClose="addClose"
:editId="editId" :editId="editId"
></addForm> ></addForm>
<detailForm :detailId="detailId" :show="drawer.detail" @detailClose="detailClose"></detailForm> <a-modal title="巡检点二维码" :visible="qr.show" @cancel="qr.show=false" width='300px'>
<!-- 二维码图片 -->
<div id="qrCodeUrl"></div>
<!-- 取消按钮 -->
<span slot="footer" class="dialog-footer">
<a-button @click="qr.show=false"></a-button>
</span>
</a-modal>
</div> </div>
</template> </template>
<script> <script>
import { newsList, newsDel,itemSelect } from "@/api/operation/news/index.js"; import QRCode from "qrcodejs2";
import { pointList, pointDel } from "@/api/operation/inspection/point.js";
import { formItem, columns, pagination } from "./depend/config"; import { formItem, columns, pagination } from "./depend/config";
import addForm from "./depend/form.vue"; import addForm from "./depend/form.vue";
import detailForm from "./depend/detail.vue";
export default { export default {
components: { components: {
addForm, addForm,
detailForm
}, },
data() { data() {
return { return {
drawer: { drawer: {
show: false, show: false,
detail:false detail: false,
},
qr: {
show: false,
}, },
editId: null, editId: null,
detailId:null, detailId: null,
tableData: [], tableData: [],
searchForm: { searchForm: {
activityAddress: undefined, name: undefined,
organizerName: undefined, code: undefined,
activityContact: undefined,
activityTel: undefined,
title: undefined,
status: undefined,
registrationStartTime: undefined,
registrationEndTime: undefined,
activityStartTime: undefined,
activityEndTime: undefined,
}, },
formItem, formItem,
columns, columns,
@ -92,7 +98,6 @@ export default {
}, },
mounted() { mounted() {
this.getData(); this.getData();
this.getItem();
}, },
methods: { methods: {
async getData(data) { async getData(data) {
@ -101,23 +106,19 @@ export default {
this.searchForm = data; this.searchForm = data;
console.log(this.searchForm); console.log(this.searchForm);
} }
let res = await newsList({ let res = await pointList({
pageNum: this.pagination.current, pageNum: this.pagination.current,
size: this.pagination.pageSize, size: this.pagination.pageSize,
...this.searchForm ...this.searchForm,
}); });
this.tableData = res.data.rows; this.tableData = res.data.rows;
this.pagination.total = res.data.total; this.pagination.total = res.data.total;
this.selectedRowKeys=[] this.selectedRowKeys = [];
},
async getItem(){
let res = await itemSelect()
this.formItem[0].option = res.data
}, },
changeTime(data,start,end){ changeTime(data, start, end) {
console.log(start); console.log(start);
this.searchForm[start] = data[0] this.searchForm[start] = data[0];
this.searchForm[end] = data[1] this.searchForm[end] = data[1];
console.log(this.searchForm); console.log(this.searchForm);
}, },
edit(id) { edit(id) {
@ -132,7 +133,7 @@ export default {
// cancelText:'', // cancelText:'',
icon: "delete", icon: "delete",
onOk: async () => { onOk: async () => {
let res = await newsDel({ informationIds: ids }); let res = await pointDel({ ids: ids });
if (res.code === 200) { if (res.code === 200) {
this.$message.success(res.msg); this.$message.success(res.msg);
this.getData(); this.getData();
@ -145,6 +146,22 @@ export default {
selectionChoosed(data) { selectionChoosed(data) {
this.selectedRowKeys = data; this.selectedRowKeys = data;
}, },
//
qrCodeGeneration(data) {
//
this.qr.show = true;
//
this.$nextTick(function () {
document.getElementById("qrCodeUrl").innerHTML = "";
let qrCodeUrl = new QRCode("qrCodeUrl", {
width: 200,
height: 200,
text: data,
colorDark: "#409EFF",
colorLight: "#fff",
});
});
},
handleMenuClick(data) { handleMenuClick(data) {
console.log(data); console.log(data);
if (data.key === "del") { if (data.key === "del") {
@ -166,14 +183,6 @@ export default {
success() { success() {
this.getData(); this.getData();
}, },
detail(id){
this.drawer.detail = true;
this.detailId = id;
},
detailClose(){
this.detailId = null;
this.drawer.detail = false;
}
}, },
computed: { computed: {
hasSelected() { hasSelected() {
@ -187,4 +196,7 @@ export default {
width: 40px; width: 40px;
height: 40px; height: 40px;
} }
/deep/ #qrCodeUrl > img {
margin: 0 auto;
}
</style> </style>

@ -1,66 +1,47 @@
export const formItem = [ export const formItem = [
{ {
type: 'select', type: 'input',
label:'资讯分类', label:'编号',
prop:'categoryId', prop:'code',
option:[], placeholder:'请输入'
placeholder:'请选择'
},
{
type: 'select',
label:'发布状态',
prop:'status',
option:[{ id:1,name:'未发布'},{ id:2,name:'已发布'},],
placeholder:'请选择状态'
},
{
type: 'time',
label:'创建时间',
start: 'createStartDate',
end:'createEndDate',
}, },
{ {
type: 'input', type: 'input',
label:'标题', label:'名称',
prop:'title', prop:'name',
placeholder:'请输入' placeholder:'请输入'
}, },
] ]
export const columns = [ export const columns = [
{ {
title: "标题", title: "路线编号",
dataIndex: "title", dataIndex: "code",
width: "10%", },
{
title: "路线名称",
dataIndex: "name",
},
{
title: "持续时间",
dataIndex: "spaceTime",
}, },
{ {
title: "分类", title: "创建时间",
dataIndex: "categoryName", dataIndex: "createDate",
width: "10%",
}, },
{ {
title: "发布状态", title: "状态",
dataIndex: "status", dataIndex: "status",
width: "6%", width: "6%",
customRender: function (status) { customRender: function (status) {
switch (status) { switch (status) {
case 1: case 1:
return '未发布' return '启用'
case 2: case 2:
return '已发布' return '停用'
} }
} }
}, },
{
title: "阅读量",
dataIndex: "viewsNum",
width: "10%",
},
{
title: "创建时间",
dataIndex: "createDate",
width: "12%",
},
{ {
title: "操作", title: "操作",
dataIndex: "action", dataIndex: "action",

@ -1,111 +0,0 @@
<template>
<div>
<a-drawer
title="资讯-详情"
:width="720"
:visible="show"
:body-style="{ paddingBottom: '80px' }"
@close="detailClose"
>
<div class="drawer-content">
<div class="content-title">
{{ detailData.title }}
<a-tag color="blue">{{
detailData.status === 1 ? "未发布" : "已发布"
}}</a-tag>
</div>
<a-divider></a-divider>
<a-descriptions>
<a-descriptions-item label="资讯类型">
{{ detailData.categoryName }}
</a-descriptions-item>
<a-descriptions-item label="阅读量">
{{ detailData.viewsNum }}
</a-descriptions-item>
<a-descriptions-item label="创建人">
{{ detailData.createName }}
</a-descriptions-item>
<a-descriptions-item label="创建时间">
{{ detailData.createDate }}
</a-descriptions-item>
</a-descriptions>
<a-descriptions :column="1">
<a-descriptions-item label="资讯内容">
{{ detailData.content }}
</a-descriptions-item>
<a-descriptions-item label="公告封面图">
<img
v-for="(item, index) in detailData.imgList"
:key="index"
:src="$ImgUrl(item.url)"
class="content-img"
/>
</a-descriptions-item>
</a-descriptions>
</div>
<div class="drawer-footer">
<a-button :style="{ marginRight: '8px' }" @click="detailClose">
关闭
</a-button>
</div>
</a-drawer>
</div>
</template>
<script>
import { newsInfo } from "@/api/operation/news/index.js";
export default {
props: {
show: {
type: Boolean,
default: false,
},
detailId: Number,
},
data() {
return {
detailData: {},
};
},
mounted() {},
methods: {
detailClose() {
this.$emit("detailClose");
},
handleTableChange(pagination) {
console.log(pagination);
const pager = { ...this.pagination };
pager.current = pagination.current;
pager.pageSize = pagination.pageSize;
this.pagination = pager;
this.getData();
},
},
watch: {
detailId: {
handler(id) {
if (id !== null && id !== undefined) {
newsInfo({ informationId: id }).then((res) => {
this.detailData = res.data;
});
}
},
immediate: true,
},
},
};
</script>
<style lang="less" scoped>
.content-title {
color: #000000d9;
font-weight: 500;
font-size: 18px;
line-height: 25px;
}
.content-img {
width: 108px;
height: 86px;
}
</style>

@ -1,21 +1,21 @@
export const form = { export const form = {
id:undefined, id:undefined,
title:undefined, name:undefined,
categoryId:undefined, describes:undefined,
status:undefined, status:undefined,
content:undefined, spaceTime:undefined,
imgUrls:[] pointRouteList:[]
} }
export const rules = { export const rules = {
title:[{required:true,message:'请输入标题',trigger:'blur'}], name:[{required:true,message:'请输入路线名称',trigger:'blur'}],
categoryId:[{required:true,message:'请选择分类',trigger:'change'}], describes:[{required:true,message:'请输入描述',trigger:'blur'}],
status:[{required:true,message:'请选择',trigger:'change'}], status:[{required:true,message:'请选择',trigger:'change'}],
content:[{required:true,message:'请输入',trigger:'blur'}], spaceTime:[{required:true,message:'请输入持续时间',trigger:'blur'}],
} }
export const options = { export const options = {
status:[ status:[
{ id:1, name:'未发布' }, { id:1, name:'启用' },
{ id:2, name:'已发布' }, { id:2, name:'停用' },
], ],
categoryId:[] pointList:[]
} }

@ -16,65 +16,25 @@
:rules="rules" :rules="rules"
layout="vertical" layout="vertical"
> >
<a-row> <a-form-model-item prop='name' label='路线名称'>
<a-col :span="12"> <a-input v-model="form.name" placeholder="请输入" style="width:60%"></a-input>
<a-form-model-item prop="title" label="标题"> </a-form-model-item>
<a-input <a-form-model-item prop='describes' label='描述'>
v-model="form.title" <a-input v-model="form.describes" placeholder="请输入" style="width:60%"></a-input>
placeholder="请输入标题" </a-form-model-item>
style="width: 80%" <a-form-model-item prop='status' label='状态' v-if="title==='新增巡检路线'">
></a-input> <a-select v-model="form.status" placeholder="请输入" style="width:60%">
</a-form-model-item> <a-select-option v-for="item in options.status" :key="item.id" :value="item.id">{{item.name}}</a-select-option>
</a-col> </a-select>
<a-col :span="12"> </a-form-model-item>
<a-form-model-item prop="categoryId" label="资讯分类"> <a-form-model-item prop='spaceTime' label='持续时间'>
<a-select <a-input-number v-model="form.spaceTime" placeholder="请输入" style="width:60%"></a-input-number>
v-model="form.categoryId" </a-form-model-item>
placeholder="请选择" <a-form-model-item prop='pointRouteList' label='巡检路线'>
style="width: 80%" <a-select mode="multiple" v-model="selectPoint" placeholder="请选择" style="width:60%">
> <a-select-option v-for="item in options.pointList" :key="item.id" :value="item.id">{{item.name}}</a-select-option>
<a-select-option </a-select>
v-for="item in options.categoryId" </a-form-model-item>
:key="item.id"
:value="item.id"
>{{ item.name }}</a-select-option
>
</a-select>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item prop="status" label="发布状态">
<a-select
v-model="form.status"
placeholder="请选择"
style="width: 80%"
>
<a-select-option
v-for="item in options.status"
:key="item.id"
:value="item.id"
>{{ item.name }}</a-select-option
>
</a-select>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item prop="content" label="内容">
<a-textarea
v-model="form.content"
placeholder="请输入内容"
style="width: 80%"
></a-textarea>
</a-form-model-item>
</a-col>
<a-col :span="24">
资讯封面图片
<commonUpload
:fileList="fileList"
@handleChange="handleChange"
></commonUpload>
</a-col>
</a-row>
</a-form-model> </a-form-model>
</div> </div>
<div class="drawer-footer"> <div class="drawer-footer">
@ -90,11 +50,11 @@
<script> <script>
import { form, rules, options } from "./form.js"; import { form, rules, options } from "./form.js";
import { import {
newsInsert, routeInsert,
newsUpdate, routeUpdate,
newsInfo, routeInfo,
itemSelect pointSelect
} from "@/api/operation/news/index.js"; } from "@/api/operation/inspection/route.js";
export default { export default {
props: { props: {
show: { show: {
@ -105,25 +65,25 @@ export default {
}, },
data() { data() {
return { return {
title: "新增资讯", title: "新增巡检路线",
form, form,
rules, rules,
options, options,
fileList: [], selectPoint:[]
}; };
}, },
mounted() { mounted() {
this.getItem(); this.getPoint();
}, },
methods: { methods: {
async getItem() { async getPoint() {
let res = await itemSelect(); let res = await pointSelect();
this.options.categoryId = res.data; this.options.pointList = res.data;
}, },
addClose() { addClose() {
this.$refs.ruleForm.resetFields(); this.$refs.ruleForm.resetFields();
this.fileList = []; this.form.pointRouteList = [];
this.form.imgUrls = []; this.selectPoint = []
this.$emit("addClose"); this.$emit("addClose");
}, },
success() { success() {
@ -131,10 +91,14 @@ export default {
this.addClose(); this.addClose();
}, },
submit() { submit() {
this.form.pointRouteList = []
for(let k in this.selectPoint){
this.form.pointRouteList.push({inspectionPointId:this.selectPoint[k]});
}
this.$refs.ruleForm.validate(async (valid) => { this.$refs.ruleForm.validate(async (valid) => {
if (valid) { if (valid) {
if (this.editId === null) { if (this.editId === null) {
let res = await newsInsert(this.form); let res = await routeInsert(this.form);
if (res.code === 200) { if (res.code === 200) {
this.$message.success(res.msg); this.$message.success(res.msg);
this.success(); this.success();
@ -143,7 +107,7 @@ export default {
} }
} else { } else {
console.log(this.form); console.log(this.form);
let res = await newsUpdate(this.form); let res = await routeUpdate(this.form);
if (res.code === 200) { if (res.code === 200) {
this.$message.success(res.msg); this.$message.success(res.msg);
this.success(); this.success();
@ -154,42 +118,24 @@ export default {
} }
}); });
}, },
handleChange(data) {
this.fileList = data;
if (data[0].status === "done") {
console.log("-------done-------");
this.form.imgUrls.push(data[0].response.data);
}
},
}, },
watch: { watch: {
editId: { editId: {
handler(val) { handler(val) {
if (val !== null) { if (val !== null) {
this.title = "修改资讯"; this.title = "修改巡检路线";
this.selectPoint = []
this.form.id = val; this.form.id = val;
newsInfo({ informationId: val }).then((res) => { routeInfo({ routeId: val }).then((res) => {
this.form = res.data; this.form = res.data;
if (res.data.imgList.length > 0) { if(this.form.routePointList.length>0){
console.log(res.data.imgList); for(let item of this.form.routePointList){
const pic = []; this.selectPoint.push(item.id)
for (let item of res.data.imgList) {
let obj = {
name: item.url.split("_")[0] + "." + item.url.split(".")[1],
url: this.$ImgUrl(item.url),
uid: item.url.split("_")[1],
status: "done",
thumbUrl: this.$ImgUrl(item.url),
};
pic.push(obj);
} }
this.fileList = pic;
} else {
this.form.imgUrls = [];
} }
}); });
} else { } else {
this.title = "新增资讯"; this.title = "新增巡检路线";
} }
}, },
immediate: true, immediate: true,

@ -1,15 +1,14 @@
<template> <template>
<div> <div>
<div class="cardTitle">资讯管理</div> <div class="cardTitle">巡检路线</div>
<searchForm :formItem="formItem" @getSearch="getData($event)" @changeTime='changeTime'></searchForm> <searchForm :formItem="formItem" @getSearch="getData($event)"></searchForm>
<a-button style="margin: 10px" class="add-btn" @click="drawer.show = true" <a-button style="margin: 10px" class="add-btn" @click="drawer.show = true"
>新增资讯</a-button >新增路线</a-button
> >
<a-table <a-table
:columns="columns" :columns="columns"
:data-source="tableData" :data-source="tableData"
:pagination="pagination" :pagination="pagination"
:scroll="{ x: 2600 }"
@change="handleTableChange" @change="handleTableChange"
:row-selection="{ :row-selection="{
selectedRowKeys: selectedRowKeys, selectedRowKeys: selectedRowKeys,
@ -23,8 +22,9 @@
> >
<span slot="action" slot-scope="text, row"> <span slot="action" slot-scope="text, row">
<a-space> <a-space>
<a class="ant-dropdown-link" @click="detail(row.id)"></a>
<a class="ant-dropdown-link" @click="edit(row.id)"></a> <a class="ant-dropdown-link" @click="edit(row.id)"></a>
<a class="ant-dropdown-link" v-if="row.status===2" @click="enable(row.id)"></a>
<a class="ant-dropdown-link" v-else-if="row.status===1" @click="enable(row.id)"></a>
<a class="ant-dropdown-link" @click="del([row.id])"></a> <a class="ant-dropdown-link" @click="del([row.id])"></a>
</a-space> </a-space>
</span> </span>
@ -48,40 +48,27 @@
@addClose="addClose" @addClose="addClose"
:editId="editId" :editId="editId"
></addForm> ></addForm>
<detailForm :detailId="detailId" :show="drawer.detail" @detailClose="detailClose"></detailForm>
</div> </div>
</template> </template>
<script> <script>
import { newsList, newsDel,itemSelect } from "@/api/operation/news/index.js"; import { routeList, routeDel,routeisEnable } from "@/api/operation/inspection/route.js";
import { formItem, columns, pagination } from "./depend/config"; import { formItem, columns, pagination } from "./depend/config";
import addForm from "./depend/form.vue"; import addForm from "./depend/form.vue";
import detailForm from "./depend/detail.vue";
export default { export default {
components: { components: {
addForm, addForm,
detailForm
}, },
data() { data() {
return { return {
drawer: { drawer: {
show: false, show: false,
detail:false
}, },
editId: null, editId: null,
detailId:null,
tableData: [], tableData: [],
searchForm: { searchForm: {
activityAddress: undefined, code: undefined,
organizerName: undefined, name: undefined,
activityContact: undefined,
activityTel: undefined,
title: undefined,
status: undefined,
registrationStartTime: undefined,
registrationEndTime: undefined,
activityStartTime: undefined,
activityEndTime: undefined,
}, },
formItem, formItem,
columns, columns,
@ -92,7 +79,6 @@ export default {
}, },
mounted() { mounted() {
this.getData(); this.getData();
this.getItem();
}, },
methods: { methods: {
async getData(data) { async getData(data) {
@ -101,24 +87,14 @@ export default {
this.searchForm = data; this.searchForm = data;
console.log(this.searchForm); console.log(this.searchForm);
} }
let res = await newsList({ let res = await routeList({
pageNum: this.pagination.current, pageNum: this.pagination.current,
size: this.pagination.pageSize, size: this.pagination.pageSize,
...this.searchForm ...this.searchForm
}); });
this.tableData = res.data.rows; this.tableData = res.data.rows;
this.pagination.total = res.data.total; this.pagination.total = res.data.total;
this.selectedRowKeys=[] this.selectedRowKeys = []
},
async getItem(){
let res = await itemSelect()
this.formItem[0].option = res.data
},
changeTime(data,start,end){
console.log(start);
this.searchForm[start] = data[0]
this.searchForm[end] = data[1]
console.log(this.searchForm);
}, },
edit(id) { edit(id) {
this.editId = id; this.editId = id;
@ -132,7 +108,7 @@ export default {
// cancelText:'', // cancelText:'',
icon: "delete", icon: "delete",
onOk: async () => { onOk: async () => {
let res = await newsDel({ informationIds: ids }); let res = await routeDel({ ids: ids });
if (res.code === 200) { if (res.code === 200) {
this.$message.success(res.msg); this.$message.success(res.msg);
this.getData(); this.getData();
@ -142,6 +118,15 @@ export default {
}, },
}); });
}, },
async enable(id) {
let res = await routeisEnable({ routeId: id });
if (res.code === 200) {
this.$message.success(res.msg);
this.getData();
} else {
this.$message.error(res.msg);
}
},
selectionChoosed(data) { selectionChoosed(data) {
this.selectedRowKeys = data; this.selectedRowKeys = data;
}, },
@ -166,14 +151,6 @@ export default {
success() { success() {
this.getData(); this.getData();
}, },
detail(id){
this.drawer.detail = true;
this.detailId = id;
},
detailClose(){
this.detailId = null;
this.drawer.detail = false;
}
}, },
computed: { computed: {
hasSelected() { hasSelected() {

15934
yarn.lock

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save