瀏覽代碼

提交车间相关代码

Lijy 11 月之前
父節點
當前提交
676481dd04
共有 1 個文件被更改,包括 92 次插入0 次删除
  1. 92 0
      fhKeeper/formulahousekeeper/timesheet-workshop/src/views/plan/orderInsert.vue

+ 92 - 0
fhKeeper/formulahousekeeper/timesheet-workshop/src/views/plan/orderInsert.vue

@@ -15,6 +15,8 @@
           </div>
         </div>
         <div class="OutSide_right">
+          <el-link type="primary" :underline="false" @click="showReportingDialog()">{{ "同步临时报工"
+          }}</el-link>
           <el-link type="primary" :underline="false" @click="(taskTypeDialog = true)">{{ "任务类型管理"
           }}</el-link>
           <el-link type="primary" :underline="false" @click="addPlan()">{{
@@ -222,6 +224,29 @@
       </span>
     </el-dialog>
 
+    <!-- 同步临时报工 -->
+    <el-dialog title="同步临时报工" :visible.sync="synchronousReportingDialog" width="600px" :before-close="handleClose">
+      <div class="tongbu">
+        <div :style="`color: ${reportWorkDayDisable ? 'red' : '#999'}`">选择的日期在三十天内</div>
+        <el-date-picker
+          v-model="reportWorkDay"
+          type="daterange"
+          value-format="yyyy-MM-dd"
+          :clearable="false"
+          range-separator="至"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+          @change="handleDateChange">
+        </el-date-picker>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="
+          (synchronousReportingDialog = false)
+          ">取 消</el-button>
+        <el-button type="primary" :loading="reportWorkLoading" :disabled="reportWorkDayDisable" @click="reportWorkCli()">确定</el-button>
+      </span>
+    </el-dialog>
+
     <!-- 任务类型新增 -->
     <el-dialog title="新增任务类型" :visible.sync="taskTypeAddDialog" width="800" :before-close="handleClose">
       <div>
@@ -290,6 +315,10 @@ export default {
   },
   data() {
     return {
+      synchronousReportingDialog: false, 
+      reportWorkDay: [],
+      reportWorkDayDisable: false,
+      reportWorkLoading: false,
       steelStampNumber: "",
       todayDate: this.dayjs().format('YYYY-MM-DD'),
       planDate: this.dayjs().format('YYYY-MM-DD'),
@@ -390,6 +419,55 @@ export default {
       this.getTaskTypeList();
   },
   methods: {
+    reportWorkCli() {
+      this.reportWorkLoading = true;
+      this.http.post(
+        "/wx-corp-info/testSyncTemporaryJobApplication",
+        { startDate: this.reportWorkDay[0], endDate: this.reportWorkDay[1] },
+        (res) => {
+          this.reportWorkLoading = false;
+          if (res.code == "ok") {
+            this.synchronousReportingDialog = false
+            this.$message({
+              message: '同步成功',
+              type: "success",
+            });
+            this.getTableData()
+          } else {
+            this.$message({
+              message: res.msg,
+              type: "error",
+            });
+          }
+        },
+        (error) => {
+          this.reportWorkLoading = false;
+          this.$message({
+            message: error,
+            type: "error",
+          });
+        }
+      );
+    },
+    // 显示临时报工
+    showReportingDialog() {
+      this.reportWorkDay = [this.dayjs().format('YYYY-MM-DD'), this.dayjs().format('YYYY-MM-DD')]
+      this.synchronousReportingDialog = true
+    },
+    handleDateChange(value) {
+      const startDate = value[0];
+      const endDate = value[1];
+      const d1 = this.dayjs(startDate);
+      const d2 = this.dayjs(endDate);
+      const diffDays = Math.abs(d1.diff(d2, 'day'));
+      if (diffDays > 30) {
+        this.reportWorkDayDisable = true
+        console.log('日期相隔超过三十天');
+      } else {
+        console.log('日期相隔不超过三十天');
+        this.reportWorkDayDisable = false
+      }
+    },
     // 初始化 Form
     initTodayPlanForm() {
       this.todayPlanForm = {
@@ -1058,6 +1136,20 @@ export default {
 };
 </script>
 <style scoped lang='scss'>
+
+.tongbu {
+  width: 100%;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  &>div {
+    margin-bottom: 15px;
+    color: #999;
+    &:last-child {
+      margin-bottom: 0;
+    }
+  }
+}
 .colorText {
   color: #02a7f0;
   cursor: pointer;