Browse Source

feat(draw): update

gemercheung 1 year ago
parent
commit
225d59d2cb
4 changed files with 200 additions and 136 deletions
  1. 1 0
      src/store/case.ts
  2. 37 10
      src/view/case/caseFile.vue
  3. 2 2
      src/view/case/records/index.vue
  4. 160 124
      src/view/case/records/manifest.vue

+ 1 - 0
src/store/case.ts

@@ -26,6 +26,7 @@ import { ModelScene, QuoteScene, Scene, SceneType } from "./scene";
 import { CaseFile } from "./caseFile";
 
 export type Case = {
+  value: Case;
   caseId: number;
   caseTitle: string;
   createTime: string;

+ 37 - 10
src/view/case/caseFile.vue

@@ -1,15 +1,20 @@
 <template>
-  <com-head :options="options" v-model="currentTypeId" notContent v-if="options.length" />
+  <com-head
+    :options="options"
+    v-model="currentTypeId"
+    notContent
+    v-if="options.length"
+  />
 
   <div class="body-layer">
     <template v-if="currentTypeId === 2">
       <Photos :caseId="caseId" />
     </template>
     <template v-else-if="currentTypeId === 3">
-      <Records :caseId="caseId" />
+      <Records :caseId="caseId" :title="caseInfoData.caseTitle" />
     </template>
     <template v-else-if="currentTypeId === 5">
-      <Manifest :caseId="caseId" />
+      <Manifest :caseId="caseId" :title="caseInfoData.caseTitle" />
     </template>
     <template v-else>
       <div class="body-head">
@@ -23,17 +28,27 @@
               创建{{ BoardTypeDesc[BoardType.scene] }}
             </el-button>
           </template>
-          <el-button type="primary" @click="addCaseFileHandler"> 上传 </el-button>
+          <el-button type="primary" @click="addCaseFileHandler">
+            上传
+          </el-button>
         </div>
       </div>
 
-      <el-table :data="files" tooltip-effect="dark" style="width: 100%" size="large">
+      <el-table
+        :data="files"
+        tooltip-effect="dark"
+        style="width: 100%"
+        size="large"
+      >
         <el-table-column label="序号" width="70" v-slot:default="{ $index }">
           <div style="text-align: center">
             {{ $index + 1 }}
           </div>
         </el-table-column>
-        <el-table-column label="名称" v-slot:default="{ row }: { row: CaseFile }">
+        <el-table-column
+          label="名称"
+          v-slot:default="{ row }: { row: CaseFile }"
+        >
           <span v-if="!inputCaseTitles.includes(row)">
             {{ row.filesTitle }}
             <el-icon class="edit-title" @click="inputCaseTitles.push(row)">
@@ -57,7 +72,10 @@
           </template>
         </el-table-column>
         <el-table-column label="创建时间" prop="createTime"></el-table-column>
-        <el-table-column label="操作" v-slot:default="{ row }: { row: CaseFile }">
+        <el-table-column
+          label="操作"
+          v-slot:default="{ row }: { row: CaseFile }"
+        >
           <span class="oper-span" @click="query(row)"> 查看 </span>
           <span
             class="oper-span"
@@ -102,6 +120,7 @@ const caseId = computed(() => {
     return Number(caseId);
   }
 });
+const caseInfoData = ref<any>();
 
 const inputCaseTitles = ref<CaseFile[]>([]);
 
@@ -110,13 +129,18 @@ const updateFileTitle = async (caseFile: CaseFile) => {
     return ElMessage.error("卷宗标题不能为空!");
   }
   await updateCaseInfo(caseFile);
-  inputCaseTitles.value = inputCaseTitles.value.filter((item) => item !== caseFile);
+  inputCaseTitles.value = inputCaseTitles.value.filter(
+    (item) => item !== caseFile
+  );
 };
 
 const currentTypeId = ref<number>();
 const types = ref<CaseFileType[]>([]);
 const options = computed(() =>
-  types.value.map((item) => ({ name: item.filesTypeName, value: item.filesTypeId }))
+  types.value.map((item) => ({
+    name: item.filesTypeName,
+    value: item.filesTypeId,
+  }))
 );
 const isDraw = computed(() => currentTypeId.value === FileDrawType);
 
