UNPKG

vue-ant-patterns

Version:

vue-ant-patterns

196 lines (177 loc) 4.98 kB
import _extends from 'babel-runtime/helpers/extends'; import { Steps, Button, Icon, Upload, Switch, Progress, Select } from 'ant-design-vue'; import DContainer from '../../es/d-container'; import PropTypes from 'ant-design-vue/es/_util/vue-types'; import { request } from '../_biz-utils'; var Horizontal = DContainer.Horizontal; var Step = Steps.Step; var Option = Select.Option; // const API_URL = 'http://192.168.167.210:9090/platform/api'; import LocaleReceiver from 'ant-design-vue/es/locale-provider/LocaleReceiver'; import EN from './locale/en_US'; import CN from './locale/zh_CN'; import miniRecognition from './miniRecognition'; import fullRecognition from './fullRecognition'; var API_PLATFORM = (global || window).globalJSConfig.SERVICE_CONFIG.API_PLATFORM; var langType = { 'zh-cn': CN, 'en-us': EN }; var BRecognition = { name: 'BRecognition', props: { type: { type: String, 'default': 'mini' // mini || full }, empId: { type: String, 'default': '' }, // 隐藏信息完整度及标签展示区 hideIntegrityAndTags: { type: Boolean, 'default': false }, // 折叠区 collapsible: { type: Boolean, 'default': true }, defTagsList: { type: Array, 'default': function _default() { return []; } }, // 是否显示完整度 showIntegrity: { type: Boolean, 'default': true } }, data: function data() { var type = this.$props.type; return { localeCode: 'zh-cn', recoInfo: {}, v_type: type, tagsList: [] }; }, watch: { empId: function empId(val) { // 初始化人员数据 this.initInfo(); this.getTags(); } }, components: { fullRecognition: fullRecognition, miniRecognition: miniRecognition }, computed: {}, created: function created() { // 初始化人员数据 this.initInfo(); this.getTags(); }, mounted: function mounted() {}, methods: { /** * 获取默认语言 */ getDefaultLocale: function getDefaultLocale() { var result = { lang: _extends({}, CN) }; return result; }, // 初始化数据 initInfo: function initInfo() { var _this = this; request({ url: API_PLATFORM + 'employeeCoreController/getEmployeeListById', data: { empId: this.empId === '' ? this.$ils.get('employeeDto').employeeId : this.empId } }).then(function (_ref) { var data = _ref.data; _this.recoInfo = data.data[0]; })['catch'](function (error) { console.log(error); _this.$message.error(error); }); }, // 获取员工画像接口 getTags: function getTags() { var _this2 = this; request({ url: API_PLATFORM + 'daTagController/getLimitTags', data: { empId: this.empId === '' ? this.$ils.get('employeeDto').employeeId : this.empId, limit: '100' } }).then(function (_ref2) { var data = _ref2.data; _this2.tagsList = data.data.tags; if (data.data.tags.length === 0 && _this2.$props.defTagsList.length > 0) { _this2.tagsList = _this2.$props.defTagsList; } })['catch'](function (error) { console.log(error); _this2.$message.error(error); }); }, editAction: function editAction() { this.$emit('editAction'); }, renderComponent: function renderComponent(contextLocale, locale) { var _this3 = this; var h = this.$createElement; this.localeCode = locale; var localMsg = langType[locale]; var $slots = this.$slots, $props = this.$props; var hideIntegrityAndTags = $props.hideIntegrityAndTags, collapsible = $props.collapsible, showIntegrity = $props.showIntegrity; var recProps = { props: { recognitionInfo: this.recoInfo, option: $slots ? $slots.option : null, localMsg: localMsg, tagsList: this.tagsList, // 标签 hideIntegrityAndTags: hideIntegrityAndTags, collapsible: collapsible, showIntegrity: showIntegrity }, on: { // 切换模式 changeType: function changeType(val) { _this3.v_type = val; } } }; return h( DContainer, { 'class': 'transition_container' }, [this.v_type === 'full' ? h('full-Recognition', recProps) : h('mini-Recognition', recProps)] ); } }, render: function render() { var h = arguments[0]; return h(LocaleReceiver, { attrs: { componentName: 'bRecognition', defaultLocale: this.getDefaultLocale }, scopedSlots: { 'default': this.renderComponent } }); } }; BRecognition.install = function (Vue) { Vue.component(BRecognition.name, BRecognition); }; export default BRecognition;