Commit f52e9412 authored by “yiyousong”'s avatar “yiyousong”

perf: 优化弹窗

parent 2708b35b
......@@ -21,6 +21,9 @@ Vue.use(ElementUI);
import { message } from "@/utils/resetMessage";
Vue.prototype.$message = message;
import { resetForm } from "@/utils";
Vue.prototype.resetForm = resetForm;
// 表格生成
import plugins from "./components/formDes/index";
Vue.use(plugins);
......
......@@ -255,7 +255,7 @@ export default {
},
methods: {
handleReset() {
this.$refs.form.resetFields();
this.resetForm("form");
},
handleOk() {
this.$refs.form.validate(async (valid) => {
......@@ -277,9 +277,12 @@ export default {
},
// 编辑
onEdit(row) {
this.form = { ...row };
setTimeout(() => {
this.form = { ...row };
}, 10);
},
handleClose() {
this.resetForm("form");
this.Visible = false;
},
},
......@@ -296,4 +299,4 @@ export default {
/deep/.el-select {
width: 100%;
}
</style>
\ No newline at end of file
</style>
......@@ -5,7 +5,6 @@
:visible.sync="Visible"
width="30%"
@close="handleClose"
:destroy-on-close="true"
:close-on-click-modal="false"
>
<el-form
......@@ -53,8 +52,8 @@
</el-dialog>
</div>
</template>
<script>
<script>
import { addMatterFolder } from "@/api/matter";
export default {
props: {
......@@ -120,21 +119,22 @@ export default {
},
// 编辑
onEdit(row) {
this.form = { ...row };
setTimeout(() => {
this.form = { ...row };
}, 10);
},
// 重置
handleRest() {
this.$refs.form.resetFields();
this.resetForm("form");
},
// 关闭
handleClose() {
this.loading = false;
this.$refs.form.resetFields();
this.resetForm("form");
this.Visible = false;
},
},
};
</script>
<style lang="less" scoped>
</style>
\ No newline at end of file
<style lang="less" scoped></style>
......@@ -5,7 +5,6 @@
:visible.sync="Visible"
width="30%"
@close="handleClose"
:destroy-on-close="true"
:close-on-click-modal="false"
>
<el-form
......@@ -186,22 +185,24 @@ export default {
},
// 编辑
onEdit(row) {
this.form = { ...row };
this.samplePathFileList = [
{
name: this.form.sampleName,
url: this.form.samplePath,
},
];
setTimeout(() => {
this.form = { ...row };
this.samplePathFileList = [
{
name: this.form.sampleName,
url: this.form.samplePath,
},
];
}, 10);
},
// 重置
handleRest() {
this.$refs.form.resetFields();
this.resetForm("form");
this.samplePathFileList = [];
},
// 关闭
handleClose() {
this.$refs.form.resetFields();
this.resetForm("form");
// this.fileUrlFileList = [];
// this.templatePathFileList = [];
this.samplePathFileList = [];
......@@ -254,4 +255,4 @@ export default {
.el-switch .el-switch__label {
width: 60px !important; /*开关按钮的宽度大小*/
}
</style>
\ No newline at end of file
</style>
......@@ -3,7 +3,6 @@
<el-dialog
:title="title"
:visible.sync="Visible"
:destroy-on-close="true"
width="30%"
@close="handleClose"
:close-on-click-modal="false"
......@@ -143,15 +142,17 @@ export default {
},
// 编辑
onEdit(row) {
this.form = { ...row };
setTimeout(() => {
this.form = { ...row };
}, 10);
},
// 重置
handleRest() {
this.$refs.form.resetFields();
this.resetForm("form");
},
// 关闭
handleClose() {
this.$refs.form.resetFields();
this.resetForm("form");
this.Visible = false;
},
handleChange(val) {
......@@ -166,4 +167,4 @@ export default {
/deep/.el-select {
width: 100%;
}
</style>
\ No newline at end of file
</style>
......@@ -2,7 +2,6 @@
<div>
<el-dialog
:title="title"
:destroy-on-close="true"
:visible.sync="Visible"
width="30%"
@close="handleClose"
......@@ -176,15 +175,17 @@ export default {
},
// 编辑
onEdit(row) {
this.form = { ...row };
setTimeout(() => {
this.form = { ...row };
}, 10);
},
// 重置
handleRest() {
this.$refs.form.resetFields();
this.resetForm("form");
},
// 关闭
handleClose() {
this.$refs.form.resetFields();
this.resetForm("form");
this.Visible = false;
},
},
......@@ -195,4 +196,4 @@ export default {
/deep/.el-select {
width: 100%;
}
</style>
\ No newline at end of file
</style>
......@@ -2,7 +2,6 @@
<div>
<el-dialog
:title="title"
:destroy-on-close="true"
:visible.sync="Visible"
width="30%"
@close="handleClose"
......@@ -222,15 +221,17 @@ export default {
},
// 编辑
onEdit(row) {
this.form = { ...row };
setTimeout(() => {
this.form = { ...row };
}, 10);
},
// 重置
handleRest() {
this.$refs.form.resetFields();
this.resetForm("form");
},
// 关闭
handleClose() {
this.$refs.form.resetFields();
this.resetForm("form");
this.Visible = false;
},
// 切换策略
......@@ -252,4 +253,4 @@ export default {
/deep/.el-select {
width: 100%;
}
</style>
\ No newline at end of file
</style>
......@@ -17,9 +17,6 @@ export default new Vuex.Store({
path: "", // 门户跳转过来的路由
},
getters: {
SET_path(state, path) {
state.path = path;
},
token(state) {
return state.token;
},
......@@ -52,6 +49,9 @@ export default new Vuex.Store({
SET_token(state, token) {
state.token = token;
},
SET_path(state, path) {
state.path = path;
},
},
actions: {},
modules: {},
......
......@@ -96,3 +96,10 @@ export class SessionCrypto {
window.sessionStorage.removeItem(key);
}
}
// 表单重置
export function resetForm(refName) {
if (this.$refs[refName]) {
this.$refs[refName].resetFields();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment