Commit 6a10ba22 by liuguorong93

警犬复训列表 样式 & 接口对接

parent b6fd3554
{
"code":200,
"data":{
"rows":[
{
"ids":"12736",
"label":"1次",
"codeType":"CODE_TRAINCOUNT",
"text":"1次",
"pId":null,
"id":"1",
"isParent":false,
"children":[]
},
{
"ids":"12737",
"label":"2次",
"codeType":"CODE_TRAINCOUNT",
"text":"2次",
"pId":null,
"id":"2",
"isParent":false,
"children":[]
},
{
"ids":"12738",
"label":"3次",
"codeType":"CODE_TRAINCOUNT",
"text":"3次",
"pId":null,
"id":"3",
"isParent":false,
"children":[]
},
{
"ids":"12739",
"label":"4次",
"codeType":"CODE_TRAINCOUNT",
"text":"4次",
"pId":null,
"id":"4",
"isParent":false,
"children":[]
},
{
"ids":"12740",
"label":"5次",
"codeType":"CODE_TRAINCOUNT",
"text":"5次",
"pId":null,
"id":"5",
"isParent":false,
"children":[]
},
{
"ids":"12741",
"label":"6次",
"codeType":"CODE_TRAINCOUNT",
"text":"6次",
"pId":null,
"id":"6",
"isParent":false,
"children":[]
},
{
"ids":"12742",
"label":"7次",
"codeType":"CODE_TRAINCOUNT",
"text":"7次",
"pId":null,
"id":"7",
"isParent":false,
"children":[]
},
{
"ids":"12743",
"label":"8次",
"codeType":"CODE_TRAINCOUNT",
"text":"8次",
"pId":null,
"id":"8",
"isParent":false,
"children":[]
},
{
"ids":"12744",
"label":"9次",
"codeType":"CODE_TRAINCOUNT",
"text":"9次",
"pId":null,
"id":"9",
"isParent":false,
"children":[]
},
{
"ids":"12745",
"label":"10次",
"codeType":"CODE_TRAINCOUNT",
"text":"10次",
"pId":null,
"id":"10",
"isParent":false,
"children":[]
}
]
},
"success":true,
"message":"成功"
}
\ No newline at end of file
import { post, postform, get, postJson } from '@/utils/http.js'
export let baseUrl = '/api'
// 获取警犬复训列表接口
export const getJobDogList = params =>
postJson(`${baseUrl}/refreshment/dogQuery`, params)
......@@ -233,3 +233,73 @@ export const getJygzqglDefaultColumns = () => {
]
return arr
}
// 工作犬复训管理(全部列)
export const getGzqfxglAllColumns = () => {
let arr = [
{
label: "警犬名称",
prop: "name",
},
{
label: "芯片号",
prop: "chipCode",
},
{
label: "工作犬等级",
prop: "trainingLevelIdForName",
},
{
label: "培训次数",
prop: "trainCountForName",
},
{
label: "归属单位",
prop: "trainingUnit",
},
{
label: "考核单位",
prop: "checkUnit",
},
{
label: "培训日期",
prop: "pxrq",
},
{
label: "考核人员",
prop: "checkStaff",
},
{
label: "培训科目",
prop: "trainSubjectForName",
},
{
label: "备注",
prop: "remark",
},
]
return arr
}
// 工作犬复训管理(默认列)
export const getGzqfxglDefaultColumns = () => {
let arr = [
{
label: "警犬名称",
prop: "name",
},
{
label: "芯片号",
prop: "chipCode",
},
{
label: "培训次数",
prop: "trainCountForName",
},
{
label: "归属单位",
prop: "trainingUnit",
},
]
return arr
}
......@@ -5,7 +5,6 @@
class="titles"
style="width: 72px;"
>查询条件</div>
{{formData}}
<el-form
:model="formData"
ref="formDataRef"
......@@ -46,7 +45,7 @@
class="elItemClass elDateClass"
>
<el-date-picker
v-model="formData.peixunDate"
v-model="formData.pxrq"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择培训日期"
......@@ -102,11 +101,11 @@
>新增</el-button>
<el-button
size="small"
icon="el-icon-download"
icon="el-icon-plus"
type="warning"
class="btnStylePub btnStyle2"
@click="importData"
>批量导入</el-button>
@click="batchAdd"
>批量新增</el-button>
<el-button
size="small"
icon="el-icon-upload2"
......@@ -152,15 +151,28 @@
</div>
</template>
</el-table-column>
<el-table-column
:label="'项目'"
:align="'left'"
show-overflow-tooltip
>
<template slot-scope="scope">
{{ scope.row.xm }}
</template>
</el-table-column>
<template v-if="colPropArr && colPropArr.length">
<el-table-column
:label="item.label"
:align="setAlign(item.prop)"
show-overflow-tooltip
v-for="item in colPropArr"
:key="item.prop"
>
<template slot-scope="scope">
<span v-if="item.prop === 'name'">{{ scope.row.name }}</span>
<span v-if="item.prop === 'chipCode'">{{ scope.row.chipCode }}</span>
<span v-if="item.prop === 'trainingLevelIdForName'">{{ scope.row.trainingLevelIdForName }}</span>
<span v-if="item.prop === 'trainCountForName'">{{ scope.row.trainCountForName }}</span>
<span v-if="item.prop === 'trainingUnit'">{{ scope.row.trainingUnit }}</span>
<span v-if="item.prop === 'checkUnit'">{{ scope.row.checkUnit }}</span>
<span v-if="item.prop === 'pxrq'">{{ scope.row.pxrq }}</span>
<span v-if="item.prop === 'checkStaff'">{{ scope.row.checkStaff }}</span>
<span v-if="item.prop === 'trainSubjectForName'">{{ scope.row.trainSubjectForName }}</span>
<span v-if="item.prop === 'remark'">{{ scope.row.remark }}</span>
</template>
</el-table-column>
</template>
</el-table>
<div class="pageClass">
......@@ -176,16 +188,33 @@
</el-pagination>
</div>
</div>
<!-- 表头配置 -->
<headerSettings
v-if="showHeaderSettingBox"
:headerSettInfo="headerSettInfo"
@getNewColArr="getNewColArr"
@close="showHeaderSettingBox = false"
></headerSettings>
</div>
</template>
<script>
import { getJobDogList } from "@/api/menuDataApi/jobDogManageApi.js";
import { getJsonDataApi } from "@/utils/getJsonData.js";
import { getCodeName, getColumns } from "@/utils/mk.js";
import {
getGzqfxglAllColumns,
getGzqfxglDefaultColumns,
} from "@/utils/tableHeaderParams.js";
import LazySelectTreeDialog from "@c/lazy_treeCode_components.vue";
import headerSettings from "@c/headerSettings.vue";
export default {
name: "jobDogManage",
components: {
LazySelectTreeDialog,
headerSettings,
},
data() {
return {
......@@ -193,16 +222,11 @@ export default {
chipCode: "",
name: "",
trainingUnit: "",
peixunDate: "",
pxrq: "",
},
tableLoading: false,
tableData: [
{
id: 1,
xm: "haha",
},
],
tableData: [],
currentPage: 1,
limit: 10,
......@@ -221,30 +245,124 @@ export default {
codeOptions: [],
},
showImportBox: false,
gzqdjOptions: [],
trainCountOption: [],
showHeaderSettingBox: false,
headerSettInfo: {
menuId: "gzqfxManage",
allColumns: getGzqfxglAllColumns(),
defaultColumns: getGzqfxglDefaultColumns(),
},
colPropArr: [],
};
},
mounted() {},
async activated() {
this.gzqdjOptions = await getJsonDataApi("CODE_GZQDJ");
this.trainCountOption = await getJsonDataApi("CODE_TRAINCOUNT");
let options = await getColumns(this.headerSettInfo.menuId);
if (options?.length) {
this.colPropArr = options;
} else {
this.colPropArr = this.headerSettInfo.defaultColumns;
}
this.getLists(this.currentPage);
},
methods: {
setAlign(val) {
let rightArr = ["trainCountForName"];
if (rightArr.includes(val)) {
return "right";
} else {
return "left";
}
},
resetForm() {
this.formData.chipCode = "";
this.formData.name = "";
this.formData.peixunDate = "";
this.formData.pxrq = "";
this.formData.trainingUnit = "";
this.getLists(1);
},
getLists(current) {},
getLists(current) {
this.tableLoading = true;
this.currentPage = current;
let params = {
pageNow: current,
pageSize: this.limit,
chipCode: this.formData.chipCode,
name: this.formData.name,
pxrq: this.formData.pxrq,
trainingUnit: this.formData.trainingUnit,
};
getJobDogList(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;
datas.forEach((item) => {
// 处理工作犬等级
item.trainingLevelIdForName = getCodeName(
item.trainingLevelId,
this.gzqdjOptions
);
// 处理培训次数
item.trainCountForName = getCodeName(
item.trainCount,
this.trainCountOption
);
// 处理培训科目
item.trainSubjectForName = "";
if (item.trainSubject) {
let subArr = item.trainSubject.split("#") || [];
if (subArr?.length) {
subArr.forEach((subItem) => {
item.trainSubjectForName =
item.trainSubjectForName + subItem + "、";
});
item.trainSubjectForName = item.trainSubjectForName.substr(
0,
item.trainSubjectForName.length - 1
);
}
}
});
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;
});
},
addData() {
// this.$router.push({ name: "poDogJobManageAdd" });
},
editData(row) {},
deleteData(row) {},
importData() {
this.showImportBox = true;
},
batchAdd() {},
exportData() {},
handleCurrentChange(current) {
this.currentPage = current;
......@@ -254,6 +372,14 @@ export default {
handleHeaderSettings() {
this.showHeaderSettingBox = true;
},
getNewColArr(arr) {
if (arr?.length) {
this.colPropArr = [];
setTimeout(() => {
this.colPropArr = arr;
}, 1);
}
},
},
};
</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