Browse Source

api新增编辑暂存

noToken
安虹睿 1 year ago
parent
commit
68103f03f0
  1. 223
      PC/UI.WinIn.FasterZ.Store/src/components/addEditFromApiPop/index.vue
  2. 312
      PC/UI.WinIn.FasterZ.Store/src/components/addEditFromApiPop/index_mst.vue
  3. 604
      PC/UI.WinIn.FasterZ.Store/src/components/currenTableFlex/index.vue
  4. 198
      PC/UI.WinIn.FasterZ.Store/src/components/umyTable/index.vue
  5. 2
      PC/UI.WinIn.FasterZ.Store/src/store/modules/definition.js
  6. 218
      PC/UI.WinIn.FasterZ.Store/src/views/demo/demo_api_handle.vue

223
PC/UI.WinIn.FasterZ.Store/src/components/addEditFromApiPop/index.vue

@ -11,88 +11,108 @@
style="width:calc(100% - 28px);left:14px;top:14px;height:calc(100% - 28px)" style="width:calc(100% - 28px);left:14px;top:14px;height:calc(100% - 28px)"
v-loading="Loading.addEditApiLoading" v-loading="Loading.addEditApiLoading"
> >
<!-- 表单 --> <!-- 数据填写 -->
<div v-if="active === 0" style="height: 100%;"> <div v-if="active === 0" style="height: 100%;">
<!-- 标题 --> <div class="centerInnerContent">
<div class="dialogOuterTitle">{{formTitle}}</div> <!-- 左侧主表 -->
<!-- 表单 --> <div class="leftMainForm">
<el-form <div class="dialogOuterTitle">{{formTitle}} 主表信息</div>
class="addEditFrom" <!-- 表单 -->
ref="addEditFrom_Ref" <el-form
v-if="formData" class="addEditFrom"
:model="formData" ref="addEditFrom_Ref"
:rules="formRules" v-if="formData"
> :model="formData"
<el-row :gutter="40"> :rules="formRules"
<el-col
:span="item.colSpan || 12"
v-for="(item, index) in formItemData"
:key="index"
> >
<el-form-item <el-row :gutter="40">
:label="item.label" <el-col
:prop="item.prop" :span="item.colSpan || 12"
> v-for="(item, index) in formItemData"
<!-- 数值 --> :key="index"
<el-input-number
v-if="item.apiBaseType === 'number'"
v-model="formData[item.prop]"
:min="item.minimum || undefined"
:max="item.maximum || undefined"
:maxlength="item.maxLength || undefined"
:minlength="item.minLength || undefined"
:disabled="Boolean(item.disabled)"
:placeholder="item.placeholder || '请输入' + item.label"
@change="changeValue(item.prop,item,$event)"
@clear="clearValue(item.prop,$event)"
></el-input-number>
<!-- 时间转换 -->
<el-date-picker
v-else-if="item.apiBaseType === 'datetime'"
v-model="formData[item.prop]"
type="datetime"
placeholder="选择日期时间"
format="yyyy-MM-dd HH:mm:ss"
value-format="yyyy-MM-ddTHH:mm:ss"
:disabled="Boolean(item.disabled)"
></el-date-picker>
<!-- 布尔枚举 -->
<el-select
v-else-if="item.isEnums || item.apiBaseType === 'boolean'"
v-model="formData[item.prop]"
:placeholder="item.placeholder || '请选择' + item.label"
:disabled="Boolean(item.disabled)"
> >
<el-option <el-form-item
v-for="item in getItemEnums(item)"
:key="item.value"
:label="item.label" :label="item.label"
:value="item.value" :prop="item.prop"
></el-option> v-if="item.label.toUpperCase() != 'DETAILS'"
</el-select> >
<!-- 数值 -->
<el-input-number
v-if="item.apiBaseType === 'number'"
v-model="formData[item.prop]"
:min="item.minimum || undefined"
:max="item.maximum || undefined"
:maxlength="item.maxLength || undefined"
:minlength="item.minLength || undefined"
:disabled="Boolean(item.disabled)"
:placeholder="item.placeholder || '请输入' + item.label"
@change="changeValue(item.prop,item,$event)"
@clear="clearValue(item.prop,$event)"
></el-input-number>
<!-- 时间转换 -->
<el-date-picker
v-else-if="item.apiBaseType === 'datetime'"
v-model="formData[item.prop]"
type="datetime"
placeholder="选择日期时间"
format="yyyy-MM-dd HH:mm:ss"
value-format="yyyy-MM-ddTHH:mm:ss"
:disabled="Boolean(item.disabled)"
></el-date-picker>
<!-- 文本框 --> <!-- 布尔枚举 -->
<!-- <el-input <el-select
v-else v-else-if="item.isEnums || item.apiBaseType === 'boolean'"
type="textarea" v-model="formData[item.prop]"
autosize :placeholder="item.placeholder || '请选择' + item.label"
resize="none" :disabled="Boolean(item.disabled)"
v-model="formData[item.prop]" >
:placeholder="item.placeholder || '请输入' + item.label" <el-option
:disabled="Boolean(item.disabled)" v-for="item in getItemEnums(item)"
></el-input> --> :key="item.value"
<el-input :label="item.label"
v-else :value="item.value"
v-model="formData[item.prop]" ></el-option>
:placeholder="item.placeholder || '请输入' + item.label" </el-select>
:disabled="Boolean(item.disabled)"
></el-input> <!-- 文本框 -->
</el-form-item> <!-- <el-input
</el-col> v-else
</el-row> type="textarea"
</el-form> autosize
resize="none"
v-model="formData[item.prop]"
:placeholder="item.placeholder || '请输入' + item.label"
:disabled="Boolean(item.disabled)"
></el-input> -->
<el-input
v-else
v-model="formData[item.prop]"
:placeholder="item.placeholder || '请输入' + item.label"
:disabled="Boolean(item.disabled)"
></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<!-- 右侧子表 -->
<div class="rightDetailTable">
<div class="dialogOuterTitle">{{formTitle}} 子表信息</div>
<!-- 子表 -->
<currenTableFlex
ref="currenTableFlex_Ref"
:isShowIndex="true"
:isEditable="true"
:setUTableHeight="230"
class="currenTableFlex"
v-if="flexTableData"
:flexTableData="flexTableData"
:flexTableColumns="flexTableColumns"
></currenTableFlex>
</div>
</div>
<!-- 操作按钮 --> <!-- 操作按钮 -->
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button @click="show = false"> </el-button> <el-button @click="show = false"> </el-button>
@ -128,9 +148,13 @@
import { ApiTypePost, ApiTypePut } from "@/api/wms-api" import { ApiTypePost, ApiTypePut } from "@/api/wms-api"
import { LoadingMixins } from "@/mixins/LoadingMixins"; import { LoadingMixins } from "@/mixins/LoadingMixins";
import { tableMixins } from "@/mixins/TableMixins" import { tableMixins } from "@/mixins/TableMixins"
import currenTableFlex from "@/components/currenTableFlex"
import * as allUrlOption from '@/utils/baseData/urlOption'
import { timeAgo } from "@/filters";
export default { export default {
name:"addEditFromApiPop", name:"addEditFromApiPop",
mixins:[ LoadingMixins,tableMixins ], mixins:[ LoadingMixins,tableMixins ],
components: { currenTableFlex },
props: { props: {
// //
editRowData:{ editRowData:{
@ -156,10 +180,13 @@ export default {
editSubmitUrl:{ editSubmitUrl:{
type: String, type: String,
default: null default: null
} },
}, },
data () { data () {
return { return {
//-
URLOption_detailList:allUrlOption[this.$route.name].detailListURL,
// dto
currentDtos:this.$store.getters.dtoColumnTypes[this.$route.name], currentDtos:this.$store.getters.dtoColumnTypes[this.$route.name],
active:0,//0 1 2 active:0,//0 1 2
show:true, show:true,
@ -167,6 +194,9 @@ export default {
formData:{},// formData:{},//
formItemData:null,//item formItemData:null,//item
formRules: {},// formRules: {},//
flexTableData:null,//table
// flexTableColumns:null,//table
flexTableColumns: null,
} }
}, },
mounted(){ mounted(){
@ -191,6 +221,22 @@ export default {
}else{ }else{
this.formData = {} this.formData = {}
} }
//
let _list = this.formItemData.filter(item=>{
return item.prop.toUpperCase() == 'DETAILS'
})
if(_list && _list.length > 0){
if(this.handleType == 'edit'){
this.flexTableData = this.formData[_list[0].prop]
}else{
this.flexTableData = []
}
}
//
let _detailApi = this.URLOption_detailList.slice(0,this.URLOption_detailList.lastIndexOf('/'))
let _detailDtos = this.$store.getters.dtoColumnTypes[_detailApi].S.dtoList
this.flexTableColumns = _detailDtos
// //
this.formRules={} this.formRules={}
_dtoList.forEach(item=>{ _dtoList.forEach(item=>{
@ -229,6 +275,7 @@ export default {
this.submitForm(valid,this.formData,this.handleType,this.formItemData,this.formRules) this.submitForm(valid,this.formData,this.handleType,this.formItemData,this.formRules)
return return
} }
this.formData.details = this.flexTableData
this.Loading.addEditApiLoading = true this.Loading.addEditApiLoading = true
if (valid) { if (valid) {
// //
@ -294,7 +341,7 @@ export default {
width: 100%; width: 100%;
} }
::v-deep .addEditFrom{ ::v-deep .addEditFrom{
height: calc(100% - 120px); height: calc(100%);
overflow: auto; overflow: auto;
} }
::v-deep .el-form-item__label{ ::v-deep .el-form-item__label{
@ -309,4 +356,22 @@ export default {
padding-top: 15px; padding-top: 15px;
text-align: right; text-align: right;
} }
.centerInnerContent{
height: calc(100% - 60px);
overflow: auto;
display: flex;
.leftMainForm{
width: 50%;
flex-shrink: 0;
height: calc(100% - 60px);
}
.rightDetailTable{
height: calc(100% - 60px);
width: calc(50%);
padding-left:40px;
border-left: #ddd solid 1px;
}
}
</style> </style>

312
PC/UI.WinIn.FasterZ.Store/src/components/addEditFromApiPop/index_mst.vue

@ -0,0 +1,312 @@
<template>
<!-- 组件功能普通新增编辑目前只有主表参数配置从api获取 -->
<el-dialog
:visible.sync="show"
:modal="false"
:modal-append-to-body="false"
:show-close="true"
@close="close"
class="searchPageComponents"
:fullscreen="true"
style="width:calc(100% - 28px);left:14px;top:14px;height:calc(100% - 28px)"
v-loading="Loading.addEditApiLoading"
>
<!-- 表单 -->
<div v-if="active === 0" style="height: 100%;">
<!-- 标题 -->
<div class="dialogOuterTitle">{{formTitle}}</div>
<!-- 表单 -->
<el-form
class="addEditFrom"
ref="addEditFrom_Ref"
v-if="formData"
:model="formData"
:rules="formRules"
>
<el-row :gutter="40">
<el-col
:span="item.colSpan || 12"
v-for="(item, index) in formItemData"
:key="index"
>
<el-form-item
:label="item.label"
:prop="item.prop"
>
<!-- 数值 -->
<el-input-number
v-if="item.apiBaseType === 'number'"
v-model="formData[item.prop]"
:min="item.minimum || undefined"
:max="item.maximum || undefined"
:maxlength="item.maxLength || undefined"
:minlength="item.minLength || undefined"
:disabled="Boolean(item.disabled)"
:placeholder="item.placeholder || '请输入' + item.label"
@change="changeValue(item.prop,item,$event)"
@clear="clearValue(item.prop,$event)"
></el-input-number>
<!-- 时间转换 -->
<el-date-picker
v-else-if="item.apiBaseType === 'datetime'"
v-model="formData[item.prop]"
type="datetime"
placeholder="选择日期时间"
format="yyyy-MM-dd HH:mm:ss"
value-format="yyyy-MM-ddTHH:mm:ss"
:disabled="Boolean(item.disabled)"
></el-date-picker>
<!-- 布尔枚举 -->
<el-select
v-else-if="item.isEnums || item.apiBaseType === 'boolean'"
v-model="formData[item.prop]"
:placeholder="item.placeholder || '请选择' + item.label"
:disabled="Boolean(item.disabled)"
>
<el-option
v-for="item in getItemEnums(item)"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
<!-- 文本框 -->
<!-- <el-input
v-else
type="textarea"
autosize
resize="none"
v-model="formData[item.prop]"
:placeholder="item.placeholder || '请输入' + item.label"
:disabled="Boolean(item.disabled)"
></el-input> -->
<el-input
v-else
v-model="formData[item.prop]"
:placeholder="item.placeholder || '请输入' + item.label"
:disabled="Boolean(item.disabled)"
></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<!-- 操作按钮 -->
<div slot="footer" class="dialog-footer">
<el-button @click="show = false"> </el-button>
<el-button type="primary" @click="submitHandle()"> </el-button>
</div>
</div>
<!-- 成功提示 -->
<div v-if="active === 1">
<el-result icon="success" title="成功提示" :subTitle="formTitle + '成功'">
<template slot="extra">
<el-button type="primary" size="medium" @click="exitHandle"
>退出</el-button
>
</template>
</el-result>
</div>
<!-- 错误提示 -->
<div v-if="active === 2">
<el-result icon="error" title="错误提示" :subTitle="formTitle + '失败'">
<template slot="extra">
<el-button type="primary" size="medium" @click="changeActive(0)"
>返回</el-button
>
<el-button type="primary" size="medium" @click="exitHandle"
>退出</el-button
>
</template>
</el-result>
</div>
</el-dialog>
</template>
<script>
import { ApiTypePost, ApiTypePut } from "@/api/wms-api"
import { LoadingMixins } from "@/mixins/LoadingMixins";
import { tableMixins } from "@/mixins/TableMixins"
export default {
name:"addEditFromApiPop",
mixins:[ LoadingMixins,tableMixins ],
props: {
//
editRowData:{
type: Object,
default: null
},
// add/edit
handleType:{
type: String,
default: null
},
//
submitForm:{
type:Function,
default:null
},
//
addSubmitUrl:{
type: String,
default: null
},
//
editSubmitUrl:{
type: String,
default: null
}
},
data () {
return {
currentDtos:this.$store.getters.dtoColumnTypes[this.$route.name],
active:0,//0 1 2
show:true,
formTitle:null,//form
formData:{},//
formItemData:null,//item
formRules: {},//
}
},
mounted(){
this.initTitle()
this.initFormItems()
},
methods: {
// form
initTitle(){
if(this.handleType){
this.formTitle = this.handleType == 'add' ? '新增'+this.$route.name : '编辑'+this.$route.name
}
},
// rules
initFormItems(){
let _dtoList_type = this.handleType == 'add' ? 'C' : 'U'
let _dtoList = this.currentDtos[_dtoList_type].dtoList
this.formItemData = JSON.parse(JSON.stringify(_dtoList))
//
if(this.handleType == 'edit' && this.editRowData){
this.formData = JSON.parse(JSON.stringify(this.editRowData))
}else{
this.formData = {}
}
//
this.formRules={}
_dtoList.forEach(item=>{
if(item.isRequired){
this.formRules[item.prop] = [{ required: true, trigger: "blur", message: "不可为空" }]
}
})
},
//
getItemEnums(item){
let _option = []
//
if(item.apiBaseType == 'boolean'){
_option = [{
value: true,
label: '是'
},{
value: false,
label: '否'
},]
}
if(item.isEnums){
_option = item.enums_list
}
return _option
},
//
close() {
this.show = false
this.$emit("closePop")
},
//
submitHandle(){
this.$refs.addEditFrom_Ref.validate((valid) => {
if(this.submitForm){
this.submitForm(valid,this.formData,this.handleType,this.formItemData,this.formRules)
return
}
this.Loading.addEditApiLoading = true
if (valid) {
//
if(this.handleType == 'add'){
ApiTypePost(
this.formData,
this.currentDtos.C.actionsUrl
).then(res => {
this.changeActive(1)
}).catch(err => {
this.changeActive(2)
})
}
//
else{
ApiTypePut(
this.formData,
this.formData.id,
this.currentDtos.U.actionsUrl
).then(res => {
this.changeActive(1)
}).catch(err => {
this.changeActive(2)
})
}
} else {
return false;
}
});
},
// 退
exitHandle(){
this.close()
if(this.active == '1')this.oldSkipCount = 1;
this.show = false
this.paging()
this.$nextTick(()=>{
this.active = 0
})
},
//
changeActive(sta){
this.active = sta
this.Loading.addEditApiLoading = false
},
//
changeValue(prop,item,val) {
this.$emit("changeValue", prop, item, val)
},
//
clearValue(prop,item,val) {
this.$emit("clearValue", prop, item, val)
},
}
}
</script>
<style lang="scss" scoped>
::v-deep .el-dialog__header{
padding: 0 !important;
}
::v-deep .el-row{
width: 100%;
}
::v-deep .addEditFrom{
height: calc(100% - 120px);
overflow: auto;
}
::v-deep .el-form-item__label{
float: unset;
}
::v-deep .el-input,.el-select,.el-input-number{
width: 100% !important;
}
.dialog-footer{
padding-top: 15px;
text-align: right;
}
</style>

604
PC/UI.WinIn.FasterZ.Store/src/components/currenTableFlex/index.vue

@ -1,308 +1,322 @@
<template> <template>
<div class="currenTableFlex"> <div class="currenTableFlex">
<div class="headerButtons"> <div class="headerButtons">
<el-button <el-button
type="primary" type="primary"
v-if="showAddBtn" v-if="showAddBtn"
@click="flexOpenAddNew" @click="flexOpenAddNew"
icon="el-icon-plus" icon="el-icon-plus"
size="mini" size="mini"
>添加一行</el-button> >添加一行</el-button>
<slot name="headerBtns"></slot> <slot name="headerBtns"></slot>
</div>
<!-- todo:多选处理selectionTable -->
<umyTable
:isEditable="isEditable"
class="flexTable"
:tableData="flexTableData"
:searchOptions="flexSearchOptions"
:tableColumns="flexTableColumns"
:selectionTable="selectionTable"
:isShowIndex="isShowIndex"
:setUTableHeight="setUTableHeight"
@push="detailsDataPush(arguments)"
>
<template v-if="showAllDeleteButton">
<el-table-column
label="操作"
align="center"
fixed="right"
width="100px"
>
<template slot-scope="scope">
<div
v-if="!scope.row.hide"
class="childTable"
@click="flexRowRemove($event, scope)"
>
<span style="color:red">删除</span>
</div>
</template>
</el-table-column>
</template>
</umyTable>
</div> </div>
<!-- todo:多选处理selectionTable --> </template>
<currenTable <script>
class="flexTable" import currenTable from "@/components/currenTable"
:tableData="flexTableData" import { mixins } from "@/mixins/mixins"
:searchOptions="flexSearchOptions" export default {
:tableColumns="flexTableColumns" name: 'currenTableFlex',
:selectionTable="selectionTable" components: {
:isShowIndex="isShowIndex" currenTable
@push="detailsDataPush(arguments)"
>
<template v-if="showAllDeleteButton">
<el-table-column
label="操作"
align="center"
fixed="right"
width="100px"
>
<template slot-scope="scope">
<div
v-if="!scope.row.hide"
class="childTable"
@click="flexRowRemove($event, scope)"
>
<span style="color:red">删除</span>
</div>
</template>
</el-table-column>
</template>
</currenTable>
</div>
</template>
<script>
import currenTable from "@/components/currenTable"
import { mixins } from "@/mixins/mixins"
export default {
name: 'currenTableFlex',
components: {
currenTable
},
mixins: [
mixins,
],
filters: {
// formData (val) {
// let data = JSON.parse(JSON.stringify(val))
// val.forEach((key, index) => {
// data[index].disabled = "true"
// delete data[index].focus
// if (key.type == "autocomplete" || key.type == "import") {
// data[index].type = "input"
// }
// });
// return data
// },
// formDataDetails (val) {
// let data = JSON.parse(JSON.stringify(val))
// val.forEach((key, index) => {
// data[index].disabled = true
// delete data[index].focus
// delete data[index].rules
// if (key.type == "autocomplete" || key.type == "import") {
// delete data[index].type
// } else if (key.type == "objectAutocomplete") {
// data[index].type = "object"
// } else if (key.prop == "containerCode" && key.type == "input") {
// data[index].disabled = false
// } else if (key.isChange) {
// //
// data[index].disabled = false
// }
// });
// return data
// }
},
props: {
//
showAddBtn:{
type: Boolean,
default: true
}, },
// mixins: [
showAllDeleteButton:{ mixins,
type: Boolean, ],
default: true filters: {
}, // formData (val) {
// // let data = JSON.parse(JSON.stringify(val))
disableAllRow:{ // val.forEach((key, index) => {
type: Boolean, // data[index].disabled = "true"
default: false // delete data[index].focus
// if (key.type == "autocomplete" || key.type == "import") {
// data[index].type = "input"
// }
// });
// return data
// },
// formDataDetails (val) {
// let data = JSON.parse(JSON.stringify(val))
// val.forEach((key, index) => {
// data[index].disabled = true
// delete data[index].focus
// delete data[index].rules
// if (key.type == "autocomplete" || key.type == "import") {
// delete data[index].type
// } else if (key.type == "objectAutocomplete") {
// data[index].type = "object"
// } else if (key.prop == "containerCode" && key.type == "input") {
// data[index].disabled = false
// } else if (key.isChange) {
// //
// data[index].disabled = false
// }
// });
// return data
// }
}, },
flexTableData: { props: {
type: Array, // table
default: () => { isEditable:{
return []; type: Boolean,
default: false
}, },
}, // app-main100%
flexSearchOptions: { setUTableHeight: {
type: Object, type: Number,
default: () => { default: () => {
return {}; return 280;
}
}, },
}, //
flexTableColumns: { showAddBtn:{
type: Array, type: Boolean,
default: () => { default: true
return [];
}, },
}, //
// showAllDeleteButton:{
selectionTable: { type: Boolean,
type: Boolean, default: true
default: false, },
}, //
// disableAllRow:{
isShowIndex: { type: Boolean,
type: Boolean, default: false
default: false, },
}, flexTableData: {
// type: Array,
// formTitle: { default: () => {
// type: String, return [];
// default: '' },
// }, },
// // flexSearchOptions: {
// displayDialog: { type: Object,
// type: Object, default: () => {
// default: () => { return {};
// return { },
// newDialog: false },
// } flexTableColumns: {
// } type: Array,
// }, default: () => {
// // return [];
// CreateFormData: { },
// type: Object, },
// default: () => { //
// return {} selectionTable: {
// } type: Boolean,
// }, default: false,
// //form },
// CreateForm: { //
// type: Array, isShowIndex: {
// default: () => { type: Boolean,
// return [] default: false,
// } },
// }, //
// // // formTitle: {
// previewFormData: { // type: String,
// type: Object, // default: ''
// default: () => { // },
// return {} // //
// } // displayDialog: {
// }, // type: Object,
// Rules: { // default: () => {
// type: Object, // return {
// default: () => { // newDialog: false
// return {} // }
// } // }
// }, // },
// // // //
// Options: { // CreateFormData: {
// type: Object, // type: Object,
// default: () => { // default: () => {
// return {} // return {}
// } // }
// }, // },
// //table // //form
// detailsTableColumns: { // CreateForm: {
// type: Array, // type: Array,
// default: () => { // default: () => {
// return [] // return []
// } // }
// }, // },
// // // //
// childTableData: { // previewFormData: {
// type: Array, // type: Object,
// default: () => { // default: () => {
// return [] // return {}
// } // }
// }, // },
// // // Rules: {
// successHandle: { // type: Object,
// type: Array, // default: () => {
// default: () => { // return {}
// return [] // }
// } // },
// }, // //
// // // Options: {
// stepArray: { // type: Object,
// type: Array, // default: () => {
// default: () => { // return {}
// return ["", "", "", ""] // }
// } // },
// }, // //table
// // // detailsTableColumns: {
// addClickButton: { // type: Array,
// type: Boolean, // default: () => {
// default: () => { // return []
// return true // }
// } // },
// }, // //
// // // childTableData: {
// isShowDeleteButton: { // type: Array,
// type: Boolean, // default: () => {
// default: () => { // return []
// return true // }
// } // },
// }, // //
// // // successHandle: {
// isHideFirstActiveCancel:{ // type: Array,
// type: Boolean, // default: () => {
// default: () => { // return []
// return false // }
// } // },
// }, // //
// // // stepArray: {
// showPreviewFormDeleteButton:{ // type: Array,
// type: Boolean, // default: () => {
// default: () => { // return ["", "", "", ""]
// return false // }
// } // },
// } // //
}, // addClickButton: {
data () { // type: Boolean,
return { // default: () => {
// // return true
addEmptyRow:null, // }
// active: 0, // },
// formReveal: 1, // //
// activeStep: 1, // isShowDeleteButton: {
// pageStatus: '', // type: Boolean,
// addClick: this.addClickButton,// // default: () => {
// showDeleteButton: this.isShowDeleteButton,//- // return true
// hideFirstActiveCancel:this.isHideFirstActiveCancel,// // }
// loading: false, // },
// session: null, // //
// step: this.stepArray, // isHideFirstActiveCancel:{
// editHandle: [ // type: Boolean,
// { label: "", name: "cancel" }, // default: () => {
// { label: "", type: "primary", name: "determine" }, // return false
// ], // }
} // },
}, // //
mounted () { // showPreviewFormDeleteButton:{
// this.session = JSON.parse(JSON.stringify(this.CreateFormData)) // type: Boolean,
// if(this.hideFirstActiveCancel){ // default: () => {
// this.editHandle=[ // return false
// { label: "", type: "primary", name: "determine" },
// ];
// }
},
methods: {
//
flexOpenAddNew() {
let _oneRow = Object.assign({}, this.flexTableData[0])
for(let key in _oneRow){
_oneRow[key] = null
}
this.flexTableData.push(_oneRow)
// if(this.flexTableData.length <= 0)return
// if(!this.addEmptyRow){
// let _oneRow = Object.assign({}, this.flexTableData[0])
// for(let key in _oneRow){
// _oneRow[key] = null
// } // }
// this.addEmptyRow = _oneRow
// this.addEmptyRow['disabled']=false
// } // }
// this.flexTableData.push(this.addEmptyRow)
}, },
// data () {
flexRowRemove(e, val) { return {
this.$confirm('您确定删除吗, 是否继续?', '提示', { //
confirmButtonText: '确定', addEmptyRow:null,
cancelButtonText: '取消', // active: 0,
type: 'warning' // formReveal: 1,
}).then(() => { // activeStep: 1,
this.flexTableData.splice(val.$index, 1) // pageStatus: '',
}).catch(() => { // addClick: this.addClickButton,//
// showDeleteButton: this.isShowDeleteButton,//-
}); // hideFirstActiveCancel:this.isHideFirstActiveCancel,//
}, // loading: false,
//selection // session: null,
handleSelectionChange(val) { // step: this.stepArray,
this.$emit("handleSelectionChange", val); // editHandle: [
// { label: "", name: "cancel" },
// { label: "", type: "primary", name: "determine" },
// ],
}
}, },
// //autoComplete mounted () {
detailsDataPush (val) { // this.session = JSON.parse(JSON.stringify(this.CreateFormData))
this.$emit("detailsDataPush", val) // if(this.hideFirstActiveCancel){
// this.editHandle=[
// { label: "", type: "primary", name: "determine" },
// ];
// }
}, },
methods: {
//
flexOpenAddNew() {
let _oneRow = Object.assign({}, this.flexTableData[0])
for(let key in _oneRow){
_oneRow[key] = null
}
this.flexTableData.push(_oneRow)
// if(this.flexTableData.length <= 0)return
// if(!this.addEmptyRow){
// let _oneRow = Object.assign({}, this.flexTableData[0])
// for(let key in _oneRow){
// _oneRow[key] = null
// }
// this.addEmptyRow = _oneRow
// this.addEmptyRow['disabled']=false
// }
// this.flexTableData.push(this.addEmptyRow)
},
//
flexRowRemove(e, val) {
this.$confirm('您确定删除吗, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.flexTableData.splice(val.$index, 1)
}).catch(() => {
});
},
//selection
handleSelectionChange(val) {
this.$emit("handleSelectionChange", val);
},
// //autoComplete
detailsDataPush (val) {
this.$emit("detailsDataPush", val)
},
}
} }
} </script>
</script> <style lang="scss" scoped>
<style lang="scss" scoped> @import "./style/index.scss";
@import "./style/index.scss"; </style>
</style>

198
PC/UI.WinIn.FasterZ.Store/src/components/umyTable/index.vue

@ -13,11 +13,118 @@
style="width: 100%" style="width: 100%"
:cell-style="cellStyle" :cell-style="cellStyle"
use-virtual use-virtual
:row-height="50"
:height="uTableHeight" :height="uTableHeight"
header-row-class-name="uTableHeader" header-row-class-name="uTableHeader"
> >
<!-- :tree-props="treeProps" height 不能共存 此组件暂不支持tree的格式--> <!-- :tree-props="treeProps" height 不能共存 此组件暂不支持tree的格式-->
<u-table-column v-if="selectionTable" fixed="left" type="selection" :reserve-selection="true" />
<u-table-column v-if="isShowIndex" type="index" fixed="left" label="序号" width="50" />
<template v-for="(item, index) in TableSize">
<u-table-column
min-width="150"
:key="index"
:prop="item.showProp ? item.prop + '.' + item.showProp : item.prop"
:sortable="item.sortable"
:fixed="setItemFixed(item,index)"
:show-overflow-tooltip="showOverflowTooltip"
:width="item.width"
:align="item.tableAlign"
:header-align="item.tableHeaderAlign"
v-if="item.istrue==null?true:item.istrue"
>
<template #header>
<span>{{ item.label }}</span>
<i style="color: #f56c6c" v-if="item.rules && requiredRules">*</i>
</template>
<template slot-scope="scope">
<!-- 正常表格回显 -->
<div v-if="!isEditable">
<!-- 时间转换 -->
<span v-if="item.apiBaseType == 'datetime'"
@click="showDetailInfo(scope.row[item.prop],'time')"
style="cursor: pointer;"
:title="'点击查看详情'"
class="showDetailHover itemSpan"
>
{{ scope.row[item.prop] | formatDate }}
</span>
<!-- 枚举 -->
<span v-else-if="item.isEnums" class="itemSpan">
{{ initApiEnumList(item,scope.row[item.prop]) }}
</span>
<!-- 布尔 -->
<span v-else-if="item.apiBaseType == 'boolean'" class="itemSpan">
{{ scope.row[item.prop] ? '是' : '否' }}
</span>
<!-- 数值 -->
<span v-else-if="item.apiBaseType == 'number'" class="itemSpan">
{{ scope.row[item.prop] }}
</span>
<!-- 点击可出详情 | 点击可点出json 目前已知String|Guid-->
<span v-else
class="itemSpan"
@click="showTypeHandle(initApiOtherType(scope.row[item.prop])[1],scope.row[item.prop])"
:style="initApiOtherType(scope.row[item.prop])[1] != 'show' ? 'cursor: pointer' : ''"
:title="'点击查看详情'"
:class="{ showDetailHover: initApiOtherType(scope.row[item.prop])[1] != 'show' }"
>
{{ initApiOtherType(scope.row[item.prop])[0] }}
</span>
</div>
<!-- 可编辑表格 -->
<div v-else>
<!-- 时间转换 -->
<el-date-picker
v-if="item.apiBaseType === 'datetime'"
v-model="scope.row[item.prop]"
type="datetime"
placeholder="选择日期时间"
format="yyyy-MM-dd HH:mm:ss"
value-format="yyyy-MM-ddTHH:mm:ss"
:disabled="Boolean(item.disabled)"
size="mini"
></el-date-picker>
<!-- 布尔枚举 -->
<el-select
v-else-if="item.isEnums || item.apiBaseType === 'boolean'"
v-model="scope.row[item.prop]"
:placeholder="item.placeholder || '请选择' + item.label"
:disabled="Boolean(item.disabled)"
size="mini"
>
<el-option
v-for="item in getItemEnums(item)"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
<!-- 数值 -->
<el-input-number
v-else-if="item.apiBaseType === 'number'"
v-model="scope.row[item.prop]"
:min="item.minimum || undefined"
:max="item.maximum || undefined"
:maxlength="item.maxLength || undefined"
:minlength="item.minLength || undefined"
:disabled="Boolean(item.disabled)"
:placeholder="item.placeholder || '请输入' + item.label"
@change="changeValue(item.prop,item,$event)"
@clear="clearValue(item.prop,$event)"
size="mini"
></el-input-number>
<!-- 文本值 -->
<el-input
v-else
v-model="scope.row[item.prop]"
:placeholder="item.placeholder || '请输入' + item.label"
:disabled="Boolean(item.disabled)"
size="mini"
></el-input>
</div>
</template>
</u-table-column>
</template>
<!-- 操作列 左侧--> <!-- 操作列 左侧-->
<u-table-column <u-table-column
v-if="buttonOperationList_left" v-if="buttonOperationList_left"
@ -64,60 +171,6 @@
>{{itemButton.label}}</el-button> >{{itemButton.label}}</el-button>
</template> </template>
</u-table-column> </u-table-column>
<u-table-column v-if="selectionTable" fixed="left" type="selection" :reserve-selection="true" />
<u-table-column v-if="isShowIndex" type="index" fixed="left" label="序号" width="50" />
<template v-for="(item, index) in TableSize">
<u-table-column
min-width="150"
:key="index"
:prop="item.showProp ? item.prop + '.' + item.showProp : item.prop"
:sortable="item.sortable"
:fixed="setItemFixed(item,index)"
:show-overflow-tooltip="showOverflowTooltip"
:width="item.width"
:align="item.tableAlign"
:header-align="item.tableHeaderAlign"
v-if="item.istrue==null?true:item.istrue"
>
<template #header>
<span>{{ item.label }}</span>
<i style="color: #f56c6c" v-if="item.rules && requiredRules">*</i>
</template>
<template slot-scope="scope">
<!-- 时间转换 -->
<span v-if="item.apiBaseType == 'datetime'"
@click="showDetailInfo(scope.row[item.prop],'time')"
style="cursor: pointer;"
:title="'点击查看详情'"
class="showDetailHover itemSpan"
>
{{ scope.row[item.prop] | formatDate }}
</span>
<!-- 枚举 -->
<span v-else-if="item.isEnums" class="itemSpan">
{{ initApiEnumList(item,scope.row[item.prop]) }}
</span>
<!-- 布尔 -->
<span v-else-if="item.apiBaseType == 'boolean'" class="itemSpan">
{{ scope.row[item.prop] ? '是' : '否' }}
</span>
<!-- 数值 -->
<span v-else-if="item.apiBaseType == 'number'" class="itemSpan">
{{ scope.row[item.prop] }}
</span>
<!-- 点击可出详情 | 点击可点出json 目前已知String|Guid-->
<span v-else
class="itemSpan"
@click="showTypeHandle(initApiOtherType(scope.row[item.prop])[1],scope.row[item.prop])"
:style="initApiOtherType(scope.row[item.prop])[1] != 'show' ? 'cursor: pointer' : ''"
:title="'点击查看详情'"
:class="{ showDetailHover: initApiOtherType(scope.row[item.prop])[1] != 'show' }"
>
{{ initApiOtherType(scope.row[item.prop])[0] }}
</span>
</template>
</u-table-column>
</template>
<slot></slot> <slot></slot>
<!-- 点开查看全部弹窗 --> <!-- 点开查看全部弹窗 -->
@ -271,6 +324,11 @@ export default {
}, },
}, },
props: { props: {
// table
isEditable:{
type: Boolean,
default: false
},
// //
buttonOperationList_left:{ buttonOperationList_left:{
type: Array, type: Array,
@ -788,6 +846,32 @@ export default {
if(type == 'detail')this.showDetailInfo(row) if(type == 'detail')this.showDetailInfo(row)
if(type == 'json')this.showJsonTable(row) if(type == 'json')this.showJsonTable(row)
}, },
//
getItemEnums(item){
let _option = []
//
if(item.apiBaseType == 'boolean'){
_option = [{
value: true,
label: '是'
},{
value: false,
label: '否'
},]
}
if(item.isEnums){
_option = item.enums_list
}
return _option
},
//
changeValue(prop,item,val) {
this.$emit("changeValue", prop, item, val)
},
//
clearValue(prop,item,val) {
this.$emit("clearValue", prop, item, val)
},
}, },
}; };
</script> </script>
@ -805,8 +889,8 @@ export default {
} }
::v-deep .el-table__fixed { ::v-deep .el-table__fixed {
display: block-inline !important; display: block-inline !important;
height: auto !important; height: 100% !important;
bottom: 13px !important; // bottom: 13px !important;
.el-table__fixed-header-wrapper { .el-table__fixed-header-wrapper {
z-index: auto !important; z-index: auto !important;
} }

2
PC/UI.WinIn.FasterZ.Store/src/store/modules/definition.js

@ -74,7 +74,7 @@ export function initDtoTypesAndEnums(res,typeName,apiName) {
} }
} }
d.baseApiName = apiName + d.name d.baseApiName = apiName + d.name
d.label = zhApiColumnsLable(apiName + d.name,res.types) || d.name d.label = zhApiColumnsLable(apiName + d.name) || d.name
d.prop = firstWordSizeChange(d.name) d.prop = firstWordSizeChange(d.name)
}) })
return _dtos return _dtos

