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

perf: 优化弹窗

parent 2708b35b
...@@ -21,6 +21,9 @@ Vue.use(ElementUI); ...@@ -21,6 +21,9 @@ Vue.use(ElementUI);
import { message } from "@/utils/resetMessage"; import { message } from "@/utils/resetMessage";
Vue.prototype.$message = message; Vue.prototype.$message = message;
import { resetForm } from "@/utils";
Vue.prototype.resetForm = resetForm;
// 表格生成 // 表格生成
import plugins from "./components/formDes/index"; import plugins from "./components/formDes/index";
Vue.use(plugins); Vue.use(plugins);
......
...@@ -255,7 +255,7 @@ export default { ...@@ -255,7 +255,7 @@ export default {
}, },
methods: { methods: {
handleReset() { handleReset() {
this.$refs.form.resetFields(); this.resetForm("form");
}, },
handleOk() { handleOk() {
this.$refs.form.validate(async (valid) => { this.$refs.form.validate(async (valid) => {
...@@ -277,9 +277,12 @@ export default { ...@@ -277,9 +277,12 @@ export default {
}, },
// 编辑 // 编辑
onEdit(row) { onEdit(row) {
setTimeout(() => {
this.form = { ...row }; this.form = { ...row };
}, 10);
}, },
handleClose() { handleClose() {
this.resetForm("form");
this.Visible = false; this.Visible = false;
}, },
}, },
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
:visible.sync="Visible" :visible.sync="Visible"
width="30%" width="30%"
@close="handleClose" @close="handleClose"
:destroy-on-close="true"
:close-on-click-modal="false" :close-on-click-modal="false"
> >
<el-form <el-form
...@@ -54,7 +53,7 @@ ...@@ -54,7 +53,7 @@
</div> </div>
</template> </template>
<script> <script>
import { addMatterFolder } from "@/api/matter"; import { addMatterFolder } from "@/api/matter";
export default { export default {
props: { props: {
...@@ -120,21 +119,22 @@ export default { ...@@ -120,21 +119,22 @@ export default {
}, },
// 编辑 // 编辑
onEdit(row) { onEdit(row) {
setTimeout(() => {
this.form = { ...row }; this.form = { ...row };
}, 10);
}, },
// 重置 // 重置
handleRest() { handleRest() {
this.$refs.form.resetFields(); this.resetForm("form");
}, },
// 关闭 // 关闭
handleClose() { handleClose() {
this.loading = false; this.loading = false;
this.$refs.form.resetFields(); this.resetForm("form");
this.Visible = false; this.Visible = false;
}, },
}, },
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped></style>
</style>
\ No newline at end of file
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
:visible.sync="Visible" :visible.sync="Visible"
width="30%" width="30%"
@close="handleClose" @close="handleClose"
:destroy-on-close="true"
:close-on-click-modal="false" :close-on-click-modal="false"
> >
<el-form <el-form
...@@ -186,6 +185,7 @@ export default { ...@@ -186,6 +185,7 @@ export default {
}, },
// 编辑 // 编辑
onEdit(row) { onEdit(row) {
setTimeout(() => {
this.form = { ...row }; this.form = { ...row };
this.samplePathFileList = [ this.samplePathFileList = [
{ {
...@@ -193,15 +193,16 @@ export default { ...@@ -193,15 +193,16 @@ export default {
url: this.form.samplePath, url: this.form.samplePath,
}, },
]; ];
}, 10);
}, },
// 重置 // 重置
handleRest() { handleRest() {
this.$refs.form.resetFields(); this.resetForm("form");
this.samplePathFileList = []; this.samplePathFileList = [];
}, },
// 关闭 // 关闭
handleClose() { handleClose() {
this.$refs.form.resetFields(); this.resetForm("form");
// this.fileUrlFileList = []; // this.fileUrlFileList = [];
// this.templatePathFileList = []; // this.templatePathFileList = [];
this.samplePathFileList = []; this.samplePathFileList = [];
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
<el-dialog <el-dialog
:title="title" :title="title"
:visible.sync="Visible" :visible.sync="Visible"
:destroy-on-close="true"
width="30%" width="30%"
@close="handleClose" @close="handleClose"
:close-on-click-modal="false" :close-on-click-modal="false"
...@@ -143,15 +142,17 @@ export default { ...@@ -143,15 +142,17 @@ export default {
}, },
// 编辑 // 编辑
onEdit(row) { onEdit(row) {
setTimeout(() => {
this.form = { ...row }; this.form = { ...row };
}, 10);
}, },
// 重置 // 重置
handleRest() { handleRest() {
this.$refs.form.resetFields(); this.resetForm("form");
}, },
// 关闭 // 关闭
handleClose() { handleClose() {
this.$refs.form.resetFields(); this.resetForm("form");
this.Visible = false; this.Visible = false;
}, },
handleChange(val) { handleChange(val) {
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
<div> <div>
<el-dialog <el-dialog
:title="title" :title="title"
:destroy-on-close="true"
:visible.sync="Visible" :visible.sync="Visible"
width="30%" width="30%"
@close="handleClose" @close="handleClose"
...@@ -176,15 +175,17 @@ export default { ...@@ -176,15 +175,17 @@ export default {
}, },
// 编辑 // 编辑
onEdit(row) { onEdit(row) {
setTimeout(() => {
this.form = { ...row }; this.form = { ...row };
}, 10);
}, },
// 重置 // 重置
handleRest() { handleRest() {
this.$refs.form.resetFields(); this.resetForm("form");
}, },
// 关闭 // 关闭
handleClose() { handleClose() {
this.$refs.form.resetFields(); this.resetForm("form");
this.Visible = false; this.Visible = false;
}, },
}, },
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
<div> <div>
<el-dialog <el-dialog
:title="title" :title="title"
:destroy-on-close="true"
:visible.sync="Visible" :visible.sync="Visible"
width="30%" width="30%"
@close="handleClose" @close="handleClose"
...@@ -222,15 +221,17 @@ export default { ...@@ -222,15 +221,17 @@ export default {
}, },
// 编辑 // 编辑
onEdit(row) { onEdit(row) {
setTimeout(() => {
this.form = { ...row }; this.form = { ...row };
}, 10);
}, },
// 重置 // 重置
handleRest() { handleRest() {
this.$refs.form.resetFields(); this.resetForm("form");
}, },
// 关闭 // 关闭
handleClose() { handleClose() {
this.$refs.form.resetFields(); this.resetForm("form");
this.Visible = false; this.Visible = false;
}, },
// 切换策略 // 切换策略
......
...@@ -17,9 +17,6 @@ export default new Vuex.Store({ ...@@ -17,9 +17,6 @@ export default new Vuex.Store({
path: "", // 门户跳转过来的路由 path: "", // 门户跳转过来的路由
}, },
getters: { getters: {
SET_path(state, path) {
state.path = path;
},
token(state) { token(state) {
return state.token; return state.token;
}, },
...@@ -52,6 +49,9 @@ export default new Vuex.Store({ ...@@ -52,6 +49,9 @@ export default new Vuex.Store({
SET_token(state, token) { SET_token(state, token) {
state.token = token; state.token = token;
}, },
SET_path(state, path) {
state.path = path;
},
}, },
actions: {}, actions: {},
modules: {}, modules: {},
......
...@@ -96,3 +96,10 @@ export class SessionCrypto { ...@@ -96,3 +96,10 @@ export class SessionCrypto {
window.sessionStorage.removeItem(key); 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