Commit 6aad0cad authored by 陈浩玮's avatar 陈浩玮

调整

parent 4721fe3b
......@@ -48,7 +48,6 @@ export function getUnitInfoApi(id) {
return getReq(`/ranger/inspection/api/v1/units/${id}`);
}
<<<<<<< src/api/ranger.js
export function getItemsInfoApi(id) {
return getReq(`/ranger/inspection/api/v1/items/${id}`);
}
......
<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>
<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>
<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 { 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>
......@@ -81,15 +81,19 @@ const hasAuthorityRoutes = [
component: () => import('@/pages/ranger/basic/unit'),
},
{
path: 'item',
name: '项目配置',
component: () => import('@/pages/ranger/basic/item'),
},{
},
{
path: 'line',
name: '线路配置',
component: () => import('@/pages/ranger/basic/line'),
},
{
path: 'exemption',
name: '免检配置',
component: () => import('@/pages/ranger/basic/exemption'),
},
],
},
......
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