| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227 |
- <template>
- <basic-container>
- <avue-crud :option="option" :data="data" ref="crud" v-model="form" :page.sync="page"
- :permission="permissionList" :before-open="beforeOpen" :table-loading="loading"
- @row-update="rowUpdate" @row-save="rowSave" @search-change="searchChange" @search-reset="searchReset"
- @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
- @refresh-change="refreshChange" @on-load="onLoad">
- <template slot="menuLeft">
- <el-button type="danger" size="small" plain icon="el-icon-delete" v-if="permission.order_lead_delete"
- @click="handleDelete">
- 删除
- </el-button>
- </template>
- <template slot="menu" slot-scope="{row}">
- <el-button type="text" size="small" icon="el-icon-view" @click="handleView(row)"
- v-if="permission.order_lead_view">
- 查看
- </el-button>
- <el-button type="text" size="small" icon="el-icon-edit" @click="handleEdit(row)"
- v-if="permission.order_lead_edit">
- 编辑
- </el-button>
- <el-button type="text" size="small" icon="el-icon-document" @click="handleViewDetail(row)">
- 详细信息
- </el-button>
- <el-button type="text" size="small" icon="el-icon-delete" @click="handleRowDelete(row)"
- v-if="permission.order_lead_delete">
- 删除
- </el-button>
- </template>
- <template slot-scope="{row}" slot="status">
- <el-tag :type="getStatusType(row.status)">
- {{ getStatusText(row.status) }}
- </el-tag>
- </template>
- <template slot-scope="{row}" slot="priority">
- <el-tag :type="getPriorityType(row.priority)">
- {{ getPriorityText(row.priority) }}
- </el-tag>
- </template>
- <template slot-scope="{row}" slot="endTime">
- <span :class="{ 'text-danger': isOverdue(row.endTime, row.status) }">
- {{ row.endTime }}
- </span>
- </template>
- </avue-crud>
- <!-- 线索详细信息弹窗 -->
- <el-dialog
- title="线索详细信息管理"
- :visible.sync="detailDialogVisible"
- width="80%"
- :close-on-click-modal="false"
- :destroy-on-close="true"
- append-to-body
- custom-class="lead-detail-dialog">
- <div v-if="currentLead">
- <div class="lead-info-flex" style="margin-bottom: 20px;">
- <div class="info-row">
- <div class="info-item">
- <span class="label">线索编码:</span>
- <span class="value">{{ currentLead.leadCode }}</span>
- </div>
- <div class="info-item">
- <span class="label">客户名称:</span>
- <span class="value">{{ currentLead.customerName }}</span>
- </div>
- <div class="info-item">
- <span class="label">联系人:</span>
- <span class="value">{{ currentLead.contactName }}</span>
- </div>
- </div>
- <div class="info-row title-row">
- <div class="info-item full-width">
- <span class="label">线索标题:</span>
- <span class="value title-value">{{ currentLead.title }}</span>
- </div>
- </div>
- </div>
- </div>
- <avue-crud
- :option="detailOption"
- :data="detailData"
- ref="detailCrud"
- v-model="detailForm"
- :page.sync="detailPage"
- :permission="detailPermissionList"
- :before-open="detailBeforeOpen"
- :table-loading="detailLoading"
- @row-del="detailRowDel"
- @row-update="detailRowUpdate"
- @row-save="detailRowSave"
- @selection-change="detailSelectionChange"
- @current-change="detailCurrentChange"
- @size-change="detailSizeChange"
- @refresh-change="detailRefreshChange"
- @on-load="detailOnLoad">
- <template slot="menuLeft">
- <el-button type="danger" size="small" plain icon="el-icon-delete"
- v-if="detailPermissionList.delBtn"
- @click="handleDetailDelete" :disabled="detailSelectionList.length === 0">
- 删除
- </el-button>
- </template>
- </avue-crud>
- </el-dialog>
- </basic-container>
- </template>
- <script>
- import leadIndexMixin from './mixins/leadIndex'
- export default {
- name: 'Lead',
- mixins: [leadIndexMixin],
- watch: {
- detailDialogVisible(visible) {
- if (visible) {
- this.injectErrorStyle();
- } else {
- this.removeErrorStyle();
- }
- }
- },
- methods: {
- injectErrorStyle() {
- const styleId = 'lead-error-style';
- if (document.getElementById(styleId)) return;
- const style = document.createElement('style');
- style.id = styleId;
- style.textContent = `
- .el-form-item__error {
- display: block !important;
- position: static !important;
- margin-top: 4px !important;
- white-space: normal !important;
- color: #f56c6c !important;
- }
- `;
- document.head.appendChild(style);
- },
- removeErrorStyle() {
- const styleId = 'lead-error-style';
- const style = document.getElementById(styleId);
- if (style) {
- style.remove();
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .text-danger {
- color: #f56c6c;
- font-weight: bold;
- }
- .lead-info-desc {
- margin-bottom: 20px;
- }
- .lead-info-flex {
- border: 1px solid #EBEEF5;
- border-radius: 4px;
- padding: 15px;
- background-color: #fff;
- .info-row {
- display: flex;
- margin-bottom: 10px;
- &:last-child {
- margin-bottom: 0;
- }
- &.title-row {
- margin-top: 5px;
- }
- }
- .info-item {
- flex: 1;
- padding: 0 10px;
- &.full-width {
- flex: 3;
- width: 100%;
- }
- .label {
- font-weight: bold;
- color: #606266;
- margin-right: 5px;
- }
- .value {
- color: #303133;
- &.title-value {
- font-size: 16px;
- }
- }
- }
- }
- // 表格中的优先级和状态样式
- ::v-deep .el-table {
- .el-tag {
- margin: 0;
- }
- }
- // 仅在本组件的弹层内,修正 Element UI 错误提示的定位与显示,确保可见
- .el-form-item__error {
- display: block !important;
- position: static !important;
- white-space: normal !important;
- color: #f56c6c !important;
- }
- </style>
|