hml2020 1 tahun lalu
induk
melakukan
b92440662c
4 mengubah file dengan 68 tambahan dan 35 penghapusan
  1. 20 15
      src/pages/payment/edit.vue
  2. 14 2
      src/pages/payment/list.vue
  3. 21 16
      src/pages/procure/edit.vue
  4. 13 2
      src/pages/procure/list.vue

+ 20 - 15
src/pages/payment/edit.vue

@@ -68,19 +68,16 @@
         <wd-button block type="primary" @click="formSubmit">提交</wd-button>
       </view>
     </wd-cell-group>
+    <wd-toast />
   </view>
 </template>
 <script setup>
 import { onLoad } from '@dcloudio/uni-app';
 import dataService from '@/api/procure';
-import { defineProps, ref, toRefs } from 'vue';
+import { useToast } from 'wot-design-uni';
+import { ref } from 'vue';
 import moment from 'moment';
-const props = defineProps({
-  id: {
-    type: String,
-    default: '',
-  },
-});
+const toast = useToast();
 const detail = ref({});
 const columns = ref([]);
 const payList = ref([
@@ -95,7 +92,6 @@ const payList = ref([
 ]);
 const formId = ref('');
 const oldValues = ref({});
-const { id } = toRefs(props);
 onLoad((options) => {
   const item = JSON.parse(options.item);
   formId.value = options.formId;
@@ -104,9 +100,8 @@ onLoad((options) => {
     obj[child.text] = child.value;
   });
   detail.value = obj;
-  console.log(detail.value);
+
   oldValues.value = JSON.parse(options.item);
-  // console.log(oldValues.value);
   projectList();
 });
 
@@ -123,9 +118,9 @@ function projectList() {
 
 function handleConfirm(e, num) {
   if (num === 1) {
-    detail.value['收款日期'] = moment(e.value).format('YYYY-MM-DD');
+    detail.value['收款日期'] = e.value;
   } else {
-    detail.value['付款日期'] = moment(e.value).format('YYYY-MM-DD');
+    detail.value['付款日期'] = e.value;
   }
 }
 function formSubmit() {
@@ -139,6 +134,13 @@ function formSubmit() {
       }
     }
   });
+
+  old['564'] = moment(old['564']).valueOf();
+  old['563'] = moment(old['563']).valueOf();
+  old['554'] = moment(old['554']).valueOf();
+  dataObj['554'] = moment(dataObj['554']).valueOf();
+  dataObj['563'] = moment(dataObj['563']).valueOf();
+  dataObj['564'] = moment(dataObj['564']).valueOf();
   const data = [
     {
       data: JSON.stringify(dataObj),
@@ -154,9 +156,12 @@ function formSubmit() {
   dataService.editData(params).then((res) => {
     if (res.code === 200) {
       toast.success('更新成功');
-      uni.navigateBack({
-        delta: 1,
-      });
+      setTimeout(() => {
+        uni.$emit('refresh', { refresh: true });
+        uni.navigateBack({
+          delta: 1,
+        });
+      }, 1000);
     } else {
       toast.error('提交失败');
     }

+ 14 - 2
src/pages/payment/list.vue

@@ -47,7 +47,7 @@
   ></wd-action-sheet>
 </template>
 <script setup>
-import { onLoad, onReachBottom } from '@dcloudio/uni-app';
+import { onLoad, onReachBottom, onShow, onUnload } from '@dcloudio/uni-app';
 import dataService from '@/api/procure';
 import { ref, onMounted } from 'vue';
 const value = ref('');
@@ -78,7 +78,7 @@ const form = ref({
   },
   paramList: [
     {
-      cubeColumnId: 875,
+      cubeColumnId: 558,
       function: 'like',
       values: [],
     },
@@ -92,6 +92,18 @@ onLoad((options) => {
   getFormConfig();
 });
 
+onShow(() => {
+  uni.$on('refresh', (data) => {
+    if (data.refresh) {
+      onSearch();
+    }
+  });
+});
+
+onUnload(() => {
+  uni.$off('refresh');
+});
+
 onReachBottom(() => {
   if (isMore.value) {
     form.value.pageQuery.current++;

+ 21 - 16
src/pages/procure/edit.vue

@@ -1,6 +1,6 @@
 <template>
   <view class="edit">
-    <wd-cell-group custom-class="group" :title="'采购单:' + detail['采购单名称']" border>
+    <wd-cell-group custom-class="group" border>
       <wd-input label="采购单名称" v-model="detail['采购单名称']" />
       <wd-input label="采购单号" v-model="detail['采购单号']" />
       <wd-calendar
@@ -44,24 +44,21 @@
         <wd-button block type="primary" @click="formSubmit">提交</wd-button>
       </view>
     </wd-cell-group>
+
+    <wd-toast />
   </view>
 </template>
 <script setup>
 import { onLoad } from '@dcloudio/uni-app';
+import { useToast } from 'wot-design-uni';
 import dataService from '@/api/procure';
-import { defineProps, ref, toRefs } from 'vue';
+import { ref } from 'vue';
 import moment from 'moment';
-const props = defineProps({
-  id: {
-    type: String,
-    default: '',
-  },
-});
+const toast = useToast();
 const detail = ref({});
 const columns = ref([]);
 const formId = ref('');
 const oldValues = ref({});
-const { id } = toRefs(props);
 onLoad((options) => {
   const item = JSON.parse(options.item);
   formId.value = options.formId;
@@ -71,7 +68,6 @@ onLoad((options) => {
   });
   detail.value = obj;
   oldValues.value = JSON.parse(options.item);
-  // console.log(oldValues.value);
   projectList();
 });
 
@@ -88,9 +84,9 @@ function projectList() {
 
 function handleConfirm(e, num) {
   if (num === 1) {
-    detail.value['提交日期'] = moment(e.value).format('YYYY-MM-DD');
+    detail.value['提交日期'] = e.value;
   } else {
-    detail.value['付款日期'] = moment(e.value).format('YYYY-MM-DD');
+    detail.value['付款日期'] = e.value;
   }
 }
 function formSubmit() {
@@ -104,6 +100,10 @@ function formSubmit() {
       }
     }
   });
+  dataObj['571'] = moment(dataObj['571']).valueOf();
+  old['571'] = moment(old['571']).valueOf();
+  dataObj['581'] = moment(dataObj['581']).valueOf();
+  old['581'] = moment(old['581']).valueOf();
   const data = [
     {
       data: JSON.stringify(dataObj),
@@ -116,14 +116,19 @@ function formSubmit() {
     id: detail.value.idKey,
     data: data,
   };
+
+  toast.success('操作成功');
   dataService.editData(params).then((res) => {
     if (res.code === 200) {
       toast.success('更新成功');
-      uni.navigateBack({
-        delta: 1,
-      });
+      setTimeout(() => {
+        uni.$emit('refresh', { refresh: true });
+        uni.navigateBack({
+          delta: 1,
+        });
+      }, 1000);
     } else {
-      toast.error('提交失败');
+      toast.error('更新失败');
     }
   });
 }

+ 13 - 2
src/pages/procure/list.vue

@@ -74,7 +74,7 @@
   ></wd-action-sheet>
 </template>
 <script setup>
-import { onLoad, onReachBottom } from '@dcloudio/uni-app';
+import { onLoad, onReachBottom, onShow, onUnload } from '@dcloudio/uni-app';
 import dataService from '@/api/procure';
 import { ref, onMounted } from 'vue';
 const value = ref('');
@@ -123,6 +123,18 @@ onLoad((options) => {
   getFormConfig();
 });
 
+onShow(() => {
+  uni.$on('refresh', (data) => {
+    if (data.refresh) {
+      onSearch();
+    }
+  });
+});
+
+onUnload(() => {
+  uni.$off('refresh');
+});
+
 onReachBottom(() => {
   if (isMore.value) {
     form.value.pageQuery.current++;
@@ -144,7 +156,6 @@ function projectList() {
     }
   });
 }
-
 // 获取表单配置信息
 function getFormConfig() {
   dataService.getConfig('f7436dcb6bbd469b1d154511ab74dd0f').then((res) => {