Bladeren bron

Merge branch 'qhse_ptw' of shuzhihua/pms-iot-vue into master

yanghao 2 dagen geleden
bovenliggende
commit
2574723618

+ 73 - 24
src/views/pms/qhse/certificate.vue

@@ -144,7 +144,7 @@
         <zm-table
           :loading="loading"
           :data="list"
-          height="calc(62.5vh - 220px)"
+          height="calc(61vh - 220px)"
           :show-overflow-tooltip="true"
           :row-style="tableRowStyle"
           :row-class-name="tableRowClassName">
@@ -209,7 +209,7 @@
                 link
                 type="success"
                 v-if="scope.row.certPic"
-                @click="handleViewImage(scope.row.certPic)">
+                @click="viewFile(scope.row.certPic)">
                 查看证书
               </el-button>
             </template>
@@ -356,8 +356,13 @@
           style="width: 100%" />
       </el-form-item>
 
-      <el-form-item label="证书图片" prop="certPic">
-        <UploadImage v-model="formData.certPic" />
+      <el-form-item label="证书附件" prop="certPic">
+        <!-- <UploadImage v-model="formData.certPic" /> -->
+        <UploadFile
+          v-model="formData.certPic"
+          :file-type="['pdf', 'jpg', 'png', 'jpeg']"
+          :file-size="100"
+          class="min-w-80px" />
       </el-form-item>
     </el-form>
 
@@ -367,18 +372,27 @@
     </template>
   </el-dialog>
 
-  <!-- 查看证书图片对话框 -->
-  <el-dialog :title="imageDialogTitle" v-model="imageDialogVisible" width="800px" center>
-    <!-- <img :src="imagePreviewUrl" alt="证书图片" style="max-width: 100%; max-height: 80vh" /> -->
+  <el-dialog v-model="dialogFileView" title="证书附件">
     <div
-      style="display: flex; justify-content: center; align-items: center; flex-direction: column">
-      <img
-        v-for="url in imagePreviewUrl"
-        :src="url"
-        :key="url"
-        alt="证书图片"
-        style="max-width: 100%" />
+      v-for="(file, index) in fileList"
+      :key="index"
+      class="flex items-center justify-between mt-5">
+      <span class="file-name-text text-ellipsis!">{{ extractFileName(file) }}</span>
+      <div>
+        <el-button link type="primary" @click="viewFileInfo(file)">
+          <Icon icon="ep:view" class="mr-2px" />查看</el-button
+        >
+        <el-button link type="primary" @click="handleDownload(file)">
+          <Icon icon="ep:download" class="mr-2px" />下载</el-button
+        >
+      </div>
     </div>
+
+    <template #footer>
+      <div class="dialog-footer mt-10">
+        <el-button type="primary" @click="dialogFileView = false"> 确认 </el-button>
+      </div>
+    </template>
   </el-dialog>
 </template>
 
@@ -391,7 +405,6 @@ import { ElMessageBox, ElMessage } from 'element-plus'
 const deptList = ref<Tree[]>([]) // 树形结构
 const deptList2 = ref<Tree[]>([]) // 树形结构
 import { formatDate } from '@/utils/formatTime'
-import UploadImage from '@/components/UploadFile/src/QHSEUploadImgs.vue'
 import { DICT_TYPE, getStrDictOptions, getBoolDictOptions } from '@/utils/dict'
 import { defaultProps } from '@/utils/tree'
 import { selectedDeptsEmployee } from '@/api/system/user'
@@ -426,8 +439,7 @@ const dialogTitle = ref('')
 const isEdit = ref(false)
 
 // 图片查看对话框
-const imageDialogVisible = ref(false)
-const imageDialogTitle = ref('证书图片')
+const dialogFileView = ref(false)
 const imagePreviewUrl = ref('')
 
 // 表单相关
@@ -570,11 +582,31 @@ const handleEdit = (row) => {
   dialogVisible.value = true
 }
 
