692e8fc1 by xiaomiao
2 parents 1773962b f0bf18c2
......@@ -21,6 +21,4 @@ yarn-error.log*
*.njsproj
*.sln
*.sw?
/src/api/config.js
package-lock.json
......
......@@ -11,10 +11,11 @@
"@jiaminghi/data-view": "^2.10.0",
"axios": "^0.21.1",
"clipboard": "^2.0.11",
"jsoneditor": "^9.9.2",
"core-js": "^3.6.5",
"echarts": "^4.6.0",
"file-saver": "^2.0.5",
"js-cookie": "2.2.0",
"jsoneditor": "^9.9.2",
"lodash": "^4.17.21",
"node-sass": "^4.14.1",
"normalize.css": "7.0.0",
......@@ -24,7 +25,9 @@
"vue-json-editor": "^1.4.3",
"vue-router": "3.0.2",
"vuex": "3.1.0",
"xe-utils": "^3.5.7"
"xe-utils": "^3.5.7",
"xlsx": "^0.17.0",
"xlsx-style": "^0.8.13"
},
"devDependencies": {
"@vue/cli-plugin-babel": "4.4.4",
......
export default {
// SERVERAPI: '/service-bdcsjsb-th', //浩浩
// SERVERAPI: '/service-bdcsjsb-zz',
SERVERAPI: '/bdcsjsb', //赵千
MANAGEMENTAPI: 'http://192.168.2.236/management'
// SERVERAPI: '/bdcsjsb-service'
// SERVERAPI: '/bdcsjsb-jiao0'
}
// 汉中
// export default {
// // SERVERAPI: '/service-bdcsjsb-th', //线上
// SERVERAPI: '/bdcsjsb', //赵千
// MANAGEMENTAPI: 'http://172.16.56.32:8877/management'
// }
<template>
<!-- 编辑 -->
<el-dialog :close-on-click-modal="false" top="0" @close="closeDialog"
custom-class="dialogBox editDialogBox mainCenter" :visible.sync="dialogVisible" width="85%">
<el-dialog :close-on-click-modal="false" top="0" @close="closeDialog" custom-class="dialogBox editDialogBox mainCenter"
:visible.sync="dialogVisible" width="85%">
<div slot="title" class="dialog_title" ref="dialogTitle">
{{ title || '标题' }}
</div>
......@@ -96,6 +95,10 @@
<component :is="editItem" ref="editItem" :class="{ 'editForm': $store.state.business.Edit }"
:bsmYwsjb="bsmYwsjb" :bsmSjsb="dataReport.bsmReport || dataReport.bsmSjsb" />
</div>
<div class="d-center">
<btn nativeType="cz" @click="dialogVisible = false">取 消</btn>
<btn nativeType="cx" @click="submitForm">确 定</btn>
</div>
</div>
<div v-if="titleName == 'xyjg'">
<Xyjg :form-data='dataReport'></Xyjg>
......@@ -160,7 +163,6 @@ export default {
digitalSign: "",
},
images: require("./images/success.gif"),
saveloding: false,
dialogVisible: false,
activeName: undefined,
editItem: "",
......@@ -234,51 +236,25 @@ export default {
this.headerList = [];
},
submitForm () {
let _this = this;
this.$store.dispatch(
"business/setRules",
this.$store.state.business.subRules
);
this.$nextTick(() => {
this.$refs["editItem"] &&
this.$refs["editItem"].verificationForm().then((res) => {
if (!res) {
_this.$message({
message: "请检查表单必填项是否完整",
type: "warning",
});
return false;
} else {
_this.saveloding = true;
_this.$refs["editItem"]
.handleUpdateForm()
// this.$store.dispatch(
// "business/setRules",
// this.$store.state.business.subRules
// );
this.$refs["editItem"].handleUpdateForm()
.then((res) => {
if (res == 200) {
_this.$alert(
'<p><img class="success-images" src="' +
this.images +
'"/>编辑成功!</p>',
"提示",
{
showConfirmButton: false,
dangerouslyUseHTMLString: true,
}
);
setTimeout(() => {
MessageBox.close(false);
}, 1500);
this.$message({
message: '修改成功',
type: 'success'
})
}
})
.catch(function (error) {
_this.$alert(error, "提示", {
this.$alert(error, "提示", {
confirmButtonText: "确定",
type: "error",
});
});
_this.saveloding = false;
}
});
});
type: "error"
})
})
}
}
}
......@@ -315,6 +291,8 @@ export default {
}
.sjmx {
padding-bottom: 25px;
/deep/.el-tabs__item {
height: 50px;
padding-top: 6px;
......@@ -390,7 +368,7 @@ export default {
}
.edit-content {
height: 450px;
height: 420px;
overflow-y: auto;
overflow-x: hidden;
padding-right: 1px;
......
<template>
<div>
<el-input type="textarea" :rows="6" disabled placeholder="配置参数" v-model="resultInfo">
</el-input>
</div>
</template>
<script>
// 引入json编译器
......
import XLSX2 from "xlsx";
import XLSX from "xlsx-style";
/**
* 获取数据类型
* @param {All} [o] 需要检测的数据
......@@ -131,3 +133,103 @@ export function getCurrentDate (date = 'firstDay') {
return new Date(nowYear, nowMonth + 1, 0); // 本月结束时间
}
}
export function setExport2Excel (exportName) {
/* generate workbook object from table */
var wb = XLSX2.utils.table_to_sheet(document.querySelector("#mytable"));//mytable为表格的id名
if (!wb['!merges']) {
this.$message.warning('无法导出:报表无数据');
return
}
for (var i = 0; i < 11; i++) {
wb["!cols"][i] = { wpx: 150 }
}
// 样式的文档地址
// https://www.npmjs.com/package/xlsx-style
for (const key in wb) {
if (key.indexOf('!') === -1 && wb[key].v) {
wb[key].s = {
font: {//字体设置
sz: 13,
bold: false,
color: {
rgb: '000000'//十六进制,不带#
}
},
alignment: {//文字居中
horizontal: 'center',
vertical: 'center',
wrapText: 1,
indent: 0,
wrap_text: true
},
border: { // 设置边框
top: { style: 'thin' },
bottom: { style: 'thin' },
left: { style: 'thin' },
right: { style: 'thin' }
}
}
}
}
var data = addRangeBorder(wb['!merges'], wb) //合并项添加边框
var filedata = sheet2blob(data)
openDownloadDialog(filedata, exportName + ".xlsx")
}
//为合并项添加边框
function addRangeBorder (range, ws) {
let arr = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"];
range.forEach(item => {
let startColNumber = Number(item.s.r), endColNumber = Number(item.e.r);
let startRowNumber = Number(item.s.c), endRowNumber = Number(item.e.c);
const test = ws[arr[startRowNumber] + (startColNumber + 1)];
for (let col = startColNumber; col <= endColNumber; col++) {
for (let row = startRowNumber; row <= endRowNumber; row++) {
ws[arr[row] + (col + 1)] = test;
}
}
})
return ws;
}
//将一个sheet转成最终的excel文件的blob对象,然后利用URL.createObjectURL下载
function sheet2blob (sheet, sheetName) {
sheetName = sheetName || 'sheet1';
var workbook = {
SheetNames: [sheetName],
Sheets: {}
};
workbook.Sheets[sheetName] = sheet; // 生成excel的配置项
var wopts = {
bookType: 'xlsx', // 要生成的文件类型
bookSST: false, // 是否生成Shared String Table,官方解释是,如果开启生成速度会下降,但在低版本IOS设备上有更好的兼容性
type: 'binary'
};
var wbout = XLSX.write(workbook, wopts);
var blob = new Blob([s2ab(wbout)], {
type: "application/octet-stream"
}); // 字符串转ArrayBuffer
function s2ab (s) {
var buf = new ArrayBuffer(s.length);
var view = new Uint8Array(buf);
for (var i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
return buf;
}
return blob;
}
function openDownloadDialog (url, saveName) {
if (typeof url == 'object' && url instanceof Blob) {
url = URL.createObjectURL(url); // 创建blob地址
}
var aLink = document.createElement('a');
aLink.href = url;
aLink.download = saveName || ''; // HTML5新增的属性,指定保存文件名,可以不要后缀,注意,file:///模式下不会生效
var event;
if (window.MouseEvent) event = new MouseEvent('click');
else {
event = document.createEvent('MouseEvents');
event.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
}
aLink.dispatchEvent(event);
}
\ No newline at end of file
......
......@@ -46,7 +46,7 @@ class data extends filter {
{
prop: "bizMsgid",
label: "业务报文ID",
width: 90,
width: 98,
},
{
prop: "createdate",
......
......@@ -10,3 +10,6 @@
.el-table--border::after {
width: 0 !important;
}
.export-excel-wrapper{
display: inline-block;
}
\ No newline at end of file
......
......@@ -25,6 +25,7 @@
<el-form-item>
<btn nativeType="cz" @click="handleResetForm">重置</btn>
<btn nativeType="cx" @click="handleSearch">查询</btn>
<btn nativeType="cx" @click="handlesetExport2Excel(2121)">导出1</btn>
</el-form-item>
</el-col>
</el-row>
......@@ -32,9 +33,9 @@
</div>
<!-- 列表区域 -->
<div class="from-clues-content">
<lb-table ref="table" :page-size="pageData.size" :current-page.sync="pageData.current" :total="tableData.total"
@size-change="handleSizeChange" @p-current-change="handleCurrentChange" :column="tableData.columns"
:data="tableData.data">
<lb-table ref="table" :id="'mytable'" :page-size="pageData.size" :header-cell-style="headerStyle"
:current-page.sync="pageData.current" :total="tableData.total" @size-change="handleSizeChange"
@p-current-change="handleCurrentChange" :column="tableData.columns" :data="tableData.data">
</lb-table>
</div>
</div>
......@@ -49,7 +50,7 @@ import tableMixin from "@/mixins/tableMixin.js";
//引入日期处理方法
import { timeFormat } from "@/utils/operation";
// 获取时间
import { getCurrentDate } from "@/utils/tools";
import { getCurrentDate, setExport2Excel } from "@/utils/tools";
export default {
name: "jsbwcx",
mixins: [tableMixin],
......@@ -112,12 +113,22 @@ export default {
pageSize: 10,
current: 1
}
};
}
},
created () {
this.handleResetForm()
},
methods: {
headerStyle ({ row, rowIndex }) {
if (rowIndex == 3) {
row[2].rowSpan = 2;
row[3].rowSpan = 2;
row[4].rowSpan = 2;
}
},
handlesetExport2Excel (val) {
setExport2Excel(val)
},
//截止日期变化
endTimeChange (val) {
this.form.endTime = timeFormat(new Date(val), true)
......
......@@ -24,7 +24,9 @@
<el-col :span="12" class="btnColRight">
<el-form-item>
<btn nativeType="cz" @click="handleResetForm">重置</btn>
<!-- 导出excel -->
<btn nativeType="cx" @click="handleSearch">查询</btn>
<btn nativeType="cx" @click="handlesetExport2Excel(2121)">导出</btn>
</el-form-item>
</el-col>
</el-row>
......@@ -32,9 +34,9 @@
</div>
<!-- 列表区域 -->
<div class="from-clues-content">
<lb-table ref="table" :page-size="pageData.size" :current-page.sync="pageData.current" :total="tableData.total"
@size-change="handleSizeChange" @p-current-change="handleCurrentChange" :column="tableData.columns"
:data="tableData.data">
<lb-table ref="table" :page-size="pageData.size" :id="'mytable'" :current-page.sync="pageData.current"
:total="tableData.total" @size-change="handleSizeChange" @p-current-change="handleCurrentChange"
:column="tableData.columns" :data="tableData.data">
</lb-table>
</div>
</div>
......@@ -49,7 +51,7 @@ import tableMixin from "@/mixins/tableMixin.js";
//引入日期处理方法
import { timeFormat } from "@/utils/operation";
// 获取时间
import { getCurrentDate } from "@/utils/tools";
import { getCurrentDate, setExport2Excel } from "@/utils/tools";
export default {
name: "jsbwcx",
mixins: [tableMixin],
......@@ -118,6 +120,9 @@ export default {
this.handleResetForm()
},
methods: {
handlesetExport2Excel (val) {
setExport2Excel(val)
},
//截止日期变化
endTimeChange (val) {
this.form.endTime = timeFormat(new Date(val), true)
......
......@@ -25,6 +25,7 @@
<el-form-item>
<btn nativeType="cz" @click="handleResetForm">重置</btn>
<btn nativeType="cx" @click="handleSearch">查询</btn>
<btn nativeType="cx" @click="handlesetExport2Excel(2121)">导出</btn>
</el-form-item>
</el-col>
</el-row>
......@@ -32,9 +33,9 @@
</div>
<!-- 列表区域 -->
<div class="from-clues-content">
<lb-table ref="table" :page-size="pageData.size" :current-page.sync="pageData.current" :total="tableData.total"
@size-change="handleSizeChange" @p-current-change="handleCurrentChange" :column="tableData.columns"
:data="tableData.data">
<lb-table ref="table" :id="'mytable'" :page-size="pageData.size" :current-page.sync="pageData.current"
:total="tableData.total" @size-change="handleSizeChange" @p-current-change="handleCurrentChange"
:column="tableData.columns" :data="tableData.data">
</lb-table>
</div>
</div>
......@@ -49,7 +50,7 @@ import tableMixin from "@/mixins/tableMixin.js";
//引入日期处理方法
import { timeFormat } from "@/utils/operation";
// 获取时间
import { getCurrentDate } from "@/utils/tools";
import { getCurrentDate, setExport2Excel } from "@/utils/tools";
export default {
name: "jsbwcx",
mixins: [tableMixin],
......@@ -111,13 +112,16 @@ export default {
total: 0,
pageSize: 10,
current: 1
},
}
};
},
created () {
this.handleResetForm()
},
methods: {
handlesetExport2Excel (val) {
setExport2Excel(val)
},
//截止日期变化
endTimeChange (val) {
this.form.endTime = timeFormat(new Date(val), true)
......
......@@ -60,6 +60,9 @@ module.exports = {
// configureWebpack通过操作对象的形式,来修改默认的webpack配置
configureWebpack: {
name: name,
externals: [{
'./cptable': 'var cptable'
}],
resolve: {
alias: {
'@': resolve('src')
......