Commit 5ca7c78a by liuguorong93

警用工作犬 列表+导入+导出

parent aeac21cb
{
"code":200,
"data":{
"rows":[
{
"ids":"666669",
"label":"一级",
"codeType":"CODE_GZQDJ",
"text":"一级",
"pId":null,
"id":"1",
"isParent":false,
"children":[]
},
{
"ids":"666670",
"label":"二级",
"codeType":"CODE_GZQDJ",
"text":"二级",
"pId":null,
"id":"2",
"isParent":false,
"children":[]
},
{
"ids":"666671",
"label":"三级",
"codeType":"CODE_GZQDJ",
"text":"三级",
"pId":null,
"id":"3",
"isParent":false,
"children":[]
},
{
"ids":"666672",
"label":"其他",
"codeType":"CODE_GZQDJ",
"text":"其他",
"pId":null,
"id":"4",
"isParent":false,
"children":[]
}
]
},
"success":true,
"message":"成功"
}
\ No newline at end of file
......@@ -8,3 +8,7 @@ export const importArtisanApi = params =>
// 技术单位(批量导入)
export const importTeUnitApi = params =>
postform(`${baseUrl}/technicalUnits/excelsave`, params)
// 警用工作犬(批量导入)
export const importPoDogJobApi = params =>
postform(`${baseUrl}/work/excelsave`, params)
import { post, postform, get, postJson } from '@/utils/http.js'
export let baseUrl = '/api'
// 获取警用工作犬信息管理列表接口
export const getPoDogJobList = params =>
postJson(`${baseUrl}/work/dogQuery`, params)
// 工作犬信息(导出url)
export const exportPoDogJobUrl = `${baseUrl}/work/export`
......@@ -135,12 +135,152 @@
重置
</el-button>
</div>
<div class="hengLine"></div>
<div class="resultClass spaceBetween">
<div class="leftC">
<div
class="titles"
style="display: inline-block;width: 72px;"
>查询结果</div>
<span class="infoClass">共有 <span class="numColor">{{ total }}</span> 条查询结果,共 <span class="numColor">{{ Math.ceil(total / limit) }}</span> 页;</span>
</div>
<div class="rightC">
<el-button
icon="el-icon-plus"
size="small"
@click="addData"
>新增</el-button>
<el-button
size="small"
icon="el-icon-download"
@click="importData"
>批量导入</el-button>
<el-button
size="small"
icon="el-icon-upload2"
style="margin-right: 0 !important;"
@click="exportData"
>导出</el-button>
</div>
</div>
<el-table
v-loading="tableLoading"
element-loading-text="拼命加载中"
ref="tableRef"
:data="tableData"
tooltip-effect="dark"
max-height="600"
width="100%"
size="small"
class="elTableClass"
>
<el-table-column
align="center"
label="操作"
width="100"
>
<template slot-scope="scope">
<div>
<el-button
type="text"
size="small"
@click="editData(scope.row)"
>
补采
</el-button>
<el-button
type="text"
size="small"
@click="deleteData(scope.row)"
>删除
</el-button>
</div>
</template>
</el-table-column>
<el-table-column
prop="name"
label="警犬名称"
align="center"
show-overflow-tooltip
></el-table-column>
<el-table-column
prop="chipCode"
label="芯片号"
align="center"
show-overflow-tooltip
></el-table-column>
<el-table-column
label="出生日期"
align="center"
show-overflow-tooltip
>
<template slot-scope="scope">
<span>{{ scope.row.birthDate }}</span>
</template>
</el-table-column>
<el-table-column
label="归属单位"
align="center"
show-overflow-tooltip
>
<template slot-scope="scope">
<span>{{ scope.row.trainingUnit }}</span>
</template>
</el-table-column>
<el-table-column
label="工作犬等级"
align="center"
show-overflow-tooltip
>
<template slot-scope="scope">
<span>{{ scope.row.trainingLevelId }}</span>
</template>
</el-table-column>
<el-table-column
label="专业方向"
align="center"
show-overflow-tooltip
>
<template slot-scope="scope">
<span>{{ scope.row.workingDogClassificationId }}</span>
</template>
</el-table-column>
</el-table>
<div class="pageClass">
<el-pagination
class="elPage"
background
@current-change="handleCurrentChange"
:current-page.sync="currentPage"
:page-size="limit"
layout="prev, pager, next"
:total="total"
>
</el-pagination>
</div>
</div>
<!-- 批量导入 -->
<importFilePublic
v-if="showImportBox"
:importInfo="importInfo"
@close="showImportBox = false"
@refreshLists="getLists(1)"
>
</importFilePublic>
</div>
</template>
<script>
import {
getPoDogJobList,
exportPoDogJobUrl,
} from "@/api/menuDataApi/poDogJobManageApi.js";
import { getJsonDataApi } from "@/utils/getJsonData.js";
import { getCodeName, handleDownFile } from "@/utils/mk.js";
import LazySelectTreeDialog from "@c/lazy_treeCode_components.vue";
import importFilePublic from "@c/importFilePublic.vue";
......@@ -189,16 +329,18 @@ export default {
showImportBox: false,
importInfo: {
fileCName: "技术人员导入模版.xlsx",
fileLocalUrl: "files/jsrydrmb.xlsx",
apiName: "importArtisanApi",
fileCName: "警用工作犬导入模版.xlsx",
fileLocalUrl: "files/jygzqdrmb.xlsx",
apiName: "importPoDogJobApi",
},
};
},
async mounted() {
this.zyfxOptions = await getJsonDataApi("CODE_WORKINGDOGCLASSIFICA");
this.gzqdjOptions = await getJsonDataApi("CODE_WORKINGDOGCLASSIFICA");
this.gzqdjOptions = await getJsonDataApi("CODE_GZQDJ");
this.jyjqOptions = await getJsonDataApi("CODE_SPECIES");
this.getLists(1);
},
methods: {
resetForm() {
......@@ -213,7 +355,97 @@ export default {
this.getLists(1);
},
getLists() {},
getLists(current) {
this.tableLoading = true;
this.currentPage = current;
let params = {
pageNow: current,
pageSize: this.limit,
chipCode: this.formData.chipCode,
name: this.formData.name,
birthDate: this.formData.birthDate,
trainingUnit: this.formData.trainingUnit,
workingDogClassificationId: this.formData.workingDogClassificationId,
trainingLevelId: this.formData.trainingLevelId,
speciesId: this.formData.speciesId,
jsrymc: this.formData.jsrymc,
};
getPoDogJobList(params)
.then((res) => {
if (
res.code === 200 &&
res.success &&
res.data &&
res.data.data &&
res.data.data.records &&
res.data.data.records.length
) {
let datas = res.data.data.records;
// console.log(datas);
// datas.forEach((item) => {
// item.jwjsxlForName = getCodeName(item.jwjsxl, this.jwjsxlOptions);
// });
this.tableData = datas;
this.total = res.data.data.total;
this.tableLoading = false;
return;
}
this.tableLoading = false;
this.tableData = [];
this.total = 0;
})
.catch((e) => {
console.log(e);
this.tableLoading = false;
this.tableData = [];
this.total = 0;
});
},
handleCurrentChange(current) {
this.currentPage = current;
this.getLists(current);
},
addData() {},
editData() {},
deleteData() {},
importData() {
this.showImportBox = true;
},
exportData() {
this.tableLoading = true;
let params = {
pageNow: 1,
pageSize: 99999,
chipCode: this.formData.chipCode,
name: this.formData.name,
birthDate: this.formData.birthDate,
trainingUnit: this.formData.trainingUnit,
workingDogClassificationId: this.formData.workingDogClassificationId,
trainingLevelId: this.formData.trainingLevelId,
speciesId: this.formData.speciesId,
jsrymc: this.formData.jsrymc,
};
axios
.post(exportPoDogJobUrl, JSON.stringify(params), {
headers: { "Content-Type": "application/json" },
responseType: "blob",
})
.then((res) => {
if (!res.data) {
this.tableLoading = false;
return;
}
let obj = {
data: res.data,
filename: "警用工作犬信息.xlsx",
};
handleDownFile(obj);
this.tableLoading = false;
});
},
},
watch: {},
};
......
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