From 3cec961d0e0c0e89981dc960135014bfa1f1f021 Mon Sep 17 00:00:00 2001 From: ln1778 <465410291@qq.com> Date: Mon, 6 May 2024 14:57:20 +0800 Subject: [PATCH] 333 --- CommonInput/Composite.vue | 303 ++++++++++++++++++++++++++ CommonInput/Compound.vue | 233 ++++++++++++++++++++ CommonInput/ErpEchart.vue | 82 +++++++ CommonInput/ErpEcharts.md | 12 ++ CommonInput/MoreClass.md | 126 +++++++++++ CommonInput/MoreClass.vue | 211 ++++++++++++++++++ CommonInput/MoreScreen.vue | 138 ++++++++++++ CommonInput/TimingModule.md | 21 ++ CommonInput/TimingModule.vue | 317 +++++++++++++++++++++++++++ CommonInput/app-title.vue | 116 ++++++++++ CommonInput/compound.md | 15 ++ CommonInput/selectbtn.md | 12 ++ CommonInput/selectbtn.vue | 405 +++++++++++++++++++++++++++++++++++ index.js | 36 ++++ package.json | 19 ++ 15 files changed, 2046 insertions(+) create mode 100644 CommonInput/Composite.vue create mode 100644 CommonInput/Compound.vue create mode 100644 CommonInput/ErpEchart.vue create mode 100644 CommonInput/ErpEcharts.md create mode 100644 CommonInput/MoreClass.md create mode 100644 CommonInput/MoreClass.vue create mode 100644 CommonInput/MoreScreen.vue create mode 100644 CommonInput/TimingModule.md create mode 100644 CommonInput/TimingModule.vue create mode 100644 CommonInput/app-title.vue create mode 100644 CommonInput/compound.md create mode 100644 CommonInput/selectbtn.md create mode 100644 CommonInput/selectbtn.vue create mode 100644 index.js create mode 100644 package.json diff --git a/CommonInput/Composite.vue b/CommonInput/Composite.vue new file mode 100644 index 0000000..afdc731 --- /dev/null +++ b/CommonInput/Composite.vue @@ -0,0 +1,303 @@ + + + + + + + + + diff --git a/CommonInput/Compound.vue b/CommonInput/Compound.vue new file mode 100644 index 0000000..7cc0ac7 --- /dev/null +++ b/CommonInput/Compound.vue @@ -0,0 +1,233 @@ + + + + + diff --git a/CommonInput/ErpEchart.vue b/CommonInput/ErpEchart.vue new file mode 100644 index 0000000..9340590 --- /dev/null +++ b/CommonInput/ErpEchart.vue @@ -0,0 +1,82 @@ + + + + \ No newline at end of file diff --git a/CommonInput/ErpEcharts.md b/CommonInput/ErpEcharts.md new file mode 100644 index 0000000..1d58674 --- /dev/null +++ b/CommonInput/ErpEcharts.md @@ -0,0 +1,12 @@ +## ErpEcharts 图表封装 +> **组件名:ErpEcharts** +> 代码块: `ErpEcharts` +> 关联组件:`echarts` + +> **子组件:传参** +> options:组件接收的参数直接去echarts图表中复制option传到组件即可 +> width: "600px",----------------------------图表宽度(选填) +> height: "400px",----------------------------图表高度(选填) + +> **注意事项** +> 循环多个图表时this.uuid必须为唯一值 diff --git a/CommonInput/MoreClass.md b/CommonInput/MoreClass.md new file mode 100644 index 0000000..05e622b --- /dev/null +++ b/CommonInput/MoreClass.md @@ -0,0 +1,126 @@ +## 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; + } + }); + }, \ No newline at end of file diff --git a/CommonInput/MoreClass.vue b/CommonInput/MoreClass.vue new file mode 100644 index 0000000..eabf1f2 --- /dev/null +++ b/CommonInput/MoreClass.vue @@ -0,0 +1,211 @@ + + + + + + \ No newline at end of file diff --git a/CommonInput/MoreScreen.vue b/CommonInput/MoreScreen.vue new file mode 100644 index 0000000..6802c3f --- /dev/null +++ b/CommonInput/MoreScreen.vue @@ -0,0 +1,138 @@ + + + + + \ No newline at end of file diff --git a/CommonInput/TimingModule.md b/CommonInput/TimingModule.md new file mode 100644 index 0000000..3d328ec --- /dev/null +++ b/CommonInput/TimingModule.md @@ -0,0 +1,21 @@ +## 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必须为唯一值 diff --git a/CommonInput/TimingModule.vue b/CommonInput/TimingModule.vue new file mode 100644 index 0000000..1f8870e --- /dev/null +++ b/CommonInput/TimingModule.vue @@ -0,0 +1,317 @@ + + + + + \ No newline at end of file diff --git a/CommonInput/app-title.vue b/CommonInput/app-title.vue new file mode 100644 index 0000000..d74137a --- /dev/null +++ b/CommonInput/app-title.vue @@ -0,0 +1,116 @@ + + + + + \ No newline at end of file diff --git a/CommonInput/compound.md b/CommonInput/compound.md new file mode 100644 index 0000000..12797ba --- /dev/null +++ b/CommonInput/compound.md @@ -0,0 +1,15 @@ +## 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 diff --git a/CommonInput/selectbtn.md b/CommonInput/selectbtn.md new file mode 100644 index 0000000..4685278 --- /dev/null +++ b/CommonInput/selectbtn.md @@ -0,0 +1,12 @@ +## selectbtn 多功能多选组件(仅筛选,多选,反选,模糊查询选择操作) +> **组件名:SelectBtn** +> 代码块: `selectbtn` +> 关联组件:`el-element` + +> **子组件:传参** +> SourceData:组件接收的参数默认为[{label:'',value:''}] 接口的数据 +> dropdowntitle:组件占位文本 +> value:返回值的字段名如:value:"name_id" 则search中parmas的接收参数为{name_id:['返回的参数']},参数为必填 +> selectAll:默认false,是否全选 +> **子组件:方法** +> search(params):params接收选择的参数 \ No newline at end of file diff --git a/CommonInput/selectbtn.vue b/CommonInput/selectbtn.vue new file mode 100644 index 0000000..fd1fd06 --- /dev/null +++ b/CommonInput/selectbtn.vue @@ -0,0 +1,405 @@ + + + + + \ No newline at end of file diff --git a/index.js b/index.js new file mode 100644 index 0000000..3c0b756 --- /dev/null +++ b/index.js @@ -0,0 +1,36 @@ +import appTitle from "./CommonInput/app-title.vue"; +import Composite from "./CommonInput/Composite.vue"; +import Compound from "./CommonInput/Compound.vue"; +import ErpEchart from "./CommonInput/ErpEchart.vue"; +import MoreClass from "./CommonInput/MoreClass.vue"; +import MoreScreen from "./CommonInput/MoreScreen.vue"; +import selectbtn from "./CommonInput/selectbtn.vue"; +import TimingModule from "./CommonInput/TimingModule.vue"; + +const componentarr = [ + appTitle, + Composite, + Compound, + ErpEchart, + MoreClass, + MoreScreen, + selectbtn, + TimingModule, +]; + +const install = function (Vue) { + // 判断是否安装 + if (install.installed) return; + install.installed = true; + // 遍历并注册全局组件 + componentarr.forEach((component) => Vue.component(component.name, component)); +}; + +// 判断是否是直接引入文件,如果Vue是全局对象自动安装插件 +if (typeof window !== "undefined" && window.Vue) { + install(window.Vue); +} +export default { + install, + ...componentarr +} \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..3d2ca8c --- /dev/null +++ b/package.json @@ -0,0 +1,19 @@ +{ + "name": "erp-element-ui", + "version": "1.0.1", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "liunan", + "license": "ISC", + "peerDependencies": { + "element-ui": "^2.15.6" + }, + "homepage": "https://git.aiguoai.com/liunan/erp-el-element.git", + "repository": { + "type": "git", + "url": "github.com/ln1778/taro-server.git" + } +}