添加公司单位管理
This commit is contained in:
parent
41f70aadd8
commit
63ad2d4e48
47
src/api/company.js
Normal file
47
src/api/company.js
Normal file
@ -0,0 +1,47 @@
|
||||
import request from '@/utils/request';
|
||||
|
||||
/** 获取公司列表 */
|
||||
export function getCompanyList() {
|
||||
return request({
|
||||
url: '/api/company',
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
/** 添加公司信息 */
|
||||
export function addCompany(data) {
|
||||
return request({
|
||||
url: '/api/company',
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
/** 删除公司信息 */
|
||||
export function deleteCompany(id) {
|
||||
return request({
|
||||
url: `/api/company/${id}`,
|
||||
method: 'delete'
|
||||
});
|
||||
}
|
||||
/** 根据id查询公司信心 */
|
||||
export function getCompanyById(id) {
|
||||
return request({
|
||||
url: `/api/company/${id}`,
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
/** 更新公司信息 */
|
||||
export function updateCompany(id, data) {
|
||||
return request({
|
||||
url: `/api/company/${id}`,
|
||||
method: 'put',
|
||||
data
|
||||
});
|
||||
}
|
||||
/** 分页查询公司列表 */
|
||||
export function getCompanyListPaging(params) {
|
||||
return request({
|
||||
url: `/api/company/paging`,
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
}
|
47
src/api/questionsRule.js
Normal file
47
src/api/questionsRule.js
Normal file
@ -0,0 +1,47 @@
|
||||
import request from '@/utils/request';
|
||||
|
||||
/** 获取出题规则列表 */
|
||||
export function getQuestionRuleList() {
|
||||
return request({
|
||||
url: `/api/questionsRule`,
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
/** 添加出题规则 */
|
||||
export function addQuestionRule(data) {
|
||||
return request({
|
||||
url: `/api/questionsRule`,
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
}
|
||||
/** 分页获取规则列表 */
|
||||
export function getQustionRuleListPage(params) {
|
||||
return request({
|
||||
url: `/api/questionsRule/paging`,
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
}
|
||||
/** 删除出题规则 */
|
||||
export function deleteQuestionRule(id) {
|
||||
return request({
|
||||
url: `/api/questionsRule/${id}`,
|
||||
method: 'delete'
|
||||
});
|
||||
}
|
||||
/** 查询单个出题规则 */
|
||||
export function selectedQuestionRule(id) {
|
||||
return request({
|
||||
url: `/api/questionsRule/${id}`,
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
/** 更改出题规则内容 */
|
||||
export function updateQuestionRule(id, data) {
|
||||
return request({
|
||||
url: `/api/questionsRule/${id}`,
|
||||
method: 'put',
|
||||
data: data
|
||||
});
|
||||
}
|
@ -81,5 +81,6 @@ export default {
|
||||
raceManage: 'Race manage',
|
||||
practiceManage:'Practice manage',
|
||||
bankManage: 'Bank manage',
|
||||
sceneManage:'Scene manage'
|
||||
sceneManage:'Scene manage',
|
||||
companyManage: 'Company manage'
|
||||
};
|
||||
|
@ -86,5 +86,6 @@ export default {
|
||||
recaList: '报名列表',
|
||||
bankManage: '题库列表',
|
||||
practiceManage:'实操列表',
|
||||
sceneManage:'场景列表'
|
||||
sceneManage:'场景列表',
|
||||
companyManage: '单位管理'
|
||||
};
|
||||
|
@ -147,6 +147,7 @@ const JsxtApply = () => import('@/views/jsxt/apply/index');
|
||||
const RefereeList = () => import('@/views/jsxt/refereeList/index');
|
||||
const RefereeDisplay = () => import('@/views/jsxt/refereeList/display');
|
||||
const Approval = () => import('@/views/approval/index');
|
||||
const CompanyManage = () => import('@/views/system/companyManage/index');
|
||||
|
||||
import { GenerateRouteProjectList } from '@/scripts/ProjectConfig';
|
||||
// import { getSessionStorage } from '@/utils/auth';
|
||||
@ -370,8 +371,8 @@ export const publicAsyncRoute = [
|
||||
path: '/plan/usertool',
|
||||
component: PlanMonitorEditUserTool,
|
||||
hidden: true
|
||||
},
|
||||
{ // 运行图编辑
|
||||
},
|
||||
{ // 运行图编辑
|
||||
path: '/plan/AUStool',
|
||||
component: PlanMonitorEditAUSTool,
|
||||
hidden: true
|
||||
@ -380,7 +381,7 @@ export const publicAsyncRoute = [
|
||||
path: '/plan/tool',
|
||||
component: PlanMonitorEditTool,
|
||||
hidden: true
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '/displayIscs/system',
|
||||
component: IscsSystem,
|
||||
@ -796,6 +797,15 @@ export const asyncRouter = [
|
||||
i18n: 'router.userManage'
|
||||
}
|
||||
},
|
||||
{
|
||||
// 单位管理
|
||||
path: 'companyManage',
|
||||
hidden: true,
|
||||
component: CompanyManage,
|
||||
meta: {
|
||||
i18n: 'router.companyManage'
|
||||
}
|
||||
},
|
||||
{
|
||||
// 缓存管理
|
||||
path: 'cache',
|
||||
@ -948,8 +958,8 @@ export const asyncRouter = [
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path:'design',
|
||||
redirect: '/iscs/design/edit',
|
||||
path:'design',
|
||||
redirect: '/iscs/design/edit',
|
||||
component: IscsDesign,
|
||||
meta: {
|
||||
i18n: 'router.iscsDraw',
|
||||
@ -962,8 +972,8 @@ export const asyncRouter = [
|
||||
hidden: true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
},
|
||||
{
|
||||
path: 'system',
|
||||
component: IscsSystem,
|
||||
meta: {
|
||||
|
106
src/views/system/companyManage/add.vue
Normal file
106
src/views/system/companyManage/add.vue
Normal file
@ -0,0 +1,106 @@
|
||||
<template>
|
||||
<el-dialog v-dialogDrag title="添加单位" :visible.sync="dialogVisible" width="30%" :before-close="handleClose" center :close-on-click-modal="false">
|
||||
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="doSave">{{ update? '修改' : $t('global.confirm') }}</el-button>
|
||||
<el-button @click="dialogVisible = false">{{ $t('global.cancel') }}</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { addCompany, updateCompany } from '@/api/company';
|
||||
export default {
|
||||
name: 'Add',
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
formModel: {
|
||||
address: '',
|
||||
name: '',
|
||||
phone: '',
|
||||
id: ''
|
||||
},
|
||||
update: false
|
||||
};
|
||||
},
|
||||
computed:{
|
||||
form() {
|
||||
const form = {
|
||||
labelWidth: '100px',
|
||||
items: [
|
||||
{ prop: 'name', label: '昵称', type: 'text' },
|
||||
{ prop: 'phone', label: '电话', type: 'text' },
|
||||
{ prop: 'address', label: '地址', type: 'text' }
|
||||
]
|
||||
};
|
||||
return form;
|
||||
},
|
||||
rules() {
|
||||
const crules = {
|
||||
name: [
|
||||
{ required: true, message: '请输入单位名称', trigger: 'blur' },
|
||||
{ min: 1, max: 25, message: this.$t('rules.strLength1To25'), trigger: 'blur' }
|
||||
],
|
||||
phone: [
|
||||
{ required: true, message: '请输入公司电话', trigger: 'blur' }
|
||||
],
|
||||
address:[
|
||||
{ required: true, message: '请输入公司地址', trigger: 'blur'}
|
||||
]
|
||||
};
|
||||
return crules;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
doShow(data) {
|
||||
this.dialogVisible = true;
|
||||
this.update = false;
|
||||
if (data) {
|
||||
this.update = true;
|
||||
this.formModel = {
|
||||
id: data.id,
|
||||
name: data.name,
|
||||
phone: data.phone,
|
||||
address: data.address
|
||||
};
|
||||
} else {
|
||||
this.formModel = {
|
||||
address: '',
|
||||
name: '',
|
||||
phone: '',
|
||||
id: ''
|
||||
};
|
||||
}
|
||||
},
|
||||
handleClose() {
|
||||
this.dialogVisible = false;
|
||||
},
|
||||
doSave() {
|
||||
this.$refs.dataform.validateForm(() => {
|
||||
if (this.update) {
|
||||
updateCompany(this.formModel.id, this.formModel).then(resp => {
|
||||
this.$message.success('更新单位信息成功!');
|
||||
this.dialogVisible = false;
|
||||
this.$emit('reloadTable');
|
||||
}).catch(e => {
|
||||
this.$message.error('更新单位信息失败!');
|
||||
});
|
||||
} else {
|
||||
addCompany(this.formModel).then(resp => {
|
||||
this.$message.success('添加单位信息成功!');
|
||||
this.dialogVisible = false;
|
||||
this.$emit('reloadTable');
|
||||
}).catch(e => {
|
||||
this.$message.error('添加单位信息失败!');
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
97
src/views/system/companyManage/index.vue
Normal file
97
src/views/system/companyManage/index.vue
Normal file
@ -0,0 +1,97 @@
|
||||
<template>
|
||||
<div>
|
||||
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
|
||||
<edit-company ref="editCompany" @reloadTable="reloadTable" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getCompanyListPaging, deleteCompany } from '@/api/company';
|
||||
import EditCompany from './add';
|
||||
export default {
|
||||
name: 'CompanyManage',
|
||||
components: {
|
||||
EditCompany
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
pagerConfig: {
|
||||
pageSize: 'pageSize',
|
||||
pageIndex: 'pageNum'
|
||||
},
|
||||
queryForm: {
|
||||
labelWidth: '80px',
|
||||
reset: true,
|
||||
queryObject: {
|
||||
}
|
||||
},
|
||||
queryList: {
|
||||
query: getCompanyListPaging,
|
||||
selectCheckShow: false,
|
||||
indexShow: true,
|
||||
columns: [
|
||||
{
|
||||
title: '公司名称',
|
||||
prop: 'name'
|
||||
},
|
||||
{
|
||||
title: '公司电话',
|
||||
prop: 'phone'
|
||||
},
|
||||
{
|
||||
title: '公司地址',
|
||||
prop: 'address'
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
title: this.$t('global.operate'),
|
||||
width: '250',
|
||||
buttons: [
|
||||
{
|
||||
name: this.$t('global.edit'),
|
||||
handleClick: this.handleUpdate
|
||||
},
|
||||
{
|
||||
name: '删除',
|
||||
handleClick: this.handleDeleteCompany,
|
||||
type: 'danger'
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
actions: [
|
||||
{ text: '添加', btnCode: 'employee_auto', handler: this.handlerAddCompany },
|
||||
{ text: '返回', btnCode: 'employee_auto', handler: this.handlerBack}
|
||||
]
|
||||
},
|
||||
currentModel: {}
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
handlerAddCompany() {
|
||||
this.$refs.editCompany.doShow();
|
||||
},
|
||||
handleDeleteCompany(index, row) {
|
||||
deleteCompany(row.id).then(resp => {
|
||||
this.$message.success('删除单位信息成功!');
|
||||
this.reloadTable();
|
||||
}).catch(() => {
|
||||
this.$message.error('删除单位信息失败!');
|
||||
});
|
||||
},
|
||||
handleUpdate(index, row) {
|
||||
this.$refs.editCompany.doShow(row);
|
||||
},
|
||||
reloadTable() {
|
||||
this.queryList.reload();
|
||||
},
|
||||
handlerBack() {
|
||||
this.$router.go(-1);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
@ -90,7 +90,8 @@ export default {
|
||||
}
|
||||
],
|
||||
actions: [
|
||||
{ text: '创建本地用户', btnCode: 'employee_auto', handler: this.createLocalUsers }
|
||||
{ text: '创建本地用户', btnCode: 'employee_auto', handler: this.createLocalUsers },
|
||||
{ text: '单位管理', btnCode: 'company_manage', handler: this.companyManage }
|
||||
]
|
||||
},
|
||||
currentModel: {}
|
||||
@ -132,6 +133,9 @@ export default {
|
||||
},
|
||||
createLocalUsers() {
|
||||
this.$refs.createUser.doShow();
|
||||
},
|
||||
companyManage() {
|
||||
this.$router.push({ path: `/system/companyManage`});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user