pull/1/head
z 2024-01-12 09:51:58 +08:00
parent f12ae4a5bc
commit b30aaf9f34
14 changed files with 189 additions and 105 deletions

View File

@ -4,9 +4,8 @@
:model-value="visible && model === 'dialog'"
@update:model-value="visible = false"
>
<div v-if="visible && model === 'dialog'">
<div v-if="visible">
<vue-pdf
ref="pdfRef"
v-for="page in numOfPages"
:key="page"
:src="VITE_FILE_URL + src"
@ -14,9 +13,8 @@
/>
</div>
</el-dialog>
<div v-if="model === 'normal'">
<div v-if="model === 'normal'" :key="src">
<vue-pdf
ref="pdfRef"
v-for="page in numOfPages"
:key="page"
:src="VITE_FILE_URL + src"
@ -53,11 +51,9 @@ const props = defineProps({
});
const emits = defineEmits(["update:visible"]);
const visible = useVModel(props, "visible", emits);
const pdfRef = ref(null);
const numOfPages = ref(0);
watchEffect(() => {
if (props.visible) {
console.log(1111);
if (props.visible || props.src) {
const loadingTask = createLoadingTask(VITE_FILE_URL + props.src);
loadingTask.promise
.then((pdf) => {

View File

@ -40,5 +40,13 @@ export const getHiddenDangerDatabaseList = (params) =>
post("/hiddenLibrary/list", params); // 隐患数据库列表
export const setInventoryTroubleshootingOtherHiddenDangerAdd = (params) =>
post("/hidden/add", params); // 清单排查其它隐患添加
export const setInventoryTroubleshootingOtherHiddenDangerView = (params) =>
export const getInventoryTroubleshootingOtherHiddenDangerView = (params) =>
post("/hidden/goEdit", params); // 清单排查其它隐患查看
export const setInventoryTroubleshootingOtherHiddenDangerDelete = (params) =>
post("/hidden/delete", params); // 清单排查其它隐患删除
export const setInventoryTroubleshootingOtherHiddenDangerEdit = (params) =>
post("/hidden/edit", params); // 清单排查其它隐患修改
export const setInventoryTroubleshootingOtherHiddenDangerListAdd = (params) =>
post("/hidden/listAdd", params); // 清单排查其它隐患添加
export const setInventoryTroubleshootingSubmit = (params) =>
post("/checkrecord/add", params); // 清单排查提交

View File

@ -10,12 +10,12 @@
>
<el-space wrap>
<layout-upload
v-model:file-list="data.form.file"
:file-list="[]"
accept=".pdf"
:show-file-list="false"
auto-upload
:http-request="fnUploadArchivesFile"
:limit="1"
:limit="999"
>
<template #tip>只能上传pdf文件</template>
</layout-upload>

View File

@ -62,8 +62,8 @@ const info = ref({});
const { list } = useListData(getInventoryManagementView, {
otherParams: { LISTMANAGER_ID },
usePagination: false,
callbackFn: (list, responseData) => {
info.value = responseData.pd;
callbackFn: (list, resData) => {
info.value = resData.pd;
},
});
console.log(list);

View File

@ -84,8 +84,8 @@ const { list } = useListData(getInventoryManagementView, {
LISTMANAGER_ID,
},
usePagination: false,
callbackFn: (list, responseData) => {
info.value = responseData.pd;
callbackFn: (list, resData) => {
info.value = resData.pd;
},
});
const fnSelect = (row, index) => {

View File

@ -75,8 +75,8 @@ const { list } = useListData(getInventoryManagementView, {
LISTMANAGER_ID,
},
usePagination: false,
callbackFn: (list, responseData) => {
info.value = responseData.pd;
callbackFn: (list, resData) => {
info.value = resData.pd;
},
});
const fnPartQrCode = (row) => {

View File

@ -107,8 +107,8 @@ const { list } = useListData(getInventoryManagementView, {
LISTMANAGER_ID,
},
usePagination: false,
callbackFn: (list, responseData) => {
info.value = responseData.pd;
callbackFn: (list, resData) => {
info.value = resData.pd;
},
});
</script>

View File

@ -1,7 +1,7 @@
<template>
<el-dialog
v-model="visible"
:title="type === 'add' ? '修改隐患' : '添加隐患'"
:title="type === 'add' ? '添加隐患' : '修改隐患'"
:on-close="fnClose"
width="1200"
>
@ -201,10 +201,12 @@ import { reactive, ref, watchEffect } from "vue";
import LayoutUpload from "@/components/upload/index.vue";
import { useVModels } from "@vueuse/core";
import { debounce } from "throttle-debounce";
import { ElLoading, ElMessage } from "element-plus";
import { ElMessage } from "element-plus";
import {
getHiddenDangerDatabaseList,
setInventoryTroubleshootingOtherHiddenDangerAdd,
setInventoryTroubleshootingOtherHiddenDangerEdit,
setInventoryTroubleshootingOtherHiddenDangerListAdd,
} from "@/request/hazard_investigation.js";
import {
layoutFnGetHazardCategories,
@ -248,6 +250,16 @@ const props = defineProps({
required: true,
default: "",
},
longitude: {
type: Number,
required: true,
default: 0,
},
latitude: {
type: Number,
required: true,
default: 0,
},
});
const emits = defineEmits(["update:visible", "update:form", "submit"]);
const { visible, form } = useVModels(props, emits);
@ -333,31 +345,32 @@ watchEffect(() => {
});
const fnClose = () => {
formRef.value.resetFields();
data.list = [];
data.rectifyUserList = [];
visible.value = false;
};
const fnSubmit = debounce(
1000,
async () => {
await useFormValidate(formRef);
const loading = ElLoading.service({
lock: true,
text: "加载中...",
background: "rgba(0, 0, 0, 0.5)",
});
const geolocation = new window.BMapGL.Geolocation();
geolocation.getCurrentPosition(async (r) => {
loading.close();
if (!r) {
ElMessage.error("获取位置信息失败,请重新提交");
let currentHiddenId = "";
let params = {
...form.value,
STATE: "0",
HIDDENTYPE1: form.value.HIDDENTYPE[0],
HIDDENTYPE2: form.value.HIDDENTYPE[1],
HIDDENTYPE3: form.value.HIDDENTYPE[2],
HIDDENTYPE_NAME: hiddenDangerTypeRef.value.getCheckedNodes(),
LISTMANAGER_ID: props.listManagerId,
};
if (props.hiddenType === "unqualified") {
if (!props.longitude && !props.latitude) {
ElMessage.error("正在获取当前位置中,请等待");
return;
}
let currentHiddenId = "";
let params = {};
if (props.hiddenType === "unqualified") {
params = {
...form.value,
...params,
SOURCE: "2",
STATE: "0",
RISK_UNIT: props.info.RISKUNITNAME,
IDENTIFICATION: props.info.PARTSNAME,
RISK_DESCR: props.info.RISK_DESCR,
@ -366,19 +379,33 @@ const fnSubmit = debounce(
CHECK_CONTENT: props.info.CHECK_CONTENT,
RECORDITEM_ID: props.info.RECORDITEM_ID,
RISKITEM_ID: props.info.LISTCHECKITEM_ID,
LISTMANAGER_ID: props.listManagerId,
LONGITUDE: r.longitude,
LATITUDE: r.latitude,
HIDDENTYPE1: form.value.HIDDENTYPE[0],
HIDDENTYPE2: form.value.HIDDENTYPE[1],
HIDDENTYPE3: form.value.HIDDENTYPE[2],
HIDDENTYPE_NAME: hiddenDangerTypeRef.value.getCheckedNodes(),
LONGITUDE: props.longitude,
LATITUDE: props.latitude,
};
const resData = await setInventoryTroubleshootingOtherHiddenDangerAdd(
params
);
currentHiddenId = resData.pd.HIDDEN_ID;
}
if (props.hiddenType === "otherHidden") {
params = {
...params,
HIDDEN_ID: props.info.HIDDEN_ID,
SOURCE: "3",
HAVESCHEME: 0,
};
if (props.type === "add") {
const resData =
await setInventoryTroubleshootingOtherHiddenDangerListAdd(params);
currentHiddenId = resData.pd.HIDDEN_ID;
}
if (props.type === "edit") {
const resData = await setInventoryTroubleshootingOtherHiddenDangerEdit(
params
);
currentHiddenId = resData.pd.HIDDEN_ID;
}
}
for (let i = 0; i < form.value.hiddenImgs.length; i++) {
if (form.value.hiddenImgs[i].raw)
await fnUploadImage(currentHiddenId, form.value.hiddenImgs[i].raw, 3);
@ -389,16 +416,11 @@ const fnSubmit = debounce(
}
for (let i = 0; i < form.value.rectifyImgs.length; i++) {
if (form.value.rectifyImgs[i].raw)
await fnUploadImage(
currentHiddenId,
form.value.rectifyImgs[i].raw,
4
);
await fnUploadImage(currentHiddenId, form.value.rectifyImgs[i].raw, 4);
}
fnClose();
ElMessage.success("保存成功");
emits("submit", currentHiddenId);
});
},
{ atBegin: true }
);

View File

@ -158,8 +158,8 @@ const router = useRouter();
let ISREST = "";
const { list, pagination, searchForm, fnGetData, fnResetPagination } =
useListData(getInventoryTroubleshootingList, {
callbackFn: (list, responseData) => {
ISREST = responseData.ISREST;
callbackFn: (list, resData) => {
ISREST = resData.ISREST;
},
});
const troubleshootingCycleList = await layoutFnGetTroubleshootingCycle();

View File

@ -51,7 +51,7 @@
<el-radio :label="1" @click.prevent="fnUnqualified($index, row)">
不合格
</el-radio>
<el-radio :label="2" @click.prevent="fnNotInvolved($index)">
<el-radio :label="2" @click.prevent="fnNotInvolved($index, row)">
不涉及
</el-radio>
</el-radio-group>
@ -60,7 +60,9 @@
</layout-table>
<el-divider content-position="left">其他隐患</el-divider>
<div class="tr mb-10">
<el-button type="primary"> 添加 </el-button>
<el-button type="primary" @click="fnAddOrEditOtherHidden({}, 'add')">
添加
</el-button>
</div>
<layout-table :data="otherHiddenList" :show-pagination="false">
<el-table-column label="序号" width="70" type="index" />
@ -71,7 +73,7 @@
type="primary"
text
link
@click="editOtherHidden(row.HIDDEN_ID)"
@click="fnAddOrEditOtherHidden(row, 'edit')"
>
修改
</el-button>
@ -79,7 +81,7 @@
type="primary"
text
link
@click="removeOtherHidden(row.HIDDEN_ID)"
@click="fnDeleteOtherHidden(row.HIDDEN_ID)"
>
删除
</el-button>
@ -97,8 +99,8 @@
<el-form-item label="检查时间" prop="CHECK_TIME">
<el-date-picker
v-model="data.form.CHECK_TIME"
format="YYYY-MM-DD HH:mm:SS"
value-format="YYYY-MM-DD HH:mm:SS"
format="YYYY-MM-DD HH:mm:ss"
value-format="YYYY-MM-DD HH:mm:ss"
type="datetime"
placeholder="这里输入检查时间"
/>
@ -201,17 +203,21 @@
:hidden-type="data.unQualifiedDialog.hiddenType"
:list-manager-id="LISTMANAGER_ID"
:info="{ ...data.unQualifiedDialog.info, ...info.value }"
:longitude="data.longitude"
:latitude="data.latitude"
@submit="fnHiddenSubmit"
/>
</layout-card>
</template>
<script setup>
import { nextTick, reactive, ref } from "vue";
import { nextTick, onMounted, reactive, ref } from "vue";
import {
getInventoryManagementView,
getInventoryTroubleshootingOtherHiddenList,
setInventoryTroubleshootingOtherHiddenDangerView,
getInventoryTroubleshootingOtherHiddenDangerView,
setInventoryTroubleshootingOtherHiddenDangerDelete,
setInventoryTroubleshootingSubmit,
} from "@/request/hazard_investigation.js";
import { useRoute, useRouter } from "vue-router";
import useListData from "@/assets/js/useListData.js";
@ -225,9 +231,10 @@ import { getUserListAll } from "@/request/data_dictionary.js";
import { getViewImg } from "@/request/api.js";
import { debounce } from "throttle-debounce";
import useFormValidate from "@/assets/js/useFormValidate.js";
import { ElLoading, ElMessage } from "element-plus";
import { ElMessage, ElMessageBox } from "element-plus";
import Qualified from "./components/qualified.vue";
import UnQualified from "./components/un_qualified.vue";
import { cloneDeep } from "lodash-es";
const route = useRoute();
const router = useRouter();
@ -240,6 +247,8 @@ const rules = {
const formRef = ref(null);
const info = ref({});
const data = reactive({
longitude: 0,
latitude: 0,
form: {
CHECK_TIME: "",
inspectedList: [],
@ -272,17 +281,30 @@ const data = reactive({
},
},
});
onMounted(() => {
const geolocation = new window.BMapGL.Geolocation();
geolocation.getCurrentPosition(async (r) => {
if (!r) {
await ElMessageBox.alert("获取位置信息失败,请刷新重试", {
type: "warning",
});
window.location.reload();
}
data.longitude = r.longitude;
data.latitude = r.latitude;
});
});
const { list: inspectionList } = useListData(getInventoryManagementView, {
otherParams: { LISTMANAGER_ID },
usePagination: false,
callbackFn: (list, responseData) => {
callbackFn: (list, resData) => {
for (let i = 0; i < list.length; i++) {
if (list[i].HASHIDDEN <= 0) list[i].ISNORMAL = 0;
}
info.value = responseData.pd;
info.value = resData.pd;
},
});
const { list: otherHiddenList } = useListData(
const { list: otherHiddenList, fnGetData: fnGetOtherHidden } = useListData(
getInventoryTroubleshootingOtherHiddenList,
{
otherParams: { LISTMANAGER_ID },
@ -291,6 +313,7 @@ const { list: otherHiddenList } = useListData(
}
);
const fnQualified = async (index, row) => {
if (row.HASHIDDEN > 0) return;
data.qualifiedDialog.visible = true;
await nextTick();
data.qualifiedDialog.RECORDITEM_ID = row.RECORDITEM_ID;
@ -304,7 +327,8 @@ const fnQualified = async (index, row) => {
}
inspectionList.value[index].ISNORMAL = 0;
};
const fnNotInvolved = (index) => {
const fnNotInvolved = (index, row) => {
if (row.HASHIDDEN > 0) return;
fnRemoveUnqualified(index);
inspectionList.value[index].ISNORMAL = 2;
};
@ -312,6 +336,7 @@ const fnRemoveUnqualified = (index) => {
inspectionList.value[index].HIDDEN_ID = "";
};
const fnUnqualified = async (index, row) => {
if (row.HASHIDDEN > 0) return;
data.unQualifiedDialog.visible = true;
await nextTick();
if (
@ -328,7 +353,7 @@ const fnUnqualified = async (index, row) => {
data.unQualifiedDialog.hiddenType = "unqualified";
};
const fnGetHiddenDangerView = async (HIDDEN_ID) => {
const resData = await setInventoryTroubleshootingOtherHiddenDangerView({
const resData = await getInventoryTroubleshootingOtherHiddenDangerView({
HIDDEN_ID,
});
data.unQualifiedDialog.form = resData.pd;
@ -354,6 +379,9 @@ const fnHiddenSubmit = (currentHiddenId) => {
inspectionList.value[index].ISNORMAL = 1;
inspectionList.value[index].HIDDEN_ID = currentHiddenId;
}
if (hiddenType === "otherHidden") {
fnGetOtherHidden();
}
};
const fnAddInspectedList = () => {
data.form.inspectedList.push({
@ -372,19 +400,50 @@ const fnInspectDepartmentChange = async (event, index) => {
});
data.form.inspectedList[index].userList = resData.userList;
};
const fnDeleteOtherHidden = async (HIDDEN_ID) => {
await ElMessageBox.confirm("确定要删除吗?", {
type: "warning",
});
await setInventoryTroubleshootingOtherHiddenDangerDelete({ HIDDEN_ID });
fnGetOtherHidden();
};
const fnAddOrEditOtherHidden = async (row, type) => {
data.unQualifiedDialog.visible = true;
await nextTick();
data.unQualifiedDialog.type = type;
data.unQualifiedDialog.info = row;
data.unQualifiedDialog.hiddenType = "otherHidden";
if (type === "edit") await fnGetHiddenDangerView(row.HIDDEN_ID);
};
const fnSubmit = debounce(
1000,
async () => {
await useFormValidate(formRef);
const loading = ElLoading.service({
lock: true,
text: "加载中...",
background: "rgba(0, 0, 0, 0.5)",
});
const geolocation = new window.BMapGL.Geolocation();
geolocation.getCurrentPosition(async (r) => {
console.log(r);
loading.close();
const items = [];
const ids = [];
for (let i = 0; i < inspectionList.value.length; i++) {
const item = {};
item.LISTCHECKITEM_ID = inspectionList.value[i].LISTCHECKITEM_ID;
item.ISNORMAL = inspectionList.value[i].ISNORMAL;
item.RECORDITEM_ID = inspectionList.value[i].RECORDITEM_ID;
items.push(item);
if (inspectionList.value[i].ISNORMAL === 1)
ids.push(inspectionList.value[i].HIDDEN_ID);
}
const inspectedList = cloneDeep(data.form.inspectedList);
if (inspectedList.length > 0) inspectedList.splice(0, 1);
await setInventoryTroubleshootingSubmit({
LISTMANAGER_ID,
LIST_NAME: info.value.NAME,
CHECK_TIME: data.form.CHECK_TIME,
DESCR: data.form.DESCR,
ITEMS: JSON.stringify(items),
IDS: ids.join(","),
CHECKDEPT: data.form.inspectedList[0].DEPARTMENT_ID,
CHECKOR: data.form.inspectedList[0].USER_ID,
OTHER: JSON.stringify(inspectedList),
LONGITUDE: data.longitude,
LATITUDE: data.latitude,
});
ElMessage.success("操作成功");
router.back();

View File

@ -288,7 +288,7 @@ const fnPreviewVideo = async (row) => {
});
if (respData && respData.type === "success") {
const video = {};
respData.videoList.forEach((item) => {
respData.videoList?.forEach((item) => {
video[item.definition] = item.playURL;
});
data.videoDialog.src = JSON.stringify(video);

View File

@ -210,7 +210,7 @@ const fnPreviewVideo = async (row) => {
});
if (respData && respData.type === "success") {
const video = {};
respData.videoList.forEach((item) => {
respData.videoList?.forEach((item) => {
video[item.definition] = item.playURL;
});
data.videoDialog.src = JSON.stringify(video);

View File

@ -196,7 +196,7 @@ const fnPreviewVideo = async (row) => {
});
if (respData && respData.type === "success") {
const video = {};
respData.videoList.forEach((item) => {
respData.videoList?.forEach((item) => {
video[item.definition] = item.playURL;
});
data.videoDialog.src = JSON.stringify(video);

View File

@ -4,7 +4,6 @@
<el-descriptions-item label="试卷名称">
{{ data.paperInfo.EXAMNAME }}
</el-descriptions-item>
<el-descriptions-item label="" />
<el-descriptions-item label="试卷总分">
{{ data.paperInfo.EXAMSCORE }}
</el-descriptions-item>
@ -37,7 +36,7 @@
</el-descriptions-item>
</el-descriptions>
<template v-for="(row, index) in data.questionList" :key="row.QUESTION_ID">
<div v-for="(row, index) in data.questionList" :key="row.QUESTION_ID">
<div class="mt-20">
{{ index + 1 }}.
<span v-if="row.QUESTIONTYPE === '1'" class="question-type">
@ -83,7 +82,7 @@
</el-radio-group>
</div>
<div class="mt-10">答案{{ row.ANSWER }}</div>
</template>
</div>
</layout-card>
</template>