From dc28e1f365d0fe26017db3e389e4462962c0b380 Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期五, 28 七月 2023 13:20:03 +0800
Subject: [PATCH] 主数据导入导出
---
Source/UBCS-WEB/src/router/axios.js | 2
Source/UBCS-WEB/src/components/Master/MasterTransfer.vue | 126 ++++++++++++++++++++++++++++++------------
Source/UBCS-WEB/src/api/GetItem.js | 2
Source/UBCS-WEB/src/components/Crud/VciMasterCrud.vue | 2
Source/UBCS-WEB/vue.config.js | 5 +
5 files changed, 96 insertions(+), 41 deletions(-)
diff --git a/Source/UBCS-WEB/src/api/GetItem.js b/Source/UBCS-WEB/src/api/GetItem.js
index 9c0df49..a367b7e 100644
--- a/Source/UBCS-WEB/src/api/GetItem.js
+++ b/Source/UBCS-WEB/src/api/GetItem.js
@@ -19,7 +19,7 @@
}
})
}
-//楂樼骇鏌ヨ
+//鍏ㄦ煡璇�
export const FindData =(params)=>{
return request({
url: 'api/ubcs-code/mdmEngineController/gridTableDataByClassifyOid',
diff --git a/Source/UBCS-WEB/src/components/Crud/VciMasterCrud.vue b/Source/UBCS-WEB/src/components/Crud/VciMasterCrud.vue
index 7b631ec..b2582e6 100644
--- a/Source/UBCS-WEB/src/components/Crud/VciMasterCrud.vue
+++ b/Source/UBCS-WEB/src/components/Crud/VciMasterCrud.vue
@@ -87,7 +87,7 @@
<advanced-query :options="this.options" :visible.sync="findvisible"
@echoContion="echoContion"></advanced-query>
<!-- 瀵煎嚭-->
- <MasterTransfer :codeClassifyOid="codeClassifyOid" :selectRow="selectRow"
+ <MasterTransfer :codeClassifyOid="codeClassifyOid" :limit="page.pageSize" :templateOid="templateOid" :selectRow="selectRow"
:tableData="tableData" :tableHeadData="tableHeadFindData"
:visible.sync="dialogPush"></MasterTransfer>
<!-- 鐩镐技椤�-->
diff --git a/Source/UBCS-WEB/src/components/Master/MasterTransfer.vue b/Source/UBCS-WEB/src/components/Master/MasterTransfer.vue
index 267b33b..e8d1929 100644
--- a/Source/UBCS-WEB/src/components/Master/MasterTransfer.vue
+++ b/Source/UBCS-WEB/src/components/Master/MasterTransfer.vue
@@ -1,11 +1,15 @@
<template>
-<el-dialog :visible.sync="dialogPush" append-to-body :close-on-click-modal="false" @close="recoverPage" title="瀵煎嚭">
- <div style="margin-bottom: 10px">
- <el-radio-group v-model="radio">
- <el-radio :label="0">閫夋嫨</el-radio>
- <el-radio :label="1">鍏ㄩ儴</el-radio>
- <el-radio :label="2">椤电爜</el-radio>
- </el-radio-group>
+<el-dialog :visible.sync="dialogPush" append-to-body :close-on-click-modal="false" @close="escHandler" title="瀵煎嚭" style="width: 1550px; margin: auto">
+ <div style="margin-bottom: 20px;">
+ <div>
+ <span>瀵煎嚭鏂瑰紡锛�</span>
+ <el-radio-group v-model="radio">
+ <el-radio :label="0">閫夋嫨</el-radio>
+ <el-radio :label="1">鍏ㄩ儴</el-radio>
+ <el-radio :label="2">椤电爜</el-radio>
+ </el-radio-group>
+ <span v-if="radio === 2" style="margin-left: 20px;"><el-input style="width: 150px" v-model="pageExport"></el-input> 锛堣緭鍏ラ〉鐮佹垨鑰呴〉闈㈣寖鍥达紝濡傦細1-10)锛�</span>
+ </div>
</div>
<div style="text-align: center">
<el-transfer
@@ -20,19 +24,20 @@
</div>
<div style="display: flex;justify-content: flex-end;">
<el-button size="small" plain type="success" @click="handleExcel">纭畾</el-button>
- <el-button size="small" plain >鍙栨秷</el-button>
+ <el-button size="small" plain @click="escHandler">鍙栨秷</el-button>
</div>
</el-dialog>
</template>
<script>
-import {exportCode} from '@/api/GetItem'
+import {exportCode,FindData} from '@/api/GetItem'
import func from "@/util/func";
export default {
name: "MasterTransfer",
- props:['visible','tableHeadData','codeClassifyOid','tableData','selectRow'],
+ props:['visible','tableHeadData','codeClassifyOid','tableData','selectRow','templateOid','limit'],
data(){
return {
+ pageExport:"",
data: [],
value: [],
filterMethod(query, item) {
@@ -50,7 +55,9 @@
children: []
}],
data: []
- }
+ },
+ exportArr:{},
+ ids:""
};
},
watch:{
@@ -105,42 +112,89 @@
mounted() {
},
methods:{
+ escHandler(){
+ this.$emit('update:visible', false);
+ this.value=[];
+ },
//鍏抽棴椤甸潰
recoverPage(){
this.$emit('update:visible', false);
},
handleExcel(){
- // this.$Export.excel({
- // title: this.option.title,
- // columns: this.option.column,
- // data: this.option.data
- // });
- if(this.radio === 0){
- if(this.selectRow.length<=0){
- this.$message.warning('璇烽�夋嫨瑕佸鍑虹殑妯℃澘')
- }else {
- //宸查�夋嫨澶氶��
- const selectList=[]
- //宸查�夋嫨灞炴��
- let exportArr={}
- const ids = this.selectRow.map(item => item.oid).join(',')
- this.selectRow.forEach(item=>{
- selectList.push(
- item.oid
- )
- })
- this.value.map(index => this.tableHeadData[index].prop).forEach((item, index) => {
- exportArr[`attrIdIndexMap[${index}]`] = item
- })
- exportCode({codeClassifyOid:this.codeClassifyOid,'conditionMap[oid]':ids,...exportArr}).then(res=>{
+ if(this.value <= 0){
+ this.$message.warning('璇烽�夋嫨灞炴��')
+ }else {
+ this.value.map(index => this.tableHeadData[index].prop).forEach((item, index) => {
+ this.exportArr[`attrIdIndexMap[${index}]`] = item
+ })
+ if(this.radio === 0){
+ if(this.selectRow.length<=0){
+ this.$message.warning('璇烽�夋嫨瑕佸鍑虹殑妯℃澘')
+ }else {
+ //宸查�夋嫨澶氶��
+ const selectList=[]
+ //宸查�夋嫨灞炴��
+ let exportArr={}
+ const ids = this.selectRow.map(item => item.oid).join(',')
+ this.selectRow.forEach(item=>{
+ selectList.push(
+ item.oid
+ )
+ })
+ exportCode({codeClassifyOid:this.codeClassifyOid,'conditionMap[oid]':this.ids,...this.exportArr}).then(res=>{
+ // console.log('res',res)
+ if(res){
+ func.downloadFileByBlob(res);
+ this.escHandler()
+ }
+ })
+
+ }
+ }else if(this.radio === 1){
+ this.ids=this.tableData.map(item => item.oid).join(',')
+ exportCode({codeClassifyOid:this.codeClassifyOid,...this.exportArr,limit:-1}).then(res=>{
// console.log('res',res)
if(res){
func.downloadFileByBlob(res);
+ this.escHandler()
}
})
-
+ }else if(this.radio === 2){
+ const input = this.pageExport.trim();
+ let start, end;
+ if (input.includes('-')) {
+ if (input.indexOf('-') !== input.lastIndexOf('-')) {
+ this.$message.warning('杈撳叆鏍煎紡閿欒锛氬彧鑳借緭鍏ヤ竴涓� - 鍙烽殧寮�');
+ return;
+ }
+ //鍖呭惈-瑙f瀽
+ const range = input.split('-');
+ start = Number(range[0]);
+ end = Number(range[1]);
+ if (isNaN(start) || isNaN(end)) {
+ this.$message.warning('杈撳叆鏍煎紡閿欒');
+ return;
+ }
+ } else {
+ //涓嶅寘鍚�-瑙f瀽
+ start = Number(input);
+ end = start;
+ if (isNaN(start)) {
+ this.$message.warning('杈撳叆鏍煎紡閿欒');
+ return;
+ }
+ }
+ exportCode({ codeClassifyOid: this.codeClassifyOid, ...this.exportArr, limit: this.limit, page: start, endPage: end }).then((res) => {
+ // console.log('res',res)
+ if (res) {
+ func.downloadFileByBlob(res);
+ this.escHandler()
+ }
+ });
}
- };
+
+ }
+
},
}
}
diff --git a/Source/UBCS-WEB/src/router/axios.js b/Source/UBCS-WEB/src/router/axios.js
index 942f0ed..559edfe 100644
--- a/Source/UBCS-WEB/src/router/axios.js
+++ b/Source/UBCS-WEB/src/router/axios.js
@@ -18,7 +18,7 @@
import qs from 'qs';
//榛樿瓒呮椂鏃堕棿
-axios.defaults.timeout = 20000;
+axios.defaults.timeout = 100000;
//杩斿洖鍏朵粬鐘舵�佺爜
axios.defaults.validateStatus = function (status) {
return status >= 200 && status <= 500;
diff --git a/Source/UBCS-WEB/vue.config.js b/Source/UBCS-WEB/vue.config.js
index 54a1f5d..e8b80d9 100644
--- a/Source/UBCS-WEB/vue.config.js
+++ b/Source/UBCS-WEB/vue.config.js
@@ -26,9 +26,10 @@
proxy: {
'/api': {
//鏈湴鏈嶅姟鎺ュ彛鍦板潃
- target: 'http://localhost:37000',
+ // target: 'http://localhost:37000',
// target: 'http://192.168.1.51:37000',
- // target: 'http://dev.vci-tech.com:37000',
+ // target: 'http://192.168.0.102:37000',
+ target: 'http://dev.vci-tech.com:37000',
// target: 'http://192.168.1.104:37000',
// target: 'http://192.168.1.63:37000',
// target: 'http://192.168.3.7:37000',
--
Gitblit v1.9.3