YLZH 1 rok temu
rodzic
commit
ce55f597dd

+ 7 - 0
src/pages.json

@@ -117,6 +117,13 @@
       }
     },
     {
+      "path": "pages/settlement/detail",
+      "style": {
+        "navigationStyle": "default",
+        "navigationBarTitleText": "结算管理"
+      }
+    },
+    {
       "path": "pages/oils/list",
       "style": {
         "navigationStyle": "default",

+ 4 - 2
src/pages/oils/detail.vue

@@ -1,6 +1,8 @@
 <template>
-  <view>
-    <wd-cell v-for="(item, i) in list" :title="item.fieldName" :value="item.value" />
+  <view class="view">
+    <wd-cell-group border>
+      <wd-cell v-for="(item, i) in list" :title="item.fieldName" :value="item.value" />
+    </wd-cell-group>
   </view>
 </template>
 <script lang="ts" setup>

+ 11 - 18
src/pages/oils/list.vue

@@ -28,23 +28,16 @@
     />
 
     <template v-for="(item, index) in settlementList" :key="index">
-      <wd-card>
-        <view class="project-body"  @click="goDetail(item)">
+      <wd-card :title="'项目编号:' + item.COL_0.value">
+        <view class="project-body" @click="goDetail(item)">
           <view class="body-list" v-for="(field, i) in showListField" :key="i">
             <view>{{ field.content }}: {{ item[field.field].value }}</view>
           </view>
         </view>
         <template #footer>
-          <wd-button size="small" plain @click="goEdit(item)">编辑</wd-button>
-          <wd-button
-            style="margin-left: 10px"
-            size="small"
-            type="error"
-            plain
-            @click="deleteData(item)"
-          >
-            删除
-          </wd-button>
+          <wd-button size="small" type="warning" @click="goDetail(item)">查看详情</wd-button>
+          <wd-button size="small" @click="goEdit(item)">编辑</wd-button>
+          <wd-button size="small" type="error" @click="deleteData(item)">删除</wd-button>
         </template>
       </wd-card>
     </template>
@@ -74,10 +67,7 @@ const menu = ref([
 ]);
 const showListField = ref([
   // 项目编号:
-  {
-    content: '项目编号',
-    field: 'COL_0',
-  },
+
   {
     content: '项目名称',
     field: 'COL_1',
@@ -294,11 +284,9 @@ function addData() {
 }
 // goDetail 去往详情页
 function goDetail(item) {
-  console.log("🚀 ~ goDetail ~ item:", item)
   router.push({
     path: 'pages/oils/detail',
     query: { filedsData: JSON.stringify(item || '[]'), formKey: formKey.value },
-
   });
 }
 // 删除
@@ -420,4 +408,9 @@ function deleteData(item) {
     }
   }
 }
+.settlement-form {
+  :deep .wd-button + .wd-button {
+    margin-left: 20rpx;
+  }
+}
 </style>

+ 54 - 0
src/pages/settlement/detail.vue

@@ -0,0 +1,54 @@
+<template>
+  <view class="view">
+    <wd-cell-group border>
+      <template v-for="(item, i) in list">
+        <!-- 如果是图片 -->
+        <!-- field: "COL_13" -->
+        <view v-if="item.field === 'COL_13' && item.value">
+          <wd-cell :title="item.fieldName">
+            <!-- 图片 -->
+          </wd-cell>
+          <view class="img-list">
+            <wd-img :width="100" :height="100" v-for="(img, index) in item.value" :src="img.url" />
+          </view>
+        </view>
+        <wd-cell v-else :title="item.fieldName" :value="item.value" />
+      </template>
+    </wd-cell-group>
+  </view>
+</template>
+<script lang="ts" setup>
+import config from '@/http/config';
+const list = ref([]);
+const filedsData = ref({});
+onLoad((options) => {
+  filedsData.value = JSON.parse(options.filedsData);
+  // 删除id
+  if (filedsData.value.id) {
+    delete filedsData.value.id;
+  }
+  list.value = Object.values(filedsData.value);
+  // 如果是图片
+  if (list.value.length > 0) {
+    list.value.forEach((item) => {
+      if (item.field === 'COL_13' && item.value) {
+        item.value = JSON.parse(item.value);
+        item.value.forEach((img) => {
+          img.url = config.baseURL + img.url;
+        });
+      }
+    });
+  }
+});
+</script>
+<style lang="scss" scoped>
+.img-list {
+  display: flex;
+  flex-wrap: wrap;
+  padding: 10px;
+  :deep .wd-img + .wd-img {
+    margin-left: 10px;
+    margin-bottom: 10px;
+  }
+}
+</style>

+ 17 - 8
src/pages/settlement/form.vue

@@ -226,7 +226,6 @@ function init() {
       }
     });
     dataForm.value = obj;
-    console.log(dataForm.value);
     oldFormData.value = JSON.stringify(obj);
     initProjectList();
   });
