增加桌面自定义快捷菜单

This commit is contained in:
zmrid 2023-02-13 17:03:25 +08:00
parent f63cdbd7df
commit 1957c4ca66
7 changed files with 866 additions and 631 deletions

View File

@ -0,0 +1,112 @@
/*****************************************************************************************
** Author:COCO 2022
*****************************************************************************************/
//此js文件是用来自定义扩展业务代码可以扩展一些自定义页面或者重新配置生成的代码
import Base_DesktopMenuModelBody from './custom_extend/Base_DesktopMenuModelBody'
let extension = {
components: {
//查询界面扩展组件
gridHeader: '',
gridBody: '',
gridFooter: '',
//新建、编辑弹出框扩展组件
modelHeader: '',
modelBody: Base_DesktopMenuModelBody,
modelFooter: ''
},
tableAction: '', //指定某张表的权限(这里填写表名,默认不用填写)
buttons: { view: [], box: [], detail: [] }, //扩展的按钮
methods: {
getFormOption(field) {
let option;
this.editFormOptions.forEach(x => {
x.forEach(item => {
if (item.field == field) {
option = item;
}
})
})
return option;
},
//下面这些方法可以保留也可以删除
onInit() { //框架初始化配置前,
//示例:在按钮的最前面添加一个按钮
// this.buttons.unshift({ //也可以用push或者splice方法来修改buttons数组
// name: '按钮', //按钮名称
// icon: 'el-icon-document', //按钮图标vue2版本见iview文档iconvue3版本见element ui文档icon(注意不是element puls文档)
// type: 'primary', //按钮样式vue2版本见iview文档buttonvue3版本见element ui文档button
// onClick: function () {
// this.$Message.success('点击了按钮');
// }
// });
//示例:设置修改新建、编辑弹出框字段标签的长度
// this.boxOptions.labelWidth = 150;
//显示序号(默认隐藏)
this.columnIndex = true;
this.boxOptions.height = 450;
var menuId = this.getFormOption('MenuId');
menuId.onChange = (val, item) => {
this.http.get('api/menu/getTreeItemById?menuId=' + val, {}, true).then((result) => {
console.log("8888", result);
this.editFormFields["MenuName"] = result.MenuName;
this.editFormFields["MenuUrl"] = result.Url;
});
};
//选择背景颜色
this.editFormOptions.forEach(x => {
x.forEach(item => {
if (item.field == 'Color') {
//给编辑表单设置[选择数据]操作,extra具体配置见mesform组件api
item.extra = {
icon: "el-icon-zoom-out",
text: "选择",
style: "color:blue;font-size: 14px;cursor: pointer;",
click: item => {
this.$refs.modelBody.open();
}
}
}
})
})
},
getRow(color) {
this.editFormFields["Color"] = color;
},
onInited() {
//框架初始化配置后
//如果要配置明细表,在此方法操作
//this.detailOptions.columns.forEach(column=>{ });
},
searchBefore(param) {
//界面查询前,可以给param.wheres添加查询参数
//返回false则不会执行查询
return true;
},
searchAfter(result) {
//查询后result返回的查询数据,可以在显示到表格前处理表格的值
return true;
},
addBefore(formData) {
//新建保存前formData为对象包括明细表可以给给表单设置值自己输出看formData的值
return true;
},
updateBefore(formData) {
//编辑保存前formData为对象包括明细表、删除行的Id
return true;
},
rowClick({ row, column, event }) {
//查询界面点击行事件
// this.$refs.table.$refs.table.toggleRowSelection(row); //单击行时选中当前行;
},
modelOpenAfter(row) {
//点击编辑、新建按钮弹出框后,可以在此处写逻辑,如,从后台获取数据
//(1)判断是编辑还是新建操作: this.currentAction=='Add';
//(2)给弹出框设置默认值
//(3)this.editFormFields.字段='xxx';
//如果需要给下拉框设置默认值请遍历this.editFormOptions找到字段配置对应data属性的key值
//看不懂就把输出看console.log(this.editFormOptions)
}
}
};
export default extension;

View File

