Преглед изворни кода

Merge branch 'lm' of http://git.yujin.shuziyunyao.com/yujin/digital-medicine-front into lm

lisy пре 5 месеци
родитељ
комит
ea902343f6

BIN
src/assets/images/file-type-sub/csv.png


BIN
src/assets/images/file-type-sub/def.png


BIN
src/assets/images/file-type-sub/doc.png


BIN
src/assets/images/file-type-sub/jpg.png


BIN
src/assets/images/file-type-sub/pdf.png


BIN
src/assets/images/file-type-sub/png.png


BIN
src/assets/images/file-type-sub/ppt.png


BIN
src/assets/images/file-type-sub/txt.png


BIN
src/assets/images/file-type-sub/xlsx.png


BIN
src/assets/images/file-type-sub/zip.png


+ 29 - 0
src/utils/models.ts

@@ -73,3 +73,32 @@ export const formatOrigin = (adcdCodeDesc: any, nationTypeDesc: any) => {
         return nationTypeDesc || '-';
     }
 };
+
+// 根据传入url获取文件后缀名,根据文件后缀名返回相应的图片icon
+export const getFileIconByUrl = (url: string) => {
+    const fileExtension = url.substring(url.lastIndexOf('.') + 1).toLowerCase();
+    const iconMap: Record<string, string> = {
+        jpg: 'jpg',
+        jpeg: 'jpg',
+        png: 'png',
+        gif: 'jpg',
+        pdf: 'pdf',
+        doc: 'doc',
+        docx: 'doc',
+        xls: 'xlsx',
+        xlsx: 'xlsx',
+        txt: 'txt',
+        // 大写后缀映射
+        JPG: 'jpg',
+        JPEG: 'jpg',
+        PNG: 'png',
+        GIF: 'jpg',
+        PDF: 'pdf',
+        DOC: 'doc',
+        DOCX: 'doc',
+        XLS: 'xlsx',
+        XLSX: 'xlsx',
+        TXT: 'txt'
+    };
+    return `https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images/file-type-sub/${iconMap?.[fileExtension] || 'def'}.png`; // 默认图标
+};

+ 6 - 13
src/utils/ruoyi.ts