@@ -320,14 +319,24 @@ function handleChangeFile({ fileList }) {
   }
   for (let i = 0; i < fileList.length; i++) {
     const val = fileList[i];
-    const response = JSON.parse(val.response);
-    if (response.code === 200) {
-      const obj = {
-        url: config.baseURL + response.msg,
-        name: response.msg,
-        fileld: response.msg,
+    if (val.response) {
+      const response = JSON.parse(val.response);
+      if (response.code === 200) {
+        const obj = {
+          url: config.baseURL + response.msg,
+          name: response.msg,
+          fileld: response.msg,
+        };
+        arr.push(obj);
+      }
+    } else {
+      const oldData = {
+        url: val.url,
+        name: val.name,
+        fileld: val.fileld,
       };
-      arr.push(obj);
+
+      arr.push(oldData);
     }
   }
   dataForm.value[544] = arr;

+ 20 - 13
src/pages/settlement/list.vue

@@ -28,23 +28,17 @@
     />
 
     <template v-for="(item, index) in settlementList" :key="index">
-      <wd-card>
+      <wd-card :title="'开票日期:' + item.COL_0.value">
         <view class="project-body" @click="goDetail(item)">
           <view class="body-list" v-for="(field, i) in showListField" :key="i">
             <view>{{ field.content }}: {{ item[field.field].value }}</view>
           </view>
         </view>
         <template #footer>
-          <wd-button size="small" plain @click="goEdit(item)">编辑</wd-button>
-          <wd-button
-            style="margin-left: 10px"
-            size="small"
-            type="error"
-            plain
-            @click="deleteData(item)"
-          >
-            删除
-          </wd-button>
+          <!-- 查看详情 -->
+          <wd-button size="small" type="warning" @click="goDetail(item)">查看详情</wd-button>
+          <wd-button size="small" @click="goEdit(item)">编辑</wd-button>
+          <wd-button size="small" type="error" @click="deleteData(item)">删除</wd-button>
         </template>
       </wd-card>
     </template>
@@ -80,8 +74,9 @@ const menu = ref([
 ]);
 const showListField = ref([
   {
-    content: '开票日期',
-    field: 'COL_0',
+    // 开票金额 7
+    content: '开票金额',
+    field: 'COL_7',
   },
   {
     content: '项目名称',
@@ -331,6 +326,13 @@ function addData() {
     query: { filedsData: '[]', formKey: formKey.value },
   });
 }
+// goDetail 去往详情页
+function goDetail(item) {
+  router.push({
+    path: 'pages/settlement/detail',
+    query: { filedsData: JSON.stringify(item || '[]'), formKey: formKey.value },
+  });
+}
 </script>
 
 <style lang="scss" scoped>
@@ -417,4 +419,9 @@ function addData() {
     }
   }
 }
+.settlement-form {
+  :deep .wd-button + .wd-button {
+    margin-left: 20rpx;
+  }
+}
 </style>