opt:优化

This commit is contained in:
DESKTOP-5DIJMF9\admin
2025-07-10 13:39:55 +08:00
parent 89cd91197a
commit 31262adb24
332 changed files with 1524 additions and 3644 deletions

View File

@@ -2,7 +2,7 @@ export default {
'lang': 'zh',
// 平台
'platform': {
'title': '欧伦电气WMS系统',
'title': 'c',
'tip1': '用户名不能为空',
'tip2': '密码不能为空',
'tip3': '验证码不能为空'

View File

@@ -26,7 +26,7 @@ export default {
},
data() {
return {
title: '欧伦电气WMS系统',
title: 'WMS系统',
logo: Logo,
title_param: 'platform'
}

View File

@@ -1,328 +0,0 @@
<template>
<div class="app-container">
<el-row :gutter="15">
<el-col style="margin-bottom: 10px">
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">字段配置{{ table_name }}</span>
<el-button
:loading="genLoading"
icon="el-icon-s-promotion"
size="mini"
style="float: right; padding: 6px 9px;"
type="success"
@click="toGen"
>保存&生成</el-button>
<el-button
:loading="columnLoading"
icon="el-icon-check"
size="mini"
style="float: right; padding: 6px 9px;margin-right: 9px"
type="primary"
@click="saveColumnConfig"
>保存</el-button>
<el-tooltip class="item" effect="dark" content="数据库中表字段变动时使用该功能" placement="top-start">
<el-button
:loading="syncLoading"
icon="el-icon-refresh"
size="mini"
style="float: right; padding: 6px 9px;"
type="info"
@click="sync"
>同步</el-button>
</el-tooltip>
</div>
<el-form size="mini" label-width="90px">
<el-table v-loading="loading" :data="data" :max-height="tableHeight" size="mini" style="width: 100%;margin-bottom: 15px">
<el-table-column prop="column_name" label="字段名称" />
<el-table-column prop="column_type" label="字段类型" />
<el-table-column prop="remark" label="字段描述">
<template slot-scope="scope">
<el-input v-model="data[scope.$index].remark" size="mini" class="edit-input" />
</template>
</el-table-column>
<el-table-column align="center" label="必填" width="70px">
<template slot-scope="scope">
<el-checkbox v-model="data[scope.$index].not_null" />
</template>
</el-table-column>
<el-table-column align="center" label="列表" width="70px">
<template slot-scope="scope">
<el-checkbox v-model="data[scope.$index].list_show" />
</template>
</el-table-column>
<el-table-column align="center" label="表单" width="70px">
<template slot-scope="scope">
<el-checkbox v-model="data[scope.$index].form_show" />
</template>
</el-table-column>
<el-table-column label="表单类型">
<template slot-scope="scope">
<el-select v-model="data[scope.$index].form_type" filterable class="edit-input" clearable size="mini" placeholder="请选择">
<el-option
label="文本框"
value="Input"
/>
<el-option
label="文本域"
value="Textarea"
/>
<el-option
label="单选框"
value="Radio"
/>
<el-option
label="下拉框"
value="Select"
/>
<el-option
label="日期框"
value="Date"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="查询方式">
<template slot-scope="scope">
<el-select v-model="data[scope.$index].query_type" filterable class="edit-input" clearable size="mini" placeholder="请选择">
<el-option
label="="
value="="
/>
<el-option
label="!="
value="!="
/>
<el-option
label=">="
value=">="
/>
<el-option
label="<="
value="<="
/>
<el-option
label="Like"
value="Like"
/>
<el-option
label="not_null"
value="not_null"
/>
<el-option
label="BetWeen"
value="BetWeen"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="日期注解">
<template slot-scope="scope">
<el-select v-model="data[scope.$index].date_annotation" filterable class="edit-input" clearable size="mini" placeholder="请选择">
<el-option
label="自动创建时间"
value="CreationTimestamp"
/>
<el-option
label="自动更新时间"
value="UpdateTimestamp"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="关联字典">
<template slot-scope="scope">
<el-select v-model="data[scope.$index].dict_name" filterable class="edit-input" clearable size="mini" placeholder="请选择">
<el-option v-for="item in dicts" :key="item.dict_id" :label="item.code === '' ? item.name : item.code" :value="item.code">
<span style="float: left">{{ item.code }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.name }}</span>
</el-option>
</el-select>
</template>
</el-table-column>
</el-table>
</el-form>
</el-card>
</el-col>
<el-col>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">生成配置</span>
<el-button
:loading="configLoading"
icon="el-icon-check"
size="mini"
style="float: right; padding: 6px 9px"
type="primary"
@click="doSubmit"
>保存</el-button>
</div>
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="78px">
<el-form-item label="作者名称" prop="author">
<el-input v-model="form.author" style="width: 40%" />
<span style="color: #C0C0C0;margin-left: 10px;">类上面的作者名称</span>
</el-form-item>
<el-form-item label="模块名称" prop="module_name">
<el-input v-model="form.module_name" style="width: 40%" />
<span style="color: #C0C0C0;margin-left: 10px;">模块的名称请选择项目中已存在的模块</span>
</el-form-item>
<el-form-item label="至于包下" prop="pack">
<el-input v-model="form.pack" style="width: 40%" />
<span style="color: #C0C0C0;margin-left: 10px;">项目包的名称生成的代码放到哪个包里面</span>
</el-form-item>
<el-form-item label="接口名称" prop="apiAlias">
<el-input v-model="form.api_alias" style="width: 40%" />
<span style="color: #C0C0C0;margin-left: 10px;">接口的名称用于控制器与接口文档中</span>
</el-form-item>
<el-form-item label="前端路径" prop="path">
<el-input v-model="form.path" style="width: 40%" />
<span style="color: #C0C0C0;margin-left: 10px;">输入views文件夹下的目录不存在即创建</span>
</el-form-item>
<!-- <el-form-item label="接口目录">-->
<!-- <el-input v-model="form.apiPath" style="width: 40%" />-->
<!-- <span style="color: #C0C0C0;margin-left: 10px;">Api存放路径[src/api]为空则自动生成路径</span>-->
<!-- </el-form-item>-->
<el-form-item label="去表前缀" prop="prefix">
<el-input v-model="form.prefix" placeholder="默认不去除表前缀" style="width: 40%" />
<span style="color: #C0C0C0;margin-left: 10px;">默认不去除表前缀可自定义</span>
</el-form-item>
<el-form-item label="是否覆盖" prop="cover">
<el-radio-group v-model="form.cover" size="mini" style="width: 40%">
<el-radio-button label="true"></el-radio-button>
<el-radio-button label="false"></el-radio-button>
</el-radio-group>
<span style="color: #C0C0C0;margin-left: 10px;">谨防误操作请慎重选择</span>
</el-form-item>
</el-form>
</el-card>
</el-col>
</el-row>
</div>
</template>
<script>
import crud from '@/mixins/crud'
import { update, get } from '@/views/generator/genConfig'
import { save, sync, generator } from '@/views/generator/generator'
import { getDicts } from '@/views/system/dict/dict'
export default {
name: 'GeneratorConfig',
components: {},
mixins: [crud],
data() {
return {
activeName: 'first', table_name: '', tableHeight: 550, columnLoading: false, configLoading: false, dicts: [], syncLoading: false, genLoading: false,
form: { id: null, table_name: '', author: '', pack: '', path: '', module_name: '', cover: 'false', apiPath: '', prefix: '', api_alias: null },
rules: {
author: [
{ required: true, message: '作者不能为空', trigger: 'blur' }
],
pack: [
{ required: true, message: '包路径不能为空', trigger: 'blur' }
],
module_name: [
{ required: true, message: '包路径不能为空', trigger: 'blur' }
],
path: [
{ required: true, message: '前端路径不能为空', trigger: 'blur' }
],
api_alias: [
{ required: true, message: '接口名称不能为空', trigger: 'blur' }
],
cover: [
{ required: true, message: '不能为空', trigger: 'blur' }
]
}
}
},
created() {
this.tableHeight = document.documentElement.clientHeight - 385
this.table_name = this.$route.params.tableName
this.$nextTick(() => {
this.init()
get(this.table_name).then(data => { // 获取作者等信息
this.form = data
this.form.cover = this.form.cover.toString()
})
getDicts().then(data => {
this.dicts = data
})
})
},
methods: {
beforeInit() {
this.url = 'api/generator/columns'
const tableName = this.table_name
this.params = { tableName }
return true
},
saveColumnConfig() {
this.columnLoading = true
save(this.data).then(res => {
this.notify('保存成功', 'success')
this.columnLoading = false
}).catch(err => {
this.columnLoading = false
console.log(err.response.data.message)
})
},
doSubmit() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.configLoading = true
update(this.form).then(res => {
this.notify('保存成功', 'success')
this.form = res
this.form.cover = this.form.cover.toString()
this.configLoading = false
}).catch(err => {
this.configLoading = false
console.log(err.response.data.message)
})
}
})
},
sync() {
this.syncLoading = true
sync([this.table_name]).then(() => {
this.init()
this.notify('同步成功', 'success')
this.syncLoading = false
}).then(() => {
this.syncLoading = false
})
},
toGen() {
this.genLoading = true
save(this.data).then(res => {
this.notify('保存成功', 'success')
// 生成代码
generator(this.table_name, 0).then(data => {
this.genLoading = false
this.notify('生成成功', 'success')
}).catch(err => {
this.genLoading = false
console.log(err.response.data.message)
})
}).catch(err => {
this.genLoading = false
console.log(err.response.data.message)
})
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss">
.edit-input {
.el-input__inner {
border: 1px solid #e5e6e7;
}
}
</style>
<style scoped>
::v-deep .input-with-select .el-input-group__prepend {
background-color: #fff;
}
</style>

View File

@@ -1,16 +0,0 @@
import request from '@/utils/request'
export function get(tableName) {
return request({
url: 'api/genConfig/' + tableName,
method: 'get'
})
}
export function update(data) {
return request({
url: 'api/genConfig',
data,
method: 'put'
})
}

View File

@@ -1,33 +0,0 @@
import request from '@/utils/request'
export function getAllTable() {
return request({
url: 'api/generator/tables/all',
method: 'get'
})
}
export function generator(tableName, type) {
return request({
url: 'api/generator/' + tableName + '/' + type,
method: 'post',
responseType: type === 2 ? 'blob' : ''
})
}
export function save(data) {
return request({
url: 'api/generator',
data,
method: 'put'
})
}
export function sync(tables) {
return request({
url: 'api/generator/sync',
method: 'post',
data: tables
})
}

View File

@@ -1,118 +0,0 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<div v-if="crud.props.searchToggle">
<el-input v-model="query.name" clearable size="mini" placeholder="请输入表名" style="width: 200px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
<rrOperation />
</div>
<crudOperation>
<el-tooltip slot="right" class="item" effect="dark" content="数据库中表字段变动时使用该功能" placement="top-start">
<el-button
class="filter-item"
size="mini"
type="success"
icon="el-icon-refresh"
:loading="syncLoading"
:disabled="crud.selections.length === 0"
@click="sync"
>同步</el-button>
</el-tooltip>
</crudOperation>
</div>
<!--表格渲染-->
<el-table ref="table" v-loading="crud.loading" :data="crud.data" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
<el-table-column type="selection" width="55" />
<el-table-column show-overflow-tooltip prop="table_name" label="表名" />
<el-table-column show-overflow-tooltip prop="engine" label="数据库引擎" />
<el-table-column show-overflow-tooltip prop="coding" label="字符编码集" />
<el-table-column show-overflow-tooltip prop="remark" label="备注" />
<el-table-column prop="create_time" label="创建日期">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.create_time) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="160px" align="center" fixed="right">
<template slot-scope="scope">
<el-button size="mini" style="margin-right: 2px" type="text">
<router-link :to="'/sys-tools/generator/preview/' + scope.row.table_name">
预览
</router-link>
</el-button>
<el-button size="mini" style="margin-left: -1px;margin-right: 2px" type="text" @click="toDownload(scope.row.table_name)">下载</el-button>
<el-button size="mini" style="margin-left: -1px;margin-right: 2px" type="text">
<router-link :to="'/sys-tools/generator/config/' + scope.row.table_name">
配置
</router-link>
</el-button>
<el-button type="text" style="margin-left: -1px" size="mini" @click="toGen(scope.row.table_name)">生成</el-button>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<pagination />
</div>
</template>
<script>
import { generator, sync } from '@/views/generator/generator'
import { downloadFile } from '@/utils/index'
import CRUD, { presenter, header } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import pagination from '@crud/Pagination'
export default {
name: 'GeneratorIndex',
components: { pagination, crudOperation, rrOperation },
cruds() {
return CRUD({ url: 'api/generator/tables' })
},
mixins: [presenter(), header()],
data() {
return {
syncLoading: false
}
},
created() {
this.crud.optShow = { add: false, edit: false, del: false, download: false }
},
methods: {
toGen(table_name) {
// 生成代码
generator(table_name, 0).then(data => {
this.$notify({
title: '生成成功',
type: 'success',
duration: 2500
})
})
},
toDownload(table_name) {
// 打包下载
generator(table_name, 2).then(data => {
downloadFile(data, table_name, 'zip')
})
},
sync() {
const tables = []
this.crud.selections.forEach(val => {
tables.push(val.table_name)
})
this.syncLoading = true
sync(tables).then(() => {
this.crud.refresh()
this.crud.notify('同步成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.syncLoading = false
}).then(() => {
this.syncLoading = false
})
}
}
}
</script>
<style scoped>
</style>

View File

@@ -1,30 +0,0 @@
<template>
<el-tabs v-model="activeName" type="card">
<el-tab-pane v-for="item in data" :key="item.name" :lazy="true" :label="item.name" :name="item.name">
<Java :value="item.content" :height="height" />
</el-tab-pane>
</el-tabs>
</template>
<script>
import Java from '@/components/JavaEdit/index'
import { generator } from '@/views/generator/generator'
export default {
name: 'Preview',
components: { Java },
data() {
return {
data: null, height: '', activeName: 'Dto'
}
},
created() {
this.height = document.documentElement.clientHeight - 180 + 'px'
const tableName = this.$route.params.tableName
generator(tableName, 1).then(data => {
this.data = data
}).catch(() => {
this.$router.go(-1)
})
}
}
</script>

View File

@@ -1,136 +1,12 @@
<template>
<div v-loading="!show" :element-loading-text="$t('common.loading')" :style="!show ? 'height: 500px' : 'height: 100%'" class="app-container">
<div v-if="show">
<el-card class="box-card">
<div style="color: #666;font-size: 13px;">
<svg-icon icon-class="system" style="margin-right: 5px" />
<span>
{{ $t('monitor.sys') }}{{ data.sys.os }}
</span>
<span>
IP{{ data.sys.ip }}
</span>
<span>
{{ $t('monitor.day') }}{{ data.sys.day }}
</span>
<i class="el-icon-refresh" style="margin-left: 40px" @click="init" />
</div>
</el-card>
<el-card class="box-card">
<div slot="header" class="clearfix">
<span style="font-weight: bold;color: #666;font-size: 15px">{{ $t('monitor.status') }}</span>
</div>
<div>
<el-col :xs="24" :sm="24" :md="6" :lg="6" :xl="6" style="margin-bottom: 10px">
<div class="title">{{ $t('monitor.cpu') }}</div>
<el-tooltip placement="top-end">
<div slot="content" style="font-size: 12px;">
<div style="padding: 3px;">
{{ data.cpu.name }}
</div>
<div style="padding: 3px">
{{ data.cpu.package }}
</div>
<div style="padding: 3px">
{{ data.cpu.core }}
</div>
<div style="padding: 3px">
{{ data.cpu.logic }}
</div>
</div>
<div class="content">
<el-progress type="dashboard" :percentage="parseFloat(data.cpu.used)" />
</div>
</el-tooltip>
<div class="footer">{{ data.cpu.coreNumber }} {{ $t('monitor.core') }}</div>
</el-col>
<el-col :xs="24" :sm="24" :md="6" :lg="6" :xl="6" style="margin-bottom: 10px">
<div class="title">{{ $t('monitor.memory') }}</div>
<el-tooltip placement="top-end">
<div slot="content" style="font-size: 12px;">
<div style="padding: 3px;">
{{ $t('monitor.tality') }}{{ data.memory.total }}
</div>
<div style="padding: 3px">
{{ $t('monitor.used') }}{{ data.memory.used }}
</div>
<div style="padding: 3px">
{{ $t('monitor.leisure') }}{{ data.memory.available }}
</div>
</div>
<div class="content">
<el-progress type="dashboard" :percentage="parseFloat(data.memory.usageRate)" />
</div>
</el-tooltip>
<div class="footer">{{ data.memory.used }} / {{ data.memory.total }}</div>
</el-col>
<el-col :xs="24" :sm="24" :md="6" :lg="6" :xl="6" style="margin-bottom: 10px">
<div class="title">{{ $t('monitor.exchange') }}</div>
<el-tooltip placement="top-end">
<div slot="content" style="font-size: 12px;">
<div style="padding: 3px;">
{{ $t('monitor.tality') }}{{ data.swap.total }}
</div>
<div style="padding: 3px">
{{ $t('monitor.used') }}{{ data.swap.used }}
</div>
<div style="padding: 3px">
{{ $t('monitor.leisure') }}{{ data.swap.available }}
</div>
</div>
<div class="content">
<el-progress type="dashboard" :percentage="parseFloat(data.swap.usageRate)" />
</div>
</el-tooltip>
<div class="footer">{{ data.swap.used }} / {{ data.swap.total }}</div>
</el-col>
<el-col :xs="24" :sm="24" :md="6" :lg="6" :xl="6" style="margin-bottom: 10px">
<div class="title">{{ $t('monitor.disk') }}</div>
<div class="content">
<el-tooltip placement="top-end">
<div slot="content" style="font-size: 12px;">
<div style="padding: 3px">
{{ $t('monitor.tality') }}{{ data.disk.total }}
</div>
<div style="padding: 3px">
{{ $t('monitor.leisure') }}{{ data.disk.available }}
</div>
</div>
<div class="content">
<el-progress type="dashboard" :percentage="parseFloat(data.disk.usageRate)" />
</div>
</el-tooltip>
</div>
<div class="footer">{{ data.disk.used }} / {{ data.disk.total }}</div>
</el-col>
</div>
</el-card>
<div>
<el-row :gutter="6">
<el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12" style="margin-bottom: 10px">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span style="font-weight: bold;color: #666;font-size: 15px">{{ $t('monitor.cpu_monitoring') }}</span>
</div>
<div>
<v-chart :options="cpuInfo" />
</div>
</el-card>
</el-col>
<el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12" style="margin-bottom: 10px">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span style="font-weight: bold;color: #666;font-size: 15px">{{ $t('monitor.memory_monitoring') }}</span>
</div>
<div>
<v-chart :options="memoryInfo" />
</div>
</el-card>
</el-col>
</el-row>
</div>
</div>
<div style="height:1000px">
<iframe
src="/screen/index.html"
width="100%"
height="100%"
frameborder="0"
allowfullscreen
></iframe>
</div>
</template>
@@ -230,22 +106,22 @@ export default {
clearInterval(this.monitor)
},
methods: {
init() {
initData(this.url, {}).then(data => {
this.data = data
this.show = true
if (this.cpuInfo.xAxis.data.length >= 8) {
this.cpuInfo.xAxis.data.shift()
this.memoryInfo.xAxis.data.shift()
this.cpuInfo.series[0].data.shift()
this.memoryInfo.series[0].data.shift()
}
this.cpuInfo.xAxis.data.push(data.time)
this.memoryInfo.xAxis.data.push(data.time)
this.cpuInfo.series[0].data.push(parseFloat(data.cpu.used))
this.memoryInfo.series[0].data.push(parseFloat(data.memory.usageRate))
})
}
// init() {
// initData(this.url, {}).then(data => {
// this.data = data
// this.show = true
// if (this.cpuInfo.xAxis.data.length >= 8) {
// this.cpuInfo.xAxis.data.shift()
// this.memoryInfo.xAxis.data.shift()
// this.cpuInfo.series[0].data.shift()
// this.memoryInfo.series[0].data.shift()
// }
// this.cpuInfo.xAxis.data.push(data.time)
// this.memoryInfo.xAxis.data.push(data.time)
// this.cpuInfo.series[0].data.push(parseFloat(data.cpu.used))
// this.memoryInfo.series[0].data.push(parseFloat(data.memory.usageRate))
// })
// }
}
}
</script>

