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

perf:优化弹窗

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