|
|
@@ -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
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
};
|