|
|
|
|
@ -24,8 +24,9 @@
|
|
|
|
|
<el-input v-model="listQuery.fgRwmc" placeholder="请输入任务名称" style="width: 100%" clearable />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item style="width: 45%" label="方格" prop="fgData">
|
|
|
|
|
<div :class="listQuery.fgData.length === 0 ? 'ipt mj' : 'ipt'" @click.stop="fgVisible = true">
|
|
|
|
|
<el-tag v-for="(tag, idx) in listQuery.fgData" :key="tag.id" class="mx-1" closable :type="tag.type"
|
|
|
|
|
<div :class="listQuery?.fgData && listQuery?.fgData.length === 0 ? 'ipt mj' : 'ipt'"
|
|
|
|
|
@click.stop="fgVisible = true">
|
|
|
|
|
<el-tag v-for="(tag, idx) in listQuery?.fgData" :key="tag.id" class="mx-1" closable :type="tag.type"
|
|
|
|
|
@close="handleClose(idx)">
|
|
|
|
|
{{ tag.fgmc }}
|
|
|
|
|
</el-tag>
|
|
|
|
|
@ -34,35 +35,46 @@
|
|
|
|
|
<el-form-item style="width: 48%" prop="dkjgsj" label="间隔时间">
|
|
|
|
|
<el-input v-model="listQuery.dkjgsj" type="number" placeholder="请输入间隔时间" style="width: 100%" clearable />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<div class="center-btn"><el-button style="margin-top: 12px" @click="next">下一步</el-button></div>
|
|
|
|
|
<div class="center-btn"><el-button style="margin: 12px 0;" @click="next">下一步</el-button></div>
|
|
|
|
|
<div style="height: 40vh; width: 100%">
|
|
|
|
|
<gd-map />
|
|
|
|
|
</div>
|
|
|
|
|
</el-form>
|
|
|
|
|
<div class="box_main" v-if="stepActive == 1">
|
|
|
|
|
<el-button style="margin: 12px 0 10px 0;" @click="addDw" v-if="openType!=='detail'">新增点位</el-button>
|
|
|
|
|
<el-button style="margin: 12px 0 10px 0;" @click="addDw" v-if="openType !== 'detail'">新增点位</el-button>
|
|
|
|
|
<MyTable :tableData="pageData.tableData" :tableColumn="pageData.tableColumn" :tableHeight="pageData.tableHeight"
|
|
|
|
|
:key="pageData.keyCount" :tableConfiger="pageData.tableConfiger" :controlsWidth="pageData.controlsWidth"
|
|
|
|
|
@chooseData="chooseData">
|
|
|
|
|
<template #dktp="{ row }">
|
|
|
|
|
<el-image :append-to-body="true" :preview-src-list="[
|
|
|
|
|
`/mosty-api/mosty-base/minio/image/download/${row.dktp}`
|
|
|
|
|
]" style="width: 75px; height: 75px" :src="`/mosty-api/mosty-base/minio/image/download/${row.dktp}`"
|
|
|
|
|
fit="cover" lazy />
|
|
|
|
|
</template>
|
|
|
|
|
<!-- 操作 -->
|
|
|
|
|
<template #controls="{ row, index }">
|
|
|
|
|
<el-button @click="deletList(index)" type="danger" size="small">删除</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</MyTable>
|
|
|
|
|
<div class="center-btn">
|
|
|
|
|
<el-button style="margin-top: 12px" @click="stepActive--; pageData.tableData = []">上一步</el-button>
|
|
|
|
|
<el-button style="margin-top: 12px" @click="submit" v-if="openType!=='detail'">提交</el-button>
|
|
|
|
|
<el-button style="margin-top: 12px" @click="stepFn">上一步</el-button>
|
|
|
|
|
<el-button style="margin-top: 12px" @click="submit" v-if="openType !== 'detail'">提交</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<FgLoad v-model="fgVisible" @choosedUsers="hanlderChoose" :Single="true" />
|
|
|
|
|
<AddDw v-model="showDialog" v-if="showDialog" :data="listQuery.fgData"
|
|
|
|
|
<AddDw v-model="showDialog" v-if="showDialog" :data="listQuery?.fgData"
|
|
|
|
|
:dic="{ D_ZDXL_FGXLRW_YJYS, D_ZDXL_FGXLRW_YJDJ, D_ZDXL_FGXLRW_RWZT }" @submit="dwSubmit" />
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
|
import FgLoad from "./fgLoad.vue";
|
|
|
|
|
import AddDw from "./addDw.vue";
|
|
|
|
|
import emitter from "@/utils/eventBus";
|
|
|
|
|
import MyTable from "@/components/aboutTable/MyTable.vue";
|
|
|
|
|
import { qcckGet, qcckPost } from "@/api/qcckApi.js";
|
|
|
|
|
import emitter from "@/utils/eventBus.js";
|
|
|
|
|
import GdMap from "@/components/Map/GdMap/index.vue";
|
|
|
|
|
import { fetchTbZdxlFgdwSelectList } from "@/api/service/taskProgress";
|
|
|
|
|
import {
|
|
|
|
|
ref,
|
|
|
|
|
defineExpose,
|
|
|
|
|
@ -85,7 +97,7 @@ const fgVisible = ref(false);
|
|
|
|
|
const loading = ref(false);
|
|
|
|
|
const elform = ref();
|
|
|
|
|
const title = ref("");
|
|
|
|
|
const openType=ref("")
|
|
|
|
|
const openType = ref("")
|
|
|
|
|
const rules = reactive({
|
|
|
|
|
fgRwmc: [{ required: true, message: "请输入任务名称", trigger: "change" }],
|
|
|
|
|
fgData: [{ required: true, message: "请选择方格", trigger: "change" }],
|
|
|
|
|
@ -99,7 +111,7 @@ const pageData = reactive({
|
|
|
|
|
tableConfiger: {
|
|
|
|
|
loading: false,
|
|
|
|
|
rowHieght: 61,
|
|
|
|
|
showSelectType: "checkBox"
|
|
|
|
|
haveControls: true,
|
|
|
|
|
},
|
|
|
|
|
total: 0,
|
|
|
|
|
pageConfiger: {
|
|
|
|
|
@ -114,6 +126,25 @@ const pageData = reactive({
|
|
|
|
|
]
|
|
|
|
|
});
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
// 点击地图方格选择
|
|
|
|
|
emitter.on("showTaskFgInfo", (val) => {
|
|
|
|
|
if (openType.value !== 'detail') {
|
|
|
|
|
listQuery.value.fgData = [{
|
|
|
|
|
id: val.id,
|
|
|
|
|
fgmc: val.mc1,
|
|
|
|
|
x1: val.x1,
|
|
|
|
|
y1: val.y1,
|
|
|
|
|
x2: val.x2,
|
|
|
|
|
y2: val.y2,
|
|
|
|
|
x11: val.x11,
|
|
|
|
|
y11: val.y11,
|
|
|
|
|
x21: val.x21,
|
|
|
|
|
y21: val.y21,
|
|
|
|
|
zxX: val.zxX,
|
|
|
|
|
zxY: val.zxY,
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 初始化数据
|
|
|
|
|
@ -121,33 +152,98 @@ const init = (type, row) => {
|
|
|
|
|
dialogForm.value = true;
|
|
|
|
|
openType.value = type;
|
|
|
|
|
title.value = row ? "编辑任务" : "新增任务";
|
|
|
|
|
stepActive.value = 0;
|
|
|
|
|
getData()
|
|
|
|
|
pageData.tableColumn = [
|
|
|
|
|
{ label: "点位名称", prop: "bxdMc", showOverflowTooltip: true },
|
|
|
|
|
{ label: "经度", prop: "jd", showOverflowTooltip: true },
|
|
|
|
|
{ label: "维度", prop: "wd", showOverflowTooltip: true },
|
|
|
|
|
]
|
|
|
|
|
pageData.tableConfiger.haveControls = true
|
|
|
|
|
if (row) {
|
|
|
|
|
getDataById(row);
|
|
|
|
|
if (openType.value == 'detail') {
|
|
|
|
|
pageData.tableColumn = [
|
|
|
|
|
{ label: "点位名称", prop: "bxdMc", showOverflowTooltip: true },
|
|
|
|
|
{ label: "经度", prop: "jd", showOverflowTooltip: true },
|
|
|
|
|
{ label: "维度", prop: "wd", showOverflowTooltip: true },
|
|
|
|
|
{ label: "打卡时间", prop: "dksj", showOverflowTooltip: true },
|
|
|
|
|
{ label: "图片", prop: "dktp", showOverflowTooltip: true, showSolt: true },
|
|
|
|
|
]
|
|
|
|
|
pageData.tableConfiger.haveControls = false
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
stepActive.value = 0;
|
|
|
|
|
listQuery.value = { fgData: [] };
|
|
|
|
|
pageData.tableData = [];
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
// 根据id查询详情
|
|
|
|
|
const getDataById = (row) => {
|
|
|
|
|
qcckGet({ fgrwid: row.id }, "/mosty-yjzl/tbZdyrw/getFgrwXq").then(async (res) => {
|
|
|
|
|
qcckGet({ fgrwid: row.id }, "/mosty-yjzl/tbZdyrw/getFgrwXq").then((res) => {
|
|
|
|
|
listQuery.value = res;
|
|
|
|
|
listQuery.value.fgData = [{...res.fgxx,
|
|
|
|
|
listQuery.value.fgData = [{
|
|
|
|
|
...res.fgxx,
|
|
|
|
|
fgmc: res.fgmc,
|
|
|
|
|
id: res.fgId,
|
|
|
|
|
}]
|
|
|
|
|
console.log(listQuery.value.fgData ,'listQuery.value.fgData ');
|
|
|
|
|
|
|
|
|
|
pageData.tableData=res.bxds
|
|
|
|
|
const fginfo = listQuery.value.fgData?.map((el, index) => {
|
|
|
|
|
let position = [
|
|
|
|
|
[Number(el.x1), Number(el.y1)],
|
|
|
|
|
[Number(el.x2), Number(el.y2)]
|
|
|
|
|
];
|
|
|
|
|
let text = el.mc;
|
|
|
|
|
let obj = { position: position, text, id: el.id, userData: el };
|
|
|
|
|
return obj;
|
|
|
|
|
});
|
|
|
|
|
emitter.emit("echoPlane", {
|
|
|
|
|
fontColor: "white",
|
|
|
|
|
coords: fginfo,
|
|
|
|
|
type: "rectangle",
|
|
|
|
|
flag: "taskFg-info",
|
|
|
|
|
color: "red",
|
|
|
|
|
linecolor: "red"
|
|
|
|
|
});
|
|
|
|
|
pageData.tableData = res.bxds
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
const getData = async () => {
|
|
|
|
|
const res = await fetchTbZdxlFgdwSelectList();
|
|
|
|
|
if (res && res?.length > 0) {
|
|
|
|
|
emitter.emit("deletePointArea", "taskFg-flag");
|
|
|
|
|
let cc = [];
|
|
|
|
|
const list = res?.map((el, index) => {
|
|
|
|
|
let centerPoint = [el.zxX, el.zxY];
|
|
|
|
|
if (index == 0) cc = centerPoint;
|
|
|
|
|
let position = [
|
|
|
|
|
[Number(el.x1), Number(el.y1)],
|
|
|
|
|
[Number(el.x2), Number(el.y2)]
|
|
|
|
|
];
|
|
|
|
|
let text = el.mc;
|
|
|
|
|
let obj = { position: position, text, id: el.id, userData: el };
|
|
|
|
|
return obj;
|
|
|
|
|
});
|
|
|
|
|
emitter.emit("echoPlane", {
|
|
|
|
|
fontColor: "#12fdb8",
|
|
|
|
|
coords: list,
|
|
|
|
|
type: "rectangle",
|
|
|
|
|
flag: "taskFg-flag",
|
|
|
|
|
color: "rgba(2,20,51,0.5)",
|
|
|
|
|
linecolor: "#1C97FF"
|
|
|
|
|
});
|
|
|
|
|
emitter.emit("setMapCenter", { location: cc, zoomLevel: 11 });
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
const next = () => {
|
|
|
|
|
elform.value.validate((valid) => {
|
|
|
|
|
if (!valid) return false;
|
|
|
|
|
stepActive.value++;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
// 上一步
|
|
|
|
|
const stepFn = () => {
|
|
|
|
|
stepActive.value--;
|
|
|
|
|
getData()
|
|
|
|
|
}
|
|
|
|
|
const addDw = () => {
|
|
|
|
|
showDialog.value = true
|
|
|
|
|
@ -174,29 +270,24 @@ function hanlderChoose(arr) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const dwSubmit = (val) => {
|
|
|
|
|
console.log(val, 'val');
|
|
|
|
|
pageData.tableData.push(val)
|
|
|
|
|
}
|
|
|
|
|
// 提交
|
|
|
|
|
const submit = () => {
|
|
|
|
|
// elform.value.validate((valid) => {
|
|
|
|
|
// if (!valid) return false;
|
|
|
|
|
loading.value = true;
|
|
|
|
|
const pramas = {
|
|
|
|
|
fgRwmc: listQuery.value.fgRwmc,
|
|
|
|
|
fgId: listQuery.value.fgData[0].id,
|
|
|
|
|
dkjgsj: listQuery.value.dkjgsj,
|
|
|
|
|
dtoList: pageData.tableData.map(item => {
|
|
|
|
|
return {
|
|
|
|
|
bxdMc: item.bxdMc,
|
|
|
|
|
jd: item.jd,
|
|
|
|
|
wd: item.wd
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
if (title.value == "新增任务") {
|
|
|
|
|
console.log(listQuery.value, pageData.tableData);
|
|
|
|
|
|
|
|
|
|
const pramas = {
|
|
|
|
|
fgRwmc: listQuery.value.fgRwmc,
|
|
|
|
|
fgId: listQuery.value.fgData[0].id,
|
|
|
|
|
dkjgsj: listQuery.value.dkjgsj,
|
|
|
|
|
dtoList: pageData.tableData.map(item => {
|
|
|
|
|
return {
|
|
|
|
|
bxdMc: item.bxdMc,
|
|
|
|
|
jd: item.jd,
|
|
|
|
|
wd: item.wd
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
qcckPost(pramas, "/mosty-yjzl/tbZdyrw/addTbZdyrw")
|
|
|
|
|
.then((res) => {
|
|
|
|
|
proxy.$message({ type: "success", message: "新增成功" });
|
|
|
|
|
@ -207,20 +298,20 @@ const submit = () => {
|
|
|
|
|
loading.value = false;
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
// qcckPut(listQuery.value, "/mosty-yszx/tbYsSxt/update")
|
|
|
|
|
// .then((res) => {
|
|
|
|
|
// proxy.$message({ type: "success", message: "修改成功" });
|
|
|
|
|
// close();
|
|
|
|
|
// emit("updateDate");
|
|
|
|
|
// })
|
|
|
|
|
// .catch(() => {
|
|
|
|
|
// loading.value = false;
|
|
|
|
|
// });
|
|
|
|
|
pramas.id = listQuery.value.id
|
|
|
|
|
qcckPost(pramas, "/mosty-yjzl/tbZdyrw/editTbZdyrw")
|
|
|
|
|
.then((res) => {
|
|
|
|
|
proxy.$message({ type: "success", message: "修改成功" });
|
|
|
|
|
close();
|
|
|
|
|
emit("updateDate");
|
|
|
|
|
})
|
|
|
|
|
.catch(() => {
|
|
|
|
|
loading.value = false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
// });
|
|
|
|
|
};
|
|
|
|
|
const deletList = (idx) => {
|
|
|
|
|
console.log(idx, 'idx');
|
|
|
|
|
pageData.tableData.splice(idx, 1)
|
|
|
|
|
}
|
|
|
|
|
// 关闭
|
|
|
|
|
|