detail.js 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793
  1. const _Http = getApp().globalData.http,
  2. currency = require("../../utils/currency"),
  3. CNY = value => currency(value, {
  4. symbol: "¥",
  5. precision: 2
  6. }).format();
  7. let paramvalue = false;
  8. Page({
  9. data: {
  10. isInsert: false,
  11. loading: true,
  12. isLeader: false, //是否为负责人
  13. isRecover: false, //关闭弹窗是否恢复项目
  14. tabsActive: 0, //tabs 选中项
  15. sa_projectid: "",
  16. tabbarList: [],
  17. sColors: getApp().globalData.sColors,
  18. },
  19. onLoad(options) {
  20. const appAuth = wx.getStorageSync('auth').wproject;
  21. let tabsList = [{
  22. label: "报价单",
  23. icon: "icon-tabbaojiadan",
  24. model: "#Offers"
  25. }, {
  26. label: "合同",
  27. icon: "icon-tabhetong",
  28. model: "#Contract"
  29. }, {
  30. label: "详细信息",
  31. icon: "icon-tabxiangxixinxi1"
  32. }, {
  33. label: "关联客户",
  34. icon: "icon-tabkehu",
  35. model: "#Treaty"
  36. }, {
  37. label: "联系人",
  38. icon: "icon-tablianxiren",
  39. model: "#Contacts"
  40. }]
  41. if (appAuth.isdatafollowup) tabsList.unshift({
  42. label: "跟进动态",
  43. icon: "icon-tabgenjinjilu",
  44. model: "#Trace"
  45. })
  46. if (appAuth.options.some(v => v == 'product')) tabsList.push({
  47. label: "产品配置单",
  48. icon: "icon-tabchanpin",
  49. model: "#Product"
  50. })
  51. tabsList = tabsList.concat([{
  52. label: "关联线索",
  53. icon: "icon-tabxiansuo",
  54. model: "#Clue"
  55. }, {
  56. label: "报备进度",
  57. icon: "icon-tabfujian1",
  58. model: "#ReportingProgress"
  59. }])
  60. if (appAuth.istask) tabsList.push({
  61. label: "任务",
  62. icon: "icon-tabrenwu",
  63. model: "#Work"
  64. })
  65. tabsList = tabsList.concat([{
  66. label: "竞争对手",
  67. icon: "icon-tabjingzhengduishou",
  68. model: "#Opponent"
  69. }, {
  70. label: "项目评估",
  71. icon: "icon-tabxiangmupinggu",
  72. model: "#Task"
  73. }, {
  74. label: "附件",
  75. icon: "icon-tabfujian1",
  76. model: "#Files"
  77. }, {
  78. label: "操作记录",
  79. icon: "icon-tabcaozuojilu1",
  80. model: "#Record"
  81. }])
  82. this.setData({
  83. sa_projectid: options.id,
  84. isAdmin: appAuth.options.some(v => v == "admin"), //是否具有管理权限
  85. options: appAuth.options, //权限列表
  86. tabsList,
  87. appAuth
  88. })
  89. this.getDetail(true);
  90. getApp().globalData.Language.getLanguagePackage(this, '项目详情');
  91. },
  92. getDetail(init = false) {
  93. _Http.basic({
  94. "id": 20221021103902,
  95. "content": {
  96. nocache: true,
  97. "sa_projectid": this.data.sa_projectid
  98. },
  99. }).then(res => {
  100. console.log("项目商机详情", res)
  101. if (res.code != '1') return wx.showToast({
  102. title: res.data,
  103. icon: "none"
  104. });
  105. this.setPreview(res.data);
  106. this.setData({
  107. loading: false,
  108. detail: res.data,
  109. })
  110. if (init) {
  111. if (this.data.appAuth.isdatatag) this.getTags();
  112. if (this.data.appAuth.isdatateam) this.getGroup();
  113. this.selectComponent("#TaskTabs").getList();
  114. }
  115. this.setTabbarList();
  116. this.partialRenewal(init);
  117. })
  118. },
  119. /* 设置显示信息 */
  120. async setPreview(data) {
  121. let list1 = [{
  122. label: "项目编号",
  123. value: data.projectnum
  124. }, {
  125. label: "项目名称",
  126. value: data.projectname
  127. }, {
  128. label: "报备进度",
  129. value: data.reportstatus,
  130. style: `color:${this.data.sColors[data.reportstatus]}`
  131. }, {
  132. label: "项目类型",
  133. value: data.projecttype
  134. }, {
  135. label: "项目阶段",
  136. value: data.stagename
  137. }, {
  138. label: "项目方阶段",
  139. value: data.squarestage
  140. }, {
  141. label: "项目等级",
  142. value: data.grade
  143. }, {
  144. label: "省市县",
  145. value: data.province ? data.province + data.city + data.county : ''
  146. }, {
  147. label: "地址",
  148. value: data.address
  149. }, {
  150. label: "项目规模",
  151. value: data.scale ? data.scale + data.unitname : ""
  152. }, {
  153. label: "项目预算(万元)",
  154. value: CNY(data.budgetary)
  155. }, {
  156. label: "总投资额(万元)",
  157. value: CNY(data.totalinvestment)
  158. }, {
  159. label: "造价(万元)",
  160. value: CNY(data.costofconstruction)
  161. }, {
  162. label: "预计开工时间",
  163. value: data.begdate_due
  164. }, {
  165. label: "预计完工时间",
  166. value: data.enddate_due
  167. }, {
  168. label: "预计签约时间",
  169. value: data.signdate_due
  170. }, {
  171. label: "预计签约金额(元)",
  172. value: CNY(data.signamount_due)
  173. }, {
  174. label: "项目成交金额",
  175. value: CNY(data.dealamount)
  176. }, {
  177. label: "领域",
  178. value: data.tradefield
  179. }, {
  180. label: "品牌",
  181. value: data.brandname
  182. }, {
  183. label: "品牌是否填报方植入",
  184. value: data.isfillbrangd == 1 ? '是' : (data.isfillbrangd + "").length == 0 ? '' : "否"
  185. }, {
  186. label: "项目来源",
  187. value: data.source
  188. }, {
  189. label: "赢率",
  190. value: data.winrate
  191. }, {
  192. label: "负责人",
  193. value: data.name
  194. }, {
  195. label: "项目状态",
  196. value: getApp().globalData.Language.getMapText(data.status),
  197. style: `color:${data.status == '跟进中'? '#3874f6':this.data.sColors[data.status]}`
  198. }, {
  199. label: "结案/失败原因",
  200. value: data.status == '已结案' ? data.endreason : data.defeattype + (data.defeatreason ? "," + data.defeatreason : data.defeatreason)
  201. }];
  202. if (wx.getStorageSync('userMsg').siteid == 'HY') list1 = list1.filter(v => !["项目预算(万元)", "总投资额(万元)", "造价(万元)"].includes(v.label))
  203. this.setData({
  204. briefs: [{
  205. label: "项目编号",
  206. value: data.projectnum
  207. }, {
  208. label: "报备进度",
  209. value: data.reportstatus,
  210. style: `color:${this.data.sColors[data.reportstatus]}`
  211. }, {
  212. label: "项目类型",
  213. value: data.projecttype
  214. }, {
  215. label: "项目阶段",
  216. value: data.stagename
  217. }, {
  218. label: "项目等级",
  219. value: data.grade
  220. }, {
  221. label: "状态",
  222. value: getApp().globalData.Language.getMapText(data.status),
  223. style: `color:${data.status == '跟进中'? '#3874f6':this.data.sColors[data.status]}`
  224. }, {
  225. label: '营销费用',
  226. value: CNY(data.salesfeesamount || '0')
  227. }],
  228. list1,
  229. list2: [{
  230. label: "创建人",
  231. value: data.createby
  232. }, {
  233. label: "创建时间",
  234. value: data.createdate
  235. }, {
  236. label: "最近编辑人",
  237. value: data.changeby
  238. }, {
  239. label: "最近编辑时间",
  240. value: data.changedate
  241. }, {
  242. label: "提交报备人",
  243. value: data.reportby
  244. }, {
  245. label: "提交报备时间",
  246. value: data.reportdate
  247. }, {
  248. label: "报备审核人",
  249. value: data.reportcheckby
  250. }, {
  251. label: "报备审核时间",
  252. value: data.reportcheckdate
  253. }, {
  254. label: "转手次数",
  255. value: data.changecount
  256. }]
  257. })
  258. },
  259. /* 设置tabbar */
  260. async setTabbarList() {
  261. let detail = this.data.detail,
  262. status = detail.status,
  263. isLeader = detail.leader.some(some => some.userid == wx.getStorageSync('userMsg').userid),
  264. isAdmin = this.data.isAdmin,
  265. editdataleader = isLeader,
  266. tabbarList = [];
  267. if (this.data.appAuth.isdatafollowup) tabbarList.push({
  268. icon: "color-genjin",
  269. label: "跟进"
  270. });
  271. if (wx.getStorageSync('auth').wproject.options.some(v => v == "auditauthorization")) tabbarList.unshift({
  272. icon: "icon-shenheshouquan",
  273. label: "审核授权"
  274. })
  275. if (!isLeader) {
  276. let res = await getApp().agentOrNot("sa_project", this.data.sa_projectid),
  277. data = res.code == '1' ? res.data : {
  278. editable: 0,
  279. editdataleader: 0
  280. }
  281. if (this.data.appAuth.isdatateam) isLeader = this.selectComponent("#Group").data.editable == 1;
  282. if (!isLeader) isLeader = data.editable == 1;
  283. editdataleader = data.editdataleader;
  284. }
  285. if (isAdmin && detail.reportstatus == '报备中') tabbarList = [{
  286. icon: "icon-baobeishenhe",
  287. label: "报备审核"
  288. }, {
  289. icon: "icon-genjin",
  290. label: "报备驳回(退回)"
  291. }].concat(tabbarList)
  292. if (isLeader || isAdmin) {
  293. if (status != '已失败' && status != '已结案') {
  294. _Http.basic({
  295. "classname": "sysmanage.develop.datafunction.datafunction",
  296. "method": "execute",
  297. "content": {
  298. functionname: "bpmswitch"
  299. }
  300. }).then(res => {
  301. console.log("查询是否启用BPM流程", res)
  302. if (res.code != '0') paramvalue = res.data[0].paramvalue == "true";
  303. })
  304. tabbarList.push({
  305. icon: "color-bianji",
  306. label: "编辑"
  307. })
  308. if (detail.reportstatus == '未报备') tabbarList.push({
  309. icon: "icon-tijiaobaobei1",
  310. label: "提交报备"
  311. })
  312. if (editdataleader) tabbarList.push({
  313. icon: "color-genghuanfuzeren",
  314. label: "更换负责人"
  315. })
  316. }
  317. if (isLeader) {
  318. if (status == '已成交') tabbarList.push({
  319. icon: "icon-dibu-jieshu",
  320. label: "结案"
  321. })
  322. if (status == '跟进中') tabbarList.push({
  323. icon: "icon-dibu-wuxiao",
  324. label: "失败"
  325. })
  326. if (status == '已失败' || status == '已结案') tabbarList = [{
  327. icon: "icon-dibu-chehui",
  328. label: "恢复"
  329. }]
  330. }
  331. tabbarList.push({
  332. icon: "icon-shanchu",
  333. label: "作废"
  334. })
  335. }
  336. if (this.data.options.find(v => v == 'viewRepetition')) tabbarList.push({
  337. icon: "icon-a-shouyejingangquhehuoren",
  338. label: "查看重复"
  339. });
  340. this.setData({
  341. isLeader,
  342. tabbarList,
  343. disabled: status != '已失败' && status != '已结案'
  344. });
  345. },
  346. //详情按钮回调
  347. tabbarOnClick({
  348. detail
  349. }) {
  350. let data = this.data.detail,
  351. that = this;
  352. switch (detail.label) {
  353. case "失败":
  354. wx.navigateTo({
  355. url: '/packageA/project/modules/fail/index?id=' + this.data.sa_projectid
  356. })
  357. break;
  358. case "结案":
  359. this.selectComponent("#Dialog").onClick(this.data.sa_projectid)
  360. break;
  361. case "发起授权":
  362. wx.navigateTo({
  363. url: `./impower/initiate?projectname=${data.projectname}&sa_projectid=${data.sa_projectid}`,
  364. })
  365. break;
  366. case "审核授权":
  367. wx.navigateTo({
  368. url: `./impower/impower?sa_projectid=${data.sa_projectid}`,
  369. })
  370. break;
  371. case "恢复":
  372. _Http.basic({
  373. "id": 20221208184202,
  374. "content": {
  375. ...data,
  376. pageSize: 999
  377. }
  378. }).then(res => {
  379. console.log("查看重复", res)
  380. if (res.code != '1') return wx.showToast({
  381. title: res.msg,
  382. icon: "none"
  383. });
  384. if (res.data.length == 0) {
  385. wx.showModal({
  386. title: getApp().globalData.Language.getMapText('提示'),
  387. content: getApp().globalData.Language.getMapText('是否确认恢复项目'),
  388. cancelText: getApp().globalData.Language.getMapText('取消'),
  389. confirmText: getApp().globalData.Language.getMapText('确定'),
  390. complete: ({
  391. confirm
  392. }) => {
  393. if (confirm) that.onRecover()
  394. }
  395. })
  396. } else {
  397. wx.showToast({
  398. title: getApp().globalData.Language.getMapText('查询到有疑似重复项目'),
  399. icon: "none"
  400. })
  401. this.setData({
  402. repetitionList: res.data.map(v => {
  403. v.chars = v.chars.reduce((acc, item) => ({
  404. ...acc,
  405. ...item
  406. }), {});
  407. v.projectname = v.projectname.split('').map(text => {
  408. let projectname = v.chars.projectname.join("") || ''
  409. return projectname.includes(text) ? {
  410. text,
  411. color: "red"
  412. } : {
  413. text,
  414. color: "#666666"
  415. }
  416. })
  417. return v
  418. }),
  419. repetitionShow: true,
  420. isRecover: true
  421. });
  422. }
  423. })
  424. break;
  425. case "提交报备":
  426. wx.showModal({
  427. title: getApp().globalData.Language.getMapText('提示'),
  428. content: getApp().globalData.Language.getMapText('是否确认提交项目审核'),
  429. cancelText: getApp().globalData.Language.getMapText('取消'),
  430. confirmText: getApp().globalData.Language.getMapText('确定'),
  431. complete: ({
  432. confirm
  433. }) => {
  434. if (confirm) that.handleReport(1)
  435. }
  436. })
  437. break;
  438. case "报备审核":
  439. if (paramvalue) {
  440. wx.showModal({
  441. title: getApp().globalData.Language.getMapText('提示'),
  442. content: getApp().globalData.Language.getMapText('请前往WEB端操作'),
  443. showCancel: false,
  444. confirmText: getApp().globalData.Language.getMapText('确定'),
  445. })
  446. } else {
  447. wx.showModal({
  448. title: getApp().globalData.Language.getMapText('提示'),
  449. content: getApp().globalData.Language.getMapText('是否确认报备审核'),
  450. cancelText: getApp().globalData.Language.getMapText('取消'),
  451. confirmText: getApp().globalData.Language.getMapText('确定'),
  452. complete: ({
  453. confirm
  454. }) => {
  455. if (confirm) that.handleReport(2)
  456. }
  457. })
  458. }
  459. break;
  460. case "报备驳回(退回)":
  461. if (paramvalue) {
  462. wx.showModal({
  463. title: getApp().globalData.Language.getMapText('提示'),
  464. content: getApp().globalData.Language.getMapText('请前往WEB端操作'),
  465. showCancel: false,
  466. confirmText: getApp().globalData.Language.getMapText('确定'),
  467. })
  468. } else {
  469. wx.showModal({
  470. title: getApp().globalData.Language.getMapText('提示'),
  471. content: getApp().globalData.Language.getMapText('是否确认报备驳回(退回)项目'),
  472. cancelText: getApp().globalData.Language.getMapText('取消'),
  473. confirmText: getApp().globalData.Language.getMapText('确定'),
  474. complete: ({
  475. confirm
  476. }) => {
  477. if (confirm) that.handleReport(3)
  478. }
  479. })
  480. }
  481. break;
  482. case "跟进":
  483. that.selectComponent("#Trace").insetr();
  484. break;
  485. case "编辑":
  486. let tags = that.selectComponent("#Tags").data.systemtag;
  487. wx.navigateTo({
  488. url: `/packageA/project/addAndEdit?data=${JSON.stringify(data)}&disabled=${tags.includes("报备中")||tags.includes("已报备")}`,
  489. })
  490. break;
  491. case "作废":
  492. _Http.basic({
  493. "id": "20221223102102",
  494. "content": {
  495. "nocache": true,
  496. "sa_projectid": that.data.sa_projectid,
  497. pageNumbe: 1,
  498. pageSize: 9999,
  499. "where": {
  500. "conditino": ""
  501. }
  502. }
  503. }).then(res => {
  504. console.log("查询合同列表", res)
  505. if (res.code != '1') return wx.showToast({
  506. title: res.data,
  507. icon: "none"
  508. })
  509. if (res.data.some(v => v.status == '审核')) {
  510. wx.showModal({
  511. title: getApp().globalData.Language.getMapText('提示'),
  512. content: getApp().globalData.Language.getMapText('当前项目中存在审核状态合同,不可作废') + '!',
  513. showCancel: false,
  514. confirmText: getApp().globalData.Language.getMapText('确定'),
  515. })
  516. } else {
  517. wx.navigateTo({
  518. url: `/packageA/project/delete?id=${this.data.detail.sa_projectid}`,
  519. })
  520. }
  521. })
  522. break;
  523. case "更换负责人":
  524. wx.navigateTo({
  525. url: `/pages/group/select?data=${JSON.stringify({
  526. ownertable:"sa_project",
  527. ownerid:data.sa_projectid,
  528. })}&radio=true&principal=true`,
  529. })
  530. break;
  531. case "查看重复":
  532. _Http.basic({
  533. "id": 20221208184202,
  534. "content": {
  535. ...data,
  536. pageSize: 999
  537. }
  538. }).then(res => {
  539. console.log("查看重复", res)
  540. if (res.code != '1') return wx.showToast({
  541. title: res.msg,
  542. icon: "none"
  543. });
  544. if (res.data.length == 0) {
  545. getApp().globalData.Language.showToast('未查询到重复数据')
  546. this.getTags()
  547. } else {
  548. this.setTags();
  549. this.setData({
  550. repetitionList: res.data.map(v => {
  551. v.chars = v.chars.reduce((acc, item) => ({
  552. ...acc,
  553. ...item
  554. }), {});
  555. return v
  556. }),
  557. repetitionShow: true
  558. })
  559. }
  560. })
  561. break;
  562. default:
  563. console.log(detail)
  564. break;
  565. }
  566. },
  567. /* 恢复项目 */
  568. onRecover() {
  569. _Http.basic({
  570. "id": 20221215164002,
  571. "content": {
  572. "sa_projectid": this.data.sa_projectid
  573. }
  574. }).then(res => {
  575. console.log('恢复', res)
  576. wx.showToast({
  577. title: res.code == '1' ? getApp().globalData.Language.getMapText('已恢复') : res.msg,
  578. icon: "none",
  579. mask: true
  580. });
  581. if (res.code == '1') setTimeout(this.getDetail, 300);
  582. })
  583. },
  584. /* 关闭查重弹窗 */
  585. repClose() {
  586. let that = this;
  587. if (this.data.isRecover) wx.showModal({
  588. title: getApp().globalData.Language.getMapText('提示'),
  589. content: getApp().globalData.Language.getMapText('存在重复项目,是否确认恢复'),
  590. cancelText: getApp().globalData.Language.getMapText('取消'),
  591. confirmText: getApp().globalData.Language.getMapText('确定'),
  592. complete: ({
  593. confirm
  594. }) => {
  595. if (confirm) {
  596. that.onRecover(true)
  597. that.setTags();
  598. }
  599. }
  600. });
  601. this.setData({
  602. repetitionShow: false,
  603. isRecover: false
  604. })
  605. },
  606. /* setTags */
  607. setTags() {
  608. let {
  609. datatag,
  610. systemtag
  611. } = this.selectComponent("#Tags").returnTags();
  612. if (!systemtag.some(v => v == '疑似重复')) {
  613. systemtag.push("疑似重复")
  614. _Http.basic({
  615. "id": 20220929090901,
  616. "content": {
  617. "ownertable": "sa_project",
  618. "ownerid": this.data.sa_projectid,
  619. datatag,
  620. systemtag
  621. }
  622. }).then(res => {
  623. console.log("绑定疑似重复标签", res)
  624. if (res.code == '1') this.getTags();
  625. })
  626. } else {
  627. this.getTags();
  628. }
  629. },
  630. /* 1提交报备,2报备审核,3报备驳回(退回) */
  631. handleReport(type) {
  632. _Http.basic({
  633. "id": 20221114163402,
  634. "content": {
  635. "sa_projectid": this.data.sa_projectid,
  636. type
  637. }
  638. }).then(res => {
  639. console.log("报备", type, res)
  640. if (res.code != '1') {
  641. wx.showModal({
  642. title: getApp().globalData.Language.getMapText('提示'),
  643. content: res.msg,
  644. showCancel: false,
  645. confirmText: getApp().globalData.Language.getMapText('确定'),
  646. })
  647. } else {
  648. wx.showToast({
  649. title: getApp().globalData.Language.getMapText('操作成功'),
  650. icon: "none",
  651. mask: true
  652. })
  653. this.getDetail();
  654. this.getTags();
  655. }
  656. })
  657. },
  658. //局部数据更新 tabs
  659. partialRenewal(init = false) {
  660. let model = this.data.tabsList[this.data.tabsActive].model;
  661. if (model) {
  662. let Component = this.selectComponent(model),
  663. {
  664. total,
  665. pageNumber,
  666. pageTotal
  667. } = Component.data.content,
  668. id = this.data.sa_projectid;
  669. if (model == "#Files") init = true;
  670. if (total == null || init) {
  671. Component.getList(id, init);
  672. } else if (pageNumber <= pageTotal) {
  673. Component.getList(id, false);
  674. }
  675. }
  676. },
  677. onReachBottom() {
  678. this.partialRenewal();
  679. },
  680. /* 项目评估切换 */
  681. taskTabsChange({
  682. detail
  683. }) {
  684. if (detail.change) {
  685. this.setData({
  686. tabsActive: this.data.tabsList.findIndex(v => v.label == '项目评估')
  687. });
  688. this.selectComponent("#Task").getList(this.data.sa_projectid, true)
  689. }
  690. },
  691. //tabs 切换
  692. tabsChange({
  693. detail
  694. }) {
  695. this.setData({
  696. tabsActive: detail
  697. });
  698. this.partialRenewal();
  699. },
  700. /* 更换负责人 */
  701. handelSubmit(arr) {
  702. const that = this;
  703. wx.showModal({
  704. title: getApp().globalData.Language.getMapText('提示'),
  705. content: getApp().globalData.Language.getMapText('是否确认更换负责人'),
  706. cancelText: getApp().globalData.Language.getMapText('取消'),
  707. confirmText: getApp().globalData.Language.getMapText('确定'),
  708. complete: ({
  709. confirm
  710. }) => {
  711. if (confirm) wx.showModal({
  712. title: getApp().globalData.Language.getMapText('提示'),
  713. content: getApp().globalData.Language.getMapText('是否参与该数据的后续工作'),
  714. cancelText: getApp().globalData.Language.getMapText('不参与'),
  715. confirmText: getApp().globalData.Language.getMapText('参与'),
  716. complete: (s) => {
  717. _Http.basic({
  718. "id": 20220930103701,
  719. "content": {
  720. ownertable: "sa_project",
  721. ownerid: that.data.detail.sa_projectid,
  722. userid: arr[0],
  723. isaddoldleader: s.confirm ? 1 : 0
  724. }
  725. }).then(res => {
  726. console.log("更换负责人", res)
  727. wx.showToast({
  728. title: res.code != '1' ? res.msg : getApp().globalData.Language.getMapText('更换成功'),
  729. icon: "none",
  730. mask: true
  731. });
  732. if (res.code == '1') setTimeout(() => {
  733. wx.navigateBack({
  734. delta: 2
  735. });
  736. }, 300)
  737. })
  738. }
  739. })
  740. }
  741. })
  742. },
  743. //更新标签
  744. getTags() {
  745. this.selectComponent("#Tags").getTags();
  746. },
  747. //更新团队成员
  748. getGroup() {
  749. this.selectComponent("#Group").getList().then(this.setTabbarList)
  750. },
  751. /* tag更新列表 */
  752. onGetList({
  753. detail
  754. }) {
  755. let tabbarList = this.data.tabbarList;
  756. if (detail.data.systemtag.includes('已报备')) {
  757. let status = this.data.detail.status
  758. if (this.data.isLeader && status != '已失败' && status != '已结案') tabbarList.unshift({
  759. icon: "icon-faqishouquan",
  760. label: "发起授权"
  761. })
  762. this.setData({
  763. isInsert: true,
  764. tabbarList
  765. })
  766. }
  767. },
  768. onUnload() {
  769. const page = getCurrentPages().find(v => v.__route__ == 'packageA/project/index');
  770. if (!page) return;
  771. let content = JSON.parse(JSON.stringify(page.data.content));
  772. content.pageSize = (content.pageNumber - 1) * content.pageSize;
  773. content.pageNumber = 1;
  774. _Http.basic({
  775. id: 20221020143502,
  776. content
  777. }).then(res => {
  778. console.log("更新项目商机列表", res);
  779. if (res.code == '1') {
  780. page.data.list = res.data.map(v => {
  781. v.progress = v.stage / v.totalstage * 100;
  782. return v
  783. });
  784. page.data.content.total = res.total;
  785. page.getTags();
  786. }
  787. })
  788. }
  789. })