Commit c1f5f17c authored by 陈浩玮's avatar 陈浩玮

Merge branch 'master' into 'feature/chw'

# Conflicts:
#   src/router/config.js
parents 6aad0cad 4ee60ff3
......@@ -70,3 +70,22 @@ export function getExemptionApi(id) {
export function updateExemptionApi(data) {
return putReq(`/ranger/inspection/api/v1/exemptions`, data);
}
export function addMajorApi(data) {
return postReq(`/ranger/inspection/api/v1/specialities`, data);
}
export function updateMajorApi(data) {
return putReq('/ranger/inspection/api/v1/specialities', data);
}
export function getMajorInfoApi(id) {
return getReq(`/ranger/inspection/api/v1/specialities/${id}`);
}
export function getOrganizationUserApi(id) {
return getReq(`/api/v1/users/organizations/${id}`);
}
export function addSpecialitiesStaffsApi(data) {
return postReq(`/ranger/inspection/api/v1/specialities/staffs`, data);
}
......@@ -12,10 +12,11 @@
@change="onChange"
/>
</template>
<!-- v-on="$listeners" -->
<script>
import api from '@/api/organization';
import { arrayToTree } from '@/utils';
export default {
model: {
prop: 'value',
......
<template>
<Wraper :hidden="hidden" :onOk="submit" :refresh="refresh" :noFooter="isView">
<a-form-model layout="vertical" :model="form" :rules="rules" ref="form">
<a-form-model-item label="专业名称" prop="specialityName">
<a-input v-model="form.specialityName" :disabled="isView" />
</a-form-model-item>
<a-form-model-item label="所属地区" prop="regionId">
<UrlSelect
url="/ranger/inspection/api/v1/region/list"
v-model="form.regionId"
labelFiled="regionName"
valueFiled="regionId"
:disabled="isView"
/>
</a-form-model-item>
<a-form-model-item label="备注" prop="remark">
<a-textarea placeholder="Basic usage" :rows="4" v-model="form.remark" :disabled="isView" />
</a-form-model-item>
</a-form-model>
</Wraper>
</template>
<script>
import Wraper from '@/components/table/wraper.vue';
import UrlSelect from '@/components/MySelect/url_select.vue';
import { addMajorApi, updateMajorApi, getMajorInfoApi } from '@/api';
export default {
components: { Wraper, UrlSelect },
props: { hidden: Function, row: Object, type: String, refresh: Function },
data: () => ({
form: {},
rules: {
specialityName: [{ required: true }],
regionId: [{ required: true }],
},
}),
computed: {
isView() {
return this.type === 'view';
},
isEdit() {
return this.type === 'edit';
},
isAdd() {
return this.type === null;
},
},
async mounted() {
if (!this.isAdd) {
this.form = await getMajorInfoApi(this.row.specialityId);
}
},
methods: {
async submit() {
await this.$refs.form.validate();
if (this.isAdd) return addMajorApi(this.form);
if (this.isEdit) return updateMajorApi(this.form);
},
},
};
</script>
<template>
<Wraper :hidden="hidden" :onOk="submit" :refresh="refresh">
<OrganizationTree v-model="value" style="margin-bottom: 10px" @change="organizationChange" />
<a-table
:data-source="data"
:row-selection="rowSelection"
:pagination="false"
rowKey="userId"
:loading="loading"
>
<a-table-column title="姓名" data-index="userName" />
</a-table>
</Wraper>
</template>
<script>
import Wraper from '@/components/table/wraper.vue';
import OrganizationTree from '@/pages/oceanus/equipment/Left/OrganizationTree.vue';
import { getOrganizationUserApi, addSpecialitiesStaffsApi } from '@/api';
export default {
components: { Wraper, OrganizationTree },
props: {
hidden: Function,
row: Object,
specialityId: Number,
refresh: Function,
},
data() {
return {
value: undefined,
loading: false,
data: [],
form: {
specialityId: this.specialityId,
staffOrgCommands: [],
},
selectedRowKeys: [],
};
},
computed: {
rowSelection() {
const { selectedRowKeys, onSelectChange } = this;
return {
selectedRowKeys,
onChange: onSelectChange,
};
},
},
methods: {
submit() {
this.form.staffOrgCommands = this.selectedRowKeys.map((staffId) => ({
orgId: this.value,
staffId,
}));
return addSpecialitiesStaffsApi(this.form);
},
onSelectChange(selectedRowKeys) {
this.selectedRowKeys = selectedRowKeys;
},
async organizationChange(val) {
this.loading = true;
this.data = await this.getTableData(val);
this.loading = false;
},
getTableData(id) {
return getOrganizationUserApi(id);
},
},
};
</script>
import Index from './index.vue';
export default Index;
<template>
<Table
url="/ranger/inspection/api/v1/specialities"
rowKey="specialityId"
addBtn
:buttons="buttons"
ref="table"
>
<template #search="{ query }">
<MoreItem label="地区">
<UrlSelect
url="/ranger/inspection/api/v1/region/list"
v-model="query.regionId"
labelFiled="regionName"
valueFiled="regionId"
/>
</MoreItem>
<MoreItem label="专业名称">
<a-input v-model="query.specialityName" />
</MoreItem>
</template>
<template #drawer="drawer">
<Member v-if="drawer.type === 'member'" v-bind="drawer" />
<AddAndEdit v-bind="drawer" v-else />
</template>
<a-table-column title="专业名称" data-index="specialityName" />
<a-table-column title="所属地区" data-index="regionName" />
<a-table-column title="修改人" data-index="editorName" />
<a-table-column title="修改时间" data-index="editTime" />
</Table>
</template>
<script>
import Table from '@/components/table/table.vue';
import UrlSelect from '@/components/MySelect/url_select.vue';
import MoreItem from '@/components/table/more_item.vue';
import AddAndEdit from './add_edit.vue';
import Member from './member.vue';
export default {
components: { Table, UrlSelect, MoreItem, AddAndEdit, Member },
data() {
return {
buttons: [
{ label: '编辑', click: this.edit },
{ label: '详情', click: this.view },
{ label: '人员', click: this.showMember },
{
type: 'confirm',
url: (row) => `/ranger/inspection/api/v1/specialities/${row.specialityId}`,
after: this.refresh,
},
],
};
},
methods: {
refresh() {
this.$refs.table.getData();
},
edit(row) {
this.$refs.table.show({ row, title: '编辑', type: 'edit' });
},
view(row) {
this.$refs.table.show({ row, title: '详情', type: 'view' });
},
showMember(row) {
this.$refs.table.show({ row, title: '人员', type: 'member' });
},
},
};
</script>
<template>
<Wraper :hidden="hidden" noFooter>
<Table
:url="tableUrl"
rowKey="staffId"
noPadding
:addBtn="addBtn"
:buttons="buttons"
:width="400"
ref="table"
>
<template #drawer="drawer">
<AddMember v-bind="drawer" :specialityId="row.specialityId" />
</template>
<a-table-column title="部门" data-index="orgName" />
<a-table-column title="用户姓名" data-index="staffName" />
</Table>
</Wraper>
</template>
<script>
import Wraper from '@/components/table/wraper.vue';
import Table from '@/components/table/table.vue';
import AddMember from './add_member.vue';
export default {
components: { Wraper, Table, AddMember },
props: {
hidden: Function,
row: Object,
},
data() {
return {
addBtn: {
text: '添加',
title: '添加',
},
buttons: [
{
type: 'confirm',
url: (row) => ({
url: `/ranger/inspection/api/v1/specialities/staffs`,
method: 'del',
data: { staffBindIds: [row.staffBindId] },
}),
after: this.refreshTable,
},
],
};
},
computed: {
tableUrl() {
return `/ranger/inspection/api/v1/specialities/staffs?specialityId=${this.row.specialityId}`;
},
},
methods: {
refreshTable() {
this.$refs['table'].getData();
},
},
};
</script>
......@@ -81,6 +81,13 @@ const hasAuthorityRoutes = [
component: () => import('@/pages/ranger/basic/unit'),
},
{
path: 'major',
name: '专业配置',
component: () => import('@/pages/ranger/basic/major'),
},
{
path: 'item',
name: '项目配置',
component: () => import('@/pages/ranger/basic/item'),
......
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