@@ -1,3 +1,4 @@
+import NP from 'number-precision';
 // 日期格式化
 export function parseTime(time: any, pattern?: string) {
     if (arguments.length === 0 || !time) {
@@ -256,28 +257,20 @@ export const fileExt = (fileName: string) => {
     // 获取文件后缀, 从后面到第一个点取 不包括.
     return fileName.slice(fileName.lastIndexOf('.') + 1);
 };
-export const changeByte = (byte: number) => {
+export const changeByte = (byte: number): string => {
     let size = '';
     if (byte < 0.1 * 1024) {
         // 小于0.1KB,则转化成B
-        size = `${byte.toFixed(2)}B`;
+        size = `${NP.round(byte, 2)}B`;
     } else if (byte < 0.1 * 1024 * 1024) {
         // 小于0.1MB,则转化成KB
-        size = `${(byte / 1024).toFixed(2)}KB`;
+        size = `${NP.round(byte / 1024, 2)}KB`;
     } else if (byte < 0.1 * 1024 * 1024 * 1024) {
         // 小于0.1GB,则转化成MB
-        size = `${(byte / (1024 * 1024)).toFixed(2)}MB`;
+        size = `${NP.round(byte / (1024 * 1024), 2)}MB`;
     } else {
         // 其他转化成GB
-        size = `${(byte / (1024 * 1024 * 1024)).toFixed(2)}GB`;
-    }
-
-    const sizeStr = `${size}`; // 转成字符串
-    const index = sizeStr.indexOf('.'); // 获取小数点处的索引
-    const dou = sizeStr.substring(index + 1, index + 3); // 获取小数点后两位的值
-    if (dou == '00') {
-        // 判断后两位是否为00,如果是则删除00
-        return sizeStr.substring(0, index);
+        size = `${NP.round(byte / (1024 * 1024 * 1024), 2)}GB`;
     }
     return size;
 };

+ 1 - 4
src/views/authority/authority-input/index.vue

@@ -232,10 +232,7 @@ const getExpertDetail = async () => {
     if (route.query?.id) {
         const res = await expertPersonDetail(route.query.id);
         if (!res || res.code !== 200) return;
-        form.value = {
-            ...res.data,
-            attachment: res.data.attachments
-        };
+        form.value = res.data
     }
 };
 onMounted(() => {

+ 1 - 1
src/views/authority/info/index.vue

@@ -67,13 +67,13 @@
                                 <DictTag :options="dm_position_status" :value="row?.status"></DictTag>
                             </template>
                         </vxe-column>
+                        <vxe-column title="所在地区" width="120" field="adcodeName" :formatter="colNoData" />
                         <vxe-column title="被抽取次数" width="100" field="chooseCount" :formatter="colNoData" />
                         <vxe-column title="前端显示" width="90">
                             <template #default="{ row }">
                                 <el-switch v-model="row.putawayFlag" active-value="1" inactive-value="0" @change="changeRowPutaway($event, row)"></el-switch>
                             </template>
                         </vxe-column>
-                        <vxe-column title="所在地区" width="120" field="adcodeName" :formatter="colNoData" />
                         <vxe-column title="操作" width="210" align="center" fixed="right">
                             <template #default="{ row }">
                                 <el-button type="primary" @click="editRow(row)" text style="width: 40px">编辑</el-button>

+ 4 - 3
src/views/authority/models/ExpertInfo.vue

@@ -34,16 +34,17 @@
             </el-descriptions>
         </div>
         <div class="jianjie">
+            <div class="f-s-14 c-#303133 mb-10">简介:</div>
             <div v-html="props.info?.brief"></div>
         </div>
 
         <div class="pt-30">
-            <div v-if="props.info?.attachments?.length" class="flex1 pt-20">
+            <div v-if="props.info?.attachment?.length" class="flex1 pt-20">
                 <div class="c-333 mb-10">附件:</div>
-                <FileLook v-model="props.info.attachments" :span="6"></FileLook>
+                <FileLook v-model="props.info.attachment" :span="6"></FileLook>
             </div>
             <div v-if="info?.images" class="flex1 pt-20">
-                <div class="c-333 mb-10">附件:</div>
+                <div class="c-333 mb-10">图片:</div>
                 <div class="d-flex flex-w">
                     <template v-for="(item, index) in info?.images.split(',')" :key="index">
                         <ImagePreview class="mr-20" :src="item" width="120px" height="120px"></ImagePreview>

+ 2 - 2
src/views/models/FileLook.vue

@@ -4,7 +4,7 @@
             <el-col :span="span" v-for="(file, index) in fileList" :key="index">
                 <div class="upload-list-item">
                     <el-link class="flex1 right-item" :href="`${file.url}`" :underline="false" target="_blank">
-                        <img style="width: 36px; height: 36px;" class="mr5" src="@/assets/images/pdf_icon.png" alt="" />
+                        <img style="width: 36px; height: 36px;" class="mr5" :src="getFileIconByUrl(file.url)" alt="" />
                         <div>
                             <div class="item-text">{{ file.fileName }}</div>
                             <div v-if="file.fileSize" class="item-text">{{ changeByte(file.fileSize) }}</div>
@@ -27,7 +27,7 @@
 import { download } from '@/utils/request';
 import { propTypes } from '@/utils/propTypes';
 import { changeByte } from '@/utils/ruoyi';
-
+import { getFileIconByUrl } from '@/utils/models';
 const props = defineProps({
     modelValue: [String, Object, Array],
     span: propTypes.number.def(18),

+ 6 - 6
src/views/training/meeting/index.vue

@@ -37,11 +37,11 @@
                 <div class="flex1 ov-hd">
                     <vxe-table :loading="loading" border :data="dataList" min-height="0" max-height="100%">
                         <vxe-column title="序号" align="center" type="seq" width="50" />
-                        <vxe-column field="trainingName" title="会议名称" :formatter="colNoData" min-width="150" class-name="f-w-5" />
-                        <vxe-column field="trainingTime" min-width="130" title="会议时间" class-name="f-w-5">
+                        <vxe-column field="trainingName" title="会议名称" :formatter="colNoData" min-width="150" class-name="f-w-600" />
+                        <vxe-column field="trainingTime" min-width="130" title="会议时间" class-name="f-w-600">
                             <template #default="{ row }">{{ row.trainingStart }}~{{ row.trainingEnd }}</template>
                         </vxe-column>
-                        <vxe-column field="signupsTime" min-width="130" title="报名时间" class-name="f-w-5">
+                        <vxe-column field="signupsTime" min-width="130" title="报名时间" class-name="f-w-600">
                             <template #default="{ row }">{{ row.signupStart }}~{{ row.signupEnd }}</template>
                         </vxe-column>
                         <vxe-column field="joinType" title="会议方式" width="80">
@@ -55,9 +55,9 @@
                                 {{ selectDictLabel(yes_no, row.certFlag) }}
                             </template>
                         </vxe-column>
-                        <vxe-column field="joinCount" title="报名人数" width="60" class-name="f-w-5" />
-                        <vxe-column field="signCount" title="签到人数" width="60" class-name="f-w-5" />
-                        <vxe-column field="waitCount" title="待审核人数" width="60" class-name="f-w-5" />
+                        <vxe-column field="joinCount" title="报名人数" width="60" class-name="f-w-600" />
+                        <vxe-column field="signCount" title="签到人数" width="60" class-name="f-w-600" />
+                        <vxe-column field="waitCount" title="待审核人数" width="60" class-name="f-w-600" />
                         <vxe-column field="certCount" title="领取证书人数" width="80" />
                         <vxe-column field="certFlag" title="会议状态" width="80">
                             <template #default="{ row }">

+ 2 - 2
vite/plugins/unocss.ts

@@ -71,8 +71,8 @@ export default () => {
             [/^pr-([\.\d]+)$/, ([_, num]) => ({ 'padding-right': `${num}px` })],
             // 字体大小
             [/^f-s-([\.\d]+)$/, ([_, num]) => ({ 'font-size': `${num}px` })],
-            // 字体加粗
-            [/^f-w-([\.\d]+)$/, ([_, num]) => ({ 'font-weight': `${num}` })],
+            // 字体加粗 f-w-5 f-w-500
+            [/^f-w-([\.\d]+)$/, ([_, num]) => ({ 'font-weight': `${+num < 100 ? +num * 100 : num}` })],
             // 宽
             [/^w-([\.\d]+)$/, ([_, num]) => ({ width: `${num}px` })],
             // 高