WMS系统文件新增,NPM添加功能(kr-print-designer打印功能插件=》预计作为二维码条码使用) (moment时间简易处理插件)(stylus stylus-loader css样式预处理)

This commit is contained in:
赵正易
2024-03-08 08:30:12 +08:00
parent 0178182920
commit ef18db877d
102 changed files with 16448 additions and 161 deletions

View File

@@ -0,0 +1,50 @@
<template>
<el-radio-group
v-model="radioValue"
@change="change"
v-bind="$props"
>
<el-radio-button
v-for="dict in dictList"
:key="dict.value"
:label="dict.value"
>{{ dict.label }}
</el-radio-button
>
</el-radio-group>
</template>
<script>
export default {
props: ['radioData', 'size', 'value', 'showAll'],
data() {
return {
// value:this.value
}
},
computed: {
radioValue: {
get() {
return this.value;
},
set(v) {
this.$emit('input', v);
}
},
dictList() {
if (this.showAll === "all") {
let list = this.radioData;
list.splice(0, 0, {label: "全部", value: null})
return list
} else {
return this.radioData
}
}
},
methods: {
change(val) {
this.$emit('change', val)
},
}
}
</script>

View File

@@ -0,0 +1,37 @@
<template>
<el-select v-model="model" v-bind="$props" @change="valueChange" :disabled="disabled">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</template>
<script>
export default {
props: ["size", "value","options","disabled"],
data() {
return {
// value:this.value
}
},
methods: {
valueChange(val){
this.$emit("change",val)
}
},
computed: {
model: {
get() {
return this.value+'';
},
set(v) {
this.$emit("input", v);
},
},
},
};
</script>

View File

@@ -0,0 +1,88 @@
<template>
<div class="item-select-wrapper">
<el-cascader :options="options" :clearable="clearable" placeholder="请选择操作类型" v-model="value1" :size="size"
:show-all-levels="false">
</el-cascader>
</div>
</template>
<script>
const optionsMap = [{
name: "入库",
dictName: "wms_receipt_type",
},
{
name: "出库",
dictName: "wms_shipment_type",
},
{
name: "移库",
dictName: "wms_movement_type",
},
{
name: "盘点",
dictName: "wms_check_type",
}
]
const dictNames = optionsMap.map(item => item.dictName)
const names = optionsMap.map(item => item.name)
export default {
name: 'InOutTypeSelect',
dicts: dictNames,
props: {
value: {
type: [String, Number],
default: null
},
size: {
type: String,
default: 'small'
},
clearable: {
type: Boolean,
default: true
}
},
data() {
return {}
},
computed: {
value1: {
get() {
return this.value
},
set(v) {
// 取数组的第二个元素
let type = v[1] || v[0] || null
this.$emit('input', type)
}
},
options: {
get() {
let options = []
let dict = this.dict.type
for (let i = 0; i < dictNames.length; i++) {
let dictName = dictNames[i]
let name = names[i]
let option = {
value: name,
label: name,
children: dict[dictName].map(item => {
return {
value: item.value,
label: item.label
}
})
}
options.push(option)
}
return options
}
}
},
}
</script>
<style lang="stylus">
</style>

View File

@@ -0,0 +1,69 @@
<template>
<div class="item-select-wrapper">
<el-select v-model="value1" filterable="filterable" remote="remote" clearable="clearable" :remote-method="doSearch" :loading="loading" :size="size">
<el-option v-for="item in options" :key="item.id" :label="item.itemName" :value="item.id">
<div>{{ item.itemName }}</div>
<div class="info">{{ item.itemNo }}</div>
</el-option>
</el-select>
</div>
</template>
<script>
import {
listWmsItem
} from '@/api/wms/item'
export default {
name: 'ItemSelect',
props: {
value: {
type: [String, Number],
default: null
},
size: {
type: String,
default: 'small'
}
},
data() {
return {
options: [],
loading: false
}
},
computed: {
value1: {
get() {
return this.value
},
set(v) {
this.$emit('input', v)
}
}
},
created() {
this.doSearch();
},
methods: {
doSearch(search) {
listWmsItem({
search
}, {
page: 0,
size: 20
}).then(res => {
const {
content,
totalElements
} = res
this.options = content
})
}
}
}
</script>
<style lang="stylus">
</style>

View File

