Commit 35edb95a authored by 陈浩玮's avatar 陈浩玮

Merge branch 'feature/chw' into 'master'

地点

See merge request product/kim3-web-vue/starter-web-vue!45
parents 809b574e 905a5068
...@@ -3,7 +3,7 @@ import Lang from '@/utils/langUtils'; ...@@ -3,7 +3,7 @@ import Lang from '@/utils/langUtils';
export * from './menu'; export * from './menu';
export * from './system'; export * from './system';
export * from './task'; export * from './task';
export * from './xunjian'; export * from './ranger';
export function getUserDetailInfoApi() { export function getUserDetailInfoApi() {
return request('/api/v1/detail', METHOD.GET); return request('/api/v1/detail', METHOD.GET);
......
...@@ -20,6 +20,22 @@ export function editRegionApi(data) { ...@@ -20,6 +20,22 @@ export function editRegionApi(data) {
return putReq(`ranger/inspection/api/v1/region`, data); return putReq(`ranger/inspection/api/v1/region`, data);
} }
export function getPlaceInfoApi(id) {
return getReq(`/ranger/inspection/api/v1/place/${id}`);
}
export function addPlaceApi(data) {
return postReq('/ranger/inspection/api/v1/place', data);
}
export function editPlaceApi(data) {
return putReq('/ranger/inspection/api/v1/place', data);
}
export function getExemptionsListApi(data) {
return getReq(`/ranger/inspection/api/v1/exemptions/valid`, data);
}
export function addUnitApi(data) { export function addUnitApi(data) {
return postReq('/ranger/inspection/api/v1/units', data); return postReq('/ranger/inspection/api/v1/units', data);
} }
......
...@@ -90,7 +90,7 @@ export default { ...@@ -90,7 +90,7 @@ export default {
noPage: Boolean, noPage: Boolean,
formatData: Function, formatData: Function,
rowKey: [String, Function], rowKey: [String, Function],
selected: Array, selected: Object,
drawerWidth: { drawerWidth: {
type: Number, type: Number,
default: 600, default: 600,
...@@ -154,7 +154,7 @@ export default { ...@@ -154,7 +154,7 @@ export default {
rowSelection() { rowSelection() {
return { return {
onChange: (selectedRowKeys, selectedRows) => { onChange: (selectedRowKeys, selectedRows) => {
this.$emit('update:selected', [selectedRowKeys, selectedRows]); this.$emit('update:selected', { keys: selectedRowKeys, rows: selectedRows });
}, },
}; };
}, },
......
<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="placeName">
<a-input v-model="form.placeName" :disabled="isView" />
</a-form-model-item>
<a-form-model-item label="所属组织" prop="regionId">
<UrlSelect
v-model="form.regionId"
url="/ranger/inspection/api/v1/region/list"
labelFiled="regionName"
valueFiled="regionId"
:disabled="isView"
/>
</a-form-model-item>
<a-form-model-item label="二维码" prop="qrCode">
<a-input v-model="form.qrCode" :disabled="isView" />
</a-form-model-item>
<a-form-model-item label="二维码" prop="electronicTag">
<a-input v-model="form.electronicTag" :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 { addPlaceApi, editPlaceApi, getPlaceInfoApi } from '@/api';
export default {
components: { Wraper, UrlSelect },
props: { hidden: Function, row: Object, type: String, refresh: Function },
data: () => ({
form: {},
rules: {
placeName: [{ required: true }],
regionId: [{ required: true }],
qrCode: [{ required: true }],
electronicTag: [{ 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 getPlaceInfoApi(this.row.placeId);
}
},
methods: {
async submit() {
await this.$refs.form.validate();
if (this.isAdd) return addPlaceApi(this.form);
if (this.isEdit) return editPlaceApi(this.form);
},
},
};
</script>
<template>
<Wraper :hidden="hidden" noFooter>
<a-list :data-source="data" :grid="{ gutter: 16, xs: 1, sm: 1, md: 1, lg: 1, xl: 1, xxl: 1 }">
<a-list-item slot="renderItem" slot-scope="item">
<a-card>
<template #title>
<a-tag v-if="item.exemptionState === 'EFFECTIVE'" color="#87d068"> 有效 </a-tag>
<a-tag v-else color="#f50"> 无效 </a-tag>
{{ `${item.startTime} 至 ${item.endTime}` }}
</template>
{{ item.exemptionReason }}
</a-card>
</a-list-item>
</a-list>
</Wraper>
</template>
<script>
import Wraper from '@/components/table/wraper.vue';
import { getExemptionsListApi } from '@/api';
export default {
components: { Wraper },
props: { hidden: Function, row: Object },
data() {
return {
data: [],
loading: false,
};
},
mounted() {
this.getList();
},
methods: {
async getList() {
const { placeId, regionId } = this.row;
this.loading = true;
const data = await getExemptionsListApi({ placeId, regionId, exemptionType: 'PLACE' });
this.data = data;
this.loading = false;
},
},
};
</script>
<template> <template>
<div>place</div> <Table
url="/ranger/inspection/api/v1/place/page"
rowKey="placeId"
:selected.sync="selected"
addBtn
:buttons="buttons"
ref="table"
>
<template #search="{ query }">
<MoreItem label="地区">
<UrlSelect
v-model="query.regionId"
url="/ranger/inspection/api/v1/region/list"
labelFiled="regionName"
valueFiled="regionId"
placeholder="选择地区"
/>
</MoreItem>
<MoreItem label="搜索">
<a-input v-model="query.inputValue" placeholder="请输入地点名称/二维码/电子标签" />
</MoreItem>
</template>
<template #operation>
<a-button @click="download">导出</a-button>
</template>
<template #drawer="drawer">
<AddAndEdit v-if="drawer.type !== 'exempt'" v-bind="drawer" />
<Exempt v-else v-bind="drawer" />
</template>
<a-table-column title="地点名称" data-index="placeName" />
<a-table-column title="所属地区" data-index="regionName" />
<a-table-column title="二维码" data-index="qrCode" />
<a-table-column title="电子标签" data-index="electronicTag" />
<a-table-column title="修改人" data-index="editorName" />
<a-table-column title="修改时间" data-index="editTime" />
</Table>
</template> </template>
<script> <script>
export default {}; import Table from '@/components/table/table.vue';
import UrlSelect from '@/components/MySelect/url_select.vue';
import MoreItem from '@/components/table/more_item.vue';
import { downloadFileByUrl } from '@/utils';
import AddAndEdit from './add_edit.vue';
import Exempt from './exempt.vue';
export default {
components: { Table, UrlSelect, MoreItem, AddAndEdit, Exempt },
data() {
return {
buttons: [
{ label: '编辑', click: this.edit },
{ label: '详情', click: this.view },
{ label: '免检', click: this.exempt },
{
type: 'confirm',
url: (row) => `/ranger/inspection/api/v1/place/${row.placeId}`,
after: this.refresh,
},
],
selected: {},
};
},
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' });
},
exempt(row) {
this.$refs.table.show({ row, title: '免检', type: 'exempt' });
},
download() {
if (!this.selected?.keys?.length) return this.$message.error('请选择需要导出的数据');
downloadFileByUrl(
`/ranger/inspection/api/v1/place/exportQrCodeData?placeIdList=${this.selected.keys.join(
',',
)}`,
);
},
},
};
</script> </script>
...@@ -187,13 +187,13 @@ export default { ...@@ -187,13 +187,13 @@ export default {
after: this.refresh, after: this.refresh,
}, },
], ],
selected: [], selected: {},
}; };
}, },
methods: { methods: {
async download() { async download() {
if (!this.selected.length) return this.$message.error('请选择需要导出的数据'); if (!this.selected?.keys?.length) return this.$message.error('请选择需要导出的数据');
const url = await getXunJianDownloadUrlApi(this.selected[0]); const url = await getXunJianDownloadUrlApi(this.selected.keys);
downloadFileByUrl(`${this.$fileUrl}${url}`); downloadFileByUrl(`${this.$fileUrl}${url}`);
}, },
refresh() { refresh() {
......
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