This commit is contained in:
ln1778 2024-05-06 15:14:21 +08:00
parent 131770e3d8
commit e55a87bf39
15 changed files with 242 additions and 241 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

134
CommonInput/Barcodescan.vue Normal file
View File

@ -0,0 +1,134 @@
<template>
<div>
<!-- 阻止扫码枪的Enter事件自动提交el-form的提交特性 -->
<!-- <el-form @submit.native.prevent>
<el-form-item label="输入条码">
<el-input
v-model="barcode"
type="text"
placeholder="输入条码"
@keyup.native="handleKeyUp"
></el-input>
</el-form-item>
</el-form> -->
</div>
</template>
<script>
let barcodeVue = {
name: "Barcodescan",
props: {
shopName: {
type: String,
},
},
data() {
return {
realBarcode: "",
keyupLastTime: undefined,
name: undefined,
regexRules: [],
};
},
created() {
let that = this;
// keyup
document.onkeyup = function (e) {
that.handleKeyUp(e);
};
this.name = this.shopName;
this.initRegexRules();
},
methods: {
//
initRegexRules() {
this.regexRules = [
{
regex: "/^IN(\\w|\\d)+$/",
value: "putInStorageNumber",
},
{
regex: "/^CH(\\w|\\d)+$/",
value: "checkNumber",
},
{
regex: "/^AL(\\w|\\d)+$/",
value: "allocateNumber",
},
{
regex: "/^\\d{12}$/",
value: "orderNumber",
},
{
regex: "/^SR(\\w|\\d)+$/",
value: "transferNumber",
},
{
regex: "/^\\d{12}-\\d{3}$/",
value: "sendNo",
},
{
regex: "/^PL\\d{10}$/",
value: "wavePickingNumber",
},
{
regex: "/^PL\\d{10}-\\d{3}$/",
value: "wavePickingGroupNumber",
},
{
regex: "/^(\\w|\\d)*-[\\w|\\d]*-\\d*-[A-Z]-\\d*/",
value: "location",
},
];
},
// keyup
handleKeyUp(e) {
let gap = 0;
if (this.keyupLastTime) {
gap = new Date().getTime() - this.keyupLastTime;
if (gap > 50) {
gap = 0;
this.realBarcode = "";
}
}
this.keyupLastTime = new Date().getTime();
// keyupkeyProcess
if (e.key != "Process" && gap < 50) {
if (e.key.trim().length == 1) {
//
this.realBarcode += e.key;
} else if (e.key.trim() == "Enter") {
// barcode
if (this.realBarcode) {
let data = {
type: this.barcodeRule(this.realBarcode),
code: this.realBarcode,
isLocal: this.isLocal(this.realBarcode),
};
this.$emit("handle", data);
this.realBarcode = "";
}
}
}
},
// barCode
barcodeRule(barcode) {
let value;
this.regexRules.some((item, index) => {
let regex = eval(item.regex);
if (regex.test(barcode)) {
value = item.value;
return true;
}
});
return value ? value : "barCode";
},
//
isLocal(barcode) {
return this.name ? barcode.indexOf(this.name) != -1 : undefined;
},
},
};
export default { ...barcodeVue };
</script>

View File