@@ -0,0 +1,70 @@
<template>
<div class="item-select-wrapper">
<el-select v-model="value1" filterable="filterable" remote="remote" clearable="clearable"
:remote-method="doSearch" :loading="loading" :size="size">
<el-option v-for="item in options" :key="item.id" :label="item.itemName" :value="item.id">
<div>{{ item.itemName }}</div>
<div class="info">{{ item.itemNo }}</div>
</el-option>
</el-select>
</div>
</template>
<script>
import {
listWmsItem
} from '@/api/wms/item'
export default {
name: 'ItemSelect',
props: {
value: {
type: [String, Number],
default: null
},
size: {
type: String,
default: 'small'
}
},
data() {
return {
options: [],
loading: false
}
},
computed: {
value1: {
get() {
return this.value
},
set(v) {
this.$emit('input', v)
}
}
},
created() {
this.doSearch();
},
methods: {
doSearch(search) {
listWmsItem({
search
}, {
page: 0,
size: 20
}).then(res => {
const {
content,
totalElements
} = res
this.options = content
})
}
}
}
</script>
<style lang="stylus">
</style>

View File

@@ -0,0 +1,71 @@
<template>
<div class="number-range-wrapper">
<el-input class="start" :value="value1[0]" @input="changeVal(0, $event)" placeholder="起始值"></el-input>
<div class="c-line"><span>-</span></div>
<el-input class="end" :value="value1[1]" @input="changeVal(1, $event)" placeholder="结束值"></el-input>
</div>
</template>
<script>
export default {
name: 'NumberRange',
props: {
value: {
type: Array,
default: [],
},
},
computed: {
value1: {
get() {
return this.value || []
},
set(v) {
this.$emit('input', v)
},
},
},
methods: {
changeVal(idx, v) {
const val = [...this.value1]
val[idx] = v ? Number(v) : null
this.value1 = val
},
},
}
</script>
<style scoped>
.number-range-wrapper {
max-width: 240px;
display: inline-flex;
align-items: stretch;
line-height: 1;
}
.c-line {
border-top: 1px solid #dcdfe6;
border-bottom: 1px solid #dcdfe6;
padding: 0 8px;
margin: 0 -1px;
color: #dcdfe6;
z-index: 1;
background-color: white;
display: inline-flex;
align-items: center;
user-select: none;
}
.start .el-input__inner {
border-top-right-radius: 0 !important;
border-bottom-right-radius: 0 !important;
}
.start .el-input__inner:hover {
z-index: 2;
}
.end .el-input__inner {
border-top-left-radius: 0 !important;
border-bottom-left-radius: 0 !important;
}
.end .el-input__inner:hover {
z-index: 2;
}
</style>

View File