@@ -130,7 +154,9 @@ const refresh = async () => {
 watchEffect(() => caseId.value && currentTypeId.value && refresh());
 
 const query = (file: CaseFile) => {
-  const ext = file.filesUrl.substring(file.filesUrl.lastIndexOf(".")).toLocaleLowerCase();
+  const ext = file.filesUrl
+    .substring(file.filesUrl.lastIndexOf("."))
+    .toLocaleLowerCase();
   if ([".raw", ".dcm"].includes(ext)) {
     window.open(
       `/xfile-viewer/index.html?file=${file.filesUrl}&name=${file.filesTitle}&time=` +
@@ -164,6 +190,7 @@ onMounted(async () => {
   currentTypeId.value = types.value[0].filesTypeId;
   const caseInfo = await getCaseInfo(caseId.value!);
   if (caseInfo) {
+    caseInfoData.value = caseInfo;
     title.value = (await getCaseInfo(caseId.value!)).caseTitle + " | 卷宗管理";
     desc.value = "";
   } else {

+ 2 - 2
src/view/case/records/index.vue

@@ -320,7 +320,7 @@ import {
 } from "@/store/case";
 import { ElMessage } from "element-plus";
 import saveAs from "@/util/file-serve";
-const props = defineProps({ caseId: Number });
+const props = defineProps({ caseId: Number, title: String });
 
 console.log(props);
 const isDisableExport = ref(false);
@@ -449,7 +449,7 @@ const handleSave = async () => {
 const handleExport = async () => {
   const res = await exportCaseInquestInfo(props.caseId);
   console.log("res", res);
-  saveAs(res, `勘验笔录-${props.caseId}.docx`);
+  saveAs(res, `${props.title}_勘验笔录.docx`);
 };
 </script>
 

+ 160 - 124
src/view/case/records/manifest.vue

@@ -1,37 +1,59 @@
 <template>
-
   <div class="records">
     <div class="header">
       <el-button type="primary" @click="handleSave">保存</el-button>
-      <el-button :disabled="isDisableExport" @click="handleExport">导出</el-button>
+      <el-button :disabled="isDisableExport" @click="handleExport"
+        >导出</el-button
+      >
     </div>
 
     <div class="content">
       <div class="line">
         <span>起火单位/地址:</span>
-        <el-input class="input" v-model="data.address" placeholder="" style="width: 100%;" />
-
+        <el-input
+          class="input"
+          v-model="data.address"
+          placeholder=""
+          style="width: 100%"
+        />
       </div>
 
       <div class="line">
         <span>提取日期:</span>
         <div>
-          <el-input class="input" :maxlength="4" type="text" v-model="data.time.year" placeholder=""
-            style="width: 80px;" />
+          <el-input
+            class="input"
+            :maxlength="4"
+            type="text"
+            v-model="data.time.year"
+            placeholder=""
+            style="width: 80px"
+          />
           <span>年</span>
-          <el-input class="input" :maxlength="2" type="text" v-model="data.time.month" placeholder=""
-            style="width: 80px;" />
+          <el-input
+            class="input"
+            :maxlength="2"
+            type="text"
+            v-model="data.time.month"
+            placeholder=""
+            style="width: 80px"
+          />
           <span>月</span>
-          <el-input class="input" :maxlength="2" type="text" v-model="data.time.day" placeholder=""
-            style="width: 80px;" />
+          <el-input
+            class="input"
+            :maxlength="2"
+            type="text"
+            v-model="data.time.day"
+            placeholder=""
+            style="width: 80px"
+          />
           <span>日</span>
         </div>
-
       </div>
 
       <div class="detail">
         <span class="sub-tit">提取清单:</span>
-        <template v-for=" (item, index) in data.detail">
+        <template v-for="(item, index) in data.detail">
           <div class="con">
             <span class="sub-tit">编号 {{ index + 1 }}: </span>
             <div class="info">
@@ -56,23 +78,16 @@
                   <span>提取部位: </span>
                   <el-input class="input" v-model="item.part" placeholder="" />
                 </div>
-
-
               </div>
               <div class="inner">
                 <div class="sec">
                   <span>特征: </span>
                   <el-input class="input" v-model="item.desc" placeholder="" />
                 </div>
-
               </div>
             </div>
-
           </div>
-
         </template>
-
-
       </div>
       <div class="btn-container">
         <el-button class="btn" @click="addItem">+新增</el-button>
@@ -84,11 +99,20 @@
         <template v-for="extractUser in data.extractUser">
           <div class="line">
             <span>姓名:</span>
-            <el-input class="input" v-model="extractUser.name" placeholder="" style="width: 20%" />
+            <el-input
+              class="input"
+              v-model="extractUser.name"
+              placeholder=""
+              style="width: 20%"
+            />
             <span>工作单位:</span>
-            <el-input class="input" v-model="extractUser.address" placeholder="" style="width: 70%" />
+            <el-input
+              class="input"
+              v-model="extractUser.address"
+              placeholder=""
+              style="width: 70%"
+            />
           </div>
-
         </template>
       </div>
       <div class="btn-container">
@@ -102,126 +126,147 @@
             <!-- <span class="sub-tit">证人信息:</span> -->
             <div class="line">
               <span>姓名:</span>
-              <el-input class="input" v-model="wit.name" placeholder="" style="width: 180px;" />
-              <span style="margin-left:50px">身份证件号码:</span>
-              <el-input class="input" v-model="wit.id" placeholder="" style="width: 280px;" />
-              <span style="margin-left:50px">联系电话:</span>
-              <el-input class="input" v-model="wit.phone" placeholder="" style="width: 280px;" />
+              <el-input
+                class="input"
+                v-model="wit.name"
+                placeholder=""
+                style="width: 180px"
+              />
+              <span style="margin-left: 50px">身份证件号码:</span>
+              <el-input
+                class="input"
+                v-model="wit.id"
+                placeholder=""
+                style="width: 280px"
+              />
+              <span style="margin-left: 50px">联系电话:</span>
+              <el-input
+                class="input"
+                v-model="wit.phone"
+                placeholder=""
+                style="width: 280px"
+              />
             </div>
             <div class="line">
               <span>单位或住址:</span>
-              <el-input class="input" v-model="wit.address" placeholder="" style="width: 100%;" />
+              <el-input
+                class="input"
+                v-model="wit.address"
+                placeholder=""
+                style="width: 100%"
+              />
             </div>
           </div>
-
         </template>
       </div>
       <div class="btn-container">
         <el-button class="btn" @click="addwitnessInfo">+新增</el-button>
       </div>
-      <div>
-      </div>
+      <div></div>
     </div>
   </div>
-
 </template>
 <script setup>
-import { onMounted, ref, watch } from 'vue';
-import { reactive } from 'vue'
+import { onMounted, ref, watch } from "vue";
+import { reactive } from "vue";
 import {
   getCaseDetailInfo,
   saveCaseDetailInfo,
-  exportCaseDetailInfo
+  exportCaseDetailInfo,
 } from "@/store/case";
 import saveAs from "@/util/file-serve";
-import { ElMessage } from 'element-plus';
+import { ElMessage } from "element-plus";
 
-const props = defineProps({ caseId: Number })
+const props = defineProps({ caseId: Number, title: String });
 
-const isDisableExport = ref(false)
+const isDisableExport = ref(false);
 
-console.log(props)
+console.log(props);
 
 const data = reactive({
   address: "",
   time: {
     year: "",
     month: "",
-    day: ""
+    day: "",
   },
 
-  location: '',
-  detail: [{
-    // id: "1",
-    name: "",
-    spec: "",
-    num: "",
-    part: "",
-    desc: "",
-  },
-  {
-    // id: "2",
-    name: "",
-    spec: "",
-    num: "",
-    part: "",
-    desc: "",
-  }],
+  location: "",
+  detail: [
+    {
+      // id: "1",
+      name: "",
+      spec: "",
+      num: "",
+      part: "",
+      desc: "",
+    },
+    {
+      // id: "2",
+      name: "",
+      spec: "",
+      num: "",
+      part: "",
+      desc: "",
+    },
+  ],
   extractUser: [
     {
       name: "",
       workplace: "",
-      id: ""
+      id: "",
     },
 
     {
       name: "",
       address: "",
-      id: ""
+      id: "",
     },
   ],
 
-  witnessInfo: [{
-    name: "",
-    address: "",
-    phone: '',
-    id: "",
-
-  }, {
-    name: "",
-    address: "",
-    phone: '',
-    id: ""
-  }]
-})
-
-watch(data, newValue => {
-  // data.userName = newValue.userName.replace(/[^0-9]/g, '');
-  const sMonth = newValue.time.month.replace(/[^0-9]/g, '');
-  const sDay = newValue.time.day.replace(/[^0-9]/g, '');
-
-  data.time.year = newValue.time.year.replace(/[^0-9]/g, '');
-  data.time.month = Number(sMonth) > 12 ? '12' : sMonth;
-  data.time.day = Number(sDay) > 31 ? '31' : sDay;
-
-
-}, {
-  immediate: true,
-  deep: true
-})
-
+  witnessInfo: [
+    {
+      name: "",
+      address: "",
+      phone: "",
+      id: "",
+    },
+    {
+      name: "",
+      address: "",
+      phone: "",
+      id: "",
+    },
+  ],
+});
+
+watch(
+  data,
+  (newValue) => {
+    // data.userName = newValue.userName.replace(/[^0-9]/g, '');
+    const sMonth = newValue.time.month.replace(/[^0-9]/g, "");
+    const sDay = newValue.time.day.replace(/[^0-9]/g, "");
+
+    data.time.year = newValue.time.year.replace(/[^0-9]/g, "");
+    data.time.month = Number(sMonth) > 12 ? "12" : sMonth;
+    data.time.day = Number(sDay) > 31 ? "31" : sDay;
+  },
+  {
+    immediate: true,
+    deep: true,
+  }
+);
 
-onMounted(() => {
-})
+onMounted(() => {});
 
 const addwitnessInfo = () => {
   data.witnessInfo.push({
     name: "",
     address: "",
-    phone: '',
-    id: ""
-  })
-}
+    phone: "",
+    id: "",
+  });
+};
 const addItem = () => {
   data.detail.push({
     // id: "1",
@@ -230,43 +275,41 @@ const addItem = () => {
     num: "",
     part: "",
     desc: "",
-  })
-}
+  });
+};
 const addextractUser = () => {
   data.extractUser.push({
     name: "",
     address: "",
-    id: ""
-  })
-}
+    id: "",
+  });
+};
 const handleSave = async () => {
-  console.log('data', data)
+  console.log("data", data);
   const res = await saveCaseDetailInfo(props.caseId, data);
   if (res.code === 0) {
-    ElMessage.success('保存成功!')
+    ElMessage.success("保存成功!");
   }
-}
+};
 const handleExport = async () => {
   const res = await exportCaseDetailInfo(props.caseId);
-  console.log('res', res)
-  saveAs(res, `提取清单-${props.caseId}.docx`)
-}
+  console.log("res", res);
+  saveAs(res, `${props.title}_提取清单.docx`);
+};
 onMounted(async () => {
   const res = await getCaseDetailInfo(props.caseId);
 
-  console.log('res', res)
+  console.log("res", res);
   for (var k in data) {
     if (!res.data) {
-      isDisableExport.value = true
+      isDisableExport.value = true;
     }
     if (res.data && res.data.hasOwnProperty(k)) {
       // console.log("Key is " + k)
-      data[k] = res.data[k]
+      data[k] = res.data[k];
     }
   }
-
-})
-
+});
 </script>
 
 <style lang="scss">
@@ -340,15 +383,11 @@ onMounted(async () => {
       align-items: center;
       justify-content: center;
     }
-
-
   }
-
-
 }
 
 .witnessInfo {
-  background: #F5F5F5;
+  background: #f5f5f5;
   padding: 15px;
   margin-top: 20px;
   // margin-right: 8px;
@@ -362,22 +401,20 @@ onMounted(async () => {
   padding: 20px 0;
 
   .btn {
-    color: #26559B;
+    color: #26559b;
     width: 100%;
 
     &:hover {
-      background: #F5F5F5;
+      background: #f5f5f5;
       border-color: #dcdfe6;
     }
   }
 }
 
 .detail {
-
-
   .con {
     padding: 20px;
-    background-color: #F5F5F5;
+    background-color: #f5f5f5;
   }
 
   .info {
@@ -385,18 +422,17 @@ onMounted(async () => {
       margin-bottom: 20px;
     }
   }
-
 }
 
 .extractUser {
   margin-right: 0px;
 
   .line {
-    background-color: #F5F5F5;
+    background-color: #f5f5f5;
     padding: 15px;
     width: calc(100% - 30px);
     display: inline-flex;
     margin-bottom: 15px;
   }
 }
-</style>
+</style>