View File

@@ -2,45 +2,46 @@
<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="物料查询">
<el-row>
<el-col :span="4">
物料查询
<el-input
v-model="query.material_code"
clearable
style="width: 150px"
size="mini"
placeholder="物料编码、名称"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<el-form-item label="批次号">
</el-col>
<el-col :span="4">
批次查询
<el-input
v-model="query.pcsn"
clearable
style="width: 150px"
size="mini"
placeholder="批次"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<el-form-item label="载具编码">
</el-col>
<el-col :span="4">
载具编码
<el-input
v-model="query.storagevehicle_code"
clearable
style="width: 150px"
size="mini"
placeholder="载具编码"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<el-form-item label="状态">
</el-col>
<el-col :span="4">
组盘状态
<el-select
v-model="query.status"
clearable
style="width: 150px"
size="mini"
placeholder="状态"
class="filter-item"
@@ -52,13 +53,73 @@
:value="item.value"
/>
</el-select>
</el-form-item>
<rrOperation />
</el-form>
</div>
<rrOperation />
</el-col>
<el-col :span="4">
<rrOperation />
</el-col>
</el-row>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<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="1200px"
>
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="110px">
<el-row>
<el-col :span="8">
<el-form-item label="物料编码" prop="material_code" >
<el-input v-model="form.material_code" style="width: 200px;" :disabled="crud.status.edit > 0" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="物料名称" prop="material_name">
<el-input v-model="form.material_name" style="width: 200px;" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="规格" prop="material_spec">
<label slot="label">规&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;格</label>
<el-input v-model="form.material_spec" style="width: 200px;" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="型号" prop="material_model">
<label slot="label">型&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;号</label>
<el-input v-model="form.material_model" style="width: 200px;" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="外部标识" prop="ext_id">
<el-input v-model="form.ext_id" style="width: 200px;" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="静置时间" prop="standing_time">
<el-input-number v-model="form.standing_time" :controls="false" :min="0" label="分钟" style="width: 200px;" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="是否启用" prop="is_used">
<el-radio v-model="form.is_used" label="0">否</el-radio>
<el-radio v-model="form.is_used" label="1">是</el-radio>
</el-form-item>
</el-col>
</el-row>
</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"
@@ -134,7 +195,7 @@ export default {
title: '组盘记录',
url: 'api/group',
optShow: {
add: false,
add: true,
reset: true
},
idField: 'group_id',

View File

@@ -0,0 +1,125 @@
<template>
<el-dialog
title="导入Excel文件"
append-to-body
:visible.sync="dialogVisible"
destroy-on-close
width="400px"
:show-close="true"
@close="close"
@open="open"
>
<el-upload
ref="upload"
class="upload-demo"
action=""
drag
:on-exceed="is_one"
:limit="1"
:auto-upload="false"
:multiple="false"
:show-file-list="true"
:on-change="uploadByJsqd"
:file-list="fileList"
accept=".xlsx,.xls"
>
<i class="el-icon-upload" />
<div class="el-upload__text">
将文件拖到此处
<em>点击上传</em>
</div>
<div slot="tip" class="el-upload__tip">只能上传Excel文件且不超过10MB</div>
</el-upload>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="submit"> </el-button>
</span>
</el-dialog>
</template>
<script>
import crudMaterial from './material'
import CRUD, { crud } from '@crud/crud'
import { download2 } from '@/api/data'
import { downloadFile } from '@/utils'
export default {
name: 'UploadDialog',
mixins: [crud()],
components: {},
props: {
dialogShow: {
type: Boolean,
default: false
},
openParam: {
type: String
}
},
data() {
return {
dialogVisible: false,
fileList: [],
file1: ''
}
},
watch: {
dialogShow: {
handler(newValue, oldValue) {
this.dialogVisible = newValue
}
},
openParam: {
handler(newValue, oldValue) {
this.opendtlParam = newValue
}
}
},
methods: {
open() {
},
close() {
this.$emit('update:dialogShow', false)
},
is_one() {
this.crud.notify('只能上传一个excel文件', CRUD.NOTIFICATION_TYPE.WARNING)
},
// 文件校验方法
beforeAvatarUpload(file) {
// 不能导入大小超过2Mb的文件
if (file.size > 10 * 1024 * 1024) {
return false
}
return true
},
// 文件发生改变就会触发的事件
uploadByJsqd(file) {
this.file1 = file
},
submit() {
if (this.beforeAvatarUpload(this.file1)) {
this.fileList.name = this.file1.name
this.fileList.url = ''
var formdata = new FormData()
formdata.append('file', this.file1.raw)
// excelImport请求接口 formdata传递参数
crudMaterial.excelImport(formdata).then((res) => {
this.crud.notify('导入成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.$emit('tableChanged3', '')
this.$emit('update:dialogShow', false)
}).catch(err => {
const list = err.response.data.message
download2('/api/produceWorkorder/download', list).then(result => {
downloadFile(result, '错误信息汇总', 'xlsx')
crud.downloadLoading = false
})
})
} else {
this.crud.notify('文件过大请上传小于10MB的文件〜', CRUD.NOTIFICATION_TYPE.WARNING)
}
}
}
}
</script>

View File

@@ -24,12 +24,12 @@
<el-button
slot="right"
class="filter-item"
type="success"
icon="el-icon-refresh"
type="warning"
icon="el-icon-upload2"
size="mini"
@click="materialSync"
@click="uploadShow = true"
>
物料同步
导入
</el-button>
</crudOperation>
<!--表单组件-->
@@ -106,9 +106,6 @@
<el-table-column prop="material_spec" label="物料规格" width="140" />
<el-table-column prop="material_model" label="物料型号" />
<el-table-column prop="class_name" label="物料分类" width="140" />
<el-table-column prop="unit_name" label="计量单位" />
<el-table-column prop="standing_time" label="静置时间分钟" width="130px" />
<el-table-column prop="product_series_name" label="系列" />
<el-table-column label="启用" align="center" prop="is_used">
<template slot-scope="scope">
<el-switch
@@ -141,6 +138,7 @@
<!--分页组件-->
<pagination />
</div>
<UploadDialog :dialog-show.sync="uploadShow"/>
</div>
</template>
@@ -151,6 +149,7 @@ import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import UploadDialog from './UploadDialog'
const defaultForm = {
material_id: null,
@@ -190,7 +189,7 @@ export default {
name: 'Materia',
// 数据字典
dicts: ['is_used'],
components: { pagination, crudOperation, rrOperation, udOperation },
components: { UploadDialog, pagination, crudOperation, rrOperation, udOperation },
mixins: [presenter(), header(), form(defaultForm), crud()],
cruds() {
return CRUD({
@@ -208,6 +207,7 @@ export default {
classes2: [],
classes3: [],
fullscreenLoading: false,
uploadShow: false,
measure_unit: [],
productSeries: [],
permission: {},

View File

@@ -55,4 +55,11 @@ export function materialSync(data) {
})
}
export default { add, edit, del, getMaterOptType, isAlongMaterType, getProductSeries, materialSync }
export function excelImport(data) {
return request({
url: 'api/Materia/importExcel',
method: 'post',
data
})
}
export default { add, edit, del, excelImport, getMaterOptType, isAlongMaterType, getProductSeries, materialSync }

View File

@@ -233,7 +233,8 @@
</el-table-column>
<el-table-column show-overflow-tooltip prop="form_type" min-width="120" :formatter="bill_typeFormat" label="单据类型" />
<el-table-column show-overflow-tooltip prop="stor_name" min-width="120" label="仓库" />
<el-table-column prop="qty" label="物料数量" show-overflow-tooltip />
<el-table-column prop="qty" label="单据物料数量" show-overflow-tooltip />
<el-table-column prop="actual_qty" label="明细实际数量" show-overflow-tooltip width="120" />
<el-table-column prop="material_code" label="物料编码" show-overflow-tooltip :min-width="flexWidth('material_code',crud.data,'物料编码')" />
<el-table-column prop="material_name" label="物料名称" show-overflow-tooltip :min-width="flexWidth('material_name',crud.data,'物料名称')" />
<el-table-column prop="material_spec" label="物料规格" show-overflow-tooltip :min-width="flexWidth('material_spec',crud.data,'物料规格')" />
@@ -247,8 +248,6 @@
</template>
</template>
</el-table-column>
<el-table-column prop="actual_qty" label="明细实际数量" show-overflow-tooltip width="120" />
<el-table-column prop="total_qty" label="单据累计数量" show-overflow-tooltip width="130" />
<el-table-column prop="remark" label="备注" show-overflow-tooltip width="120" />
<el-table-column prop="create_name" label="创建人" />
<el-table-column prop="create_time" label="创建时间" :min-width="flexWidth('create_time',crud.data,'创建时间')" />