Ver código fonte

服务合同:服务记录

lxf 2 anos atrás
pai
commit
a1487d7b20

+ 48 - 29
src/views/salesMange/saleContract/serviceContract/index.vue

@@ -40,8 +40,21 @@
         <el-button type="primary" @click="clickAddRecord" plain>添加服务记录</el-button>
       </div>
       <el-timeline>
-        <el-timeline-item v-for="(activity, index) in activities" :key="index" :timestamp="activity.timestamp">
-          {{ activity.content }}
+        <el-timeline-item v-for="(item, index) in recordList" :key="index" :timestamp="item.serviceTime" :hide-timestamp="true">
+          <div>
+            <div style="display: flex; justify-content: space-between; padding-bottom;: 20px">
+              <span>{{ item.userName }}</span>
+              <span>{{ item.serviceTime }}</span>
+            </div>
+            <div style="padding-bottom;: 20px">
+              <div v-html="item.remark"></div>
+            </div>
+            <div style="padding-bottom;: 20px" v-if="item.fileList && item.fileList.length > 0">
+              <div v-for="(file, index) in item.fileList" :key="index">
+                <a style="color: #409eff; cursor: pointer" @click="openFile(file.fileUrl)">{{ file.fileName }}</a>
+              </div>
+            </div>
+          </div>
         </el-timeline-item>
       </el-timeline>
       <div style="padding: 16px; text-align: center">
@@ -90,6 +103,7 @@ import { ElMessage, ElMessageBox } from "element-plus";
 import byForm from "@/components/byForm/index";
 import useUserStore from "@/store/modules/user";
 import Editor from "@/components/Editor/index.vue";
+import path from "path";
 
 const { proxy } = getCurrentInstance();
 const corporationList = ref([]);
@@ -368,35 +382,37 @@ const submit = ref(null);
 const dialogVisible = ref(false);
 const loadingDialog = ref(false);
 const openAddRecord = ref(false);
-const activities = [
-  {
-    content: "Event start",
-    timestamp: "2018-04-15",
-  },
-  {
-    content: "Approved",
-    timestamp: "2018-04-13",
-  },
-  {
-    content: "Success",
-    timestamp: "2018-04-11",
-  },
-];
+const recordList = ref([]);
 const getRecordList = () => {
   proxy.post("/serviceContractRecord/page", { serviceContractId: formData.data.serviceContractId }).then((res) => {
-    console.log(res);
-    
-    // proxy.post("/fileInfo/getList", { businessIdList: [row.id] }).then((res) => {
-    //   if (res[row.id] && res[row.id].length > 0) {
-    //     fileList.value = res[row.id].map((item) => {
-    //       return {
-    //         raw: item,
-    //         name: item.fileName,
-    //         url: item.fileUrl,
-    //       };
-    //     });
-    //   }
-    // });
+    if (res.rows && res.rows.length > 0) {
+      recordList.value = res.rows;
+      let fileIds = res.rows.map((item) => {
+        return item.id;
+      });
+      proxy.post("/fileInfo/getList", { businessIdList: fileIds }).then((resFile) => {
+        recordList.value = recordList.value.map((item) => {
+          let fileData = [];
+          if (resFile[item.id] && resFile[item.id].length > 0) {
+            fileData = resFile[item.id];
+            // .map((item) => {
+            //   return {
+            //     raw: item,
+            //     name: item.fileName,
+            //     url: item.fileUrl,
+            //   };
+            // });
+          }
+          return {
+            ...item,
+            fileList: fileData,
+          };
+        });
+        console.log(recordList.value);
+      });
+    } else {
+      recordList.value = [];
+    }
     loadingDialog.value = false;
   });
 };
@@ -516,6 +532,9 @@ const submitForm = () => {
     );
   });
 };
+const openFile = (path) => {
+  window.open(path, "_blank");
+};
 </script>
 
 <style lang="scss" scoped>