iZaiZaiA 3 年 前
コミット
8eecda322d

+ 14 - 1
src/global/components/hc-dialog/index.vue

@@ -1,5 +1,5 @@
 <template>
-    <el-dialog v-model="isShow" class="hc-modal-border" :class="[isTable?'hc-modal-table':'', isSlotExtra?'hc-modal-header-extra':'', ui]" :show-close="!isSlotExtra"
+    <el-dialog v-model="isShow" class="hc-modal-border" :class="[isTable?'hc-modal-table':'', isSlotExtra?'hc-modal-header-extra':'', ui]" :show-close="isClose"
                :style="isBgColor?'--el-dialog-bg-color:' + isBgColor:''" :title="title" :width="isWidth" draggable destroy-on-close @closed="dialogClosed">
         <template #header v-if="isSlotHeader || isSlotExtra">
             <slot name='header' v-if="isSlotHeader"/>
@@ -74,6 +74,10 @@ const props = defineProps({
         type: Boolean,
         default: false
     },
+    isClose: {
+        type: Boolean,
+        default: true
+    },
 })
 
 //变量
@@ -127,6 +131,15 @@ const buttonSaveClick = () => {
             .el-dialog__title {
                 flex: 1;
             }
+            .el-dialog__headerbtn {
+                position: relative;
+                top: initial;
+                right: initial;
+                width: auto;
+                height: inherit;
+                margin-left: 24px;
+                font-size: 18px;
+            }
         }
     }
 }

+ 28 - 0
src/styles/tentative/detect/test.scss

@@ -0,0 +1,28 @@
+.hc-switch-tab-content {
+    position: relative;
+    height: 100%;
+    display: flex;
+    justify-content: center;
+    border: 1px solid #e9e9e9;
+    border-radius: 4px;
+    .hc-no-table-form {
+        position: relative;
+        height: 100%;
+        display: flex;
+        justify-content: center;
+        align-items: center;
+        .table-form-no {
+            position: relative;
+            text-align: center;
+            img {
+                width: 200px;
+            }
+            .desc {
+                text-align: center;
+                font-size: 16px;
+                color: #aaa;
+                margin-bottom: 24px;
+            }
+        }
+    }
+}

+ 1 - 7
src/styles/tentative/material/approach.scss

