Commit c019fef7 by zhouzy

样式变化和绑定数据的更改

1 parent 9e1598c2
...@@ -5458,9 +5458,9 @@ ...@@ -5458,9 +5458,9 @@
} }
}, },
"glsx-vue-common": { "glsx-vue-common": {
"version": "1.2.4", "version": "1.2.8",
"resolved": "https://registry.npm.taobao.org/glsx-vue-common/download/glsx-vue-common-1.2.4.tgz", "resolved": "https://registry.npm.taobao.org/glsx-vue-common/download/glsx-vue-common-1.2.8.tgz",
"integrity": "sha1-fMhwcowJfQAZ8/hBEQXhxulqVXY=", "integrity": "sha1-tEcsGvWHZSKlYwqPAhhT8RroMbw=",
"requires": { "requires": {
"vue": "^2.5.10" "vue": "^2.5.10"
} }
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
"dependencies": { "dependencies": {
"axios": "^0.18.0", "axios": "^0.18.0",
"element-ui": "^2.15.1", "element-ui": "^2.15.1",
"glsx-vue-common": "^1.2.4", "glsx-vue-common": "^1.2.8",
"glsx-vue-components": "^1.0.13", "glsx-vue-components": "^1.0.13",
"vee-validate": "^2.1.7", "vee-validate": "^2.1.7",
"vue": "^2.5.17", "vue": "^2.5.17",
......
...@@ -24,7 +24,7 @@ function getlistByCardName(params) { ...@@ -24,7 +24,7 @@ function getlistByCardName(params) {
} }
function exportMemberCard(params) { function exportMemberCard(params) {
return GlAxios.post(`${path}/exportMemberCard`, params, { headers: { 'Content-Type': 'application/json; charset=utf-8' }, requestType: 'jsonString' }) return GlAxios.post(`${path}/exportMemberCard`, params, { headers: { 'Content-Type': 'application/blob; charset=GBK' }, requestType: 'jsonString' })
} }
// 查询权益卡详情 // 查询权益卡详情
// export function memberCardDetails(data) { // export function memberCardDetails(data) {
......
/**
* 公共方法
* author:jack
* date:2018-07-03
* */
import axios from 'axios';
const common = {
/**
* 导出excel
* */
exportExcel: function (options) {
if (!options) {
return false;
}
let oParams = {
method: options.method || 'post',
url: options.url,
responseType: 'blob'
}
if (options.method == 'GET' || options.method == 'get') {
oParams.params = options.data
} else {
oParams.data = options.data;
}
console.log(options.data);
axios(oParams).then(response => {
if (!response) {
return
};
let url = window.URL.createObjectURL(new Blob([response.data], {
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
}));
let link = document.createElement('a');
link.style.display = 'none';
link.href = url;
link.setAttribute('download', options.fileName || 'excel.xlsx');
document.body.appendChild(link);
link.click();
if (options.success) {
(options.success)();
}
}).catch((error) => {
if (options.errorFunc) {
(options.errorFunc)(error);
}
})
},
/**
* 下载zip
*/
downPackFile: function (options) {
if (!options) {
return false;
};
/* let iframe = document.createElement('a')
iframe.style.display = 'none'
iframe.src = options.url
document.body.appendChild(link);
link.click(); */
window.location.href = options.url;
//document.body.appendChild(iframe)
},
/**
* 获取时间对象
*/
getDateInfo: function () {
var o = new Date();
var y = o.getFullYear();
var m = o.getMonth() + 1;
var d = o.getDate();
var M = m;
var D = d;
if (m < 10) {
M = '0' + m;
};
if (d < 10) {
D = '0' + d;
};
return {
y: y,
m: m,
M: M,
d: d,
D: D,
today: y + '-' + M + '-' + D
};
},
/**
* 判断按钮是否有权限
*/
hasPermission: function (id) {
if (!id) {
return false
};
let res = sessionStorage.getItem('MENURESOUCE');
let mres = '';
let resObj = {};
if (res) {
mres = JSON.parse(res);
};
if (mres && mres.length > 0) {
for (let i = 0, len = mres.length; i < len; i++) {
let child = mres[i].children;
resObj[mres[i].menuId] = mres[i];
let abc = Common.processData(child);
Object.assign(resObj, abc);
}
};
if (resObj[id]) {
return true;
} else {
return false;
}
},
/**
* 递归处理数据
*/
processData: function (o) {
let list = {};
if (o && o.length > 0) {
for (let i = 0, len = o.length; i < len; i++) {
let child = o[i].children;
list[o[i].menuId] = o[i];
if (child && child.length > 0) {
let mn = Common.processData(child);
Object.assign(list, mn);
}
}
}
return list;
},
/**
* 递归获取子节点数据
*/
processChildData: function (oInfo) {
let resObj = {};
if (!oInfo) {
return false;
}
if (oInfo && oInfo.length > 0) {
for (let i = 0, len = oInfo.length; i < len; i++) {
let child = oInfo[i].children;
resObj[oInfo[i].menuId] = oInfo[i];
let abc = Common.processData(child);
Object.assign(resObj, abc);
}
};
return resObj;
},
/**
* 数字转换成货币格式
*/
formatMoney: function (number, places, symbol, thousand, decimal) {
number = number || 0;
places = !isNaN(places = Math.abs(places)) ? places : 2;
symbol = symbol !== undefined ? symbol : "$";
thousand = thousand || ",";
decimal = decimal || ".";
var negative = number < 0 ? "-" : "",
i = parseInt(number = Math.abs(+number || 0).toFixed(places), 10) + "",
j = (j = i.length) > 3 ? j % 3 : 0;
return negative + (j ? i.substr(0, j) + thousand : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" +
thousand) + (places ? '' : "");
},
/**
* 字符串截取
*/
/**
* 截取字符串
*/
subStrByLength: function (str, length) {
var retStr = str;
var len = 3;
if (retStr) {
if (length) {
len = length;
};
if (str.length > len) {
retStr = str.substring(0, len) + '...';
}
};
return retStr;
}
};
export const exportExcel = common.exportExcel;
export const subStrByLength = common.subStrByLength;
export const formatMoney = common.formatMoney;
...@@ -2,6 +2,7 @@ import App from './index.vue' ...@@ -2,6 +2,7 @@ import App from './index.vue'
import base from '@/base' import base from '@/base'
import GlsxVueCommon from 'glsx-vue-common' import GlsxVueCommon from 'glsx-vue-common'
base.getConfig().then(data => { base.getConfig().then(data => {
console.log(data);
const { vue, config } = data const { vue, config } = data
vue.use(GlsxVueCommon, config) vue.use(GlsxVueCommon, config)
base.render(App) base.render(App)
......
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
> >
<span class="itemLeftContainer"> <span class="itemLeftContainer">
<el-form-item label="权益卡名称:"> <el-form-item label="权益卡名称:">
{{ cardsInformationForm.merchantName }} {{ cardsInformationForm.memberName }}
</el-form-item> </el-form-item>
</span> </span>
<span class="itemRightContainer"> <span class="itemRightContainer">
...@@ -440,6 +440,8 @@ function date_format(d) { ...@@ -440,6 +440,8 @@ function date_format(d) {
var D = date.getDate() + " "; var D = date.getDate() + " ";
return Y + M + D; return Y + M + D;
} }
import axios from 'axios'
import { exportExcel } from '@/common.js'
import { import {
generateMemberBatch, generateMemberBatch,
// getlistMemberInfo, // getlistMemberInfo,
...@@ -629,7 +631,7 @@ export default { ...@@ -629,7 +631,7 @@ export default {
prop: "status", prop: "status",
formatter: (cellValue) => { formatter: (cellValue) => {
return { return {
1: '激活', 1: '已激活',
0:'未激活' 0:'未激活'
}[cellValue.status]; }[cellValue.status];
}, },
...@@ -787,6 +789,7 @@ export default { ...@@ -787,6 +789,7 @@ export default {
batchId: "", batchId: "",
generateNumber: "", generateNumber: "",
activation: "", activation: "",
memberName:''
}, },
// 权益明细 // 权益明细
BatchDetailInformationForm: { BatchDetailInformationForm: {
...@@ -848,15 +851,79 @@ export default { ...@@ -848,15 +851,79 @@ export default {
}, },
methods: { methods: {
fetch(url,params){
return new Promise(resolve => {
const xhr = new XMLHttpRequest()
xhr.onreadystatechange = () => {
if (xhr.readyState === 4 && xhr.status === 200) {
console.log(xhr.responseText);
}
}
xhr.open('POST', url)
xhr.send(params)
})},
//领用界面导出 //领用界面导出
exportCollection(){ exportCollection(){
var params = { var params = {
beginTime: "" , beginTime: this.collectionListSearch.condition.beginTime ,
endTime: "" , endTime: this.collectionListSearch.condition.endTime ,
sn: "" , sn: this.collectionListSearch.condition.sn ,
mobile: "", mobile: this.collectionListSearch.condition.mobile,
defineCode: "" , defineCode: this.collectionListSearch.condition.defineCode,
}; };
const url = this.$get_session_common_config().axios.baseURL+'/memberInfo/exportMemberCard';
// axios({ method: 'post', url:this.$get_session_common_config().axios.baseURL+'/memberInfo/exportMemberCard', }) .then(res => {
// const data = res.data
// const url = window.URL.createObjectURL(new Blob([data], {type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}))
// const link = document.createElement('a')
// link.style.display = 'none'
// link.href = url
// link.setAttribute('download', 'excel.xlsx')
// document.body.appendChild(link)
// link.click()
// document.body.removeChild(link)
// })
// this.fetch(url,JSON.stringify(params))
// this.$http.post(url,params).then(res=>{
// console.log(res);
// })
// fetch(url, {
// method: 'POST', // or 'PUT'
// body: JSON.stringify(params), // data can be `string` or {object}!
// headers: new Headers({
// 'Content-Type': 'application/json'
// })
// }).then(res =>{
// })
// .catch(error => console.error('Error:', error))
// .then(res => {
// const aLink = document.createElement("a");
// let blob = new Blob([res], {type: "application/vnd.ms-excel"})
// aLink.href = URL.createObjectURL(blob)
// aLink.setAttribute('download', 'a' + '.xlsx') // 设置下载文件名称
// aLink.click()
// this.$refs.loadElement.appendChild(aLink)
// });
exportExcel({url,params})
// exportMemberCard(params).then((res) => {
// if (res) {
// console.log(res);
// const aLink = document.createElement("a");
// let blob = new Blob([res], {type: "application/x-excel"})
// aLink.href = URL.createObjectURL(blob)
// aLink.setAttribute('download', '领用列表导出文档' + '.xlsx') // 设置下载文件名称
// aLink.click()
// // document.body.appendChild(aLink)
// // this.$refs.batchDetailTable.refreshTable();
// } else {
// this.$message({
// message: "导出失败!",
// type: "error",
// });
// }
// })
}, },
//批次详情导出数据 //批次详情导出数据
// exportDetail() { // exportDetail() {
...@@ -1039,12 +1106,12 @@ var params = { ...@@ -1039,12 +1106,12 @@ var params = {
.InputContainer { .InputContainer {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
margin-left: -100px; margin-left: -130px;
} }
.lastInputContainer { .lastInputContainer {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
margin-left: 40px; margin-left: 10px;
} }
.firstpickerContainer { .firstpickerContainer {
margin-left: 20px; margin-left: 20px;
...@@ -1061,7 +1128,7 @@ var params = { ...@@ -1061,7 +1128,7 @@ var params = {
margin-left: 20px; margin-left: 20px;
} }
.buttonContainer { .buttonContainer {
margin-left: 100px; margin-left: 20px;
} }
.batchGeneration { .batchGeneration {
margin-left: 100px; margin-left: 100px;
......
...@@ -56,9 +56,9 @@ export default { ...@@ -56,9 +56,9 @@ export default {
}, },
{ {
label: '有效期', label: '有效期',
prop: 'validitDate', prop: 'validitDateStr',
formatter: (cellValue) => { formatter: (cellValue) => {
return this.date_format(cellValue.validitDate) return this.date_format(cellValue.validitDateStr)
} }
}, },
{ {
...@@ -81,7 +81,10 @@ export default { ...@@ -81,7 +81,10 @@ export default {
}, },
{ {
label: '创建时间', label: '创建时间',
prop: 'createdDateStr' prop: 'createdDateStr',
formatter: (cellValue) => {
return this.date_format(cellValue.createdDateStr)
}
// minWidth: '200' // minWidth: '200'
}, },
{ {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!