Browse Source

addEditFromApiPop暂存

noToken
安虹睿 1 year ago
parent
commit
e975e380d1
  1. 251
      PC/InterFace.Dash/src/components/addEditFromApiPop/index.vue
  2. 2
      PC/InterFace.Dash/src/mixins/LoadingMixins.js
  3. 1
      PC/InterFace.Dash/src/mixins/TableHeaderMixins.js
  4. 1
      PC/InterFace.Dash/src/mixins/TableMixins.js
  5. 3
      PC/InterFace.Dash/src/mixins/mixins.js
  6. 6
      PC/InterFace.Dash/src/mixins/newAndEdiDialogMixins.js
  7. 5
      PC/InterFace.Dash/src/utils/baseData/urlOption.js
  8. 1
      PC/InterFace.Dash/src/views/login/index.vue
  9. 6
      PC/InterFace.Dash/src/views/menuList/ExportCustomUserSetting.vue
  10. 101
      PC/InterFace.Dash/src/views/menuList/IncomingData copy.vue
  11. 20
      PC/InterFace.Dash/src/views/menuList/IncomingData.vue

251
PC/InterFace.Dash/src/components/addEditFromApiPop/index.vue

@ -9,87 +9,120 @@
class="searchPageComponents"
:fullscreen="true"
style="width:calc(100% - 28px);left:14px;top:14px;height:calc(100% - 28px)"
v-loading="Loading.addEditApiLoading"
>
<!-- 标题 -->
<div class="dialogOuterTitle">{{formTitle}}</div>
<!-- 表单 -->
<el-form
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"
<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-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-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-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-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
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>
<!-- 操作按钮 -->
<span slot="footer" class="dialog-footer">
<el-button @click="show = false"> </el-button>
<el-button type="primary" @click="submitHandle()"> </el-button>
</span>
<!-- 文本框 -->
<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 { postCreate, postUpdate } from "@/api/wms-api"
import { LoadingMixins } from "@/mixins/LoadingMixins";
import { tableMixins } from "@/mixins/TableMixins"
import * as allUrlOption from '@/utils/baseData/urlOption'
export default {
name:"addEditFromApiPop",
mixins:[ LoadingMixins,tableMixins ],
props: {
//
editRowData:{
@ -100,10 +133,32 @@ export default {
handleType:{
type: String,
default: null
},
//
submitForm:{
type:Function,
default:null
},
//
addSubmitUrl:{
type: String,
default: null
},
//
editSubmitUrl:{
type: String,
default: null
}
},
data () {
return {
//
URLOption_base:allUrlOption[this.$route.name].baseURL,
//
URLOption_add:allUrlOption[this.$route.name].addURL,
//
URLOption_edit:allUrlOption[this.$route.name].editURL,
active:0,//0 1 2
show:true,
formTitle:null,//form
formData:{},//
@ -128,6 +183,10 @@ export default {
let _dtoList_type = this.handleType == 'add' ? 'C' : 'U'
let _dtoList = data[this.$route.name][_dtoList_type].dtoList
this.formItemData = JSON.parse(JSON.stringify(_dtoList))
//
if(this.handleType == 'edit' && this.editRowData){
}
//
this.formRules={}
_dtoList.forEach(item=>{
@ -162,22 +221,52 @@ export default {
//
submitHandle(){
this.$refs.addEditFrom_Ref.validate((valid) => {
if(this.submitForm){
this.submitForm(valid,this.formData,this.handleType,this.formItemData,this.formRules)
return
}
let _updata = this.handleType == 'add' ? this.URLOption_add : this.URLOption_edit
let _url = _updata ? _updata : this.URLOption_base
this.Loading.addEditApiLoading = true
if (valid) {
console.log(this.handleType,this.formData)
//
if(this.handleType == 'add'){
if(!_updata){_url = _url + '/create'}
postCreate(this.formData, _url).then(res => {
this.changeActive(1)
}).catch(err => {
this.changeActive(2)
})
}
//
else{
if(!_updata){_url = _url + '/update-by-id'}
postUpdate(this.formData, this.formData.id, _url).then(res => {
this.changeActive(1)
}).catch(err => {
this.changeActive(2)
})
}
this.show = false
} 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)
@ -185,7 +274,7 @@ export default {
//
clearValue(prop,item,val) {
this.$emit("clearValue", prop, item, val)
}
},
}
}
</script>
@ -194,6 +283,13 @@ export default {
::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;
}
@ -201,4 +297,9 @@ export default {
::v-deep .el-input,.el-select,.el-input-number{
width: 100% !important;
}
.dialog-footer{
padding-top: 15px;
text-align: right;
}
</style>

2
PC/InterFace.Dash/src/mixins/LoadingMixins.js

@ -9,6 +9,8 @@ export const LoadingMixins = {
newAndEdiLoading: false,
autoTableLoading: false,
appMainLoading: false,
// fast-new
addEditApiLoading:false,//Api 新增编辑
},
//Dialog显示状态
displayDialog: {

1
PC/InterFace.Dash/src/mixins/TableHeaderMixins.js

@ -32,6 +32,7 @@ export const TableHeaderMixins = {
// 关闭主表新增编辑api
closeAddEditApiPop(){
this.addEditApiType = null
this.editFromApiRowData = null
this.displayDialog.addEditApiDialog = false
},
// 导出功能

1
PC/InterFace.Dash/src/mixins/TableMixins.js

@ -91,6 +91,7 @@ export const tableMixins = {
// 编辑 api
if (item.name == "editFromApi") {
this.addEditApiType = 'edit'
this.editFromApiRowData = row
this.displayDialog.addEditApiDialog = true;
}
// 删除

3
PC/InterFace.Dash/src/mixins/mixins.js

@ -18,8 +18,6 @@ export const mixins = {
URLOption_add:allUrlOption[this.$route.name].addURL,
// 编辑
URLOption_edit:allUrlOption[this.$route.name].editURL,
// 新增和编辑
URLOption_updata:allUrlOption[this.$route.name].updataURL,
//明细-查看主表
URLOption_parent:allUrlOption[this.$route.name].parentURL ? allUrlOption[this.$route.name].parentURL : allUrlOption[this.$route.name].detailURL,
//明细-查看主表的连接id
@ -67,6 +65,7 @@ export const mixins = {
],
addEditApiType: null,//Api新增编辑方式(add,edit)
editFromApiRowData:null,//Api编辑方式的默认值
}
},
methods: {

6
PC/InterFace.Dash/src/mixins/newAndEdiDialogMixins.js

@ -51,10 +51,10 @@ export const newAndEdiDialogMixins = {
this.ref = val
this.Loading.newAndEdiLoading = true
let _updata = this.formReveal ? this.URLOption_add : this.URLOption_edit
let _url = this.URLOption_updata ? this.URLOption_updata : (_updata ? _updata : this.URLOption_base)
let _url = _updata ? _updata : this.URLOption_base
switch (this.formReveal) {
case true:
if(!_updata && !this.URLOption_updata){_url = _url + '/create'}
if(!_updata){_url = _url + '/create'}
postCreate(this.CreateFormData, _url).then(res => {
this.oldSkipCount = 1;
this.Loading.newAndEdiLoading = false
@ -65,7 +65,7 @@ export const newAndEdiDialogMixins = {
})
break;
case false:
if(!_updata && !this.URLOption_updata){_url = _url + '/update-by-id'}
if(!_updata){_url = _url + '/update-by-id'}
postUpdate(this.editFormData, this.editFormData.id, _url).then(res => {
this.propsData = res
this.Loading.newAndEdiLoading = false

5
PC/InterFace.Dash/src/utils/baseData/urlOption.js

@ -6,9 +6,8 @@ export const TestSchool = {
detailListURL:'TestStudentDetail/base',//明细-列表,
// parentURL:null,//明细-查看主表:特殊接口,如果没有则走detailURL
// deleteURL:null,//删除特殊URL
// updataURL:null,//新增+编辑特殊URL(新增+编辑使用一个)
// addURL:null,//新增特殊URL(有此参数,updataURL无效)
// editURL:null,//编辑特殊URL(有此参数,updataURL无效)
// addURL:null,//新增特殊URL
// editURL:null,//编辑特殊URL
// exportURL:'exportURL',//导出特殊URL
}

1
PC/InterFace.Dash/src/views/login/index.vue

@ -178,7 +178,6 @@ export default {
return
this.loading = true
this.loginForm.userNameOrEmailAddress = this.loginForm.username
// todo-new:permission
let _zh = localStorage.getItem('columnsApiNamesZh')
login(this.loginForm).then(()=>{
// this.$store.dispatch('user/login', this.loginForm).then(() => {

6
PC/InterFace.Dash/src/views/menuList/ExportCustomUserSetting.vue

@ -285,12 +285,12 @@ export default {
this.ref = val
this.Loading.newAndEdiLoading = true
let _updata = this.formReveal ? this.URLOption_add : this.URLOption_edit
let _url = this.URLOption_updata ? this.URLOption_updata : (_updata ? _updata : this.URLOption_base)
let _url = _updata ? _updata : this.URLOption_base
switch (this.formReveal) {
case true:
this.CreateFormData.exportColumnName = this.CreateFormData.exportColumnNameArr.join(" ")
this.CreateFormData.exportTableName = this.CreateFormData.exportTableName_old
if(!_updata && !this.URLOption_updata){_url = _url + '/create'}
if(!_updata){_url = _url + '/create'}
postCreate(this.CreateFormData, _url).then(res => {
this.oldSkipCount = 1;
this.Loading.newAndEdiLoading = false
@ -302,7 +302,7 @@ export default {
})
break;
case false:
if(!_updata && !this.URLOption_updata){_url = _url + '/update-by-id'}
if(!_updata){_url = _url + '/update-by-id'}
this.editFormData.exportColumnName = this.editFormData.exportColumnNameArr.join(" ")
this.editFormData.exportTableName = this.editFormData.exportTableName_old
postUpdate(this.editFormData, this.editFormData.id, _url).then(res => {

101
PC/InterFace.Dash/src/views/menuList/IncomingData copy.vue

@ -0,0 +1,101 @@
<template>
<div class="page-box" v-loading="Loading.tableLoading">
<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"
></tablePagination>
<!-- :buttonOperationList_left="buttonOperationClick_leftBase"
@buttonOperationClick_left="buttonOperationClick_left" -->
<!-- <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>
</div>
</template>
<script>
import { tableMixins } from "@/mixins/TableMixins";
import { LoadingMixins } from "@/mixins/LoadingMixins";
import { drawerMixins } from "@/mixins/drawerMixins"
import { TableHeaderMixins } from "@/mixins/TableHeaderMixins";
import { newAndEdiDialogMixins } from "@/mixins/newAndEdiDialogMixins"
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,
newAndEdiDialogMixins
],
data() {
return {
//
currenButtonData: [
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>

20
PC/InterFace.Dash/src/views/menuList/IncomingData.vue

@ -23,10 +23,14 @@
:primarySearchOption="primarySearchOption"
@overallSearchFormClick="overallSearchFormClick"
:httpOverallSearchData="httpOverallSearchData"
:buttonOperationList_left="buttonOperationClick_leftBase"
@buttonOperationClick_left="buttonOperationClick_left"
:buttonOperationList_right="(data)=>{return buttonOperationList_rightApi(data,'edit')}"
@buttonOperationClick_right="buttonOperationClick_right"
></tablePagination>
<!-- :buttonOperationList_left="buttonOperationClick_leftBase"
@buttonOperationClick_left="buttonOperationClick_left" -->
<!-- <curren-Drawer
<curren-Drawer
ref="currenDrawer_Ref"
:title="apiColumns_DesTions"
@rowDrop="rowDrop"
@ -46,13 +50,20 @@
@alterResultCountDetails="alterResultCountDetails"
@alertoldSkipCountDetails="alertoldSkipCountDetails"
:buttonOperationList_left="operationButtonsDetail"
></curren-Drawer> -->
></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>
@ -60,7 +71,6 @@ import { tableMixins } from "@/mixins/TableMixins";
import { LoadingMixins } from "@/mixins/LoadingMixins";
import { drawerMixins } from "@/mixins/drawerMixins"
import { TableHeaderMixins } from "@/mixins/TableHeaderMixins";
import { newAndEdiDialogMixins } from "@/mixins/newAndEdiDialogMixins"
import { mixins } from "@/mixins/mixins";
import { filterSelectMixins } from '@/mixins/filter-Select'
import { getToken } from '@/utils/auth'
@ -75,12 +85,14 @@ export default {
TableHeaderMixins,
mixins,
filterSelectMixins,
newAndEdiDialogMixins
],
data() {
return {
//
currenButtonData: [
this.defaultAddBtn({
name:'addFromApi'
}),//
this.defaultExportBtn({
isRedundance:true,
isDetailExport:true

Loading…
Cancel
Save