add.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712
  1. /*******************************************************************************
  2. * Copyright(c) 2022 dongke All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:
  5. * 编辑履历:
  6. * 作者 日期 版本 修改内容
  7. * 王英杰 2024-1-24 1.00 新建商品档案
  8. *******************************************************************************/
  9. const mixins = require('@/mixins/index.js')
  10. const app = getApp()
  11. const util = require('@/utils/util.js')
  12. const Constants = require('@/utils/Constants')
  13. Page({
  14. mixins: [mixins],
  15. /**
  16. * 页面的初始数据
  17. */
  18. data: {
  19. gradeCode: app.globalData.company.gradeCode, //判断版本的 ( 标准还是专业)
  20. buttonList: [{
  21. name: 'merge',
  22. title: mixins.$t("save"), //'保存'
  23. }],
  24. table: Constants.tables.goodsSku,
  25. cardList: [], //不在这定义 在 loadinit定义
  26. contentObj: {
  27. main: [{ //商品型号
  28. code: 'skuModel',
  29. type: 'textarea',
  30. title: mixins.$t("skuModel"),
  31. required: true,
  32. }, { //商品名称
  33. code: 'skuName',
  34. type: 'textarea',
  35. title: mixins.$t("skuName"),
  36. }, {
  37. code: 'skuImages',
  38. name: mixins.$t("commodityPicture"), //商品图片
  39. type: 'uploader',
  40. },
  41. ],
  42. goods: [{ //商品品牌
  43. code: 'brandId',
  44. name: 'brandName',
  45. title: mixins.$t("goodsBrand"),
  46. type: 'choose',
  47. urlKey: 'goodsBrand',
  48. required: true,
  49. },
  50. { //商品种类
  51. code: 'categoryId',
  52. name: 'catName',
  53. title: mixins.$t("goodsCategory"),
  54. type: 'choose',
  55. urlKey: 'goodsCategory',
  56. required: true,
  57. }, { //商品系列
  58. code: 'seriesId',
  59. name: 'seriesName',
  60. title: mixins.$t("goodsSeries"),
  61. type: 'choose',
  62. urlKey: 'goodsSeries',
  63. }, { //商品规格
  64. code: 'skuSpec',
  65. name: 'skuSpec',
  66. type: 'textarea',
  67. required: true,
  68. title: mixins.$t("sukSpec"),
  69. }
  70. ],
  71. unit: [{ //基本单位
  72. code: 'unitId',
  73. name: 'unitName',
  74. title: mixins.$t("unit"),
  75. type: 'choose',
  76. urlKey: 'unit',
  77. required: true,
  78. }, { //辅助单位标识
  79. type: 'switch',
  80. title: mixins.$t("subUnitId"),
  81. code: 'flgSubUnit',
  82. }, { //包装单位
  83. code: 'subUnitId',
  84. name: 'subUnitName',
  85. title: mixins.$t("packageUnit"),
  86. type: 'choose',
  87. urlKey: 'unit',
  88. required: true,
  89. }, { //包装
  90. code: 'packBox',
  91. title: mixins.$t("package"),
  92. type: 'number',
  93. sign: "",
  94. digits: 0,
  95. required: true,
  96. },
  97. {
  98. code: 'calculationFormula',
  99. type: 'textarea',
  100. title: mixins.$t("calculationFormula"),
  101. readonly:true,
  102. }
  103. ],
  104. warehouse: [{ //期初库存标识
  105. type: 'switch',
  106. title: mixins.$t("openingInv"),
  107. code: 'flgOpeningInv',
  108. }, { //仓库名称
  109. code: 'whId',
  110. name: 'whName',
  111. title: mixins.$t("whName"),
  112. type: 'choose',
  113. urlKey: 'openingInventory',
  114. required: true,
  115. },
  116. { //库存批号
  117. code: 'nonStdCode',
  118. type: 'textarea',
  119. title: mixins.$t("iinventoryBatchNumber"),
  120. required: true,
  121. },
  122. { //期初数量
  123. code: 'intoQty',
  124. type: 'number',
  125. sign: "",
  126. digits: 0,
  127. title: mixins.$t("openingInventoryQty"),
  128. required: true,
  129. },
  130. { //期初成本价
  131. code: 'priceInto',
  132. type: 'textarea',
  133. title: mixins.$t("iinitialCostPrice"),
  134. required: true,
  135. },
  136. ],
  137. price: [{ //期初库存标识
  138. type: 'switch',
  139. title: mixins.$t("flgPrice"),
  140. code: 'flgPrice',
  141. }, { //采购价
  142. tip: mixins.$t("purchasePricetip"),
  143. code: 'pricePurchase',
  144. type: 'number',
  145. title: mixins.$t("purchasePrice"),
  146. required: true,
  147. }, { //零售价
  148. tip: mixins.$t("retailPricetip"),
  149. code: 'priceStandard',
  150. type: 'number',
  151. title: mixins.$t("retailPrice"),
  152. required: true,
  153. }, { //批发价
  154. tip: mixins.$t("wholesalePricetip"),
  155. code: 'priceWholesale',
  156. type: 'number',
  157. title: mixins.$t("wholesalePrice"),
  158. required: true,
  159. }, { //销售限价
  160. tip: mixins.$t("SaleSPriceLimittip"),
  161. code: 'priceLimited',
  162. type: 'number',
  163. title: mixins.$t("SaleSPriceLimit"),
  164. required: true,
  165. }, { //其他价
  166. tip: mixins.$t("otherPriceLimittip"),
  167. code: 'priceOther',
  168. type: 'number',
  169. title: mixins.$t("otherPriceLimit"),
  170. required: true,
  171. }, ],
  172. other: [{
  173. code: 'remarks',
  174. type: 'textarea',
  175. title: mixins.$t("remarks"),
  176. }]
  177. },
  178. // 路由
  179. routeObjName: 'goodsSku',
  180. },
  181. /**
  182. * @desc : dk-form 里 dk-number-input 的输入回调
  183. * @date : 2024/2/1 15:49
  184. * @author : 王英杰
  185. */
  186. changeNumberField(e){
  187. console.log("changeNumberField",e);
  188. let code = e.detail.code
  189. let formData = JSON.parse(this.data.formData)
  190. if(code = "packBox"){//包装
  191. if(formData.packBox&&formData.unitName&&formData.subUnitName){ //选了辅助计量单位 正好 包装也有值 那么直接给出公式
  192. formData.calculationFormula = formData.packBox+ formData.unitName + '= 1'+ formData.subUnitName
  193. }
  194. }
  195. this.setData({
  196. formData:JSON.stringify(formData)
  197. })
  198. },
  199. /**
  200. * @desc : dk-form 里 Switch 的切换回调
  201. * @date : 2024/2/1 15:49
  202. * @author : 王英杰
  203. */
  204. onSwitchChange(e) {
  205. console.log("Switch", e);
  206. let code = e.detail.code
  207. let checkFlag = !e.detail.checkFlag
  208. let contentObj = this.data.contentObj
  209. if (code == "flgSubUnit") { //辅助单位
  210. if (checkFlag) {
  211. contentObj.unit = [{ //基本单位
  212. code: 'unitId',
  213. name: 'unitName',
  214. title: mixins.$t("unit"),
  215. type: 'choose',
  216. urlKey: 'unit',
  217. required: true,
  218. }, { //辅助单位标识
  219. type: 'switch',
  220. title: mixins.$t("subUnitId"),
  221. code: 'flgSubUnit',
  222. }, { //包装单位
  223. code: 'subUnitId',
  224. name: 'subUnitName',
  225. title: mixins.$t("packageUnit"),
  226. type: 'choose',
  227. urlKey: 'unit',
  228. required: checkFlag,
  229. }, { //包装
  230. code: 'packBox',
  231. title: mixins.$t("package"),
  232. type: 'number',
  233. sign: "",
  234. digits: 0,
  235. required: checkFlag,
  236. },
  237. {
  238. code: 'calculationFormula',
  239. type: 'textarea',
  240. title: mixins.$t("calculationFormula"),
  241. readonly:true,
  242. }
  243. ]
  244. } else {
  245. contentObj.unit = [{ //基本单位
  246. code: 'unitId',
  247. name: 'unitName',
  248. title: mixins.$t("unit"),
  249. type: 'choose',
  250. urlKey: 'unit',
  251. required: true,
  252. }, { //辅助单位标识
  253. type: 'switch',
  254. title: mixins.$t("subUnitId"),
  255. code: 'flgSubUnit',
  256. }, ]
  257. }
  258. } else if (code == "flgOpeningInv") { //期初库存标识
  259. if (checkFlag) {
  260. contentObj.warehouse = [{ //期初库存标识
  261. type: 'switch',
  262. title: mixins.$t("openingInv"),
  263. code: 'flgOpeningInv',
  264. }, { //仓库名称
  265. code: 'whId',
  266. name: 'whName',
  267. title: mixins.$t("whName"),
  268. type: 'choose',
  269. urlKey: 'openingInventory',
  270. required: checkFlag,
  271. },
  272. { //库存批号
  273. code: 'nonStdCode',
  274. type: 'textarea',
  275. title: mixins.$t("iinventoryBatchNumber"),
  276. required: checkFlag,
  277. },
  278. { //期初数量
  279. code: 'intoQty',
  280. type: 'number',
  281. sign: "",
  282. digits: 0,
  283. title: mixins.$t("openingInventoryQty"),
  284. required: checkFlag,
  285. },
  286. { //期初成本价
  287. code: 'priceInto',
  288. type: 'textarea',
  289. title: mixins.$t("iinitialCostPrice"),
  290. required: checkFlag,
  291. },
  292. ]
  293. } else {
  294. contentObj.warehouse = [{ //期初库存标识
  295. type: 'switch',
  296. title: mixins.$t("openingInv"),
  297. code: 'flgOpeningInv',
  298. }, ]
  299. }
  300. } else if (code == "flgPrice") { //期初库存标识
  301. if (checkFlag) {
  302. contentObj.price = [{ //期初库存标识
  303. type: 'switch',
  304. title: mixins.$t("flgPrice"),
  305. code: 'flgPrice',
  306. }, { //采购价
  307. tip: mixins.$t("purchasePricetip"),
  308. code: 'pricePurchase',
  309. type: 'number',
  310. title: mixins.$t("purchasePrice"),
  311. required: checkFlag,
  312. }, { //零售价
  313. tip: mixins.$t("retailPricetip"),
  314. code: 'priceStandard',
  315. type: 'number',
  316. title: mixins.$t("retailPrice"),
  317. required: checkFlag,
  318. }, { //批发价
  319. tip: mixins.$t("wholesalePricetip"),
  320. code: 'priceWholesale',
  321. type: 'number',
  322. title: mixins.$t("wholesalePrice"),
  323. required: checkFlag,
  324. }, { //销售限价
  325. tip: mixins.$t("SaleSPriceLimittip"),
  326. code: 'priceLimited',
  327. type: 'number',
  328. title: mixins.$t("SaleSPriceLimit"),
  329. required: checkFlag,
  330. }, { //其他价
  331. tip: mixins.$t("otherPriceLimittip"),
  332. code: 'priceOther',
  333. type: 'number',
  334. title: mixins.$t("otherPriceLimit"),
  335. required: checkFlag,
  336. }, ]
  337. } else {
  338. contentObj.price = [{ //期初库存标识
  339. type: 'switch',
  340. title: mixins.$t("flgPrice"),
  341. code: 'flgPrice',
  342. }, ]
  343. }
  344. }
  345. this.setData({
  346. contentObj: contentObj
  347. })
  348. },
  349. /**
  350. * @desc : 选择页面跳转回调事件
  351. * @date : 2024/2/1 15:49
  352. * @author : 王英杰
  353. */
  354. chooseData(e) {
  355. console.log("t", e, this.data.formData);
  356. let formData = JSON.parse(this.data.formData)
  357. let code = e.detail.code
  358. let data = e.detail.data.data
  359. if (code == "brandId") { //商品品牌
  360. formData.brandId = data.id
  361. formData.brandName = data.name
  362. }
  363. if (code == "categoryId") { //商品种类
  364. formData.categoryId = data.id
  365. formData.catName = data.name
  366. }
  367. if (code == "unitId") { //计量单位
  368. formData.unitId = data.id
  369. formData.unitName = data.name
  370. if(formData.packBox&&formData.unitName&&formData.subUnitName){ //选了辅助计量单位 正好 包装也有值 那么直接给出公式
  371. formData.calculationFormula = formData.packBox+ formData.unitName + '= 1'+ formData.subUnitName
  372. }
  373. }
  374. if (code == "subUnitId") { //辅助计量单位
  375. formData.subUnitId = data.id
  376. formData.subUnitName = data.name
  377. if(formData.packBox&&formData.unitName&&formData.subUnitName){ //选了辅助计量单位 正好 包装也有值 那么直接给出公式
  378. formData.calculationFormula = formData.packBox+ formData.unitName + '= 1'+ formData.subUnitName
  379. }
  380. }
  381. if (code == "seriesId") { //商品系列
  382. formData.seriesId = data.id
  383. formData.seriesName = data.name
  384. }
  385. if (code == "whId") { //仓库名称
  386. formData.whId = data.id
  387. formData.whName = data.name
  388. }
  389. this.setData({
  390. formData: JSON.stringify(formData)
  391. })
  392. },
  393. /**
  394. * @desc : 保存数据服务--校验
  395. * @date : 2024/2/1 15:49
  396. * @author : 王英杰
  397. */
  398. validData() {
  399. let formData = JSON.parse(this.data.formData)
  400. if(!formData.flgSubUnit){//辅助单位标识未勾选 不存包装单位 包装
  401. delete formData.subUnitId
  402. delete formData.subUnitName
  403. delete formData.packBox
  404. }
  405. //编辑的时候 就不用删除了 因为不允许修改
  406. if((!formData.flgOpeningInv)&&this.data.formMode !== Constants.formMode.edit){//期初库存标识未勾选 不存仓库名称 色号 起初数量 期初成本价
  407. delete formData.whId
  408. delete formData.whName
  409. delete formData.nonStdCode
  410. delete formData.priceInto
  411. }
  412. if(!formData.flgPrice){//价格体系标识未勾选 不存采购价 零售价 批发价 销售限价 其他价
  413. delete formData.pricePurchase
  414. delete formData.priceStandard
  415. delete formData.priceWholesale
  416. delete formData.priceLimited
  417. delete formData.priceOther
  418. }
  419. this.setData({
  420. formData:JSON.stringify(formData)
  421. })
  422. return true
  423. },
  424. // 设置保存参数
  425. setParams(params) {
  426. let saveData = JSON.parse(this.data.formData)
  427. // 修改之后的 值
  428. params = Object.assign({}, params, saveData);
  429. params.serviceCategories = (params.serviceCategories && params.serviceCategories.length > 0) ? params.serviceCategories.split(',') : []
  430. params.skuImages = params.annexPaths
  431. params.orgId = app.globalData.user.orgId
  432. return params
  433. },
  434. /**
  435. * @desc : 保存数据服务
  436. * @date : 2024/2/1 15:49
  437. * @author : 王英杰
  438. */
  439. saveData() {
  440. console.log("参数", this.data.params);
  441. let that = this
  442. if (this.data.formMode == Constants.formMode.edit) { //编辑接口
  443. return this.excute(this.data.service, this.data.service.update, this.data.params)
  444. } else { //新建接口
  445. return this.excute(this.data.service, this.data.service.insert, this.data.params).then(res => {
  446. // 增加包装;数字类型正整数,默认1
  447. let formData = {}
  448. formData.packBox = 1
  449. that.setData({
  450. formData: JSON.stringify(formData)
  451. })
  452. })
  453. }
  454. },
  455. /**
  456. * @desc : 处理保存后续事件
  457. * @date : 2024/2/1 15:49
  458. * @author : 姜永辉
  459. */
  460. handleSaveData() {
  461. //购物车跳转来的
  462. if (this.data.formType == Constants.formType.shopping) {
  463. var pages = getCurrentPages();
  464. var prevPage = pages[pages.length - 2]; //上一个页面
  465. prevPage.setData({
  466. refreshByAdd: true
  467. })
  468. setTimeout(() => {
  469. wx.navigateBack({
  470. delta: 1
  471. });
  472. }, 200)
  473. }
  474. },
  475. /**
  476. * @desc : 页面加载数据方法
  477. * @date : 2024/2/1 15:49
  478. * @author : 王英杰
  479. */
  480. loadInit() {
  481. //标准版商品档案新建、编辑、详情不展示价格体系
  482. if (this.data.gradeCode == Constants.gradeCode.STD) { //标准版
  483. this.setData({
  484. cardList: ['main', 'goods', "unit", "warehouse", 'other'],
  485. })
  486. } else {
  487. this.setData({
  488. cardList: ['main', 'goods', "unit", "warehouse", 'price', 'other'],
  489. })
  490. }
  491. if (this.data.formMode == Constants.formMode.edit) {
  492. wx.setNavigationBarTitle({
  493. title: mixins.$t('editGoodsSuk'),
  494. })
  495. } else {
  496. // 增加包装;数字类型正整数,默认1
  497. let formData = JSON.parse(this.data.formData)
  498. formData.packBox = 1
  499. formData.flgPrice = true
  500. formData.flgOpeningInv = true
  501. formData.flgSubUnit = true
  502. this.setData({
  503. formData: JSON.stringify(formData)
  504. })
  505. wx.setNavigationBarTitle({
  506. title: mixins.$t('addGoodsSuk'),
  507. })
  508. }
  509. },
  510. /**
  511. * @desc : 给表单赋值
  512. * @date : 2024/2/1 15:49
  513. * @author : 王英杰
  514. */
  515. setValuesByEdit(data) {
  516. // data.serviceCategories = (data.serviceCategories && data.serviceCategories.length > 0) ? data.serviceCategories.join(',') : undefined
  517. data.annexPaths = data.skuImages
  518. data.onlyCode = data.skuCode
  519. let contentObj = this.data.contentObj
  520. // 我们要添加的新对象是 编码 新建的时候没有 编辑的时候添加
  521. contentObj.main = [{ //唯一编码
  522. code: 'onlyCode',
  523. type: 'textarea',
  524. title: mixins.$t("onlyCode"),
  525. readonly: true
  526. }, { //商品型号
  527. code: 'skuModel',
  528. type: 'textarea',
  529. title: mixins.$t("skuModel"),
  530. required: true,
  531. }, { //商品名称
  532. code: 'skuName',
  533. type: 'textarea',
  534. title: mixins.$t("skuName"),
  535. }, {
  536. code: 'skuImages',
  537. name: mixins.$t("commodityPicture"), //商品图片
  538. type: 'uploader',
  539. },
  540. ]
  541. if (data.flgSubUnit) {
  542. contentObj.unit = [{ //基本单位
  543. code: 'unitId',
  544. name: 'unitName',
  545. title: mixins.$t("unit"),
  546. type: 'choose',
  547. urlKey: 'unit',
  548. required: true,
  549. readonly: data.inventoryCount!==0 //要校验库存; 库存量不为0不让更改
  550. }, { //辅助单位标识
  551. type: 'switch',
  552. title: mixins.$t("subUnitId"),
  553. code: 'flgSubUnit',
  554. readonly: data.inventoryCount!==0 //要校验库存; 库存量不为0不让更改
  555. }, { //包装单位
  556. code: 'subUnitId',
  557. name: 'subUnitName',
  558. title: mixins.$t("packageUnit"),
  559. type: 'choose',
  560. urlKey: 'unit',
  561. required: true,
  562. readonly: data.inventoryCount!==0 //要校验库存; 库存量不为0不让更改
  563. }, { //包装
  564. code: 'packBox',
  565. title: mixins.$t("package"),
  566. type: 'number',
  567. sign: "",
  568. digits: 0,
  569. required: true,
  570. },
  571. {
  572. code: 'calculationFormula',
  573. type: 'textarea',
  574. title: mixins.$t("calculationFormula"),
  575. readonly:true,
  576. }
  577. ]
  578. } else {
  579. contentObj.unit = [{ //基本单位
  580. code: 'unitId',
  581. name: 'unitName',
  582. title: mixins.$t("unit"),
  583. type: 'choose',
  584. urlKey: 'unit',
  585. required: true,
  586. }, { //辅助单位标识
  587. type: 'switch',
  588. title: mixins.$t("subUnitId"),
  589. code: 'flgSubUnit',
  590. }, ]
  591. }
  592. if (data.flgOpeningInv) {
  593. contentObj.warehouse = [{ //期初库存标识
  594. type: 'switch',
  595. title: mixins.$t("openingInv"),
  596. code: 'flgOpeningInv',
  597. }, { //仓库名称
  598. code: 'whId',
  599. name: 'whName',
  600. title: mixins.$t("whName"),
  601. type: 'choose',
  602. urlKey: 'openingInventory',
  603. required: true,
  604. readonly:true,
  605. },
  606. { //库存批号
  607. code: 'nonStdCode',
  608. type: 'textarea',
  609. title: mixins.$t("iinventoryBatchNumber"),
  610. required: true,
  611. readonly:true,
  612. },
  613. { //期初数量
  614. code: 'intoQty',
  615. type: 'number',
  616. sign: "",
  617. digits: 0,
  618. title: mixins.$t("openingInventoryQty"),
  619. required: true,
  620. readonly:true,
  621. },
  622. { //期初成本价
  623. code: 'priceInto',
  624. type: 'textarea',
  625. title: mixins.$t("iinitialCostPrice"),
  626. required: true,
  627. readonly:true,
  628. },
  629. ]
  630. } else {
  631. contentObj.warehouse = [{ //期初库存标识
  632. type: 'switch',
  633. title: mixins.$t("openingInv"),
  634. code: 'flgOpeningInv',
  635. }, ]
  636. }
  637. if (data.flgPrice) {
  638. contentObj.price = [{ //期初库存标识
  639. type: 'switch',
  640. title: mixins.$t("flgPrice"),
  641. code: 'flgPrice',
  642. }, { //采购价
  643. tip: mixins.$t("purchasePricetip"),
  644. code: 'pricePurchase',
  645. type: 'number',
  646. title: mixins.$t("purchasePrice"),
  647. required: true,
  648. }, { //零售价
  649. tip: mixins.$t("retailPricetip"),
  650. code: 'priceStandard',
  651. type: 'number',
  652. title: mixins.$t("retailPrice"),
  653. required: true,
  654. }, { //批发价
  655. tip: mixins.$t("wholesalePricetip"),
  656. code: 'priceWholesale',
  657. type: 'number',
  658. title: mixins.$t("wholesalePrice"),
  659. required: true,
  660. }, { //销售限价
  661. tip: mixins.$t("SaleSPriceLimittip"),
  662. code: 'priceLimited',
  663. type: 'number',
  664. title: mixins.$t("SaleSPriceLimit"),
  665. required: true,
  666. }, { //其他价
  667. tip: mixins.$t("otherPriceLimittip"),
  668. code: 'priceOther',
  669. type: 'number',
  670. title: mixins.$t("otherPriceLimit"),
  671. required: true,
  672. }, ]
  673. } else {
  674. contentObj.price = [{ //期初库存标识
  675. type: 'switch',
  676. title: mixins.$t("flgPrice"),
  677. code: 'flgPrice',
  678. }, ]
  679. }
  680. if(data.packBox&&data.unitName&&data.subUnitName){ //选了辅助计量单位 正好 包装也有值 那么直接给出公式
  681. data.calculationFormula = data.packBox+ data.unitName + '= 1'+ data.subUnitName
  682. }
  683. this.setData({
  684. contentObj: contentObj,
  685. formData: JSON.stringify(data),
  686. buttonList: [{
  687. name: 'merge',
  688. title: mixins.$t("save"), //'保存'
  689. }],
  690. })
  691. },
  692. })