fix:重点场所添加动态
This commit is contained in:
parent
1971a42f73
commit
13934be21a
|
|
@ -16,10 +16,10 @@ VITE_PROXY_API = /dev-api
|
|||
# VITE_PROXY = [ ["/dev-api", "http://42.193.40.239:8017" ],["/dev-img-api", "http://file.sczysoft.com" ]]
|
||||
# VITE_UPLOAD_URL = http://42.193.40.239:8888
|
||||
# 东哥
|
||||
# VITE_PROXY = [ ["/dev-api", "http://192.168.110.186:8017" ],["/dev-img-api", "http://file.sczysoft.com" ]]
|
||||
VITE_PROXY = [ ["/dev-api", "http://192.168.110.186:8017" ],["/dev-img-api", "http://42.193.40.239:8017" ]]
|
||||
# VITE_UPLOAD_URL = http://192.168.110.186
|
||||
# 陈游
|
||||
VITE_PROXY = [ ["/dev-api", "http://192.168.110.10:8017" ],["/dev-img-api", "http://42.193.40.239:8017" ]]
|
||||
# VITE_PROXY = [ ["/dev-api", "http://192.168.110.10:8017" ],["/dev-img-api", "http://42.193.40.239:8017" ]]
|
||||
VITE_UPLOAD_URL = http://42.193.40.239:8888/
|
||||
# VITE_UPLOAD_URL = https://city.sczysoft.com/dffile/
|
||||
#
|
||||
|
|
|
|||
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll.eslint": false,
|
||||
"source.fixAll.stylelint": true
|
||||
"source.fixAll.eslint": "never",
|
||||
"source.fixAll.stylelint": "explicit"
|
||||
},
|
||||
"stylelint.validate": [
|
||||
"css",
|
||||
|
|
|
|||
4769
pnpm-lock.yaml
4769
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
374
src/views/emergency/danger-points/dialog/add-dynamic.vue
Normal file
374
src/views/emergency/danger-points/dialog/add-dynamic.vue
Normal file
|
|
@ -0,0 +1,374 @@
|
|||
|
||||
<template>
|
||||
<BaseDialog
|
||||
:dialogVisible="props.visible"
|
||||
@close="onclone"
|
||||
:titleName="'新增' + tabsTitle"
|
||||
width="50%"
|
||||
@onSubmit="handleSubmit"
|
||||
:footerclosed="true"
|
||||
:diafooter="true"
|
||||
:footerkeepnaem="props.readonly ? false : true"
|
||||
>
|
||||
<div class="detailForm-content">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
label-position="right"
|
||||
label-width="150px"
|
||||
:rules="ruleForm"
|
||||
:model="form"
|
||||
>
|
||||
<el-form-item label="动态标题:" prop="title" style="width: 100%;">
|
||||
<el-input
|
||||
placeholder="请输入动态标题"
|
||||
v-model="form.title"
|
||||
>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="动态内容:" prop="detail" style="width: 100%;">
|
||||
<el-input
|
||||
placeholder="请输入动态内容"
|
||||
v-model="form.detail"
|
||||
:rows="3"
|
||||
type="textarea"
|
||||
>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="时间:" prop="time">
|
||||
<el-date-picker
|
||||
v-model="form.time"
|
||||
type="daterange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始时间"
|
||||
end-placeholder="结束时间"
|
||||
size="default"
|
||||
format="YYYY-MM-DD"
|
||||
value-format="YYYY-MM-DD"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="类型:" prop="typeId">
|
||||
<el-select
|
||||
v-model="form.typeId"
|
||||
placeholder="请选择类型"
|
||||
style="width: 240px"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in option"
|
||||
:key="item.typeId"
|
||||
:label="item.typeName"
|
||||
:value="item.typeId"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="工作附件:" style="width: 100%;">
|
||||
<el-upload
|
||||
class="avatar-uploader"
|
||||
ref="uploadAfter"
|
||||
action="#"
|
||||
list-type="upload-demo"
|
||||
:file-list="afterList"
|
||||
:http-request="handleUploadAfter"
|
||||
>
|
||||
<el-icon class="avatar-uploader-icon" :size="40">
|
||||
<Plus />
|
||||
</el-icon>
|
||||
<template #file="{ file }">
|
||||
<div>
|
||||
<span class="el-upload-list__item-actions">
|
||||
<span class="el-upload-list__item-preview">
|
||||
<el-icon>
|
||||
<Document />
|
||||
</el-icon>
|
||||
<span>{{ file.realfilename }}</span>
|
||||
</span>
|
||||
<span
|
||||
class="el-upload-list__item-preview"
|
||||
@click="handleInfo(file)"
|
||||
>
|
||||
<el-icon><zoom-in /></el-icon>
|
||||
</span>
|
||||
<span
|
||||
class="el-upload-list__item-preview"
|
||||
@click="handleDownload(file)"
|
||||
>
|
||||
<el-icon>
|
||||
<Download />
|
||||
</el-icon>
|
||||
</span>
|
||||
<span
|
||||
class="el-upload-list__item-preview"
|
||||
@click="handleRemove(file)"
|
||||
>
|
||||
<el-icon>
|
||||
<Delete />
|
||||
</el-icon>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-dialog v-model="upVisible">
|
||||
<img w-full :src="upImageUrl" alt="Preview Image" />
|
||||
</el-dialog>
|
||||
</div>
|
||||
</BaseDialog>
|
||||
</template>
|
||||
<script setup lang="ts" >
|
||||
import { reactive, ref, onMounted, watch, getCurrentInstance } from "vue";
|
||||
import useUserStore from "@/store/modules/user";
|
||||
import { ElMessage, FormInstance, FormRules } from "element-plus";
|
||||
import type { UploadUserFile } from "element-plus";
|
||||
import { getYears, getUUID, FileType } from "@/utils/common";
|
||||
import { uploadFile, getFile, delFile } from "@/api/file";
|
||||
import { getListperformTree } from "@/api/Sys";
|
||||
import { wkDynamicsAdd,wkTypes } from "@/api/Work";
|
||||
|
||||
const formRef = ref<FormInstance>();
|
||||
const userStore = useUserStore();
|
||||
const user = ref(JSON.parse(userStore.userInfo));
|
||||
const userId = ref(user.value.userId);
|
||||
const uuid = ref(getUUID());
|
||||
const ruleForm = reactive<FormRules>({
|
||||
detail: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入动态内容",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
processedBy: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入处理人",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
time: [
|
||||
{
|
||||
required: true,
|
||||
message: "请选择时间",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
title:[
|
||||
{
|
||||
required: true,
|
||||
message: "请输入动态标题",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
typeId:[
|
||||
{
|
||||
required: true,
|
||||
message: "请选择动态类型",
|
||||
trigger: "change",
|
||||
}
|
||||
]
|
||||
});
|
||||
const props = defineProps({
|
||||
visible: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
form: Object,
|
||||
readonly: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
id: {
|
||||
type: String,
|
||||
}
|
||||
});
|
||||
const form = ref(<any>{});
|
||||
const tabsTitle = ref('工作动态')
|
||||
const emits = defineEmits(["close", "onSubmit"]);
|
||||
//保存并退出
|
||||
const handleSubmit = () => {
|
||||
formRef.value?.validate((valid) => {
|
||||
if (valid) {
|
||||
let params = {
|
||||
dynamicsId:uuid.value,
|
||||
detail: form.value.detail,
|
||||
title: form.value.title,
|
||||
typeId: form.value.typeId,
|
||||
userId: userId.value,
|
||||
startTime: form.value.time[0],
|
||||
endTime: form.value.time[1],
|
||||
targetId:props.id,
|
||||
};
|
||||
wkDynamicsAdd(params).then((res: any) => {
|
||||
if (res.code == 1) {
|
||||
ElMessage.success({
|
||||
message: "保存成功",
|
||||
type: "success",
|
||||
});
|
||||
onclone();
|
||||
} else {
|
||||
ElMessage.error({
|
||||
message: res.message,
|
||||
type: "error",
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
};
|
||||
// 文件上传
|
||||
const afterList = ref<UploadUserFile[]>([]);
|
||||
const handleUploadAfter = (file: any) => {
|
||||
const newFile = new FormData();
|
||||
newFile.append("file", file.file);
|
||||
uploadFile(userId.value,uuid.value, FileType.resumptionAcs, newFile).then((res) => {
|
||||
if (res) {
|
||||
ElMessage.success("上传成功!");
|
||||
getCheckDangers(uuid.value)
|
||||
}
|
||||
})
|
||||
|
||||
};
|
||||
//文件显示
|
||||
const baseImgUrl = ref(import.meta.env.VITE_UPLOAD_URL);
|
||||
const getCheckDangers = (id) => {
|
||||
getFile(
|
||||
id,
|
||||
FileType.resumptionAcs
|
||||
).then((res: any) => {
|
||||
afterList.value = res.data.map(item => {
|
||||
let arr = item;
|
||||
let index = item.filepath.indexOf(".");//获取第一个"_"的位置
|
||||
let after1 = item.filepath.substring(index + 1);
|
||||
switch (after1) {
|
||||
case 'xlsx':
|
||||
arr.url = 'src/assets/images/exl.png';
|
||||
break;
|
||||
case 'exl':
|
||||
arr.url = 'src/assets/images/exl.png';
|
||||
break;
|
||||
case 'pdf':
|
||||
arr.url = 'src/assets/images/pdf.png';
|
||||
break;
|
||||
case 'word':
|
||||
arr.url = 'src/assets/images/word.png';
|
||||
break;
|
||||
default:
|
||||
arr.url = baseImgUrl.value + item.filepath;
|
||||
break;
|
||||
}
|
||||
return arr;
|
||||
});
|
||||
})
|
||||
};
|
||||
//删除附件
|
||||
const handleRemove = (file) => {
|
||||
delFile(file.sysdocumentid).then((res: any) => {
|
||||
if (res) {
|
||||
ElMessage.success("删除成功!");
|
||||
}
|
||||
getCheckDangers(uuid.value);
|
||||
})
|
||||
};
|
||||
//下载附件
|
||||
const handleDownload = (file) => {
|
||||
function text() {
|
||||
const x = new XMLHttpRequest();
|
||||
x.open("GET", baseImgUrl.value + file.filepath, true);
|
||||
x.responseType = "blob";
|
||||
x.onload = function () {
|
||||
const url = window.URL.createObjectURL(x.response);
|
||||
const a = document.createElement("a");
|
||||
a.href = url;
|
||||
a.download = file.name;
|
||||
a.click();
|
||||
};
|
||||
x.send();
|
||||
}
|
||||
let index = file.filepath.indexOf("."); //获取第一个"_"的位置
|
||||
let after1 = file.filepath.substring(index + 1);
|
||||
switch (after1) {
|
||||
case "xlsx":
|
||||
text();
|
||||
break;
|
||||
case "exl":
|
||||
text();
|
||||
break;
|
||||
case "pdf":
|
||||
text();
|
||||
break;
|
||||
case "word":
|
||||
text();
|
||||
break;
|
||||
default:
|
||||
window.open(baseImgUrl.value + file.filepath, "_blank");
|
||||
break;
|
||||
}
|
||||
};
|
||||
const upVisible = ref(false);
|
||||
const upImageUrl = ref("");
|
||||
//查看附件
|
||||
const handleInfo = (file) => {
|
||||
upImageUrl.value = file.url!;
|
||||
upVisible.value = true;
|
||||
};
|
||||
//关闭弹窗
|
||||
const onclone = () => {
|
||||
afterList.value = [];
|
||||
form.value = {};
|
||||
emits("close");
|
||||
};
|
||||
//获取类型
|
||||
const option = ref([])
|
||||
const getWkTypes = () => {
|
||||
let params = {
|
||||
classify: 2,
|
||||
};
|
||||
wkTypes(params).then((res: any) => {
|
||||
option.value = res.data;
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
onMounted(() => {});
|
||||
watch(
|
||||
() => props.id,
|
||||
(val) => {
|
||||
uuid.value = getUUID();
|
||||
getWkTypes();
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.detailForm-content {
|
||||
margin-right: 30px;
|
||||
}
|
||||
:deep(.el-form) {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
// justify-content: space-around;
|
||||
justify-content: space-between;
|
||||
}
|
||||
:deep(.el-form-item) {
|
||||
width: 47%;
|
||||
}
|
||||
::v-deep(.el-upload-list__item-actions) {
|
||||
display: flex;
|
||||
> span:nth-child(2) {
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
::v-deep(.el-upload-list__item-preview) {
|
||||
margin-right: 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
> span {
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
::v-deep(.avatar-uploader-icon) {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -86,9 +86,33 @@
|
|||
label="详细地址"
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
prop="checkTime"
|
||||
:resizable="true"
|
||||
align="center"
|
||||
width="260"
|
||||
label="检查时间"
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
prop="nextTime"
|
||||
:resizable="true"
|
||||
align="center"
|
||||
label="下次检查时间"
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
prop="poolState"
|
||||
:resizable="true"
|
||||
align="center"
|
||||
width="100"
|
||||
label="风险状态"
|
||||
>
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.poolState === 1">正常</span>
|
||||
<span v-else style="color: red;">超时未检查</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
:resizable="true"
|
||||
align="center"
|
||||
width="300"
|
||||
label="操作"
|
||||
>
|
||||
<template #default="scope">
|
||||
|
|
@ -110,6 +134,10 @@
|
|||
<svg-icon name="detail" class="icon"></svg-icon>
|
||||
<span class="detail">详情</span>
|
||||
</span> -->
|
||||
<span class="operate" @click="adddynamic(scope.row.poolId)">
|
||||
<svg-icon name="add" class="icon"></svg-icon>
|
||||
<span class="edit">新增动态</span>
|
||||
</span>
|
||||
<span class="operate" @click="deletelist(scope.row.poolId)">
|
||||
<svg-icon name="delete" class="icon"></svg-icon>
|
||||
<span class="func">删除</span>
|
||||
|
|
@ -132,6 +160,8 @@
|
|||
</el-pagination>
|
||||
<!-- 新增 -->
|
||||
<AddEdit :visible="dialogVisible" :form="form" @close="onclone" />
|
||||
<!-- 新增 -->
|
||||
<Adddynamic :visible="dialogdynamic" :id="dynamicid" @close="ondynamic" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -141,6 +171,7 @@ import { onMounted, reactive, ref } from "vue";
|
|||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import { riskPoolPage, riskTypeList, riskPoolDel } from "@/api/emergency";
|
||||
import AddEdit from "./dialog/add-edit.vue";
|
||||
import Adddynamic from "./dialog/add-dynamic.vue";
|
||||
|
||||
import useUserStore from "@/store/modules/user";
|
||||
const userStore = useUserStore();
|
||||
|
|
@ -157,6 +188,8 @@ const pageSize = ref(10);
|
|||
const total = ref(0);
|
||||
|
||||
const dialogVisible = ref(false);
|
||||
const dialogdynamic = ref(false);
|
||||
const dynamicid = ref('')
|
||||
const form = ref({});
|
||||
const readonly = ref(false);
|
||||
|
||||
|
|
@ -214,6 +247,16 @@ const onclone = () => {
|
|||
form.value = {};
|
||||
getList();
|
||||
};
|
||||
const ondynamic = () => {
|
||||
dialogdynamic.value = false;
|
||||
form.value = {};
|
||||
getList();
|
||||
}
|
||||
//新增动态
|
||||
const adddynamic = (id:any) => {
|
||||
dialogdynamic.value = true;
|
||||
dynamicid.value = id;
|
||||
}
|
||||
onMounted(() => {
|
||||
getList();
|
||||
getRiskTypeList();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user