bibi 3 years ago
parent da5102d6e6
commit a63c3369e0

@ -14,6 +14,13 @@ export function planisEnable(params) {
params: params, params: params,
}) })
} }
export function routeSelect(params) {
return httpService({
url: `/user/inspectionRoute/allList`,
method: 'get',
params: params,
})
}
export function planInfo(params) { export function planInfo(params) {
return httpService({ return httpService({
url: `/user/inspectionPlan/findById`, url: `/user/inspectionPlan/findById`,

@ -258,7 +258,7 @@ export default {
this.positionDisabled(this.treeData) this.positionDisabled(this.treeData)
}); });
}, },
// disabled //
positionDisabled(arr){ positionDisabled(arr){
arr.forEach((item,index)=>{ arr.forEach((item,index)=>{
if(item.type=== 1 && (item.childList.length===0 || item.childList===null)){ if(item.type=== 1 && (item.childList.length===0 || item.childList===null)){

@ -1,73 +1,79 @@
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:'inspectorTel',
placeholder:'请输入' placeholder:'请输入'
}, },
{
type: 'select',
label:'巡检状态',
prop:'inspectionStatus',
placeholder: '请选择',
option:[{ id:1,name:'待巡检'},{ id:2,name:'已巡检'},{ id:3,name:'巡检中'},{ id:4,name:'未巡检'}]
},
] ]
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: "beginDate",
},
{
title: "计划当次巡检结束时间",
dataIndex: "endDate",
},
{
title: "实际当次巡检开始时间",
dataIndex: "actualBeginDate",
},
{
title: "实际当次巡检结束时间",
dataIndex: "actualEndDate",
},
{
title: "状态",
dataIndex: "status", dataIndex: "status",
width: "6%",
customRender: function (status) { customRender: function (status) {
switch (status) { switch (status) {
case 1: case 1:
return '未发布' return "待巡检"
break;
case 2: case 2:
return '已发布' return "已巡检"
break;
case 3:
return "巡检中"
break;
case 4:
return "未巡检"
break;
default:
break;
} }
} }
}, },
{ {
title: "阅读量", title: "巡检人姓名",
dataIndex: "viewsNum", dataIndex: "inspectorName",
width: "10%",
},
{
title: "创建时间",
dataIndex: "createDate",
width: "12%",
}, },
{ {
title: "操作", title: "巡检人手机号",
dataIndex: "action", dataIndex: "inspectorTel",
key: "action",
width: "180",
fixed: "right",
scopedSlots: { customRender: "action" },
}, },
] ]
export const pagination = { export const pagination = {

@ -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 +0,0 @@
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:[]
}

@ -1,201 +0,0 @@
<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>

@ -1,10 +1,10 @@
<template> <template>
<div> <div>
<div class="cardTitle">资讯管理</div> <div class="cardTitle">巡检记录</div>
<searchForm :formItem="formItem" @getSearch="getData($event)" @changeTime='changeTime'></searchForm> <searchForm
<a-button style="margin: 10px" class="add-btn" @click="drawer.show = true" :formItem="formItem"
>新增资讯</a-button @getSearch="getData($event)"
> ></searchForm>
<a-table <a-table
:columns="columns" :columns="columns"
:data-source="tableData" :data-source="tableData"
@ -21,67 +21,27 @@
} }
" "
> >
<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> </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> </div>
</template> </template>
<script> <script>
import { newsList, newsDel,itemSelect } from "@/api/operation/news/index.js"; import { inspectionExecute } from "@/api/operation/inspection/plan.js";
import { formItem, columns, pagination } from "./depend/config"; import { formItem, columns, pagination } from "./depend/config";
import addForm from "./depend/form.vue";
import detailForm from "./depend/detail.vue";
export default { export default {
components: {
addForm,
detailForm
},
data() { data() {
return { return {
drawer: { drawer: {
show: false, show: false,
detail:false detail: false,
}, },
editId: null, editId: null,
detailId: null, detailId: null,
tableData: [], tableData: [],
searchForm: { searchForm: {
activityAddress: undefined, code: undefined,
organizerName: undefined, inspectorTel: undefined,
activityContact: undefined, inspectionStatus: undefined,
activityTel: undefined,
title: undefined,
status: undefined,
registrationStartTime: undefined,
registrationEndTime: undefined,
activityStartTime: undefined,
activityEndTime: undefined,
}, },
formItem, formItem,
columns, columns,
@ -92,7 +52,6 @@ export default {
}, },
mounted() { mounted() {
this.getData(); this.getData();
this.getItem();
}, },
methods: { methods: {
async getData(data) { async getData(data) {
@ -101,56 +60,18 @@ export default {
this.searchForm = data; this.searchForm = data;
console.log(this.searchForm); console.log(this.searchForm);
} }
let res = await newsList({ let res = await inspectionExecute({
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) {
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) { selectionChoosed(data) {
this.selectedRowKeys = data; this.selectedRowKeys = data;
}, },
handleMenuClick(data) {
console.log(data);
if (data.key === "del") {
this.del(this.selectedRowKeys);
}
},
handleTableChange(pagination) { handleTableChange(pagination) {
console.log(pagination); console.log(pagination);
const pager = { ...this.pagination }; const pager = { ...this.pagination };
@ -159,21 +80,6 @@ export default {
this.pagination = pager; this.pagination = pager;
this.getData(); 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: { computed: {
hasSelected() { hasSelected() {
@ -187,4 +93,7 @@ export default {
width: 40px; width: 40px;
height: 40px; height: 40px;
} }
/deep/ #qrCodeUrl > img {
margin: 0 auto;
}
</style> </style>

@ -11,28 +11,66 @@ export const formItem = [
prop:'name', prop:'name',
placeholder:'请输入' placeholder:'请输入'
}, },
{
type: 'select',
label:'状态',
prop:'status',
placeholder: '请选择',
option:[{ id:1,name:'启用'},{ id:2,name:'停用'}]
},
{
type: 'select',
label:'巡检路线',
prop:'inspectionRouteId',
placeholder: '请选择',
option:[]
},
{
type: 'time',
label: '计划时间',
start: 'planBeginDateStart',
end:'planBeginDateEnd'
},
{
type: 'time',
label: '实际时间',
start: 'actualBeginDateStart',
end:'actualBeginDateEnd'
},
] ]
export const columns = [ export const columns = [
{ {
title: "路线编号", title: "巡检计划编号",
dataIndex: "code", dataIndex: "code",
}, },
{ {
title: "路线名称", title: "名称",
dataIndex: "name", dataIndex: "name",
}, },
{ {
title: "持续时间", title: "巡检路线编号",
dataIndex: "spaceTime", dataIndex: "routeCode",
},
{
title: "计划开始时间",
dataIndex: "planBeginDate",
},
{
title: "实际开始时间",
dataIndex: "actualBeginDate",
},
{
title: "部门名称",
dataIndex: "positionName",
}, },
{ {
title: "创建时间", title: "巡检人名称",
dataIndex: "createDate", dataIndex: "inspectorName",
}, },
{ {
title: "状态", title: "状态",
dataIndex: "status", dataIndex: "status",
width: "6%",
customRender: function (status) { customRender: function (status) {
switch (status) { switch (status) {
case 1: case 1:
@ -46,7 +84,7 @@ export const columns = [
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,21 +1,34 @@
export const form = { export const form = {
id: undefined, id: undefined,
inspectionRouteId: undefined,
name:undefined, name:undefined,
describes:undefined, positionId:undefined,
status:undefined, inspector:undefined,
spaceTime:undefined, planBeginDate:undefined,
pointRouteList:[] isSort:undefined,
checkRateType:undefined,
} }
export const rules = { export const rules = {
name:[{required:true,message:'请输入路线名称',trigger:'blur'}], inspectionRouteId:[{required:true,message:'请选择路线',trigger:'change'}],
describes:[{required:true,message:'请输入描述',trigger:'blur'}], name:[{required:true,message:'请输入名称',trigger:'blur'}],
status:[{required:true,message:'请选择',trigger:'change'}], inspector:[{required:true,message:'请选择',trigger:'change'}],
spaceTime:[{required:true,message:'请输入持续时间',trigger:'blur'}], planBeginDate:[{required:true,message:'请选择',trigger:'change'}],
isSort:[{required:true,message:'请选择',trigger:'change'}],
checkRateType:[{required:true,message:'请选择',trigger:'change'}],
} }
export const options = { export const options = {
status:[ isSort:[
{ id:1, name:'启用' }, { id:1, name:'顺序' },
{ id:2, name:'停用' }, { id:2, name:'不顺序' },
], ],
pointList:[] routeList: [],
checkRateType: [
{ id:1, name:'每天' },
{ id:2, name:'每周' },
{ id:3, name:'每月' },
],
// 岗位选择
positionId: [],
// 人员选择
inspector:[]
} }

@ -16,23 +16,88 @@
:rules="rules" :rules="rules"
layout="vertical" layout="vertical"
> >
<a-form-model-item prop='name' label='路线名称'> <a-form-model-item prop="inspectionRouteId" label="巡检路线">
<a-input v-model="form.name" placeholder="请输入" style="width:60%"></a-input> <a-select
v-model="form.inspectionRouteId"
placeholder="请选择"
style="width: 60%"
>
<a-select-option
v-for="item in options.routeList"
:key="item.id"
:value="item.id"
>{{ item.name }}</a-select-option
>
</a-select>
</a-form-model-item> </a-form-model-item>
<a-form-model-item prop='describes' label='描述'> <a-form-model-item prop="name" label="计划名称">
<a-input v-model="form.describes" placeholder="请输入" style="width:60%"></a-input> <a-input
v-model="form.name"
placeholder="请输入"
style="width: 60%"
></a-input>
</a-form-model-item> </a-form-model-item>
<a-form-model-item prop='status' label='状态' v-if="title==='新增巡检路线'"> <a-form-model-item prop="positionId" label="部门">
<a-select v-model="form.status" placeholder="请输入" style="width:60%"> <a-cascader
<a-select-option v-for="item in options.status" :key="item.id" :value="item.id">{{item.name}}</a-select-option> v-model="positionValue"
:options="options.positionId"
:field-names="{
label: 'name',
value: 'id',
children: 'childList',
}"
placeholder="请选择"
style="width: 60%"
@change="changePosition"
></a-cascader>
</a-form-model-item>
<a-form-model-item prop="inspector" label="巡检人">
<a-select
v-model="form.inspector"
placeholder="请选择"
style="width: 60%"
>
<a-select-option
v-for="item in options.inspector"
:key="item.id"
:value="item.id"
>{{ item.actualName }}</a-select-option
>
</a-select> </a-select>
</a-form-model-item> </a-form-model-item>
<a-form-model-item prop='spaceTime' label='持续时间'> <a-form-model-item prop="planBeginDate" label="计划开始时间">
<a-input-number v-model="form.spaceTime" placeholder="请输入" style="width:60%"></a-input-number> <a-date-picker
placeholder="请选择开始时间"
v-model="form.planBeginDate"
value-format="YYYY-MM-DD HH:mm:ss"
/>
</a-form-model-item> </a-form-model-item>
<a-form-model-item prop='pointRouteList' label='巡检路线'> <a-form-model-item prop="isSort" label="是否按照顺序巡检">
<a-select mode="multiple" v-model="selectPoint" placeholder="请选择" style="width:60%"> <a-select
<a-select-option v-for="item in options.pointList" :key="item.id" :value="item.id">{{item.name}}</a-select-option> v-model="form.isSort"
placeholder="请选择"
style="width: 60%"
>
<a-select-option
v-for="item in options.isSort"
:key="item.id"
:value="item.id"
>{{ item.name }}</a-select-option
>
</a-select>
</a-form-model-item>
<a-form-model-item prop="checkRateType" label="检查频率">
<a-select
v-model="form.checkRateType"
placeholder="请选择"
style="width: 60%"
>
<a-select-option
v-for="item in options.checkRateType"
:key="item.id"
:value="item.id"
>{{ item.name }}</a-select-option
>
</a-select> </a-select>
</a-form-model-item> </a-form-model-item>
</a-form-model> </a-form-model>
@ -50,11 +115,12 @@
<script> <script>
import { form, rules, options } from "./form.js"; import { form, rules, options } from "./form.js";
import { import {
routeInsert, planInsert,
routeUpdate, planUpdate,
routeInfo, planInfo,
pointSelect routeSelect,
} from "@/api/operation/inspection/route.js"; } from "@/api/operation/inspection/plan.js";
import { departmentList, findToUser } from "@/api/basic/department/index.js";
export default { export default {
props: { props: {
show: { show: {
@ -65,25 +131,61 @@ export default {
}, },
data() { data() {
return { return {
title: "新增巡检路线", title: "新增巡检计划",
form, form,
rules, rules,
options, options,
selectPoint:[] positionValue:[]
}; };
}, },
mounted() { mounted() {
this.getPoint(); this.getRoute();
this.getDepartment();
}, },
methods: { methods: {
async getPoint() { async getRoute() {
let res = await pointSelect(); let res = await routeSelect();
this.options.pointList = res.data; this.options.routeList = res.data;
},
async getDepartment() {
let res = await departmentList();
this.options.positionId = res.data;
this.positionDisabled(this.options.positionId)
},
// idtype===''disable
positionDisabled(arr){
arr.forEach((item,index)=>{
if(item.type=== 1 && (item.childList.length===0 || item.childList===null)){
arr[index].disabled=true
}else if(item.type === 2){
arr[index].disabled=false
}else{
this.positionDisabled(item.childList)
}
})
},
async getUser(id){
let res = await findToUser({
// 10000
pageNum:1,size:10000,positionId:id
})
this.options.inspector = res.data.rows;
},
getPositionValue(id){
console.log(this.options.positionId);
},
async changePosition(data) {
this.options.inspector = []
this.form.inspector = undefined
let id = data[data.length - 1]
this.form.positionId = id
this.getUser(id)
}, },
addClose() { addClose() {
this.$refs.ruleForm.resetFields(); this.$refs.ruleForm.resetFields();
this.form.pointRouteList = []; this.positionValue = []
this.selectPoint = [] this.form.positionId = undefined;
this.form.inspector = undefined
this.$emit("addClose"); this.$emit("addClose");
}, },
success() { success() {
@ -91,14 +193,10 @@ 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 routeInsert(this.form); let res = await planInsert(this.form);
if (res.code === 200) { if (res.code === 200) {
this.$message.success(res.msg); this.$message.success(res.msg);
this.success(); this.success();
@ -107,7 +205,7 @@ export default {
} }
} else { } else {
console.log(this.form); console.log(this.form);
let res = await routeUpdate(this.form); let res = await planUpdate(this.form);
if (res.code === 200) { if (res.code === 200) {
this.$message.success(res.msg); this.$message.success(res.msg);
this.success(); this.success();
@ -123,19 +221,17 @@ export default {
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;
routeInfo({ routeId: val }).then((res) => { planInfo({ planId: val }).then((res) => {
this.form = res.data; this.form = res.data;
if(this.form.routePointList.length>0){ //
for(let item of this.form.routePointList){ this.getUser(this.form.positionId)
this.selectPoint.push(item.id) //
} // this.form.positionId
}
}); });
} else { } else {
this.title = "新增巡检路线"; this.title = "新增巡检计划";
} }
}, },
immediate: true, immediate: true,

@ -1,14 +1,15 @@
<template> <template>
<div> <div>
<div class="cardTitle">巡检路线</div> <div class="cardTitle">巡检计划</div>
<searchForm :formItem="formItem" @getSearch="getData($event)"></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
> >
<a-table <a-table
:columns="columns" :columns="columns"
:data-source="tableData" :data-source="tableData"
:pagination="pagination" :pagination="pagination"
:scroll="{ x: 1900 }"
@change="handleTableChange" @change="handleTableChange"
:row-selection="{ :row-selection="{
selectedRowKeys: selectedRowKeys, selectedRowKeys: selectedRowKeys,
@ -52,7 +53,7 @@
</template> </template>
<script> <script>
import { routeList, routeDel,routeisEnable } from "@/api/operation/inspection/route.js"; import { planList, planDel,planisEnable,routeSelect } from "@/api/operation/inspection/plan.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";
export default { export default {
@ -69,6 +70,12 @@ export default {
searchForm: { searchForm: {
code: undefined, code: undefined,
name: undefined, name: undefined,
status: undefined,
inspectionplanId: undefined,
planBeginDateStart: undefined,
planBeginDateEnd: undefined,
actualBeginDateStart: undefined,
actualBeginDateEnd: undefined,
}, },
formItem, formItem,
columns, columns,
@ -79,15 +86,20 @@ export default {
}, },
mounted() { mounted() {
this.getData(); this.getData();
this.getRoute()
}, },
methods: { methods: {
async getRoute(){
let res = await routeSelect()
this.formItem[3].option = res.data
},
async getData(data) { async getData(data) {
if (data !== undefined) { if (data !== undefined) {
console.log(data); console.log(data);
this.searchForm = data; this.searchForm = data;
console.log(this.searchForm); console.log(this.searchForm);
} }
let res = await routeList({ let res = await planList({
pageNum: this.pagination.current, pageNum: this.pagination.current,
size: this.pagination.pageSize, size: this.pagination.pageSize,
...this.searchForm ...this.searchForm
@ -96,6 +108,12 @@ export default {
this.pagination.total = res.data.total; this.pagination.total = res.data.total;
this.selectedRowKeys = [] this.selectedRowKeys = []
}, },
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;
this.drawer.show = true; this.drawer.show = true;
@ -108,7 +126,7 @@ export default {
// cancelText:'', // cancelText:'',
icon: "delete", icon: "delete",
onOk: async () => { onOk: async () => {
let res = await routeDel({ ids: ids }); let res = await planDel({ ids: ids });
if (res.code === 200) { if (res.code === 200) {
this.$message.success(res.msg); this.$message.success(res.msg);
this.getData(); this.getData();
@ -119,7 +137,7 @@ export default {
}); });
}, },
async enable(id) { async enable(id) {
let res = await routeisEnable({ routeId: id }); let res = await planisEnable({ planId: id });
if (res.code === 200) { if (res.code === 200) {
this.$message.success(res.msg); this.$message.success(res.msg);
this.getData(); this.getData();

Loading…
Cancel
Save