响应式优化

This commit is contained in:
wangxinbo
2020-11-15 16:47:42 +08:00
parent 8de6c6900c
commit 30686dab03
33 changed files with 2803 additions and 1824 deletions

View File

@ -61,19 +61,16 @@
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['benyi:child:add']"
>新增</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
<div class="mb8 btn-list">
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['benyi:child:add']"
>新增</el-button
>
<!-- <el-button
type="success"
icon="el-icon-edit"
size="mini"
@ -81,57 +78,48 @@
@click="handleUpdate"
v-hasPermi="['benyi:child:edit']"
>修改</el-button
>
</el-col>
<el-col :span="1.5">
> -->
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['benyi:child:remove']"
>删除</el-button
>
<el-button
type="warning"
icon="el-icon-download"
size="mini"
:disabled="multiple"
@click="handleTiaoban"
v-hasPermi="['benyi:child:edit']"
>调班</el-button
>
<el-button
type="info"
icon="el-icon-upload2"
size="mini"
@click="handleImport"
v-hasPermi="['benyi:child:import']"
>导入</el-button
>
<el-tooltip
effect="dark"
content="点我,可以复制链接发送给所有家长补填幼儿信息呦"
placement="top-start"
>
<el-button
type="danger"
icon="el-icon-delete"
type="primary"
icon="el-icon-document-copy"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['benyi:child:remove']"
>删除</el-button
@click="copy($event, inviteCode)"
v-hasPermi="['benyi:child:add']"
>家长填报链接</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
icon="el-icon-download"
size="mini"
:disabled="multiple"
@click="handleTiaoban"
v-hasPermi="['benyi:child:edit']"
>调班</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="info"
icon="el-icon-upload2"
size="mini"
@click="handleImport"
v-hasPermi="['benyi:child:import']"
>导入</el-button
>
</el-col>
<el-col :span="1.5">
<el-tooltip
effect="dark"
content="点我,可以复制链接发送给所有家长补填幼儿信息呦"
placement="top-start"
>
<el-button
type="primary"
icon="el-icon-document-copy"
size="mini"
@click="copy($event, inviteCode)"
v-hasPermi="['benyi:child:add']"
>家长填报链接</el-button
>
</el-tooltip>
</el-col>
</el-row>
</el-tooltip>
</div>
<el-table
v-loading="loading"
@ -148,7 +136,7 @@
:formatter="classFormat"
/>
<el-table-column label="姓名" align="center" prop="name" />
<el-table-column label="家长手机号码" align="center" prop="phone" />
<el-table-column label="家长手机号码" width="120" align="center" prop="phone" />
<el-table-column
label="性别"
align="center"
@ -193,6 +181,7 @@
<el-table-column
label="操作"
align="center"
width="100"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
@ -225,7 +214,7 @@
/>
<!-- 添加或修改幼儿信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
<el-dialog :title="title" :visible.sync="open" class="big-dialog" append-to-body>
<el-tabs type="border-card">
<el-tab-pane label="幼儿基础信息">
<el-row :gutter="15">
@ -670,7 +659,7 @@ import {
addChild,
updateChild,
updateChild_tb,
importTemplate,
importTemplate
} from "@/api/benyi/child";
import {
listContactpeople,
@ -678,7 +667,7 @@ import {
getContactpeopleByChildId,
delContactpeople,
addContactpeople,
updateContactpeople,
updateContactpeople
} from "@/api/benyi/contactpeople";
import { listClass } from "@/api/system/class";
@ -698,22 +687,22 @@ export default {
placeholders: {
province: "请选择省",
city: "请选择市",
area: "请选择区",
area: "请选择区"
},
diglogForm: {
province: null,
city: null,
area: null,
area: null
},
diglogForm1: {
province: null,
city: null,
area: null,
area: null
},
diglogForm2: {
province: null,
city: null,
area: null,
area: null
},
// 连接内容
inviteCode: "",
@ -761,7 +750,7 @@ export default {
// 设置上传的请求头部
headers: { Authorization: "Bearer " + getToken() },
// 上传的地址
url: process.env.VUE_APP_BASE_API + "/benyi/child/importData",
url: process.env.VUE_APP_BASE_API + "/benyi/child/importData"
},
// 查询参数
queryParams: {
@ -805,7 +794,7 @@ export default {
firstLanguage: undefined,
seconderLanguage: undefined,
otherLanguage: undefined,
createuserid: undefined,
createuserid: undefined
},
// 表单参数
form: {},
@ -816,44 +805,44 @@ export default {
// 表单校验
rules: {
name: [
{ required: true, message: "幼儿姓名不能为空", trigger: "blur" },
{ required: true, message: "幼儿姓名不能为空", trigger: "blur" }
],
phone: [
{ required: true, message: "家长手机号码不能为空", trigger: "blur" },
{ required: true, message: "家长手机号码不能为空", trigger: "blur" }
],
classid: [{ required: true, message: "班级不能为空", trigger: "blur" }],
classid: [{ required: true, message: "班级不能为空", trigger: "blur" }]
},
rules_tb: {
classid: [{ required: true, message: "班级不能为空", trigger: "blur" }],
},
classid: [{ required: true, message: "班级不能为空", trigger: "blur" }]
}
};
},
created() {
this.getList();
this.getClassList();
this.getDicts("sys_user_sex").then((response) => {
this.getDicts("sys_user_sex").then(response => {
this.sexOptions = response.data;
});
this.getDicts("sys_normal_disable").then((response) => {
this.getDicts("sys_normal_disable").then(response => {
this.statusOptions = response.data;
});
this.getDicts("sys_dm_mz").then((response) => {
this.getDicts("sys_dm_mz").then(response => {
this.mzOptions = response.data;
});
this.getDicts("sys_yes_no").then((response) => {
this.getDicts("sys_yes_no").then(response => {
this.ynOptions = response.data;
});
this.getDicts("sys_dm_ryqd").then((response) => {
this.getDicts("sys_dm_ryqd").then(response => {
this.sourceOptions = response.data;
});
this.getDicts("sys_dm_jtgx").then((response) => {
this.getDicts("sys_dm_jtgx").then(response => {
this.jtgxOptions = response.data;
});
this.getLink();
},
components: {
//省市区三级联动全局组件
VDistpicker,
VDistpicker
},
methods: {
/** 导入按钮操作 */
@ -863,27 +852,24 @@ export default {
},
// 链接内容
getLink() {
getUserProfile().then((response) => {
getUserProfile().then(response => {
var domain = window.location.host;
//console.log(domain);
//this.user = response.data;
this.inviteCode =
"http://" +
domain +
"/benyi_child/child_preserve";
this.inviteCode = "http://" + domain + "/benyi_child/child_preserve";
});
},
// 给家长发送链接
copy(e, text) {
const clipboard = new Clipboard(e.target, { text: () => text });
clipboard.on("success", (e) => {
clipboard.on("success", e => {
this.msgSuccess("复制成功");
// 释放内存
clipboard.off("error");
clipboard.off("success");
clipboard.destroy();
});
clipboard.on("error", (e) => {
clipboard.on("error", e => {
// 不支持复制
this.msgError("手机权限不支持复制功能");
// 释放内存
@ -918,7 +904,7 @@ export default {
// return this.selectDictLabel(this.classOptions, row.classid);
var actions = [];
var datas = this.classOptions;
Object.keys(datas).map((key) => {
Object.keys(datas).map(key => {
if (datas[key].bjbh == "" + row.classid) {
actions.push(datas[key].bjmc);
return false;
@ -927,14 +913,14 @@ export default {
return actions.join("");
},
getClassList() {
listClass(null).then((response) => {
listClass(null).then(response => {
this.classOptions = response.rows;
});
},
/** 查询幼儿信息列表 */
getList() {
this.loading = true;
listChild(this.queryParams).then((response) => {
listChild(this.queryParams).then(response => {
this.childList = response.rows;
this.total = response.total;
this.loading = false;
@ -993,7 +979,7 @@ export default {
seconderLanguage: undefined,
otherLanguage: undefined,
createuserid: undefined,
createTime: undefined,
createTime: undefined
};
this.diglogForm.province = "";
@ -1029,7 +1015,7 @@ export default {
gmphone: undefined,
gmaddress: undefined,
gmoffphone: undefined,
createTime: undefined,
createTime: undefined
};
this.resetForm("form_jhr");
},
@ -1045,7 +1031,7 @@ export default {
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id);
this.ids = selection.map(item => item.id);
this.single = selection.length != 1;
this.multiple = !selection.length;
},
@ -1059,7 +1045,7 @@ export default {
async handleUpdate(row) {
this.reset();
const id = row.id || this.ids;
await getChild(id).then((response) => {
await getChild(id).then(response => {
this.form = response.data;
this.diglogForm.province = response.data.birthProvincename;
@ -1078,20 +1064,20 @@ export default {
this.title = "修改幼儿信息";
//根据幼儿id获取监护人信息
getContactpeopleByChildId(this.form.id).then((res) => {
getContactpeopleByChildId(this.form.id).then(res => {
// console.log("childid:" + this.form.id + ";jhr:" + res.data);
this.form_jhr = res.data;
});
});
},
/** 提交按钮 */
submitForm: function () {
this.$refs["form"].validate((valid) => {
submitForm: function() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != undefined) {
updateChild(this.form).then((response) => {
updateChild(this.form).then(response => {
if (response.code === 200) {
updateContactpeople(this.form_jhr).then((res) => {
updateContactpeople(this.form_jhr).then(res => {
if (res.code === 200) {
this.msgSuccess("修改成功");
this.open = false;
@ -1101,11 +1087,11 @@ export default {
}
});
} else {
addChild(this.form).then((response) => {
addChild(this.form).then(response => {
// console.log(response);
if (response.code === 200) {
this.form_jhr.childid = response.data;
addContactpeople(this.form_jhr).then((res) => {
addContactpeople(this.form_jhr).then(res => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
@ -1117,11 +1103,11 @@ export default {
});
},
/** 提交按钮 */
submitForm_tb: function () {
this.$refs["form"].validate((valid) => {
submitForm_tb: function() {
this.$refs["form"].validate(valid => {
if (valid) {
console.log(this.ids + "---" + this.form.classid);
updateChild_tb(this.form, this.ids).then((response) => {
updateChild_tb(this.form, this.ids).then(response => {
if (response.code === 200) {
this.msgSuccess("调班成功");
this.open_tb = false;
@ -1147,17 +1133,17 @@ export default {
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
type: "warning"
}
)
.then(function () {
.then(function() {
return delChild(ids);
})
.then(() => {
this.getList();
this.msgSuccess("删除成功");
})
.catch(function () {});
.catch(function() {});
},
//所在省市区触发联动方法
onSelected_brith(data) {
@ -1215,7 +1201,7 @@ export default {
},
/** 下载模板操作 */
importTemplate() {
importTemplate().then((response) => {
importTemplate().then(response => {
this.download(response.msg);
});
},
@ -1234,7 +1220,7 @@ export default {
// 提交上传文件
submitFileForm() {
this.$refs.upload.submit();
},
},
}
}
};
</script>
</script>