Browse Source

修正请求url前面缺少/的问题

seyason 1 year ago
parent
commit
3d7ff0a3fe

+ 1 - 1
fhKeeper/formulahousekeeper/timesheet/src/views/corpreport/list.vue

@@ -3387,7 +3387,7 @@ export default {
     },
     // 获取项目分类
     async getProjectSort() {
-      let { data } = await this.postData('project-category/list', {})
+      let { data } = await this.postData('/project-category/list', {})
       let dataList = data || []
       dataList.push({id: 'null', name: '未分类'})
       this.projectSortList = dataList

+ 63 - 0
fhKeeper/formulahousekeeper/timesheet/src/views/project/list.vue

@@ -93,6 +93,9 @@
                             <el-dropdown-item v-if="user.timeType.projectManDay == 1 && permissions.projectClassification">
                                 <el-link type="primary" :underline="false" @click="projectManDaySettingDialog = true;getManDaySetting()">{{ '预估工时配置' }}</el-link>
                             </el-dropdown-item>
+                            <el-dropdown-item v-if="user.companyId == 10 || user.companyId == 5608">
+                                <el-link type="primary" :underline="false" @click="importTaskDialog = true">{{ '项目任务导入' }}</el-link>
+                            </el-dropdown-item>
                         </el-dropdown-menu>
                         </el-dropdown>
                 </el-form-item>
@@ -1651,6 +1654,19 @@
                 <el-button type="primary" @click="syncProjectForThird(hasChooseProjectCode)">开始同步</el-button>
             </span>
         </el-dialog>
+        <!--导入数据,下载模板 -->
+        <el-dialog :title="$t('wdorkplanimport')" v-if="importTaskDialog" :visible.sync="importTaskDialog" :close-on-click-modal="false" customClass="customWidth" width="500px">
+            <el-form ref="form4" >
+                <el-form-item :label="'1. '+$t('qing-xian-xia-zai-mo-ban-bing-tian-xie-hou-shang-chuan')" >
+                    <el-link type="primary" :underline="false" href="./upload/多项目任务导入模板.xlsx" download="多项目任务模板.xlsx'">下载多项目任务模板</el-link>
+                </el-form-item>
+            </el-form>
+            <div slot="footer" class="dialog-footer">
+                <el-upload ref="upload" action="#" :limit="1" :http-request="importTask" :show-file-list="false">
+                        <el-button type="primary" :underline="false" style="width:100%;" :loading="loadingExport">{{ $t('uoloadFiles') }}</el-button>
+                </el-upload>
+            </div>
+        </el-dialog>
     </section>
 </template>
 <style scoped>
@@ -1692,6 +1708,7 @@ a {
         },
         data() {
             return {
+                importTaskDialog: false,
                 manDaySetting:{},
                 projectManDaySettingDialog: false,
                 projectListPageComponentKey: 1,
@@ -1999,6 +2016,52 @@ a {
             })
         },
         methods: {
+            // 批量导入任务
+            importTask(item) {
+                //首先判断文件类型
+                this.loadingExport = true
+                let str = item.file.name.split(".");
+                let format = str[str.length - 1];
+                if (format != "xls" && format != "xlsx") {
+                    this.loadingExport = false
+                    this.$message({
+                        message: this.$t('other.PleaseselecttheXLSorXLSXfile'),
+                        type: "error"
+                    });
+                } else {
+                    this.listLoading = true;
+                    let formData = new FormData();
+                    formData.append("file", item.file);
+                    formData.append("isMultiProject", 1);
+                    this.http.uploadFile('/task/importTask', formData,
+                    res => {
+                        this.$refs.upload.clearFiles();
+                        this.listLoading = false;
+                        this.loadingExport = false
+                        if (res.code == "ok") {
+                            this.$message({
+                                message: this.$t('other.importSuccess'),
+                                type: "success"
+                            });
+                            this.importTaskDialog = false;
+                        } else {
+                            this.$message({
+                                message: res.msg,
+                                type: "error"
+                            });
+                        }
+                    },
+                    error => {
+                        this.$refs.upload.clearFiles();
+                        this.listLoading = false;
+                        this.loadingExport = false
+                        this.$message({
+                            message: error,
+                            type: "error"
+                        });
+                    });
+                }
+            },
             saveProjectManDaySetting() {
                 this.http.post('/estimate-time-setting/save', this.manDaySetting,
                 res => {