|
|
@@ -22,14 +22,14 @@ export const indexMixin = {
|
|
|
loading: false,
|
|
|
searchButtonName: null, // 查询按钮的权限名称
|
|
|
initSearchFlag: true, // 初始查询标识
|
|
|
- formType:null,// 如果是同一个路由,要记录类型
|
|
|
+ formType: null,// 如果是同一个路由,要记录类型
|
|
|
pageFlag: true, // 是否进行分页查询
|
|
|
pageInfo: {
|
|
|
total: 0,
|
|
|
pageSize: this.$config.pageSize,
|
|
|
currentPage: 1
|
|
|
},
|
|
|
- split:0.5,// 分区的默认
|
|
|
+ split: 0.5,// 分区的默认
|
|
|
formDataInit: {}, // 记录页面初始化的数据
|
|
|
tableData: [],
|
|
|
searchInfo: [], // 记录的查询的实体
|
|
|
@@ -44,8 +44,9 @@ export const indexMixin = {
|
|
|
tableSwitch: true, // 开关是否开启
|
|
|
allScreenFlag: false, // 列表是否最大化
|
|
|
params: {},
|
|
|
- primaryKey:null, // 主键Id,
|
|
|
- exportCondition:null,// 额外导出条件
|
|
|
+ primaryKey: null, // 主键Id,
|
|
|
+ routeObjName: '', // 页面路由名称
|
|
|
+ exportCondition: null,// 额外导出条件
|
|
|
modalParams: { // 打开modal传入的参数
|
|
|
modalRef: 'modal_editAdd',
|
|
|
button: 'add',
|
|
|
@@ -54,15 +55,15 @@ export const indexMixin = {
|
|
|
},
|
|
|
}
|
|
|
},
|
|
|
- watch:{
|
|
|
- $route:{
|
|
|
- handler:'resetData',
|
|
|
+ watch: {
|
|
|
+ $route: {
|
|
|
+ handler: 'resetData',
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- resetData(route,oldRoute){
|
|
|
- if(route.meta.flgSameRoute && oldRoute && oldRoute.meta.flgSameRoute
|
|
|
- && this && this.formType){
|
|
|
+ resetData(route, oldRoute) {
|
|
|
+ if (route.meta.flgSameRoute && oldRoute && oldRoute.meta.flgSameRoute
|
|
|
+ && this && this.formType) {
|
|
|
this._createdInit(); // 加载创建的初始方法
|
|
|
this._mountedInit(); // 加载加载完后的初始方法
|
|
|
}
|
|
|
@@ -90,6 +91,7 @@ export const indexMixin = {
|
|
|
* @date : 2022/12/9 8:36
|
|
|
*/
|
|
|
open(routeUrl, tableRef = 'table-select', isMustChooseFlag = true) {
|
|
|
+ console.log('rrr', routeUrl)
|
|
|
if (!routeUrl || !routeUrl.key) {
|
|
|
return;
|
|
|
}
|
|
|
@@ -97,7 +99,7 @@ export const indexMixin = {
|
|
|
let url = routeUrl.url
|
|
|
let chooseKeys = tableRef ? this.$refs[tableRef].batchKeys : []
|
|
|
// 校验
|
|
|
- if (isMustChooseFlag && name.indexOf('add') < 0 && name !== 'search' && name !== 'clear') {
|
|
|
+ if (isMustChooseFlag && name.indexOf('add') < 0 && name !== 'search' && name !== 'clear') {
|
|
|
// 新建不用校验
|
|
|
if (!chooseKeys || chooseKeys.length === 0) {
|
|
|
this.$Message.error(this.$t('W_013'))
|
|
|
@@ -122,7 +124,7 @@ export const indexMixin = {
|
|
|
chooseKeys = []
|
|
|
}
|
|
|
if (chooseKeys && chooseKeys.length > 0) {
|
|
|
- localSave(this.$route.name + '-edit',JSON.stringify({editKeys:chooseKeys.copy()}) )
|
|
|
+ localSave(this.$route.name + '-edit', JSON.stringify({editKeys: chooseKeys.copy()}))
|
|
|
this.$router.push(url.endsWith('/') ? (url + chooseKeys[0]) : (url + '/' + chooseKeys[0]))
|
|
|
} else {
|
|
|
this.$router.push(url)
|
|
|
@@ -153,6 +155,14 @@ export const indexMixin = {
|
|
|
}
|
|
|
},
|
|
|
/**
|
|
|
+ * @desc : 打开窗体
|
|
|
+ * @author : 周兴
|
|
|
+ * @date : 2023/3/3 17:47
|
|
|
+ */
|
|
|
+ _open(ref,) {
|
|
|
+
|
|
|
+ },
|
|
|
+ /**
|
|
|
* @desc : 打开窗体时校验数据(不给外部调用)
|
|
|
* @author : 周兴
|
|
|
* @date : 2022/12/9 8:52
|
|
|
@@ -249,7 +259,7 @@ export const indexMixin = {
|
|
|
this.setParams(arg);
|
|
|
this.params.ftyId = this.$store.state.user.ftyId;// 给工厂赋默认值
|
|
|
// 如果主键id有值需要在新建时清空主键Id
|
|
|
- if(this.primaryKey && button === 'add' && this.params[this.primaryKey]){
|
|
|
+ if (this.primaryKey && button === 'add' && this.params[this.primaryKey]) {
|
|
|
this.params[this.primaryKey] = null;
|
|
|
}
|
|
|
// 3、保存数据
|
|
|
@@ -309,7 +319,7 @@ export const indexMixin = {
|
|
|
this.$Message.success(this.$t('I_001', {'param': this.$v(button)}))
|
|
|
}
|
|
|
} else {
|
|
|
- if(res.message){
|
|
|
+ if (res.message) {
|
|
|
this.$Message.error(res.message)
|
|
|
}
|
|
|
}
|
|
|
@@ -369,17 +379,17 @@ export const indexMixin = {
|
|
|
* @author : 周兴
|
|
|
* @date : 2023/2/23 13:41
|
|
|
*/
|
|
|
- cellMenu(e,tableRef = 'table-select'){
|
|
|
+ cellMenu(e, tableRef = 'table-select') {
|
|
|
// 只有右键点击可以进行
|
|
|
- if(e.button === 2 && this.$refs[tableRef]){
|
|
|
+ if (e.button === 2 && this.$refs[tableRef]) {
|
|
|
//查询条件
|
|
|
this.setCondition(this.searchCond)
|
|
|
let params = this.searchList
|
|
|
params.name = this.$route.name
|
|
|
params.title = this.$route.meta.title
|
|
|
// 合并实体
|
|
|
- if(this.exportCondition){
|
|
|
- this.objectMerge(params,this.exportCondition);
|
|
|
+ if (this.exportCondition) {
|
|
|
+ this.objectMerge(params, this.exportCondition);
|
|
|
}
|
|
|
this.$refs[tableRef].exportCondition = params;
|
|
|
}
|
|
|
@@ -435,7 +445,6 @@ export const indexMixin = {
|
|
|
if (key === 18) {
|
|
|
code = 18
|
|
|
}
|
|
|
-
|
|
|
let btList = []
|
|
|
for (let itKey in buttonList) {
|
|
|
if (!buttonList[itKey].includes('(')) {
|
|
|
@@ -465,6 +474,7 @@ export const indexMixin = {
|
|
|
}
|
|
|
// Q:code = 81 查询
|
|
|
btList.forEach(forIt => {
|
|
|
+ console.log('eee',code != 18,forIt.hotKey.toLowerCase() , e.key.toLowerCase())
|
|
|
if (code != 18 || forIt.hotKey.toLowerCase() != e.key.toLowerCase()) return
|
|
|
e.returnValue = false
|
|
|
// 如果模块开着,在前面加上模块的ref名
|
|
|
@@ -490,6 +500,7 @@ export const indexMixin = {
|
|
|
document.onkeyup = function (e) {
|
|
|
const evn = e || event
|
|
|
const key = evn.keyCode || evn.which || evn.charCode
|
|
|
+ console.log('eee',e.key,key)
|
|
|
if (key === 18) {
|
|
|
code = 0
|
|
|
}
|
|
|
@@ -631,7 +642,7 @@ export const indexMixin = {
|
|
|
* @author : 周兴
|
|
|
* @date : 2023/2/8 11:50
|
|
|
*/
|
|
|
- _createdInit(){
|
|
|
+ _createdInit() {
|
|
|
let _this = this
|
|
|
// 初始化页面所需要的数据
|
|
|
if (_this.initData) {
|
|
|
@@ -649,11 +660,11 @@ export const indexMixin = {
|
|
|
})
|
|
|
})
|
|
|
// 记录formType
|
|
|
- if(_this.$route.meta && _this.$route.meta.flgSameRoute){
|
|
|
+ if (_this.$route.meta && _this.$route.meta.flgSameRoute) {
|
|
|
_this.formType = _this.$route.meta.formCode
|
|
|
}
|
|
|
// 初始化页面数据
|
|
|
- if(_this.createdInit){
|
|
|
+ if (_this.createdInit) {
|
|
|
_this.createdInit();
|
|
|
}
|
|
|
},
|
|
|
@@ -662,7 +673,7 @@ export const indexMixin = {
|
|
|
* @author : 周兴
|
|
|
* @date : 2023/2/8 11:51
|
|
|
*/
|
|
|
- _mountedInit(){
|
|
|
+ _mountedInit() {
|
|
|
let _this = this
|
|
|
// 初始时,需要查询数据库
|
|
|
if (_this.initSearchFlag && _this.searchData) {
|
|
|
@@ -680,21 +691,38 @@ export const indexMixin = {
|
|
|
_this.resizeTable()
|
|
|
})
|
|
|
// 初始化页面数据
|
|
|
- if(_this.mountedInit){
|
|
|
+ if (_this.mountedInit) {
|
|
|
_this.mountedInit();
|
|
|
}
|
|
|
// 给dk-table列表注册cellMenu事件
|
|
|
- if(_this.$refs){
|
|
|
+ if (_this.$refs) {
|
|
|
let arr = Object.keys(_this.$refs);
|
|
|
- if(arr && arr.length > 0){
|
|
|
- arr.forEach(it=>{
|
|
|
+ if (arr && arr.length > 0) {
|
|
|
+ arr.forEach(it => {
|
|
|
// 说明是dk-table列表 增加右键事件 为了导出做准备
|
|
|
- if(_this.$refs[it].$vnode && _this.$refs[it].$vnode.tag &&
|
|
|
- _this.$refs[it].$vnode.tag.endsWith('DkTable')){
|
|
|
- _this.$refs[it].$el.addEventListener('mousedown', function(e) {
|
|
|
+ if (_this.$refs[it].$vnode && _this.$refs[it].$vnode.tag &&
|
|
|
+ _this.$refs[it].$vnode.tag.endsWith('DkTable')) {
|
|
|
+ _this.$refs[it].$el.addEventListener('mousedown', function (e) {
|
|
|
_this.cellMenu(e, it);
|
|
|
});
|
|
|
}
|
|
|
+ // 说明是buttonGroup
|
|
|
+ if (_this.$refs[it].$vnode && _this.$refs[it].$vnode.tag &&
|
|
|
+ _this.$refs[it].$vnode.tag.endsWith('BaseIndexButton')
|
|
|
+ && this.routeObjName && _this.$config.routeUrl[this.routeObjName]) {
|
|
|
+ // _this.$refs[it].$vnode.componentInstance.$el.click();
|
|
|
+ let buttonRef = _this.$refs[it].$vnode?.data.ref;
|
|
|
+ // 查询特殊处理
|
|
|
+ if (buttonRef && (_this.$config.routeUrl[this.routeObjName][buttonRef] || buttonRef === 'search')) {
|
|
|
+ let obj = _this.$config.routeUrl[this.routeObjName][buttonRef];
|
|
|
+ if(buttonRef === 'search'){
|
|
|
+ obj = _this.$config.routeUrl[buttonRef]
|
|
|
+ }
|
|
|
+ _this.$refs[it].$vnode.componentInstance.$el.addEventListener('click', function (e) {
|
|
|
+ _this.open(obj)
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
})
|
|
|
}
|
|
|
}
|