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) {
setTimeout(() => {
this.form = { ...row };
}, 10);
},
handleClose() {
this.resetForm("form");
this.Visible = false;
},
},
......
......@@ -5,7 +5,6 @@
:visible.sync="Visible"
width="30%"
@close="handleClose"
:destroy-on-close="true"
:close-on-click-modal="false"
>
<el-form
......@@ -54,7 +53,7 @@
</div>
</template>
<script>
<script>
import { addMatterFolder } from "@/api/matter";
export default {
props: {
......@@ -120,21 +119,22 @@ export default {
},
// 编辑
onEdit(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,6 +185,7 @@ export default {
},
// 编辑
onEdit(row) {
setTimeout(() => {
this.form = { ...row };
this.samplePathFileList = [
{
......@@ -193,15 +193,16 @@ export default {
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 = [];
......
......@@ -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) {
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) {
......
......@@ -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) {
setTimeout(() => {
this.form = { ...row };
}, 10);
},
// 重置
handleRest() {
this.$refs.form.resetFields();
this.resetForm("form");
},
// 关闭
handleClose() {
this.$refs.form.resetFields();
this.resetForm("form");
this.Visible = false;
},
},
......
......@@ -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) {
setTimeout(() => {
this.form = { ...row };
}, 10);
},
// 重置
handleRest() {
this.$refs.form.resetFields();
this.resetForm("form");
},
// 关闭
handleClose() {
this.$refs.form.resetFields();
this.resetForm("form");
this.Visible = false;
},
// 切换策略
......
......@@ -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