opportunityDetailDialog.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454
  1. <template>
  2. <div>
  3. <headerTitle title="基本信息"></headerTitle>
  4. <el-form
  5. label-width="120px"
  6. ref="form"
  7. :model="form"
  8. :rules="rules"
  9. style="margin-top: 30px"
  10. >
  11. <el-row>
  12. <el-col :span="8">
  13. <el-form-item label="客户名称:" prop="contactName">
  14. {{ detailData.contactName }}
  15. </el-form-item>
  16. </el-col>
  17. <el-col :span="8">
  18. <el-form-item label=" 商机名称:" prop="name">
  19. {{ detailData.name }}
  20. </el-form-item>
  21. </el-col>
  22. <el-col :span="8">
  23. <el-form-item label="负责人名称:" prop="responsibleName">
  24. {{ detailData.responsibleName }}
  25. </el-form-item>
  26. </el-col>
  27. <el-col :span="8">
  28. <el-form-item label="商机来源:" prop="sourceCode">
  29. {{ detailData.sourceName }}
  30. </el-form-item>
  31. </el-col>
  32. <el-col :span="8">
  33. <el-form-item label="赢单率:" prop="winRate">
  34. {{ detailData.winRate ? detailData.winRate + '%' : '' }}
  35. </el-form-item>
  36. </el-col>
  37. <el-col :span="8">
  38. <el-form-item label="预算:" prop="budget">
  39. {{ detailData.budget ? detailData.budget + '万元' : '' }}
  40. </el-form-item>
  41. </el-col>
  42. <el-col :span="8">
  43. <el-form-item label="预计结单日期:" prop="expectedClosingDate">
  44. {{ detailData.expectedClosingDate }}
  45. </el-form-item>
  46. </el-col>
  47. <el-col :span="8">
  48. <el-form-item label="商机阶段:" prop="stageCode">
  49. {{ detailData.stageName }}
  50. </el-form-item>
  51. </el-col>
  52. <el-col :span="8">
  53. <el-form-item label="附件:" prop="files">
  54. <fileMain v-model="detailData.files" type="view"></fileMain>
  55. <!-- <div v-if="detailData.files && detailData.files?.length">-->
  56. <!-- <el-link-->
  57. <!-- v-for="link in detailData.files"-->
  58. <!-- :key="link.id"-->
  59. <!-- type="primary"-->
  60. <!-- :underline="false"-->
  61. <!-- @click="downloadFile(link)"-->
  62. <!-- >-->
  63. <!-- {{ link.name }}</el-link-->
  64. <!-- >-->
  65. <!-- </div>-->
  66. </el-form-item>
  67. </el-col>
  68. <!-- <el-col :span="8">
  69. <el-form-item label="计费方式:" prop="pricingWay">
  70. {{ detailData.pricingWay == 1 ? '按数量计费' : '按重量计费' }}
  71. </el-form-item>
  72. </el-col> -->
  73. <el-col :span="16">
  74. <el-form-item label="备注:" prop="remark">
  75. {{ detailData.remark }}
  76. </el-form-item>
  77. </el-col>
  78. </el-row>
  79. </el-form>
  80. <headerTitle title="物品清单"></headerTitle>
  81. <inventoryTable
  82. pageName="businessOpportunity"
  83. v-if="
  84. [
  85. 'productionSupervisorApprove1',
  86. 'technicianApprove',
  87. 'techLeaderApprove',
  88. 'productionSupervisorApprove2',
  89. 'salesManagerApprove'
  90. ].includes(taskDefinitionKey)
  91. "
  92. :isCustomerMark="false"
  93. ref="inventoryTable"
  94. :isDeliveryDeadline="false"
  95. :isGuaranteePeriod="false"
  96. :isDiscount="false"
  97. :pricing-way="form.pricingWay"
  98. ></inventoryTable>
  99. <inventoryTabledetail
  100. v-if="
  101. ![
  102. 'productionSupervisorApprove1',
  103. 'technicianApprove',
  104. 'techLeaderApprove',
  105. 'productionSupervisorApprove2',
  106. 'salesManagerApprove'
  107. ].includes(taskDefinitionKey)
  108. "
  109. ref="inventoryTabledetailRef"
  110. :isDeliveryDeadline="false"
  111. :isGuaranteePeriod="false"
  112. :isCustomerMark="false"
  113. :isDiscount="false"
  114. :pricingWay="detailData.pricingWay"
  115. ></inventoryTabledetail>
  116. <!-- <el-card
  117. shadow="never"
  118. header="竞品对手"
  119. body-style="padding: 22px 20px 0 20px;"
  120. >
  121. <ele-pro-table
  122. ref="table"
  123. :needPage="false"
  124. :columns="competAnalysisListcolumns1"
  125. :datasource="detailData.competAnalysisList"
  126. row-key="id"
  127. >
  128. </ele-pro-table>
  129. </el-card>
  130. <el-card
  131. shadow="never"
  132. header="关键人信息"
  133. body-style="padding: 22px 20px 0 20px;"
  134. >
  135. <ele-pro-table
  136. ref="table"
  137. :needPage="false"
  138. :columns="partyListcolumns"
  139. :datasource="detailData.partyList"
  140. row-key="id"
  141. >
  142. </ele-pro-table>
  143. </el-card> -->
  144. </div>
  145. </template>
  146. <script>
  147. import { getDetail } from '@/api/bpm/components/saleManage/businessOpportunity';
  148. import { getFile } from '@/api/system/file';
  149. import dictMixins from '@/mixins/dictMixins';
  150. // import inventoryTable from './saleGeneralityInventoryTable.vue';
  151. import inventoryTable from '@/BIZComponents/inventoryTable.vue';
  152. import inventoryTabledetail from '@/views/bpm/handleTask/components/contractBook/inventoryTabledetail.vue';
  153. import fileMain from '@/components/addDoc/index.vue';
  154. import {contactDetail} from '@/api/bpm/components/saleManage/contact';
  155. export default {
  156. mixins: [dictMixins],
  157. components: {
  158. fileMain,
  159. inventoryTable,
  160. inventoryTabledetail
  161. },
  162. props: {
  163. businessId: {
  164. default: ''
  165. },
  166. taskDefinitionKey: {
  167. default: ''
  168. }
  169. },
  170. data() {
  171. return {
  172. visible: false,
  173. customerMark:'',
  174. title: '详情',
  175. row: {},
  176. activeName: 'base',
  177. form: {},
  178. rules: {},
  179. detailData: {},
  180. competAnalysisListcolumns1: [
  181. {
  182. prop: 'name',
  183. label: '竞争对手名称',
  184. // sortable: 'custom',
  185. showOverflowTooltip: true,
  186. align: 'center',
  187. width: 300
  188. },
  189. {
  190. prop: 'analysis',
  191. label: '竞品分析',
  192. showOverflowTooltip: true,
  193. align: 'center'
  194. }
  195. ],
  196. partyListcolumns: [
  197. {
  198. prop: 'linkName',
  199. label: '关键人名称',
  200. // sortable: 'custom',
  201. showOverflowTooltip: true,
  202. align: 'center',
  203. minWidth: 110
  204. },
  205. {
  206. prop: 'linkMobilePhone',
  207. label: '联系方式',
  208. showOverflowTooltip: true,
  209. align: 'center',
  210. minWidth: 110
  211. },
  212. {
  213. prop: 'linkPost',
  214. label: '职位',
  215. showOverflowTooltip: true,
  216. align: 'center',
  217. minWidth: 110
  218. },
  219. {
  220. prop: 'attitudeName',
  221. label: '态度',
  222. showOverflowTooltip: true,
  223. align: 'center',
  224. minWidth: 110
  225. },
  226. {
  227. prop: 'influenceName',
  228. label: '影响力',
  229. showOverflowTooltip: true,
  230. align: 'center',
  231. minWidth: 110
  232. },
  233. {
  234. prop: 'goal',
  235. label: '项目目标/期望',
  236. showOverflowTooltip: true,
  237. align: 'center',
  238. minWidth: 110
  239. }
  240. ],
  241. competAnalysisListcolumns: [
  242. {
  243. width: 45,
  244. type: 'index',
  245. columnKey: 'index',
  246. align: 'center',
  247. fixed: 'left'
  248. },
  249. {
  250. width: 200,
  251. prop: 'productName',
  252. label: '名称',
  253. slot: 'productName'
  254. },
  255. {
  256. width: 120,
  257. prop: 'productCode',
  258. label: '编码',
  259. slot: 'productCode'
  260. },
  261. {
  262. width: 200,
  263. prop: 'productCategoryName',
  264. label: '类型',
  265. slot: 'productCategoryName'
  266. },
  267. {
  268. width: 160,
  269. prop: 'productBrand',
  270. label: '牌号',
  271. slot: 'productBrand'
  272. },
  273. {
  274. width: 120,
  275. prop: 'modelType',
  276. label: '型号',
  277. slot: 'modelType'
  278. },
  279. {
  280. width: 120,
  281. prop: 'specification',
  282. label: '规格',
  283. slot: 'specification'
  284. },
  285. {
  286. width: 160,
  287. prop: 'singlePrice',
  288. label: '单价',
  289. slot: 'singlePrice'
  290. },
  291. {
  292. width: 120,
  293. prop: 'totalCount',
  294. label: '数量',
  295. slot: 'totalCount'
  296. },
  297. {
  298. width: 120,
  299. prop: 'totalPrice',
  300. label: '销售总金额',
  301. slot: 'totalPrice',
  302. formatter: (_row, _column, cellValue) => {
  303. return _row.totalPrice ? _row.totalPrice + '元' : '';
  304. }
  305. },
  306. {
  307. width: 120,
  308. prop: 'measuringUnit',
  309. label: '计量单位',
  310. slot: 'measuringUnit'
  311. },
  312. {
  313. width: 120,
  314. prop: 'deliveryDays',
  315. label: '交期(天)',
  316. slot: 'deliveryDays'
  317. },
  318. {
  319. width: 200,
  320. prop: 'guaranteePeriod',
  321. label: '质保期',
  322. slot: 'guaranteePeriod',
  323. formatter: (_row, _column, cellValue) => {
  324. return (
  325. (_row.guaranteePeriod || '') + _row.guaranteePeriodUnitName
  326. );
  327. }
  328. },
  329. // {
  330. // width: 120,
  331. // prop: 'guaranteePeriodUnitCode',
  332. // label: '',
  333. // slot: 'guaranteePeriodUnitCode'
  334. // },
  335. {
  336. width: 240,
  337. prop: 'customerReqFiles',
  338. label: '客户需求',
  339. slot: 'customerReqFiles'
  340. },
  341. {
  342. width: 120,
  343. prop: 'technicalAnswerName',
  344. label: '技术答疑人',
  345. slot: 'technicalAnswerName'
  346. },
  347. {
  348. width: 220,
  349. prop: 'technicalParams',
  350. label: '技术参数',
  351. slot: 'technicalParams'
  352. },
  353. {
  354. width: 240,
  355. prop: 'technicalDrawings',
  356. label: '技术图纸',
  357. slot: 'technicalDrawings',
  358. formatter: (_row, _column, cellValue) => {
  359. return (
  360. (_row.guaranteePeriod || '') + _row.guaranteePeriodUnitName
  361. );
  362. }
  363. },
  364. {
  365. width: 220,
  366. prop: 'remark',
  367. label: '备注',
  368. slot: 'remark'
  369. }
  370. ]
  371. };
  372. },
  373. created() {
  374. this.getDetailData(this.businessId);
  375. },
  376. methods: {
  377. downloadFile(file) {
  378. getFile({ objectName: file.storePath }, file.name);
  379. },
  380. async getDetailData(id) {
  381. this.loading = true;
  382. const data = await getDetail(id);
  383. this.loading = false;
  384. this.detailData = data;
  385. this.getContactDetail()
  386. if (this.detailData) {
  387. this.$refs.inventoryTable &&
  388. this.$refs.inventoryTable.putTableValue(this.detailData);
  389. this.$refs.inventoryTabledetailRef &&
  390. this.$refs.inventoryTabledetailRef.putTableValue(this.detailData);
  391. }
  392. },
  393. //获取客户
  394. async getContactDetail(type) {
  395. const { base } = await contactDetail(this.detailData.contactId);
  396. this.customerMark = base.serialNo;
  397. },
  398. getValidate() {
  399. return Promise.all([
  400. new Promise((resolve, reject) => {
  401. this.$refs.inventoryTable.validateForm((valid) => {
  402. if (!valid) {
  403. reject(false);
  404. } else {
  405. resolve(true);
  406. }
  407. });
  408. })
  409. ]);
  410. },
  411. async getTableValue() {
  412. try {
  413. await this.getValidate();
  414. if (this.$refs.inventoryTable.getTableValue().length == 0) {
  415. this.$message.warning('物品清单不能为空');
  416. return;
  417. }
  418. this.detailData.totalPrice= this.$refs.inventoryTable.getPrice()[0]
  419. const commitData = {
  420. opportunity: this.detailData,
  421. competAnalysisList: this.detailData.competAnalysisList,
  422. partyList: this.detailData.partyList,
  423. productList: this.$refs.inventoryTable.getTableValue()
  424. };
  425. return commitData;
  426. } catch (error) {
  427. console.log(error);
  428. return Promise.resolve([]);
  429. }
  430. }
  431. }
  432. };
  433. </script>
  434. <style scoped lang="scss">
  435. .ele-dialog-form {
  436. .el-form-item {
  437. margin-bottom: 10px;
  438. }
  439. }
  440. </style>