index.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792
  1. <template>
  2. <div class="app-container">
  3. <el-card shadow="never" class="search-card">
  4. <el-form :model="queryParams" ref="queryRef" label-width="100px">
  5. <el-row :gutter="24">
  6. <el-col :span="6">
  7. <el-form-item label="所属公司" prop="companyId">
  8. <el-select v-model="queryParams.companyId" placeholder="请选择" style="width: 100%" clearable>
  9. <el-option v-for="item in companyOptions" :key="item.companyCode || item.id"
  10. :label="item.companyName" :value="item.companyCode || item.id" />
  11. </el-select>
  12. </el-form-item>
  13. </el-col>
  14. <el-col :span="6">
  15. <el-form-item label="项目名称" prop="projectName">
  16. <el-input v-model="queryParams.projectName" placeholder="请输入项目名称" clearable />
  17. </el-form-item>
  18. </el-col>
  19. <el-col :span="6">
  20. <el-form-item label="客户名称" prop="customerName">
  21. <el-input v-model="queryParams.customerName" placeholder="请输入客户名称" clearable />
  22. </el-form-item>
  23. </el-col>
  24. <el-col :span="6">
  25. <el-form-item label="业务负责人" prop="managerId">
  26. <el-select v-model="queryParams.managerId" placeholder="请选择" style="width: 100%" clearable>
  27. <el-option v-for="item in userOptions" :key="item.staffId || item.userId"
  28. :label="(item.staffCode || item.userName ? '(' + (item.staffCode || item.userName) + ') ' : '') + (item.staffName || item.nickName)" :value="item.staffId || item.userId" />
  29. </el-select>
  30. </el-form-item>
  31. </el-col>
  32. </el-row>
  33. <el-row :gutter="24">
  34. <el-col :span="6">
  35. <el-form-item label="部门" prop="deptId">
  36. <el-tree-select
  37. v-model="queryParams.deptId"
  38. :data="deptOptions"
  39. :props="{ value: 'deptId', label: 'deptName', children: 'children' }"
  40. value-key="deptId"
  41. placeholder="所属部门"
  42. check-strictly
  43. style="width: 100%"
  44. clearable
  45. />
  46. </el-form-item>
  47. </el-col>
  48. <el-col :span="6">
  49. <el-form-item label="产品支持" prop="productSupport">
  50. <el-select v-model="queryParams.productSupport" placeholder="请选择" style="width: 100%" clearable>
  51. <el-option v-for="item in userOptions" :key="item.staffId || item.userId"
  52. :label="(item.staffCode || item.userName ? '(' + (item.staffCode || item.userName) + ') ' : '') + (item.staffName || item.nickName)" :value="String(item.staffId || item.userId)" />
  53. </el-select>
  54. </el-form-item>
  55. </el-col>
  56. <el-col :span="6">
  57. <el-form-item label="项目状态" prop="projectStatus">
  58. <el-select v-model="queryParams.projectStatus" placeholder="请选择" style="width: 100%" clearable>
  59. <el-option v-for="item in saleStatusOptions" :key="item.value"
  60. :label="item.label" :value="item.value" />
  61. </el-select>
  62. </el-form-item>
  63. </el-col>
  64. <el-col :span="6">
  65. <el-form-item label="成交结果" prop="result">
  66. <el-select v-model="queryParams.result" placeholder="请选择" style="width: 100%" clearable>
  67. <el-option v-for="item in dealResultOptions" :key="item.value"
  68. :label="item.label" :value="item.value" />
  69. </el-select>
  70. </el-form-item>
  71. </el-col>
  72. </el-row>
  73. <el-row :gutter="24">
  74. <el-col :span="6">
  75. <el-form-item label="时间查询类型" prop="timeType">
  76. <el-select v-model="queryParams.timeType" placeholder="请选择" style="width: 100%" clearable>
  77. <el-option v-for="item in timeQueryTypeOptions" :key="item.value"
  78. :label="item.label" :value="item.value" />
  79. </el-select>
  80. </el-form-item>
  81. </el-col>
  82. <el-col :span="8">
  83. <el-form-item label="时间范围" prop="dateRange">
  84. <el-date-picker v-model="dateRange" type="daterange" range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间" style="width: 100%" value-format="YYYY-MM-DD" />
  85. </el-form-item>
  86. </el-col>
  87. <el-col :span="10">
  88. <el-form-item label-width="0">
  89. <div class="search-btns">
  90. <el-button type="primary" icon="Search" @click="handleQuery" :loading="loading">搜索</el-button>
  91. <el-button icon="Refresh" @click="resetQuery" :disabled="loading">重置</el-button>
  92. <el-button type="primary" icon="Plus" @click="handleAdd" class="btn-new">新增</el-button>
  93. </div>
  94. </el-form-item>
  95. </el-col>
  96. </el-row>
  97. </el-form>
  98. </el-card>
  99. <el-card shadow="never" class="table-card">
  100. <div class="filter-action-bar-inner">
  101. <!-- 页面标题 -->
  102. <div class="page-title">项目商机信息列表</div>
  103. <!-- 分类筛选点击项 -->
  104. <div class="tab-filters">
  105. <div class="tab-btn" :class="{ active: activeTab === 'managed' }" @click="handleTabClick('managed')">我负责的项目商机</div>
  106. <div class="tab-btn" :class="{ active: activeTab === 'participated' }" @click="handleTabClick('participated')">我参与的项目商机</div>
  107. <div class="tab-btn badge-btn" :class="{ active: activeTab === 'all' }" @click="handleTabClick('all')">
  108. 全部项目商机
  109. <span class="badge" v-if="allCount > 0">{{ allCount > 99 ? '99+' : allCount }}</span>
  110. </div>
  111. </div>
  112. <!-- 金额汇总 -->
  113. <div class="amount-summary">
  114. 金额总计<span class="red-num">{{ totalAmount ? totalAmount.toFixed(2) : '0.00' }}</span>(万)
  115. </div>
  116. <!-- 操作按钮(靠右) -->
  117. <div class="right-actions">
  118. <el-button type="info" size="small" icon="Delete" :disabled="multipleSelection.length === 0" @click="handleBatchDelete">批量删除</el-button>
  119. <el-button type="primary" size="small" icon="Switch" :disabled="multipleSelection.length === 0" @click="handleTransfer">转移给他人</el-button>
  120. </div>
  121. </div>
  122. <el-table ref="opportunityTable" v-loading="loading" :data="opportunityList" border class="standard-table" @selection-change="handleSelectionChange">
  123. <el-table-column type="selection" width="50" align="center" fixed />
  124. <el-table-column label="项目名称" align="center" prop="projectName" min-width="240" show-overflow-tooltip fixed />
  125. <el-table-column label="所属公司" align="center" prop="companyName" min-width="150" />
  126. <el-table-column label="客户名称" align="center" prop="customerName" min-width="200" show-overflow-tooltip />
  127. <el-table-column label="行业" align="center" width="100">
  128. <template #default="{ row }">
  129. <span>{{ findIndustryName(row.industry || row.profession) }}</span>
  130. </template>
  131. </el-table-column>
  132. <el-table-column label="部门" align="center" prop="deptName" width="100" />
  133. <el-table-column label="金额(万)" align="center" prop="projectBudget" width="100">
  134. <template #default="{ row }">
  135. <span>{{ row.projectBudget != null ? Number(row.projectBudget).toFixed(2) : '' }}</span>
  136. </template>
  137. </el-table-column>
  138. <el-table-column label="赢单率" align="center" prop="winRate" width="100">
  139. <template #default="{ row }">
  140. <span>{{ row.winRate != null ? `${row.winRate}%` : '' }}</span>
  141. </template>
  142. </el-table-column>
  143. <el-table-column label="项目级别" align="center" prop="projectLevel" width="100">
  144. <template #default="{ row }">
  145. <span>{{ findProjectLevelName(row.projectLevel) }}</span>
  146. </template>
  147. </el-table-column>
  148. <el-table-column label="业务负责人" align="center" prop="leader" min-width="100">
  149. <template #default="{ row }">
  150. <span>{{ findUserName(row.leader) }}</span>
  151. </template>
  152. </el-table-column>
  153. <el-table-column label="产品支持" align="center" prop="productSupportName" min-width="100">
  154. <template #default="{ row }">
  155. <span>{{ row.productSupportName || findUserName(row.productSupport) }}</span>
  156. </template>
  157. </el-table-column>
  158. <el-table-column label="创建时间" align="center" prop="createTime" width="110">
  159. <template #default="scope">
  160. <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
  161. </template>
  162. </el-table-column>
  163. <el-table-column label="立项时间" align="center" prop="approvalDate" width="110">
  164. <template #default="scope">
  165. <span>{{ parseTime(scope.row.approvalDate, '{y}-{m}-{d}') }}</span>
  166. </template>
  167. </el-table-column>
  168. <el-table-column label="截止时间" align="center" prop="expectedCompletionTime" width="110">
  169. <template #default="scope">
  170. <span>{{ parseTime(scope.row.expectedCompletionTime, '{y}-{m}-{d}') }}</span>
  171. </template>
  172. </el-table-column>
  173. <el-table-column label="项目状态" align="center" prop="statusName" width="100">
  174. <template #default="{ row }">
  175. <span :class="getStatusClass(row.status)">
  176. {{ row.statusName }}
  177. </span>
  178. </template>
  179. </el-table-column>
  180. <el-table-column label="成交结果" align="center" prop="dealResult" width="100">
  181. <template #default="{ row }">
  182. <span :style="{ color: row.dealResult === '赢单' ? '#67c23a' : row.dealResult === '丢单' ? '#f56c6c' : '' }">
  183. {{ row.dealResult }}
  184. </span>
  185. </template>
  186. </el-table-column>
  187. <el-table-column label="操作" align="center" width="200" fixed="right">
  188. <template #default="scope">
  189. <el-button link type="info" @click="handleProgress(scope.row)">详情</el-button>
  190. <el-button link type="primary" @click="handleProgressBtn(scope.row)">进度</el-button>
  191. <el-button link type="info" @click="handleDelete(scope.row)">删除</el-button>
  192. </template>
  193. </el-table-column>
  194. </el-table>
  195. <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
  196. </el-card>
  197. <!-- 弹窗:转移他人 -->
  198. <el-dialog title="是否将选中的项目商机转移其他业务负责人?" v-model="transferVisible" width="550px" append-to-body>
  199. <el-form label-width="100px" style="padding: 20px 0;">
  200. <el-form-item label="新业务负责人:" required>
  201. <el-select v-model="transferOwner" placeholder="请选择" style="width: 100%">
  202. <el-option v-for="item in userOptions" :key="item.staffId || item.userId"
  203. :label="(item.staffCode || item.userName ? '(' + (item.staffCode || item.userName) + ') ' : '') + (item.staffName || item.nickName)" :value="String(item.staffId || item.userId)" />
  204. </el-select>
  205. </el-form-item>
  206. <el-form-item class="label-nowrap">
  207. <el-checkbox v-model="keepAsMember">保留【业务负责人】为销售团队成员</el-checkbox>
  208. </el-form-item>
  209. </el-form>
  210. <template #footer>
  211. <div class="dialog-footer">
  212. <el-button type="primary" @click="confirmTransfer">确认</el-button>
  213. <el-button @click="transferVisible = false">取消</el-button>
  214. </div>
  215. </template>
  216. </el-dialog>
  217. <!-- 新增弹窗 -->
  218. <OpportunityAdd
  219. v-model="addVisible"
  220. :company-options="companyOptions"
  221. :user-options="userOptions"
  222. :project-level-options="projectLevelOptions"
  223. :procurement-method-options="procurementMethodOptions"
  224. :info-source-options="infoSourceOptions"
  225. :marketing-activity-options="marketingActivityOptions"
  226. @success="getList"
  227. />
  228. <!-- 编辑弹窗 -->
  229. <OpportunityEdit
  230. v-model="editVisible"
  231. :id="currentId"
  232. :company-options="companyOptions"
  233. :user-options="userOptions"
  234. :project-level-options="projectLevelOptions"
  235. :procurement-method-options="procurementMethodOptions"
  236. :info-source-options="infoSourceOptions"
  237. :marketing-activity-options="marketingActivityOptions"
  238. @success="getList"
  239. />
  240. <!-- 详情抽屉 -->
  241. <OpportunityDetail
  242. ref="detailDrawerRef"
  243. v-model="detailVisible"
  244. :id="currentId"
  245. :saleStatusOptions="saleStatusOptions"
  246. :projectLevelOptions="projectLevelOptions"
  247. :infoSourceOptions="infoSourceOptions"
  248. :procurementMethodOptions="procurementMethodOptions"
  249. @edit="onDetailEdit"
  250. @success="getList"
  251. />
  252. <!-- 查看进度抽屉 -->
  253. <el-drawer title="查看进度" v-model="progressVisible" size="500px" direction="rtl" destroy-on-close class="progress-drawer">
  254. <div class="progress-container">
  255. <div class="progress-input-area">
  256. <el-input
  257. v-model="progressContent"
  258. type="textarea"
  259. :rows="4"
  260. placeholder="请输入进度描述"
  261. maxlength="500"
  262. show-word-limit
  263. resize="none"
  264. />
  265. <div class="publish-btn-wrap">
  266. <el-button type="primary" icon="Plus" @click="submitProgress" :loading="progressSubmitting">发 布</el-button>
  267. </div>
  268. </div>
  269. <div class="progress-list-area" v-loading="progressLoading">
  270. <div v-for="(item, index) in progressList" :key="index" class="progress-item">
  271. <div class="item-header">
  272. <span class="user-name">{{ item.userName || item.createBy }}</span>
  273. <span class="time">{{ item.time || item.createTime }}</span>
  274. </div>
  275. <div class="item-content">{{ item.content || item.followUpCondition }}</div>
  276. </div>
  277. <div v-if="progressList.length === 0 && !progressLoading" class="empty-text">暂无进度数据</div>
  278. </div>
  279. <div class="progress-pagination">
  280. <el-pagination
  281. v-if="progressTotal > 0"
  282. v-model:current-page="progressPage"
  283. v-model:page-size="progressPageSize"
  284. layout="prev, pager, next"
  285. :total="progressTotal"
  286. @current-change="loadProgress"
  287. small
  288. />
  289. </div>
  290. </div>
  291. </el-drawer>
  292. </div>
  293. </template>
  294. <script setup name="ProjectOpportunity">
  295. import { ref, reactive, onMounted, getCurrentInstance, toRefs } from 'vue';
  296. import { useDebounceFn } from '@vueuse/core';
  297. import { listOpportunity, delOpportunity, transferOpportunity } from '@/api/saleManage/opportunity/index';
  298. import { listComStaff } from "@/api/system/comStaff/index";
  299. import { listCompanyOption, listCustomerInfo } from "@/api/customer/customerInfo/index";
  300. import { listDept } from "@/api/system/dept/index";
  301. import { listIndustryCategory } from "@/api/customer/industryCategory";
  302. import { listRecord, addRecord } from "@/api/visit/record";
  303. import OpportunityAdd from './add.vue';
  304. import OpportunityEdit from './edit.vue';
  305. import OpportunityDetail from './detail.vue';
  306. const detailDrawerRef = ref(null);
  307. const proxy = getCurrentInstance().proxy;
  308. const { parseTime } = proxy.useDict ? { parseTime: proxy.parseTime } : proxy;
  309. /* ========== 状态 ========== */
  310. const loading = ref(false);
  311. const total = ref(0);
  312. const opportunityList = ref([]);
  313. const dateRange = ref([]);
  314. const multipleSelection = ref([]);
  315. const totalAmount = ref(0);
  316. const allCount = ref(0);
  317. /* ========== 下拉选项 ========== */
  318. const companyOptions = ref([]);
  319. const userOptions = ref([]);
  320. const deptOptions = ref([]);
  321. const industryOptions = ref([]);
  322. const {
  323. J0001: saleStatusOptions,
  324. time_query_type: timeQueryTypeOptions,
  325. L0001: projectLevelOptions,
  326. X0001: procurementMethodOptions,
  327. X0002: infoSourceOptions,
  328. deal_result: dealResultOptions
  329. } = toRefs(reactive(proxy.useDict('J0001', 'time_query_type', 'L0001', 'X0001', 'X0002', 'deal_result')));
  330. const marketingActivityOptions = ref([]);
  331. /* ========== 弹窗状态 ========== */
  332. const addVisible = ref(false);
  333. const editVisible = ref(false);
  334. const detailVisible = ref(false);
  335. const currentId = ref(undefined);
  336. const currentProjectNo = ref(undefined);
  337. const transferVisible = ref(false);
  338. const transferOwner = ref('');
  339. const keepAsMember = ref(false);
  340. /* ========== 进度弹窗状态 ========== */
  341. const progressVisible = ref(false);
  342. const progressLoading = ref(false);
  343. const progressSubmitting = ref(false);
  344. const progressContent = ref('');
  345. const progressList = ref([]);
  346. const progressTotal = ref(0);
  347. const progressPage = ref(1);
  348. const progressPageSize = ref(5);
  349. /* ========== Tab切换状态 ========== */
  350. const activeTab = ref('all');
  351. const handleTabClick = (tab) => {
  352. activeTab.value = tab;
  353. handleQuery();
  354. };
  355. /* ========== 查询参数 ========== */
  356. const queryParams = reactive({
  357. pageNum: 1, pageSize: 10,
  358. companyId: undefined, projectName: undefined, customerName: undefined,
  359. managerId: undefined, deptId: undefined, productSupport: undefined,
  360. projectStatus: undefined, result: undefined, timeType: undefined
  361. });
  362. /* ========== 列表查询 ========== */
  363. const getList = async () => {
  364. loading.value = true;
  365. try {
  366. const params = proxy.addDateRange(
  367. { pageNum: queryParams.pageNum, pageSize: queryParams.pageSize,
  368. projectType: '销售商机', companyNo: queryParams.companyId,
  369. projectName: queryParams.projectName, customerName: queryParams.customerName,
  370. leader: queryParams.managerId, deptNo: queryParams.deptId,
  371. productSupport: queryParams.productSupport,
  372. status: queryParams.projectStatus,
  373. result: queryParams.result,
  374. dealResult: queryParams.result,
  375. timeType: queryParams.timeType,
  376. tabType: activeTab.value === 'list' ? undefined : activeTab.value
  377. },
  378. dateRange.value
  379. );
  380. const res = await listOpportunity(params);
  381. opportunityList.value = res.rows || [];
  382. total.value = res.total || 0;
  383. // 异步获取全部项目商机的总数用于红点显示
  384. try {
  385. const allRes = await listOpportunity({
  386. projectType: '销售商机',
  387. tabType: 'all',
  388. pageNum: 1,
  389. pageSize: 1
  390. });
  391. allCount.value = allRes.total || 0;
  392. } catch (e) { console.error('获取商机总数失败', e); }
  393. totalAmount.value = opportunityList.value.reduce((acc, cur) => acc + (Number(cur.projectBudget) || 0), 0);
  394. } catch (err) { console.error(err); }
  395. finally { loading.value = false; }
  396. };
  397. const handleQuery = useDebounceFn(() => { queryParams.pageNum = 1; getList(); }, 300);
  398. const resetQuery = useDebounceFn(() => { dateRange.value = []; proxy.resetForm('queryRef'); handleQuery(); }, 300);
  399. const handleSelectionChange = (selection) => { multipleSelection.value = selection; };
  400. /* ========== 按钮操作 ========== */
  401. const handleAdd = () => { addVisible.value = true; };
  402. const handleUpdate = (row) => { currentId.value = row.id; editVisible.value = true; };
  403. const onDetailEdit = (row) => { currentId.value = row.id; editVisible.value = true; };
  404. /* ========== 转移 ========== */
  405. const handleTransfer = () => {
  406. if (!multipleSelection.value.length) return proxy.$modal.msgWarning('请先选择项目');
  407. transferOwner.value = ''; keepAsMember.value = true; transferVisible.value = true;
  408. };
  409. const confirmTransfer = async () => {
  410. if (!transferOwner.value) return proxy.$modal.msgWarning('请选择新业务负责人');
  411. const ids = multipleSelection.value.map(item => item.id);
  412. const ownerUser = userOptions.value.find(u => u.staffId == transferOwner.value || u.userId == transferOwner.value);
  413. try {
  414. await transferOpportunity({
  415. ids,
  416. leader: transferOwner.value,
  417. leaderName: ownerUser?.staffName || ownerUser?.nickName || '',
  418. keepOldOwner: keepAsMember.value ? 1 : 0
  419. });
  420. proxy.$modal.msgSuccess('转移成功');
  421. transferVisible.value = false;
  422. getList();
  423. } catch (e) {}
  424. };
  425. /* ========== 详情 ========== */
  426. const handleProgress = (row) => {
  427. if (detailDrawerRef.value) {
  428. detailDrawerRef.value.open(row);
  429. }
  430. };
  431. const handleProgressBtn = (row) => {
  432. currentId.value = row.id;
  433. currentProjectNo.value = row.projectNo || row.id;
  434. progressContent.value = '';
  435. progressPage.value = 1;
  436. progressVisible.value = true;
  437. loadProgress();
  438. };
  439. const loadProgress = async () => {
  440. if (!currentProjectNo.value) return;
  441. progressLoading.value = true;
  442. try {
  443. const res = await listRecord({
  444. objectNo: currentProjectNo.value,
  445. dataType: '1', // 对应项目商机
  446. pageNum: progressPage.value,
  447. pageSize: progressPageSize.value
  448. });
  449. progressList.value = res.rows || [];
  450. progressTotal.value = res.total || 0;
  451. } catch (e) {
  452. console.error('获取进度失败', e);
  453. } finally {
  454. progressLoading.value = false;
  455. }
  456. };
  457. const submitProgress = async () => {
  458. if (!progressContent.value.trim()) return proxy.$modal.msgWarning('请输入进度描述');
  459. progressSubmitting.value = true;
  460. try {
  461. await addRecord({
  462. objectNo: currentProjectNo.value,
  463. customerNo: currentProjectNo.value,
  464. dataType: '1',
  465. followUpCondition: progressContent.value,
  466. callDate: new Date().toISOString().split('T')[0],
  467. visitor: proxy.$store?.state?.user?.userId || '', // 这里可能需要更准确的获取方式,暂定
  468. callTypeCode: '1' // 默认为电话/普通记录
  469. });
  470. proxy.$modal.msgSuccess('发布成功');
  471. progressContent.value = '';
  472. progressPage.value = 1;
  473. loadProgress();
  474. } catch (e) {
  475. console.error('发布进度失败', e);
  476. } finally {
  477. progressSubmitting.value = false;
  478. }
  479. };
  480. /* ========== 删除 ========== */
  481. const handleDelete = (row) =>
  482. proxy.$modal.confirm(`确认删除项目「${row.projectName}」吗?`).then(async () => {
  483. try { await delOpportunity(row.id); getList(); proxy.$modal.msgSuccess('删除成功'); } catch (e) {}
  484. }).catch(() => {});
  485. const handleBatchDelete = () => {
  486. if (!multipleSelection.value.length) return proxy.$modal.msgWarning('请先选择要删除的项目');
  487. const ids = multipleSelection.value.map(i => i.id);
  488. proxy.$modal.confirm(`确认批量删除选中的 ${ids.length} 条项目商机吗?`).then(async () => {
  489. try {
  490. await delOpportunity(ids);
  491. getList();
  492. proxy.$modal.msgSuccess('批量删除成功');
  493. } catch (e) {}
  494. }).catch(() => {});
  495. };
  496. /* ========== 辅助方法 ========== */
  497. const getSaleStatusLabel = (status) => {
  498. if (!saleStatusOptions.value || saleStatusOptions.value.length === 0) return status;
  499. const item = saleStatusOptions.value.find(i => String(i.value) === String(status));
  500. return item ? item.label : status;
  501. };
  502. const getStatusClass = (status) => {
  503. if (String(status) === '1') return 'status-tag status-success';
  504. if (String(status) === '0') return 'status-tag status-following';
  505. if (!saleStatusOptions.value || saleStatusOptions.value.length === 0) return 'status-tag status-following';
  506. const item = saleStatusOptions.value.find(i => String(i.value) === String(status));
  507. if (item && (item.listClass === 'success' || item.label === '结案')) return 'status-tag status-success';
  508. return 'status-tag status-following';
  509. };
  510. const findProjectLevelName = (id) => {
  511. if (!id) return '';
  512. return projectLevelOptions.value.find(i => String(i.value) === String(id))?.label || id;
  513. };
  514. /* ========== 加载选项列表 ========== */
  515. function getCompanyList() { listCompanyOption().then(r => companyOptions.value = r.data); }
  516. function getUserList() { listComStaff({ pageSize: 1000 }).then(r => userOptions.value = r.rows || r.data || []); }
  517. function getDeptList() { listDept().then(r => deptOptions.value = proxy.handleTree(r.data, 'deptId')); }
  518. const findIndustryName = (val) => {
  519. if (!val) return '';
  520. // 处理可能的多个 ID(以逗号分隔)
  521. const ids = String(val).split(',').filter(Boolean);
  522. if (ids.length > 1) {
  523. return ids.map(id => {
  524. return industryOptions.value.find(i => String(i.id) === String(id))?.industryCategoryName || id;
  525. }).join('、');
  526. }
  527. return industryOptions.value.find(i => String(i.id) === String(val))?.industryCategoryName || val;
  528. };
  529. const findUserName = (id) => {
  530. if (!id) return '';
  531. const user = userOptions.value.find(u => String(u.staffId || u.userId) === String(id));
  532. return user ? (user.staffName || user.nickName) : id;
  533. };
  534. function getIndustryList() { listIndustryCategory().then(r => industryOptions.value = r.data || r.rows || []); }
  535. onMounted(() => {
  536. getList(); getCompanyList(); getUserList(); getDeptList();
  537. getIndustryList();
  538. });
  539. </script>
  540. <style scoped lang="scss">
  541. .app-container {
  542. padding: 20px;
  543. background-color: #f7f9fb;
  544. min-height: calc(100vh - 84px);
  545. /* 全局强制取消加粗 */
  546. :deep(*) {
  547. font-weight: 400 !important;
  548. }
  549. }
  550. .search-card {
  551. margin-bottom: 10px;
  552. border: none;
  553. background: #fff;
  554. border-radius: 8px;
  555. :deep(.el-form-item) { margin-bottom: 10px; }
  556. :deep(.el-form-item__label) {
  557. white-space: nowrap;
  558. font-weight: normal !important;
  559. }
  560. }
  561. .search-btns {
  562. display: flex; align-items: center; justify-content: flex-start; gap: 12px;
  563. .el-button { border-radius: 6px; height: 32px; padding: 8px 16px; }
  564. }
  565. .filter-action-bar-inner {
  566. display: flex;
  567. align-items: center;
  568. padding: 15px 0 20px 0;
  569. gap: 15px;
  570. }
  571. .page-title {
  572. font-size: 16px;
  573. color: #333;
  574. font-weight: normal;
  575. }
  576. .tab-filters {
  577. display: flex;
  578. gap: 10px;
  579. }
  580. .tab-btn {
  581. padding: 6px 15px;
  582. border: 1px solid #dcdfe6;
  583. border-radius: 4px;
  584. font-size: 14px;
  585. color: #606266;
  586. cursor: pointer;
  587. transition: all 0.2s;
  588. background: #fff;
  589. font-weight: normal;
  590. }
  591. .tab-btn:hover {
  592. color: #409eff;
  593. border-color: #c6e2ff;
  594. background-color: #ecf5ff;
  595. }
  596. .tab-btn.active {
  597. color: #409eff;
  598. border-color: #409eff;
  599. background-color: #ecf5ff;
  600. }
  601. .badge-btn {
  602. position: relative;
  603. }
  604. .badge-btn .badge {
  605. position: absolute;
  606. top: -8px;
  607. right: -12px;
  608. background: #f56c6c;
  609. color: #fff;
  610. font-size: 12px;
  611. padding: 2px 6px;
  612. border-radius: 10px;
  613. line-height: 1;
  614. transform: scale(0.85);
  615. }
  616. .amount-summary {
  617. font-size: 14px;
  618. color: #f56c6c;
  619. }
  620. .amount-summary .red-num { font-size: 16px; font-weight: normal; margin: 0 4px; }
  621. .right-actions {
  622. margin-left: auto;
  623. display: flex;
  624. gap: 10px;
  625. }
  626. .table-card { border: none; }
  627. .standard-table {
  628. :deep(th.el-table__cell) { background-color: #f8fafc !important; color: #475569; font-weight: normal; }
  629. :deep(.el-table__cell) { font-weight: normal !important; }
  630. }
  631. .dialog-footer { display: flex; justify-content: center; gap: 20px; padding-bottom: 10px; }
  632. .label-nowrap { :deep(.el-form-item__label) { white-space: nowrap !important; } }
  633. :global(.el-select-dropdown__item) {
  634. color: #333 !important;
  635. &.selected,
  636. &.is-selected {
  637. color: #333 !important;
  638. font-weight: normal !important;
  639. }
  640. }
  641. /* 查看进度抽屉样式 */
  642. .progress-drawer {
  643. :deep(.el-drawer__header) {
  644. border-bottom: 1px solid #f2f3f5;
  645. margin-bottom: 0;
  646. padding: 15px 20px;
  647. color: #1d2129;
  648. font-weight: 500;
  649. }
  650. :deep(.el-drawer__body) { padding: 0; }
  651. .progress-container {
  652. height: 100%;
  653. display: flex;
  654. flex-direction: column;
  655. padding: 20px;
  656. }
  657. .progress-input-area {
  658. margin-bottom: 20px;
  659. :deep(.el-textarea__inner) {
  660. background-color: #fff;
  661. border-color: #e5e6eb;
  662. border-radius: 4px;
  663. padding: 10px 12px;
  664. font-size: 13px;
  665. &:focus { border-color: #409eff; }
  666. }
  667. .publish-btn-wrap {
  668. margin-top: 15px;
  669. display: flex;
  670. justify-content: flex-end;
  671. }
  672. }
  673. .progress-list-area {
  674. flex: 1;
  675. overflow-y: auto;
  676. &::-webkit-scrollbar { display: none; }
  677. -ms-overflow-style: none;
  678. scrollbar-width: none;
  679. .progress-item {
  680. margin-bottom: 20px;
  681. .item-header {
  682. display: flex;
  683. align-items: center;
  684. margin-bottom: 8px;
  685. .user-name { font-size: 14px; color: #333; margin-right: 15px; }
  686. .time { font-size: 14px; color: #333; }
  687. }
  688. .item-content {
  689. font-size: 14px;
  690. color: #333;
  691. line-height: 1.6;
  692. }
  693. }
  694. .empty-text { text-align: center; color: #999; padding: 40px 0; font-size: 13px; }
  695. }
  696. .progress-pagination {
  697. display: flex;
  698. justify-content: flex-end;
  699. margin-top: 10px;
  700. }
  701. }
  702. /* 状态标签通用样式 */
  703. .status-tag {
  704. display: inline-block;
  705. padding: 1px 8px;
  706. border-radius: 4px;
  707. font-size: 12px;
  708. line-height: 18px;
  709. border: 1px solid transparent;
  710. }
  711. /* 跟进中 - 蓝色 */
  712. .status-following {
  713. background-color: #eaf5ff;
  714. color: #1890ff;
  715. border-color: #badeff;
  716. }
  717. /* 结案/成功 - 绿色 */
  718. .status-success {
  719. background-color: #e8ffea;
  720. color: #00b42a;
  721. border-color: #aff0b5;
  722. }
  723. </style>