opportunityDetailDialog.vue 13 KB

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