Fixiaobai
2023-10-25 0a11dd47059e28f8978c758e83c07b8d93c0f75b
src/views/basic/part/index.vue
@@ -11,11 +11,11 @@
    </basic-container>
    <el-dialog title="同步IFS" :visible.sync="dialogVisible" width="30%" :before-close="handleClose">
      <el-row>
        <el-col :span="6"">
        <el-col :span="6" style="height: 40px;line-height: 30px;">
          同步日期:
        </el-col>
        <el-col :span="18">
          <el-date-picker style="width: 100%;" v-model="selectDate" type="date" placeholder="选择日期">
          <el-date-picker style="width: 100%;height: 100%;" v-model="selectDate" type="date" placeholder="选择日期">
      </el-date-picker>
        </el-col>
      </el-row>
@@ -364,7 +364,7 @@
            fun: this.addOrUpdateHandle
          },
          {
            text: '同步IFS',
            text: '获取IFS零件',
            type: 'primary',
            fun: this.syncISDate,
            loading: false
@@ -634,20 +634,34 @@
    // },
    syncISDate() {
      this.dialogVisible = true
      this.selectDate=null
    },
    syncIfs() {
      this.table.toolbar.find((e) => e.text === '同步IFS').loading = true
      this.handleClose()
      let data=new FormData()
      data.append("date",this.selectDatethis.selectDate)
      console.log(data);
      syncPart(data)
      this.dialogVisible = false
      let datas=new FormData()
      datas.set("date",this.selectDate)
      // console.log(datas.get("date"));
      // console.log(this.selectDate);
      // return
      syncPart(datas)
        .then((res) => {
          const data = res.data
          console.log(data);
          if (data.code === 0) {
            this.$message.success('开始同步')
            if(data.data>0){
              this.$message.success('同步成功'+data.data+"条数据")
            }
            if(data.data<1){
              this.$message.warning("该日期没有新的零件数据");
            }
            this.table.toolbar.find((e) => e.text === '同步IFS').loading = false
            this.getData()
          } else {
            this.$message.error('同步IFS失败')
            this.table.toolbar.find((e) => e.text === '同步IFS').loading = false
            this.getData()
          }
        })
        .catch((e) => {