Commit 9a221604 by 乔延琦

Merge branch 'develop-zhouyi' into 'develop'

Develop zhouyi

See merge request GFP/RBC/rbc-frontend!62
parents 91e76a77 89f16eff
......@@ -163,9 +163,6 @@ export default {
document.addEventListener('keyup', this.onKeyUp)
this.getVerificationCode();
},
beforeUnmount() {
document.removeEventListener('keyup', this.onKeyUp)
},
methods: {
onKeyUp(event) {
if (event.keyCode == 13) {
......@@ -252,6 +249,8 @@ export default {
.then(res => {
this.loginLoading = false;
GMS.routerManager.afterLogin().then(() => {
document.removeEventListener('keyup', this.onKeyUp)
this.$router.push({
path: "/",
});
......
......@@ -20,7 +20,8 @@
"view-design": "^4.3.2",
"vue": "^2.6.11",
"vue-router": "^3.0.3",
"vuex": "^3.0.1"
"vuex": "^3.0.1",
"vxe-table": "^3.3.9"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
......@@ -17120,6 +17121,16 @@
"vue": "^2.0.0"
}
},
"node_modules/vxe-table": {
"version": "3.3.9",
"resolved": "http://nvwa.jiuqi.com.cn/nexus/repository/npm-gov-group/vxe-table/-/vxe-table-3.3.9.tgz",
"integrity": "sha512-Kbkt+zL/NShByWK+w0bmA9CTpnAwunC/Z1IHjkn3HFRGMmnm+CXE/zx+LJSPRVBwAoG8kjKrOM1QNdIkGTYGsQ==",
"license": "MIT",
"peerDependencies": {
"vue": "^2.6.0",
"xe-utils": "^3.2.0"
}
},
"node_modules/watchpack": {
"version": "1.7.5",
"resolved": "http://nvwa.jiuqi.com.cn/nexus/repository/npm-gov-group/watchpack/-/watchpack-1.7.5.tgz",
......@@ -18137,6 +18148,13 @@
"async-limiter": "~1.0.0"
}
},
"node_modules/xe-utils": {
"version": "3.5.4",
"resolved": "http://nvwa.jiuqi.com.cn/nexus/repository/npm-gov-group/xe-utils/-/xe-utils-3.5.4.tgz",
"integrity": "sha512-oH7VOgvHv34pn198dhKPVKnuEHV22Q06YpCTVnAS3JuutylmZj/rtJGvn0BxxWQ37w2LgCknoebLA4uIGXwFtw==",
"license": "MIT",
"peer": true
},
"node_modules/xtend": {
"version": "4.0.2",
"resolved": "http://nvwa.jiuqi.com.cn/nexus/repository/npm-gov-group/xtend/-/xtend-4.0.2.tgz",
......@@ -30930,6 +30948,12 @@
"integrity": "sha1-I2vAhqhww655lG8QfxbeWdWJXnE=",
"requires": {}
},
"vxe-table": {
"version": "3.3.9",
"resolved": "http://nvwa.jiuqi.com.cn/nexus/repository/npm-gov-group/vxe-table/-/vxe-table-3.3.9.tgz",
"integrity": "sha512-Kbkt+zL/NShByWK+w0bmA9CTpnAwunC/Z1IHjkn3HFRGMmnm+CXE/zx+LJSPRVBwAoG8kjKrOM1QNdIkGTYGsQ==",
"requires": {}
},
"watchpack": {
"version": "1.7.5",
"resolved": "http://nvwa.jiuqi.com.cn/nexus/repository/npm-gov-group/watchpack/-/watchpack-1.7.5.tgz",
......@@ -31689,6 +31713,12 @@
"async-limiter": "~1.0.0"
}
},
"xe-utils": {
"version": "3.5.4",
"resolved": "http://nvwa.jiuqi.com.cn/nexus/repository/npm-gov-group/xe-utils/-/xe-utils-3.5.4.tgz",
"integrity": "sha512-oH7VOgvHv34pn198dhKPVKnuEHV22Q06YpCTVnAS3JuutylmZj/rtJGvn0BxxWQ37w2LgCknoebLA4uIGXwFtw==",
"peer": true
},
"xtend": {
"version": "4.0.2",
"resolved": "http://nvwa.jiuqi.com.cn/nexus/repository/npm-gov-group/xtend/-/xtend-4.0.2.tgz",
......@@ -21,7 +21,8 @@
"view-design": "^4.3.2",
"vue": "^2.6.11",
"vue-router": "^3.0.3",
"vuex": "^3.0.1"
"vuex": "^3.0.1",
"vxe-table": "^3.3.9"
},
"files": [
"dist",
......
......@@ -79,7 +79,10 @@ export default {
watch: {
templateName() {
this.handleClear()
this.$refs.customQuery.initTemplate(this.templateName)
this.$refs
&& this.$refs.customQuery
&& this.$refs.customQuery.initTemplate
&& this.$refs.customQuery.initTemplate(this.templateName)
}
},
mounted() {
......@@ -166,7 +169,10 @@ export default {
}
}
this.seniorQuery = conditions
this.$refs.customQuery.initTemplate(this.templateName)
this.$refs
&& this.$refs.customQuery
&& this.$refs.customQuery.initTemplate
&& this.$refs.customQuery.initTemplate(this.templateName)
},
handleClear() {
this.queryFields = { timeRange: [] };
......
......@@ -26,23 +26,23 @@
<div class='tableContent'>
<!--查询表格内容区域-->
<table-content
v-if="tableVisible"
ref='tableContent'
@noShowColSet='noShowColSet'
:queryHandler="queryHandler"
:queryBus="queryBus"
:table='table'
:summerData="summerData"
:tableData='tableData'
:tableHeight='tableHeight'
:extraActionObject='extraActionObject'
:pager-config="pagerConfig"
:loading="loading"
@onSelectionChange="onSelectionChange"
@onSelectAll="onSelectAll"
@onCurrentChange="onCurrentChange"
@on-refresh="refreshData"
:tableHeight='tableHeight'
:extraActionObject='extraActionObject'
@noShowColSet='noShowColSet'
@on-page-change="onPageChange"
/>
<div v-if="!tableVisible" :style="spinStyle">
<Spin fix></Spin>
</div>
<!--无数据内容展示-->
<no-data-can-build
v-if='isShowBuildData'
......@@ -51,22 +51,6 @@
/>
</div>
<div class="height5"></div>
<div class="pageContent" v-if="!(pageSet && pageSet.isShowPage == false)">
<!--分页区域-->
<Page
ref="pageContent"
class='pagePosition'
:total="totalCount"
:current='currentPage'
show-total
show-elevator
show-sizer
:page-size='pageSize'
:page-size-opts='pageSizeOpts'
@on-change="onPageNumChange"
@on-page-size-change="onPageSizeChange"
/>
</div>
</template>
</div>
</template>
......
import tableViewChange from './table-view-change.vue'
export default tableViewChange
<template>
<div class="simpleTableContentBody">
<Table :columns='columnsData' :data='tableData'></Table>
</div>
</template>
<script>
export default {
name: "simpleTableContent",
data() {
return {
columnsData:[
{
type: 'selection',
width: 60,
align: 'center'
},
{
type: 'index',
width: 60,
align: 'center'
},
{
title: 'Name',
key: 'name',
width:100
},
{
title: 'Age',
key: 'age',
width:100
},
{
title: 'Address',
key: 'address',
width:200
}
],
tableData:[
{
name: 'John Brown',
age: 18,
address: 'New York No. 1 Lake Park',
job: 'Data engineer',
interest: 'badminton',
birthday: '1991-05-14',
book: 'Steve Jobs',
movie: 'The Prestige',
music: 'I Cry'
},
{
name: 'Jim Green',
age: 25,
address: 'London No. 1 Lake Park',
job: 'Data Scientist',
interest: 'volleyball',
birthday: '1989-03-18',
book: 'My Struggle',
movie: 'Roman Holiday',
music: 'My Heart Will Go On'
},
{
name: 'Joe Black',
age: 30,
address: 'Sydney No. 1 Lake Park',
job: 'Data Product Manager',
interest: 'tennis',
birthday: '1992-01-31',
book: 'Win',
movie: 'Jobs',
music: 'Don’t Cry'
},
{
name: 'Jon Snow',
age: 26,
address: 'Ottawa No. 2 Lake Park',
job: 'Data Analyst',
interest: 'snooker',
birthday: '1988-7-25',
book: 'A Dream in Red Mansions',
movie: 'A Chinese Ghost Story',
music: 'actor'
}
]
};
},
props: {
},
watch: {
},
methods: {
},
created() {
},
updated(){
},
mounted() {
}
};
</script>
<style lang="less" scoped>
</style>
<template>
<!--关于操作列之后应该做的控制为:超过三个的情况下,第三个变成更多,通过下拉选择来进行触发,这时候需要考虑关于按钮隐藏的情况-->
<div class="actions-column">
<div class="action" v-for="(action, index) in actionList" :key="index">
<Button
......@@ -124,14 +125,6 @@ export default {
formulaCache = "",
dynamicNodeFactory = "",
expression;
var AbstractData = function(value, dataType, isNull,formData,fieldKey) {
this.Value = value;
this.dataType = dataType;
this.isNull = isNull;
this.formData = formData;
this.fieldKey = fieldKey;
}
var QueryKeyNode = function (key) {
this.assignData = function () {};
this.getResult = function () {
......@@ -181,15 +174,14 @@ export default {
tabName: this.queryBus.currGroup.name
};
for (let i = 0, len = actions.length; i < len; i++) {
let val = JSON.parse(JSON.stringify(param));
val["actionParam"] = actions[i].param;
val._key = actions[i].name;
param["actionParam"] = actions[i].param;
param._key = actions[i].name;
result.push(
queryUtil.actionDisplay(
this,
null,
actions[i].visible.function,
val,
param,
null,
currentNameObject
)
......@@ -206,14 +198,13 @@ export default {
let result = [];
for (let i = 0, len = actions.length; i < len; i++) {
if (!actions[i].hasOwnProperty("enable")) {
let val = JSON.parse(JSON.stringify(param));
val._key = actions[i].name;
param._key = actions[i].name;
result.push(
queryUtil.actionEnable(
this,
null,
actions[i].disabled.function,
val
param
)
);
}
......
import CustomQueryTableAction from "../../table-view/table-action-column.vue";
export default {
renderDefault(h, renderOpts, params) {
let {row, column, rowIndex} = params,
props = column.cellRender.props,
colItem = props.colItem,
context = props.context,
extraActionObject = props.extraActionObject,
queryBus = props.queryBus;
if (!params.row.isCountRow) {
return [
h(CustomQueryTableAction, {
props: {
params: params,
colItem: colItem,
context: context,
extraActionObject: extraActionObject,
queryBus: queryBus
},
on: {}
})
];
}
}
}
\ No newline at end of file
var stepData = null;
//获取审批流程数据
const getApprovalStep = (billId, billdefine, progressFlag, objectid) => {
var path = "";
if (progressFlag && progressFlag == "ScrapProgress") {
if (!objectid) {
this.$Message.warning("未获取到卡片ObjectId");
return;
}
path = "/business/scrap/getScrapProgress/" + objectid;
} else {
if (!billId) {
this.$Message.warning("未获取到业务id");
return;
}
path = "/business/bill/getApprovaStep/" + billId;
if (billdefine) {
if (billdefine == "com.jiuqi.np.gams2.business.bill.ReimburseBillDefine") {
path = "/business/bill/getApprovaStep4Reimburse/" + billId;
}
}
}
GAMS.Util.invokeServer({
path: path,
type: "GET",
contentType: "application/json",
}).then((data, textStatus, response) => {
if (data.code == 0) {
if (data.content) {
this.stepData = data.content;
}
}
}).catch((XMLHttpRequest, textStatus, errorThrown) => {
// this.$Message.error("未获取到流程信息");
});
};
export default {
renderDefault(h, renderOpts, params) {
let {row, column} = params,
colItem = column.cellRender.props.colItem;
colItem.key = column.property;
let styles = colItem.style; //查询列中的style属性配置关于default与item数组中元素的type都为class名称
if (styles) {
let stylesArr = styles.item;
let styleValue = null;
let param = params.row[colItem.key];
if (styles.default) {
return [
h(
"span", {
class: styles.default
},
params.row[colItem.key]
)
];
} else {
for (let i = 0; i < stylesArr.length; i++) {
if (stylesArr[i].enumValue == param) {
styleValue = stylesArr[i].type;
break;
}
}
}
if (styleValue) {
return [
h(
"span", {
class: styleValue,
attrs: {
style: "vertical-align: middle;"
}
},
params.row[colItem.key]
),
h(
"Poptip", {
attrs: {
placement: "right-start"
}
},
[
h(
"svg", {
attrs: {
"aria-hidden": "true",
style: "margin-left:5px;vertical-align: middle;cursor: pointer;"
},
style: {
width: "14px",
height: "14px"
},
on: {
click: () => {
//每次进来先清空
stepData = null;
let billid = params.row.billid,
billDefine = params.row.billDefine,
objectid = params.row.objectid,
progressFlag = params.row.progressFlag;
getApprovalStep(billid, billDefine, progressFlag, objectid);
}
}
},
[
h("use", {
attrs: {
"xlink:href": "#icon-_banliliucheng"
}
})
],
""
),
h(
"div", {
slot: "content"
},
[
h("zStepsVertical", {
attrs: {},
props: {
stepData: stepData
}
})
]
)
]
)
];
}
}
}
}
\ No newline at end of file
import BillType from '../../billType.vue';
export default {
renderDefault(h, renderOpts, params) {
let {row, column} = params,
colItem = column.cellRender.props.colItem;
colItem.key = column.property;
return [
h(
"div", {
attrs: {
style: "cursor: pointer;"
}
},
[
h(
BillType, {
props: {
params: params.row,
config: colItem
}
},
[]
)
]
)
];
}
}
\ No newline at end of file
const getTimeStr = (val) => {
var time = new Date(val);
var year = time.getFullYear();
var month = time.getMonth() + 1;
var day = time.getDate();
var timeStr = year + "-" + (month > 9 ? month : "0" + month) + "-" + (day > 9 ? day : "0" + day);
return timeStr;
}
export default {
renderDefault(h, renderOpts, params) {
let {row, column} = params,
colItem = column.cellRender.props.colItem;
colItem.key = column.property;
return [
h(
"div", {
class: "haveDoubleTimeContent"
},
[
h(
"div", {
class: "topTime"
},
[
h(
"span", {
style: "font-size:12px;color:#4C79E1;font-family:MicrosoftYaHei;"
},
["申请"]
),
h(
"span", {
style: "font-size:12px;color:#666;font-family:MicrosoftYaHei;"
},
[
" : " + getTimeStr(params.row[colItem.key])
]
)
]
),
h(
"div", {
class: "bottomTime"
},
[
h(
"span", {
style: "font-size:12px;color:#56BA3E;font-family:MicrosoftYaHei;"
},
["已达"]
),
h(
"span", {
style: "font-size:12px;color:#666;font-family:MicrosoftYaHei;"
},
[
" : " + getTimeStr(params.row[colItem.queryFields])
]
)
]
)
]
)
];
}
}
\ No newline at end of file
export default {
renderDefault(h, renderOpts, params) {
let {row, column} = params,
colItem = column.cellRender.props.colItem,
{events} = renderOpts,
host = window.location.host,
rootUrl = this.rootUrl;
colItem.key = column.property;
let visibleUrl = "http://" + host + rootUrl + "/business/qrcode/downloadFirstByBillid/" + params.row[colItem.key];
if (!params.row.isCountRow) {
return [
h(
"div", {
attrs: {
class: "allBox"
}
},
[
h("img", {
attrs: {
src: "http://" + host + rootUrl + "/business/qrcode/downloadByid/" + params.row[colItem.key],
style: "width:40px;height:40px;display:inline-block;vertical-align: middle;",
onerror: "javascript:this.src='../../../assets/image/tjtp.png';" //@king
}
}),
h(
"div", {
attrs: {
class: "shadowColor"
}
},
[
h(
"svg", {
attrs: {
style: "margin-left: 33%;margin-top: 33%;cursor: pointer;"
},
style: {
width: "14px",
height: "14px"
},
on: {
click: () => events.click(visibleUrl)
}
},
[
h("use", {
attrs: {
"xlink:href": "#icon-_yulan"
}
})
],
""
)
]
)
]
)
];
}
}
}
\ No newline at end of file
export default {
renderDefault(h, renderOpts, params) {
let {row, column} = params,
colItem = column.cellRender.props.colItem;
colItem.key = column.property;
return [
h("div", {}, [
h("img", {
attrs: {
src: params.row.assetPic,
style: "width:40px;display:inline-block;vertical-align: middle;"
}
}),
h(
"div", {
attrs: {
style: "display:inline-block;vertical-align: middle;"
}
},
params.row[colItem.key]
)
])
];
}
}
\ No newline at end of file
export default {
renderDefault(h, renderOpts, params) {
let {row, column} = params,
colItem = column.cellRender.props.colItem,
{events} = renderOpts,
host = window.location.host,
rootUrl = this.rootUrl;
colItem.key = column.property;
let visibleUrl = "http://" + host + rootUrl + "/business/qrcode/downloadFirstByBillid/" + params.row[colItem.key];
if (!params.row.isCountRow) {
return [
h(
"div", {
attrs: {
class: "allBox"
}
},
[
h("img", {
attrs: {
src: "http://" + host + rootUrl + "/business/qrcode/downloadFirstByBillid/" + params.row[colItem.key],
style: "width:40px;height:40px;display:inline-block;vertical-align: middle;",
onerror: "javascript:this.src='../../../assets/image/tjtp.png';" //@king
}
}),
h(
"div", {
attrs: {
class: "shadowColor"
}
},
[
h(
"svg", {
attrs: {
style: "margin-left: 33%;margin-top: 33%;cursor: pointer;"
},
style: {
width: "14px",
height: "14px"
},
on: {
click: () => events.click(visibleUrl)
}
},
[
h("use", {
attrs: {
"xlink:href": "#icon-_yulan"
}
})
],
""
)
]
)
]
)
];
}
}
}
\ No newline at end of file
import ACTION from './action.js'
import APPROVAL from './approval.js'
import BILLTYPE from './bill-type.js'
import COMPARETIME from './compare-time.js'
import HYPERLINK from './hyperlink.js'
import IMG_SRC from './img-src.js'
import IMG_TXT from './img-txt.js'
import IMG from './img.js'
import MERGE from './merge.js'
import OBJECT from './object.js'
import PASSTATUS from './passtatus.js'
import SEGMENTPROGRESS from './segment-progress.js'
import Seq from './seq.js'
import TEXTWITHTAG from './text-with-tag.js'
import TIMEDIFF from './time-diff.js'
import VALUE from './value.js'
export default {
ACTION,
APPROVAL,
BILLTYPE,
COMPARETIME,
HYPERLINK,
IMG_SRC,
IMG_TXT,
IMG,
MERGE,
OBJECT,
PASSTATUS,
SEGMENTPROGRESS,
Seq,
TEXTWITHTAG,
TIMEDIFF,
VALUE
}
\ No newline at end of file
const formatYearMonth = (val) => {
if (Number(val) < 12) {
return val + "个月";
} else if (Number(val) == 12) {
return "1年";
} else {
if (Number(val) % 12 == 0) {
return Number(val) / 12 + "年";
} else {
return parseInt(Number(val) / 12) + "年" + (Number(val) % 12) + "个月";
}
}
};
export default {
renderDefault(h, renderOpts, params) {
let {row, column} = params,
colItem = column.cellRender.props.colItem;
colItem.key = column.property;
//财务入账日期存在,计算已使用年限
if (params.row.qudrq) {
// zjy实现改变逻辑
var timestamp = new Date(params.row.qudrq);
var currentTime = new Date();
let qudrqYear = timestamp.getFullYear(),
qudrqMonth = timestamp.getMonth(),
qudrqDate = timestamp.getDate();
let currentYear = currentTime.getFullYear(),
currentMonth = currentTime.getMonth(),
currentDate = currentTime.getDate();
var year = 0,
month = 0;
if (currentYear - qudrqYear > 0) {
year = currentYear - qudrqYear;
}
if (currentMonth - qudrqMonth > 0) {
month = currentMonth - qudrqMonth;
} else if (currentMonth - qudrqMonth < 0) {
month = 12 + currentMonth - qudrqMonth;
year = year - 1;
}
if (month == 12) {
month = 0;
year = year + 1;
}
if (currentDate - qudrqDate > 0) {
month += 1;
}
var totalMonth = year * 12 + month;
}
let showYearMonth = year + "年" + month + "个月"
if (month >= 12) {
year = year + parseInt(month / 12)
month = month % 12
}
if (year == 0 && month > 0 && month < 12) {
showYearMonth = month + "个月"
} else if (year > 0 && month == 0) {
showYearMonth = year + "年"
}
if ((params.row.zhejzt && params.row.zhejzt == "不提折旧") || !params.row[colItem.key]) {
//折旧状态为空或者不提折旧,只显示已使用年限
return [
h("div", {}, [
h(
"div", {
attrs: {
style: "margin-bottom:3px"
}
},
[
h(
"span", {
attrs: {
style: "font-size:12px;color:#555555;"
},
},
params.row.qudrq ? showYearMonth : ""
),
]
)
])
];
} else {
//提折旧则显示已使用年限和折旧年限
//财务已入账则显示已使用年限和折旧年限
if (params.row.qudrq) {
return [
h("div", {}, [
h(
"div", {
attrs: {
style: "margin-bottom:3px"
}
},
[
h(
"span", {
attrs: {
// style: "font-size:12px;color:#555555;",
style: params.row[colItem.key] && totalMonth > params.row[colItem.key] ? "color:#ED664B" : ""
},
},
showYearMonth
)
]
),
h(
"div", {
attrs: {
style: "font-size:12px;color:#888888"
},
},
params.row[colItem.key] ? "年限:" + formatYearMonth(params.row[colItem.key]) : ""
)
])
];
} else {
//财务未入账的,只显示折旧年限
return [
h("div", {}, [
h(
"div", {
attrs: {
style: "margin-bottom:3px"
}
},
[
h(
"span", {
attrs: {
style: "font-size:12px;color:#555555;",
}
},
params.row[colItem.key] ? "年限:" + formatYearMonth(params.row[colItem.key]) : ""
)
]
)
])
];
}
}
}
}
\ No newline at end of file
export default {
renderDefault(h, renderOpts, params) {
let {row, column} = params,
colItem = column.cellRender.props.colItem;
colItem.key = column.property;
if (params.row[colItem.key] && ["title", "name"].includes(colItem.field)) {
return [
h("div", {}, params.row[colItem.key][colItem.field])
]
}
}
}
\ No newline at end of file
export default {
renderDefault(h, renderOpts, params) {
let {row, column} = params,
colItem = column.cellRender.props.colItem,
props = column.cellRender.props,
contextData = props.contextData;
colItem.key = column.property;
return [
h(
"div", {
attrs: {
style: "height:48px;line-height:44px"
}
},
[
!params.row.isCountRow ?
h("zApprovalButtonTab", {
props: {
contextData: contextData,
rowData: params.row,
indexs: params.index,
state: params.row.state,
},
}) :
""
]
)
]
}
}
\ No newline at end of file
import SegmentProgress from "../../segment-progress.vue";
const returnSegmentProgressData = (queryFields, params) => {
let segmentProgressDataKey = ["left", "middle", "right"];
let segmentProgressData = {};
for (let i = 0; i < queryFields.length; i++) {
let item = queryFields[i];
segmentProgressData[segmentProgressDataKey[i]] = params.row[item];
}
return segmentProgressData;
}
export default {
renderDefault(h, renderOpts, params) {
let {row, column} = params,
colItem = column.cellRender.props.colItem;
colItem.key = column.property;
return [
h(
SegmentProgress, {
props: {
segmentProgressData: returnSegmentProgressData(colItem.queryFields, params)
}
},
[]
)
];
}
}
\ No newline at end of file
export default {
renderDefault(h, renderOpts, params) {
let {row, column, rowIndex} = params,
startIndex = column.cellRender.props.startIndex;
params.row._serialIndex = startIndex + params.rowIndex + 1;
return [
h("span", {}, [
h(
"strong", {
attrs: {
style: params.row.isCountRow ? "font-weight:bold;" : ""
}
},
params.row.isCountRow ? "合计" : startIndex + params.rowIndex + 1
)
])
];
}
}
\ No newline at end of file
const defaultEnumArr = [{
enumValue: "贵重",
type: "textWhiteBgB48E6C"
},
{
enumValue: "贵重",
type: "textWhiteBgFF8286"
}
];
const returnTagRender = (h, params, styleItem = defaultEnumArr) => {
var renderTagArr = [];
for (let i = 0; i < styleItem.length; i++) {
let item = styleItem[i];
if (params.row[item.queryFields]) {
renderTagArr.push(
h(
"span", {
stype: "margin-right:10px",
class: "val_" + item.type
},
[item.enumValue]
)
);
}
}
return renderTagArr;
}
export default {
renderDefault(h, renderOpts, params) {
let { row, column } = params,
colItem = column.cellRender.props.colItem;
colItem.key = column.property;
return [
h(
"div", {
class: "textWithTagContainer"
},
[
h(
"div", {
style: "font-size:12px;font-family:MicrosoftYaHei;color:#666"
},
[params.row[colItem.key] || "默认文本"]
),
h(
"div", {
class: "tagPart"
},
returnTagRender(h, params, colItem.style && colItem.style.items)
)
]
)
];
}
}
\ No newline at end of file
const getTimeDifference = (begin, end) => {
let timeDifferenceStr = Math.ceil((new Date(end).getTime() - new Date(begin).getTime()) / (1000 * 60 * 60 * 24)) + "天";
return timeDifferenceStr;
}
const getTimeStr = (val) => {
var time = new Date(val);
var year = time.getFullYear();
var month = time.getMonth() + 1;
var day = time.getDate();
var timeStr = year + "-" + (month > 9 ? month : "0" + month) + "-" + (day > 9 ? day : "0" + day);
return timeStr;
}
export default {
renderDefault(h, renderOpts, params) {
let {row, column} = params,
colItem = column.cellRender.props.colItem,
beginTimeKey = colItem.config.beginTimeKey,
endTimeKey = colItem.config.endTimeKey,
timeDifference = getTimeDifference(params.row[beginTimeKey], endTimeKey && params.row[endTimeKey] ? params.row[endTimeKey] : Date.now());
colItem.key = column.property;
return [
h("div", {}, [
h(
"div", {
attrs: {
style: "display:inline-block;margin:0 3px 3px 0;font-size:12px;"
}
},
getTimeStr(params.row[beginTimeKey])
),
h(
"div", {
attrs: {
style: "display:inline-block;padding:0px 5px;color:#ED664B;border:1px solid #ED664B;font-size:12px; border-radius:4px;"
}
},
timeDifference
)
])
];
}
}
\ No newline at end of file
import CustomPoptip from "../../../custom-poptip/components/custom-poptip.vue";
import NumUtils from "../../../../utils/NumUtils";
import queryUtil from "../../queryUtil";
//获取合计数值
const getCount = (params, name) => {
let count = 0;
if (params.row.isCountRow) {
for (var i = 0, len = params.data.length; i < len; i++) {
count += params.data[i][name] ? parseFloat(replaceNum(params.data[i][name])) : 0;
}
} else {
return params.row[name];
}
return NumUtils.splitThousand(count, 2);
}
const replaceNum = (num) => {
let str = String(num).replace(/,/g, "");
return Number(str);
}
//判断列对象是否为日期或数值类型
const valueColumnUseRender = (colItem) => {
let format = colItem.format
if (format && ["DATE", "NUMBER", "date", "number"].includes(format.type)) {
return true
}
return false;
}
//日期或数值类型转换
const getParamValue = (params, colItem) => {
let value = params.row[colItem.key],
format = colItem.format;
if (format && ["DATE", "date"].includes(format.type)) {
return queryUtil.dateTimeFormat(value, format.config);
} else if (format && ["NUMBER", "number"].includes(format.type)) {
return isNaN(value) ? value : queryUtil.numberFormat(value, format.config);
} else {
return value;
}
}
export default {
renderDefault(h, renderOpts, params) {
let {row, column} = params,
colItem = column.cellRender.props.colItem,
_this = column.cellRender.props.this,
businessPoptipContent = column.cellRender.props.businessPoptipContent,
obj = params.row,
_obj = obj.bizdes ? obj.bizdes : obj.biztype;
//根据判断列对象类型为日期或数值类型进行相对应的render渲染
if (valueColumnUseRender(colItem)) {
let value = getParamValue(params, colItem);
// 增加其它需要render处理逻辑
return [h("div", value)];
}
//判断是否具有相关样式配置
let styles = colItem.style;
if (styles) {
let stylesArr = styles.item,
styleValue = null,
param = params.row[colItem.key];
for (let i = 0; i < stylesArr.length; i++) {
if (stylesArr[i].enumValue == param) {
styleValue = stylesArr[i].type;
break;
}
}
if (!styleValue && styles.default) {
styleValue = styles.default;
}
if (param || param ===0) {
if (typeof styleValue != "undefined" && null != styleValue) {
if (styleValue.substring(0, 3) == "val") {
return [
h(
"span", {
class: styleValue
},
row[column.property]
)
];
} else if (styleValue.substring(0, 3) == "img") {
return [
h(
"svg", {
attrs: {
"aria-hidden": "true",
style: "vertical-align: middle;"
},
style: {
width: "40px",
height: "40px"
}
},
[
h("use", {
attrs: {
"xlink:href": row[column.property] == "通过" ? "#icon-_tongguo" : "#icon-_bohui"
}
})
],
""
)
];
}
}
}
}
//判断此列是否求和
if (colItem.isSum == true) {
return [
h("div", {}, [
params.row.isCountRow ?
h(
"strong", {
attrs: {
style: params.row.isCountRow ? "font-weight:bold;" : "",
style: "color: #ed664b;"
}
},
getCount(params, colItem.key)
) :
h(
"span", {
style: "color: #ed664b;"
},
row[column.property]
)
])
];
}
/**
* isLock是否锁定,这个是默认查询锁定表
* customIsLock自定义的时候锁定,有的时候可能根据业务需求需要锁定这个数据,哪怕是锁定表没锁它
*/
if (Object.prototype.hasOwnProperty.call(obj, "isLock") == true && obj.isLock == true) {
if (params.row.cardobjectid) {
return [
h("div", {}, [
h(
CustomPoptip, {
props: {
placement: "right",
trigger: "hover",
transfer: true,
rowData: params.row,
opotipCompontent: "businessPoptip",
context: _this,
contents: "正在进行" + _obj + " 业务",
businessPoptipContent: businessPoptipContent
},
// this.popperShow() 为空
// on: {
// "on-popper-show": this.popperShow
// }
},
row[column.property]
)
])
];
} else {
return [
h("div", {}, [
h(
"Tooltip", {
props: {
placement: "right",
content: "正在进行" + _obj + " 业务",
transfer: true
}
},
// params.row[colItem.key]
row[column.property]
)
])
];
}
} else if (Object.prototype.hasOwnProperty.call(obj, "customIsLock") == true && obj.customIsLock == true) {
return [
h("div", {}, [
h(
"Tooltip", {
props: {
placement: "right",
content: obj.customLockMessage,
transfer: true
}
},
row[column.property]
)
])
];
} else {
// params.column.tooltip
if (colItem.tooltip && row[column.property]) {
return [
h("div", {}, [
h(
"Tooltip", {
attrs: {
class: "line1"
},
style: {
width: Number(colItem.width) - 20 + "px"
},
props: {
maxWidth: "200",
placement: "bottom-start",
content: params.row[colItem.key],
transfer: true
}
},
row[column.property]
)
])
];
} else if (colItem.numberType == 1) {
return [
h("div", {}, [
NumUtils.splitThousand(row[column.property] ? row[column.property] : 0, 2)
])
];
} else {
//renderPadding属性是针对左内边距的填充宽度
if (colItem.renderPadding) {
let paddingLeft = params.row[colItem.renderPadding];
return [
h(
"div", {
style: {
paddingLeft: paddingLeft + "px"
}
},
[row[column.property]]
)
];
} else {
return [
h("div", {}, [row[column.property]])
];
}
}
};
}
}
\ No newline at end of file
<template>
<div>
<vxe-grid
:data="tableData"
ref="xTable"
border
:highlight-current-row="highlightRow"
:columns="columns"
:row-class-name="rowClassName"
:height="height"
:pager-config="pagerConfig"
:loading="loading"
@current-change="onCurrentChange"
@checkbox-change="onSelectionChange"
@checkbox-all="onSelectAll"
@sort-change="onSortChange"
@page-change="pageChange"
@cell-click="onCellClick"
@cell-dblclick="onCellDblclick"
>
<template #empty>
<span>{{ noDataText }}</span>
</template>
</vxe-grid>
</div>
</template>
<script>
export default {
name: 'VxeTableView',
data() {
return {};
},
props: {
tableData: {
type: Array,
require: false,
default() {
return [];
}
},
columns: {
type: Array
},
rowClassName: {
type: Function,
default() {
return "";
}
},
height: {
type: [Number, String]
},
highlightRow: {
type: Boolean
},
noDataText: {
type: String,
default: ""
},
pagerConfig: {
type: Object,
default: function() {
return {
layouts: ['Total', 'PrevJump', 'PrevPage', 'JumpNumber', 'NextPage', 'NextJump', 'Sizes', 'FullJump'],
currentPage: 1,
pageSize: 10,
total: 0,
pagerCount: 7,
pageSizes: [10, 20, 50, 100, 200],
enabled: true //是否启用
}
}
},
loading: {
type: Boolean,
default: false
}
},
methods: {
//当排序条件发生变化时触发该事件
onSortChange({column, property, order, sortBy, sortList, $event}) {
this.$emit("on-sort-change", column);
},
//只对 type=checkbox 有效,当手动勾选全选时触发的事件
onSelectAll({ records, reserves, indeterminates, checked, $event }) {
if (records.length > 0) {
this.$emit("on-select-all", records);
} else {
this.$emit("on-select-all-cancel", records, this.tableData);
}
},
//只对 highlightCurrentRow 有效,当手动选中行并且值发生改变时触发的事件
onCurrentChange({newValue, oldValue, row, rowIndex, $rowIndex, column, columnIndex, $columnIndex, $event}) {
this.$emit("on-current-change", newValue, oldValue);
},
//只对 type=checkbox 有效,当手动勾选并且值发生改变时触发的事件
onSelectionChange({records, reserves, indeterminates, checked, row, rowIndex, $rowIndex, column, columnIndex, $columnIndex, $event}) {
this.$emit("on-selection-change", records);
if (row.checked) {
this.$emit("on-select", records, row);
} else {
this.$emit("on-select-cancel", records, row);
}
},
//页签进行切换时触发执行
pageChange({type, currentPage, pageSize, $event}) {
this.$emit("on-page-change", currentPage, pageSize);
},
//单元格被点击时会触发该事件
onCellClick({row, rowIndex, $rowIndex, column, columnIndex, $columnIndex, triggerRadio, triggerCheckbox, triggerTreeNode, triggerExpandNode, $event}) {
this.$emit("on-row-click", row, rowIndex)
},
//单元格被双击时会触发该事件
onCellDblclick({row, rowIndex, $rowIndex, column, columnIndex, $columnIndex, $event}) {
this.$emit("on-row-dblclick", row, rowIndex)
}
}
};
</script>
<style lang="less" scoped>
/deep/ .vxe-table--render-default {
.vxe-body--column:not(.col--ellipsis) {
padding: 5px 0;
}
.vxe-cell {
font-size: 14px;
font-family: "Microsoft YaHei","微软雅黑","PingFang SC","Helvetica Neue",Helvetica,"Hiragino Sans GB",sans-serif,Arial;
}
.vxe-cell--checkbox:hover {
border-color: #3477cb;
}
.is--checked {
color: #3477cb;
.vxe-checkbox--icon:before {
border-color: #3477cb;
background-color: #3477cb;
}
}
.is--indeterminate {
color: #3477cb;
.vxe-checkbox--icon:before {
border-color: #3477cb;
background-color: #3477cb;
}
}
}
/deep/ .vxe-grid--pager-wrapper {
.is--background {
.vxe-pager--num-btn:not(.is--disabled).is--active {
background-color: #3477cb;
}
}
}
.rowperson {
display: inline-block;
cursor: pointer;
}
.permodal {
position: absolute;
width: 300px;
height: 210px;
background-color: red;
}
.poptip {
display: flex;
flex-flow: column;
}
</style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment