提交 2dd63f13 编写于 作者: ibizdev's avatar ibizdev

ibizdev提交

上级 ab5bf2ce
...@@ -65,6 +65,7 @@ import AppHeaderMenus from './components/app-header-menus/app-header-menus.vue' ...@@ -65,6 +65,7 @@ import AppHeaderMenus from './components/app-header-menus/app-header-menus.vue'
import AppColumnLink from './components/app-column-link/app-column-link.vue' import AppColumnLink from './components/app-column-link/app-column-link.vue'
import AppDataUploadView from './components/app-data-upload/app-data-upload.vue' import AppDataUploadView from './components/app-data-upload/app-data-upload.vue'
import DropDownListDynamic from './components/dropdown-list-dynamic/dropdown-list-dynamic.vue' import DropDownListDynamic from './components/dropdown-list-dynamic/dropdown-list-dynamic.vue'
import AppImagePreview from './components/app-image-preview/app-image-preview.vue'
// 全局挂载UI实体服务注册中心 // 全局挂载UI实体服务注册中心
window['uiServiceRegister'] = uiServiceRegister; window['uiServiceRegister'] = uiServiceRegister;
...@@ -139,5 +140,6 @@ export const AppComponents = { ...@@ -139,5 +140,6 @@ export const AppComponents = {
v.component('app-column-link', AppColumnLink); v.component('app-column-link', AppColumnLink);
v.component('app-data-upload', AppDataUploadView); v.component('app-data-upload', AppDataUploadView);
v.component('dropdown-list-dynamic', DropDownListDynamic); v.component('dropdown-list-dynamic', DropDownListDynamic);
v.component('app-image-preview', AppImagePreview);
}, },
}; };
\ No newline at end of file
...@@ -51,6 +51,14 @@ export default class AppCheckBox extends Vue { ...@@ -51,6 +51,14 @@ export default class AppCheckBox extends Vue {
*/ */
@Prop() public codelistType?: string; @Prop() public codelistType?: string;
/**
* 代码表值分隔符
*
* @type {string}
* @memberof AppCheckBox
*/
@Prop({default:';'}) public valueSeparator?: string;
/** /**
* 是否禁用 * 是否禁用
* *
...@@ -151,7 +159,7 @@ export default class AppCheckBox extends Vue { ...@@ -151,7 +159,7 @@ export default class AppCheckBox extends Vue {
return selectsArray; return selectsArray;
} else if (Object.is(this.currentmode, 'str')) { } else if (Object.is(this.currentmode, 'str')) {
if (this.selects !== '') { if (this.selects !== '') {
return this.selects.split(this.currentseparator); return this.selects.split(this.valueSeparator);
} }
} }
} else { } else {
...@@ -181,7 +189,7 @@ export default class AppCheckBox extends Vue { ...@@ -181,7 +189,7 @@ export default class AppCheckBox extends Vue {
} }
_datas.push(item.value); _datas.push(item.value);
}); });
value = _datas.join(this.currentseparator); value = _datas.join(this.valueSeparator);
} }
this.$emit('change', value); this.$emit('change', value);
} }
......
.app-data-upload-view{ .app-data-upload-view{
width: 100%; width: 100%;
height: 100%;
padding: 16px;
.import-temp{
text-align: right;
vertical-align: middle;
color: #409EFF;
}
.data-info-content{
height: 100%;
width: 100%;
overflow: auto;
}
} }
\ No newline at end of file
/*** BEGIN:图片上传 ***/
.app-picture-preview {
.preview-file-list-item{
margin: 0 8px 8px 0;
display: inline-block;
position: relative;
}
.preview-file-list-img{
display: inline-block;
position: relative;
width: 148px;
height: 148px;
.el-image{
width: 100%;
height: 100%;
.image-slot{
width: 100%;
height: 100%;
}
}
}
.preview-file-list-actions{
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
font-size: 20px;
text-align: center;
color: #fff;
opacity: 0;
transition: opacity .3s;
.action-download{
margin-left: 15px;
}
}
.preview-file-list-actions:hover{
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
font-size: 20px;
text-align: center;
color: #fff;
opacity: 1;
background-color: rgba(0,0,0,.5);
}
.preview-file-list-actions::after{
display: inline-block;
content: "";
height: 100%;
vertical-align: middle;
}
>div{
display: inline;
}
}
.app-image-preview-model {
width: 100%;
height: 100%;
text-align: center;
.ivu-modal{
top: 50%;
transform: translateY(-50%);
display: inline-block;
.ivu-modal-content{
display: inline-block;
.ivu-modal-close{
display: none;
}
.ivu-modal-body{
display: inline-block;
line-height: 0;
.el-image {
width: auto;
height: auto;
line-height: 0;
.image-slot {
width: auto;
height: auto;
line-height: 0;
img{
max-width: 1200px;
max-height: 1600px;
}
}
}
}
}
}
}
/*** END:图片上传 ***/
\ No newline at end of file
<template>
<div class='app-picture-preview'>
<ul class="">
<li v-for="(file,index) in files" :key="index" class="preview-file-list-item">
<div class='preview-file-list-img'>
<el-image :src="file.url" class='' style=''>
<div slot='error' class='image-slot'>
<img src="/assets/img/picture.png" style='width:100%;height:100%;'>
</div>
</el-image>
<div class='preview-file-list-actions'>
<span class='action-preview'>
<i class='el-icon-zoom-in' @click="onPreview(file)"></i>
</span>
<span class='action-download'>
<i class='el-icon-download' @click="onDownload(file)"></i>
</span>
</div>
</div>
</li>
</ul>
<!-- 预览 -->
<modal v-model="dialogVisible" footer-hide width="auto" class-name='app-image-preview-model'>
<el-image src="dialogImageUrl">
<div slot='error' class='image-slot'>
<img src="/assets/img/picture.png">
</div>
</el-image>
</modal>
</div>
</template>
<script lang = 'ts'>
import { Vue, Component, Prop, Watch, Provide } from 'vue-property-decorator';
import { Environment } from '@/environments/environment';
import { Subject, Unsubscribable } from 'rxjs';
@Component({})
export default class AppImageUpload extends Vue {
/**
* 表单状态
*
* @type {Subject<any>}
* @memberof AppImageUpload
*/
@Prop() public formState?: Subject<any>
/**
* 表单状态事件
*
* @private
* @type {(Unsubscribable | undefined)}
* @memberof AppImageUpload
*/
private formStateEvent: Unsubscribable | undefined;
/**
* 初始化值
*
* @type {*}
* @memberof AppImageUpload
*/
@Prop() public value?: any;
/**
* 数据值变化
*
* @param {*} newval
* @param {*} val
* @returns
* @memberof AppImageUpload
*/
@Watch('value')
onValueChange(newval: any, val: any) {
this.setFiles(newval)
}
/**
* 所属表单项名称
*
* @type {string}
* @memberof AppImageUpload
*/
@Prop() public name!: string;
/**
* 上传文件路径
*
* @memberof AppImageUpload
*/
public uploadUrl = Environment.BaseUrl + Environment.UploadFile;
/**
* 下载文件路径
*
* @memberof AppImageUpload
*/
public downloadUrl = Environment.BaseUrl + Environment.ExportFile;
/**
* 文件列表
*
* @memberof AppImageUpload
*/
@Provide() public files = [];
/**
* 设置files
*
* @private
* @memberof AppImageUpload
*/
private setFiles(value:any): void {
let _files = JSON.parse(value);
if (value && Object.prototype.toString.call(_files)=='[object Array]') {
this.files = _files;
this.files.forEach((file: any) => {
let url = `${this.downloadUrl}/${file.id}`;
file.url = url;
});
} else {
this.files = [];
}
}
/**
* vue 生命周期
*
* @memberof AppImageUpload
*/
public created() {
if (this.formState) {
this.formStateEvent = this.formState.subscribe(($event: any) => {
// 表单加载完成
if (Object.is($event.type, 'load')) {
this.setFiles(this.value);
}
});
}
}
/**
* vue 生命周期
*
* @memberof AppImageUpload
*/
public mounted() {
this.setFiles(this.value);
}
/**
* 组件销毁
*
* @memberof AppImageUpload
*/
public destroyed(): void {
if (this.formStateEvent) {
this.formStateEvent.unsubscribe();
}
}
/**
* 下载文件
*
* @param {*} file
* @memberof AppImageUpload
*/
public onDownload(file: any) {
window.open(file.url);
}
/**
* 预览图片地址
*
* @type {string}
* @memberof AppImageUpload
*/
public dialogImageUrl: string = '';
/**
* 是否显示预览界面
*
* @type {boolean}
* @memberof AppImageUpload
*/
public dialogVisible: boolean = false;
/**
* 预览
*
* @param {*} file
* @memberof AppImageUpload
*/
public onPreview(file: any) {
this.dialogImageUrl = file.url;
this.dialogVisible = true;
}
}
</script>
<style lang = "less">
@import './app-image-preview.less';
</style>
\ No newline at end of file
<template> <template>
<radio-group class="app-radio-group" v-model="value" > <radio-group class="app-radio-group" v-model="selectArray" >
<radio v-for="(_item,index) in items" :key = "index" :label="_item.value" :disabled="isDisabled || _item.disabled"> <radio v-for="(_item,index) in items" :key = "index" :label="_item.value" :disabled="isDisabled || _item.disabled">
<span>{{Object.is(codelistType,'STATIC') ? $t('codelist.'+tag+'.'+_item.value) : _item.text}}</span> <span>{{Object.is(codelistType,'STATIC') ? $t('codelist.'+tag+'.'+_item.value) : _item.text}}</span>
</radio> </radio>
...@@ -25,41 +25,39 @@ export default class AppRadioGroup extends Vue { ...@@ -25,41 +25,39 @@ export default class AppRadioGroup extends Vue {
* @type {*} * @type {*}
* @memberof AppRadioGroup * @memberof AppRadioGroup
*/ */
@Model('change') item?: any; @Model('change') value?: any;
/** /**
* 获取值 * 代码表标识
* *
* @type {string}
* @memberof AppRadioGroup * @memberof AppRadioGroup
*/ */
get value() { @Prop() public tag?: string;
return this.item;
}
/** /**
* 设置值 * 代码表类型
* *
* @type {string}
* @memberof AppRadioGroup * @memberof AppRadioGroup
*/ */
set value(val: any) { @Prop() public codelistType?: string;
this.$emit('change', val);
}
/** /**
* 代码表标识 * 代码表值分隔符
* *
* @type {string} * @type {string}
* @memberof AppRadioGroup * @memberof AppRadioGroup
*/ */
@Prop() public tag?: string; @Prop({default:';'}) public valueSeparator?: string;
/** /**
* 代码表类型 * 模式(数字或者字符串)
* *
* @type {string} * @type {*}
* @memberof AppRadioGroup * @memberof AppCheckBox
*/ */
@Prop() public codelistType?: string; @Prop({default:'str'}) mode: any;
/** /**
* 是否禁用 * 是否禁用
...@@ -115,6 +113,59 @@ export default class AppRadioGroup extends Vue { ...@@ -115,6 +113,59 @@ export default class AppRadioGroup extends Vue {
}) })
} }
} }
/**
* 选中数组
*
* @memberof AppRadioGroup
*/
get selectArray() {
if (this.value) {
if (Object.is(this.mode, 'num') && this.items) {
let selectsArray: Array<any> = [];
let num: number = parseInt(this.value, 10);
this.items.forEach((item: any) => {
if ((num & item.value) == item.value) {
selectsArray.push(item.value);
}
});
return selectsArray;
} else if (Object.is(this.mode, 'str')) {
if (this.value !== '') {
return this.value.split(this.valueSeparator);
}
}
} else {
return [];
}
}
/**
* 设置选中
*
* @memberof AppRadioGroup
*/
set selectArray(val: any) {
let value: null | string | number = null;
if (Object.is(this.mode, 'num')) {
let temp: number = 0;
val.forEach((item: any) => {
temp = temp | parseInt(item, 10);
});
value = temp;
} else if (Object.is(this.mode, 'str')) {
let _datas: string[] = [];
this.items.forEach((item: any) => {
const index = val.findIndex((_key: any) => Object.is(item.value, _key));
if (index === -1) {
return;
}
_datas.push(item.value);
});
value = _datas.join(this.valueSeparator);
}
this.$emit('change', value);
}
} }
</script> </script>
<style lang="less"> <style lang="less">
......
<template> <template>
<span>{{isUseLangres ? $t(text) : text}}</span> <codelist v-if="tag" :tag="tag" :value="value" :codelistType="codelistType" :renderMode="renderMode" :valueSeparator="valueSeparator" :textSeparator="textSeparator"></codelist>
<span v-else >{{text}}</span>
</template> </template>
<script lang="ts"> <script lang="ts">
import { Vue, Component, Prop,Watch,Model } from 'vue-property-decorator'; import { Vue, Component, Prop, Watch, Model } from 'vue-property-decorator';
import CodeListService from "@service/app/codelist-service"; import CodeListService from "@service/app/codelist-service";
@Component({}) @Component({})
export default class DropDownList extends Vue { export default class DropDownList extends Vue {
/** /**
* 代码表服务对象 * 当前值
* *
* @type {CodeListService} * @type {*}
* @memberof AppSpan * @memberof AppSpan
*/ */
public codeListService:CodeListService = new CodeListService({ $store: this.$store }); @Prop() public value?: any;
/** /**
* 当前值 * 代码表标识
* *
* @type {*} * @type {string}
* @memberof AppSpan * @memberof AppSpan
*/ */
@Prop() public data?: any; @Prop() public tag?: string;
/**
* 代码表类型
*
* @type {string}
* @memberof AppSpan
*/
@Prop() public codelistType?: string;
/**
* 获取或模式
* @type {boolean}
* @memberof SelectPicker
*/
@Prop() public renderMode?: string;
/**
* 文本分隔符
* @type {boolean}
* @memberof SelectPicker
*/
@Prop({default:"、"}) public textSeparator?: string;
/**
* 值分隔符
* @type {boolean}
* @memberof SelectPicker
*/
@Prop({default:";"}) public valueSeparator?: string;
/** /**
* 监控表单属性 data 值 * 监控表单属性 data 值
* *
* @memberof AppSpan * @memberof AppSpan
*/ */
@Watch('data') @Watch('value')
onDataChange(newVal: any, oldVal: any) { onDataChange(newVal: any, oldVal: any) {
if(newVal !== oldVal){ if(newVal !== oldVal){
this.load(); this.load();
...@@ -52,30 +82,6 @@ export default class DropDownList extends Vue { ...@@ -52,30 +82,6 @@ export default class DropDownList extends Vue {
*/ */
@Prop() public editorType?: string; @Prop() public editorType?: string;
/**
* 代码表标识
*
* @type {string}
* @memberof AppSpan
*/
@Prop() public tag?: string;
/**
* 代码表类型
*
* @type {string}
* @memberof AppSpan
*/
@Prop() public codelistType?: string;
/**
* 代码表
*
* @type {any[]}
* @memberof AppSpan
*/
public items: any[] = [];
/** /**
* vue 生命周期 * vue 生命周期
* *
...@@ -85,76 +91,25 @@ export default class DropDownList extends Vue { ...@@ -85,76 +91,25 @@ export default class DropDownList extends Vue {
this.load(); this.load();
} }
/**
* 是否使用多语言资源
* @type {boolean}
* @memberof AppSpan
*/
public isUseLangres:boolean = false;
/** /**
* 加载代码表 * 加载代码表
* *
* @memberof AppSpan * @memberof AppSpan
*/ */
public load(){ public load(){
if(Object.is(this.editorType,'PICTURE') || Object.is(this.editorType,'PICTURE_ONE') ||Object.is(this.editorType,'FILEUPLOADER')){ if(this.tag){
let files: any[] = JSON.parse(this.data); return; //代码表走codelist组件
} else if(Object.is(this.editorType,'PICTURE') || Object.is(this.editorType,'PICTURE_ONE') || Object.is(this.editorType,'FILEUPLOADER')){
let files: any[] = JSON.parse(this.value);
let names: any[] = []; let names: any[] = [];
if(files.length && files.length > 0){
files.forEach((item:any) => { files.forEach((item:any) => {
names.push(item.name); names.push(item.name);
}); });
this.text = names.join(','); this.text = names.join(',');
}else{
if(this.tag && Object.is(this.codelistType,"STATIC")){
const codelist = this.$store.getters.getCodeList(this.tag);
if (codelist) {
this.items = [...JSON.parse(JSON.stringify(codelist.items))];
this.setText();
} else {
console.log(`----${this.tag}----代码表不存在`);
}
}else if(this.tag && Object.is(this.codelistType,"DYNAMIC")){
this.codeListService.getItems(this.tag).then((res:any) => {
this.items = res;
this.setText();
}).catch((error:any) => {
console.log(`----${this.tag}----代码表不存在`);
});
}else{
this.setText();
}
}
}
/**
* 设置显示值
* @memberof AppSpan
*/
public setText(){
this.isUseLangres = false;
if(this.items.length>0){
let currentItem:any = this.items.find((item:any)=>{
return item.value == this.data;
});
if(currentItem){
if(Object.is(this.codelistType,'STATIC')){
this.isUseLangres = true;
this.text = 'codelist.'+this.tag+'.'+this.data;
}else{
this.text = currentItem.label;
}
}else{
// 不匹配显示原值,不存在显示空值
if(this.data){
this.text = this.data;
}else{
this.isUseLangres = true;
this.text = 'codelist.'+this.tag+'.empty';
}
} }
}else{ }else{
this.text = this.data; this.text = this.value;
} }
} }
......
<template> <template>
<div class="codelist"> <div class="codelist">
<span v-if="ifEmpty">{{$t('codelist.'+srfkey+'.empty')}}</span> <span v-if="ifEmpty">{{$t('codelist.'+tag+'.empty')}}</span>
<template v-if="!ifEmpty"> <template v-if="!ifEmpty">
<template v-if="renderMode == 'string'">
<template v-for="(val, index) in items">
{{ index != 0 ? textSeparator : ''}}
<template v-for="(item, index) in val">
{{ index != 0 ? "、" : ''}}
<i v-if="item.iconCls" :class="item.iconCls"></i>
<span :class="item.textCls" :style="{color:item.color}">{{isUseLangres ? $t(item.text) : item.text}}</span>
</template>
</template>
</template>
<template v-else>
<template v-for="(item, index) in items"> <template v-for="(item, index) in items">
{{ index != 0 ? textSeparator : ''}} <span>{{ index != 0 ? textSeparator : ''}}</span>
<i v-if="item.iconCls" :class="item.iconCls"></i> <i v-if="item.iconCls" :class="item.iconCls"></i>
<span :class="item.textCls" :style="{color:item.color}">{{isUseLangres ? $t(item.text) : item.text}}</span> <span :class="item.textCls" :style="{color:item.color}">{{isUseLangres ? $t(item.text) : item.text}}</span>
</template> </template>
</template> </template>
</template>
</div> </div>
</template> </template>
...@@ -43,7 +31,7 @@ export default class CodeList extends Vue { ...@@ -43,7 +31,7 @@ export default class CodeList extends Vue {
* @type {string} * @type {string}
* @memberof CodeList * @memberof CodeList
*/ */
@Prop() public srfkey!: string; @Prop() public tag!: string;
/** /**
* 代码表类型 * 代码表类型
...@@ -62,14 +50,7 @@ export default class CodeList extends Vue { ...@@ -62,14 +50,7 @@ export default class CodeList extends Vue {
@Prop() public value?: string; @Prop() public value?: string;
/** /**
* 空值显示文本 * 获取或模式
* @type {boolean}
* @memberof SelectPicker
*/
@Prop() public emptytext?: string;
/**
* 绘制模式
* @type {boolean} * @type {boolean}
* @memberof SelectPicker * @memberof SelectPicker
*/ */
...@@ -90,14 +71,14 @@ export default class CodeList extends Vue { ...@@ -90,14 +71,14 @@ export default class CodeList extends Vue {
@Prop({default:";"}) public valueSeparator?: string; @Prop({default:";"}) public valueSeparator?: string;
/** /**
* 是否 * 是否为空
* *
* @memberof CodeList * @memberof CodeList
*/ */
public ifEmpty:boolean = false; public ifEmpty:boolean = false;
/** /**
* 显示数据 * 显示数据集合
* *
* @type {any[]} * @type {any[]}
* @memberof CodeList * @memberof CodeList
...@@ -150,16 +131,16 @@ export default class CodeList extends Vue { ...@@ -150,16 +131,16 @@ export default class CodeList extends Vue {
this.ifEmpty = false; this.ifEmpty = false;
// 动态代码表处理 // 动态代码表处理
if (Object.is(this.codelistType, "DYNAMIC")) { if (Object.is(this.codelistType, "DYNAMIC")) {
this.codeListService.getItems(this.srfkey).then((res: any) => { this.codeListService.getItems(this.tag).then((res: any) => {
let items = res; let items = res;
_this.setItems(items, _this); _this.setItems(items, _this);
}).catch((error: any) => { }).catch((error: any) => {
console.log(`----${_this.srfkey}----代码表不存在`); console.log(`----${_this.tag}----代码表不存在`);
}); });
// 静态处理 // 静态处理
} else if(Object.is(this.codelistType, "STATIC")){ } else if(Object.is(this.codelistType, "STATIC")){
this.isUseLangres = true; this.isUseLangres = true;
let items = this.$store.getters.getCodeListItems(this.srfkey); let items = this.$store.getters.getCodeListItems(this.tag);
_this.setItems(items, _this); _this.setItems(items, _this);
} }
} }
...@@ -176,8 +157,8 @@ export default class CodeList extends Vue { ...@@ -176,8 +157,8 @@ export default class CodeList extends Vue {
private setItems(items: any[], _this: any){ private setItems(items: any[], _this: any){
if (items) { if (items) {
let result:any = []; let result:any = [];
if(Object.is(this.renderMode,"number")){ if(Object.is(_this.renderMode,"NUM")){
this.isUseLangres = false; _this.isUseLangres = false;
items.map((_item: any, index: number)=>{ items.map((_item: any, index: number)=>{
const nValue = parseInt((_this.value as any), 10); const nValue = parseInt((_this.value as any), 10);
const codevalue = _item.value; const codevalue = _item.value;
...@@ -185,25 +166,10 @@ export default class CodeList extends Vue { ...@@ -185,25 +166,10 @@ export default class CodeList extends Vue {
result.push(_item); result.push(_item);
} }
}); });
} else if(Object.is(this.renderMode,"string")){
const arrayValue: Array<any> = (_this.value as any).split(_this.valueSeparator);
arrayValue.map((value: any, index: number) => {
result.push([]);
let values: any[] = Object.is(this.$util.typeOf(value), 'number') ? [value] : [...(value as any).split(this.valueSeparator)];
values.map((val:any ,num: number)=>{
const item = this.getItem(items, val);
if(item){
result[index].push(item);
}
});
if(result[index].length == 0){
result.splice(index,1);
}
});
} else { } else {
let values: any[] = Object.is(this.$util.typeOf(this.value), 'number') ? [this.value] : [...(this.value as any).split(this.valueSeparator)]; let values: any[] = Object.is(_this.$util.typeOf(_this.value), 'NUM') ? [_this.value] : [...(_this.value as any).split(_this.valueSeparator)];
values.map((value:any ,index: number)=>{ values.map((value:any ,index: number)=>{
const item = this.getItem(items, value); const item = _this.getItem(items, value);
if(item){ if(item){
result.push(item); result.push(item);
} }
...@@ -213,11 +179,7 @@ export default class CodeList extends Vue { ...@@ -213,11 +179,7 @@ export default class CodeList extends Vue {
if(result.length != 0){ if(result.length != 0){
_this.items = result; _this.items = result;
}else{ }else{
if(Object.is(this.renderMode,"string")){ _this.items = [{text:_this.value}];
_this.items = [[{text:this.value}]];
} else {
_this.items = [{text:this.value}];
}
} }
} }
} }
...@@ -240,16 +202,13 @@ export default class CodeList extends Vue { ...@@ -240,16 +202,13 @@ export default class CodeList extends Vue {
result = { ...arr[0] }; result = { ...arr[0] };
if(Object.is(this.codelistType,'STATIC')){ if(Object.is(this.codelistType,'STATIC')){
let value = JSON.parse(JSON.stringify(result)); let value = JSON.parse(JSON.stringify(result));
value.text = 'codelist.'+this.srfkey+'.'+value.value; value.text = 'codelist.'+this.tag+'.'+value.value;
return value; return value;
}else{ }else{
return result; return result;
} }
} }
} }
</script> </script>
......
...@@ -64,6 +64,14 @@ export default class DropDownList extends Vue { ...@@ -64,6 +64,14 @@ export default class DropDownList extends Vue {
*/ */
@Prop() public codelistType?: string; @Prop() public codelistType?: string;
/**
* 代码表值分隔符
*
* @type {string}
* @memberof DropDownListMpicker
*/
@Prop({default:';'}) public valueSeparator?: string;
/** /**
* 是否禁用 * 是否禁用
* @type {any} * @type {any}
...@@ -94,7 +102,7 @@ export default class DropDownList extends Vue { ...@@ -94,7 +102,7 @@ export default class DropDownList extends Vue {
set currentVal(val: any) { set currentVal(val: any) {
const type: string = this.$util.typeOf(val); const type: string = this.$util.typeOf(val);
val = Object.is(type, 'null') || Object.is(type, 'undefined') ? [] : val; val = Object.is(type, 'null') || Object.is(type, 'undefined') ? [] : val;
let value = val.length > 0 ? val.join(',') : ''; let value = val.length > 0 ? val.join(this.valueSeparator) : '';
this.$emit('change', value); this.$emit('change', value);
} }
...@@ -104,7 +112,7 @@ export default class DropDownList extends Vue { ...@@ -104,7 +112,7 @@ export default class DropDownList extends Vue {
* @memberof DropDownListMpicker * @memberof DropDownListMpicker
*/ */
get currentVal() { get currentVal() {
return this.itemValue? this.itemValue.split(','):[]; return this.itemValue? this.itemValue.split(this.valueSeparator):[];
} }
/** /**
......
...@@ -310,12 +310,21 @@ export default class AppIndexViewBase extends Vue { ...@@ -310,12 +310,21 @@ export default class AppIndexViewBase extends Vue {
public handleCustomDataLogic(curNavData:any,tempData:any,item:string){ public handleCustomDataLogic(curNavData:any,tempData:any,item:string){
// 直接值直接赋值 // 直接值直接赋值
if(curNavData.isRawValue){ if(curNavData.isRawValue){
if(Object.is(curNavData.value,"null") || Object.is(curNavData.value,"")){
Object.defineProperty(tempData, item, {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item, { Object.defineProperty(tempData, item, {
value: curNavData.value, value: curNavData.value,
writable : true, writable : true,
enumerable : true, enumerable : true,
configurable : true configurable : true
}); });
}
}else{ }else{
// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null // 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
if(this.context[curNavData.value]){ if(this.context[curNavData.value]){
......
...@@ -448,12 +448,21 @@ export default class IBZDictEditViewBase extends Vue { ...@@ -448,12 +448,21 @@ export default class IBZDictEditViewBase extends Vue {
public handleCustomDataLogic(curNavData:any,tempData:any,item:string){ public handleCustomDataLogic(curNavData:any,tempData:any,item:string){
// 直接值直接赋值 // 直接值直接赋值
if(curNavData.isRawValue){ if(curNavData.isRawValue){
if(Object.is(curNavData.value,"null") || Object.is(curNavData.value,"")){
Object.defineProperty(tempData, item, {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item, { Object.defineProperty(tempData, item, {
value: curNavData.value, value: curNavData.value,
writable : true, writable : true,
enumerable : true, enumerable : true,
configurable : true configurable : true
}); });
}
}else{ }else{
// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null // 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
if(this.context[curNavData.value]){ if(this.context[curNavData.value]){
......
...@@ -474,12 +474,21 @@ export default class IBZDictGridViewBase extends Vue { ...@@ -474,12 +474,21 @@ export default class IBZDictGridViewBase extends Vue {
public handleCustomDataLogic(curNavData:any,tempData:any,item:string){ public handleCustomDataLogic(curNavData:any,tempData:any,item:string){
// 直接值直接赋值 // 直接值直接赋值
if(curNavData.isRawValue){ if(curNavData.isRawValue){
if(Object.is(curNavData.value,"null") || Object.is(curNavData.value,"")){
Object.defineProperty(tempData, item, {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item, { Object.defineProperty(tempData, item, {
value: curNavData.value, value: curNavData.value,
writable : true, writable : true,
enumerable : true, enumerable : true,
configurable : true configurable : true
}); });
}
}else{ }else{
// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null // 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
if(this.context[curNavData.value]){ if(this.context[curNavData.value]){
......
...@@ -448,12 +448,21 @@ export default class IBZDictItemEditViewBase extends Vue { ...@@ -448,12 +448,21 @@ export default class IBZDictItemEditViewBase extends Vue {
public handleCustomDataLogic(curNavData:any,tempData:any,item:string){ public handleCustomDataLogic(curNavData:any,tempData:any,item:string){
// 直接值直接赋值 // 直接值直接赋值
if(curNavData.isRawValue){ if(curNavData.isRawValue){
if(Object.is(curNavData.value,"null") || Object.is(curNavData.value,"")){
Object.defineProperty(tempData, item, {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item, { Object.defineProperty(tempData, item, {
value: curNavData.value, value: curNavData.value,
writable : true, writable : true,
enumerable : true, enumerable : true,
configurable : true configurable : true
}); });
}
}else{ }else{
// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null // 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
if(this.context[curNavData.value]){ if(this.context[curNavData.value]){
......
...@@ -474,12 +474,21 @@ export default class IBZDictItemGridViewBase extends Vue { ...@@ -474,12 +474,21 @@ export default class IBZDictItemGridViewBase extends Vue {
public handleCustomDataLogic(curNavData:any,tempData:any,item:string){ public handleCustomDataLogic(curNavData:any,tempData:any,item:string){
// 直接值直接赋值 // 直接值直接赋值
if(curNavData.isRawValue){ if(curNavData.isRawValue){
if(Object.is(curNavData.value,"null") || Object.is(curNavData.value,"")){
Object.defineProperty(tempData, item, {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item, { Object.defineProperty(tempData, item, {
value: curNavData.value, value: curNavData.value,
writable : true, writable : true,
enumerable : true, enumerable : true,
configurable : true configurable : true
}); });
}
}else{ }else{
// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null // 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
if(this.context[curNavData.value]){ if(this.context[curNavData.value]){
......
...@@ -64,10 +64,14 @@ export default class CodeListService { ...@@ -64,10 +64,14 @@ export default class CodeListService {
} }
}else{ }else{
if (_this[tag]) { if (_this[tag]) {
return _this[tag].getItems(context,data,isloading); _this[tag].getItems(context,data,isloading).then((result:any) =>{
} resolve(result);
}).catch((error:any) =>{
Promise.reject([]);
})
}else{
return Promise.reject([]); return Promise.reject([]);
}
} }
}) })
} }
......
...@@ -552,6 +552,19 @@ export default class EntityService { ...@@ -552,6 +552,19 @@ export default class EntityService {
return this.FetchDefault(context,data,isloading); return this.FetchDefault(context,data,isloading);
} }
/**
* ImportData接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof EntityService
*/
public async ImportData(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
return Http.getInstance().post(`/${this.APPDENAME}/import`,data,isloading);
}
/** /**
* WFStart接口方法 * WFStart接口方法
* *
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<row > <row >
<i-col v-show="detailsModel.n_ibzdictid_like.visible" :style="{}" :md="{ span: 12, offset: 0 }" :lg="{ span: 12, offset: 0 }" :xl="{ span: 12, offset: 0 }"> <i-col v-show="detailsModel.n_ibzdictid_like.visible" :style="{}" :md="{ span: 12, offset: 0 }" :lg="{ span: 12, offset: 0 }" :xl="{ span: 12, offset: 0 }">
<app-form-item name='n_ibzdictid_like' :itemRules="this.rules.n_ibzdictid_like" class='' :caption="$t('ibzdict.default_searchform.details.n_ibzdictid_like')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.n_ibzdictid_like.error" :isEmptyCaption="false" labelPos="LEFT"> <app-form-item name='n_ibzdictid_like' :itemRules="this.rules.n_ibzdictid_like" class='' :caption="$t('ibzdict.default_searchform.details.n_ibzdictid_like')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.n_ibzdictid_like.error" :isEmptyCaption="false" labelPos="LEFT">
<app-span style="width:100px;" :data="data.n_ibzdictid_like" ></app-span> <app-span :value="data.n_ibzdictid_like" style="width:100px;"></app-span>
</app-form-item> </app-form-item>
</i-col> </i-col>
......
...@@ -33,6 +33,7 @@ public class IBZDict extends EntityBase implements Serializable { ...@@ -33,6 +33,7 @@ public class IBZDict extends EntityBase implements Serializable {
/** /**
* 字典标识 * 字典标识
*/ */
@DEField(isKeyField=true)
@TableId(value= "ibzdictid",type=IdType.UUID) @TableId(value= "ibzdictid",type=IdType.UUID)
private String dictid; private String dictid;
...@@ -82,14 +83,6 @@ public class IBZDict extends EntityBase implements Serializable { ...@@ -82,14 +83,6 @@ public class IBZDict extends EntityBase implements Serializable {
/**
* 字典项目
*/
@JsonIgnore
@JSONField(serialize = false)
@TableField(exist = false)
private List<cn.ibizlab.core.dict.domain.IBZDictItem> items;
/** /**
* 设置 [字典名称] * 设置 [字典名称]
......
...@@ -33,6 +33,7 @@ public class IBZDictItem extends EntityBase implements Serializable { ...@@ -33,6 +33,7 @@ public class IBZDictItem extends EntityBase implements Serializable {
/** /**
* 字典项目标识 * 字典项目标识
*/ */
@DEField(isKeyField=true)
@TableId(value= "ibzdictitemid",type=IdType.UUID) @TableId(value= "ibzdictitemid",type=IdType.UUID)
private String itemid; private String itemid;
......
<?xml version="1.0" encoding="UTF-8"?> !!!!模版产生代码错误:----
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----
<mapper namespace="cn.ibizlab.core.dict.mapper.IBZDictMapper">
----
<!--该方法用于重写mybatis中selectById方法,以实现查询逻辑属性--> FTL stack trace ("~" means nesting-related):
<select id="selectById" resultMap="IBZDictResultMap" databaseId="mysql"> - Failed at: #if MajorPSDER.getMinorPSDataEntity??... [in template "CODETEMPL_zh_CN" at line 85, column 41]
<![CDATA[ select t1.* from ( ----
SELECT t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`ENABLE`, t1.`IBZDICTID`, t1.`IBZDICTNAME`, t1.`UPDATEDATE`, t1.`UPDATEMAN` FROM `IBZDICT` t1 \ No newline at end of file
)t1 where ibzdictid=#{id}]]>
</select>
<!--通过mybatis将查询结果注入到entity中,通过配置autoMapping="true"由mybatis自动处理映射关系 -->
<resultMap id="IBZDictResultMap" type="cn.ibizlab.core.dict.domain.IBZDict" autoMapping="true">
<id property="dictId" column="ibzdictid" /><!--主键字段映射-->
<!--通过mybatis自动注入关系属性[关系实体],fetchType="lazy"为懒加载配置 -->
<collection property="items" ofType="cn.ibizlab.core.dict.domain.IBZDictItem" column="ibzdictid" select="cn.ibizlab.core.dict.mapper.IBZDictItemMapper.selectBydictid" fetchType="lazy"></collection>
</resultMap>
<!--数据集合[Default]-->
<select id="searchDefault" parameterType="cn.ibizlab.core.dict.filter.IBZDictSearchContext" resultMap="IBZDictResultMap">
select t1.* from (
<include refid="Default" />
)t1
<where><if test="ew!=null and ew.sqlSegment!=null and !ew.emptyOfWhere">${ew.sqlSegment}</if></where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">${ew.sqlSegment}</if>
</select>
<!--数据查询[Default]-->
<sql id="Default" databaseId="mysql">
select t1.* from (
<![CDATA[ SELECT t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`ENABLE`, t1.`IBZDICTID`, t1.`IBZDICTNAME`, t1.`UPDATEDATE`, t1.`UPDATEMAN` FROM `IBZDICT` t1 ]]>
<![CDATA[
WHERE
t1.ENABLE = 1
]]>
)t1
</sql>
<!--数据查询[View]-->
<sql id="View" databaseId="mysql">
select t1.* from (
<![CDATA[ SELECT t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`ENABLE`, t1.`IBZDICTID`, t1.`IBZDICTNAME`, t1.`UPDATEDATE`, t1.`UPDATEMAN` FROM `IBZDICT` t1 ]]>
<![CDATA[
WHERE
t1.ENABLE = 1
]]>
)t1
</sql>
</mapper>
...@@ -5,14 +5,12 @@ ...@@ -5,14 +5,12 @@
<!--该方法用于重写mybatis中selectById方法,以实现查询逻辑属性--> <!--该方法用于重写mybatis中selectById方法,以实现查询逻辑属性-->
<select id="selectById" resultMap="IBZDictItemResultMap" databaseId="mysql"> <select id="selectById" resultMap="IBZDictItemResultMap" databaseId="mysql">
<![CDATA[ select t1.* from ( <![CDATA[select t1.* from (SELECT t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`DICTID`, t1.`DICTITEMVAL`, t1.`IBZDICTITEMID`, t1.`IBZDICTITEMNAME`, t1.`ITEMCLS`, t1.`ITEMFILTER`, t1.`ITEMICON`, t1.`PITEMVAL`, t1.`SHOWORDER`, t1.`UPDATEDATE`, t1.`UPDATEMAN` FROM `IBZDICTITEM` t1 ) t1 where ibzdictitemid=#{id}]]>
SELECT t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`DICTID`, t1.`DICTITEMVAL`, t1.`IBZDICTITEMID`, t1.`IBZDICTITEMNAME`, t1.`ITEMCLS`, t1.`ITEMFILTER`, t1.`ITEMICON`, t1.`PITEMVAL`, t1.`SHOWORDER`, t1.`UPDATEDATE`, t1.`UPDATEMAN` FROM `IBZDICTITEM` t1
)t1 where ibzdictitemid=#{id}]]>
</select> </select>
<!--通过mybatis将查询结果注入到entity中,通过配置autoMapping="true"由mybatis自动处理映射关系 --> <!--通过mybatis将查询结果注入到entity中,通过配置autoMapping="true"由mybatis自动处理映射关系 -->
<resultMap id="IBZDictItemResultMap" type="cn.ibizlab.core.dict.domain.IBZDictItem" autoMapping="true"> <resultMap id="IBZDictItemResultMap" type="cn.ibizlab.core.dict.domain.IBZDictItem" autoMapping="true">
<id property="itemId" column="ibzdictitemid" /><!--主键字段映射--> <id property="itemid" column="ibzdictitemid" /><!--主键字段映射-->
<result property="dictid" column="dictid" /><!--关系字段映射--> <result property="dictid" column="dictid" /><!--关系字段映射-->
<!--通过mybatis自动注入关系属性[主实体],fetchType="lazy"为懒加载配置 --> <!--通过mybatis自动注入关系属性[主实体],fetchType="lazy"为懒加载配置 -->
<association property="dict" javaType="cn.ibizlab.core.dict.domain.IBZDict" column="dictid" select="cn.ibizlab.core.dict.mapper.IBZDictMapper.selectById" fetchType="lazy"></association> <association property="dict" javaType="cn.ibizlab.core.dict.domain.IBZDict" column="dictid" select="cn.ibizlab.core.dict.mapper.IBZDictMapper.selectById" fetchType="lazy"></association>
...@@ -22,7 +20,7 @@ ...@@ -22,7 +20,7 @@
<select id="selectBydictid" resultMap="IBZDictItemResultMap"> <select id="selectBydictid" resultMap="IBZDictItemResultMap">
select t1.* from ( select t1.* from (
<include refid="Default" /> <include refid="Default" />
)t1 ) t1
where dictid=#{dictid} where dictid=#{dictid}
</select> </select>
...@@ -37,18 +35,14 @@ ...@@ -37,18 +35,14 @@
<!--数据查询[Default]--> <!--数据查询[Default]-->
<sql id="Default" databaseId="mysql"> <sql id="Default" databaseId="mysql">
select t1.* from ( <![CDATA[ SELECT t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`DICTID`, t1.`DICTITEMVAL`, t1.`IBZDICTITEMID`, t1.`IBZDICTITEMNAME`, t1.`ITEMCLS`, t1.`ITEMFILTER`, t1.`ITEMICON`, t1.`PITEMVAL`, t1.`SHOWORDER`, t1.`UPDATEDATE`, t1.`UPDATEMAN` FROM `IBZDICTITEM` t1
<![CDATA[ SELECT t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`DICTID`, t1.`DICTITEMVAL`, t1.`IBZDICTITEMID`, t1.`IBZDICTITEMNAME`, t1.`ITEMCLS`, t1.`ITEMFILTER`, t1.`ITEMICON`, t1.`PITEMVAL`, t1.`SHOWORDER`, t1.`UPDATEDATE`, t1.`UPDATEMAN` FROM `IBZDICTITEM` t1 ]]> ]]>
<![CDATA[ ]]>
)t1
</sql> </sql>
<!--数据查询[View]--> <!--数据查询[View]-->
<sql id="View" databaseId="mysql"> <sql id="View" databaseId="mysql">
select t1.* from ( <![CDATA[ SELECT t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`DICTID`, t1.`DICTITEMVAL`, t1.`IBZDICTITEMID`, t1.`IBZDICTITEMNAME`, t1.`ITEMCLS`, t1.`ITEMFILTER`, t1.`ITEMICON`, t1.`PITEMVAL`, t1.`SHOWORDER`, t1.`UPDATEDATE`, t1.`UPDATEMAN` FROM `IBZDICTITEM` t1
<![CDATA[ SELECT t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`DICTID`, t1.`DICTITEMVAL`, t1.`IBZDICTITEMID`, t1.`IBZDICTITEMNAME`, t1.`ITEMCLS`, t1.`ITEMFILTER`, t1.`ITEMICON`, t1.`PITEMVAL`, t1.`SHOWORDER`, t1.`UPDATEDATE`, t1.`UPDATEMAN` FROM `IBZDICTITEM` t1 ]]> ]]>
<![CDATA[ ]]>
)t1
</sql> </sql>
</mapper> </mapper>
......
...@@ -21,8 +21,6 @@ ...@@ -21,8 +21,6 @@
<module>ibzdict-dependencies</module> <module>ibzdict-dependencies</module>
<!-- utils --> <!-- utils -->
<module>ibzdict-util</module> <module>ibzdict-util</module>
<!-- comenpents -->
<module>ibzdict-mybatis</module>
<!-- cores --> <!-- cores -->
<module>ibzdict-core</module> <module>ibzdict-core</module>
<!-- services --> <!-- services -->
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册