@ -0,0 +1,43 @@
<template>
<MesBox v-model="model" :lazy="true" title="选择颜色" :height="250" :width="250" :padding="15">
<div class="block">
<span class="demonstration">有默认值</span>
<el-color-picker v-model="color"></el-color-picker>
</div>
<!-- 设置弹出框的操作按钮 -->
<template #footer>
<div>
<el-button size="mini" type="primary" @click="addRow()"><i class="el-icon-plus" />添加选择的数据</el-button>
<el-button size="mini" icon="el-icon-close" @click="model = false">关闭</el-button>
</div>
</template>
</MesBox>
</template>
<script>
import MesBox from "@/components/basic/MesBox.vue";
import { thisTypeAnnotation } from "@babel/types";
export default {
components: {
MesBox: MesBox
},
data() {
return {
color: '#409EFF',
model: false
};
},
methods: {
open() {
this.model = true;
},
addRow() {
//
this.$emit("parentCall", ($parent) => {
$parent.getRow(this.color);
});
//
this.model = false;
}
},
};
</script>

View File

@ -1,92 +1,55 @@
<template> <template>
<MesBox <MesBox v-model="model" :lazy="true" title="选择数据" :height="700" :width="1500" :padding="15">
v-model="model" <!-- 设置查询条件 -->
:lazy="true" <div style="padding-bottom: 10px">
title="选择数据" <span style="margin-right: 20px">产品编码</span>
:height="700" <el-input placeholder="请输入产品编码" style="width: 200px" v-model="productCode" />
:width="1500" <el-button type="primary" style="margin-left:10px" size="medium" icon="el-icon-zoom-out" @click="search">搜索
:padding="15" </el-button>
> </div>
<!-- 设置查询条件 -->
<div style="padding-bottom: 10px"> <!-- mes-table配置的这些属性见MesTable组件api文件 -->
<span style="margin-right: 20px">产品编码</span> <mes-table ref="mytable" :loadKey="true" :columns="columns" :pagination="pagination" :pagination-hide="false"
<el-input :max-height="700" :url="url" :index="true" :single="true" :defaultLoadPage="defaultLoadPage"
@loadBefore="loadTableBefore" @loadAfter="loadTableAfter"></mes-table>
placeholder="请输入产品编码" <!-- 设置弹出框的操作按钮 -->
style="width: 200px" <template #footer>
v-model="productCode" <div>
/> <el-button size="mini" type="primary" @click="addRow()"> <i class="el-icon-plus" />添加选择的数据</el-button>
<el-button <el-button size="mini" icon="el-icon-close" @click="model = false">关闭</el-button>
type="primary"
style="margin-left:10px"
size="medium"
icon="el-icon-zoom-out"
@click="search"
>搜索</el-button
>
</div> </div>
</template>
<!-- mes-table配置的这些属性见MesTable组件api文件 --> </MesBox>
<mes-table </template>
ref="mytable" <script>
:loadKey="true"
:columns="columns"
:pagination="pagination"
:pagination-hide="false"
:max-height="700"
:url="url"
:index="true"
:single="true"
:defaultLoadPage="defaultLoadPage"
@loadBefore="loadTableBefore"
@loadAfter="loadTableAfter"
></mes-table>
<!-- 设置弹出框的操作按钮 -->
<template #footer>
<div>
<el-button
size="mini"
type="primary"
icon="el-icon-plus"
@click="addRow()"
>添加选择的数据</el-button
>
<el-button size="mini" icon="el-icon-close" @click="model = false"
>关闭</el-button
>
</div>
</template>
</MesBox>
</template>
<script>
import MesBox from "@/components/basic/MesBox.vue"; import MesBox from "@/components/basic/MesBox.vue";
import MesTable from "@/components/basic/MesTable.vue"; import MesTable from "@/components/basic/MesTable.vue";
import { thisTypeAnnotation } from "@babel/types"; import { thisTypeAnnotation } from "@babel/types";
export default { export default {
components: { components: {
MesBox: MesBox, MesBox: MesBox,
MesTable: MesTable, MesTable: MesTable,
}, },
data() { data() {
return { return {
model: false, model: false,
defaultLoadPage: false, //tableopenDemotable defaultLoadPage: false, //tableopenDemotable
productCode: "", // productCode: "", //
modelType:"", modelType: "",
url: "api/Base_Product/getSelectorDemo",// url: "api/Base_Product/getSelectorDemo",//
columns: [ columns: [
{field:'Product_Id',title:'产品定义主键ID',type:'int',width:110,hidden:true,readonly:true,require:true,align:'left'}, { field: 'Product_Id', title: '产品定义主键ID', type: 'int', width: 110, hidden: true, readonly: true, require: true, align: 'left' },
{field:'ProductCode',title:'产品编号',type:'string',sort:true,width:250,align:'left',sort:true}, { field: 'ProductCode', title: '产品编号', type: 'string', sort: true, width: 250, align: 'left', sort: true },
{field:'ProductName',title:'产品名称',type:'string',link:true,sort:true,width:180,require:true,align:'left'}, { field: 'ProductName', title: '产品名称', type: 'string', link: true, sort: true, width: 180, require: true, align: 'left' },
{field:'Unit_Id',title:'库存单位',type:'int',bind:{ key:'unitList',data:[]},width:110,require:true,align:'left'}, { field: 'Unit_Id', title: '库存单位', type: 'int', bind: { key: 'unitList', data: [] }, width: 110, require: true, align: 'left' },
{field:'ProductStandard',title:'产品规格',type:'string',width:180,align:'left'}, { field: 'ProductStandard', title: '产品规格', type: 'string', width: 180, align: 'left' },
{field:'ProductAttribute',title:'产品属性',type:'string',bind:{ key:'productAttr',data:[]},width:180,require:true,align:'left'}, { field: 'ProductAttribute', title: '产品属性', type: 'string', bind: { key: 'productAttr', data: [] }, width: 180, require: true, align: 'left' },
{field:'Process_Id',title:'工艺路线',type:'int',bind:{ key:'processLineList',data:[]},width:110,align:'left'}, { field: 'Process_Id', title: '工艺路线', type: 'int', bind: { key: 'processLineList', data: [] }, width: 110, align: 'left' },
{field:'MaxInventory',title:'最大库存',type:'int',sort:true,width:110,align:'left'}, { field: 'MaxInventory', title: '最大库存', type: 'int', sort: true, width: 110, align: 'left' },
{field:'MinInventory',title:'最小库存',type:'int',sort:true,width:110,align:'left'}, { field: 'MinInventory', title: '最小库存', type: 'int', sort: true, width: 110, align: 'left' },
{field:'SafeInventory',title:'安全库存',type:'int',sort:true,width:110,align:'left'}, { field: 'SafeInventory', title: '安全库存', type: 'int', sort: true, width: 110, align: 'left' },
{field:'InventoryQty',title:'库存数量',type:'int',sort:true,width:110,align:'left'}, { field: 'InventoryQty', title: '库存数量', type: 'int', sort: true, width: 110, align: 'left' },
{field:'FinishedProduct',title:'成品图',type:'img',width:180,align:'left'} { field: 'FinishedProduct', title: '成品图', type: 'img', width: 180, align: 'left' }
], ],
pagination: {}, //mestableapi pagination: {}, //mestableapi
}; };
@ -104,10 +67,10 @@ import { thisTypeAnnotation } from "@babel/types";
// //
this.$refs.mytable.load(); this.$refs.mytable.load();
}, },
getFieldDicValue(fieldName,fieldValue){ getFieldDicValue(fieldName, fieldValue) {
this.columns.forEach(item => { this.columns.forEach(item => {
if (item.field == fieldName) { if (item.field == fieldName) {
var result = item.bind.data.find(val => val.key == fieldValue) var result = item.bind.data.find(val => val.key == fieldValue)
return result; return result;
} }
}) })
@ -119,13 +82,13 @@ import { thisTypeAnnotation } from "@babel/types";
} }
// //
this.$emit("parentCall", ($parent) => { this.$emit("parentCall", ($parent) => {
$parent.getRow(rows,this.modelType); $parent.getRow(rows, this.modelType);
}); });
// //
this.model = false; this.model = false;
}, },
//api //api
loadTableAfter(row) {}, loadTableAfter(row) { },
loadTableBefore(params) { loadTableBefore(params) {
// //
if (this.productCode) { if (this.productCode) {
@ -135,5 +98,4 @@ import { thisTypeAnnotation } from "@babel/types";
}, },
}, },
}; };
</script> </script>