@ -6,7 +6,8 @@
placeholder="请选择"
class="dateselect"
:size="size"
@keydown.enter.native="Enter"
@keydown.enter.native="search"
@change="changeText"
>
<template slot="prefix">
{{ (PopUp.find((e) => e.enName == select) || {}).lable }}
@ -42,7 +43,7 @@
</div>
<div>
<el-button size="mini" @click="clear">清空</el-button>
<el-button size="mini" type="primary" plain @click="Enter"
<el-button size="mini" type="primary" plain @click="search"
>查询</el-button
>
</div>
@ -54,7 +55,7 @@
class="compound-input"
:placeholder="placeholder"
@input="changeText('value')"
@keydown.enter.native="Enter"
@keydown.enter.native="search"
>
<i
slot="suffix"
@ -71,14 +72,13 @@
<script>
export default {
name:'Compound',
props: {
size: {
type: String,
default: "small",
},
default: {
default: "imei",
default: null,
},
data: {
type: Array,
@ -102,11 +102,19 @@ export default {
//
PopUp() {
if (!this.data) return;
return this.data.filter((item) => item.isPopUp);
let arr = [];
arr = this.data.filter((item) => item.isPopUp && item.show);
if (arr && arr.length) {
arr.findIndex((e) => e.enName == this.select) == -1
? this.$set(this, "select", arr[0].enName)
: "";
}
return arr;
},
},
methods: {
changeText(mark) {
if (mark) {
const rep = /[^\s]+/g;
let values = "";
if (mark == "textarea") {
@ -117,6 +125,8 @@ export default {
values = this.value;
}
this.values = values;
}
this.$emit("CompoundSearch", this.select, this.values);
},
//
eject() {
@ -124,16 +134,19 @@ export default {
},
//
clear() {
this.$set(this, "textarea", "");
this.$set(this, "value", "");
this.$set(this, "values", "");
this.disable = false;
this.textarea = "";
},
//
close() {
this.popBox = false;
},
//
Enter() {
console.log(this.select, this.values, "++++++this.value, imeisn");
search() {
this.close();
this.$emit("SearchCompound");
},
},
};

View File

@ -9,7 +9,7 @@ const idGen = () => {
};
export default {
name:'ErpEchart',
name:'erp_echarts',
props: {
height: {
type: String,

View File

@ -1,12 +0,0 @@
## ErpEcharts 图表封装
> **组件名ErpEcharts**
> 代码块: `ErpEcharts`
> 关联组件:`echarts`
> **子组件:传参**
> options组件接收的参数直接去echarts图表中复制option传到组件即可
> width: "600px",----------------------------图表宽度(选填)
> height: "400px",----------------------------图表高度(选填)
> **注意事项**
> 循环多个图表时this.uuid必须为唯一值

View File

@ -1,126 +0,0 @@
## MoreClass 级联选择器弹出层
> **组件名MoreClass**
> 代码块: `MoreClass`
> 关联组件:`el-element`
> **子组件:传参**
> data组件接收的参数默认为[] 其中classifiable等于true的时候默认到该组件
> lable: "分类",----------------------------输入框名称(选填)
> type: "el-select",------------------------输入框类型el-inpit,el-selec组件没用到但最好必填
> enName: "cate_id",------------------------返回值与model双向绑定必填
> placeholder: "请选择机器类型",-------------输入框占位文本(选填)
> size: "small",----------------------------输入框大小(选填)
> show: true,-------------------------------是否展示(必填)
> filterable: true,-------------------------是否可搜索(选填)
> clearable: true,--------------------------是否可清除(选填)
> classifiable: true,-----------------------是否分类,使用组件必填(必填)
> disabled: false,--------------------------是否禁用(选填)
> loading: false,---------------------------加载效果(选填)
> options: [],------------------------------输入框下拉的值,父组件调用接口传递
> formLabelAlign组件返回的参数与v-model双向绑定{}
> disabled组件是否禁用默认false
> size:组件大小默认值small
> width组件宽度默认450
> Title组件最外层占位文本默认为请选择分类/品牌/型号
> **子组件:方法**
> SearchClass点击查询后直接父组件中打印formLabelAlign的值
> ClearInput父组件绑定ref直接调用子组件ClearInput方法然后子组件会给父组件抛出一个resetfrom方法在父组件resetfrom中清空formLabelAlign中的邦定值
> **父组件:方法**
> getphonetype():父组件中获取第一条分类数据
> SelectChange():选择数据后调用 后面是处理方法其中如果不是同一个接口resetFields中的值需要改变后续代码也要修改
SelectChange(item) {
const resetFields = {
cate_id: ["brand_id", "model_id", "color_id", "rom_id"],
brand_id: ["model_id", "color_id", "rom_id"],
model_id: ["color_id", "rom_id"],
};
Object.entries(resetFields).forEach(([field, resetFields]) => {
if (item.enName === field) {
resetFields.forEach((field) => {
this.formLabelAlign[field] = "";
this.input.find((res) => res.enName === field).options = [];
});
}
});
/** 获取型号 颜色 容量*/
if (item.enName == "cate_id" && this.formLabelAlign.cate_id != "") {
this.getqualityinfo(
{ cate_id: this.formLabelAlign.cate_id },
1,
"brand_id"
);
} else if (
item.enName == "brand_id" &&
this.formLabelAlign.brand_id != ""
) {
this.getqualityinfo(
{
cate_id: this.formLabelAlign.cate_id,
brand_id: this.formLabelAlign.brand_id,
},
2,
"model_id"
);
} else if (
item.enName == "model_id" &&
this.formLabelAlign.model_id != ""
) {
this.getqualityinfo(
{
cate_id: this.formLabelAlign.cate_id,
brand_id: this.formLabelAlign.brand_id,
model_id: this.formLabelAlign.model_id,
},
3,
"color_id"
);
}
},
// 获取品牌,颜色,模型数据
async getqualityinfo(data, val, itm) {
this.input.forEach((item) => {
if (item.enName == itm) {
item.loading = true;
}
});
try {
const res = await cate_brand_list_in_stock(data);
this.input.forEach((item) => {
if (item.enName == itm) {
item.loading = false;
}
});
if (res.errcode !== 0) return;
if (val == 1) {
this.updateInputOptions("brand_id", res.datas);
} else if (val == 2) {
this.updateInputOptions("model_id", res.datas);
} else {
this.updateInputOptions("rom_id", res.datas.rom_list);
this.updateInputOptions("color_id", res.datas.color_list);
}
} catch (error) {
// 处理错误
console.error(error);
}
},
处理数据
updateInputOptions(enName, list) {
const mappedList = Array.isArray(list)
? list.map((item) => ({ label: item.label, value: item.value }))
: [];
this.input.forEach((r, i) => {
if (r.enName === enName) {
if (
r.enName !== "model_id" &&
r.enName !== "cate_id" &&
r.enName !== "brand_id"
) {
this.input[i].show =
Array.isArray(list) && list.length ? true : false;
}
this.input[i].options = mappedList;
}
});
},

View File

@ -1,4 +1,18 @@
<!-- 分类传值 -->
<!-- input: [{
lable: "分类",------------------------------------输入框名称选填
type: "el-select",--------------------------------输入框类型el-inpit,el-select组件没用到但最好必填
enName: "cate_id",--------------------------------返回值与model双向绑定必填)
placeholder: "请选择机器类型",---------------------输入框占位文本选填
size: "small",------------------------------------输入框大小选填
show: true,---------------------------------------是否展示必填
filterable: true,---------------------------------是否可搜索选填
clearable: true,----------------------------------是否可清除选填
classifiable: true,-------------------------------是否分类使用组件必填必填
disabled: false,----------------------------------是否禁用选填
loading: false,-----------------------------------加载效果选填
options: [],--------------------------------------输入框下拉的值父组件调用接口传递
}] -->
<template>
<div class="machinemore">
<el-popover
@ -63,7 +77,6 @@
<script>
export default {
name:'MoreClass',
props: {
disabled: {
type: Boolean,

View File

@ -15,7 +15,7 @@
<el-form-item
:label="item.label"
:prop="item.prop"
v-show="item.show"
v-if="item.MoreScreen"
>
<div
:is="item.type"
@ -36,6 +36,20 @@
</el-option>
</div>
</el-form-item>
<el-form-item
v-if="item.show && item.Composite"
:label="item.lable"
:prop="item.prop"
>
<Composite
:key="item.componentKey"
:data="item.options"
:default="item.default"
:content="item.placeholder"
:enName="item.enName"
@CompositeVal="CompositeVal"
></Composite>
</el-form-item>
</el-col>
</el-row>
</el-form>
@ -57,8 +71,8 @@
</template>
<script>
import Composite from "@/components/CommonInput/Composite.vue";
export default {
name:'MoreScreen',
props: {
data: {
default: () => {
@ -72,7 +86,7 @@ export default {
},
},
},
components: {},
components: { Composite },
data() {
return {
visible: false, //
@ -81,7 +95,9 @@ export default {
computed: {
screenList() {
if (!this.data) return;
return this.data.filter((item) => item.MoreScreen);
return this.data.filter(
(item) => (item.MoreScreen || item.Composite) && item.show
);
},
},
methods: {
@ -98,12 +114,15 @@ export default {
this.visible = false;
this.$emit("search");
},
CompositeVal(val) {
this.$emit("CompositeVal", val);
},
},
};
</script>
<style scoped lang='scss'>
.morescreen{
.morescreen {
display: inline-block;
}
.machinebox {

View File

@ -1,21 +0,0 @@
## TimingModule 时间选择器
> **组件名TimingModule**
> 代码块: `TimingModule`
> 关联组件:`el-element`
> **子组件:传参**
> data组件接收的参数默认为[] 其中type等于el-date-picker的时候默认到该组件
> lable: "分类名称",----------------------------输入框名称(必填)
> type: "el-date-picker",------------------------输入框类型el-date-picker必填
> TimeType:daterange(daterange为时间段date为当前时间)
> enName: "time",------------------------返回值与model双向绑定必填
> show: true,-------------------------------是否展示(必填)
> size:组件大小默认值small
> default:默认参数
> **子组件:方法**
> getDateTime子组件抛出一个getDateTime(a,b)接受两个参数a为下拉选择器的值b为时间值
> **注意事项**
> 循环多个图表时this.uuid必须为唯一值

View File

@ -1,5 +1,5 @@
<template>
<div class="TimingModule">
<div class="TimingModule" v-if="timer && timer.length">
<el-select
v-model="select"
placeholder="请选择"
@ -51,10 +51,9 @@
<script>
export default {
name:'TimingModule',
props: {
default: {
default: null,
default: "time",
},
size: {
type: String,
@ -192,7 +191,16 @@ export default {
computed: {
timer() {
if (!this.data) return;
return this.data.filter((item) => item.type === "el-date-picker");
let arr = [];
arr = this.data.filter(
(item) => item.type === "el-date-picker" && item.show
);
if (arr && arr.length) {
arr.findIndex((e) => e.enName == this.select) == -1
? this.$set(this, "select", arr[0].enName)
: "";
}
return arr;
},
},
methods: {
@ -206,7 +214,7 @@ export default {
this.screen();
},
//
timeChange(e) {
timeChange() {
this.screen();
},
//
@ -215,14 +223,17 @@ export default {
this.timer.find((e) => e.enName == this.select).TimeType == "daterange"
) {
this.$emit("getDateTime", this.select, this.DateTime);
console.log(this.select, this.DateTime);
} else if (
this.timer.find((e) => e.enName == this.select).TimeType == "date"
) {
this.$emit("getDateTime", this.select, this.Time);
console.log(this.select, this.Time);
}
},
clear() {
this.select = "";
this.DateTime = "";
this.Time = "";
},
},
};
</script>

View File

@ -22,7 +22,6 @@
<script>
export default {
name:'appTitle',
props: ["shoptitle"],
data() {
return {

View File

@ -1,15 +0,0 @@
## Compound 多功能输入框(支持输入多组数据)
> **组件名Compound**
> 代码块: `Compound`
> 关联组件:`el-element`
> **子组件:传参**
> data组件接收的参数默认为[] 其中isPopUp等于true的时候默认到该组件
> lable: "IMEI/SN/机器编号",----------------------------输入框名称(选填)
> type: "el-select",------------------------输入框类型(必填)
> enName: "cate_id",------------------------返回值与model双向绑定必填
> size: "small",----------------------------输入框大小(选填)
> show: true,-------------------------------是否展示(必填)
> isPopUp: true,-----------------------是否分类,使用组件必填(必填)
> default组件默认值
> size:组件大小默认值small

View File

@ -1,12 +0,0 @@
## selectbtn 多功能多选组件(仅筛选,多选,反选,模糊查询选择操作)
> **组件名SelectBtn**
> 代码块: `selectbtn`
> 关联组件:`el-element`
> **子组件:传参**
> SourceData组件接收的参数默认为[{label:'',value:''}] 接口的数据
> dropdowntitle:组件占位文本
> value:返回值的字段名如value"name_id" 则search中parmas的接收参数为{name_id:['返回的参数']},参数为必填
> selectAll:默认false是否全选
> **子组件:方法**
> search(params):params接收选择的参数

View File

@ -71,7 +71,6 @@
<script>
export default {
name:'selectbtn',
props: ["SourceData", "dropdowntitle", "value", "selectAll"],
data() {
return {
@ -108,7 +107,7 @@ export default {
//
checkeddown() {
if (this.checkedList.length) {
this.checkedList = this.selectvalue;
this.checkedList =Object.assign([],this.selectvalue) ;
} else {
this.checkedList = [];
}
@ -239,7 +238,6 @@ export default {
this.selectvalue = this.checkedList;
this.valuelength = this.checkedList.length - 1;
let params = { [this.value]: this.selectvalue };
console.log(this.selectvalue.length, "测试params");
this.cancel();
this.$emit("search", params);
},

View File

@ -1,6 +1,6 @@
{
"name": "erp-element-ui",
"version": "1.0.3",
"version": "1.0.5",
"description": "",
"main": "index.js",
"scripts": {