@@ -1,12 +1,6 @@
-.hc-new-switch-tab-box {
-    position: relative;
-    display: flex;
-    justify-content: center;
-    margin-bottom: 24px;
-}
 .hc-switch-tab-content {
     position: relative;
-    height: calc(100% - 64px);
+    height: 100%;
     display: flex;
     justify-content: center;
     border: 1px solid #e9e9e9;

+ 152 - 0
src/views/tentative/detect/components/HcDragUpload.vue

@@ -0,0 +1,152 @@
+<template>
+    <el-upload ref="uploadRef" class="hc-upload-border approach" drag :action="action" :headers="getTokenHeader()" :data="uploadData" :accept="accept" :disabled="uploadDisabled" :limit="1" :show-file-list="false"
+               :before-upload="beforeUpload" :on-exceed="uploadExceed" :on-progress="uploadprogress" :on-success="uploadSuccess" :on-error="uploadError" :on-change="uploadChange" :auto-upload="false">
+
+        <div class="hc-upload-loading upload-file-info" v-loading="uploadDisabled" element-loading-text="上传中...">
+            <template v-if="uploadFileInfo?.name">
+                <HcIcon name="file-text" class="upload-file-icon"/>
+                <div class="upload-file-name">{{uploadFileInfo?.name}}</div>
+            </template>
+            <template v-else>
+                <HcIcon name="upload-cloud" class="upload-icon"/>
+                <div class="el-upload__text">拖动文件到这里 或 <em>点击这里选择文件</em> 并上传</div>
+            </template>
+        </div>
+
+        <template #tip>
+            <div class="el-upload__tip">允许格式:excel, 文件大小 小于 60MB</div>
+        </template>
+    </el-upload>
+</template>
+
+<script setup>
+import {ref,watch,onMounted} from "vue";
+import {getTokenHeader} from '~src/api/request/header';
+import {getObjValue, isSize} from "vue-utils-plus"
+import {genFileId} from "element-plus";
+const props = defineProps({
+    datas: {
+        type: Object,
+        default: () => ({})
+    },
+})
+
+//变量
+const uploadRef = ref(null)
+const uploadData = ref(props.datas)
+const uploadFileInfo = ref({})
+const uploadDisabled = ref(false)
+
+const action = '/api/blade-manager/exceltab/add-buss-file';
+const accept = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel';
+
+//监听
+watch(() => [
+    props.datas,
+], ([datas]) => {
+    uploadData.value = datas
+})
+
+
+//事件
+const emit = defineEmits(['progress', 'finished', 'change'])
+
+//上传前
+const beforeUpload = async (file) => {
+    if (isSize(file?.size,60)) {
+        return true;
+    } else {
+        window?.$message?.warning('文件大小, 不能过60M!');
+        return false;
+    }
+}
+
+//超出限制时
+const uploadExceed = (files) => {
+    uploadRef.value?.clearFiles()
+    const file = files[0]
+    file.uid = genFileId()
+    uploadRef.value?.handleStart(file)
+}
+
+//上传中
+const uploadprogress = () => {
+    uploadDisabled.value = true
+    emit('progress', true)
+}
+
+//上传完成
+const uploadSuccess = (res) => {
+    uploadDisabled.value = false
+    emit('progress', false)
+    emit('finished', {
+        type: 'success',
+        data: getObjValue(res?.data)
+    })
+}
+
+//上传失败
+const uploadError = (res) => {
+    uploadDisabled.value = false
+    emit('progress', false)
+    emit('finished', {
+        type: 'error',
+        data: getObjValue(res?.data)
+    })
+    window?.$message?.error('导入失败');
+}
+
+//文件改变时
+const uploadChange = (file) => {
+    console.log(file)
+    uploadFileInfo.value = file
+    emit('change', file)
+}
+
+const submit = () => {
+    uploadRef.value?.submit()
+}
+
+const clearFiles = () => {
+    uploadRef.value?.clearFiles()
+}
+
+// 暴露出去
+defineExpose({
+    submit,
+    clearFiles
+})
+</script>
+
+<style lang="scss">
+.hc-upload-border.approach {
+    .el-upload-dragger {
+        padding: 24px;
+    }
+    .hc-upload-loading.upload-file-info {
+        .hc-icon-i {
+            font-size: 40px;
+        }
+        .upload-icon {
+            color: var(--el-text-color-placeholder);
+        }
+        .upload-file-icon {
+            color: var(--el-color-primary-light-5);
+        }
+        .el-upload__text {
+            margin-top: 10px;
+        }
+        .upload-file-name {
+            margin-top: 10px;
+            font-size: 14px;
+            text-align: center;
+            color: var(--el-color-primary);
+        }
+    }
+    .el-upload__tip {
+        font-size: 14px;
+        margin-top: 16px;
+        color: var(--el-text-color-placeholder);
+    }
+}
+</style>

+ 1 - 1
src/views/tentative/detect/outside.vue

@@ -87,7 +87,7 @@
         </HcDialog>
 
         <!--新增/编辑-->
-        <HcDialog :show="addEditFormModal" title="新增/编辑 第三方检测信息" widths="70rem" isRowFooter @close="addEditFormModalClose">
+        <HcDialog :show="addEditFormModal" title="新增/编辑 第三方检测信息" widths="70rem" :isClose="false" isRowFooter @close="addEditFormModalClose">
             <template #extra>
                 <HcNewSwitch :datas="tabTypeTab" :keys="tabTypeKey" @change="tabTypeChange"/>
             </template>

+ 340 - 14
src/views/tentative/detect/test.vue

@@ -1,30 +1,356 @@
 <template>
-    <div class="hc-layout-box">
-        试验检测
+    <div class="hc-page-layout-box">
+        <div class="hc-layout-left-box" :style="'width:' + leftWidth + 'px;'">
+            <div class="hc-project-box">
+                <div class="hc-project-icon-box">
+                    <HcIcon name="stack"/>
+                </div>
+                <div class="ml-2 project-name-box">
+                    <span class="text-xl text-cut project-alias">{{projectInfo['projectAlias']}}</span>
+                    <div class="text-xs text-cut project-name">{{projectInfo['name']}}</div>
+                </div>
+            </div>
+            <div class="hc-tree-box">
+                <el-scrollbar>
+                    <WbsTree :autoExpandKeys="treeAutoExpandKeys" :projectId="projectId" :contractId="contractId" isColor @nodeTap="wbsElTreeClick"/>
+                </el-scrollbar>
+            </div>
+            <!--左右拖动-->
+            <div class="horizontal-drag-line" @mousedown="onmousedown"/>
+        </div>
+        <div class="hc-page-content-box">
+            <HcCard :scrollbar="false" actionSize="lg">
+                <template #header>
+                    <HcTooltip keys="tentative_detect_outside_add">
+                        <el-button type="primary" hc-btn @click="addFormModalClick">
+                            <HcIcon name="add-circle"/>
+                            <span>新增</span>
+                        </el-button>
+                    </HcTooltip>
+                    <HcTooltip keys="tentative_detect_outside_copy">
+                        <el-button hc-btn>
+                            <HcIcon name="file-copy-2"/>
+                            <span>复制</span>
+                        </el-button>
+                    </HcTooltip>
+                    <HcTooltip keys="tentative_detect_outside_del">
+                        <el-button hc-btn @click="delModalClick">
+                            <HcIcon name="delete-bin-2"/>
+                            <span>删除</span>
+                        </el-button>
+                    </HcTooltip>
+                    <HcTooltip keys="tentative_detect_outside_edit">
+                        <el-button hc-btn>
+                            <HcIcon name="printer"/>
+                            <span>批量打印</span>
+                        </el-button>
+                    </HcTooltip>
+                    <HcTooltip keys="tentative_detect_outside_edit">
+                        <el-button hc-btn>
+                            <HcIcon name="printer"/>
+                            <span>打印空表</span>
+                        </el-button>
+                    </HcTooltip>
+                </template>
+                <template #search>
+                    <div class="w-40">
+                        <el-select v-model="searchForm.user" placeholder="请选择试验人员" clearable>
+                            <el-option v-for="item in userData" :key="item.value" :label="item['label']" :value="item['value']"/>
+                        </el-select>
+                    </div>
+                    <div class="w-40 ml-2">
+                        <el-select v-model="searchForm.qualified" placeholder="请选择是否合格" clearable>
+                            <el-option v-for="item in qualifiedData" :key="item.value" :label="item['label']" :value="item['value']"/>
+                        </el-select>
+                    </div>
+                    <div class="w-64 ml-2">
+                        <HcDatePicker :dates="betweenTime" clearable @change="betweenTimeUpdate"/>
+                    </div>
+                    <div class="w-72 ml-2">
+                        <el-input v-model="searchForm.queryValue" placeholder="请输入项目名称关键字" clearable @keyup="keyUpEvent"/>
+                    </div>
+                    <div class="ml-2">
+                        <el-button type="primary" @click="searchClick">
+                            <HcIcon name="search-2"/>
+                            <span>搜索</span>
+                        </el-button>
+                    </div>
+                </template>
+                <HcTable ref="tableRef" :column="tableColumn" :datas="tableData" :loading="tableLoading" isCheck @selection-change="tableSelection">
+                    <template #key5="{row}">
+                        <span class="text-link" @click="tableRowEdit(row)">{{row?.key5}}</span>
+                    </template>
+                    <template #action="{row}">
+                        <HcTooltip keys="tentative_material_approach_annex">
+                            <el-button type="primary" size="small" plain @click="viewAttachmentModalClick(row)">附件</el-button>
+                        </HcTooltip>
+                        <HcTooltip keys="tentative_material_approach_sampling">
+                            <el-button type="primary" size="small" plain @click="samplingRecordModalClick(row)">样品信息</el-button>
+                        </HcTooltip>
+                    </template>
+                </HcTable>
+                <template #action>
+                    <HcPages :pages="searchForm" @change="pageChange"/>
+                </template>
+            </HcCard>
+        </div>
+
+        <!--查看附件-->
+        <HcDialog :show="viewAttachmentModal" title="查看附件" widths="70rem" :footer="false" isTable @close="viewAttachmentModalClose">
+            <template #extra>
+                <HcNewSwitch :datas="tabTypeTab" :keys="tabTypeKey" @change="tabTypeChange"/>
+            </template>
+            <div class="hc-switch-tab-content">
+                <div class="h-full w-full">
+                    <iframe allow="display-capture" width='100%' height='100%' frameborder='1' :src="attachmentPdfUrl" v-if="attachmentPdfUrl"/>
+                    <div class="hc-no-table-form" v-else>
+                        <div class="table-form-no">
+                            <img :src="notableform" alt=""/>
+                            <div class="desc">暂无 PDF 数据,请上传</div>
+
+                            <HcDragUpload/>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </HcDialog>
+
+        <!--查看样品信息-->
+        <HcDialog :show="samplingRecordModal" title="查看样品信息" widths="60%" :footer="false" isTable @close="samplingRecordModalClose">
+            <HcTable :column="samplingTableColumn" :datas="samplingTableData" :loading="samplingTableLoading" :isIndex="false"></HcTable>
+        </HcDialog>
+
     </div>
 </template>
 
 <script setup>
-import {ref,watch,onMounted} from "vue";
-import {useRouter, useRoute} from 'vue-router'
+import {ref, watch, onMounted} from "vue";
 import {useAppStore} from "~src/store";
+import WbsTree from "../../data-fill/components/WbsTree.vue"
+import {getStoreData, setStoreData} from '~src/utils/storage'
+import HcDragUpload from "./components/HcDragUpload.vue"
+import notableform from '~src/assets/view/notableform.svg';
 
-//初始变量
-const router = useRouter()
-const useRoutes = useRoute()
+//变量
 const useAppState = useAppStore()
-//const {getObjValue, getArrValue} = isType()
-
-//全局变量
 const projectId = ref(useAppState.getProjectId);
 const contractId = ref(useAppState.getContractId);
+const projectInfo = ref(useAppState.getProjectInfo);
+const isCollapse = ref(useAppState.getCollapse)
 
-</script>
+//监听
+watch(() => [
+    useAppState.getCollapse
+], ([Collapse]) => {
+    isCollapse.value = Collapse
+})
 
-<style lang="scss" scoped>
+//自动展开缓存
+const treeAutoExpandKeys = ref(getStoreData('wbsTreeExpandKeys') || [])
 
-</style>
+//渲染完成
+onMounted(() => {
+
+})
+
+const userData = ref([
+    {label: 'xxx', value: '1'}
+])
+
+const qualifiedData = ref([
+    {label: '是', value: '1'}
+])
+
+//搜索表单
+const searchForm = ref({user: null, qualified: null, betweenTime: null, queryValue: null, current: 1, size: 20, total: 0})
+
+//树相关的变量
+const primaryKeyId = ref('')
+const nodeItemInfo = ref({})
+const nodeDataInfo = ref({})
+
+//树被点击
+const wbsElTreeClick = ({node, data, keys}) => {
+    nodeItemInfo.value = node
+    nodeDataInfo.value = data
+    primaryKeyId.value = data['primaryKeyId'] || ''
+    //缓存自动展开
+    treeAutoExpandKeys.value = keys
+    setStoreData('wbsTreeExpandKeys',keys)
+    //改变搜索表单数据
+    //searchForm.value.wbsId = data['contractIdRelation'] ? data['id'] : data['primaryKeyId']
+    //searchForm.value.contractIdRelation = data['contractIdRelation']
+    searchForm.value.current = 1;
+    getTableData()
+}
+
+//日期时间被选择
+const betweenTime = ref(null)
+const betweenTimeUpdate = ({arr,query}) => {
+    betweenTime.value = arr
+    searchForm.value.betweenTime = query
+}
+
+//回车搜索
+const keyUpEvent = (e) => {
+    if (e.key === "Enter") {
+        searchForm.value.current = 1;
+        getTableData()
+    }
+}
+
+//搜索
+const searchClick = () => {
+    searchForm.value.current = 1;
+    getTableData()
+}
+
+//分页被点击
+const pageChange = ({current, size}) => {
+    searchForm.value.current = current
+    searchForm.value.size = size
+    getTableData()
+}
+
+//表格数据
+const tableRef = ref(null)
+const tableColumn = ref([
+    {key:'key1', name: '编号'},
+    {key:'key2', name: '记录编号'},
+    {key:'key3', name: '报告编号'},
+    {key:'key4', name: '取样地点'},
+    {key:'key5', name: '试验项目名称'},
+    {key:'key6', name: '检测类别'},
+    {key:'key7', name: '是否上传合格证'},
+    {key:'key8', name: '合同段'},
+    {key:'key9', name: '单位'},
+    {key:'key10', name: '样品编号'},
+    {key:'key11', name: '规格类型'},
+    {key:'key12', name: '检测结果'},
+    {key:'key13', name: '工程部位及用途'},
+    {key:'key14', name: '报告日期'},
+    {key:'key15', name: '试验人员'},
+    {key:'key16', name: '任务状态'},
+    {key:'action', name: '操作', width: 150, fixed: 'right', align: 'center'},
+])
 
-<style lang="scss">
+//获取数据
+const tableLoading = ref(false)
+const tableData = ref([
+    {key5: '测试测试测试'}
+])
+const getTableData = async () => {
 
+}
+
+//多选
+const tableCheckedKeys = ref([]);
+const tableSelection = (rows) => {
+    tableCheckedKeys.value = rows.filter((item) => {
+        return (item??'') !== '';
+    })
+}
+
+//新增
+const addFormModalClick = () => {
+
+}
+
+//编辑
+const tableRowEdit = () => {
+
+}
+
+//删除
+const delModalClick = () => {
+    window?.$messageBox?.alert('请谨慎考虑后,确认是否需要删除?', '删除提醒', {
+        showCancelButton: true,
+        confirmButtonText: '确认删除',
+        cancelButtonText: '取消',
+        type: 'warning',
+        callback: (action) => {
+            if (action === 'confirm') {
+                //removeContractTreeNode()
+            }
+        }
+    })
+}
+
+//查看附件
+const viewAttachmentModal = ref(false)
+const viewAttachmentModalClick = (row) => {
+    viewAttachmentModal.value = true
+}
+
+const attachmentPdfUrl = ref('')
+
+//类型tab数据和相关处理
+const tabTypeKey = ref('tab1')
+const tabTypeTab = ref([
+    {key:'tab1',  name: '生产合格证'},
+    {key:'tab2', name: '厂家质检报告'},
+    {key:'tab3', name: '其他文件'},
+]);
+const tabTypeChange = (item) => {
+    tabTypeKey.value = item?.key
+}
+
+//关闭查看附件
+const viewAttachmentModalClose = () => {
+    viewAttachmentModal.value = false
+}
+
+//取样记录
+const samplingRecordModal = ref(false)
+const samplingRecordModalClick = (row) => {
+    samplingRecordModal.value = true
+}
+
+//样品信息数据
+const samplingTableColumn = ref([
+    {key:'key1', name: '样品名称'},
+    {key:'key2', name: '取样时间'},
+    {key:'key3', name: '样品编号'},
+    {key:'key4', name: '规格型号'},
+    {key:'key5', name: '试样数量'},
+    {key:'key6', name: '计算单位'},
+    {key:'key7', name: '拟用部位'},
+    {key:'key8', name: '代表数量'},
+    {key:'key9', name: '取样人'},
+])
+const samplingTableData = ref([])
+const samplingTableLoading = ref(false)
+
+//关闭样品信息
+const samplingRecordModalClose = () => {
+    samplingRecordModal.value = false
+}
+
+
+//拼接ID
+const rowsToId = (rows) => {
+    return rows.map((obj) => {
+        return obj.id;
+    }).join(",")
+}
+
+//左右拖动,改变树形结构宽度
+const leftWidth = ref(382);
+const onmousedown = () => {
+    const leftNum = isCollapse.value ? 142 : 272
+    document.onmousemove = (ve) => {
+        let diffVal = ve.clientX - leftNum;
+        if(diffVal >= 310 && diffVal <= 900) {
+            leftWidth.value = diffVal;
+        }
+    }
+    document.onmouseup = () => {
+        document.onmousemove = null;
+        document.onmouseup = null;
+    }
+}
+</script>
+
+<style lang="scss" scoped>
+@import "../../../styles/tentative/detect/test.scss";
 </style>

+ 1 - 1
src/views/tentative/detect/third.vue

@@ -87,7 +87,7 @@
         </HcDialog>
 
         <!--新增/编辑-->
-        <HcDialog :show="addEditFormModal" title="新增/编辑 外委试验信息" widths="70rem" isRowFooter @close="addEditFormModalClose">
+        <HcDialog :show="addEditFormModal" title="新增/编辑 外委试验信息" widths="70rem" isRowFooter :isClose="false" @close="addEditFormModalClose">
             <template #extra>
                 <HcNewSwitch :datas="tabTypeTab" :keys="tabTypeKey" @change="tabTypeChange"/>
             </template>

+ 2 - 2
src/views/tentative/material/approach.vue

@@ -173,9 +173,9 @@
 
         <!--查看附件-->
         <HcDialog :show="viewAttachmentModal" title="查看附件" widths="70rem" :footer="false" isTable @close="viewAttachmentModalClose">
-            <div class="hc-new-switch-tab-box">
+            <template #extra>
                 <HcNewSwitch :datas="tabTypeTab" :keys="tabTypeKey" @change="tabTypeChange"/>
-            </div>
+            </template>
             <div class="hc-switch-tab-content">
                 <div class="h-full w-full">
                     <iframe allow="display-capture" width='100%' height='100%' frameborder='1' :src="attachmentPdfUrl" v-if="attachmentPdfUrl"/>