From b74beee46cee6b4274e68246321af4f8b2a3b9ed Mon Sep 17 00:00:00 2001
From: zengh <123456>
Date: Wed, 07 Dec 2022 09:38:43 +0800
Subject: [PATCH] 1、值班联系方式联动下拉
---
src/views/policeman/policeman.vue | 4 ++
src/api/scheduling/scheduling.js | 9 ++++
src/views/scheduling/scheduling.vue | 65 ++++++++++++++++++++++++--------
3 files changed, 62 insertions(+), 16 deletions(-)
diff --git a/src/api/scheduling/scheduling.js b/src/api/scheduling/scheduling.js
index f64e30c..43c97d8 100644
--- a/src/api/scheduling/scheduling.js
+++ b/src/api/scheduling/scheduling.js
@@ -21,6 +21,15 @@
}
})
}
+export const getPliceman = () => {
+ return request({
+ url: '/api/policeman/policeman/all',
+ method: 'get',
+ params: {
+
+ }
+ })
+}
export const remove = (ids) => {
return request({
diff --git a/src/views/policeman/policeman.vue b/src/views/policeman/policeman.vue
index 6a1b1be..d176c34 100644
--- a/src/views/policeman/policeman.vue
+++ b/src/views/policeman/policeman.vue
@@ -74,6 +74,10 @@
prop: "serialNumber",
},
{
+ label: "联系方式",
+ prop: "contact",
+ },
+ {
label: "所属辖区",
prop: "deptId",
type: "tree",
diff --git a/src/views/scheduling/scheduling.vue b/src/views/scheduling/scheduling.vue
index 3d0cca1..933b558 100644
--- a/src/views/scheduling/scheduling.vue
+++ b/src/views/scheduling/scheduling.vue
@@ -32,7 +32,7 @@
</template>
<script>
- import {getList, getDetail, add, update, remove} from "@/api/scheduling/scheduling";
+ import {getList, getDetail, add, update, remove, getPliceman} from "@/api/scheduling/scheduling";
import {mapGetters} from "vuex";
export default {
@@ -64,11 +64,11 @@
{
label: "值班员",
prop: "person",
- type:"select",
- dicUrl:"/api/policeman/policeman/all",
- props:{
- label:"name",
- value:"id"
+ type: "select",
+ dicUrl: "",
+ props: {
+ label: "name",
+ value: "id"
}
},
{
@@ -78,8 +78,8 @@
{
label: "值班岗位",
prop: "station",
- row:true,
- span:24
+ row: true,
+ span: 24
},
{
label: "开始时间",
@@ -110,11 +110,11 @@
{
label: "带班领导",
prop: "leads",
- type:"select",
- dicUrl:"/api/policeman/policeman/all",
- props:{
- label:"name",
- value:"id"
+ type: "select",
+ dicUrl: "",
+ props: {
+ label: "name",
+ value: "id"
}
},
{
@@ -123,7 +123,8 @@
},
]
},
- data: []
+ data: [],
+ policemanList: []
};
},
computed: {
@@ -143,6 +144,29 @@
});
return ids.join(",");
}
+ },
+ watch: {
+ 'form.person': {
+ handler(res) {
+ this.policemanList.forEach(e => {
+ if (res == e.id) {
+ this.form.contact = e.contact
+ }
+ })
+ }
+ },
+ 'form.leads': {
+ handler(res) {
+ this.policemanList.forEach(e => {
+ if (res == e.id) {
+ this.form.leadContact = e.contact
+ }
+ })
+ }
+ },
+ },
+ created() {
+ this.getPolicemanAll();
},
methods: {
rowSave(row, done, loading) {
@@ -235,10 +259,10 @@
this.selectionList = [];
this.$refs.crud.toggleSelection();
},
- currentChange(currentPage){
+ currentChange(currentPage) {
this.page.currentPage = currentPage;
},
- sizeChange(pageSize){
+ sizeChange(pageSize) {
this.page.pageSize = pageSize;
},
refreshChange() {
@@ -253,6 +277,15 @@
this.loading = false;
this.selectionClear();
});
+ },
+ getPolicemanAll() {
+ getPliceman().then(res => {
+ this.policemanList = res.data.data
+ const securityIdColumn = this.findObject(this.option.column, "person")
+ securityIdColumn.dicData = this.policemanList
+ const securityIdColumns = this.findObject(this.option.column, "leads")
+ securityIdColumns.dicData = this.policemanList
+ })
}
}
};
--
Gitblit v1.9.3