select-data.js 24 KB

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