vue-ant-patterns
Version:
vue-ant-patterns
274 lines (249 loc) • 7.91 kB
JavaScript
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _vueTypes = require('ant-design-vue/lib/_util/vue-types');
var _vueTypes2 = _interopRequireDefault(_vueTypes);
var _dContainer = require('../../lib/d-container');
var _dContainer2 = _interopRequireDefault(_dContainer);
var _vue = require('vue');
var _vue2 = _interopRequireDefault(_vue);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _vuescrollNative = require('vuescroll/dist/vuescroll-native');
var _vuescrollNative2 = _interopRequireDefault(_vuescrollNative);
require('vuescroll/dist/vuescroll.css');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var API_PLATFORM = (global || window).globalJSConfig.SERVICE_CONFIG.API_PLATFORM;
var Vertical = _dContainer2['default'].Vertical,
Horizontal = _dContainer2['default'].Horizontal;
// 导入css文件
var getBlobUrl = API_PLATFORM + 'storageController/file/'; // 获取接口
_vue2['default'].component('vue-scroll', _vuescrollNative2['default']);
exports['default'] = {
name: 'fullRecognition',
props: {
recognitionInfo: _vueTypes2['default'].Object,
option: _vueTypes2['default'].any,
localMsg: _vueTypes2['default'].Object,
tagsList: _vueTypes2['default'].Object,
hideIntegrityAndTags: _vueTypes2['default'].bool,
collapsible: _vueTypes2['default'].bool,
showIntegrity: _vueTypes2['default'].bool.def(true)
},
data: function data() {
return {
personData: this.recognitionInfo
};
},
mounted: function mounted() {
// console.log(this.recognitionInfo);
},
watch: {
recognitionInfo: {
handler: function handler(val) {
this.personData = val;
},
deep: true
}
},
methods: {
desMenuClick: function desMenuClick(e) {
// console.log(e);
switch (e.key) {
case 1:
// 职位说明书
break;
case 2:
// 职务说明书
break;
}
},
editAction: function editAction() {
this.$emit('editAction');
},
collapseBtn: function collapseBtn() {
// this.type === 'mini';
this.$emit('changeType', 'mini');
},
// 渲染标签列表
renderTagsList: function renderTagsList() {
var h = this.$createElement;
var tagsList = this.$props.tagsList;
return tagsList.map(function (item, index) {
return h(
'a-tag',
{ 'class': 'emp-tags margin-bottom-xs' },
[item]
);
});
}
},
render: function render() {
var _this = this,
_cx;
var h = arguments[0];
var $props = this.$props,
personData = this.personData;
var option = $props.option,
localMsg = $props.localMsg,
hideIntegrityAndTags = $props.hideIntegrityAndTags,
collapsible = $props.collapsible,
showIntegrity = $props.showIntegrity;
var progressProps = {
props: {
width: 100,
strokeWidth: 8,
showInfo: false,
percent: personData.integrity === null ? 0 : parseInt(personData.integrity)
}
};
// 折叠
var btnProps = {
'class': 'full-collapse-btn',
on: {
click: function click() {
_this.collapseBtn();
}
}
};
// 自定义滚动条
var vuescrollProps = {
props: {
ops: {
bar: {
hoverStyle: true,
onlyShowBarOnScroll: false, // 是否只有滚动的时候才显示滚动条
background: '#fff' // 滚动条颜色
}
}
}
};
// 右侧操作
var operationsProps = {
'class': (0, _classnames2['default'])((_cx = {}, (0, _defineProperty3['default'])(_cx, 'flex-end-center', true), (0, _defineProperty3['default'])(_cx, 'recognition-operations', true), (0, _defineProperty3['default'])(_cx, 'showMiddlePart', !hideIntegrityAndTags), _cx))
};
return h(
'div',
{ 'class': 'fullRecognition' },
[h(
'a-row',
{
attrs: { type: 'flex' }
},
[h('a-col', [h(Horizontal, [h('d-container-v', [h('d-avatar', {
attrs: {
size: 80,
icon: 'user',
src: personData.photo ? '' + getBlobUrl + personData.photo : ''
},
'class': 'avatar-self'
}), h(
'd-container-h',
{
attrs: { justify: 'center' },
'class': 'margin-top-md' },
[h(
'a-tooltip',
{
attrs: { placement: 'bottom' },
'class': 'margin-right-md' },
[h(
'template',
{ slot: 'title' },
[personData.mobileTel ? personData.mobileTel : '暂无信息']
), h(
'd-icon-button',
{ 'class': 'radiconbtn' },
[h('a-icon', { 'class': 'operation-btn', attrs: { type: 'phone' }
})]
)]
), h(
'a-tooltip',
{
attrs: { placement: 'bottom' }
},
[h(
'template',
{ slot: 'title' },
[personData.businessEmail ? personData.businessEmail : '暂无信息']
), h(
'd-icon-button',
{ 'class': 'radiconbtn' },
[h('a-icon', { 'class': 'operation-btn', attrs: { type: 'mail' }
})]
)]
)]
)]), h(
'div',
{ 'class': 'demarginleft' },
[h(
'd-container-v',
{
attrs: { justify: 'between' },
'class': 'pinfo' },
[h('div', [h(
'span',
{ 'class': 'pinfo-namespan' },
[personData.employeeName]
), h(
'span',
{ 'class': 'pinfo-sexspan' },
[personData.gender ? '[' + personData.gender.name + ']' : '']
)]), h(
'div',
{ 'class': 'pinfo-empcode' },
[personData.employeeCode]
), h('div', [h(
'a-tag',
{ 'class': 'pinfo-tagcs' },
[personData.employeeStatus ? personData.employeeStatus.name : '']
), h(
'a-tag',
{ 'class': 'pinfo-tagcs' },
[personData.activeStatus ? personData.activeStatus.name : '']
)]), h(
'div',
{ 'class': 'pinfo-comcode' },
[personData.positionName]
), h(
'div',
{ 'class': 'pinfo-comcode' },
[personData.deptName]
), h(
'div',
{ 'class': 'pinfo-comcode' },
[personData.companyName]
)]
)]
)])]), !hideIntegrityAndTags ? h('a-col', [h(
Vertical,
{ 'class': 'flex-start-center' },
[showIntegrity ? h(
'div',
{ 'class': 'progress-container' },
[h(
'div',
{ 'class': 'margin-bottom-xs text-color-65 f12' },
['资料完整度' + (personData.integrity ? parseInt(personData.integrity) + '%' : 0)]
), h('a-progress', progressProps)]
) : '', h(
'div',
{ 'class': 'tags-container' },
[h(
'vue-scroll',
vuescrollProps,
[this.renderTagsList()]
)]
)]
)]) : '', option ? h('a-col', [h(
'd-container-h',
operationsProps,
[option]
)]) : '']
), collapsible ? h('div', btnProps) : '']
);
}
};