View File

@ -314,6 +314,10 @@ let viewgird = [
path: '/Quality_OutCheck', path: '/Quality_OutCheck',
name: 'Quality_OutCheck', name: 'Quality_OutCheck',
component: () => import('@/views/quality/quality/Quality_OutCheck.vue') component: () => import('@/views/quality/quality/Quality_OutCheck.vue')
} ,{
path: '/Base_DesktopMenu',
name: 'Base_DesktopMenu',
component: () => import('@/views/custom/custom/Base_DesktopMenu.vue')
}] }]
export default viewgird export default viewgird

File diff suppressed because it is too large Load Diff

View File

@ -22,8 +22,8 @@
<p>手机APP移动端管理无需电脑</p> <p>手机APP移动端管理无需电脑</p>
<p>演示账号admin 密码:123456</p> <p>演示账号admin 密码:123456</p>
<div style="margin-top: 30px" class="link"> <div style="margin-top: 30px" class="link">
<a href="http://www.625sc.com/" target="_blank"> <a href="https://www.625sc.com/imes/313.html" target="_blank">
<span>官网</span></a <span>亮点介绍</span></a
> >
<a href="https://www.625sc.com/imes/" target="_blank"> <a href="https://www.625sc.com/imes/" target="_blank">
<span>项目介绍</span></a <span>项目介绍</span></a