218
PC/UI.WinIn.FasterZ.Store/src/views/demo/demo_api_handle.vue

@ -1,112 +1,112 @@
<template> <template>
<div class="page-box" v-loading="Loading.tableLoading"> <div class="page-box" v-loading="Loading.tableLoading">
<!-- DEMO:只有主表查询 API新增编辑删除 --> <!-- DEMO: API新增编辑删除 根据details判断是否有子表编辑-->
<tablePagination <tablePagination
v-if="apiColumns_Table" v-if="apiColumns_Table"
:currenButtonData="currenButtonData" :currenButtonData="currenButtonData"
:tableData="tableData" :tableData="tableData"
:tableLoading="Loading.tableLoading" :tableLoading="Loading.tableLoading"
:tableColumns="apiColumns_Table" :tableColumns="apiColumns_Table"
@rowDrop="rowDrop" @rowDrop="rowDrop"
:totalCount="totalCount" :totalCount="totalCount"
:multipleSelection="multipleSelection" :multipleSelection="multipleSelection"
:MaxResultCount="PageListParams.MaxResultCount" :MaxResultCount="PageListParams.MaxResultCount"
@topbutton="topbutton" @topbutton="topbutton"
@inlineDialog="inlineDialog" @inlineDialog="inlineDialog"
@sortChange="sortChange" @sortChange="sortChange"
@alertoldSkipCount="alertoldSkipCount" @alertoldSkipCount="alertoldSkipCount"
@alterResultCount="alterResultCount" @alterResultCount="alterResultCount"
@handleSelectionChange="handleSelectionChange" @handleSelectionChange="handleSelectionChange"
:currentPageProps="oldSkipCount" :currentPageProps="oldSkipCount"
:quicklySearchOption="quicklySearchOption" :quicklySearchOption="quicklySearchOption"
@quicklySearchClick="quicklySearchClick" @quicklySearchClick="quicklySearchClick"
@quicklySearchClear="quicklySearchClear" @quicklySearchClear="quicklySearchClear"
:primarySearchOption="primarySearchOption" :primarySearchOption="primarySearchOption"
@overallSearchFormClick="overallSearchFormClick" @overallSearchFormClick="overallSearchFormClick"
:httpOverallSearchData="httpOverallSearchData" :httpOverallSearchData="httpOverallSearchData"
:buttonOperationList_left="buttonOperationClick_leftBase" :buttonOperationList_left="buttonOperationClick_leftBase"
@buttonOperationClick_left="buttonOperationClick_left" @buttonOperationClick_left="buttonOperationClick_left"
:buttonOperationList_right="(data)=>{return buttonOperationList_rightApi(data,'edit|delete')}" :buttonOperationList_right="(data)=>{return buttonOperationList_rightApi(data,'edit|delete')}"
@buttonOperationClick_right="buttonOperationClick_right" @buttonOperationClick_right="buttonOperationClick_right"
></tablePagination> ></tablePagination>
<curren-Drawer <curren-Drawer
ref="currenDrawer_Ref" ref="currenDrawer_Ref"
:title="apiColumns_DesTions" :title="apiColumns_DesTions"
@rowDrop="rowDrop" @rowDrop="rowDrop"
:tableColumns="apiColumns_DetailsTable" :tableColumns="apiColumns_DetailsTable"
:tabsDesTions="apiColumns_DesTions" :tabsDesTions="apiColumns_DesTions"
:DrawerLoading="Loading.DrawerLoading" :DrawerLoading="Loading.DrawerLoading"
:drawer="displayDialog.detailsDialog" :drawer="displayDialog.detailsDialog"
:propsData="propsData" :propsData="propsData"
:Butttondata="[]" :Butttondata="[]"
@drawerShut="(val) => (displayDialog.detailsDialog = val)" @drawerShut="(val) => (displayDialog.detailsDialog = val)"
@drawerbutton="drawerbutton" @drawerbutton="drawerbutton"
@handleCommand="drawerHandle" @handleCommand="drawerHandle"
@close-value="closeValue" @close-value="closeValue"
:totalCount="totalCountDetails" :totalCount="totalCountDetails"
:currentPage="oldSkipCountDetails" :currentPage="oldSkipCountDetails"
:MaxResultCount="MaxResultCountDetails" :MaxResultCount="MaxResultCountDetails"
@alterResultCountDetails="alterResultCountDetails" @alterResultCountDetails="alterResultCountDetails"
@alertoldSkipCountDetails="alertoldSkipCountDetails" @alertoldSkipCountDetails="alertoldSkipCountDetails"
:buttonOperationList_left="operationButtonsDetail" :buttonOperationList_left="operationButtonsDetail"
></curren-Drawer> ></curren-Drawer>
<!-- 导出弹窗 --> <!-- 导出弹窗 -->
<exportDrop <exportDrop
v-if="displayDialog.exportDialog" v-if="displayDialog.exportDialog"
@closeDialog="closeExportDrop" @closeDialog="closeExportDrop"
@exportDropSubmit="exportDropSubmit" @exportDropSubmit="exportDropSubmit"
></exportDrop> ></exportDrop>
<!-- Api新增 --> <!-- Api新增 -->
<addEditFromApiPop <addEditFromApiPop
v-if="displayDialog.addEditApiDialog" v-if="displayDialog.addEditApiDialog"
:handleType="addEditApiType" :handleType="addEditApiType"
:editRowData="editFromApiRowData" :editRowData="editFromApiRowData"
@closePop="closeAddEditApiPop" @closePop="closeAddEditApiPop"
></addEditFromApiPop> ></addEditFromApiPop>
</div> </div>
</template> </template>
<script> <script>
import { tableMixins } from "@/mixins/TableMixins"; import { tableMixins } from "@/mixins/TableMixins";
import { LoadingMixins } from "@/mixins/LoadingMixins"; import { LoadingMixins } from "@/mixins/LoadingMixins";
import { drawerMixins } from "@/mixins/drawerMixins" import { drawerMixins } from "@/mixins/drawerMixins"
import { TableHeaderMixins } from "@/mixins/TableHeaderMixins"; import { TableHeaderMixins } from "@/mixins/TableHeaderMixins";
import { mixins } from "@/mixins/mixins"; import { mixins } from "@/mixins/mixins";
import { filterSelectMixins } from '@/mixins/filter-Select' import { filterSelectMixins } from '@/mixins/filter-Select'
import { getToken } from '@/utils/auth' import { getToken } from '@/utils/auth'
export default { export default {
name: "IncomingData", name: "IncomingData",
mixins: [ mixins: [
tableMixins, tableMixins,
LoadingMixins, LoadingMixins,
drawerMixins, drawerMixins,
TableHeaderMixins, TableHeaderMixins,
mixins, mixins,
filterSelectMixins, filterSelectMixins,
], ],
data() { data() {
return { return {
// //
currenButtonData: [ currenButtonData: [
this.defaultAddBtn({ this.defaultAddBtn({
name:'addFromApi' name:'addFromApi'
}),// }),//
this.defaultExportBtn({ this.defaultExportBtn({
isRedundance:true, isRedundance:true,
isDetailExport:true isDetailExport:true
}),// }),//
this.defaultFieldSettingBtn(),// this.defaultFieldSettingBtn(),//
this.defaultFreshBtn(),// this.defaultFreshBtn(),//
this.defaultFilterBtn(),// this.defaultFilterBtn(),//
], ],
}; };
}, },
mounted() { mounted() {
this.paging(); this.paging();
}, },
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "@/styles/basicData.scss"; @import "@/styles/basicData.scss";
</style> </style>
Loading…
Cancel
Save