优化页面-手机端响应式

This commit is contained in:
zhanglipeng
2020-11-19 10:25:11 +08:00
parent 9221a1a547
commit 10c309fcd2
17 changed files with 1637 additions and 1176 deletions

View File

@ -1,42 +1,45 @@
<template>
<div class="app-container">
<el-form
:model="queryParams"
ref="queryForm"
:inline="true"
label-width="90px"
>
<el-form-item label="通知书标题" prop="title">
<el-input
v-model="queryParams.title"
placeholder="请输入标题"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="通知书类型" prop="type">
<el-select v-model="queryParams.type" placeholder="请选择">
<el-option
v-for="dict in typeOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item>
<el-form :model="queryParams" ref="queryForm" label-width="90px">
<el-row :gutter="10">
<el-col :xs="24" :ms="12" :md="5">
<el-form-item label="通知书标题" prop="title">
<el-input
v-model="queryParams.title"
placeholder="请输入标题"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
</el-col>
<el-col :xs="24" :ms="12" :md="5">
<el-form-item label="通知书类型" prop="type">
<el-select v-model="queryParams.type" placeholder="请选择">
<el-option
v-for="dict in typeOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :xs="24" :ms="12" :md="4">
<el-form-item class="no-margin">
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="mb8 btn-list">
@ -71,13 +74,14 @@
</div>
<el-table
border
v-loading="loading"
:data="noticeList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="编号" align="center" prop="id" /> -->
<el-table-column label="标题" align="center" prop="title" />
<el-table-column fixed label="标题" align="center" prop="title" />
<el-table-column
label="类型"
align="center"
@ -85,8 +89,10 @@
:formatter="typeFormat"
/>
<el-table-column
fixed="right"
label="操作"
align="center"
width="180"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
@ -138,7 +144,12 @@
/>
<!-- 添加或修改入园通知书对话框 -->
<el-dialog :title="title" :visible.sync="open" class="big-dialog" append-to-body>
<el-dialog
:title="title"
:visible.sync="open"
class="big-dialog"
append-to-body
>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="标题" prop="title">
<el-input v-model="form.title" placeholder="请输入标题" />
@ -164,7 +175,7 @@ import {
delNotice,
addNotice,
updateNotice,
copyNotice
copyNotice,
} from "@/api/benyi/recruitstudentsnotice";
import Editor from "@/components/Editor";
@ -172,7 +183,7 @@ import Editor from "@/components/Editor";
export default {
name: "Notice",
components: {
Editor
Editor,
},
data() {
return {
@ -202,17 +213,17 @@ export default {
title: undefined,
content: undefined,
type: undefined,
schoolid: undefined
schoolid: undefined,
},
// 表单参数
form: {},
// 表单校验
rules: {}
rules: {},
};
},
created() {
this.getList();
this.getDicts("sys_dm_noticetype").then(response => {
this.getDicts("sys_dm_noticetype").then((response) => {
this.typeOptions = response.data;
});
},
@ -232,7 +243,7 @@ export default {
/** 查询入园通知书列表 */
getList() {
this.loading = true;
listNotice(this.queryParams).then(response => {
listNotice(this.queryParams).then((response) => {
this.noticeList = response.rows;
this.total = response.total;
this.loading = false;
@ -251,7 +262,7 @@ export default {
content: undefined,
type: undefined,
schoolid: undefined,
createTime: undefined
createTime: undefined,
};
this.resetForm("form");
},
@ -267,7 +278,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;
},
@ -275,7 +286,7 @@ export default {
handleView(row) {
this.reset();
const id = row.id || this.ids;
getNotice(id).then(response => {
getNotice(id).then((response) => {
this.form = response.data;
this.open = true;
this.title = "入园通知书详情";
@ -293,7 +304,7 @@ export default {
handleUpdate(row) {
this.reset();
const id = row.id || this.ids;
getNotice(id).then(response => {
getNotice(id).then((response) => {
this.form = response.data;
this.open = true;
this.title = "修改入园通知书";
@ -301,11 +312,11 @@ export default {
});
},
/** 提交按钮 */
submitForm: function() {
this.$refs["form"].validate(valid => {
submitForm: function () {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.id != undefined) {
updateNotice(this.form).then(response => {
updateNotice(this.form).then((response) => {
if (response.code === 200) {
this.msgSuccess("修改成功");
this.open = false;
@ -313,7 +324,7 @@ export default {
}
});
} else {
addNotice(this.form).then(response => {
addNotice(this.form).then((response) => {
if (response.code === 200) {
this.msgSuccess("新增成功");
this.open = false;
@ -333,17 +344,17 @@ export default {
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
type: "warning",
}
)
.then(function() {
.then(function () {
return delNotice(ids);
})
.then(() => {
this.getList();
this.msgSuccess("删除成功");
})
.catch(function() {});
.catch(function () {});
},
/** 复制按钮操作 */
handleCopy(row) {
@ -351,17 +362,34 @@ export default {
this.$confirm('确认复制入园通知书编号为"' + id + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
type: "warning",
})
.then(function() {
.then(function () {
return copyNotice(id);
})
.then(() => {
this.getList();
this.msgSuccess("复制成功");
})
.catch(function() {});
}
}
.catch(function () {});
},
},
};
</script>
<style lang="scss" scoped>
.el-select {
width: 100%;
}
.my-date-picker {
width: 100%;
}
.edit-btns {
.el-button {
display: block;
margin: 0 auto;
}
}
.no-margin ::v-deep.el-form-item__content {
margin: 0 !important;
}
</style>