From 5eafcdcbba33c10b4ce2fa91eeb6b88f256fda25 Mon Sep 17 00:00:00 2001
From: xy <271556543@qq.com>
Date: Thu, 8 Jun 2023 17:28:44 +0800
Subject: [PATCH] 2023-6-8
---
src/api/system/customForm.js | 16 +
src/components/LxHeader/XyContent.vue | 1 -
src/components/XyTable/index.vue | 2 +-
src/main.js | 1 +
src/store/modules/permission.js | 1 -
src/views/component/dialog.vue | 176 +++---
src/views/component/table.vue | 581 ++++++++++++------
src/views/system/components/editPane.vue | 104 +---
src/views/system/components/formEditor.vue | 3 +-
.../system/components/formSlotRender.vue | 44 +-
src/views/system/components/linkWith.vue | 318 ++++++++++
src/views/system/form.vue | 12 +-
12 files changed, 876 insertions(+), 383 deletions(-)
create mode 100644 src/views/system/components/linkWith.vue
diff --git a/src/api/system/customForm.js b/src/api/system/customForm.js
index ba03a48..d9e9198 100644
--- a/src/api/system/customForm.js
+++ b/src/api/system/customForm.js
@@ -49,3 +49,19 @@ export function realTableIndex() {
url: '/api/admin/custom-form/real-table-index'
})
}
+
+export function realTableShow(params) {
+ return request({
+ method: "get",
+ url: '/api/admin/custom-form/real-table-show',
+ params
+ })
+}
+
+export function relationDestroy(params) {
+ return request({
+ method: 'get',
+ url: '/api/admin/custom-form/relation-destroy',
+ params
+ })
+}
diff --git a/src/components/LxHeader/XyContent.vue b/src/components/LxHeader/XyContent.vue
index 6e71828..2075b04 100644
--- a/src/components/LxHeader/XyContent.vue
+++ b/src/components/LxHeader/XyContent.vue
@@ -17,7 +17,6 @@ export default {
//权限排序后(让按钮排序)
let temp = JSON.parse(JSON.stringify(this.auths))
if(temp.indexOf('search') !== -1){
- console.log(temp.indexOf('search'))
temp.splice(temp.indexOf('search'),1)
temp.unshift('search')
}
diff --git a/src/components/XyTable/index.vue b/src/components/XyTable/index.vue
index 7525b4c..bce399c 100644
--- a/src/components/XyTable/index.vue
+++ b/src/components/XyTable/index.vue
@@ -895,7 +895,7 @@ export default {
);
})}
- {$scopedSlots.btns ? $scopedSlots.btns() : this.isCreateAuthBtns()}
+ { this.auths.length > 0 ? this.isCreateAuthBtns() : '' }
) : (
diff --git a/src/main.js b/src/main.js
index ab218e5..2d7aa25 100644
--- a/src/main.js
+++ b/src/main.js
@@ -89,6 +89,7 @@ Vue.prototype.$integrateData = (target,value) => {
}
}
}
+
new Vue({
el: '#app',
router,
diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js
index 3900072..668e182 100644
--- a/src/store/modules/permission.js
+++ b/src/store/modules/permission.js
@@ -127,7 +127,6 @@ export function generaMenu(routes, data) {
title: item.name,
id: item.id,
roles: ['admin'],
- auths:item.has_auth_node_tags,
params,
icon: item.icon
diff --git a/src/views/component/dialog.vue b/src/views/component/dialog.vue
index 3de0beb..8c398fa 100644
--- a/src/views/component/dialog.vue
+++ b/src/views/component/dialog.vue
@@ -60,85 +60,89 @@ export default {
: false,
},
},
- [
- h(
- domMap.get(i.edit_input),
- {
- ref: `elEdit_${i.field}`,
- style: {
- width: "100%",
- },
- props: {
- ...addPropsMap.get(i.edit_input),
- ...this.extraProps(i),
- placeholder: i.help,
- value: this.form[i.field],
- },
- attrs: {
- placeholder: i.help || `请填写${i.name}`,
- },
- on: {
- [this.getEventType(i.edit_input)]: (e) => {
- console.log(1111, e);
- if (i.field) {
- this.form[i.field] = e;
- this.form = Object.assign({}, this.form);
- }
- },
- },
- scopedSlots:
- i.edit_input === "file" || i.edit_input === "files"
- ? {
- file: (scope) => {
- let { file } = scope;
-
- console.log(111, file);
- return [
- h("div", {}, [
- h("i", {
- class: {
- "el-icon-circle-check":
- file.status === "success",
- "el-icon-loading":
- file.status === "uploading",
- },
- style: {
- "color": file.status === "success" ? "green" : ""
- }
- }),
- h(
- "a",
- {
- attrs: {
- href: file.url,
- download: file.name,
- },
- class: {
- "uploaded-a":
- file.status === "success",
- }
- },
- file.name
- )
- ]),
- h("i", {
- class: "el-icon-close",
- on: {
- ["click"]: () =>
- this.fileRemoveHandler(
- file,
- i.field
+ this.$scopedSlots[i.field]
+ ? this.$scopedSlots[i.field]({ fieldInfo: i, form: this.form })
+ : [
+ h(
+ domMap.get(i.edit_input),
+ {
+ ref: `elEdit_${i.field}`,
+ style: {
+ width: "100%",
+ },
+ props: {
+ ...addPropsMap.get(i.edit_input),
+ ...this.extraProps(i),
+ placeholder: i.help,
+ value: this.form[i.field],
+ },
+ attrs: {
+ placeholder: i.help || `请填写${i.name}`,
+ },
+ on: {
+ [this.getEventType(i.edit_input)]: (e) => {
+ if (i.field) {
+ this.form[i.field] = e;
+ this.form = Object.assign({}, this.form);
+ }
+ },
+ ['visible-change']:_ => i._params.set()
+ },
+ scopedSlots:
+ i.edit_input === "file" ||
+ i.edit_input === "files"
+ ? {
+ file: (scope) => {
+ let { file } = scope;
+ return [
+ h("div", {}, [
+ h("i", {
+ class: {
+ "el-icon-circle-check":
+ file.status === "success",
+ "el-icon-loading":
+ file.status === "uploading",
+ },
+ style: {
+ color:
+ file.status === "success"
+ ? "green"
+ : "",
+ },
+ }),
+ h(
+ "a",
+ {
+ attrs: {
+ href: file.url,
+ download: file.name,
+ },
+ class: {
+ "uploaded-a":
+ file.status === "success",
+ },
+ },
+ file.name
),
- },
- }),
- ];
- },
- }
- : "",
- },
- this.optionsRender(h, i)
- ),
- ]
+ ]),
+ h("i", {
+ class: "el-icon-close",
+ on: {
+ ["click"]: () =>
+ this.fileRemoveHandler(
+ file,
+ i.field
+ ),
+ },
+ }),
+ ];
+ },
+ }
+ : "",
+ },
+ this.optionsRender(h, i)
+ ),
+ ]
)
);
}
@@ -202,7 +206,7 @@ export default {
},
//on事件类别获取
getEventType(info) {
- if (info.type === "checkbox") {
+ if (info === "checkbox") {
return "change";
}
return "input";
@@ -211,12 +215,12 @@ export default {
//渲染一些组件内部需要选项等
optionsRender(h, info) {
if (info.edit_input === "checkbox" || info.edit_input === "radio") {
- return info._paramters && info._paramters instanceof Array
- ? info._paramters.map((i) =>
+ return info._params.get() && info._params.get() instanceof Array
+ ? info._params.get().map((i) =>
h("el-option", {
props: {
label: i.name || i.no || i.value || i.id,
- value: i.id,
+ value: i[info._relations.foreign_key],
},
})
)
@@ -287,13 +291,13 @@ export default {
this.file[info.field] = fileList;
};
- props.onError = (err,file,fileList) => {
+ props.onError = (err, file, fileList) => {
this.file[info.field] = fileList;
this.$message({
type: "warning",
- message: err
- })
- }
+ message: err,
+ });
+ };
}
return props;
},
diff --git a/src/views/component/table.vue b/src/views/component/table.vue
index da64d49..21c1727 100644
--- a/src/views/component/table.vue
+++ b/src/views/component/table.vue
@@ -3,42 +3,100 @@
-
+
-
@@ -47,9 +52,11 @@ import { authMixin } from "@/mixin/authMixin";
import LxHeader from "@/components/LxHeader/index.vue";
import addForm from "./components/addForm.vue";
import formEditor from "@/views/system/components/formEditor.vue";
+import linkWith from "@/views/system/components/linkWith.vue";
+import { deepCopy } from "@/utils";
export default {
components:{
- LxHeader,addForm,formEditor
+ LxHeader,addForm,formEditor,linkWith
},
mixins: [authMixin],
@@ -82,6 +89,7 @@ export default {
}
},
methods: {
+ deepCopy,
index,destroy,
},