From 0c6aa6e556a8771897b9251a296a7a0c15c57c46 Mon Sep 17 00:00:00 2001 From: MrShi <1878285526@qq.com> Date: 星期二, 19 十一月 2024 18:28:17 +0800 Subject: [PATCH] 优化 --- company/src/components/business/OperaSolutionsBaseWindow.vue | 42 +++++++++++++++++++++++++++++++++++++++--- 1 files changed, 39 insertions(+), 3 deletions(-) diff --git a/company/src/components/business/OperaSolutionsBaseWindow.vue b/company/src/components/business/OperaSolutionsBaseWindow.vue index 6772793..bbb4437 100644 --- a/company/src/components/business/OperaSolutionsBaseWindow.vue +++ b/company/src/components/business/OperaSolutionsBaseWindow.vue @@ -87,7 +87,11 @@ placeholder="璇烽�夋嫨鎵规敼鎻愰啋鏃堕棿"> </el-time-picker> </el-form-item> - <el-button type="primary" @click="add" style="margin-bottom: 10px;">娣诲姞宸ョ</el-button> + <div style="display: flex; align-items: center;"> + <el-button type="primary" @click="add" style="margin-bottom: 10px;">娣诲姞宸ョ</el-button> + <el-button type="primary" @click="impor" style="margin-bottom: 10px;">瀵煎叆宸ョ</el-button> + <el-button type="text" @click="exprot">瀵煎叆妯$増xls</el-button> + </div> <el-table :data="form.worktypeIdList" border @@ -133,6 +137,8 @@ <RichEditor :richData="form.ortherInfo" :styleEditor="'border: 1px solid #ccc;display: inline-block;'" @getWangedditor="getWangedditor2" :readonly="false"/> </el-form-item> </el-form> + <!-- 涓婁紶宸ョ --> + <input type="file" @change="getFile" style="opacity: 0;" ref="upload" accept=".xlsx" /> </GlobalWindow> </template> @@ -140,7 +146,7 @@ import BaseOpera from '@/components/base/BaseOpera' import GlobalWindow from '@/components/common/GlobalWindow' import { all } from '@/api/business/insurance' - import { all as allWorktype } from '@/api/business/worktype' + import { all as allWorktype, importExcelForSolution } from '@/api/business/worktype' import { solutionsBaseId } from '@/api/business/solutionsBase' import { pageAll as shopList } from '@/api/business/company' import UploadFile from '@/components/common/UploadFile' @@ -233,6 +239,37 @@ }) }, methods: { + // 瀵煎叆宸ョ妯℃澘 + getFile(e) { + const formdate = new FormData() + formdate.append('file', e.target.files[0]) + formdate.append('insuranceId', this.form.insuranceId) + importExcelForSolution(formdate) + .then(res => { + console.log(res) + res.forEach(id => { + if (this.form.worktypeIdList.length === 1 && !this.form.worktypeIdList[0].worktypeId) { + this.form.worktypeIdList[0].worktypeId = id + } else { + this.form.worktypeIdList.push({ worktypeId: id }) + } + }) + }) + .catch(err => { + this.$message.error(err.message) + }) + .finally(() => { + this.$refs.upload.value = null + }) + }, + impor() { + if (!this.form.insuranceId) return this.$message.warning('璇峰厛閫夋嫨浼佷笟') + this.$refs.upload.click() + }, + // 瀵煎嚭妯℃澘 + exprot() { + window.open(process.env.VUE_APP_TYPEWORK_URL) + }, getWangedditor(val){ this.form.specialAgreement = val; }, @@ -349,7 +386,6 @@ this.form[key] = res[key] } this.form.correctWarnTime = `${this.form.correctWarnTime}:00` - console.log(this.form.correctWarnTime) if (res.worktypeList) { this.form.worktypeIdList = res.worktypeList.map(item => { return { -- Gitblit v1.9.3