From 352e9e459e3c865a8509ccebfe6a3d580a65165c Mon Sep 17 00:00:00 2001 From: yangfeng <wanwan926_4@163.com> Date: 星期二, 10 十月 2023 13:48:29 +0800 Subject: [PATCH] 搜索公共组件、新建选择客户名称等公共组件、新建弹窗及跟进记录页面批量删除改为单条删除 --- src/views/other/commonDialog/SelectClientDialog.vue | 198 ++++++++++++++++++++++++++++--------------------- 1 files changed, 114 insertions(+), 84 deletions(-) diff --git a/src/views/other/commonDialog/SelectClientDialog.vue b/src/views/other/commonDialog/SelectClientDialog.vue index 1a62eb9..4615423 100644 --- a/src/views/other/commonDialog/SelectClientDialog.vue +++ b/src/views/other/commonDialog/SelectClientDialog.vue @@ -10,61 +10,31 @@ > <div class="bg-view"> <div class="query-bg"> - <el-input placeholder="璇疯緭鍏ュ唴瀹�" v-model="queryInput" size="mini" class="input-with-select"> - <el-select v-model="select" slot="prepend" placeholder="璇烽�夋嫨"> - <el-option label="鍏ㄩ儴瀛楁" value="1"></el-option> - <el-option label="瀹㈡埛缂栧彿" value="2"></el-option> - <el-option label="瀹㈡埛鐘舵��" value="3"></el-option> - <el-option label="閿�鍞礋璐d汉" value="4"></el-option> - <el-option label="娉曞畾浠h〃浜�" value="5"></el-option> - <el-option label="娉ㄥ唽鏃堕棿" value="6"></el-option> - <el-option label="缁忚惀鑼冨洿" value="7"></el-option> - <el-option label="璇︾粏鍦板潃" value="8"></el-option> - <el-option label="澶囨敞" value="9"></el-option> - </el-select> - </el-input> + <SearchCommonView + ref="searchCommonView" + :search-options="searchOptions" + @searchClick="searchClick" + @resetClick="resetClick" + /> <div class="btn"> - <el-button type="primary" size="mini" disabled>璁剧疆瀛楁</el-button> - <el-button type="primary" size="mini" disabled>蹇�熷垱寤�</el-button> + <!-- <el-button type="primary" size="mini" disabled>璁剧疆瀛楁</el-button> + <el-button type="primary" size="mini" disabled>蹇�熷垱寤�</el-button> --> </div> </div> - <el-table - :data="tableData" - border - size="mini" + <TableCommonView + ref="tableListRef" v-loading="loading" - :header-cell-style="{ background: '#f7f7f7' }" + :table-list="tableList" + :select-box="false" + @selClientClick="selNameClick" + @selTableCol="selTableCol" > - <el-table-column label="瀹㈡埛鍚嶇О" prop="name" show-overflow-tooltip> - <template slot-scope="scope"> - <!-- <div style="margin-right: 10px"> --> - <span class="sel-name" @click="selNameClick(scope.row)">{{ scope.row.name }}</span> - <!-- </div> --> - </template> - </el-table-column> - <el-table-column label="瀹㈡埛缂栧彿" prop="number"></el-table-column> - <el-table-column label="瀹㈡埛鐘舵��" prop="client_status"></el-table-column> - <el-table-column label="閿�鍞礋璐d汉" prop="member_id"></el-table-column> - <!-- <el-table-column label="绾跨储鍗囩骇鐘舵��" prop="setDefault"></el-table-column> --> - <el-table-column label="娉曞畾浠h〃浜�" prop="representative"></el-table-column> - <el-table-column label="娉ㄥ唽鏃堕棿" prop="registration_time" show-overflow-tooltip> - <template slot-scope="scope"> - <span>{{ - dateFormat("YYYY-mm-dd HH:MM:SS", scope.row.registration_time) === "1900-01-01 08:00:00" - ? "--" - : dateFormat("YYYY-mm-dd HH:MM:SS", scope.row.registration_time) - }}</span> - </template> - </el-table-column> - <el-table-column label="缁忚惀鑼冨洿" prop="business_scope"></el-table-column> - <el-table-column label="璇︾粏鍦板潃" prop="detail_address"></el-table-column> - <el-table-column label="澶囨敞" prop="remark"></el-table-column> - <div slot="empty"> - <el-empty :image-size="100"></el-empty> - </div> - </el-table> + </TableCommonView> <div slot="footer" class="dialog-footer"> - <div class="remark">璇存槑锛氭敮鎸佸瀛楁妯$硦鏌ヨ锛屼粎鏄剧ず绗﹀悎鏉′欢鐨勫墠5鏉℃暟鎹�</div> + <!-- <div class="remark">璇存槑锛氭敮鎸佸瀛楁妯$硦鏌ヨ锛屼粎鏄剧ず绗﹀悎鏉′欢鐨勫墠5鏉℃暟鎹�</div> --> + <div class="btn-pager"> + <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" /> + </div> </div> </div> </el-dialog> @@ -73,8 +43,10 @@ <script> import { getClientList } from "@/api/client/client" +import pageMixin from "@/components/makepager/pager/mixin/pageMixin" export default { name: "EditSelClientDialog", + mixins: [pageMixin], props: { editCommonConfig: { type: Object, @@ -82,11 +54,7 @@ return { editVisible: false, title: "", - infomation: { - name: "", - color: "", - setDefault: "" - } + infomation: {} } } } @@ -101,69 +69,119 @@ select: "1", tableData: [], searchSelOptions: [], - loading: false + loading: false, + searchOptions: [], + tableList: {}, + search_map: {}, + tableColumn: [ + { label: "瀹㈡埛鍚嶇О", prop: "name", min: 100, isClientClick: true, default: true }, + { label: "瀹㈡埛缂栧彿", prop: "number" }, + { label: "瀹㈡埛鐘舵��", prop: "client_status" }, + { label: "閿�鍞礋璐d汉", prop: "member_name", min: 100 }, + { label: "娉曞畾浠h〃浜�", prop: "representative", min: 100 }, + { label: "娉ㄥ唽鏃堕棿", prop: "registration_time" }, + { label: "缁忚惀鑼冨洿", prop: "business_scope" }, + { label: "璇︾粏鍦板潃", prop: "detail_address" }, + { label: "澶囨敞", prop: "remark" } + ], + showCol: [ + "瀹㈡埛鍚嶇О", + "瀹㈡埛缂栧彿", + "瀹㈡埛鐘舵��", + "閿�鍞礋璐d汉", + "娉曞畾浠h〃浜�", + "娉ㄥ唽鏃堕棿", + "缁忚惀鑼冨洿", + "璇︾粏鍦板潃", + "澶囨敞" + ] } }, created() { + this.setTable() this.getData() }, methods: { + setTable() { + this.tableList = { + selectIndex: true, + tableInfomation: [], + allcol: [], + showcol: this.showCol, + tableColumn: this.setColumnVisible(this.showCol) + } + this.tableList.allcol = this.tableList.tableColumn.filter((ele) => !ele.default).map((ele) => ele.label) + this.searchOptions = [] + for (let i = 0; i < this.tableList.tableColumn.length; i++) { + const label = this.tableList.tableColumn[i].label + const value = this.tableList.tableColumn[i].prop + this.searchOptions.push({ value: value, label: label }) + } + }, + setColumnVisible(showCol) { + return this.tableColumn.map((ele) => { + return { + ...ele, + isShowColumn: showCol.includes(ele.label) + } + }) + }, + selTableCol(val) { + this.showcol = val + this.tableList.tableColumn = this.setColumnVisible(val) + }, handleClose() { this.editConfig.editVisible = false }, // 璇锋眰鏁版嵁 async getData() { this.loading = true - await getClientList() + await getClientList({ + search_map: this.search_map, + page: this.pagerOptions.currPage, + pageSize: this.pagerOptions.pageSize + }) .then((res) => { console.log(res) if (res.code === 200) { if (res.data.list && res.data.list.length > 0) { + console.log("ssss") const list = res.data.list.map((item) => { return { ...item, - client_status: item.client_status.name + client_status: item.client_status.name, + member_name: item.member.username } }) - this.tableData = list.slice(0, 5) || [] - } else { - this.tableData = [] + this.tableList.tableInfomation = list || [] + this.pagerOptions.totalCount = res.data.count } } else { - this.tableData = [] + this.tableList.tableInfomation = [] } this.loading = false }) .catch((err) => { console.log(err) - this.tableData = [] + this.this.tableList.tableInfomation = [] this.loading = false }) }, selNameClick(row) { this.editConfig.editVisible = false - this.$emit("selClient", row) + this.$emit("selClient", row, "client") }, - // 鏃堕棿鏄剧ず - dateFormat(fmt, date) { - let ret = "" - date = new Date(date) - const opt = { - "Y+": date.getFullYear().toString(), // 骞� - "m+": (date.getMonth() + 1).toString(), // 鏈� - "d+": date.getDate().toString(), // 鏃� - "H+": date.getHours().toString(), // 鏃� - "M+": date.getMinutes().toString(), // 鍒� - "S+": date.getSeconds().toString() // 绉� - // 鏈夊叾浠栨牸寮忓寲瀛楃闇�姹傚彲浠ョ户缁坊鍔狅紝蹇呴』杞寲鎴愬瓧绗︿覆 + // 鎼滅储 + searchClick(val, content) { + console.log(val, content) + this.search_map = { + [val.value]: content } - for (let k in opt) { - ret = new RegExp("(" + k + ")").exec(fmt) - if (ret) { - fmt = fmt.replace(ret[1], ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, "0")) - } - } - return fmt + this.getData() + }, + resetClick() { + this.search_map = {} + this.getData() } } } @@ -174,6 +192,7 @@ .bg-view { margin: 10px; .query-bg { + margin-left: -20px; margin-bottom: 10px; display: flex; justify-content: space-between; @@ -187,15 +206,26 @@ float: right; } } + .list-view { + height: 100%; + background: #c22f2f; + } } .sel-name { color: $color-primary; cursor: pointer; } .dialog-footer { - height: 40px; - line-height: 40px; + height: 50px; + line-height: 50px; color: red; + .btn-pager { + display: flex; + margin-top: 0px; + .page { + margin-left: auto; + } + } } ::v-deep { .input-with-select .el-input-group__prepend { -- Gitblit v1.8.0