123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379 |
- <template>
- <div class="container">
- <div v-show="!isShowStructure" class="page-head">
- <van-search
- v-model="keywords"
- placeholder="请输入搜索关键词"
- :left-icon="searchImg"
- :right-icon="closeImg"
- @search="onSearch"
- />
- <div class="select-box">
- <div class="adress-box" @click="showStructure">
- <div class="blue-rectangle" />
- <div v-if="!!requestParameters.checkedId" class="block1">
- <div>{{ upOneLevel }}</div>
- <div style="margin: 0 5px">{{ ">" }}</div>
- <div style="color: #1d92ff">{{ adressContent }}</div>
- </div>
- <div v-else class="block1" style="height: 27px">
- <div>广东省</div>
- <div style="margin: 0 5px">{{ ">" }}</div>
- <div style="color: #1d92ff">茂名市</div>
- </div>
- </div>
- <div />
- </div>
- <hr style="color: #f9f9f9" />
- </div>
- <div v-show="!isShowStructure" class="scroll-list">
- <van-list
- v-model:loading="loading"
- :finished="finished"
- finished-text="没有更多了"
- @load="onLoad"
- >
- <div v-for="(item, index) in persons" :key="item.id">
- <div class="person-box2" @click="personInform(item)">
- <div class="circle">
- <img :src="onlineUser" alt="" />
- </div>
- <div style="display: flex">
- <div class="information-card2">
- <div style="display: flex">
- <div style="font-weight: bold">{{ item.name }}</div>
- </div>
- <div style="display: flex">
- <div style="font-size: 13px; margin-top: 5px; color: #979797">
- {{ item.unit }} {{ item.position }}
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="link-top" />
- </div>
- </van-list>
- </div>
- <organizationalStructure
- v-if="isShowStructure"
- v-model:isShowStructure="isShowStructure"
- @confirm="handleSelect"
- />
- </div>
- </template>
- <script setup lang="ts">
- import offlineUser from "@/assets/images/threePreventionResponsiblePerson/offlineUsers.png";
- import onlineUser from "@/assets/images/threePreventionResponsiblePerson/onlineUsers.png";
- import { getDicts } from "@/api/system/dict/data";
- import { getEventList } from "@/api/event";
- import searchImg from "@/assets/images/search.png";
- import closeImg from "@/assets/images/close.png";
- import OrganizationalStructure from "@/views/threePreventionResponsiblePerson/organizationalStructure.vue";
- import { getPersonalData, getPersonalType } from "@/api/persons";
- import { listContact } from "@/api/duty/eventing";
- /*
- const list = ref([
- {
- id: "1",
- name: "谢和平",
- unit: "茂名市应急管理局",
- position: "一级科员",
- title: "教授",
- expertType: "其它突发事件"
- },
- {
- id: "2",
- name: "谢和平",
- unit: "茂名市应急管理局",
- position: "一级科员",
- title: "教授",
- expertType: "其它突发事件"
- },
- {
- id: "3",
- name: "谢和平",
- unit: "茂名市应急管理局",
- position: "一级科员",
- title: "教授",
- expertType: "其它突发事件"
- },
- {
- id: "4",
- name: "谢和平",
- unit: "茂名市应急管理局",
- position: "一级科员",
- title: "教授",
- expertType: "其它突发事件"
- },
- {
- id: "5",
- name: "谢和平",
- unit: "茂名市应急管理局",
- position: "一级科员",
- title: "教授",
- expertType: "其它突发事件"
- },
- {
- id: "6",
- name: "谢和平",
- unit: "茂名市应急管理局",
- position: "一级科员",
- title: "教授",
- expertType: "其它突发事件"
- },
- {
- id: "7",
- name: "谢和平",
- unit: "茂名市应急管理局",
- position: "一级科员",
- title: "教授",
- expertType: "其它突发事件"
- },
- {
- id: "8",
- name: "谢和平",
- unit: "茂名市应急管理局",
- position: "一级科员",
- title: "教授",
- expertType: "其它突发事件"
- },
- {
- id: "9",
- name: "谢和平",
- unit: "茂名市应急管理局",
- position: "一级科员",
- title: "教授",
- expertType: "其它突发事件"
- },
- {
- id: "10",
- name: "谢和平",
- unit: "茂名市应急管理局",
- position: "一级科员",
- title: "教授",
- expertType: "其它突发事件"
- }
- ]);
- */
- const router = useRouter();
- const keywords = ref("");
- let responsibility_type = ref([]);
- const fieldValue = ref("三防指挥部");
- const showPicker = ref(false);
- const onConfirm = ({ selectedValues, selectedOptions }) => {
- showPicker.value = false; //用于控制 van-picker 组件的显示状态,将其设置为 false 表示隐藏选择器。
- requestParameters.value.type_parent_id = selectedValues.toString(); //将用户选择的值(selectedValues)保存到 requestParameters 对象的 type_content 属性中
- fieldValue.value = selectedOptions[0].dictLabel; //将用户选择的第一个选项的 dictLabel 属性值保存到 fieldValue 中
- requestParameters.value.page = 1;
- onLoad();
- };
- const loading = ref(false);
- const finished = ref(false);
- const customFieldName = {
- text: "dictLabel",
- value: "dictValue"
- };
- const requestParameters = ref({
- name: "",
- type: [],
- type_parent_id: "",
- page: 1,
- pageSize: 10,
- contactName: keywords,
- checkedId: ""
- });
- const personInform = item => {
- router.push({ name: "CadreInformation", query: { id: item.id } });
- };
- const persons = ref([]);
- const onLoad = () => {
- /*
- getPersonalData(requestParameters.value).then(res => {
- var item = res.data || [];
- // 重置 persons 数组(如果是第一页)
- if (requestParameters.value.page == 1) {
- persons.value = [];
- }
- // 将新数据添加到 persons 数组中
- item.forEach(temp => {
- persons.value.push(temp);
- });
- // 检查是否加载了所有数据
- if (persons.value.length >= res.total) {
- finished.value = true;
- } else {
- finished.value = false;
- }
- requestParameters.value.page++;
- loading.value = false;
- });
- */
- listContact(requestParameters.value).then(res => {
- var item = res.data || [];
- // 重置 persons 数组(如果是第一页)
- if (requestParameters.value.page == 1) {
- persons.value = [];
- }
- // 将新数据添加到 persons 数组中
- item.forEach(i => {
- persons.value.push({
- id: i.id,
- name: i.contactName,
- unit: i.unitName,
- position: i.position,
- phone: i.phone
- });
- });
- // 检查是否加载了所有数据
- if (persons.value.length >= res.total) {
- finished.value = true;
- } else {
- finished.value = false;
- }
- requestParameters.value.page++;
- loading.value = false;
- });
- };
- onMounted(() => {
- // getDicts("responsibility_type").then(res => {
- // res.data.unshift({ dictLabel: "所有类型", dictValue: "" });
- // responsibility_type.value = res.data;
- // });
- //getPersonalType(requestParameters.value).then(res => {
- // responsibility_type = res.data || [];
- //});
- onLoad();
- });
- const onSearch = keywords => {
- requestParameters.value.page = 1;
- onLoad();
- };
- const showPersonalInformation = item => {
- router.push({ name: "PersonInformation", query: { id: item.id } });
- };
- let keyword = ref("");
- let treeRef = ref();
- let checkData = ref([]);
- const isShowStructure = ref(false);
- const showStructure = () => {
- isShowStructure.value = true;
- };
- const adressContent = ref();
- const upOneLevel = ref();
- const filterNode = (value, data) => {
- if (!value) return true;
- return data.label.indexOf(value) !== -1;
- };
- let selectedTreeId = ref([]);
- const handleSelect = data => {
- adressContent.value = data.label;
- upOneLevel.value = data.value;
- requestParameters.value.checkedId = data.id;
- };
- </script>
- <style scoped lang="scss">
- .container {
- height: calc(100vh - 55px);
- display: flex;
- flex-direction: column;
- }
- .select-box {
- display: flex;
- flex-direction: row;
- justify-content: space-between;
- margin-top: -2px;
- background: #fff;
- }
- .circle {
- width: 55px;
- height: 55px;
- border-radius: 50%;
- background-color: #eaeaea;
- display: flex;
- justify-content: center;
- align-items: center;
- color: black;
- font-size: 15px;
- margin: 15px 5px 15px;
- }
- .person-box {
- display: flex;
- flex-direction: row;
- margin-left: 10px;
- }
- .person-box2 {
- display: flex;
- flex-direction: row;
- padding-left: 8px;
- background-color: #ffffff;
- }
- .information-card {
- display: flex;
- flex-direction: column;
- margin-left: 10px;
- width: 250px;
- }
- .block {
- width: 100%;
- height: 100%;
- background-color: #f2f2f2;
- }
- .page-head {
- width: 100%;
- }
- .blue-rectangle {
- width: 6px;
- height: 20px;
- background-image: linear-gradient(180deg, #00fce7 0%, #2c81ff 100%);
- border-radius: 0 3px 0 0;
- margin-left: -10px;
- }
- .adress-box {
- display: flex;
- flex-direction: row;
- padding-top: 10px;
- width: 50%;
- margin-left: 20px;
- }
- .link-top {
- height: 0.5px;
- border-top: solid #f2f2f2 1px;
- }
- .block1 {
- display: flex;
- flex-direction: row;
- margin-left: 5px;
- }
- .scroll-list {
- flex: 1;
- overflow: scroll;
- }
- .information-card2 {
- display: flex;
- flex-direction: column;
- justify-content: center;
- margin-left: 10px;
- width: 230px;
- margin-top: 2px;
- }
- .common-search {
- :deep(.van-field__right-icon) {
- width: 30px;
- height: 30px;
- padding: 0;
- .van-icon__image {
- width: 30px;
- height: 30px;
- }
- }
- }
- </style>
|