select-data.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927
  1. const app = getApp();
  2. const api = require('@/utils/api.js');
  3. const Constants = require('@/utils/Constants.js')
  4. const mixins = require('@/mixins/index.js')
  5. Page({
  6. mixins: [mixins],
  7. /**
  8. * 页面的初始数据
  9. */
  10. data: {
  11. showPop: false,
  12. gradeCode: app.globalData.company.gradeCode,
  13. active: 0,
  14. // 选择数据
  15. choosedData: [],
  16. // // 是否显示tab
  17. // tabFlag: false,
  18. // 页签默认在第一个
  19. // 查询条件
  20. searchContent: null,
  21. // 路由
  22. routeObjName: 'common',
  23. // pop使用
  24. routeObjNamePop: '',
  25. // 列表区(内容)
  26. contentList: null,
  27. // 方法名
  28. method: null,
  29. // 字典类型
  30. dictCode: null,
  31. // 标题
  32. title: null,
  33. // 弹出pop的标题
  34. popTitle: null,
  35. // 需要调到的新建路由
  36. addUrl: null,
  37. // 是否多选
  38. chooseFlag: false,
  39. // 提示信息
  40. placeholder: [],
  41. // tab页签
  42. tagList: [],
  43. // 用于多选
  44. valueKey: null,
  45. labelKey: null,
  46. // 多选时是否允许重复
  47. repeatFlag: false,
  48. // 简单标识
  49. simpleFlag: false,
  50. // 弹出新建
  51. popContent: null,
  52. // 是否有默认值
  53. defaultFlag: false,
  54. // 简单模式
  55. simpleFlag: false,
  56. // 确定按钮
  57. buttonList: [{
  58. name: 'confirm',
  59. title: '确定'
  60. }],
  61. },
  62. /**
  63. * @desc : 调到新建
  64. * @author : 姜永辉
  65. * @date : 2022/5/23 15:16
  66. */
  67. toAdd() {
  68. let addUrl = this.data.addUrl
  69. // 如果链接有值,跳转
  70. if (addUrl) {
  71. let _this = this
  72. wx.navigateTo({
  73. url: this.data.addUrl,
  74. events: {
  75. // 保存成功后刷新页面
  76. refresh: function (data) {
  77. // 刷新一览界面
  78. _this.searchData();
  79. }
  80. },
  81. success: function (res) {
  82. // 通过eventChannel向被打开页面传送数据 TODO 测试例子url是写死的,实际中,需要从route中读取
  83. res.eventChannel.emit('params', { formType: _this.data.chooseRoute.type, backFlag: true })
  84. }
  85. })
  86. } else if (this.data.popContent && this.data.popContent.length > 0) {
  87. this.setData({
  88. showPop: true
  89. })
  90. }
  91. },
  92. /**
  93. * @desc : 选择数据
  94. * @author : 周兴
  95. * @date : 2024/3/25 15:16
  96. */
  97. chooseData(e) {
  98. let list = e.detail.list;
  99. let item = e.detail.item;
  100. let valueKey = this.data.valueKey;
  101. if (!valueKey) {
  102. this.setData({
  103. choosedData: list
  104. })
  105. } else {
  106. let choosedData = this.data.choosedData
  107. // 不允许重复
  108. if (!this.data.repeatFlag) {
  109. if (e.detail.checked) { // 勾选
  110. let filters = choosedData.filter(it => it[valueKey] == item[valueKey])
  111. if (!filters || filters.length == 0) {
  112. choosedData.push(item);
  113. }
  114. } else { // 取消勾选
  115. choosedData = choosedData.filter(it => it[valueKey] != item[valueKey])
  116. }
  117. } else {
  118. if (e.detail.checked) { // 勾选
  119. // 可以重复
  120. choosedData.push(item);
  121. }
  122. }
  123. this.setData({
  124. choosedData: choosedData
  125. })
  126. }
  127. },
  128. /**
  129. * @desc : 确定事件-返回数据
  130. * @author : 周兴
  131. * @date : 2024/3/25 15:16
  132. */
  133. confirm() {
  134. let list = [...this.data.choosedData]
  135. let id = list.map(it => it[this.data.valueKey])
  136. let name = list.map(it => it[this.data.labelKey])
  137. const eventChannel = this.getOpenerEventChannel();
  138. eventChannel.emit('bindData', {
  139. data: {
  140. list,
  141. id,
  142. name
  143. }
  144. })
  145. wx.navigateBack({
  146. delta: 1
  147. })
  148. },
  149. /**
  150. * @desc : 点击事件-返回数据
  151. * @author : 周兴
  152. * @date : 2024/5/8 15:16
  153. */
  154. choose(e) {
  155. // 如果选择框开启就走确定模式
  156. if (this.data.chooseFlag) {
  157. return;
  158. }
  159. let item = e.currentTarget.dataset.item
  160. let index = e.currentTarget.dataset.index
  161. let tableData = this.data.tableData
  162. tableData.forEach(res => {
  163. res.checked = false
  164. })
  165. tableData[index].checked = true
  166. this.setData({
  167. tableData: tableData
  168. })
  169. // 执行点击事件
  170. this._toDetail(item);
  171. },
  172. /**
  173. * @desc : 点击事件-返回数据
  174. * @author : 姜永辉
  175. * @date : 2022/5/23 15:16
  176. */
  177. toDetail(e) {
  178. // 如果选择框开启就走确定模式
  179. if (this.data.chooseFlag) {
  180. return;
  181. }
  182. let item = e.detail.item
  183. let tableData = this.data.tableData
  184. tableData.forEach(res => {
  185. res.checked = false
  186. })
  187. tableData[e.detail.index].checked = true
  188. this.setData({
  189. tableData: tableData
  190. })
  191. // 执行点击事件
  192. this._toDetail(item);
  193. },
  194. /**
  195. * @desc : 执行点击事件(私有方法)
  196. * @author : 周兴
  197. * @date : 2024/5/9 15:16
  198. */
  199. _toDetail(item) {
  200. // 读取传入的单据类型
  201. let route = this.data.chooseRoute
  202. console.log('dddf', route);
  203. let data = {}
  204. switch (route.type) {
  205. // 部门
  206. case Constants.chooseType.org:
  207. data = {
  208. id: item.orgId,
  209. name: item.orgName
  210. }
  211. break;
  212. // 员工
  213. case Constants.chooseType.staff:
  214. data = {
  215. id: item.staffId,
  216. name: item.staffName,
  217. orgId: item.orgId,
  218. orgName: item.orgName,
  219. staffPhone: item.staffPhone,
  220. }
  221. break;
  222. // 角色
  223. case Constants.chooseType.role:
  224. data = {
  225. id: item.roleId,
  226. name: item.roleName,
  227. }
  228. break;
  229. //渠道
  230. case Constants.chooseType.saleChannel:
  231. data = {
  232. id: item.channelId,
  233. name: item.channelName,
  234. code: item.channelCode
  235. }
  236. break;
  237. //客户来源
  238. case Constants.chooseType.cusFrom:
  239. data = {
  240. id: item.dataId,
  241. name: item.dataValue,
  242. code: item.dataCode
  243. }
  244. break;
  245. // 供应商
  246. case Constants.chooseType.supplier:
  247. case Constants.chooseType.outSupplier:
  248. data = {
  249. id: item.supId,
  250. name: item.supName,
  251. item: item
  252. }
  253. break;
  254. // 对象类型
  255. case Constants.chooseType.objectType:
  256. data = {
  257. id: item.objId,
  258. name: item.objName,
  259. objType: item.objType
  260. }
  261. break;
  262. // 仓库
  263. case Constants.chooseType.warehouse:
  264. data = {
  265. id: item.whId,
  266. name: item.whName
  267. }
  268. break;
  269. case Constants.chooseType.inventorySku:
  270. data = {
  271. id: item.whId,
  272. name: item.whName,
  273. item: item
  274. }
  275. break;
  276. // 品牌
  277. case Constants.chooseType.brand:
  278. data = {
  279. id: item.brandId,
  280. name: item.brandName
  281. }
  282. break;
  283. // 系统数据
  284. case Constants.chooseType.kindData:
  285. data = {
  286. id: item.kindCode,
  287. name: item.kindName
  288. }
  289. break;
  290. // 数据字典
  291. case Constants.chooseType.dictionary:
  292. data = {
  293. id: item.dataId,
  294. name: item.dataValue,
  295. dictCode: item.dictCode,
  296. dataCode: item.dataCode,
  297. flgDefault: item.flgDefault,
  298. }
  299. break;
  300. // 系统数据
  301. case Constants.chooseType.kindType:
  302. data = {
  303. id: item.id,
  304. name: item.kindName,
  305. kindType: item.kindType,
  306. kindCode: item.kindCode,
  307. flgDefault: item.flgDefault,
  308. }
  309. break;
  310. default:
  311. data = {}
  312. break;
  313. }
  314. const eventChannel = this.getOpenerEventChannel();
  315. eventChannel.emit('bindData', {
  316. data: data
  317. })
  318. wx.navigateBack({
  319. delta: 1
  320. })
  321. },
  322. /**
  323. * @desc : 设置查询参数
  324. * @date : 2024/3/25 15:49
  325. * @author : 周兴
  326. */
  327. setSearchParams(params) {
  328. params.flgValid = true
  329. // 字典类别
  330. if (this.data.dictCode) {
  331. params.dictCode = this.data.dictCode
  332. }
  333. // 系统数据
  334. if (this.data.kindType) {
  335. params.kindType = this.data.kindType
  336. }
  337. console.log('eee', this.data.chooseRoute);
  338. let chooseType = this.data.chooseRoute.type;
  339. // 供应商
  340. if (chooseType == Constants.chooseType.supplier) {
  341. params.supType = "";
  342. let active = this.data.active
  343. params.supType = Constants.kindCode.supplierPur;
  344. if (active == 1) { //采购供应商
  345. params.supType = Constants.kindCode.supplierPur;
  346. } else if (active == 2) { //服务供应商
  347. params.supType = Constants.kindCode.supplierService;
  348. }
  349. }
  350. // 外协供应商
  351. if (chooseType == Constants.chooseType.outSupplier) {
  352. params.supType = Constants.kindCode.supplierOutsourcing;
  353. }
  354. //跟据色号公司skuid判断库存
  355. if (chooseType == Constants.chooseType.inventorySku) {
  356. console.log('globalData', app.globalData)
  357. params.skuId = this.data.item.skuId
  358. params.nonStdCode = this.data.item.nonStdCode
  359. params.cpId = app.globalData.company.cpId
  360. }
  361. if (chooseType == Constants.chooseType.saleChannel) {
  362. params.dataSourceCode = Constants.chooseType.saleChannel
  363. }
  364. if (chooseType == Constants.chooseType.cusFrom) {
  365. params.dataSourceCode = Constants.chooseType.cusFrom
  366. }
  367. if (chooseType == Constants.chooseType.inventorySku) {
  368. params.flgValid = true
  369. }
  370. if (chooseType == Constants.chooseType.warehouse) {
  371. params.flgValid = true
  372. }
  373. return params
  374. },
  375. /**
  376. * @desc : 删除已选
  377. * @date : 2024年3月26日
  378. * @author : 周兴
  379. */
  380. delChoosed(e) {
  381. let choosedData = this.data.choosedData;
  382. choosedData = choosedData.filter((it, index) => index != e.detail.index)
  383. this.setData({
  384. choosedData: choosedData
  385. })
  386. },
  387. /**
  388. * @desc : 查询数据
  389. * @date : 2024年3月23日
  390. * @author : 周兴
  391. */
  392. getData(params) {
  393. console.log('this.data.routeObjName', this.data.method)
  394. let service = app.globalData[this.data.routeObjName + 'Service'];
  395. return this.excute(service, service[this.data.method], params);
  396. },
  397. /**
  398. * @desc : 保存数据
  399. * @date : 2024年5月9日
  400. * @author : 周兴
  401. */
  402. editItems(e) {
  403. let data = e.detail.form
  404. // 基础资料的传值
  405. data.dictCode = this.data.dictCode
  406. this.setData({
  407. formData: JSON.stringify(data)
  408. })
  409. //执行保存编辑操作
  410. this.save({})
  411. },
  412. /**
  413. * @desc : 执行保存
  414. * @date : 2024年5月9日
  415. * @author : 周兴
  416. */
  417. saveData(params) {
  418. let routeObjNamePop = this.data.routeObjNamePop
  419. if (!routeObjNamePop) return;
  420. let service = app.globalData[routeObjNamePop + 'Service']
  421. let defaultFlag = this.data.defaultFlag;
  422. // 没有默认值就直接保存
  423. if (!defaultFlag) {
  424. return this.excute(service, service.insert, params).then(res => {
  425. if (res.data.code === Constants.SUCESS_CODE) {
  426. wx.showToast({
  427. title: '保存成功',
  428. image: '/static/image/success.png',
  429. duration: 2000
  430. })
  431. if (res.data.data) {
  432. setTimeout(() => {
  433. // 执行点击事件
  434. this._toDetail(res.data.data)
  435. }, 2000)
  436. }
  437. }
  438. })
  439. } else {
  440. this.isFlgDefaultSave(service).then(it => {
  441. //存在默认
  442. Dialog.confirm({
  443. message: mixins.$t('defaultInfo'),
  444. }).then(() => {
  445. return this.excute(service, service.insert, params).then(res => {
  446. if (res.data.code === Constants.SUCESS_CODE) {
  447. wx.showToast({
  448. title: '保存成功',
  449. image: '/static/image/success.png',
  450. duration: 2000
  451. })
  452. if (res.data.data) {
  453. setTimeout(() => {
  454. // 执行点击事件
  455. this._toDetail(res.data.data)
  456. }, 2000)
  457. }
  458. }
  459. })
  460. }).catch(() => {
  461. // this.setData({
  462. // dataItem: null
  463. // })
  464. // //清除组件数据
  465. // this.selectComponent('#popup').setFormNull()
  466. return
  467. });
  468. })
  469. }
  470. },
  471. /**
  472. * @desc : 新建默认设置提示
  473. * @author : 于继渤
  474. * @date : 2022/5/26 20:16
  475. */
  476. isFlgDefaultSave(service) {
  477. return new Promise((resolve, reject) => {
  478. this.excute(service, service.selectByCond, {
  479. flgDefault: true
  480. }).then(res => {
  481. if (res.data.data.list && res.data.data.list.length > 0) {
  482. resolve(false)
  483. } else {
  484. resolve(true)
  485. }
  486. })
  487. })
  488. },
  489. /**
  490. * @desc : tab切换(列表和已选)
  491. * @date : 2024/3/25 15:49
  492. * @author : 周兴
  493. */
  494. changeTag(e) {
  495. this.setData({
  496. active: e.detail.index
  497. })
  498. },
  499. /**
  500. * @desc : 切换tab
  501. * @date : 2024/2/1 15:49
  502. * @author : 周兴
  503. */
  504. onChangeTabs(e) {
  505. let index = e.detail.detail.index
  506. this.setData({
  507. active: index,
  508. })
  509. // 查询
  510. this.searchData()
  511. },
  512. /**
  513. * @desc : stickyView的高度
  514. * @date : 2024年3月23日
  515. * @author : 周兴
  516. */
  517. queryHeight() {
  518. let _this = this
  519. var query = wx.createSelectorQuery();
  520. query.select('#stickyView').boundingClientRect(function (rect) {
  521. var height = rect.height; // 获取元素的高度
  522. console.log('元素的高度: ' + height + 'px');
  523. _this.setData({
  524. heightList: height + 20
  525. })
  526. }).exec();
  527. },
  528. /**
  529. * @desc : 生命周期函数(初始加载)
  530. * @date : 2024年3月23日
  531. * @author : 周兴
  532. */
  533. loadInit(e) {
  534. // stickyView的高度
  535. this.queryHeight()
  536. let route = this.data.chooseRoute;
  537. if (!route || !route.type) {
  538. return;
  539. }
  540. let title;
  541. // 读取传入的单据类型
  542. let chooseType = route.type
  543. switch (chooseType) {
  544. // 角色
  545. case Constants.chooseType.role:
  546. title = "角色"
  547. this.setData({
  548. addUrl: '/package-basic-data/pages/role/add/add',
  549. routeObjName: 'common',
  550. method: 'getRole',
  551. title: 'roleName',
  552. chooseFlag: route.chooseFlag,
  553. contentList: [{
  554. name: 'roleCode',
  555. title: '编码'
  556. },],
  557. placeholder: ['roleName']
  558. })
  559. break;
  560. // 部门
  561. case Constants.chooseType.org:
  562. title = "部门"
  563. this.setData({
  564. addUrl: app.globalData.company.gradeCode == Constants.gradeCode.STD ? null : '/package-basic-data/pages/org/org',
  565. routeObjName: 'common',
  566. method: 'getOrg',
  567. title: 'orgName',
  568. contentList: [{
  569. name: 'orgCode',
  570. title: '部门编码'
  571. },],
  572. placeholder: ['orgName']
  573. })
  574. break;
  575. // 员工
  576. case Constants.chooseType.staff:
  577. title = "员工"
  578. this.setData({
  579. addUrl: '/package-basic-data/pages/staff/add/add',
  580. routeObjName: 'common',
  581. method: 'getStaff',
  582. title: 'staffName',
  583. contentList: [{
  584. name: 'staffCode',
  585. title: '员工工号'
  586. },
  587. {
  588. name: 'orgName',
  589. title: '部门'
  590. },
  591. ],
  592. placeholder: ['staffName']
  593. })
  594. break;
  595. //客户来源
  596. case Constants.chooseType.cusFrom:
  597. title = "客户来源"
  598. this.setData({
  599. routeObjName: 'common',
  600. method: 'getInitData',
  601. title: 'dataValue',
  602. contentList: [{
  603. name: 'dataCode',
  604. title: '来源编码'
  605. },
  606. {
  607. name: 'dataValue',
  608. title: '来源名称'
  609. },
  610. ],
  611. placeholder: ['sourceName']
  612. })
  613. break;
  614. //销售渠道
  615. case Constants.chooseType.saleChannel:
  616. title = "销售渠道"
  617. this.setData({
  618. routeObjName: 'common',
  619. method: 'getInitData',
  620. title: 'channelName',
  621. simpleFlag: true,
  622. placeholder: ['channelName']
  623. })
  624. console.log('rrrrr', this.data.simpleFlag);
  625. break;
  626. // 供应商
  627. case Constants.chooseType.supplier:
  628. case Constants.chooseType.outSupplier:
  629. title = "供应商"
  630. this.setData({
  631. addUrl: '/package-purchase/pages/supplier-list/add/add',
  632. routeObjName: 'supplier',
  633. method: 'selectByCond',
  634. title: 'supName',
  635. valueKey: 'supId',
  636. labelKey: 'supName',
  637. chooseFlag: route.chooseFlag,
  638. contentList: [{
  639. name: 'supTypeName',
  640. title: '供应商类别'
  641. },
  642. {
  643. name: 'returnAddress',
  644. title: '供应商地址'
  645. },
  646. {
  647. name: 'payableResidue',
  648. title: '剩余应付'
  649. },
  650. {
  651. name: 'paymentResidue',
  652. title: '预付金额'
  653. },
  654. ],
  655. placeholder: ['supplier']
  656. })
  657. // 多选时就不要有其他的tag标签
  658. // if (!route.chooseFlag) {
  659. // this.setData({
  660. // tagList: [{
  661. // title: mixins.$t("all") //全部
  662. // }, {
  663. // title: mixins.$t("procurementSupplier") //采购供应商
  664. // }, {
  665. // title: mixins.$t("serviceProvider") // 服务供应商
  666. // }],
  667. // })
  668. // }
  669. break;
  670. // 仓库
  671. case Constants.chooseType.warehouse:
  672. title = "仓库"
  673. let dataItemData = {}
  674. dataItemData['supervisor'] = app.globalData.user.staffName
  675. dataItemData['contactPhone'] = app.globalData.user.userPhone
  676. this.setData({
  677. routeObjName: 'common',
  678. routeObjNamePop: 'warehouse',
  679. method: 'getWarehouseListBy',
  680. title: 'whName',
  681. contentList: [{
  682. name: 'supervisor',
  683. title: '仓库主管'
  684. },
  685. {
  686. name: 'contactPhone',
  687. title: '联系电话'
  688. },
  689. ],
  690. placeholder: ['whName'],
  691. popContent:
  692. [
  693. // { code: 'whCode', type: 'str', title: mixins.$t('whCode'), required: false, readonly: true, },
  694. { code: 'whName', type: 'str', title: mixins.$t('whName'), required: true },
  695. {
  696. name: 'supervisor',
  697. code: 'supervisor',
  698. title: mixins.$t("supervisor"),
  699. type: 'choose',
  700. required: true,
  701. urlKey: 'chooseStaff'
  702. },
  703. { code: 'contactPhone', type: 'str', title: mixins.$t('contactPhone'), required: true },
  704. { code: 'remarks', type: 'str', title: mixins.$t('remarks'), required: false }
  705. ],
  706. //设置默认主管
  707. dataItem: JSON.stringify(dataItemData)
  708. })
  709. break;
  710. case Constants.chooseType.inventorySku:
  711. title = "库存"
  712. this.setData({
  713. routeObjName: 'common',
  714. method: 'getInventory',
  715. title: 'skuName',
  716. contentList: [
  717. {
  718. name: 'skuCode',
  719. title: '商品编码'
  720. },
  721. {
  722. name: 'whName',
  723. title: '库区'
  724. },
  725. {
  726. name: 'nonStdCode',
  727. title: '色号'
  728. },
  729. {
  730. name: 'usableQty',
  731. title: '可售量'
  732. },
  733. {
  734. name: 'invQty',
  735. title: '库存量'
  736. },
  737. {
  738. name: 'outingQty',
  739. title: '占库量'
  740. },
  741. {
  742. name: 'freezeQty',
  743. title: '冻结量'
  744. },
  745. ],
  746. placeholder: ['whName']
  747. })
  748. break;
  749. // 品牌
  750. case Constants.chooseType.brand:
  751. title = "品牌"
  752. this.setData({
  753. routeObjName: 'common',
  754. routeObjNamePop: 'goodsBrand',
  755. method: 'goodsBrandListNoPage',
  756. chooseFlag: route.chooseFlag,
  757. repeatFlag: route.repeatFlag,
  758. valueKey: 'brandId',
  759. pageFlag: false,
  760. popTitle: mixins.$t('add') + title,
  761. title: 'brandName',
  762. simpleFlag: true,
  763. // contentList: [{
  764. // name: 'brandCode',
  765. // title: '品牌编码'
  766. // },
  767. // {
  768. // name: 'brandName',
  769. // title: '品牌名称'
  770. // },
  771. // ],
  772. placeholder: ['brandName']
  773. })
  774. // 标准版没有供应商
  775. if (this.data.gradeCode == Constants.gradeCode.STD) {
  776. this.setData({
  777. popContent: [
  778. { code: 'brandName', type: 'str', title: mixins.$t('brandName'), required: true },
  779. { code: 'remarks', type: 'str', title: mixins.$t('remarks'), required: false }
  780. ],
  781. })
  782. } else {
  783. this.setData({
  784. popContent: [
  785. { code: 'brandName', type: 'str', title: mixins.$t('brandName'), required: true },
  786. { code: 'supplierIds', name: 'supplierNames', title: 'supplier', type: 'choose', dropType: 'supplier', urlKey: '', code: 'supplierIds', formMode: 'index', idKey: 'roleId', title: mixins.$t('supplier') },
  787. { code: 'remarks', type: 'str', title: mixins.$t('remarks'), required: false }
  788. ],
  789. })
  790. }
  791. break;
  792. // 数据字典
  793. case Constants.chooseType.dictionary:
  794. title = "数据字典"
  795. let dictCode = route.dictCode
  796. this.setData({
  797. addUrl: '/package-basic-data/pages/basic-data/basic-data',
  798. routeObjName: 'common',
  799. method: 'getDictionaryData',
  800. routeObjNamePop: 'basicData',
  801. dictCode: route.dictCode,
  802. chooseFlag: route.chooseFlag,
  803. repeatFlag: route.repeatFlag,
  804. pageFlag: false,
  805. valueKey: 'dataId',
  806. title: 'dataValue',
  807. contentList: [{
  808. name: 'dataCode',
  809. title: '数据编码'
  810. },
  811. {
  812. name: 'dictCode',
  813. title: '字典项目'
  814. },
  815. ],
  816. placeholder: ['orgName'],
  817. })
  818. if (dictCode == mixins.$t('reasonStorageSys')) {
  819. let popContent =
  820. [
  821. { code: 'dataValue', type: 'str', title: mixins.$t('reasonName'), required: true },
  822. { code: 'remarks', type: 'str', title: mixins.$t('remarks'), required: false, },
  823. ]
  824. this.setData({
  825. popContent
  826. })
  827. }
  828. break;
  829. // 系统数据
  830. case Constants.chooseType.kindData:
  831. title = "系统数据"
  832. this.setData({
  833. routeObjName: 'common',
  834. method: 'getDataKind',
  835. kindType: route.kindType,
  836. valueKey: 'kindCode',
  837. title: 'kindName',
  838. chooseFlag: route.chooseFlag,
  839. repeatFlag: route.repeatFlag,
  840. contentList: [{
  841. name: 'kindCode',
  842. title: '数据代码'
  843. },
  844. {
  845. name: 'kindName',
  846. title: '数据名称'
  847. },
  848. ],
  849. placeholder: ['sensitiveName']
  850. })
  851. break;
  852. // 对象类型
  853. case Constants.chooseType.objectType:
  854. title = "对象类型"
  855. this.setData({
  856. routeObjName: 'common',
  857. method: 'getSupplierAndCustomerData',
  858. title: 'objName',
  859. contentList: [{
  860. name: 'objCode',
  861. title: '对象编码'
  862. },
  863. {
  864. name: 'objTypeName',
  865. title: '对象'
  866. },
  867. {
  868. name: 'addressFull',
  869. title: '地址'
  870. },
  871. {
  872. name: 'phone',
  873. title: '电话'
  874. },
  875. ],
  876. searchContent: [{
  877. code: 'supplier-customer',
  878. title: '选择对象',
  879. searchType: Constants.searchType.switch,
  880. list: [{
  881. code: 'supplier',
  882. title: '供应商',
  883. value: 1,
  884. },
  885. {
  886. code: 'customer',
  887. title: '客户',
  888. value: 2
  889. }
  890. ]
  891. },
  892. ],
  893. placeholder: ['customerName', 'supplierName', 'address', 'telephone']
  894. })
  895. break;
  896. default:
  897. break;
  898. }
  899. // 多选,数据回显到已选列表
  900. if (this.data.chooseFlag && this.data.item && this.data.item.data) {
  901. this.setData({
  902. choosedData: this.data.item.data
  903. })
  904. }
  905. wx.setNavigationBarTitle({
  906. title: '选择' + title,
  907. })
  908. // 调取查询
  909. this.searchData();
  910. },
  911. })