wsx 11 месяцев назад
Родитель
Сommit
d644ca99bc

+ 62 - 1
src/BIZComponents/processSubmitDialog/processSubmitDialog.vue

@@ -15,6 +15,7 @@
         <!--          {{ form.name }}-->
         <!--        </div>-->
         <fm-generate-form
+          @on-change="onChange"
           :preview="true"
           class="el-form-box"
           v-if="Object.keys(form?.formJson || {}).length !== 0"
@@ -258,6 +259,7 @@
   import { getToken } from '@/utils/token-util';
   import { mapGetters } from 'vuex';
   import staffSelection from '@/components/staffSelection/staffSelection.vue';
+  import dayjs from 'dayjs';
   export default {
     name: 'processSubmitDialog',
     components: { visibilityRangeDialog, staffSelection },
@@ -309,7 +311,12 @@
         userOptions: [],
         userGroupOptions: [],
         dictList: {},
-        rules: {}
+        rules: {},
+        editForm: {
+          start: '',
+          end: '',
+          days: ''
+        }
       };
     },
     computed: {
@@ -372,6 +379,8 @@ this.postOptions.push(...response.data);
         this.$set(this.form, 'key', '');
         this.$set(this.form, 'valueJson', {});
         this.jsonData = JSON.parse(this.form.formJson.makingJson);
+        console.log(this.jsonData);
+
         this.jsonData.config.dataSource &&
           this.jsonData.config.dataSource.forEach((item) => {
             item.headers = {
@@ -596,6 +605,58 @@ this.postOptions.push(...response.data);
       },
       cancel() {
         this.$emit('update:processSubmitDialogFlag', false);
+      },
+      getDays(start, end) {
+        const startDay = dayjs(start);
+        const endDay = dayjs(end);
+        const diffInMilliseconds = endDay.diff(startDay);
+
+        // 计算天数
+        const days = Math.floor(diffInMilliseconds / (1000 * 60 * 60 * 24));
+        // 计算剩余小时数
+        const hours = Math.floor(
+          (diffInMilliseconds % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)
+        );
+        // 计算剩余分钟数
+        const minutes = Math.floor(
+          (diffInMilliseconds % (1000 * 60 * 60)) / (1000 * 60)
+        );
+        // 计算剩余秒数
+        const seconds = Math.floor((diffInMilliseconds % (1000 * 60)) / 1000);
+
+        let result = '';
+        if (days > 0) result += `${days} 天 `;
+        if (hours > 0) result += `${hours} 小时 `;
+        if (minutes > 0) result += `${minutes} 分钟 `;
+        if (seconds > 0) result += `${seconds} 秒`;
+        return result.trim();
+      },
+
+      onChange(field, value) {
+        console.log(field, value);
+        // input_if1cav3p
+
+        if (field === 'date_fxb0rd2w') {
+          this.editForm.start = value;
+        }
+
+        if (field === 'date_mz7gmwkm') {
+          this.editForm.end = value;
+        }
+
+        if (this.editForm.start && this.editForm.end) {
+          this.editForm.days = this.getDays(
+            this.editForm.start,
+            this.editForm.end
+          );
+          this.$refs.generateForm.setData({
+            input_if1cav3p: this.editForm.days
+          });
+        } else {
+          this.$refs.generateForm.setData({
+            input_if1cav3p: 0
+          });
+        }
       }
     }
   };

+ 3 - 1
src/views/home/index.vue

@@ -196,6 +196,7 @@
               v-for="(item, index) in list"
               :class="[(index + 1) % 3 == 0 ? 'item margin_0' : 'item']"
               @click="openUrl(item)"
+              :key="item.id"
             >
               <div><img :src="item.img" /></div>
               <div>{{ item.name }}</div>
@@ -542,7 +543,7 @@
           size: 9999,
           userId: this.user.info.userId
         });
-        this.messageScrollList = deepClone(list);  
+        this.messageScrollList = deepClone(list);
       },
       errorHandler(err, vm) {
         console.log('图片加载失败');
@@ -1176,6 +1177,7 @@
       }
 
       .scroll-box-content-item {
+        padding-right: 15px;
         margin-top: 5px;
         width: 100%;
         display: flex;