index.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <template>
  2. <basic-container>
  3. <avue-crud :option="option" :data="data" ref="crud" v-model="form" :page.sync="page"
  4. :permission="permissionList" :before-open="beforeOpen" :table-loading="loading"
  5. @row-update="rowUpdate" @row-save="rowSave" @search-change="searchChange" @search-reset="searchReset"
  6. @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
  7. @refresh-change="refreshChange" @on-load="onLoad">
  8. <template slot="menuLeft">
  9. <el-button type="danger" size="small" plain icon="el-icon-delete" v-if="permission.order_lead_delete"
  10. @click="handleDelete">
  11. 删除
  12. </el-button>
  13. </template>
  14. <template slot="menu" slot-scope="{row}">
  15. <el-button type="text" size="small" icon="el-icon-view" @click="handleView(row)"
  16. v-if="permission.order_lead_view">
  17. 查看
  18. </el-button>
  19. <el-button type="text" size="small" icon="el-icon-edit" @click="handleEdit(row)"
  20. v-if="permission.order_lead_edit">
  21. 编辑
  22. </el-button>
  23. <el-button type="text" size="small" icon="el-icon-document" @click="handleViewDetail(row)">
  24. 详细信息
  25. </el-button>
  26. <el-button type="text" size="small" icon="el-icon-delete" @click="handleRowDelete(row)"
  27. v-if="permission.order_lead_delete">
  28. 删除
  29. </el-button>
  30. </template>
  31. <template slot-scope="{row}" slot="status">
  32. <el-tag :type="getStatusType(row.status)">
  33. {{ getStatusText(row.status) }}
  34. </el-tag>
  35. </template>
  36. <template slot-scope="{row}" slot="priority">
  37. <el-tag :type="getPriorityType(row.priority)">
  38. {{ getPriorityText(row.priority) }}
  39. </el-tag>
  40. </template>
  41. <template slot-scope="{row}" slot="endTime">
  42. <span :class="{ 'text-danger': isOverdue(row.endTime, row.status) }">
  43. {{ row.endTime }}
  44. </span>
  45. </template>
  46. </avue-crud>
  47. <!-- 线索详细信息弹窗 -->
  48. <el-dialog
  49. title="线索详细信息管理"
  50. :visible.sync="detailDialogVisible"
  51. width="80%"
  52. :close-on-click-modal="false"
  53. :destroy-on-close="true"
  54. append-to-body
  55. custom-class="lead-detail-dialog">
  56. <div v-if="currentLead">
  57. <div class="lead-info-flex" style="margin-bottom: 20px;">
  58. <div class="info-row">
  59. <div class="info-item">
  60. <span class="label">线索编码:</span>
  61. <span class="value">{{ currentLead.leadCode }}</span>
  62. </div>
  63. <div class="info-item">
  64. <span class="label">客户名称:</span>
  65. <span class="value">{{ currentLead.customerName }}</span>
  66. </div>
  67. <div class="info-item">
  68. <span class="label">联系人:</span>
  69. <span class="value">{{ currentLead.contactName }}</span>
  70. </div>
  71. </div>
  72. <div class="info-row title-row">
  73. <div class="info-item full-width">
  74. <span class="label">线索标题:</span>
  75. <span class="value title-value">{{ currentLead.title }}</span>
  76. </div>
  77. </div>
  78. </div>
  79. </div>
  80. <avue-crud
  81. :option="detailOption"
  82. :data="detailData"
  83. ref="detailCrud"
  84. v-model="detailForm"
  85. :page.sync="detailPage"
  86. :permission="detailPermissionList"
  87. :before-open="detailBeforeOpen"
  88. :table-loading="detailLoading"
  89. @row-del="detailRowDel"
  90. @row-update="detailRowUpdate"
  91. @row-save="detailRowSave"
  92. @selection-change="detailSelectionChange"
  93. @current-change="detailCurrentChange"
  94. @size-change="detailSizeChange"
  95. @refresh-change="detailRefreshChange"
  96. @on-load="detailOnLoad">
  97. <template slot="menuLeft">
  98. <el-button type="danger" size="small" plain icon="el-icon-delete"
  99. v-if="detailPermissionList.delBtn"
  100. @click="handleDetailDelete" :disabled="detailSelectionList.length === 0">
  101. 删除
  102. </el-button>
  103. </template>
  104. </avue-crud>
  105. </el-dialog>
  106. </basic-container>
  107. </template>
  108. <script>
  109. import leadIndexMixin from './mixins/leadIndex'
  110. export default {
  111. name: 'Lead',
  112. mixins: [leadIndexMixin],
  113. watch: {
  114. detailDialogVisible(visible) {
  115. if (visible) {
  116. this.injectErrorStyle();
  117. } else {
  118. this.removeErrorStyle();
  119. }
  120. }
  121. },
  122. methods: {
  123. injectErrorStyle() {
  124. const styleId = 'lead-error-style';
  125. if (document.getElementById(styleId)) return;
  126. const style = document.createElement('style');
  127. style.id = styleId;
  128. style.textContent = `
  129. .el-form-item__error {
  130. display: block !important;
  131. position: static !important;
  132. margin-top: 4px !important;
  133. white-space: normal !important;
  134. color: #f56c6c !important;
  135. }
  136. `;
  137. document.head.appendChild(style);
  138. },
  139. removeErrorStyle() {
  140. const styleId = 'lead-error-style';
  141. const style = document.getElementById(styleId);
  142. if (style) {
  143. style.remove();
  144. }
  145. }
  146. }
  147. }
  148. </script>
  149. <style lang="scss" scoped>
  150. .text-danger {
  151. color: #f56c6c;
  152. font-weight: bold;
  153. }
  154. .lead-info-desc {
  155. margin-bottom: 20px;
  156. }
  157. .lead-info-flex {
  158. border: 1px solid #EBEEF5;
  159. border-radius: 4px;
  160. padding: 15px;
  161. background-color: #fff;
  162. .info-row {
  163. display: flex;
  164. margin-bottom: 10px;
  165. &:last-child {
  166. margin-bottom: 0;
  167. }
  168. &.title-row {
  169. margin-top: 5px;
  170. }
  171. }
  172. .info-item {
  173. flex: 1;
  174. padding: 0 10px;
  175. &.full-width {
  176. flex: 3;
  177. width: 100%;
  178. }
  179. .label {
  180. font-weight: bold;
  181. color: #606266;
  182. margin-right: 5px;
  183. }
  184. .value {
  185. color: #303133;
  186. &.title-value {
  187. font-size: 16px;
  188. }
  189. }
  190. }
  191. }
  192. // 表格中的优先级和状态样式
  193. ::v-deep .el-table {
  194. .el-tag {
  195. margin: 0;
  196. }
  197. }
  198. // 仅在本组件的弹层内,修正 Element UI 错误提示的定位与显示,确保可见
  199. .el-form-item__error {
  200. display: block !important;
  201. position: static !important;
  202. white-space: normal !important;
  203. color: #f56c6c !important;
  204. }
  205. </style>