安虹睿
1 year ago
6 changed files with 1018 additions and 543 deletions
@ -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> |
@ -1,308 +1,322 @@ |
|||
<template> |
|||
<div class="currenTableFlex"> |
|||
<div class="headerButtons"> |
|||
<el-button |
|||
type="primary" |
|||
v-if="showAddBtn" |
|||
@click="flexOpenAddNew" |
|||
icon="el-icon-plus" |
|||
size="mini" |
|||
>添加一行</el-button> |
|||
<slot name="headerBtns"></slot> |
|||
<div class="currenTableFlex"> |
|||
<div class="headerButtons"> |
|||
<el-button |
|||
type="primary" |
|||
v-if="showAddBtn" |
|||
@click="flexOpenAddNew" |
|||
icon="el-icon-plus" |
|||
size="mini" |
|||
>添加一行</el-button> |
|||
<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> |
|||
<!-- todo:多选处理【selectionTable】 --> |
|||
<currenTable |
|||
class="flexTable" |
|||
:tableData="flexTableData" |
|||
:searchOptions="flexSearchOptions" |
|||
:tableColumns="flexTableColumns" |
|||
:selectionTable="selectionTable" |
|||
:isShowIndex="isShowIndex" |
|||
@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 |
|||
</template> |
|||
<script> |
|||
import currenTable from "@/components/currenTable" |
|||
import { mixins } from "@/mixins/mixins" |
|||
export default { |
|||
name: 'currenTableFlex', |
|||
components: { |
|||
currenTable |
|||
}, |
|||
// 是否显示删除按钮(控制全部列) |
|||
showAllDeleteButton:{ |
|||
type: Boolean, |
|||
default: true |
|||
}, |
|||
// 是否禁止编辑行(控制全部行) |
|||
disableAllRow:{ |
|||
type: Boolean, |
|||
default: false |
|||
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 |
|||
// } |
|||
}, |
|||
flexTableData: { |
|||
type: Array, |
|||
default: () => { |
|||
return []; |
|||
props: { |
|||
// table内表单数据是否可编辑 |
|||
isEditable:{ |
|||
type: Boolean, |
|||
default: false |
|||
}, |
|||
}, |
|||
flexSearchOptions: { |
|||
type: Object, |
|||
default: () => { |
|||
return {}; |
|||
// 已app-main高度为100% 需要减掉的高度 |
|||
setUTableHeight: { |
|||
type: Number, |
|||
default: () => { |
|||
return 280; |
|||
} |
|||
}, |
|||
}, |
|||
flexTableColumns: { |
|||
type: Array, |
|||
default: () => { |
|||
return []; |
|||
// 是否显示添加一行按钮 |
|||
showAddBtn:{ |
|||
type: Boolean, |
|||
default: true |
|||
}, |
|||
}, |
|||
// 是否显示多选 |
|||
selectionTable: { |
|||
type: Boolean, |
|||
default: false, |
|||
}, |
|||
// 是否显示序号列 |
|||
isShowIndex: { |
|||
type: Boolean, |
|||
default: false, |
|||
}, |
|||
//名称 |
|||
// formTitle: { |
|||
// type: String, |
|||
// default: '' |
|||
// }, |
|||
// //是否弹窗 |
|||
// displayDialog: { |
|||
// type: Object, |
|||
// default: () => { |
|||
// return { |
|||
// newDialog: false |
|||
// } |
|||
// } |
|||
// }, |
|||
// //主表提交数据 |
|||
// CreateFormData: { |
|||
// type: Object, |
|||
// default: () => { |
|||
// return {} |
|||
// } |
|||
// }, |
|||
// //主表显示form |
|||
// CreateForm: { |
|||
// type: Array, |
|||
// default: () => { |
|||
// return [] |
|||
// } |
|||
// }, |
|||
// //预览数据 |
|||
// previewFormData: { |
|||
// type: Object, |
|||
// default: () => { |
|||
// return {} |
|||
// } |
|||
// }, |
|||
// Rules: { |
|||
// type: Object, |
|||
// default: () => { |
|||
// return {} |
|||
// } |
|||
// }, |
|||
// //下拉选择 |
|||
// Options: { |
|||
// type: Object, |
|||
// default: () => { |
|||
// return {} |
|||
// } |
|||
// }, |
|||
// //子表table显示 |
|||
// detailsTableColumns: { |
|||
// type: Array, |
|||
// default: () => { |
|||
// return [] |
|||
// } |
|||
// }, |
|||
// //子表提交数据 |
|||
// childTableData: { |
|||
// type: Array, |
|||
// default: () => { |
|||
// return [] |
|||
// } |
|||
// }, |
|||
// //成功后的操作 |
|||
// successHandle: { |
|||
// type: Array, |
|||
// default: () => { |
|||
// return [] |
|||
// } |
|||
// }, |
|||
// //步骤标题 |
|||
// stepArray: { |
|||
// type: Array, |
|||
// default: () => { |
|||
// return ["总体信息", "明细", "预览", "结果"] |
|||
// } |
|||
// }, |
|||
// //添加一行 |
|||
// addClickButton: { |
|||
// type: Boolean, |
|||
// default: () => { |
|||
// return true |
|||
// } |
|||
// }, |
|||
// //删除行记录 |
|||
// isShowDeleteButton: { |
|||
// type: Boolean, |
|||
// default: () => { |
|||
// return true |
|||
// } |
|||
// }, |
|||
// // 隐藏第一步骤的取消按钮 |
|||
// isHideFirstActiveCancel:{ |
|||
// type: Boolean, |
|||
// default: () => { |
|||
// return false |
|||
// } |
|||
// }, |
|||
// // 预览视图显示删除按钮 |
|||
// showPreviewFormDeleteButton:{ |
|||
// type: Boolean, |
|||
// default: () => { |
|||
// return false |
|||
// } |
|||
// } |
|||
}, |
|||
data () { |
|||
return { |
|||
// 添加一行的空置 |
|||
addEmptyRow:null, |
|||
// active: 0, |
|||
// formReveal: 1, |
|||
// activeStep: 1, |
|||
// pageStatus: '', |
|||
// addClick: this.addClickButton,//添加一行按钮 |
|||
// showDeleteButton: this.isShowDeleteButton,//操作-删除按钮 |
|||
// hideFirstActiveCancel:this.isHideFirstActiveCancel,// 隐藏第一步骤的取消按钮 |
|||
// loading: false, |
|||
// session: null, |
|||
// step: this.stepArray, |
|||
// editHandle: [ |
|||
// { label: "取消", name: "cancel" }, |
|||
// { label: "下一步", type: "primary", name: "determine" }, |
|||
// ], |
|||
} |
|||
}, |
|||
mounted () { |
|||
// this.session = JSON.parse(JSON.stringify(this.CreateFormData)) |
|||
// 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 |
|||
// 是否显示删除按钮(控制全部列) |
|||
showAllDeleteButton:{ |
|||
type: Boolean, |
|||
default: true |
|||
}, |
|||
// 是否禁止编辑行(控制全部行) |
|||
disableAllRow:{ |
|||
type: Boolean, |
|||
default: false |
|||
}, |
|||
flexTableData: { |
|||
type: Array, |
|||
default: () => { |
|||
return []; |
|||
}, |
|||
}, |
|||
flexSearchOptions: { |
|||
type: Object, |
|||
default: () => { |
|||
return {}; |
|||
}, |
|||
}, |
|||
flexTableColumns: { |
|||
type: Array, |
|||
default: () => { |
|||
return []; |
|||
}, |
|||
}, |
|||
// 是否显示多选 |
|||
selectionTable: { |
|||
type: Boolean, |
|||
default: false, |
|||
}, |
|||
// 是否显示序号列 |
|||
isShowIndex: { |
|||
type: Boolean, |
|||
default: false, |
|||
}, |
|||
//名称 |
|||
// formTitle: { |
|||
// type: String, |
|||
// default: '' |
|||
// }, |
|||
// //是否弹窗 |
|||
// displayDialog: { |
|||
// type: Object, |
|||
// default: () => { |
|||
// return { |
|||
// newDialog: false |
|||
// } |
|||
// } |
|||
// }, |
|||
// //主表提交数据 |
|||
// CreateFormData: { |
|||
// type: Object, |
|||
// default: () => { |
|||
// return {} |
|||
// } |
|||
// }, |
|||
// //主表显示form |
|||
// CreateForm: { |
|||
// type: Array, |
|||
// default: () => { |
|||
// return [] |
|||
// } |
|||
// }, |
|||
// //预览数据 |
|||
// previewFormData: { |
|||
// type: Object, |
|||
// default: () => { |
|||
// return {} |
|||
// } |
|||
// }, |
|||
// Rules: { |
|||
// type: Object, |
|||
// default: () => { |
|||
// return {} |
|||
// } |
|||
// }, |
|||
// //下拉选择 |
|||
// Options: { |
|||
// type: Object, |
|||
// default: () => { |
|||
// return {} |
|||
// } |
|||
// }, |
|||
// //子表table显示 |
|||
// detailsTableColumns: { |
|||
// type: Array, |
|||
// default: () => { |
|||
// return [] |
|||
// } |
|||
// }, |
|||
// //子表提交数据 |
|||
// childTableData: { |
|||
// type: Array, |
|||
// default: () => { |
|||
// return [] |
|||
// } |
|||
// }, |
|||
// //成功后的操作 |
|||
// successHandle: { |
|||
// type: Array, |
|||
// default: () => { |
|||
// return [] |
|||
// } |
|||
// }, |
|||
// //步骤标题 |
|||
// stepArray: { |
|||
// type: Array, |
|||
// default: () => { |
|||
// return ["总体信息", "明细", "预览", "结果"] |
|||
// } |
|||
// }, |
|||
// //添加一行 |
|||
// addClickButton: { |
|||
// type: Boolean, |
|||
// default: () => { |
|||
// return true |
|||
// } |
|||
// }, |
|||
// //删除行记录 |
|||
// isShowDeleteButton: { |
|||
// type: Boolean, |
|||
// default: () => { |
|||
// return true |
|||
// } |
|||
// }, |
|||
// // 隐藏第一步骤的取消按钮 |
|||
// isHideFirstActiveCancel:{ |
|||
// type: Boolean, |
|||
// default: () => { |
|||
// return false |
|||
// } |
|||
// }, |
|||
// // 预览视图显示删除按钮 |
|||
// showPreviewFormDeleteButton:{ |
|||
// type: Boolean, |
|||
// default: () => { |
|||
// return false |
|||
// } |
|||
// 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); |
|||
data () { |
|||
return { |
|||
// 添加一行的空置 |
|||
addEmptyRow:null, |
|||
// active: 0, |
|||
// formReveal: 1, |
|||
// activeStep: 1, |
|||
// pageStatus: '', |
|||
// addClick: this.addClickButton,//添加一行按钮 |
|||
// showDeleteButton: this.isShowDeleteButton,//操作-删除按钮 |
|||
// hideFirstActiveCancel:this.isHideFirstActiveCancel,// 隐藏第一步骤的取消按钮 |
|||
// loading: false, |
|||
// session: null, |
|||
// step: this.stepArray, |
|||
// editHandle: [ |
|||
// { label: "取消", name: "cancel" }, |
|||
// { label: "下一步", type: "primary", name: "determine" }, |
|||
// ], |
|||
} |
|||
}, |
|||
// //autoComplete子表 |
|||
detailsDataPush (val) { |
|||
this.$emit("detailsDataPush", val) |
|||
mounted () { |
|||
// this.session = JSON.parse(JSON.stringify(this.CreateFormData)) |
|||
// 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> |
|||
<style lang="scss" scoped> |
|||
@import "./style/index.scss"; |
|||
</style> |
|||
</script> |
|||
<style lang="scss" scoped> |
|||
@import "./style/index.scss"; |
|||
</style> |
@ -1,112 +1,112 @@ |
|||
<template> |
|||
<div class="page-box" v-loading="Loading.tableLoading"> |
|||
<!-- DEMO:只有主表查询 API新增编辑删除 --> |
|||
<tablePagination |
|||
v-if="apiColumns_Table" |
|||
:currenButtonData="currenButtonData" |
|||
:tableData="tableData" |
|||
:tableLoading="Loading.tableLoading" |
|||
:tableColumns="apiColumns_Table" |
|||
@rowDrop="rowDrop" |
|||
:totalCount="totalCount" |
|||
:multipleSelection="multipleSelection" |
|||
:MaxResultCount="PageListParams.MaxResultCount" |
|||
@topbutton="topbutton" |
|||
@inlineDialog="inlineDialog" |
|||
@sortChange="sortChange" |
|||
@alertoldSkipCount="alertoldSkipCount" |
|||
@alterResultCount="alterResultCount" |
|||
@handleSelectionChange="handleSelectionChange" |
|||
:currentPageProps="oldSkipCount" |
|||
:quicklySearchOption="quicklySearchOption" |
|||
@quicklySearchClick="quicklySearchClick" |
|||
@quicklySearchClear="quicklySearchClear" |
|||
:primarySearchOption="primarySearchOption" |
|||
@overallSearchFormClick="overallSearchFormClick" |
|||
:httpOverallSearchData="httpOverallSearchData" |
|||
:buttonOperationList_left="buttonOperationClick_leftBase" |
|||
@buttonOperationClick_left="buttonOperationClick_left" |
|||
:buttonOperationList_right="(data)=>{return buttonOperationList_rightApi(data,'edit|delete')}" |
|||
@buttonOperationClick_right="buttonOperationClick_right" |
|||
></tablePagination> |
|||
<curren-Drawer |
|||
ref="currenDrawer_Ref" |
|||
:title="apiColumns_DesTions" |
|||
@rowDrop="rowDrop" |
|||
:tableColumns="apiColumns_DetailsTable" |
|||
:tabsDesTions="apiColumns_DesTions" |
|||
:DrawerLoading="Loading.DrawerLoading" |
|||
:drawer="displayDialog.detailsDialog" |
|||
:propsData="propsData" |
|||
:Butttondata="[]" |
|||
@drawerShut="(val) => (displayDialog.detailsDialog = val)" |
|||
@drawerbutton="drawerbutton" |
|||
@handleCommand="drawerHandle" |
|||
@close-value="closeValue" |
|||
:totalCount="totalCountDetails" |
|||
:currentPage="oldSkipCountDetails" |
|||
:MaxResultCount="MaxResultCountDetails" |
|||
@alterResultCountDetails="alterResultCountDetails" |
|||
@alertoldSkipCountDetails="alertoldSkipCountDetails" |
|||
:buttonOperationList_left="operationButtonsDetail" |
|||
></curren-Drawer> |
|||
<!-- 导出弹窗 --> |
|||
<exportDrop |
|||
v-if="displayDialog.exportDialog" |
|||
@closeDialog="closeExportDrop" |
|||
@exportDropSubmit="exportDropSubmit" |
|||
></exportDrop> |
|||
<!-- Api新增 --> |
|||
<addEditFromApiPop |
|||
v-if="displayDialog.addEditApiDialog" |
|||
:handleType="addEditApiType" |
|||
:editRowData="editFromApiRowData" |
|||
@closePop="closeAddEditApiPop" |
|||
></addEditFromApiPop> |
|||
</div> |
|||
</template> |
|||
<script> |
|||
import { tableMixins } from "@/mixins/TableMixins"; |
|||
import { LoadingMixins } from "@/mixins/LoadingMixins"; |
|||
import { drawerMixins } from "@/mixins/drawerMixins" |
|||
import { TableHeaderMixins } from "@/mixins/TableHeaderMixins"; |
|||
import { mixins } from "@/mixins/mixins"; |
|||
import { filterSelectMixins } from '@/mixins/filter-Select' |
|||
import { getToken } from '@/utils/auth' |
|||
|
|||
|
|||
export default { |
|||
name: "IncomingData", |
|||
mixins: [ |
|||
tableMixins, |
|||
LoadingMixins, |
|||
drawerMixins, |
|||
TableHeaderMixins, |
|||
mixins, |
|||
filterSelectMixins, |
|||
], |
|||
data() { |
|||
return { |
|||
//常用按钮数据 |
|||
currenButtonData: [ |
|||
this.defaultAddBtn({ |
|||
name:'addFromApi' |
|||
}),//新增 |
|||
this.defaultExportBtn({ |
|||
isRedundance:true, |
|||
isDetailExport:true |
|||
}),//导出 |
|||
this.defaultFieldSettingBtn(),//字段设置 |
|||
this.defaultFreshBtn(),//刷新 |
|||
this.defaultFilterBtn(),//筛选 |
|||
], |
|||
}; |
|||
}, |
|||
mounted() { |
|||
this.paging(); |
|||
}, |
|||
} |
|||
</script> |
|||
<style lang="scss" scoped> |
|||
@import "@/styles/basicData.scss"; |
|||
</style> |
|||
<div class="page-box" v-loading="Loading.tableLoading"> |
|||
<!-- DEMO: API新增编辑删除 根据details判断是否有子表编辑--> |
|||
<tablePagination |
|||
v-if="apiColumns_Table" |
|||
:currenButtonData="currenButtonData" |
|||
:tableData="tableData" |
|||
:tableLoading="Loading.tableLoading" |
|||
:tableColumns="apiColumns_Table" |
|||
@rowDrop="rowDrop" |
|||
:totalCount="totalCount" |
|||
:multipleSelection="multipleSelection" |
|||
:MaxResultCount="PageListParams.MaxResultCount" |
|||
@topbutton="topbutton" |
|||
@inlineDialog="inlineDialog" |
|||
@sortChange="sortChange" |
|||
@alertoldSkipCount="alertoldSkipCount" |
|||
@alterResultCount="alterResultCount" |
|||
@handleSelectionChange="handleSelectionChange" |
|||
:currentPageProps="oldSkipCount" |
|||
:quicklySearchOption="quicklySearchOption" |
|||
@quicklySearchClick="quicklySearchClick" |
|||
@quicklySearchClear="quicklySearchClear" |
|||
:primarySearchOption="primarySearchOption" |
|||
@overallSearchFormClick="overallSearchFormClick" |
|||
:httpOverallSearchData="httpOverallSearchData" |
|||
:buttonOperationList_left="buttonOperationClick_leftBase" |
|||
@buttonOperationClick_left="buttonOperationClick_left" |
|||
:buttonOperationList_right="(data)=>{return buttonOperationList_rightApi(data,'edit|delete')}" |
|||
@buttonOperationClick_right="buttonOperationClick_right" |
|||
></tablePagination> |
|||
<curren-Drawer |
|||
ref="currenDrawer_Ref" |
|||
:title="apiColumns_DesTions" |
|||
@rowDrop="rowDrop" |
|||
:tableColumns="apiColumns_DetailsTable" |
|||
:tabsDesTions="apiColumns_DesTions" |
|||
:DrawerLoading="Loading.DrawerLoading" |
|||
:drawer="displayDialog.detailsDialog" |
|||
:propsData="propsData" |
|||
:Butttondata="[]" |
|||
@drawerShut="(val) => (displayDialog.detailsDialog = val)" |
|||
@drawerbutton="drawerbutton" |
|||
@handleCommand="drawerHandle" |
|||
@close-value="closeValue" |
|||
:totalCount="totalCountDetails" |
|||
:currentPage="oldSkipCountDetails" |
|||
:MaxResultCount="MaxResultCountDetails" |
|||
@alterResultCountDetails="alterResultCountDetails" |
|||
@alertoldSkipCountDetails="alertoldSkipCountDetails" |
|||
:buttonOperationList_left="operationButtonsDetail" |
|||
></curren-Drawer> |
|||
<!-- 导出弹窗 --> |
|||
<exportDrop |
|||
v-if="displayDialog.exportDialog" |
|||
@closeDialog="closeExportDrop" |
|||
@exportDropSubmit="exportDropSubmit" |
|||
></exportDrop> |
|||
<!-- Api新增 --> |
|||
<addEditFromApiPop |
|||
v-if="displayDialog.addEditApiDialog" |
|||
:handleType="addEditApiType" |
|||
:editRowData="editFromApiRowData" |
|||
@closePop="closeAddEditApiPop" |
|||
></addEditFromApiPop> |
|||
</div> |
|||
</template> |
|||
<script> |
|||
import { tableMixins } from "@/mixins/TableMixins"; |
|||
import { LoadingMixins } from "@/mixins/LoadingMixins"; |
|||
import { drawerMixins } from "@/mixins/drawerMixins" |
|||
import { TableHeaderMixins } from "@/mixins/TableHeaderMixins"; |
|||
import { mixins } from "@/mixins/mixins"; |
|||
import { filterSelectMixins } from '@/mixins/filter-Select' |
|||
import { getToken } from '@/utils/auth' |
|||
|
|||
|
|||
export default { |
|||
name: "IncomingData", |
|||
mixins: [ |
|||
tableMixins, |
|||
LoadingMixins, |
|||
drawerMixins, |
|||
TableHeaderMixins, |
|||
mixins, |
|||
filterSelectMixins, |
|||
], |
|||
data() { |
|||
return { |
|||
//常用按钮数据 |
|||
currenButtonData: [ |
|||
this.defaultAddBtn({ |
|||
name:'addFromApi' |
|||
}),//新增 |
|||
this.defaultExportBtn({ |
|||
isRedundance:true, |
|||
isDetailExport:true |
|||
}),//导出 |
|||
this.defaultFieldSettingBtn(),//字段设置 |
|||
this.defaultFreshBtn(),//刷新 |
|||
this.defaultFilterBtn(),//筛选 |
|||
], |
|||
}; |
|||
}, |
|||
mounted() { |
|||
this.paging(); |
|||
}, |
|||
} |
|||
</script> |
|||
<style lang="scss" scoped> |
|||
@import "@/styles/basicData.scss"; |
|||
</style> |
Loading…
Reference in new issue