fix:跨域问题

This commit is contained in:
zhangzq
2024-08-13 17:24:20 +08:00
parent f1958b404d
commit e5691da42a
5 changed files with 474 additions and 68 deletions

View File

@@ -0,0 +1,47 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.nl.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* WebMvcConfigurer
*
* @author Zheng Jie
* @date 2018-11-30
*/
@Configuration
@EnableWebMvc
public class ConfigurerAdapter implements WebMvcConfigurer {
@Bean
public CorsFilter corsFilter() {
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
CorsConfiguration config = new CorsConfiguration();
config.setAllowCredentials(true);
config.addAllowedOrigin("*");
config.addAllowedHeader("*");
config.addAllowedMethod("*");
source.registerCorsConfiguration("/**", config);
return new CorsFilter(source);
}
}

View File

@@ -2,11 +2,11 @@
<div class="sidebar-logo-container" :class="{'collapse':collapse}" :style="{ backgroundColor: sideTheme === 'theme-dark' ? variables.menuBg : variables.menuLightBackground }">
<transition name="sidebarLogoFade">
<router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/">
<img v-if="logo" :src="logo" class="sidebar-logo" />
<img v-if="logo" :src="logo" class="sidebar-logo">
<h1 v-else class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }} </h1>
</router-link>
<router-link v-else key="expand" class="sidebar-logo-link" to="/">
<img v-if="logo" :src="logo" class="sidebar-logo" />
<img v-if="logo" :src="logo" class="sidebar-logo">
<h1 class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }} </h1>
</router-link>
</transition>
@@ -24,6 +24,13 @@ export default {
required: true
}
},
data() {
return {
title: '恒森WMS系统',
logo: Logo,
title_param: 'platform'
}
},
computed: {
variables() {
return variables
@@ -32,13 +39,6 @@ export default {
return this.$store.state.settings.sideTheme
}
},
data() {
return {
title: '海亮lms系统',
logo: Logo,
title_param: 'platform'
}
},
created() {
this.getValueByCode(this.title_param).then(res => {
this.title = res.value

View File

@@ -2,7 +2,7 @@
<div class="login" :style="'background-image:url('+ Background +');'">
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" label-position="left" label-width="0px" class="login-form">
<h3 class="title">
海亮LMS系统
恒森WMS系统
</h3>
<el-form-item prop="username">
<el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="账号">

View File

@@ -0,0 +1,364 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<div v-if="crud.props.searchToggle">
<el-form
:inline="true"
class="demo-form-inline"
label-position="right"
label-width="80px"
label-suffix=":"
>
<el-form-item label="任务号">
<label slot="label">&nbsp;&nbsp;&nbsp;:</label>
<el-input
v-model="query.task_code"
clearable
style="width: 240px"
placeholder="任务号"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<el-form-item label="载具号">
<label slot="label">&nbsp;&nbsp;&nbsp;:</label>
<el-input
v-model="query.vehicle_code"
clearable
style="width: 240px"
placeholder="载具号"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<el-form-item label="点位编码">
<el-input
v-model="query.point_code"
clearable
style="width: 240px"
placeholder="起点"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker
v-model="query.createTime"
type="datetimerange"
value-format="yyyy-MM-dd HH:mm:ss"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="crud.toQuery"
/>
</el-form-item>
<el-form-item label="任务状态">
<el-select
v-model="query.status"
multiple
style="width: 360px"
placeholder="任务状态"
class="filter-item"
clearable
@change="handTaskStatus"
>
<el-option
v-for="item in statusEnum.FORM_STATUS"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<rrOperation />
</el-form>
</div>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<span>
未完成数
<el-input
v-model="undo"
clearable
style="width: 60px"
/>
<el-button type="primary" @click="taskScheduler()">任务调度</el-button>
</span>
<crudOperation :permission="permission" />
<!--表单组件-->
<el-dialog
:close-on-click-modal="false"
:before-close="crud.cancelCU"
:visible.sync="crud.status.cu > 0"
:title="crud.status.title"
width="800px"
>
<el-form
ref="form"
style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;"
:inline="true"
:model="form"
:rules="rules"
size="mini"
label-width="115px"
label-suffix=":"
>
<el-form-item label="任务编码">
<el-input v-model="form.task_code" style="width: 240px;" />
</el-form-item>
<el-form-item label="任务状态">
<el-input v-model="form.status" style="width: 240px;" />
</el-form-item>
<el-form-item label="点位1">
<el-input v-model="form.point_code1" style="width: 240px;" />
</el-form-item>
<el-form-item label="点位2">
<el-input v-model="form.point_code2" style="width: 240px;" />
</el-form-item>
<el-form-item label="点位3">
<el-input v-model="form.point_code3" style="width: 240px;" />
</el-form-item>
<el-form-item label="点位4">
<el-input v-model="form.point_code4" style="width: 240px;" />
</el-form-item>
<el-form-item label="载具类型">
<el-input v-model="form.vehicle_type" style="width: 240px;" />
</el-form-item>
<el-form-item label="载具编码">
<el-input v-model="form.vehicle_code" style="width: 240px;" />
</el-form-item>
<el-form-item label="优先级">
<el-input v-model="form.priority" style="width: 240px;" />
</el-form-item>
<el-form-item v-if="false" label="处理类">
<el-input v-model="form.handle_class" style="width: 240px;" />
</el-form-item>
<el-form-item label="备注">
<el-input v-model="form.remark" style="width: 240px;" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="crud.cancelCU">取消</el-button>
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
</div>
</el-dialog>
<!--表格渲染-->
<el-table
ref="table"
v-loading="crud.loading"
:data="crud.data"
size="mini"
style="width: 100%;"
@selection-change="crud.selectionChangeHandler"
>
<el-table-column type="selection" width="55" />
<el-table-column prop="product_area" show-overflow-tooltip show-tooltip-when-overflow label="哈尔滨锅炉厂有限公司">
<el-table-column prop="product_area" show-overflow-tooltip show-tooltip-when-overflow label="序号" />
<el-table-column prop="task_code" show-overflow-tooltip show-tooltip-when-overflow label="图号" />
<el-table-column prop="task_type" show-overflow-tooltip show-tooltip-when-overflow label="件号" />
<template slot-scope="scope">
{{ statusEnum.label.TASK_TYPE[scope.row.task_type] }}
</template>
</el-table-column>
<el-table-column prop="product_area" show-overflow-tooltip show-tooltip-when-overflow label="水冷器(DT123123)">
<el-table-column prop="product_area" show-overflow-tooltip show-tooltip-when-overflow label="零件名称" />
<el-table-column prop="task_code" show-overflow-tooltip show-tooltip-when-overflow label="零件编号" />
<el-table-column prop="task_code" show-overflow-tooltip show-tooltip-when-overflow label="质量">
<el-table-column prop="task_code" show-overflow-tooltip show-tooltip-when-overflow label="单重" />
<el-table-column prop="task_code" show-overflow-tooltip show-tooltip-when-overflow label="总重" />
</el-table-column>
</el-table-column>
<el-table-column prop="acs_type" show-overflow-tooltip show-tooltip-when-overflow width="130" label="零件号231231231231312">
<el-table-column prop="acs_type" show-overflow-tooltip show-tooltip-when-overflow width="130" label="版本号D" />
<el-table-column prop="acs_type" show-overflow-tooltip show-tooltip-when-overflow width="130" label="工艺版本号DDD" />
</el-table-column>
<el-table-column prop="acs_type" show-overflow-tooltip show-tooltip-when-overflow width="130" label="零件清单">
<el-table-column prop="acs_type" show-overflow-tooltip show-tooltip-when-overflow width="130" label="零件尺寸" />
<el-table-column prop="status" show-overflow-tooltip show-tooltip-when-overflow label="消耗定额">
<template slot-scope="scope">
{{ statusEnum.label.FORM_STATUS[scope.row.status] }}
</template>
</el-table-column>
<el-table-column prop="task_step" show-overflow-tooltip show-tooltip-when-overflow width="90" label="毛胚类型" />
<el-table-column prop="task_step" show-overflow-tooltip show-tooltip-when-overflow width="90" label="是否有料" />
</el-table-column>
<el-table-column prop="point_code2" show-overflow-tooltip show-tooltip-when-overflow width="130" label="终点1" />
<el-table-column prop="point_code3" show-overflow-tooltip show-tooltip-when-overflow width="130" label="起点2" />
<el-table-column prop="point_code4" show-overflow-tooltip show-tooltip-when-overflow width="130" label="终点2" />
<el-table-column prop="vehicle_code" show-overflow-tooltip show-tooltip-when-overflow label="载具编码">
<template slot-scope="scope">
{{ scope.row.vehicle_code ? scope.row.vehicle_code : '-' }}
</template>
</el-table-column>
<el-table-column prop="priority" show-overflow-tooltip show-tooltip-when-overflow label="优先级" />
<el-table-column prop="handle_class" show-overflow-tooltip show-tooltip-when-overflow width="150" label="处理类" />
<el-table-column prop="is_send" show-overflow-tooltip show-tooltip-when-overflow label="立即下发" />
<el-table-column prop="remark" show-overflow-tooltip show-tooltip-when-overflow label="备注" />
<el-table-column prop="form_data" show-overflow-tooltip show-tooltip-when-overflow width="130" label="自定义参数" />
<el-table-column prop="create_time" show-overflow-tooltip show-tooltip-when-overflow label="创建时间" />
<el-table-column prop="update_name" show-overflow-tooltip show-tooltip-when-overflow label="修改人" />
<el-table-column prop="update_time" show-overflow-tooltip show-tooltip-when-overflow label="修改时间" />
<el-table-column v-permission="[]" label="操作" width="250px" align="center" fixed="right">
<template slot-scope="scope">
<el-button
type="text"
icon="el-icon-success"
:disabled="scope.row.status!=='10' && scope.row.status!=='30' "
@click="doOperate(scope.row, 'c')"
>下发
</el-button>
<el-button
type="text"
icon="el-icon-success"
:disabled="scope.row.status==='80' || scope.row.status==='82' || scope.row.status==='90'"
@click="doOperate(scope.row, 'a')"
>完成
</el-button>
<el-button
type="text"
icon="el-icon-success"
:disabled="scope.row.status==='80' || scope.row.status==='82' || scope.row.status==='90'"
@click="doOperate(scope.row, 'e')"
>强制完成
</el-button>
<el-button
type="text"
icon="el-icon-error"
:disabled="scope.row.status==='80' || scope.row.status==='82' || scope.row.status==='90'"
@click="doOperate(scope.row, 'b')"
>取消
</el-button>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<pagination />
</div>
</div>
</template>
<script>
import crudSchBaseTask, { scheduler } from './schBaseTask'
// import crudSchBaseTaskconfig from './config/schBaseTaskconfig'
import CRUD, { crud, form, header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import crudDict from '@/views/system/dict/dict'
const defaultForm = {
id: null,
product_area: null,
task_code: null,
task_type: null,
acs_type: null,
status: null,
task_step: null,
group_code: null,
point_code1: null,
point_code2: null,
point_code3: null,
point_code4: null,
vehicle_code: null,
priority: null,
handle_class: null,
is_send: null,
create_time: null,
update_time: null,
update_name: null,
remark: null,
form_data: null,
is_delete: false
}
export default {
name: 'Task',
components: { pagination, crudOperation, rrOperation, udOperation },
mixins: [presenter(), header(), form(defaultForm), crud()],
statusEnums: ['TASK_TYPE', 'FORM_STATUS'],
cruds() {
return CRUD({
title: '任务管理',
url: 'api/schBaseTask',
idField: 'task_id',
sort: 'task_code,desc',
optShow: {
add: false,
edit: false,
del: false,
download: false,
reset: true
},
crudMethod: { ...crudSchBaseTask }
})
},
data() {
return {
undo: 0,
permission: {},
rules: {},
taskStatusList: []
}
},
created() {
},
methods: {
// 钩子在获取表格数据之前执行false 则代表不获取数据
[CRUD.HOOK.beforeRefresh]() {
return true
},
hand(value) {
this.crud.toQuery()
},
handTaskStatus(value) {
this.crud.query.more_status = null
if (value) {
this.crud.query.more_status = value.toString()
}
this.crud.toQuery()
},
doOperate(row, command) {
let status = ''
switch (command) {
case 'a':// 完成
status = '80'
break
case 'b':// 取消
status = '90'
break
case 'c':// 下发
status = '15'
break
case 'd':// 详情
status = 'view'
case 'e':// 详情
status = '82'
break
}
if (status === 'view') {
// this.view(row)
return
}
const data = {
task_code: row.task_code,
status: status
}
crudSchBaseTask.operation(data).then(res => {
this.crud.toQuery()
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
}).catch(err => {
console.log(err.response.data.message)
})
},
taskScheduler() {
crudSchBaseTask.scheduler().then(res => {
this.crud.toQuery()
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
})
}
}
}
</script>
<style scoped>
</style>

View File

@@ -27,7 +27,8 @@
</el-form-item>
<template v-for="(col,index) in cols">
<el-form-item :label="col.lable">
<el-select v-if="col.value == 'stor_code'"
<el-select
v-if="col.value == 'stor_code'"
v-model="form.form_data[col.value]"
clearable
class="filter-item"
@@ -41,12 +42,12 @@
:value="item.value"
/>
</el-select>
<el-input v-if="col.value != 'stor_code'" :label="col.lable" v-model="form.form_data[col.value]" :value="col.value" clearable style="width: 150px" />
<el-input v-if="col.value != 'stor_code'" v-model="form.form_data[col.value]" :label="col.lable" :value="col.value" clearable style="width: 150px" />
</el-form-item>
</template>
<el-form-item label="备注" prop="remark">
<label slot="label">备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注:</label>
<el-input v-model="form.remark" style="width: 380px;" rows="2" type="textarea" />
<el-input v-model="form.remark" style="width: 380px;" rows="2" type="textarea" />
</el-form-item>
</el-form>
@@ -54,14 +55,14 @@
<span class="crud-opts-right2">
<!--左侧插槽-->
<slot name="left" />
<el-button
slot="left"
class="filter-item"
type="primary"
icon="el-icon-plus"
size="mini"
@click="insertEvent()"
>
<el-button
slot="left"
class="filter-item"
type="primary"
icon="el-icon-plus"
size="mini"
@click="insertEvent()"
>
选择库存
</el-button>
</span>
@@ -85,19 +86,20 @@
<el-table-column show-overflow-tooltip prop="material_name" label="物料名称" />
<el-table-column show-overflow-tooltip prop="pcsn" label="批次" />
<el-table-column show-overflow-tooltip prop="qty" label="物料数量" />
<el-table-column show-overflow-tooltip prop="unit_id" label="单位" >
<el-table-column show-overflow-tooltip prop="unit_id" label="单位">
<template slot-scope="scope">
{{ tableEnum.label.bm_measure_unit[scope.row.unit_id] }}
{{ tableEnum.label.bm_measure_unit[scope.row.unit_id] }}
</template>
</el-table-column>
<el-table-column v-for="(item, index) in dtlCols" :key="item.value" :label="item.lable" width="160">
<el-table-column v-for="(item, index) in dtlCols" :key="item.value" :label="item.lable" width="160">
<template scope="scope">
<el-input v-model="tableData[scope.$index].form_data[item.value]" disabled class="input-with-select" />
<el-input v-if="item.value != 'change_qty'" v-model="tableData[scope.$index].form_data[item.value]" disabled class="input-with-select" />
<el-input v-if="item.value == 'change_qty'" v-model="tableData[scope.$index].form_data[item.value]" class="input-with-select" />
</template>
</el-table-column>
<el-table-column label="备注" width="160">
<el-table-column label="备注" width="160">
<template scope="scope">
<el-input v-model="tableData[scope.$index].remark" class="input-with-select" />
<el-input v-model="tableData[scope.$index].remark" class="input-with-select" />
</template>
</el-table-column>
<el-table-column v-if="crud.status.cu > 0" align="center" label="操作" width="170" fixed="right">
@@ -116,8 +118,8 @@
<StructAttrDialog
:dialog-show.sync="structShow"
:is-single="false"
:storCode="stor_code"
:has=true
:stor-code="stor_code"
:has="true"
@setMaterValue="tableDtlMaterial"
/>
</el-dialog>
@@ -129,6 +131,7 @@ import CRUD, { crud, form } from '@crud/crud'
import StructAttrDialog from '@/views/wms/stor_manage/storIvtInfo/StructAttrDialog'
import formstruc from '@/views/wms/config_manage/formStruc/formstruc'
import crudCheck from '@/views/wms/stor_manage/warehouse/checkStorage/check'
import crudFormData from '../move/formData'
const defaultForm = {
id: '',
@@ -145,15 +148,15 @@ const defaultForm = {
update_time: '',
remark: '',
form_data: {},
proc_inst_id:''
proc_inst_id: ''
}
export default {
name: 'AddDialog',
components: { formstruc, StructAttrDialog },
mixins: [crud(), form(defaultForm)],
statusEnums: [ 'FORM_STATUS', 'IOBILL_TYPE_IN' ],
tableEnums: [ 'st_ivt_bsrealstorattr#stor_name#stor_code','bm_measure_unit#unit_name#unit_id' ],
statusEnums: ['FORM_STATUS', 'IOBILL_TYPE_IN'],
tableEnums: ['st_ivt_bsrealstorattr#stor_name#stor_code', 'bm_measure_unit#unit_name#unit_id'],
props: {
dialogShow: {
type: Boolean,
@@ -165,12 +168,12 @@ export default {
},
data() {
return {
cols:[],
dtlCols:[],
tableData:[],
structs:[],
endStructs:[],
currentIndex:null,
cols: [],
dtlCols: [],
tableData: [],
structs: [],
endStructs: [],
currentIndex: null,
dialogVisible: false,
structShow: false,
structShow2: false,
@@ -180,7 +183,7 @@ export default {
rules: {
bill_type: [
{ required: true, message: '单据类型不能为空', trigger: 'blur' }
],
]
}
}
},
@@ -200,24 +203,24 @@ export default {
this.cols = res
this.form.form_type = 'st_ivt_check'
res.forEach(a => {
this.form.form_data[a.value,'']
this.form.form_data[a.value, '']
})
})
formstruc.getHeader('st_ivt_checkdtl').then(res => {
this.dtlCols = res
res.forEach(a => {
this.dtlCols.form_data[a.value,'']
this.dtlCols.form_data[a.value, '']
})
})
},
close() {
this.tableData = [],
this.structs = [],
this.endStructs = [],
this.crud.cancelCU()
this.tableData = [],
this.structs = [],
this.endStructs = [],
this.crud.cancelCU()
this.$emit('AddChanged')
},
changeStor(stor){
changeStor(stor) {
this.stor_code = stor
},
@@ -239,27 +242,20 @@ export default {
this.dis_flag = true
}
},
[CRUD.HOOK.beforeCrudToCU]() {
this.$refs['form'].validate((valid) => {
if (valid) {
return true
}else {
return false
}
[CRUD.HOOK.beforeToEdit]() {
// 获取入库单明细
crudFormData.getSonFormData(this.form.id).then(res => {
this.tableData = res
})
if (this.tableData.length === 0) {
this.crud.notify('请至少选择一条明细', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
},
submitCU() {
// 提交前校验
this.$refs['form'].validate((valid) => {
if (valid) {
return true
}else {
return false
}
if (valid) {
return true
} else {
return false
}
})
if (this.tableData.length === 0) {
this.crud.notify('请至少选择一条明细', CRUD.NOTIFICATION_TYPE.INFO)
@@ -279,10 +275,10 @@ export default {
tableDtlMaterial(rows) {
rows.forEach((row) => {
if (this.structs.includes(row.struct_code)){
if (this.structs.includes(row.struct_code)) {
return
}
const data = {}
const data = {}
this.structs.push(row.struct_code)
data.sect_name = row.sect_name
data.sect_code = row.sect_code
@@ -300,15 +296,14 @@ export default {
data.form_type = 'st_ivt_checkdtl'
data.form_data = {}
data.end_struct_code = row.struct_code
this.dtlCols.forEach(a=>{
this.dtlCols.forEach(a => {
let item = ''
if (a.value in data) {
item = data[a.value];
item = data[a.value]
}
this.$set(data.form_data,a.value,item)
this.$set(data.form_data, a.value, item)
})
this.tableData.splice(-1, 0, data)
})
}
}