Commit 4d79d995 authored by “yiyousong”'s avatar “yiyousong”

perf:优化弹窗

parent a68e7a4b
...@@ -112,7 +112,9 @@ export default { ...@@ -112,7 +112,9 @@ export default {
this.form.id && this.$delete(this.form, "id"); this.form.id && this.$delete(this.form, "id");
}, },
onEdit(data) { onEdit(data) {
this.form = { ...data }; this.$nextTick(() => {
this.form = { ...data };
});
}, },
handleReset() { handleReset() {
this.$refs.form.resetFields(); this.$refs.form.resetFields();
...@@ -125,5 +127,4 @@ export default { ...@@ -125,5 +127,4 @@ export default {
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped></style>
</style>
\ No newline at end of file
...@@ -154,7 +154,9 @@ export default { ...@@ -154,7 +154,9 @@ export default {
}, },
// 编辑 // 编辑
onEdit(data) { onEdit(data) {
this.form = { ...data }; this.$nextTick(() => {
this.form = { ...data };
});
}, },
// 关闭对话框 // 关闭对话框
handleClose() { handleClose() {
...@@ -178,4 +180,4 @@ export default { ...@@ -178,4 +180,4 @@ export default {
/deep/.ant-form-explain { /deep/.ant-form-explain {
position: absolute; position: absolute;
} }
</style> </style>
\ No newline at end of file
...@@ -471,7 +471,9 @@ export default { ...@@ -471,7 +471,9 @@ export default {
}; };
}); });
} }
this.form = { ...data }; this.$nextTick(() => {
this.form = { ...data };
});
}, },
// 过滤附件数组 // 过滤附件数组
filterArr(arr, file) { filterArr(arr, file) {
...@@ -525,4 +527,4 @@ export default { ...@@ -525,4 +527,4 @@ export default {
.upload-file { .upload-file {
display: block; display: block;
} }
</style> </style>
\ No newline at end of file
...@@ -143,7 +143,7 @@ ...@@ -143,7 +143,7 @@
}" }"
> >
<a-space size="middle"> <a-space size="middle">
<a-button @click="onClose"> 取消 </a-button> <a-button @click="resetForm"> 重置 </a-button>
<a-button type="primary" @click="onSubmit"> 确定 </a-button> <a-button type="primary" @click="onSubmit"> 确定 </a-button>
</a-space> </a-space>
</div> </div>
...@@ -269,8 +269,14 @@ export default { ...@@ -269,8 +269,14 @@ export default {
onClose() { onClose() {
this.$refs.form.resetFields(); this.$refs.form.resetFields();
this.fileList = []; this.fileList = [];
this.iconFileList = [];
this.Visible = false; this.Visible = false;
}, },
resetForm() {
this.fileList = [];
this.iconFileList = [];
this.$refs.form.resetFields();
},
// 提交 // 提交
onSubmit() { onSubmit() {
this.$refs.form.validate(async (valid) => { this.$refs.form.validate(async (valid) => {
...@@ -302,15 +308,6 @@ export default { ...@@ -302,15 +308,6 @@ export default {
}, },
// 上传图标 // 上传图标
handleChangeIcon({ fileList }) { handleChangeIcon({ fileList }) {
// if (info.file.status === "uploading") {
// this.loading = true;
// return;
// }
// if (info.file.status === "done") {
// this.form.appIconPath = info.file.response.url;
// this.loading = false;
// }
this.iconFileList = [...fileList].slice(-1); this.iconFileList = [...fileList].slice(-1);
this.iconFileList = this.iconFileList.map((v) => { this.iconFileList = this.iconFileList.map((v) => {
if (v.response) { if (v.response) {
...@@ -358,25 +355,28 @@ export default { ...@@ -358,25 +355,28 @@ export default {
}, },
// 编辑 // 编辑
onEdit(data) { onEdit(data) {
this.form = { ...data }; this.$nextTick(() => {
this.fileList = [ this.form = { ...data };
{ this.fileList = [
uid: "-1", {
name: this.form.fileName, uid: "-1",
status: "done", name: this.form.fileName,
url: this.form.filePath, status: "done",
}, url: this.form.filePath,
]; },
this.iconFileList = [ ];
{ this.iconFileList = [
uid: "-2", {
name: this.form.appIconPath, uid: "-2",
status: "done", name: this.form.appIconPath,
url: this.api2 + this.form.appIconPath, status: "done",
url2: this.form.appIconPath, url: this.api2 + this.form.appIconPath,
}, url2: this.form.appIconPath,
]; },
];
});
}, },
// 选中站点 // 选中站点
changeSite(value, label) { changeSite(value, label) {
this.form.siteName = label[0]; this.form.siteName = label[0];
......
...@@ -150,7 +150,7 @@ ...@@ -150,7 +150,7 @@
</a-form-model-item> </a-form-model-item>
</a-form-model> </a-form-model>
<div slot="footer"> <div slot="footer">
<a-button @click="handleCancel">取消</a-button> <a-button @click="handleReset">重置</a-button>
<a-button type="primary" @click="handleOk">确定</a-button> <a-button type="primary" @click="handleOk">确定</a-button>
</div> </div>
</a-modal> </a-modal>
...@@ -259,10 +259,10 @@ export default { ...@@ -259,10 +259,10 @@ export default {
fieldCode: "", // 字段编码 fieldCode: "", // 字段编码
fieldName: "", // 字段名称 fieldName: "", // 字段名称
fieldType: undefined, //字段类型(input.单行输入框,textarea.多行输入框,SELECT.下拉选项框,date.日期选择框) fieldType: undefined, //字段类型(input.单行输入框,textarea.多行输入框,SELECT.下拉选项框,date.日期选择框)
dataType: "", // 数据类型(number.数字,string.字符串) dataType: "string", // 数据类型(number.数字,string.字符串)
fieldLen: 128, //数据长度,默认128 fieldLen: 128, //数据长度,默认128
fieldNull: "", //是否允许为空,(0.否,1.是) fieldNull: 0, //是否允许为空,(0.否,1.是)
isList: "", //字段是否列表显示(0.否,1.是) isList: 0, //字段是否列表显示(0.否,1.是)
fieldOrderNo: 99, // 排序号 fieldOrderNo: 99, // 排序号
fieldTypeValue: "", // 字段类型值 fieldTypeValue: "", // 字段类型值
defaultValue: "", // 字段默认值 defaultValue: "", // 字段默认值
...@@ -363,7 +363,7 @@ export default { ...@@ -363,7 +363,7 @@ export default {
}); });
}, },
handleCancel() { handleCancel() {
this.$refs.form.clearValidate(); this.$refs.form.resetFields();
this.fieldType = [ this.fieldType = [
{ {
key: "", key: "",
...@@ -378,6 +378,21 @@ export default { ...@@ -378,6 +378,21 @@ export default {
]; ];
this.Visible = false; this.Visible = false;
}, },
handleReset() {
this.$refs.form.resetFields();
this.fieldType = [
{
key: "",
value: "",
},
];
this.apiParams = [
{
key: "",
value: "",
},
];
},
// 新增 // 新增
onAdd() { onAdd() {
Object.assign(this.form, this.$options.data().form); Object.assign(this.form, this.$options.data().form);
...@@ -387,40 +402,42 @@ export default { ...@@ -387,40 +402,42 @@ export default {
}, },
// 编辑 // 编辑
onEdit(data) { onEdit(data) {
if (data.fieldTypeValue) { this.$nextTick(() => {
let fieldTypeObj = JSON.parse(data.fieldTypeValue); if (data.fieldTypeValue) {
this.fieldType = Object.keys(fieldTypeObj).map((key) => { let fieldTypeObj = JSON.parse(data.fieldTypeValue);
return { this.fieldType = Object.keys(fieldTypeObj).map((key) => {
key, return {
value: fieldTypeObj[key], key,
}; value: fieldTypeObj[key],
}); };
} else { });
this.fieldType = [ } else {
{ this.fieldType = [
key: "", {
value: "", key: "",
}, value: "",
]; },
} ];
if (data.serviceApiParams) { }
let apiParamsObj = JSON.parse(data.serviceApiParams); if (data.serviceApiParams) {
this.apiParams = Object.keys(apiParamsObj).map((key) => { let apiParamsObj = JSON.parse(data.serviceApiParams);
return { this.apiParams = Object.keys(apiParamsObj).map((key) => {
key, return {
value: apiParamsObj[key], key,
}; value: apiParamsObj[key],
}); };
} else { });
this.apiParams = [ } else {
{ this.apiParams = [
key: "", {
value: "", key: "",
}, value: "",
]; },
} ];
this.form = { ...data }; }
this.getTempleteList(); this.form = { ...data };
this.getTempleteList();
});
}, },
// 添加数据配置行数 // 添加数据配置行数
insertion(index, type) { insertion(index, type) {
......
...@@ -5,13 +5,8 @@ ...@@ -5,13 +5,8 @@
:maskClosable="false" :maskClosable="false"
:title="title" :title="title"
@cancel="handleClose" @cancel="handleClose"
destroyOnClose
centered centered
> >
<template slot="footer">
<a-button @click="handleReset">重置</a-button>
<a-button type="primary" @click="handleOk">确定</a-button>
</template>
<a-form-model <a-form-model
ref="form" ref="form"
:model="form" :model="form"
...@@ -46,6 +41,10 @@ ...@@ -46,6 +41,10 @@
<a-input-number v-model="form.sort" :min="1" /> <a-input-number v-model="form.sort" :min="1" />
</a-form-model-item> </a-form-model-item>
</a-form-model> </a-form-model>
<template slot="footer">
<a-button @click="handleReset">重置</a-button>
<a-button type="primary" @click="handleOk">确定</a-button>
</template>
</a-modal> </a-modal>
</div> </div>
</template> </template>
...@@ -110,18 +109,20 @@ export default { ...@@ -110,18 +109,20 @@ export default {
}, },
// 编辑 // 编辑
onEdit(data) { onEdit(data) {
this.form = { ...data }; this.$nextTick(() => {
if (this.form.cover) { this.form = { ...data };
this.fileList = [ if (this.form.cover) {
{ this.fileList = [
uid: "-2", {
name: this.form.cover, uid: "-2",
status: "done", name: this.form.cover,
url: this.api2 + this.form.cover, status: "done",
url2: this.form.cover, url: this.api2 + this.form.cover,
}, url2: this.form.cover,
]; },
} ];
}
});
}, },
// 关闭弹窗 // 关闭弹窗
handleClose() { handleClose() {
...@@ -180,6 +181,7 @@ export default { ...@@ -180,6 +181,7 @@ export default {
}, },
// 重置 // 重置
handleReset() { handleReset() {
this.fileList = [];
this.$refs.form.resetFields(); this.$refs.form.resetFields();
}, },
}, },
......
...@@ -157,11 +157,13 @@ export default { ...@@ -157,11 +157,13 @@ export default {
}, },
// 编辑 // 编辑
onEdit(data) { onEdit(data) {
this.getBusinessData(); this.$nextTick(() => {
this.form = { ...data }; this.getBusinessData();
if (this.form.parentId == 0) { this.form = { ...data };
this.form.parentId = undefined; if (this.form.parentId == 0) {
} this.form.parentId = undefined;
}
});
}, },
// 切换业务级别 // 切换业务级别
changeIsBusiness() { changeIsBusiness() {
......
...@@ -119,8 +119,10 @@ export default { ...@@ -119,8 +119,10 @@ export default {
}, },
// 编辑 // 编辑
onEdit(data, modelInfo) { onEdit(data, modelInfo) {
this.modelInfo = modelInfo; this.$nextTick(() => {
this.formData = { ...data }; this.modelInfo = modelInfo;
this.formData = { ...data };
});
}, },
// 关闭弹窗 // 关闭弹窗
handleClose() { handleClose() {
...@@ -149,5 +151,4 @@ export default { ...@@ -149,5 +151,4 @@ export default {
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped></style>
</style>
\ No newline at end of file
...@@ -92,6 +92,12 @@ ...@@ -92,6 +92,12 @@
</a-col> </a-col>
</a-row> </a-row>
</a-form-model> </a-form-model>
<div slot="footer">
<a-button @click="resetForm">重置</a-button>
<a-button :loading="loading" type="primary" @click="handleOk"
>确定</a-button
>
</div>
</a-modal> </a-modal>
</template> </template>
...@@ -114,6 +120,7 @@ export default { ...@@ -114,6 +120,7 @@ export default {
// } // }
// }; // };
return { return {
loading: false,
labelCol: { span: 6 }, labelCol: { span: 6 },
wrapperCol: { span: 14 }, wrapperCol: { span: 14 },
siteInfo: { siteInfo: {
...@@ -179,9 +186,11 @@ export default { ...@@ -179,9 +186,11 @@ export default {
}, },
// 编辑 // 编辑
onEdit(data) { onEdit(data) {
this.siteInfo.siteName = data.siteName; this.$nextTick(() => {
this.siteInfo.siteId = data.siteId; this.siteInfo.siteName = data.siteName;
this.form = { ...data }; this.siteInfo.siteId = data.siteId;
this.form = { ...data };
});
}, },
// 保存 // 保存
handleOk() { handleOk() {
...@@ -206,6 +215,10 @@ export default { ...@@ -206,6 +215,10 @@ export default {
this.$refs.formData.resetFields(); this.$refs.formData.resetFields();
this.Visible = false; this.Visible = false;
}, },
// 重置
resetForm() {
this.$refs.formData.resetFields();
},
}, },
}; };
</script> </script>
...@@ -220,4 +233,4 @@ export default { ...@@ -220,4 +233,4 @@ export default {
/deep/.ant-form-explain { /deep/.ant-form-explain {
position: absolute; position: absolute;
} }
</style> </style>
\ No newline at end of file
<template> <template>
<a-modal <a-modal
:title="WindowTitle" :title="WindowTitle"
@ok="handleAdd"
:visible="Visible" :visible="Visible"
@cancel="handleClose" @cancel="handleClose"
:maskClosable="false" :maskClosable="false"
...@@ -188,6 +187,12 @@ ...@@ -188,6 +187,12 @@
</a-col> </a-col>
</a-row> </a-row>
</a-form-model> </a-form-model>
<div slot="footer">
<a-button @click="resetForm">重置</a-button>
<a-button :loading="loading" type="primary" @click="handleOk"
>确定</a-button
>
</div>
</a-modal> </a-modal>
</template> </template>
...@@ -288,12 +293,14 @@ export default { ...@@ -288,12 +293,14 @@ export default {
}, },
// 编辑 // 编辑
onEdit(row) { onEdit(row) {
this.siteInfo.siteName = row.siteName; this.$nextTick(() => {
this.siteInfo.siteId = row.siteId; this.siteInfo.siteName = row.siteName;
this.form = { ...row }; this.siteInfo.siteId = row.siteId;
this.form = { ...row };
});
}, },
// 保存 // 保存
async handleAdd() { async handleOk() {
this.$refs.formData.validate(async (valid) => { this.$refs.formData.validate(async (valid) => {
if (valid) { if (valid) {
let res = await addWindow({ let res = await addWindow({
...@@ -314,6 +321,10 @@ export default { ...@@ -314,6 +321,10 @@ export default {
this.$refs.formData.resetFields(); this.$refs.formData.resetFields();
this.Visible = false; this.Visible = false;
}, },
// 重置
resetForm() {
this.$refs.formData.resetFields();
},
// 改变无人值守 // 改变无人值守
changeDuty(val) { changeDuty(val) {
if (!val) { if (!val) {
......
...@@ -5,12 +5,7 @@ ...@@ -5,12 +5,7 @@
:maskClosable="false" :maskClosable="false"
:title="title" :title="title"
@cancel="handleClose" @cancel="handleClose"
destroyOnClose
> >
<template slot="footer">
<a-button @click="handleReset">重置</a-button>
<a-button type="primary" @click="handleOk">确定</a-button>
</template>
<a-form-model <a-form-model
ref="form" ref="form"
:model="form" :model="form"
...@@ -44,11 +39,15 @@ ...@@ -44,11 +39,15 @@
/> />
</a-form-model-item> </a-form-model-item>
</a-form-model> </a-form-model>
<template slot="footer">
<a-button @click="handleReset">重置</a-button>
<a-button type="primary" @click="handleOk">确定</a-button>
</template>
</a-modal> </a-modal>
</div> </div>
</template> </template>
<script> <script>
import { saveHall } from "@/services/hall"; import { saveHall } from "@/services/hall";
import loacl from "@/utils/local"; import loacl from "@/utils/local";
export default { export default {
...@@ -100,7 +99,9 @@ export default { ...@@ -100,7 +99,9 @@ export default {
}, },
// 编辑 // 编辑
onEdit(data) { onEdit(data) {
this.form = { ...data }; this.$nextTick(() => {
this.form = { ...data };
});
}, },
// 关闭弹窗 // 关闭弹窗
handleClose() { handleClose() {
...@@ -128,9 +129,9 @@ export default { ...@@ -128,9 +129,9 @@ export default {
}, },
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.ant-input-number { .ant-input-number {
width: 100%; width: 100%;
} }
</style> </style>
\ No newline at end of file
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
:maskClosable="false" :maskClosable="false"
title="新增大厅窗口" title="新增大厅窗口"
@cancel="handleClose" @cancel="handleClose"
destroyOnClose
centered centered
> >
<template slot="footer"> <template slot="footer">
...@@ -96,7 +95,9 @@ export default { ...@@ -96,7 +95,9 @@ export default {
}, },
// 新增 // 新增
onAdd(rows) { onAdd(rows) {
this.windowList = rows; this.$nextTick(() => {
this.windowList = rows;
});
// this.form.windowId = rows.id; // this.form.windowId = rows.id;
// this.form.windowName = rows.name; // this.form.windowName = rows.name;
}, },
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
<a-modal <a-modal
:maskClosable="false" :maskClosable="false"
:title="title" :title="title"
@ok="handleOk"
:visible="Visible" :visible="Visible"
@cancel="handleClose" @cancel="handleClose"
> >
...@@ -34,6 +33,12 @@ ...@@ -34,6 +33,12 @@
<a-textarea v-model="form.summary" placeholder allow-clear /> <a-textarea v-model="form.summary" placeholder allow-clear />
</a-form-model-item> </a-form-model-item>
</a-form-model> </a-form-model>
<div slot="footer">
<a-button @click="resetForm">重置</a-button>
<a-button :loading="loading" type="primary" @click="handleOk"
>确定</a-button
>
</div>
</a-modal> </a-modal>
</template> </template>
...@@ -41,8 +46,15 @@ ...@@ -41,8 +46,15 @@
import { addHoliday } from "@/services/festival"; import { addHoliday } from "@/services/festival";
import locale from "ant-design-vue/es/date-picker/locale/zh_CN"; import locale from "ant-design-vue/es/date-picker/locale/zh_CN";
export default { export default {
props: {
visibleDay: {
type: Boolean,
default: false,
},
},
data() { data() {
return { return {
loading: false,
locale, locale,
title: "选择节假日", title: "选择节假日",
date: [], // 日期 date: [], // 日期
...@@ -71,10 +83,15 @@ export default { ...@@ -71,10 +83,15 @@ export default {
}, },
}; };
}, },
props: {
visibleDay: { computed: {
type: Boolean, Visible: {
default: false, get() {
return this.visibleDay;
},
set(val) {
this.$emit("update:visibleDay", val);
},
}, },
}, },
methods: { methods: {
...@@ -82,6 +99,7 @@ export default { ...@@ -82,6 +99,7 @@ export default {
handleOk() { handleOk() {
this.$refs.ruleForm.validate(async (valid) => { this.$refs.ruleForm.validate(async (valid) => {
if (valid) { if (valid) {
this.loading = true;
let year = new Date(parseInt(this.form.startTime)).getFullYear(); let year = new Date(parseInt(this.form.startTime)).getFullYear();
let res = await addHoliday({ let res = await addHoliday({
...this.form, ...this.form,
...@@ -95,6 +113,7 @@ export default { ...@@ -95,6 +113,7 @@ export default {
this.handleClose(); this.handleClose();
this.$parent.getHolidayData(); this.$parent.getHolidayData();
} }
this.loading = false;
} }
}); });
}, },
...@@ -114,22 +133,19 @@ export default { ...@@ -114,22 +133,19 @@ export default {
// 编辑 // 编辑
onEdit(data) { onEdit(data) {
this.title = "编辑节假日"; this.title = "编辑节假日";
this.date = [String(data.startTime), String(data.endTime)]; this.$nextTick(() => {
this.form = { ...data }; this.date = [String(data.startTime), String(data.endTime)];
this.form = { ...data };
});
}, },
handleClose() { handleClose() {
this.Visible = false; this.Visible = false;
this.$refs.ruleForm.resetFields(); this.$refs.ruleForm.resetFields();
}, },
}, // 重置
computed: { resetForm() {
Visible: { this.date = [];
get() { this.$refs.ruleForm.resetFields();
return this.visibleDay;
},
set(val) {
this.$emit("update:visibleDay", val);
},
}, },
}, },
}; };
...@@ -143,4 +159,4 @@ export default { ...@@ -143,4 +159,4 @@ export default {
/deep/.ant-form-explain { /deep/.ant-form-explain {
position: absolute; position: absolute;
} }
</style> </style>
\ No newline at end of file
...@@ -36,10 +36,10 @@ ...@@ -36,10 +36,10 @@
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
<a-form-model-item label="区域编号" prop="areaCode"> <a-form-model-item label="区域编号">
<a-input <a-input
v-model="areaInfo.areaCode" v-model="areaInfo.areaCode"
readOnly disabled
type="text" type="text"
placeholder="请输入区域编号" placeholder="请输入区域编号"
/> </a-form-model-item /> </a-form-model-item
...@@ -596,6 +596,7 @@ export default { ...@@ -596,6 +596,7 @@ export default {
//重置 //重置
resetForm() { resetForm() {
this.fileList = []; this.fileList = [];
this.cityData = [];
this.$refs.ruleForm.resetFields(); this.$refs.ruleForm.resetFields();
}, },
// 关闭对话框 // 关闭对话框
...@@ -612,31 +613,33 @@ export default { ...@@ -612,31 +613,33 @@ export default {
}, },
// 编辑 // 编辑
onEdit(data) { onEdit(data) {
this.formInfo = { ...data }; this.$nextTick(() => {
this.areaInfo.areaID = this.formInfo.areaID; this.formInfo = { ...data };
this.areaInfo.areaCode = this.formInfo.areaCode; this.areaInfo.areaID = this.formInfo.areaID;
this.areaInfo.areaName = this.formInfo.areaName; this.areaInfo.areaCode = this.formInfo.areaCode;
this.cityData = [ this.areaInfo.areaName = this.formInfo.areaName;
this.formInfo.proCode, this.cityData = [
this.formInfo.cityCode, this.formInfo.proCode,
this.formInfo.districtCode, this.formInfo.cityCode,
]; this.formInfo.districtCode,
this.formInfo.modelIds = this.formInfo.modelIds.map(Number);
this.formInfo.amWorkStartTime = String(this.formInfo.amWorkStartTime);
this.formInfo.amWorkEndTime = String(this.formInfo.amWorkEndTime);
this.formInfo.pmWorkStartTime = String(this.formInfo.pmWorkStartTime);
this.formInfo.pmWorkEndTime = String(this.formInfo.pmWorkEndTime);
if (this.formInfo.logoPath) {
this.fileList = [
{
uid: -1,
status: "done",
name: this.formInfo.logoPath,
url: this.api2 + this.formInfo.logoPath,
url2: this.formInfo.logoPath,
},
]; ];
} this.formInfo.modelIds = this.formInfo.modelIds.map(Number);
this.formInfo.amWorkStartTime = String(this.formInfo.amWorkStartTime);
this.formInfo.amWorkEndTime = String(this.formInfo.amWorkEndTime);
this.formInfo.pmWorkStartTime = String(this.formInfo.pmWorkStartTime);
this.formInfo.pmWorkEndTime = String(this.formInfo.pmWorkEndTime);
if (this.formInfo.logoPath) {
this.fileList = [
{
uid: -1,
status: "done",
name: this.formInfo.logoPath,
url: this.api2 + this.formInfo.logoPath,
url2: this.formInfo.logoPath,
},
];
}
});
}, },
// 保存 // 保存
handleOk() { handleOk() {
...@@ -729,8 +732,10 @@ export default { ...@@ -729,8 +732,10 @@ export default {
}) })
.then((res) => { .then((res) => {
let { location } = res.geocodes[0]; let { location } = res.geocodes[0];
[this.formInfo.longitude, this.formInfo.latitude] = [
location.split(","); this.formInfo.longitude,
this.formInfo.latitude,
] = location.split(",");
}) })
.catch(() => { .catch(() => {
this.$message.error("经纬度获取失败,请输入正确的地址"); this.$message.error("经纬度获取失败,请输入正确的地址");
......
<template> <template>
<div> <div>
<a-modal <a-modal v-model="Visible" :title="title" @cancel="handleClose">
v-model="Visible"
:title="title"
@ok="handleOk"
@cancel="handleClose"
>
<a-form-model <a-form-model
:model="form" :model="form"
ref="form" ref="form"
...@@ -27,6 +22,10 @@ ...@@ -27,6 +22,10 @@
/> />
</a-form-model-item> </a-form-model-item>
</a-form-model> </a-form-model>
<div slot="footer">
<a-button @click="resetForm">重置</a-button>
<a-button type="primary" @click="handleOk">确定</a-button>
</div>
</a-modal> </a-modal>
</div> </div>
</template> </template>
...@@ -89,9 +88,12 @@ export default { ...@@ -89,9 +88,12 @@ export default {
}, },
// 关闭对话框 // 关闭对话框
handleClose() { handleClose() {
this.$refs.form.clearValidate(); this.$refs.form.resetFields();
this.Visible = false; this.Visible = false;
}, },
resetForm() {
this.$refs.form.resetFields();
},
// 新增 // 新增
onAdd() { onAdd() {
Object.assign(this.form, this.$options.data().form); Object.assign(this.form, this.$options.data().form);
...@@ -99,7 +101,9 @@ export default { ...@@ -99,7 +101,9 @@ export default {
}, },
// 编辑 // 编辑
onEdit(row) { onEdit(row) {
this.form = { ...row }; setTimeout(() => {
this.form = { ...row };
}, 10);
}, },
}, },
}; };
...@@ -114,4 +118,4 @@ export default { ...@@ -114,4 +118,4 @@ export default {
/deep/.ant-form-explain { /deep/.ant-form-explain {
position: absolute; position: absolute;
} }
</style> </style>
\ No newline at end of file
<template> <template>
<div> <div>
<a-modal <a-modal v-model="Visible" :title="titleField" @cancel="handleClose">
v-model="Visible"
:title="titleField"
@ok="handleOk"
@cancel="handleClose"
>
<a-form-model <a-form-model
:model="formData" :model="formData"
ref="formData" ref="formData"
...@@ -54,6 +49,10 @@ ...@@ -54,6 +49,10 @@
<a-input-number v-model="formData.fieldOrderNo" :min="0" /> <a-input-number v-model="formData.fieldOrderNo" :min="0" />
</a-form-model-item> </a-form-model-item>
</a-form-model> </a-form-model>
<div slot="footer">
<a-button @click="resetForm">重置</a-button>
<a-button type="primary" @click="handleOk">确定</a-button>
</div>
</a-modal> </a-modal>
</div> </div>
</template> </template>
...@@ -152,7 +151,10 @@ export default { ...@@ -152,7 +151,10 @@ export default {
}); });
}, },
handleClose() { handleClose() {
this.$refs.formData.resetFields();
this.Visible = false; this.Visible = false;
},
resetForm() {
this.$refs.formData.resetFields(); this.$refs.formData.resetFields();
}, },
changeTemplate(val, e) { changeTemplate(val, e) {
...@@ -166,7 +168,9 @@ export default { ...@@ -166,7 +168,9 @@ export default {
}, },
// 编辑 // 编辑
onEdit(row) { onEdit(row) {
this.formData = { ...row }; this.$nextTick(() => {
this.formData = { ...row };
});
}, },
}, },
}; };
...@@ -181,4 +185,4 @@ export default { ...@@ -181,4 +185,4 @@ export default {
/deep/.ant-form-explain { /deep/.ant-form-explain {
position: absolute; position: absolute;
} }
</style> </style>
\ No newline at end of file
<template> <template>
<div> <div>
<a-modal <a-modal v-model="Visible" :title="titleTemplate" @cancel="handleClose">
v-model="Visible"
:title="titleTemplate"
@ok="handleOk"
@cancel="handleClose"
>
<a-form-model <a-form-model
:model="formData" :model="formData"
ref="formData" ref="formData"
...@@ -31,6 +26,10 @@ ...@@ -31,6 +26,10 @@
/> />
</a-form-model-item> </a-form-model-item>
</a-form-model> </a-form-model>
<div slot="footer">
<a-button @click="resetForm">重置</a-button>
<a-button type="primary" @click="handleOk">确定</a-button>
</div>
</a-modal> </a-modal>
</div> </div>
</template> </template>
...@@ -108,8 +107,8 @@ export default { ...@@ -108,8 +107,8 @@ export default {
this.formData.productName = text; this.formData.productName = text;
}, },
handleClose() { handleClose() {
this.Visible = false;
this.$refs.formData.resetFields(); this.$refs.formData.resetFields();
this.Visible = false;
}, },
// 新增 // 新增
onAdd() { onAdd() {
...@@ -118,8 +117,12 @@ export default { ...@@ -118,8 +117,12 @@ export default {
}, },
// 编辑 // 编辑
onEdit(row) { onEdit(row) {
this.formData = { ...row }; this.$nextTick(() => {
console.log(row); this.formData = { ...row };
});
},
resetForm() {
this.$refs.formData.resetFields();
}, },
handleOk() { handleOk() {
this.$refs.formData.validate(async (valid) => { this.$refs.formData.validate(async (valid) => {
...@@ -161,4 +164,4 @@ export default { ...@@ -161,4 +164,4 @@ export default {
margin-right: 4px; margin-right: 4px;
margin-bottom: 4px; margin-bottom: 4px;
} }
</style> </style>
\ No newline at end of file
...@@ -148,7 +148,9 @@ export default { ...@@ -148,7 +148,9 @@ export default {
}, },
// 编辑 // 编辑
onEdit(row) { onEdit(row) {
this.form = { ...row }; this.$nextTick(() => {
this.form = { ...row };
});
}, },
// 保存 // 保存
handleOk() { handleOk() {
...@@ -168,5 +170,4 @@ export default { ...@@ -168,5 +170,4 @@ export default {
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped></style>
</style>
\ No newline at end of file
...@@ -209,7 +209,9 @@ export default { ...@@ -209,7 +209,9 @@ export default {
}, },
// 编辑 // 编辑
onEdit(row) { onEdit(row) {
this.form = { ...row }; this.$nextTick(() => {
this.form = { ...row };
});
}, },
// 保存 // 保存
handleOk() { handleOk() {
...@@ -229,5 +231,4 @@ export default { ...@@ -229,5 +231,4 @@ export default {
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped></style>
</style>
\ No newline at end of file
...@@ -527,22 +527,26 @@ export default { ...@@ -527,22 +527,26 @@ export default {
}, },
// 编辑 // 编辑
onEdit(data) { onEdit(data) {
// this.editWindow(data.deptId); this.$nextTick(() => {
this.form = { ...data }; // this.editWindow(data.deptId);
this.form.loginName && this.$delete(this.form, "loginName"); this.form = { ...data };
this.form.loginPwd && this.$delete(this.form, "loginPwd"); this.form.loginName && this.$delete(this.form, "loginName");
this.form.windowId = this.form.windowId ? this.form.windowId : undefined; this.form.loginPwd && this.$delete(this.form, "loginPwd");
if (this.form.photoPath) { this.form.windowId = this.form.windowId
this.fileList = [ ? this.form.windowId
{ : undefined;
uid: -1, if (this.form.photoPath) {
status: "done", this.fileList = [
name: this.form.photoPath, {
url: this.api2 + this.form.photoPath, uid: -1,
url2: this.form.photoPath, status: "done",
}, name: this.form.photoPath,
]; url: this.api2 + this.form.photoPath,
} url2: this.form.photoPath,
},
];
}
});
}, },
// 关闭对话框 // 关闭对话框
handleClose() { handleClose() {
...@@ -556,6 +560,7 @@ export default { ...@@ -556,6 +560,7 @@ export default {
// 重置 // 重置
handleReset() { handleReset() {
// this.form.windowName = ""; // this.form.windowName = "";
this.fileList = [];
this.$refs.formData.resetFields(); this.$refs.formData.resetFields();
}, },
// 照片上传 // 照片上传
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
:label-col="{ span: 5 }" :label-col="{ span: 5 }"
:wrapper-col="{ span: 19 }" :wrapper-col="{ span: 19 }"
> >
<a-form-model-item label="账号" prop="loginName"> <a-form-model-item label="账号">
<a-input disabled placeholder="请输入账号" v-model="form.loginName" /> <a-input disabled placeholder="请输入账号" v-model="form.loginName" />
</a-form-model-item> </a-form-model-item>
<!-- <a-form-model-item label="旧密码" prop="oldPwd"> <!-- <a-form-model-item label="旧密码" prop="oldPwd">
...@@ -115,12 +115,15 @@ export default { ...@@ -115,12 +115,15 @@ export default {
}, },
// 关闭对话框 // 关闭对话框
handleClose() { handleClose() {
this.form.loginName = "";
this.$refs.form.resetFields(); this.$refs.form.resetFields();
this.Visible = false; this.Visible = false;
}, },
// 获取用户账号信息 // 获取用户账号信息
getUserInfo(account) { getUserInfo(account) {
this.form.loginName = account; this.$nextTick(() => {
this.form.loginName = account;
});
}, },
}, },
}; };
...@@ -135,4 +138,4 @@ export default { ...@@ -135,4 +138,4 @@ export default {
/deep/.ant-form-explain { /deep/.ant-form-explain {
position: absolute; position: absolute;
} }
</style> </style>
\ No newline at end of file
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