From fd34c3c56e2d40c312fcbbf7330d40ceafcd421e Mon Sep 17 00:00:00 2001 From: songshankun <songshankun@foxmail.com> Date: 星期四, 28 九月 2023 09:34:46 +0800 Subject: [PATCH] feat: 表格组件添加列显隐控制组件;销售线索页表格适配列显隐 --- src/views/client/client/index.vue | 264 +++++++++++++++++++++++++++++++++------------------- 1 files changed, 169 insertions(+), 95 deletions(-) diff --git a/src/views/client/client/index.vue b/src/views/client/client/index.vue index 4830133..a1c4e19 100644 --- a/src/views/client/client/index.vue +++ b/src/views/client/client/index.vue @@ -5,7 +5,7 @@ <el-tab-pane label="鍏捣瀹㈡埛" name="first"></el-tab-pane> <el-tab-pane label="鎴戠殑瀹㈡埛" name="second"></el-tab-pane> </el-tabs> - <div class="sel-gonghai"> + <!-- <div class="sel-gonghai"> <el-select v-model="gonghaiValue" placeholder="璇烽�夋嫨" class="query-class-sel" size="mini" disabled> <el-option v-for="item in gonghaiOptions" :key="item.value" :label="item.label" :value="item.value"> </el-option> @@ -13,46 +13,59 @@ <div class="query-class-btn"> <i class="el-icon-setting"></i> </div> - </div> + </div> --> </div> - <div class="top"> - <SearchCommonView - ref="searchCommonView" - :query-class-options="queryClassOptions" - :search-options="searchOptions" - @searchClick="searchClick" - @resetClick="resetClick" - /> - <div class="btn-pager"> - <PublicFunctionBtnView - :list-button="true" - :map-button="true" - :statistics="true" - :operates-list="operatesList" - @batchDelete="delClick" - /> - <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" /> - </div> - </div> - <TableCommonView - ref="tableListRef" - v-loading="loading" - :table-list="tableList" - @selClientClick="selClientClick" - @selContactsClick="selContactsClick" - @getSelectArray="getSelectArray" - > - <template slot="tableButton"> - <el-table-column label="鎿嶄綔" width="150"> - <template slot-scope="scope"> - <el-button type="text" size="small" disabled>鍙樻洿鍏捣</el-button> - <el-button @click="handleClick(scope.row)" type="text" size="small">缂栬緫</el-button> - <el-button @click="followupClick(scope.row)" type="text" size="small">璺熻繘</el-button> - <!-- <el-button @click="delClick(scope.row.id)" type="text" size="small">鍒犻櫎</el-button> --> + + <div class="filter"> + <div class="filter-card"> + <CommonSearch + :show-add="false" + :show-download="false" + :amount-view="false" + :show-action-btn="false" + placeholder="璇疯緭鍏ュ鎴峰悕绉�" + @searchClick="onFilterSearch" + > + <template slot="leftButton"> + <el-button size="small" type="primary" @click="addBtnClick">鏂板缓</el-button> + <el-button size="small" @click="delClick">鍒犻櫎</el-button> </template> - </el-table-column> - </template> - </TableCommonView> + </CommonSearch> + </div> + </div> + + <div class="body"> + <div class="body-card"> + <div class="list-view"> + <TableCommonView + ref="tableListRef" + v-loading="loading" + :table-list="tableList" + @selClientClick="selClientClick" + @selContactsClick="selContactsClick" + @getSelectArray="getSelectArray" + > + <template slot="tableButton"> + <el-table-column label="鎿嶄綔" width="150"> + <template slot-scope="scope"> + <el-button v-if="activeName === 'first'" type="text" size="small" @click="allocationBtnClick(scope.row)" + >鍒嗛厤</el-button + > + <el-button v-else type="text" size="small" @click="changeHighSeasClick(scope.row)">鍙樻洿鍏捣</el-button> + <el-button @click="handleClick(scope.row)" type="text" size="small">缂栬緫</el-button> + <el-button @click="followupClick(scope.row)" type="text" size="small">璺熻繘</el-button> + <!-- <el-button @click="delClick(scope.row.id)" type="text" size="small">鍒犻櫎</el-button> --> + </template> + </el-table-column> + </template> + </TableCommonView> + </div> + <div class="btn-pager"> + <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" /> + </div> + </div> + </div> + <!-- 鏂板缓/缂栬緫瀹㈡埛绠$悊 --> <AddClientManageDialog v-if="editConfig.visible" :edit-client-manage-config="editConfig" /> <!-- 瀹㈡埛璇︽儏 --> @@ -61,6 +74,8 @@ <DetailContacts v-if="contactsDeail.visible" :contacts-detail="contactsDeail" /> <!-- 鏂板缓/缂栬緫璺熻繘璁板綍 --> <AddFollowupRecordsDialog v-if="editFollowupConfig.visible" :edit-contacts-config="editFollowupConfig" /> + <!-- 鍒嗛厤 --> + <AllocationDialog v-if="allocationConfig.visible" :edit-common-config="allocationConfig" /> </div> </template> @@ -69,6 +84,8 @@ import { getClientList, getDeleteClient } from "@/api/client/client" import pageMixin from "@/components/makepager/pager/mixin/pageMixin" import AddFollowupRecordsDialog from "@/views/client/followupRecords/AddFollowupRecordsDialog" +import AllocationDialog from "@/views/client/client/AllocationDialog" +import { getAssign } from "@/api/common/other" export default { name: "CustomManage", @@ -78,7 +95,8 @@ AddClientManageDialog, DetailContacts: () => import("@/views/client/contacts/DetailContacts"), DetailClientManage: () => import("@/views/client/client/DetailClientManage"), - AddFollowupRecordsDialog + AddFollowupRecordsDialog, + AllocationDialog }, computed: {}, data() { @@ -126,11 +144,19 @@ visible: false, title: "鏂板缓", infomation: {} - } + }, + allocationConfig: { + visible: false, + infomation: {} + }, + not_admin: 2 } }, created() { this.setTable() + this.search_map = { + not_admin: this.not_admin + } this.getData() }, methods: { @@ -171,12 +197,18 @@ let contact_name = "" let contact_phone = "" let contact_id = 0 + let contact_wechat = "" + let contact_email = "" + let position = "" if (item.contacts.length !== 0) { for (let i = 0; i < item.contacts.length; i++) { if (item.contacts[i].is_first) { contact_name = item.contacts[i].name contact_phone = item.contacts[i].phone contact_id = item.contacts[i].id + contact_wechat = item.contacts[i].wechat + contact_email = item.contacts[i].email + position = item.contacts[i].position } } } @@ -187,7 +219,10 @@ client_level: item.client_level.name, client_status: item.client_status.name, contact_id: contact_id, - member_name: item.member.username + member_name: item.member.username, + contact_wechat: contact_wechat, + contact_email: contact_email, + position: position } }) this.tableList.tableInfomation = list || [] @@ -206,44 +241,50 @@ this.loading = false }) }, - tabsClick(tab, event) { - console.log(tab, event) - }, - // 鎼滅储 - searchClick(val, content) { - console.log(val, content) - this.search_map = { - [val.value]: content + tabsClick(tab) { + console.log(tab.name) + if (tab.name === "first") { + this.not_admin = 2 + } else { + this.not_admin = 1 } + this.search_map = { + not_admin: this.not_admin + } + this.pagerOptions.currPage = 1 this.getData() }, - resetClick() { - this.search_map = {} + // 鎼滅储 + onFilterSearch(searchText){ + this.search_map = { + not_admin: this.not_admin, + name: searchText + } + this.pagerOptions.currPage = 1 this.getData() }, // 鏂板缓 addBtnClick() { this.editConfig.visible = true this.editConfig.title = "鏂板缓" - this.editConfig.infomation = { city_id: 0 } + this.editConfig.infomation = { + city_id: 0, + client_type_id: 1, + client_origin_id: 1, + client_level_id: 1, + registered_capital_id: 1, + enterprise_nature_id: 1, + enterprise_scale_id: 1, + industry_id: 1 + } }, // 缂栬緫 handleClick(row) { console.log(row) this.editConfig.visible = true this.editConfig.title = "缂栬緫" - let contactObj = {} - if (row.contacts.length > 0) { - row.contacts.forEach((ele) => { - if (ele.is_first) { - contactObj = { ...ele } - } - }) - } this.editConfig.infomation = { - ...row, - contact_wechat: contactObj.length > 0 ? contactObj.wechat : "", - contact_email: contactObj.length > 0 ? contactObj.email : "" + ...row } }, // 鍒犻櫎 @@ -311,6 +352,26 @@ number: "", next_follow_time: row.next_visit_time } + }, + // 鍒嗛厤 + allocationBtnClick(row) { + console.log(row) + this.allocationConfig.visible = true + this.allocationConfig.infomation = { member_id: row.member_id, id: row.id } + }, + // 鍙樻洿鍏捣 + async changeHighSeasClick(row) { + await getAssign({ + ids: [row.id], + member_id: 1, + type: "client" + }).then((res) => { + this.editConfig.visible = false + if (res.code === 200) { + this.$message.success("鍙樻洿鎴愬姛") + this.getData() + } + }) } } } @@ -318,37 +379,6 @@ <!-- Add "scoped" attribute to limit CSS to this component only --> <style lang="scss" scoped> -.custom-manage { - .tab-view { - position: relative; - .sel-gonghai { - display: flex; - position: absolute; - top: 5px; - left: 660px; - height: 35px; - line-height: 35px; - .query-class-sel { - width: 165px; - margin-left: 10px; - } - .query-class-btn { - font-size: 16px; - margin-left: 10px; - color: #bebebe; - } - } - } - .top { - margin-bottom: 20px; - .btn-pager { - display: flex; - .page { - margin-left: auto; - } - } - } -} ::v-deep { .el-tabs--top .el-tabs__item.is-top:nth-child(2) { padding-left: 25px; @@ -358,4 +388,48 @@ height: 45px; } } + +.custom-manage{ + height: 100%; + overflow: hidden; + .filter{ + height: 80px; + display: flex; + align-items: center; + padding: 0 20px 0 20px; + &-card{ + height: 80px; + display: flex; + align-items: center; + box-sizing: border-box; + padding: 10px 20px; + flex: 1; + border-radius: 12px; + background-color: #fff; + } + } + .body{ + box-sizing: border-box; + padding: 10px 20px; + border-radius: 12px; + height: calc(100% - 139px); + .body-card { + background-color: #fff; + border-radius: 12px; + height: 100%; + overflow: hidden; + } + .list-view { + height: calc(100% - 60px); + overflow: hidden; + } + .btn-pager { + display: flex; + margin-top: 10px; + .page { + margin-left: auto; + } + } + } +} </style> -- Gitblit v1.8.0