|
@@ -1650,7 +1650,9 @@
|
|
|
oninput="value=value.replace(/[^\a-\z\A-\Z0-9\u4E00-\u9FA5]/g,'')" class="w-50 m-2"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
- <el-button class="btncolor" v-if="activeIndex2 === 0">导入</el-button>
|
|
|
+ <input type="file" ref="fileInput" style="display: none" accept=".xlsx, .xls" @change="handleFileChange"/>
|
|
|
+ <el-button class="btncolor" v-if="activeIndex2 === 0" @click="importdesignvar">导入</el-button>
|
|
|
+ <el-button class="btncolor" v-if="activeIndex2 === 0" @click="exportdesignvar">导出</el-button>
|
|
|
<el-button class="btncolor" @click="onAddItem">新建</el-button>
|
|
|
<el-button class="btncolor" @click="onokItem">确定</el-button>
|
|
|
</div>
|
|
@@ -1679,11 +1681,12 @@
|
|
|
import { ref, onMounted, reactive, provide, nextTick } from "vue";
|
|
|
import { RouterView, RouterLink, useRouter, useRoute } from "vue-router"
|
|
|
import myheader from "@/components/header.vue"
|
|
|
-import { request, uploadFile } from "@/utils/request";
|
|
|
+import { request, uploadFile, downloadFile } from "@/utils/request";
|
|
|
import { ElMessage, ElButton, ElDialog, ElSelect } from 'element-plus'
|
|
|
import { Edit, CaretBottom } from '@element-plus/icons-vue'
|
|
|
// import '@/utils/flexible'
|
|
|
import { ArrowDown } from '@element-plus/icons-vue';
|
|
|
+import axios from 'axios'
|
|
|
import s0 from "@/assets/img/s0.png"
|
|
|
import gc1 from "@/assets/img/gc1.png"
|
|
|
import gc2 from "@/assets/img/gc2.png"
|
|
@@ -3356,6 +3359,53 @@ const targetclick = () => {
|
|
|
const modelgroup=()=>{
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+const fileInput = ref(null)
|
|
|
+
|
|
|
+const importdesignvar = () => {
|
|
|
+ fileInput.value.click();
|
|
|
+}
|
|
|
+
|
|
|
+const handleFileChange = async (event) => {
|
|
|
+ const file = event.target.files[0]
|
|
|
+ if (!file) return
|
|
|
+
|
|
|
+ try {
|
|
|
+ // 直接上传文件到后端
|
|
|
+ const formData = new FormData()
|
|
|
+ formData.append('file', file)
|
|
|
+ formData.append('transCode', 'MDO0081')
|
|
|
+ formData.append('pid', pid.value)
|
|
|
+
|
|
|
+ // 这里替换为你的实际API调用
|
|
|
+ const response = await uploadFile(formData)
|
|
|
+
|
|
|
+ ElMessage.success('文件上传成功')
|
|
|
+ } catch (error) {
|
|
|
+ console.error('上传失败:', error)
|
|
|
+ ElMessage.error('文件上传失败')
|
|
|
+ } finally {
|
|
|
+ event.target.value = '' // 重置input
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const exportdesignvar = () => {
|
|
|
+ const params = {
|
|
|
+ transCode: 'MDO0080',
|
|
|
+ pid: pid.value
|
|
|
+ }
|
|
|
+
|
|
|
+ request(params)
|
|
|
+ .then(() => {
|
|
|
+ ElMessage.success('导出成功')
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ ElMessage.error('导出失败')
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
//新增
|
|
|
const onAddItem = () => {
|
|
|
let tablevalnum = Number(tableval.value) > 1 ? Number(tableval.value) : 1
|
|
@@ -4020,7 +4070,7 @@ const logsget = () => {
|
|
|
}
|
|
|
})
|
|
|
.catch((err) => {
|
|
|
- ElMessage.error(err.returnMsg)
|
|
|
+ ElMessage.error("日志赋值失败")
|
|
|
})
|
|
|
}
|
|
|
// 字符串截取
|