@@ -0,0 +1,59 @@
<template>
<el-cascader
placeholder="请选择仓库信息"
:options="options"
:props="{ checkStrictly: true }"
v-model="selections"
clearable
filterable>
</el-cascader>
</template>
<script>
import { mapGetters } from 'vuex';
export default {
props: ['value','size'],
data(){
return{
options:[]
}
},
computed:{
...mapGetters(['areaList','warehouseList']),
selections:{
get(){
return this.value;
},
set(v){
this.$emit('input',v);
}
}
},
created(){
this.setOption()
},
methods:{
setOption(){
let areaMap = new Map()
let warehouseMap=new Map()
this.areaList.forEach(area=>{
let children=warehouseMap.get(area.warehouseId)
if(children){
children.push({value:area.id,label:area.areaName,children:areaMap.get(area.id)})
}else{
children=[{value:area.id,label:area.areaName,children:areaMap.get(area.id)}]
}
warehouseMap.set(area.warehouseId,children)
})
this.warehouseList.forEach(warehouse=>{
this.options.push({value:warehouse.id,label:warehouse.warehouseName,children:warehouseMap.get(warehouse.id)})
})
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,34 @@
<template>
<el-select placeholder="请选择承运商" clearable v-model=" carrier">
<el-option
v-for="customer in carrierList"
:key="customer.id"
:label="customer.carrierName"
:value="customer.id"
></el-option>
</el-select>
</template>
<script>
import {mapGetters} from 'vuex';
export default {
props: ['value', 'size'],
data() {
return {}
},
computed: {
...mapGetters(['carrierList']),
carrier: {
get() {
return this.value;
},
set(v) {
this.$emit('input', v);
}
}
},
created() {
},
methods: {}
}
</script>

View File

@@ -0,0 +1,36 @@
<template>
<el-select placeholder="请选择客户" clearable v-model="customer">
<el-option
v-for="customer in customerList"
:key="customer.id"
:label="customer.customerName"
:value="customer.id"
></el-option>
</el-select>
</template>
<script>
import { mapGetters } from 'vuex';
export default {
props: ['value','size'],
data() {
return {
}
},
computed: {
...mapGetters(['customerList']),
customer: {
get() {
return this.value;
},
set(v) {
this.$emit('input', v);
}
}
},
created() {
},
methods: {
}
}
</script>

View File

@@ -0,0 +1,103 @@
<template>
<el-dialog :visible.sync="dialogVisible" title="库存一览" width="600px" @close="handleDialogClose">
<div ref="reportHTML" v-html="msg" class="web-con"></div>
<el-table :data="wmsInventoryList" v-loading="loading">
<el-table-column width="100" property="itemName" label="物料名称"></el-table-column>
<el-table-column width="150" property="itemTypeName" label="物料类别"></el-table-column>
<el-table-column property="warehouseName" label="仓库/库区"></el-table-column>
<el-table-column width="100" property="quantity" label="库存"></el-table-column>
</el-table>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="handleDialogConfirm"> </el-button>
</span>
</el-dialog>
</template>
<script>
import { mapGetters } from 'vuex'
import { listWmsInventory } from "@/api/wms/inventory";
export default {
props: {
value: {
type: [String, Number, Array],
default: null
},
size: {
type: String,
default: 'small'
},
disabled: {
type: Boolean,
default: false
},
prodId: {
type: [Number, String],
default: null
},
msg: {
type: String,
default: ""
}
},
data() {
return {
wmsInventoryList: [],
loading: true,
dialogVisible: true,
selectedValue: ''
}
},
computed: {
...mapGetters(['rackList', 'areaList', 'warehouseList']),
selections: {
get() {
return this.value
},
set(v) {
this.$emit('input', v)
}
}
},
created() {
this.setOptions()
},
methods: {
setOptions() {
this.loading = true
listWmsInventory({ itemId: this.prodId }, {}).then(response => {
const { content, totalElements } = response
this.wmsInventoryList = content
content.forEach(item => {
if (!item.warehouseName) {
item.warehouseName = "暂未分配仓库"
}
if (item.areaName) {
if (item.areaName) {
item.warehouseName = `${item.warehouseName}/${item.areaName}`;
}
}
});
this.total = totalElements;
this.loading = false;
});
},
handleDialogClose() {
this.selectedValue = this.selections;
},
showDialog() {
this.dialogVisible = true;
},
handleDialogConfirm() {
// 处理对话框确认按钮的逻辑
// 可以在这里获取选中的值并进行相应的处理
// 例如,将选中的值赋给输入框的绑定值
this.selectedValue = this.selections;
this.dialogVisible = false; // 关闭对话框
}
}
}
</script>

View File

@@ -0,0 +1,36 @@
<template>
<el-select placeholder="请选择供应商" clearable v-model="supplier">
<el-option
v-for="supplier in supplierList"
:key="supplier.id"
:label="supplier.supplierName"
:value="supplier.id"
></el-option>
</el-select>
</template>
<script>
import { mapGetters } from 'vuex';
export default {
props: ['value','size'],
data() {
return {
}
},
computed: {
...mapGetters(['supplierList']),
supplier: {
get() {
return this.value;
},
set(v) {
this.$emit('input', v);
}
}
},
created() {
},
methods: {
}
}
</script>

View File

@@ -0,0 +1,39 @@
<template>
<el-table ref="multipleTable" v-bind="$props" @selection-change="handleSelectionChange" @row-click="handleRowClick">
<slot />
</el-table>
</template>
<script>
export default {
props: ['data'],
data() {
return {
selectionData: []
}
},
methods: {
// 向父组件共享数据
handleSelectionChange(val) {
this.$emit('selection-change', val)
},
handleRowClick(row, column, event) {
// selectionData -- 已选的数据
let index = this.selectionData.findIndex(item => {
// 判断已选数组中是否已存在该条数据
return item.id == row.id
})
if (index == -1) {
// 如果未存在设置已选状态并在list中添加这条数据
this.$refs.multipleTable.toggleRowSelection(row, true); //设置复选框为选中状态
this.selectionData.push(row)
} else {
// 如果已存在设置未选状态并在list中删除这条数据
this.$refs.multipleTable.toggleRowSelection(row, false); //设置复选框为未选状态
this.selectionData.splice(index, 1)
}
}
}
}
</script>

View File

@@ -0,0 +1,72 @@
<template>
<el-cascader placeholder="请选择仓库信息" :options="options" v-model="selections" :props="{ checkStrictly: true }" clearable :size="size" :disabled="disabled" filterable></el-cascader>
</template>
<script>
import { mapGetters } from 'vuex'
export default {
props: {
value: {
type: [String, Number, Array],
default: null
},
size: {
type: String,
default: 'small'
},
disabled: {
type: Boolean,
default: false
}
},
data() {
return {
options: []
}
},
computed: {
...mapGetters(['rackList', 'areaList', 'warehouseList']),
selections: {
get() {
return this.value
},
set(v) {
this.$emit('input', v)
}
}
},
created() {
this.setOptions()
},
methods: {
setOptions() {
let areaMap = new Map()
let warehouseMap = new Map()
// this.rackList.forEach(rack => {
// let children = areaMap.get(rack.areaId)
// if (!children) {
// children = []
// areaMap.set(rack.areaId, children)
// }
// children.push({ value: rack.id, label: rack.rackName })
// })
this.areaList.forEach(area => {
let children = warehouseMap.get(area.warehouseId)
if (!children) {
children = []
warehouseMap.set(area.warehouseId, children)
}
children.push({ value: area.id, label: area.areaName, children: areaMap.get(area.id) })
})
this.options = this.warehouseList.map(warehouse => {
return {
value: warehouse.id,
label: warehouse.warehouseName,
children: warehouseMap.get(warehouse.id)
}
})
}
}
}
</script>

119
src/components/main.js Normal file
View File

@@ -0,0 +1,119 @@
import Vue from 'vue'
import Cookies from 'js-cookie'
import Element from 'element-ui'
import './assets/styles/element-variables.scss'
import '@/assets/styles/index.scss' // global css
import '@/assets/styles/ruoyi.scss' // ruoyi css
import App from './App'
import store from './store'
import router from './router'
import directive from './directive' // directive
import plugins from './plugins' // plugins
import { download } from '@/utils/request'
import './assets/icons' // icon
import './permission' // permission control
import { getDicts } from "@/api/system/dict/data";
import { getConfigKey } from "@/api/system/config";
import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi";
// 分页组件
import Pagination from "@/components/Pagination";
// 自定义表格工具组件
import RightToolbar from "@/components/RightToolbar"
// 富文本组件
import Editor from "@/components/Editor"
// 文件上传组件
import FileUpload from "@/components/FileUpload"
// 图片上传组件
import ImageUpload from "@/components/ImageUpload"
// 图片预览组件
import ImagePreview from "@/components/ImagePreview"
// 字典标签组件
import DictTag from '@/components/DictTag'
// 头部标签组件
import VueMeta from 'vue-meta'
// 字典数据组件
import DictData from '@/components/DictData'
//wms table组件
import WmsTable from '@/components/WmsTable'
import WmsSupplierSelect from '@/components/WmsSupplierSelect'
import WmsCustomerSelect from '@/components/WmsCustomerSelect'
import KrPrintDesigner from "kr-print-designer";
import "kr-print-designer/lib/kr-print-designer.css";
import DictRadio from '@/components/DictRadio'
import DictSelect from '@/components/DictSelect'
import WmsWarehouseCascader from '@/components/WmsWarehouseCascader'
import vuePlugsPrint from '@/utils/vuePlugsPrint'
import WmsCarrierSelect from "@/components/WmsCarrierSelect/index.vue";
// 全局方法挂载
Vue.prototype.getDicts = getDicts
Vue.prototype.getConfigKey = getConfigKey
Vue.prototype.parseTime = parseTime
Vue.prototype.resetForm = resetForm
Vue.prototype.addDateRange = addDateRange
Vue.prototype.selectDictLabel = selectDictLabel
Vue.prototype.selectDictLabels = selectDictLabels
Vue.prototype.download = download
Vue.prototype.handleTree = handleTree
// 全局组件挂载
Vue.component('DictTag', DictTag)
Vue.component('Pagination', Pagination)
Vue.component('RightToolbar', RightToolbar)
Vue.component('Editor', Editor)
Vue.component('FileUpload', FileUpload)
Vue.component('ImageUpload', ImageUpload)
Vue.component('ImagePreview', ImagePreview)
Vue.component('WmsTable',WmsTable)
Vue.component('WmsSupplierSelect',WmsSupplierSelect)
Vue.component('WmsCustomerSelect',WmsCustomerSelect)
Vue.component('WmsCarrierSelect',WmsCarrierSelect)
Vue.component('DictRadio',DictRadio)
Vue.component('DictSelect',DictSelect)
Vue.component('WmsWarehouseCascader',WmsWarehouseCascader)
Vue.use(KrPrintDesigner);
Vue.use(vuePlugsPrint);
Vue.use(directive)
Vue.use(plugins)
Vue.use(VueMeta)
DictData.install()
/**
* If you don't want to use mock-server
* you want to use MockJs for mock api
* you can execute: mockXHR()
*
* Currently MockJs will be used in the production environment,
* please remove it before going online! ! !
*/
Vue.use(Element, {
size: Cookies.get('size') || 'medium' // set element-ui default size
})
Vue.config.productionTip = false
new Vue({
el: '#app',
router,
store,
render: h => h(App)
})
var _hmt = _hmt || [];
window._hmt = _hmt;
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?8611b8753c9d6bb71fd882dc61e4adf2";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();