index.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952
  1. <!-- 商机-列表 -->
  2. <template>
  3. <div class="app-container">
  4. <el-form
  5. :model="queryParams"
  6. ref="queryForm"
  7. size="mini"
  8. :inline="true"
  9. v-show="showSearch"
  10. >
  11. <el-form-item label="商机名称" prop="boName">
  12. <el-input
  13. size="mini"
  14. v-model="queryParams.boName"
  15. clearable
  16. @keyup.enter.native="handleQuery"
  17. />
  18. </el-form-item>
  19. <el-form-item label="客户名称" prop="customerName">
  20. <el-input
  21. size="mini"
  22. v-model="queryParams.customerName"
  23. clearable
  24. @keyup.enter.native="handleQuery"
  25. />
  26. </el-form-item>
  27. <el-form-item label="商机负责人" prop="principalName">
  28. <el-input
  29. size="mini"
  30. v-model="queryParams.principalName"
  31. clearable
  32. @keyup.enter.native="handleQuery"
  33. />
  34. </el-form-item>
  35. <el-form-item label="商机类型" prop="boType">
  36. <el-select
  37. size="mini"
  38. v-model="queryParams.boType"
  39. @change="boTypeChange"
  40. placeholder=""
  41. clearable
  42. >
  43. <el-option
  44. v-for="dict in dict.type.mk_bo_type"
  45. :key="dict.value"
  46. :label="dict.label"
  47. :value="dict.value"
  48. ></el-option>
  49. </el-select>
  50. </el-form-item>
  51. <el-form-item label="商机阶段" prop="boStage">
  52. <el-select size="mini" v-model="queryParams.boStage" placeholder="" clearable>
  53. <el-option
  54. v-for="item in mk_bo_stage"
  55. :key="item.code"
  56. :label="item.name"
  57. :value="item.code"
  58. ></el-option>
  59. </el-select>
  60. </el-form-item>
  61. <el-form-item size="mini" label="商机来源" prop="boSource">
  62. <el-select v-model="queryParams.boSource" placeholder="" clearable>
  63. <el-option
  64. v-for="dict in dict.type.mk_bo_source"
  65. :key="dict.value"
  66. :label="dict.label"
  67. :value="dict.value"
  68. ></el-option>
  69. </el-select>
  70. </el-form-item>
  71. <el-form-item label="赢单状态" prop="winningState">
  72. <el-select v-model="queryParams.winningState" placeholder="" clearable>
  73. <el-option
  74. v-for="dict in dict.type.mk_bo_winstate"
  75. :key="dict.value"
  76. :label="dict.label"
  77. :value="dict.value"
  78. ></el-option>
  79. </el-select>
  80. </el-form-item>
  81. <el-form-item label="创建时间">
  82. <el-date-picker
  83. size="mini"
  84. v-model="dateRange"
  85. style="width: 240px"
  86. value-format="yyyy-MM-dd"
  87. type="daterange"
  88. range-separator="-"
  89. :picker-options="pickerOptions"
  90. ></el-date-picker>
  91. </el-form-item>
  92. <el-form-item>
  93. <el-button
  94. type="primary"
  95. icon="el-icon-search"
  96. size="mini"
  97. @click="handleQuery"
  98. >搜索</el-button
  99. >
  100. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
  101. >重置</el-button
  102. >
  103. </el-form-item>
  104. </el-form>
  105. <div class="btn_grooup">
  106. <el-button
  107. type="primary"
  108. plain
  109. icon="el-icon-plus"
  110. size="mini"
  111. @click="handleAdd"
  112. >新增</el-button
  113. >
  114. </div>
  115. <el-table
  116. v-loading="loading"
  117. :data="basicList"
  118. @selection-change="handleSelectionChange"
  119. @cell-dblclick="enterDetails"
  120. :height="height"
  121. size="mini"
  122. >
  123. <el-table-column
  124. width="150"
  125. label="编号"
  126. align="center"
  127. prop="boCode"
  128. />
  129. <el-table-column label="商机名称" show-overflow-tooltip width="300" align="center" prop="boName" />
  130. <el-table-column label="商机类型" width="150" align="center" prop="boType">
  131. <template slot-scope="scope">
  132. <dict-tag :options="dict.type.mk_bo_type" :value="scope.row.boType" />
  133. </template>
  134. </el-table-column>
  135. <el-table-column label="商机状态" width="150" align="center" prop="boState">
  136. <template slot-scope="scope">
  137. <dict-tag
  138. :options="dict.type.mk_bo_state"
  139. :value="scope.row.boState"
  140. />
  141. </template>
  142. </el-table-column>
  143. <el-table-column label="商机来源" width="150" align="center" prop="boSource">
  144. <template slot-scope="scope">
  145. <dict-tag
  146. :options="dict.type.mk_bo_source"
  147. :value="scope.row.boSource"
  148. />
  149. </template>
  150. </el-table-column>
  151. <el-table-column label="商机阶段" width="150" align="center" prop="boStageName" />
  152. <el-table-column label="客户名称" show-overflow-tooltip width="150" align="center" prop="customerName" />
  153. <el-table-column
  154. width="150"
  155. label="商机预估值(万元)"
  156. align="center"
  157. prop="hosDiscreetValue"
  158. />
  159. <el-table-column label="赢单率" width="150" align="center" prop="winningRate" />
  160. <el-table-column label="赢单率状态" width="150" align="center" prop="winningState">
  161. <template slot-scope="scope">
  162. <dict-tag
  163. :options="dict.type.mk_bo_winstate"
  164. :value="scope.row.winningState"
  165. />
  166. </template>
  167. </el-table-column>
  168. <el-table-column
  169. width="150"
  170. label="销售区域"
  171. align="center"
  172. prop="marketingAreaName"
  173. />
  174. <el-table-column
  175. width="150"
  176. show-overflow-tooltip
  177. label="销售组织"
  178. align="center"
  179. prop="marketingOrganizingName"
  180. />
  181. <el-table-column label="部门" width="150" align="center" prop="deptName" />
  182. <el-table-column label="商机负责人" width="150" align="center" prop="principalName" />
  183. <el-table-column label="创建人" width="150" align="center" prop="createBy" />
  184. <el-table-column label="创建时间" width="150" align="center" prop="createTime" />
  185. <el-table-column
  186. label="操作"
  187. fixed="right"
  188. align="center"
  189. class-name="small-padding fixed-width"
  190. width="250"
  191. >
  192. <template slot-scope="scope">
  193. <el-button
  194. size="mini"
  195. type="text"
  196. icon="el-icon-search"
  197. @click="enterDetails(scope.row)"
  198. >进入详情</el-button
  199. >
  200. <el-button
  201. size="mini"
  202. type="text"
  203. icon="el-icon-edit"
  204. @click="handleUpdate(scope.row)"
  205. >修改</el-button
  206. >
  207. <el-button
  208. size="mini"
  209. type="text"
  210. icon="el-icon-view"
  211. @click="handleBrowse(scope.row)"
  212. >查看</el-button
  213. >
  214. <el-button
  215. size="mini"
  216. type="text"
  217. icon="el-icon-delete"
  218. @click="handleDelete(scope.row)"
  219. >删除</el-button
  220. >
  221. </template>
  222. </el-table-column>
  223. </el-table>
  224. <pagination
  225. v-show="total > 0"
  226. :total="total"
  227. :page.sync="queryParams.pageNum"
  228. :limit.sync="queryParams.pageSize"
  229. @pagination="getList"
  230. />
  231. <!-- 添加或修改商机基础信息对话框 -->
  232. <el-dialog
  233. :title="title"
  234. :visible.sync="open"
  235. width="1000px"
  236. append-to-body
  237. >
  238. <el-form
  239. size="mini"
  240. ref="form"
  241. :model="form"
  242. :rules="rules"
  243. label-width="80px"
  244. :disabled="
  245. this.form.winningState > 0 || this.operatingState == 'Browse'
  246. "
  247. >
  248. <el-divider content-position="left">
  249. <dev style="width: 50px; height: 40px; font-size: 18px">基本信息</dev>
  250. </el-divider>
  251. <el-row>
  252. <el-col :span="8">
  253. <el-form-item label="商机名称" prop="boName">
  254. <el-input
  255. v-model="form.boName"
  256. placeholder="商机名称自动生成"
  257. :disabled="true"
  258. />
  259. </el-form-item>
  260. </el-col>
  261. <el-col :span="8">
  262. <el-form-item label="商机来源" prop="boSource">
  263. <el-select v-model="form.boSource">
  264. <el-option
  265. v-for="dict in dict.type.mk_bo_source"
  266. :key="dict.value"
  267. :label="dict.label"
  268. :value="dict.value"
  269. ></el-option>
  270. </el-select>
  271. </el-form-item>
  272. </el-col>
  273. <el-col :span="8">
  274. <el-form-item
  275. label="推荐人"
  276. prop="referrerName"
  277. v-show="form.boSource == '2'"
  278. :rules="
  279. form.boSource == '2' ? rules.referrer : [{ require: false }]
  280. "
  281. >
  282. <el-input v-model="form.referrerName">
  283. <el-button
  284. slot="append"
  285. icon="el-icon-more"
  286. @click="refereStaff"
  287. ></el-button>
  288. </el-input>
  289. </el-form-item>
  290. </el-col>
  291. </el-row>
  292. <el-row>
  293. <el-col :span="8">
  294. <el-form-item label="商机类型" prop="boType">
  295. <el-select
  296. v-model="form.boType"
  297. :disabled="this.operatingState == 'Update'"
  298. >
  299. <el-option
  300. v-for="dict in dict.type.mk_bo_type"
  301. :key="dict.value"
  302. :label="dict.label"
  303. :value="dict.value"
  304. ></el-option>
  305. </el-select>
  306. </el-form-item>
  307. </el-col>
  308. <el-col :span="8">
  309. <el-form-item label="客户名称" prop="customerName">
  310. <dr-popover-select
  311. :disabled="this.operatingState == 'Update'"
  312. v-model="form.customerName" title="客户" type="MkCustomerRule" :dataMapping="{
  313. customer: 'id',
  314. customerName: 'name',
  315. }" :source.sync="form">
  316. </dr-popover-select>
  317. <!-- <el-input
  318. v-model="form.customerName"
  319. :disabled="this.operatingState == 'Update'"
  320. >
  321. <el-button
  322. slot="append"
  323. icon="el-icon-more"
  324. @click="refereCustomer"
  325. :disabled="this.operatingState == 'Update'"
  326. ></el-button>
  327. </el-input> -->
  328. </el-form-item>
  329. </el-col>
  330. <el-col :span="8">
  331. <el-form-item :label="totalRevenue" prop="totalHosRevenue">
  332. <el-select
  333. v-model="form.totalHosRevenue"
  334. @change="totalHosRevenueChange"
  335. >
  336. <el-option
  337. v-for="dict in dict.type.mk_bo_total_revenue"
  338. :key="dict.value"
  339. :label="dict.label"
  340. :value="dict.value"
  341. ></el-option>
  342. </el-select>
  343. </el-form-item>
  344. </el-col>
  345. </el-row>
  346. <el-row>
  347. <el-col :span="8">
  348. <el-form-item
  349. :label="estimate"
  350. prop="hosDiscreetValue"
  351. >
  352. <el-input-number
  353. type="number"
  354. :controls="false"
  355. v-model="form.hosDiscreetValue"
  356. :precision="2"
  357. ></el-input-number>
  358. </el-form-item>
  359. </el-col>
  360. </el-row>
  361. <el-row>
  362. <el-col>
  363. <el-form-item label="商机内容" prop="boContent">
  364. <el-input
  365. type="textarea"
  366. maxlength="900"
  367. rows="2"
  368. autosize
  369. v-model="form.boContent"
  370. placeholder="客户存在什么需求,需求(如客户希望我司提供耗材/设备/SPD/打包耗材/工程商机服务,最好填写客户需要的的物料名称和物料品牌,大概需要多少数量,客户预计什么是时候要)"
  371. >
  372. </el-input>
  373. </el-form-item>
  374. </el-col>
  375. </el-row>
  376. <el-divider content-position="left">
  377. <dev style="width: 50px; height: 40px; font-size: 18px">其它信息</dev>
  378. </el-divider>
  379. <el-row>
  380. <el-col :span="6">
  381. <el-form-item label="销售区域" prop="marketingAreaName">
  382. <el-input
  383. v-model="form.marketingAreaName"
  384. placeholder="请输入销售区域"
  385. >
  386. <el-button
  387. slot="append"
  388. icon="el-icon-more"
  389. @click="refereSaleaea"
  390. ></el-button>
  391. </el-input>
  392. </el-form-item>
  393. </el-col>
  394. <el-col :span="6">
  395. <el-form-item label="销售组织" prop="marketingOrganizingName">
  396. <el-input v-model="form.marketingOrganizingName" readonly>
  397. </el-input>
  398. </el-form-item>
  399. </el-col>
  400. <el-col :span="6">
  401. <el-form-item label="部门" prop="deptName">
  402. <el-input v-model="form.deptName" readonly>
  403. </el-input>
  404. </el-form-item>
  405. </el-col>
  406. <el-col :span="6">
  407. <el-form-item label="商机负责人" prop="principalName">
  408. <el-input v-model="form.principalName" readonly>
  409. </el-input>
  410. </el-form-item>
  411. </el-col>
  412. </el-row>
  413. </el-form>
  414. <div slot="footer">
  415. <el-button
  416. size="mini"
  417. type="primary"
  418. @click="submitForm"
  419. v-if="this.operatingState != 'Browse'"
  420. :disabled="submitButtonEditStatus"
  421. >确 定</el-button
  422. >
  423. <el-button size="mini" @click="cancel">取 消</el-button>
  424. </div>
  425. </el-dialog>
  426. <!-- 客户参照 -->
  427. <CustomerRef
  428. ref="customerSelect"
  429. @doSubmit="customerSelectionsToInput"
  430. :single="true"
  431. />
  432. <!-- 销售区域参照 -->
  433. <SaleaeaRef
  434. ref="saleaeaSelect"
  435. @doSubmit="saleaeaSelectionsToInput"
  436. :single="true"
  437. />
  438. <!-- 组织参照 -->
  439. <OrgRef ref="orgSelect" @doSubmit="orgSelectionsToInput" :single="true" />
  440. <!-- 部门参照 -->
  441. <DeptRef
  442. ref="deptSelect"
  443. @doSubmit="deptSelectionsToInput"
  444. :single="true"
  445. />
  446. <!-- 员工参照 -->
  447. <StaffRef
  448. ref="staffSelect"
  449. @doSubmit="staffSelectionsToInput"
  450. :single="true"
  451. />
  452. </div>
  453. </template>
  454. <script>
  455. import {
  456. listBasic,
  457. getBasic,
  458. addBasic,
  459. updateBasic,
  460. delBasic,
  461. } from "@/api/business/spd/bo/basic";
  462. import CustomerRef from "@/views/business/spd/bo/refer/customer/index.vue";
  463. import SaleaeaRef from "@/views/business/spd/bo/refer/saleaea/index.vue";
  464. import OrgRef from "@/views/business/spd/bo/refer/org/index.vue";
  465. import DeptRef from "@/views/business/spd/bo/refer/dept/index.vue";
  466. import StaffRef from "@/views/business/spd/bo/refer/staff/index.vue";
  467. import { getBoNodeListByType } from "@/api/business/spd/bo/boNode";
  468. export default {
  469. name: "Basic",
  470. dicts: [
  471. "mk_bo_type",
  472. "mk_bo_state",
  473. "mk_bo_source",
  474. "mk_bo_total_revenue",
  475. "mk_bo_winstate",
  476. ],
  477. components: {
  478. CustomerRef,
  479. SaleaeaRef,
  480. OrgRef,
  481. DeptRef,
  482. StaffRef,
  483. },
  484. data() {
  485. return {
  486. // 遮罩层
  487. loading: true,
  488. // 选中数组
  489. ids: [],
  490. // 非单个禁用
  491. single: true,
  492. // 非多个禁用
  493. multiple: true,
  494. // 显示搜索条件
  495. showSearch: true,
  496. // 总条数
  497. total: 0,
  498. // 商机基础信息表格数据
  499. basicList: [],
  500. // 弹出层标题
  501. title: "",
  502. // 是否显示弹出层
  503. open: false,
  504. //当前操作状态
  505. operatingState: "",
  506. // 查询参数
  507. queryParams: {
  508. pageNum: 1,
  509. pageSize: 10,
  510. id: null,
  511. boCode: null,
  512. boSource: null,
  513. boState: null,
  514. boStage: null,
  515. boName: null,
  516. referrer: null,
  517. referrerName: null,
  518. boType: null,
  519. customerName: null,
  520. totalHosRevenue: null,
  521. hosDiscreetValue: null,
  522. boContent: null,
  523. marketingArea: null,
  524. marketingAreaName: null,
  525. marketingOrganizing: null,
  526. marketingOrganizingName: null,
  527. marketingArea: null,
  528. dept: null,
  529. deptName: null,
  530. principal: null,
  531. principalName: null,
  532. delFlag: null,
  533. tenantId: null,
  534. revision: null,
  535. createBy: null,
  536. createTime: null,
  537. updateBy: null,
  538. updateTime: null,
  539. params:{}
  540. },
  541. // 表单参数
  542. form: {
  543. referrer: null,
  544. referrerName: null,
  545. },
  546. //表单校验
  547. rules: {
  548. boSource: [
  549. { required: true, message: "商机来源不能为空", trigger: "blur" },
  550. ],
  551. referrerName: [
  552. { required: true, message: "推荐人不能为空", trigger: "blur" },
  553. ],
  554. boType: [
  555. { required: true, message: "商机类型不能为空", trigger: "blur" },
  556. ],
  557. customerName: [
  558. { required: true, message: "客户名称不能为空", trigger: "blur" },
  559. ],
  560. totalHosRevenue: [
  561. { required: true, message: "医院营收总额不能为空", trigger: "blur" },
  562. ],
  563. hosDiscreetValue: [
  564. {
  565. required: true,
  566. message: "医院耗材预估值不能为空",
  567. trigger: "blur",
  568. },
  569. ],
  570. boContent: [
  571. { required: true, message: "商机内容不能为空", trigger: "blur" },
  572. ],
  573. },
  574. //阶段列表
  575. mk_bo_stage: [],
  576. // 查询日期范围
  577. dateRange: [],
  578. //确定按钮是否可点
  579. submitButtonEditStatus:false,
  580. //营收总额
  581. totalRevenue:"***营收总额",
  582. //预估额
  583. estimate:"***预估额(万元)",
  584. pickerOptions: {
  585. shortcuts: [{
  586. text: '最近一周',
  587. onClick(picker) {
  588. const end = new Date();
  589. const start = new Date();
  590. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  591. picker.$emit('pick', [start, end]);
  592. }
  593. }, {
  594. text: '最近一个月',
  595. onClick(picker) {
  596. const end = new Date();
  597. const start = new Date();
  598. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  599. picker.$emit('pick', [start, end]);
  600. }
  601. }, {
  602. text: '最近三个月',
  603. onClick(picker) {
  604. const end = new Date();
  605. const start = new Date();
  606. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
  607. picker.$emit('pick', [start, end]);
  608. }
  609. }]
  610. },
  611. //表格高度
  612. height: "200px",
  613. };
  614. },
  615. watch: {
  616. 'form.boType': {
  617. handler(newVal, oldVal) {
  618. console.log('newVal',newVal);
  619. switch(newVal) {
  620. case '0':
  621. this.totalRevenue = "医院营收总额";
  622. this.estimate = "医院耗材预估值(万元)"
  623. break;
  624. case '1':
  625. this.totalRevenue = "医院营收总额";
  626. this.estimate = "医院耗材采集预估额(万元)"
  627. break;
  628. case '2':
  629. this.totalRevenue = "医院营收总额";
  630. this.estimate = "医院耗材预估值(万元)"
  631. break;
  632. case '3':
  633. this.totalRevenue = "医院营收总额";
  634. this.estimate = "医院设备预估额(万元)"
  635. break;
  636. case '4':
  637. this.totalRevenue = "医院营收总额";
  638. this.estimate = "军队医院设备预估额(万元)"
  639. break;
  640. case '5':
  641. this.totalRevenue = "项目总额";
  642. this.estimate = "工程预估额(万元)"
  643. break;
  644. default:
  645. break;
  646. }
  647. },
  648. immediate: true,
  649. deep: true // 可以深度检测到 person 对象的属性值的变化
  650. }
  651. },
  652. created() {
  653. this.height = window.innerHeight - 250 + 'px';
  654. this.getList();
  655. },
  656. methods: {
  657. /** 查询商机基础信息列表 */
  658. getList() {
  659. this.loading = true;
  660. this.queryParams.params.source = "list";
  661. listBasic(this.addDateRange(this.queryParams, this.dateRange)).then(
  662. (response) => {
  663. this.basicList = response.rows;
  664. //对商机名称进行加*
  665. console.log(this.basicList);
  666. for (var i = 0; i < this.basicList.length; i++) {
  667. var arr = this.basicList[i].boName.split("-");
  668. this.basicList[i].boName =
  669. arr[0] +
  670. "-" +
  671. arr[1].substring(0, 2) +
  672. "******" +
  673. arr[1].substring(arr[1].length - 2, arr[1].length) +
  674. "-" +
  675. arr[2];
  676. var customerName = this.basicList[i].customerName;
  677. this.basicList[i].customerName =
  678. customerName.substring(0, 2) +
  679. "******" +
  680. customerName.substring(
  681. customerName.length - 2,
  682. customerName.length
  683. );
  684. }
  685. this.total = response.total;
  686. this.loading = false;
  687. }
  688. );
  689. },
  690. // 取消按钮
  691. cancel() {
  692. this.open = false;
  693. this.reset();
  694. },
  695. // 表单重置
  696. reset() {
  697. this.form = {
  698. id: null,
  699. boCode: null,
  700. boSource: null,
  701. boState: null,
  702. boStage: null,
  703. boName: null,
  704. referrer: null,
  705. referrerName: null,
  706. boType: null,
  707. customerName: null,
  708. totalHosRevenue: null,
  709. hosDiscreetValue: null,
  710. boContent: null,
  711. marketingArea: null,
  712. marketingAreaName: null,
  713. marketingOrganizing: null,
  714. marketingOrganizingName: null,
  715. marketingArea: null,
  716. dept: null,
  717. deptName: null,
  718. principal: null,
  719. principalName: null,
  720. delFlag: null,
  721. tenantId: null,
  722. revision: null,
  723. createBy: null,
  724. createTime: null,
  725. updateBy: null,
  726. updateTime: null,
  727. };
  728. this.resetForm("form");
  729. },
  730. /** 搜索按钮操作 */
  731. handleQuery() {
  732. this.queryParams.pageNum = 1;
  733. this.getList();
  734. },
  735. /** 重置按钮操作 */
  736. resetQuery() {
  737. this.dateRange = [];
  738. this.resetForm("queryForm");
  739. this.handleQuery();
  740. },
  741. // 多选框选中数据
  742. handleSelectionChange(selection) {
  743. this.ids = selection.map((item) => item.id);
  744. this.single = selection.length !== 1;
  745. this.multiple = !selection.length;
  746. },
  747. /** 新增按钮操作 */
  748. handleAdd() {
  749. this.reset();
  750. this.open = true;
  751. this.operatingState = "Insert";
  752. const { id, name, orgId, deptId, nickName, deptName, orgName } = this.$store.state.user;
  753. this.form.principal = name;
  754. this.form.principalName = nickName;
  755. this.form.dept = deptId;
  756. this.form.deptName = deptName;
  757. this.form.marketingOrganizing = orgId;
  758. this.form.marketingOrganizingName = orgName;
  759. this.title = "添加商机基础信息";
  760. },
  761. /** 进入详情按钮操作 */
  762. enterDetails(row) {
  763. this.$router.push(`/basic/spd/bo/basic/details/${row.id}`);
  764. },
  765. /** 修改按钮操作 */
  766. handleUpdate(row) {
  767. this.reset();
  768. const id = row.id || this.ids;
  769. getBasic(id).then((response) => {
  770. this.form = { ...this.form, ...response.data };
  771. this.open = true;
  772. this.operatingState = "Update";
  773. this.title = "修改商机基础信息";
  774. });
  775. },
  776. /** 查看按钮操作 */
  777. handleBrowse(row) {
  778. this.reset();
  779. const id = row.id || this.ids;
  780. getBasic(id).then((response) => {
  781. this.form = response.data;
  782. this.open = true;
  783. this.operatingState = "Browse";
  784. this.title = "基础信息";
  785. });
  786. },
  787. /** 提交按钮 */
  788. submitForm() {
  789. this.submitButtonEditStatus = true;
  790. this.$refs["form"].validate((valid) => {
  791. if (valid) {
  792. if (this.form.id != null) {
  793. updateBasic(this.form).then((response) => {
  794. this.$modal.msgSuccess("修改成功");
  795. this.open = false;
  796. this.getList();
  797. this.submitButtonEditStatus = false;
  798. });
  799. } else {
  800. addBasic(this.form).then((response) => {
  801. this.$modal.msgSuccess("新增成功");
  802. this.open = false;
  803. this.getList();
  804. this.submitButtonEditStatus = false;
  805. });
  806. }
  807. }else{
  808. this.submitButtonEditStatus = false;
  809. }
  810. });
  811. },
  812. /** 删除按钮操作 */
  813. handleDelete(row) {
  814. const ids = row.id || this.ids;
  815. this.$modal
  816. .confirm('是否确认删除商机基础信息编号为"' + ids + '"的数据项?')
  817. .then(function () {
  818. return delBasic(ids);
  819. })
  820. .then(() => {
  821. this.getList();
  822. this.$modal.msgSuccess("删除成功");
  823. })
  824. .catch(() => {});
  825. },
  826. /** 导出按钮操作 */
  827. handleExport() {
  828. this.download(
  829. "system/basic/export",
  830. {
  831. ...this.queryParams,
  832. },
  833. `basic_${new Date().getTime()}.xlsx`
  834. );
  835. },
  836. //选择医院营收总额后
  837. totalHosRevenueChange(value) {
  838. switch (value) {
  839. //5000万以下
  840. case "0":
  841. this.form.hosDiscreetValue = 5000 * 0.2;
  842. break;
  843. //5000万-1亿
  844. case "1":
  845. this.form.hosDiscreetValue = 10000 * 0.2;
  846. break;
  847. //1亿-2亿
  848. case "2":
  849. this.form.hosDiscreetValue = 20000 * 0.2;
  850. break;
  851. //2亿-5亿
  852. case "3":
  853. this.form.hosDiscreetValue = 50000 * 0.2;
  854. break;
  855. //5亿-10亿
  856. case "4":
  857. this.form.hosDiscreetValue = 100000 * 0.2;
  858. break;
  859. //10亿以上
  860. case "5":
  861. this.form.hosDiscreetValue = 100000 * 0.2;
  862. break;
  863. }
  864. },
  865. //查询参数商机类型改变后
  866. boTypeChange(boType) {
  867. if (boType) {
  868. getBoNodeListByType(boType).then((response) => {
  869. this.mk_bo_stage = response.rows;
  870. });
  871. } else {
  872. this.mk_bo_stage = [];
  873. }
  874. },
  875. // 触发客户参照列表
  876. refereCustomer() {
  877. this.$refs.customerSelect.init();
  878. },
  879. //客户参照列表选择后
  880. customerSelectionsToInput(selections) {
  881. this.form.customer = selections[0].id;
  882. this.form.customerName = selections[0].name;
  883. },
  884. // 触发销售区域参照列表
  885. refereSaleaea() {
  886. this.$refs.saleaeaSelect.init();
  887. },
  888. //销售区域参照列表选择后
  889. saleaeaSelectionsToInput(selections) {
  890. this.form.marketingArea = selections[0].id;
  891. this.form.marketingAreaName = selections[0].name;
  892. },
  893. // 触发组织参照列表
  894. refereOrg() {
  895. this.$refs.orgSelect.init();
  896. },
  897. //组织参照列表选择后
  898. orgSelectionsToInput(selections) {
  899. this.form.marketingOrganizing = selections[0].deptId;
  900. this.form.marketingOrganizingName = selections[0].deptName;
  901. },
  902. // 触发部门参照列表
  903. refereDept() {
  904. this.$refs.deptSelect.init();
  905. },
  906. //部门参照列表选择后
  907. deptSelectionsToInput(selections) {
  908. this.form.dept = selections[0].deptId;
  909. this.form.deptName = selections[0].deptName;
  910. },
  911. // 触发员工参照列表
  912. refereStaff() {
  913. this.$refs.staffSelect.init();
  914. },
  915. //员工参照列表选择后
  916. staffSelectionsToInput(selections) {
  917. this.form.referrer = selections[0].userId;
  918. this.form.referrerName = selections[0].nickName;
  919. console.log("this.form", this.form);
  920. },
  921. },
  922. };
  923. </script>
  924. <style lang="scss" scoped>
  925. #deliveryAddressList {
  926. height: calc(100vh - 84px);
  927. padding: 12px;
  928. box-sizing: border-box;
  929. overflow-y: scroll;
  930. }
  931. .btn_grooup {
  932. margin-bottom: 10px;
  933. display: flex;
  934. justify-content: flex-end;
  935. }
  936. .lines {
  937. margin-top: 0;
  938. }
  939. .el-pagination {
  940. margin-top: 10px;
  941. text-align: right;
  942. }
  943. </style>