|  |  | 
 |  |  |     > | 
 |  |  |       <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="销售阶段" value="4"></el-option> | 
 |  |  |               <el-option label="销售负责人" value="5"></el-option> | 
 |  |  |               <el-option label="预计成交日期" value="6"></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" | 
 |  |  |           @selCommonClick="selNameClick" | 
 |  |  |           @selTableCol="selTableCol" | 
 |  |  |         > | 
 |  |  |           <el-table-column label="销售机会编号" prop="number"></el-table-column> | 
 |  |  |           <el-table-column label="机会名称" prop="name" show-overflow-tooltip> | 
 |  |  |             <template slot-scope="scope"> | 
 |  |  |               <span class="sel-name" @click="selNameClick(scope.row)">{{ scope.row.name }}</span> | 
 |  |  |             </template> | 
 |  |  |           </el-table-column> | 
 |  |  |           <el-table-column label="销售阶段" prop="sale_stage_id"></el-table-column> | 
 |  |  |           <el-table-column label="销售负责人" prop="member_id"></el-table-column> | 
 |  |  |           <el-table-column label="预计成交日期" prop="expected_time" show-overflow-tooltip> | 
 |  |  |             <template slot-scope="scope"> | 
 |  |  |               <span>{{ | 
 |  |  |                 dateFormat("YYYY-mm-dd HH:MM:SS", scope.row.expected_time) === "1900-01-01 08:00:00" | 
 |  |  |                   ? "--" | 
 |  |  |                   : dateFormat("YYYY-mm-dd HH:MM:SS", scope.row.expected_time) | 
 |  |  |               }}</span> | 
 |  |  |             </template> | 
 |  |  |           </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> | 
 |  |  | 
 |  |  |  | 
 |  |  | <script> | 
 |  |  | import { getSaleChanceList } from "@/api/sales/salesOpportunity" | 
 |  |  | import pageMixin from "@/components/makepager/pager/mixin/pageMixin" | 
 |  |  | export default { | 
 |  |  |   name: "EditSelChanceDialog", | 
 |  |  |   mixins: [pageMixin], | 
 |  |  |   props: { | 
 |  |  |     editCommonConfig: { | 
 |  |  |       type: Object, | 
 |  |  | 
 |  |  |         return { | 
 |  |  |           editVisible: false, | 
 |  |  |           title: "", | 
 |  |  |           clientId: 0, | 
 |  |  |           infomation: {} | 
 |  |  |         } | 
 |  |  |       } | 
 |  |  | 
 |  |  |       editConfig: this.editCommonConfig, | 
 |  |  |       queryInput: "", | 
 |  |  |       select: "1", | 
 |  |  |       tableData: [], | 
 |  |  |       tableList: [], | 
 |  |  |       searchSelOptions: [], | 
 |  |  |       loading: false | 
 |  |  |       loading: false, | 
 |  |  |       search_map: {}, | 
 |  |  |       tableColumn: [ | 
 |  |  |         { label: "销售机会编号", prop: "number" }, // 销售机会编号 | 
 |  |  |         { label: "机会名称", prop: "name", isCommonClick: true, default: true }, // 机会名称 | 
 |  |  |         { label: "销售阶段", prop: "sale_stage_name" }, // 销售阶段 | 
 |  |  |         { label: "销售负责人", prop: "member_name" }, // 销售负责人 | 
 |  |  |         { label: "预计成交日期", prop: "expected_time" } // 预计成交日期 | 
 |  |  |       ], | 
 |  |  |       showCol: ["销售机会编号", "机会名称", "销售阶段", "销售负责人", "预计成交日期"] | 
 |  |  |     } | 
 |  |  |   }, | 
 |  |  |   created() { | 
 |  |  |     this.search_map = { | 
 |  |  |       client_id: this.editConfig.clientId | 
 |  |  |     } | 
 |  |  |     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 getSaleChanceList() | 
 |  |  |       await getSaleChanceList({ | 
 |  |  |         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) { | 
 |  |  |               const list = res.data.list.map((item) => { | 
 |  |  |                 return { | 
 |  |  |                   ...item | 
 |  |  |                   ...item, | 
 |  |  |                   member_name: item.member.username, | 
 |  |  |                   sale_stage_name: item.sale_stage.name | 
 |  |  |                 } | 
 |  |  |               }) | 
 |  |  |               this.tableData = list.slice(0, 5) || [] | 
 |  |  |               this.tableList.tableInfomation = list || [] | 
 |  |  |               this.pagerOptions.totalCount = res.data.count | 
 |  |  |             } else { | 
 |  |  |               this.tableData = [] | 
 |  |  |               this.tableList.tableInfomation = [] | 
 |  |  |             } | 
 |  |  |           } else { | 
 |  |  |             this.tableData = [] | 
 |  |  |             this.tableList.tableInfomation = [] | 
 |  |  |           } | 
 |  |  |           this.loading = false | 
 |  |  |         }) | 
 |  |  |         .catch((err) => { | 
 |  |  |           console.log(err) | 
 |  |  |           this.tableData = [] | 
 |  |  |           this.tableList.tableInfomation = [] | 
 |  |  |           this.loading = false | 
 |  |  |         }) | 
 |  |  |     }, | 
 |  |  | 
 |  |  |       console.log(row) | 
 |  |  |       this.$emit("selClient", row, "chance") | 
 |  |  |     }, | 
 |  |  |     // 时间显示 | 
 |  |  |     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() | 
 |  |  |     } | 
 |  |  |   } | 
 |  |  | } | 
 |  |  | 
 |  |  | .bg-view { | 
 |  |  |   margin: 10px; | 
 |  |  |   .query-bg { | 
 |  |  |     margin-left: -20px; | 
 |  |  |     margin-bottom: 10px; | 
 |  |  |     display: flex; | 
 |  |  |     justify-content: space-between; | 
 |  |  | 
 |  |  |   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 { |