-// 查看证书图片
-const handleViewImage = (imageUrl: any) => {
-  imagePreviewUrl.value = imageUrl.split(',')
-  imageDialogTitle.value = '证书图片'
-  imageDialogVisible.value = true
+let fileList = ref([])
+const viewFile = (file) => {
+  fileList.value = file.split(',')
+  dialogFileView.value = true
+}
+
+const viewFileInfo = (file) => {
+  window.open(
+    'http://doc.deepoil.cc:8012/onlinePreview?url=' + encodeURIComponent(Base64.encode(file))
+  )
+}
+
+const extractFileName = (url: string): string => {
+  try {
+    // 移除查询参数和哈希
+    const cleanUrl = url.split('?')[0].split('#')[0]
+    // 获取最后一个斜杠后的内容
+    const parts = cleanUrl.split('/')
+    const fileName = parts[parts.length - 1]
+    // URL 解码
+    return decodeURIComponent(fileName) || url
+  } catch {
+    // 如果解析失败,返回原始 URL
+    return url
+  }
 }
 
 // 确保时间戳是毫秒级的
@@ -716,6 +748,23 @@ const downloadFile = (response: any) => {
   window.URL.revokeObjectURL(url)
 }
 
+const handleDownload = async (url) => {
+  try {
+    const response = await fetch(url)
+    const blob = await response.blob()
+    const downloadUrl = window.URL.createObjectURL(blob)
+
+    const link = document.createElement('a')
+    link.href = downloadUrl
+    link.download = url.split('/').pop() // 自动获取文件名‌:ml-citation{ref="3" data="citationList"}
+    link.click()
+
+    URL.revokeObjectURL(downloadUrl)
+  } catch (error) {
+    console.error('下载失败:', error)
+  }
+}
+
 let userList = ref([])
 const handleDeptChange = async (value) => {
   const res = await selectedDeptsEmployee({
@@ -757,10 +806,10 @@ onMounted(async () => {
 </script>
 
 <style scoped>
-:deep(.el-tree--highlight-current) {
+::deep(.el-tree--highlight-current) {
   height: 200px !important;
 }
-:deep(.el-transfer-panel__body) {
+::deep(.el-transfer-panel__body) {
   height: 700px !important;
 }
 

+ 3 - 3
src/views/pms/qhse/index.vue

@@ -88,7 +88,7 @@
         <zm-table
           :loading="loading"
           :data="list"
-          height="calc(49vh - 150px)"
+          height="calc(46vh - 140px)"
           :show-overflow-tooltip="true"
           :row-style="tableRowStyle"
           :row-class-name="tableRowClassName">
@@ -953,10 +953,10 @@ onUnmounted(() => {
 </script>
 
 <style scoped>
-:deep(.el-tree--highlight-current) {
+::deep(.el-tree--highlight-current) {
   height: 200px !important;
 }
-:deep(.el-transfer-panel__body) {
+::deep(.el-transfer-panel__body) {
   height: 700px !important;
 }
 

+ 12 - 1
src/views/pms/qhse/iotmeasuredetect/IotMeasureDetectForm.vue

@@ -114,6 +114,15 @@
             @keyup.enter="handleQuery"
             class="!w-200px" />
         </el-form-item>
+
+        <el-form-item label="责任人" prop="dutyPerson">
+          <el-input
+            v-model="queryParams.dutyPerson"
+            placeholder="请输入责任人"
+            clearable
+            @keyup.enter="handleQuery"
+            class="!w-200px" />
+        </el-form-item>
         <el-form-item>
           <el-button @click="handleQuery"
             ><Icon icon="ep:search" class="mr-5px" /> {{ t('devicePerson.search') }}</el-button
@@ -336,7 +345,8 @@ const queryParams = reactive({
   pageNo: 1,
   pageSize: 10,
   measureName: undefined,
-  deptId: undefined
+  deptId: undefined,
+  dutyPerson: undefined
 })
 
 const handleQuery = () => {
@@ -346,6 +356,7 @@ const handleQuery = () => {
 const resetQuery = () => {
   queryParams.measureName = undefined
   queryParams.deptId = undefined
+  queryParams.dutyPerson = undefined
   handleQuery()
 }
 // 仪器选择相关

+ 1 - 1
src/views/pms/qhse/ptw/index.vue

@@ -179,7 +179,7 @@
           :check-strictly="false"
           node-key="id"
           filterable
-          placeholder="请选择所在部门" />
+          placeholder="请选择所属队伍" />
       </el-form-item>
       <el-form-item label="JSA编号" prop="ptwNo">
         <el-input v-model="formData.ptwNo" disabled placeholder="选择JSA编号" style="width: 300px">

+ 14 - 2
src/views/pms/qhse/safety/index.vue

@@ -234,7 +234,7 @@
   </el-row>
 
   <!-- 新增/编辑证书对话框 -->
-  <el-dialog
+  <Dialog
     :title="dialogTitle"
     v-model="dialogVisible"
     width="600px"
@@ -246,6 +246,17 @@
       :rules="formRules"
       label-width="120px"
       v-loading="formLoading">
+      <el-form-item label="所属队伍" prop="deptId">
+        <el-tree-select
+          clearable
+          v-model="formData.deptId"
+          :data="deptList2"
+          :props="defaultProps"
+          :check-strictly="false"
+          node-key="id"
+          filterable
+          placeholder="请选择所属队伍" />
+      </el-form-item>
       <el-form-item label="隐患排查类型" prop="classify">
         <el-tree-select
           style="width: 500px; overflow: auto"
@@ -302,7 +313,7 @@
       <el-button @click="closeDialog">取 消</el-button>
       <el-button type="primary" @click="submitForm" :loading="submitLoading">确 定</el-button>
     </template>
-  </el-dialog>
+  </Dialog>
 
   <!-- 整改 -->
   <el-dialog
@@ -513,6 +524,7 @@ const handleAdd = async () => {
   dialogTitle.value = '新增隐患排查'
   await getTree()
   resetForm()
+  formData.value.deptId = userStore.getUser.deptId
   dialogVisible.value = true
 }