Commit 50ce56ec authored by 陈浩玮's avatar 陈浩玮

Merge branch 'feature/shuiluo' into 'master'

feat: 巡检管理,地区配置完成

See merge request product/kim3-web-vue/starter-web-vue!41
parents 2468f14a 9bfc5762
import { getReq, postReq } from '@/utils/requestUtil';
import { getReq, postReq, putReq } from '@/utils/requestUtil';
export function getXunJianDownloadUrlApi(idList) {
return getReq('/ranger/inspection/api/v1/jobs/export', { jobIdList: idList.join(',') });
......@@ -7,3 +7,15 @@ export function getXunJianDownloadUrlApi(idList) {
export function addXunJianTaskApi(data) {
return postReq('/ranger/inspection/api/v1/jobs/temporary', data);
}
export function getRegionInfoApi(id) {
return getReq(`/ranger/inspection/api/v1/region/${id}`);
}
export function addRegionApi(data) {
return postReq('/ranger/inspection/api/v1/region', data);
}
export function editRegionApi(data) {
return putReq(`ranger/inspection/api/v1/region`, data);
}
......@@ -14,9 +14,10 @@ export default {
</script>
<style module lang="less">
.container:last-child {
min-width: 250px;
.container {
max-width: 400px;
}
.label {
color: rgba(0, 0, 0, 0.85);
width: 6em;
......
......@@ -163,7 +163,6 @@ export default {
methods: {
async getData() {
this.loading = true;
console.log(this.queryForm);
try {
this.noPage ? await this.getDataNoPage() : await this.getDataWithPage();
} catch (error) {
......@@ -215,7 +214,6 @@ export default {
addBtnClick() {
const { click } = typeof this.addBtn === 'object' ? this.addBtn : {};
click && click();
this.type = 'add';
this.visible = true;
},
},
......
<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="regionName">
<a-input v-model="form.regionName" :disabled="isView" />
</a-form-model-item>
<a-form-model-item label="所属组织" prop="organizationId">
<UrlSelect
url="/api/v1/users/organizations"
labelFiled="orgName"
valueFiled="orgId"
v-model="form.organizationId"
: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 { addRegionApi, editRegionApi, getRegionInfoApi } from '@/api';
export default {
components: { Wraper, UrlSelect },
props: { hidden: Function, row: Object, type: String, refresh: Function },
data: () => ({
form: {},
rules: {
regionName: [{ required: true }],
organizationId: [{ 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 getRegionInfoApi(this.row.regionId);
}
},
methods: {
async submit() {
await this.$refs.form.validate();
console.log(this.isAdd);
if (this.isAdd) return addRegionApi(this.form);
if (this.isEdit) return editRegionApi(this.form);
},
},
};
</script>
<template>
<h1>template</h1>
<Table
url="/ranger/inspection/api/v1/region/page"
rowKey="regionId"
addBtn
:buttons="buttons"
ref="table"
>
<template #search="{ query }">
<MoreItem label="所属组织">
<UrlSelect
v-model="query.organizationId"
url="/api/v1/users/organizations"
labelFiled="orgName"
valueFiled="orgId"
/>
</MoreItem>
<MoreItem label="地区名称">
<a-input v-model="query.regionName" />
</MoreItem>
</template>
<template #drawer="drawer">
<AddAndEdit v-bind="drawer" />
</template>
<a-table-column title="地区名称" data-index="regionName" />
<a-table-column title="所属组织" data-index="organizationName" />
<a-table-column title="备注" data-index="remark" />
<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';
export default {
components: { Table, UrlSelect, MoreItem, AddAndEdit },
data() {
return {
buttons: [
{ label: '编辑', click: this.edit },
{ label: '详情', click: this.view },
{
type: 'confirm',
url: (row) => `/ranger/inspection/api/v1/region/${row.regionId}`,
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' });
},
},
};
</script>
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