提交
This commit is contained in:
129
src/views/zs/office/components/OfiiceDialogForm.vue
Normal file
129
src/views/zs/office/components/OfiiceDialogForm.vue
Normal file
@@ -0,0 +1,129 @@
|
||||
<template>
|
||||
<el-dialog title="报名点信息" :close-on-click-modal="false" append-to-body :visible.sync="visible" width="600px" @close="closeDialog">
|
||||
<div>
|
||||
<el-form ref="dialogForm" :model="dialogForm" :rules="dataRule" label-position="top" @keyup.enter.native="dialogFormSubmit()">
|
||||
<el-form-item label="报名点名称" prop="officeName">
|
||||
<el-input v-model="dialogForm.officeName" placeholder="请输入报名点名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="推送驾校" prop="schoolList">
|
||||
<el-select v-model="dialogForm.schoolList" filterable placeholder="请选择" value-key="schoolId" clearable size="small" multiple>
|
||||
<el-option v-for="(dict, index) in schoolOptions" :key="index" :label="dict.schoolName" :value="dict.schoolId" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="负责人" prop="leader">
|
||||
<el-input v-model="dialogForm.leader" placeholder="请输入负责人" />
|
||||
</el-form-item>
|
||||
<el-form-item label="联系方式" prop="phone">
|
||||
<el-input v-model="dialogForm.phone" placeholder="请输入联系方式" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="dialogForm.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button plain @click="(visible=false)">取消</el-button>
|
||||
<el-button v-jclick type="primary" :disabled="!canSubmit" @click="dialogFormSubmit()">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { addOffice, updateOffice } from '@/api/zs/office';
|
||||
import schoolAPi from '@/api/sch/school'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
canSubmit: true,
|
||||
dialogForm: {
|
||||
officeId: undefined,
|
||||
deptId: undefined,
|
||||
officeName: undefined,
|
||||
leader: undefined,
|
||||
phone: undefined,
|
||||
schoolList: [],
|
||||
remark: undefined
|
||||
},
|
||||
dataRule: {
|
||||
officeName: [{ required: true, message: '报名点名称不能为空', trigger: 'blur' }],
|
||||
schoolList: [{ required: true, message: '推送驾校不能为空', trigger: 'blur' }]
|
||||
},
|
||||
schoolOptions: []
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
init(info = undefined) {
|
||||
// debugger
|
||||
this.visible = true;
|
||||
this.getSchools()
|
||||
this.$nextTick(() => {
|
||||
this.resetDialogForm();
|
||||
this.$refs['dialogForm'].resetFields();
|
||||
if (info) {
|
||||
this.dialogForm = this.deepClone(info);
|
||||
}
|
||||
});
|
||||
},
|
||||
resetDialogForm() {
|
||||
this.dialogForm = {
|
||||
officeId: undefined,
|
||||
deptId: undefined,
|
||||
officeName: undefined,
|
||||
leader: undefined,
|
||||
phone: undefined,
|
||||
schoolList: [],
|
||||
remark: undefined
|
||||
};
|
||||
},
|
||||
closeDialog() {
|
||||
this.$emit('update:dialogVisible', false);
|
||||
},
|
||||
// 表单提交
|
||||
dialogFormSubmit() {
|
||||
this.$refs.dialogForm.validate((valid) => {
|
||||
if (valid) {
|
||||
this.canSubmit = false;
|
||||
|
||||
if (this.dialogForm.officeId) {
|
||||
// 校验完成,调接口
|
||||
updateOffice(this.dialogForm)
|
||||
.then((resp) => {
|
||||
this.canSubmit = true;
|
||||
if (resp.code == 200) {
|
||||
this.$message.success('保存成功');
|
||||
this.$emit('refreshDataList');
|
||||
this.visible = false;
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.canSubmit = true;
|
||||
});
|
||||
} else {
|
||||
addOffice(this.dialogForm)
|
||||
.then((resp) => {
|
||||
this.canSubmit = true;
|
||||
if (resp.code == 200) {
|
||||
this.$message.success('保存成功');
|
||||
this.$emit('refreshDataList');
|
||||
this.visible = false;
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.canSubmit = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
getSchools() {
|
||||
schoolAPi.pageList().then((resp) => {
|
||||
this.schoolOptions = resp.rows
|
||||
})
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
42
src/views/zs/office/components/SearchForm.vue
Normal file
42
src/views/zs/office/components/SearchForm.vue
Normal file
@@ -0,0 +1,42 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-form ref="searchForm" :model="searchForm" inline>
|
||||
<el-form-item label="报名点名称" prop="officeName">
|
||||
<el-input v-model="searchForm.officeName" placeholder="请输入报名点名称" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label-width="0">
|
||||
<el-button type="primary" icon="el-icon-search" @click="$emit('search')">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import DMRadio from '@/components/DMRadio';
|
||||
export default {
|
||||
components: {
|
||||
DMRadio
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
searchForm: {},
|
||||
dateRange: []
|
||||
}
|
||||
|
||||
},
|
||||
created() {
|
||||
},
|
||||
methods: {
|
||||
resetQuery() {
|
||||
this.searchForm = {
|
||||
officeName: undefined
|
||||
};
|
||||
this.dateRange = []
|
||||
},
|
||||
pickDateChange() {
|
||||
this.addDateRange(this.searchForm, this.dateRange)
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
125
src/views/zs/office/index.vue
Normal file
125
src/views/zs/office/index.vue
Normal file
@@ -0,0 +1,125 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 搜索插件 -->
|
||||
<SearchForm v-show="showSearch" ref="SearchForm" @search="_getTableList" />
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAddAndUpdate(undefined)" v-hasPermi="['zs:office:add']">新增</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="_getTableList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="officeList">
|
||||
<el-table-column type="index" width="55" align="center" />
|
||||
<el-table-column label="报名点名称" align="center" prop="officeName" />
|
||||
<el-table-column label="负责人" align="center" prop="leader" />
|
||||
<el-table-column label="联系方式" align="center" prop="phone" />
|
||||
<el-table-column label="推送驾校" align="center" prop="schoolNames" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleAddAndUpdate(scope.row)" v-hasPermi="['zs:office:edit']">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['zs:office:remove']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total>0" :total="total" :page.sync="searchForm.pageNum" :limit.sync="searchForm.pageSize" @pagination="_getTableList" />
|
||||
|
||||
<!-- 添加或修改报名点对话框 -->
|
||||
<OfiiceDialogForm v-if="dialogVisible" ref="dialogForm" :dialog-visible="dialogVisible" @refreshDataList="_getTableList" />
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listOffice, getOffice, delOffice, } from "@/api/zs/office";
|
||||
import SearchForm from "./components/SearchForm.vue";
|
||||
import OfiiceDialogForm from "./components/OfiiceDialogForm.vue";
|
||||
|
||||
export default {
|
||||
name: "Office",
|
||||
components: {
|
||||
SearchForm, OfiiceDialogForm
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 报名点表格数据
|
||||
officeList: [],
|
||||
// 查询参数
|
||||
searchForm: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
},
|
||||
dialogVisible: false
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this._getTableList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询报名点列表 */
|
||||
_getTableList() {
|
||||
this.loading = true;
|
||||
const tempForm = this.$refs.SearchForm?.searchForm || {};
|
||||
const params = { ...this.searchForm, ...tempForm };
|
||||
listOffice(params).then(response => {
|
||||
this.officeList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this._getTableList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAddAndUpdate(item) {
|
||||
this.dialogVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.dialogForm.init(item);
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const officeIds = row.officeId || this.ids;
|
||||
this.$modal.confirm('是否确认删除报名点编号为"' + officeIds + '"的数据项?').then(function () {
|
||||
return delOffice(officeIds);
|
||||
}).then(() => {
|
||||
this._getTableList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => { });
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('system/office/export', {
|
||||
...this.queryParams
|
||||
}, `office_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user