View File

@ -0,0 +1,70 @@
<!--
*AuthorCOCO
*代码由框架生成,任何更改都可能导致被代码生成器覆盖
*业务请在@/extension/custom/custom/Base_DesktopMenu.js此处编写
-->
<template>
<view-grid ref="grid"
:columns="columns"
:detail="detail"
:editFormFields="editFormFields"
:editFormOptions="editFormOptions"
:searchFormFields="searchFormFields"
:searchFormOptions="searchFormOptions"
:table="table"
:extend="extend">
</view-grid>
</template>
<script>
import extend from "@/extension/custom/custom/Base_DesktopMenu.js";
import { ref, defineComponent } from "vue";
export default defineComponent({
setup() {
const table = ref({
key: 'DesktopMenu_Id',
footer: "Foots",
cnName: '主页菜单配置',
name: 'custom/Base_DesktopMenu',
url: "/Base_DesktopMenu/",
sortName: "DesktopMenu_Id"
});
const editFormFields = ref({"MenuId":"","MenuUrl":"","MenuName":"","Color":"","Enable":""});
const editFormOptions = ref([[{"dataKey":"MenuList","data":[],"title":"菜单","required":true,"field":"MenuId","type":"select"}],
[{"title":"路由地址","required":true,"field":"MenuUrl","disabled":true}],
[{"title":"菜单名称","required":true,"field":"MenuName","disabled":true}],
[{"title":"背景颜色","required":true,"field":"Color","disabled":true}],
[{"dataKey":"cq","data":[],"title":"是否启用","required":true,"field":"Enable","type":"switch"}]]);
const searchFormFields = ref({"MenuName":""});
const searchFormOptions = ref([[{"title":"菜单名称","field":"MenuName","type":"like"}]]);
const columns = ref([{field:'DesktopMenu_Id',title:'主页菜单表主键ID',type:'int',width:110,hidden:true,readonly:true,require:true,align:'left'},
{field:'MenuId',title:'菜单',type:'int',bind:{ key:'MenuList',data:[]},width:80,require:true,align:'left',sort:true},
{field:'MenuName',title:'菜单名称',type:'string',sort:true,width:180,hidden:true,readonly:true,require:true,align:'left'},
{field:'MenuUrl',title:'路由地址',type:'string',link:true,width:120,readonly:true,require:true,align:'left'},
{field:'Color',title:'背景颜色',type:'string',width:120,readonly:true,require:true,align:'left'},
{field:'Enable',title:'是否启用',type:'byte',bind:{ key:'cq',data:[]},width:110,require:true,align:'left'},
{field:'CreateDate',title:'创建时间',type:'datetime',sort:true,width:110,align:'left',sort:true},
{field:'CreateID',title:'创建人编号',type:'int',width:80,hidden:true,align:'left'},
{field:'Creator',title:'创建人',type:'string',width:130,align:'left'},
{field:'Modifier',title:'修改人',type:'string',width:130,align:'left'},
{field:'ModifyDate',title:'修改时间',type:'datetime',width:110,align:'left',sort:true},
{field:'ModifyID',title:'修改人编号',type:'int',width:80,hidden:true,align:'left'}]);
const detail = ref({
cnName: "#detailCnName",
table: "#detailTable",
columns: [],
sortName: "",
key: ""
});
return {
table,
extend,
editFormFields,
editFormOptions,
searchFormFields,
searchFormOptions,
columns,
detail,
};
},
});
</script>