|
@@ -331,24 +331,29 @@
|
|
|
<div>
|
|
|
<el-link
|
|
|
type="primary"
|
|
|
- @click="handleDownload"
|
|
|
+ @click="xiazaielement"
|
|
|
>下载导入模版</el-link>
|
|
|
</div>
|
|
|
<el-upload
|
|
|
class="upload-demo martop10"
|
|
|
action="#"
|
|
|
- accept="xlsx,xls"
|
|
|
- multiple
|
|
|
+ accept=".xlsx,.xls"
|
|
|
+ :multiple='false'
|
|
|
+ :limit="1"
|
|
|
+ :auto-upload="false"
|
|
|
+ :on-change="ElementChange"
|
|
|
:file-list="ImportElementFile"
|
|
|
+ :on-remove='ElementRemove'
|
|
|
>
|
|
|
<el-button
|
|
|
+ v-if="ImportElementFile.length===0"
|
|
|
size="small"
|
|
|
type="primary"
|
|
|
>点击上传</el-button>
|
|
|
<div
|
|
|
slot="tip"
|
|
|
class="el-upload__tip"
|
|
|
- >只能上传xlsx/xls文件</div>
|
|
|
+ >只能上传xlsx / xls文件</div>
|
|
|
</el-upload>
|
|
|
<span
|
|
|
slot="footer"
|
|
@@ -1307,7 +1312,7 @@
|
|
|
import ManualSorting from '@/components/WbsTree/ManualSorting'
|
|
|
import {
|
|
|
getLazytree, getDetail, update, selectByNodeTable, getAlltree,
|
|
|
- saveFormAndElement, selectFormElements, removeTableById, findWbsTreeSameLevel, wbsTreeSort, findWbsTreeTableSameLevel, wbsTreeTableSort, parameters, saveOrUpdateBatch, keymap,
|
|
|
+ saveFormAndElement, selectFormElements, removeTableById, findWbsTreeSameLevel, wbsTreeSort, findWbsTreeTableSameLevel, wbsTreeTableSort, parameters, saveOrUpdateBatch, keymap, importwbsTreeFormBatch, exportBatchTemplate,
|
|
|
importWbsTree, exportTemplate, remove as removeTreeNode
|
|
|
} from "@/api/manager/wbstree";
|
|
|
import {
|
|
@@ -1319,6 +1324,9 @@ import { mapGetters } from "vuex";
|
|
|
export default {
|
|
|
data () {
|
|
|
return {
|
|
|
+ ImportElementdata: {
|
|
|
+
|
|
|
+ },
|
|
|
ImportElementFile: [],//导入元素file文件
|
|
|
ImportElementTag: false,
|
|
|
jiedianId: '',
|
|
@@ -2243,17 +2251,65 @@ export default {
|
|
|
//#endregion
|
|
|
|
|
|
//#region 导入元素
|
|
|
- ImportElement () {//导入元素按钮
|
|
|
+ ImportElement (data) {//导入元素按钮
|
|
|
+ this.ImportElementdata.ancestors = data.ancestors
|
|
|
+ this.ImportElementdata.id = data.id
|
|
|
this.ImportElementTag = true
|
|
|
|
|
|
},
|
|
|
- pushImportElement () {//确定按钮
|
|
|
-
|
|
|
+ async pushImportElement () {//确定按钮
|
|
|
+ if (this.ImportElementFile.length > 0) {
|
|
|
+ let formData = new FormData()
|
|
|
+ // formData.append('wbsTree', JSON.stringify({
|
|
|
+ // wbsId: this.$route.params.id,
|
|
|
+ // ancestors: this.ImportElementdata.ancestors,
|
|
|
+ // id: this.ImportElementdata.id,
|
|
|
+ // tenantId: this.userInfo.tenant_id,
|
|
|
+ // }))
|
|
|
+ formData.append('wbsId', this.$route.params.id)
|
|
|
+ formData.append('ancestors', this.ImportElementdata.ancestors)
|
|
|
+ formData.append('id', this.ImportElementdata.id)
|
|
|
+ formData.append('tenantId', this.userInfo.tenant_id)
|
|
|
+ formData.append('excelFile', this.ImportElementFile[0].raw)
|
|
|
+ await this.importwbsTreeFormBatch(formData)
|
|
|
+ this.ImportElementFile = []
|
|
|
+ this.ImportElementTag = false
|
|
|
+ }
|
|
|
},
|
|
|
ImportElementHandleClose () {//关闭弹框事件
|
|
|
this.ImportElementTag = false
|
|
|
this.ImportElementFile = []
|
|
|
},
|
|
|
+ ElementChange (file, fileList) {//文件上传时的钩子
|
|
|
+ console.log(fileList);
|
|
|
+ if (this.ImportElementFile.length == 0) {
|
|
|
+ this.ImportElementFile = fileList
|
|
|
+ }
|
|
|
+ },
|
|
|
+ ElementRemove (file, fileList) {
|
|
|
+ this.ImportElementFile = fileList
|
|
|
+ },
|
|
|
+ async importwbsTreeFormBatch (da) {
|
|
|
+ const { data: res } = await importwbsTreeFormBatch(da)
|
|
|
+ console.log();
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message({
|
|
|
+ type: "success",
|
|
|
+ message: "新增元素成功!"
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ async exportBatchTemplate () {
|
|
|
+ const res = await exportBatchTemplate()
|
|
|
+ console.log(res);
|
|
|
+ if (res.status == 200) {
|
|
|
+ this.downloadExcel(res.data, '导入元素模板')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ xiazaielement () {
|
|
|
+ this.exportBatchTemplate()
|
|
|
+ }
|
|
|
//#endregion
|
|
|
},
|
|
|
components: {
|