detailsPage.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860
  1. <template>
  2. <div>
  3. <div class="borderless">
  4. <div class="customer-head">
  5. <div class="customer-back">
  6. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left" @click="backToList">
  7. 返回列表
  8. </el-button>
  9. </div>
  10. <div class="add-customer-btn">
  11. <el-button v-if="form.status == 1" size="small" @click="disabled(0)">
  12. 启用
  13. </el-button>
  14. <el-button v-if="form.status == 0" size="small" @click="disabled(1)">
  15. 禁用
  16. </el-button>
  17. <el-button type="primary" size="small" @click="editCustomer">
  18. 保存数据
  19. </el-button>
  20. </div>
  21. </div>
  22. <trade-card title="基础资料" style="margin-top: 60px">
  23. <avue-form ref="form" class="trading-form" v-model="form" :option="option">
  24. <template slot="goodsTypeId">
  25. <div style="display:flex;">
  26. <avue-cascader :emit-path="false" check-strictly :show-all-levels="false" v-model="form.goodsTypeId" placeholder="请选择产品分类" :dic="goodsTypeList" :props="props"></avue-cascader>
  27. <i class="el-icon-circle-plus-outline" style="font-size:18px;line-height: 32px;margin-left:4px" @click="goodsTypeVisible = true"></i>
  28. </div>
  29. </template>
  30. <template slot="unit">
  31. <div style="display:flex;">
  32. <avue-select v-model="form.unit" filterable placeholder="请选择单位" :dic="unitList" :props="props2"></avue-select>
  33. <i class="el-icon-circle-plus-outline" style="font-size:18px;line-height: 32px;margin-left:4px" @click="$refs.dictbiz.open()"></i>
  34. </div>
  35. </template>
  36. <template slot="whether">
  37. <el-switch v-model="form.whether" active-text="是" inactive-text="否" active-value="1" inactive-value="0" @change="whetherChange"/>
  38. </template>
  39. <template slot="whetherIntegral">
  40. <el-switch v-model="form.whetherIntegral" active-text="是" inactive-text="否" active-value="1" inactive-value="0" @change="whetherIntegralChange"/>
  41. </template>
  42. </avue-form>
  43. </trade-card>
  44. <trade-card title="库存管理" v-loading="loadingBtn">
  45. <avue-crud ref="crud" :option="optionList" :data="data" :table-loading="loading" @saveColumn="saveColumn"
  46. @resetColumn="resetColumn" :cell-style="cellStyle" @row-update="rowUpdate" @row-save="rowSave">
  47. <!--<template slot="headerSerial">-->
  48. <!-- <el-button type="primary" icon="el-icon-plus" size="mini" @click.stop="addRow"-->
  49. <!-- :disabled="detailData.status == 1" circle></el-button>-->
  50. <!--</template>-->
  51. <template slot="storageIdHeader" slot-scope="{column}">
  52. <span style="color: #409EFF;cursor: pointer" @click.stop="storageVisible = true">仓库</span>
  53. </template>
  54. <template slot="menu" slot-scope="{ row, index }">
  55. <el-button size="small" type="text" @click="rowCell(row, index)">{{ row.$cellEdit ? "保存" : "修改" }}
  56. </el-button>
  57. <!--<el-button size="small" type="text" @click="rowDel(row, index)">删除</el-button>-->
  58. </template>
  59. </avue-crud>
  60. </trade-card>
  61. <containerTitle title="主图附件"></containerTitle>
  62. <c-upload :data="filesList" display deleteUrl="/api/blade-client/goodsfiles/delete" :enumerationValue="160" />
  63. <el-dialog title="设置产品分类" v-dialogDrag :visible.sync="goodsTypeVisible" class="avue-dialog"
  64. width="80%" append-to-body @closed="goodsTypeClosed">
  65. <span>
  66. <!-- <avue-form :key="reload" ref="goodsType" v-model="form2" :option="option2" style="margin-top:20px"></avue-form> -->
  67. <goods-type></goods-type>
  68. </span>
  69. <div class="avue-dialog__footer">
  70. <el-button @click="goodsTypeVisible = false" size="mini">取 消</el-button>
  71. <el-button @click="saveGoodstype" type="primary" size="mini">确 定</el-button>
  72. </div>
  73. </el-dialog>
  74. <el-dialog title="添加仓库" v-dialogDrag :visible.sync="storageVisible" class="avue-dialog avue-dialog--top" width="30%" append-to-body @closed="storageClosed">
  75. <span>
  76. <avue-form :key="reload2" ref="storage" v-model="form3" :option="option3" style="margin-top:20px"></avue-form>
  77. </span>
  78. <div class="avue-dialog__footer">
  79. <el-button @click="storageVisible = false" size="mini">取 消</el-button>
  80. <el-button @click="savestorage" type="primary" size="mini">确 定</el-button>
  81. </div>
  82. </el-dialog>
  83. <dictbiz-dialog ref="dictbiz" title="添加单位" code="unit" parentId="1585962784498225154" @closed="getAllWorkDicts"></dictbiz-dialog>
  84. </div>
  85. </div>
  86. </template>
  87. <script>
  88. import { getGoodstype, getDetails, goodsTypesubmit, getStoragetype, submit, itemRemove, disabled, getStoragelist, storagesubmit } from "@/api/basicData/product";
  89. import { optionList } from "./js/optionList";
  90. import goodsType from '@/components/goodsType/index'
  91. import {getList} from "@/api/basicData/client";
  92. import {getList as getListpp } from "@/api/tirePartsMall/basicData/brandPage";
  93. import {listAllP} from "../../api/tirePartsMall/basicData/listingManagement";
  94. export default {
  95. name: "index",
  96. data() {
  97. return {
  98. loadingBtn: false,
  99. goodsTypeVisible: false,
  100. storageVisible: false,
  101. form: {},
  102. form2: {},
  103. form3: {},
  104. data: [],
  105. option: {
  106. menuBtn: false,
  107. labelWidth: 100,
  108. column: [
  109. {
  110. label: "名称",
  111. prop: "cname",
  112. span: 16,
  113. rules: [{
  114. required: true,
  115. message: "请输入通知标题",
  116. trigger: "blur"
  117. }]
  118. },
  119. {
  120. label: "产品分类",
  121. prop: "goodsTypeId",
  122. type: 'select',
  123. dicData: [],
  124. props: {
  125. label: 'detailedAddress',
  126. value: 'detailedAddress'
  127. },
  128. filterable: true,
  129. span: 8,
  130. rules: [{
  131. required: true,
  132. message: "请输入通知标题",
  133. trigger: "blur"
  134. }]
  135. },
  136. {
  137. label: "单位",
  138. prop: "unit",
  139. type: "select",
  140. props: {
  141. label: "dictValue",
  142. value: "dictValue"
  143. },
  144. dicUrl: "/api/blade-system/dict-biz/dictionary?code=unit",
  145. span: 8,
  146. rules: [{
  147. required: true,
  148. message: "请输入通知标题",
  149. trigger: "blur"
  150. }]
  151. },
  152. {
  153. label: "零售价",
  154. prop: "standardPrice",
  155. type: 'number',
  156. minRows: 0,
  157. controls: false,
  158. span: 8,
  159. rules: [{
  160. required: true,
  161. message: "请输入通知标题",
  162. trigger: "blur"
  163. }]
  164. },
  165. {
  166. label: "售价1",
  167. prop: "wholesalePrice",
  168. type: 'number',
  169. minRows: 0,
  170. controls: false,
  171. span: 8,
  172. rules: [{
  173. required: true,
  174. message: "请输入通知标题",
  175. trigger: "blur"
  176. }]
  177. },
  178. {
  179. label: "售价2",
  180. prop: "repairDepotPrice",
  181. type: 'number',
  182. minRows: 0,
  183. controls: false,
  184. span: 8,
  185. rules: [{
  186. required: true,
  187. message: "请输入通知标题",
  188. trigger: "blur"
  189. }]
  190. },
  191. {
  192. label: "售价3",
  193. prop: "storePrice",
  194. type: 'number',
  195. minRows: 0,
  196. controls: false,
  197. span: 8,
  198. rules: [{
  199. required: true,
  200. message: "请输入通知标题",
  201. trigger: "blur"
  202. }]
  203. },
  204. {
  205. label: "售价4",
  206. prop: "price",
  207. type: 'number',
  208. minRows: 0,
  209. controls: false,
  210. span: 8,
  211. rules: [{
  212. required: true,
  213. message: "请输入通知标题",
  214. trigger: "blur"
  215. }]
  216. },
  217. {
  218. label: "进货价",
  219. prop: "purchasePrice",
  220. type: 'number',
  221. minRows: 0,
  222. controls: false,
  223. span: 8,
  224. rules: [{
  225. required: true,
  226. message: "请输入通知标题",
  227. trigger: "blur"
  228. }]
  229. },
  230. {
  231. label: "特价",
  232. prop: "specialOffer",
  233. type: 'number',
  234. minRows: 0,
  235. controls: false,
  236. span: 8,
  237. rules: [{
  238. required: true,
  239. message: "请输入通知标题",
  240. trigger: "blur"
  241. }]
  242. },
  243. {
  244. label: "销售数量",
  245. prop: "salesVolumes",
  246. type: 'number',
  247. minRows: 0,
  248. controls: false,
  249. span: 8
  250. },
  251. {
  252. label: "标签",
  253. prop: "label",
  254. type: 'checkbox',
  255. dataType: "string",
  256. props: {
  257. label: "dictValue",
  258. value: "dictValue"
  259. },
  260. dicUrl: "/api/blade-system/dict-biz/dictionary?code=label",
  261. span: 8,
  262. },
  263. {
  264. label: "是否管理批次号",
  265. prop: "whether",
  266. labelWidth:120,
  267. span: 8,
  268. rules: [{
  269. required: true,
  270. message: "请输入通知标题",
  271. trigger: "blur"
  272. }]
  273. },
  274. {
  275. label: "是否为积分商品",
  276. prop: "whetherIntegral",
  277. labelWidth:120,
  278. span: 8,
  279. rules: [{
  280. required: true,
  281. message: "请输入通知标题",
  282. trigger: "blur"
  283. }]
  284. },
  285. {
  286. label: "门店积分",
  287. prop: "storeIntegral",
  288. type: 'number',
  289. minRows: 0,
  290. controls: false,
  291. disabled:true,
  292. span: 6,
  293. value:0,
  294. rules: [{
  295. pattern:/^[+]{0,1}(\d+)$/,
  296. message:"必须为正整数",
  297. trigger:"blur"
  298. }]
  299. },
  300. {
  301. label: "推荐人积分",
  302. prop: "referenceIntegral",
  303. type: 'number',
  304. minRows: 0,
  305. controls: false,
  306. disabled:true,
  307. span: 6,
  308. value:0,
  309. rules: [{
  310. pattern:/^[+]{0,1}(\d+)$/,
  311. message:"必须为正整数",
  312. trigger:"blur"
  313. }]
  314. },
  315. {
  316. label: "业务员积分",
  317. prop: "salesmanIntegral",
  318. type: 'number',
  319. minRows: 0,
  320. controls: false,
  321. disabled:true,
  322. span: 6,
  323. value:0,
  324. rules: [{
  325. pattern:/^[+]{0,1}(\d+)$/,
  326. message:"必须为正整数",
  327. trigger:"blur"
  328. }]
  329. },
  330. {
  331. label: "商品积分",
  332. prop: "integral",
  333. type: 'number',
  334. minRows: 0,
  335. controls: false,
  336. disabled:true,
  337. span: 6,
  338. value:0,
  339. rules: [{
  340. pattern:/^[+]{0,1}(\d+)$/,
  341. message:"必须为正整数",
  342. trigger:"blur"
  343. }]
  344. },
  345. {
  346. label: "厂家",
  347. prop: "corpId",
  348. type: "select",
  349. props: {
  350. label: "cname",
  351. value: "id"
  352. },
  353. dicData: [],
  354. span: 6,
  355. change:(val)=>{
  356. for(let item of val.column.dicData) {
  357. if (val.value == item.id) {
  358. this.form.corpName = item.cname
  359. break;
  360. }
  361. }
  362. }
  363. },
  364. // {
  365. // label: "采购日期",
  366. // prop: "exitDate",
  367. // type: "date",
  368. // format: "yyyy-MM-dd",
  369. // valueFormat: "yyyy-MM-dd 00:00:00",
  370. // span: 6,
  371. // },
  372. {
  373. label: "规格",
  374. prop: "specs",
  375. span: 6,
  376. },
  377. {
  378. label: "品牌",
  379. prop: "brandId",
  380. type: "select",
  381. props: {
  382. label: "cname",
  383. value: "id"
  384. },
  385. dicData: [],
  386. span: 6,
  387. change:(val)=>{
  388. for(let item of val.column.dicData) {
  389. if (val.value == item.id) {
  390. this.form.brand = item.cname
  391. break;
  392. }
  393. }
  394. }
  395. },
  396. {
  397. label: "功能分类",
  398. prop: "categoryitemList",
  399. type: "select",
  400. multiple:true,
  401. props: {
  402. label: "cname",
  403. value: "id"
  404. },
  405. dicUrl: "/api/blade-sales-part/brandDesc/listAll?type=GN",
  406. span: 6,
  407. },
  408. {
  409. label: "备注",
  410. prop: "remarks",
  411. type: "textarea",
  412. minRows: 3,
  413. span: 24,
  414. }
  415. ]
  416. },
  417. option2: {
  418. menuBtn: false,
  419. labelWidth: 80,
  420. column: [
  421. {
  422. label: "分类名称",
  423. prop: "cname",
  424. rules: [
  425. {
  426. required: true,
  427. message: "",
  428. trigger: "blur"
  429. }
  430. ],
  431. span: 24,
  432. },
  433. {
  434. label: "上级类型",
  435. prop: "parentId",
  436. dicData: [],
  437. type: "tree",
  438. props: {
  439. label: "title",
  440. value: "id"
  441. },
  442. span: 24,
  443. }
  444. ]
  445. },
  446. option3: {
  447. menuBtn: false,
  448. labelWidth: 80,
  449. column: [
  450. {
  451. label: "仓库名称",
  452. prop: "cname",
  453. rules: [
  454. {
  455. required: true,
  456. message: "",
  457. trigger: "blur"
  458. }
  459. ],
  460. span: 24,
  461. },
  462. {
  463. label: "仓库编码",
  464. prop: "code",
  465. rules: [
  466. {
  467. required: true,
  468. message: "",
  469. trigger: "blur"
  470. }
  471. ],
  472. span: 24,
  473. },
  474. {
  475. label: "上级类型",
  476. prop: "parentId",
  477. dicData: [],
  478. type: "tree",
  479. props: {
  480. label: 'cname',
  481. value: 'id'
  482. },
  483. span: 24,
  484. }
  485. ]
  486. },
  487. filesList: [],
  488. props: {
  489. label: 'title',
  490. value: 'value'
  491. },
  492. props2: {
  493. label: 'dictValue',
  494. value: 'dictValue'
  495. },
  496. goodsTypeList: [],
  497. unitList: [],
  498. optionList: {},
  499. // admin 权限
  500. roleNameqx:[]
  501. };
  502. },
  503. components: {
  504. goodsType
  505. },
  506. props: {
  507. detailData: {
  508. type: Object
  509. }
  510. },
  511. async created() {
  512. this.optionList = await this.getColumnData(
  513. this.getColumnName(218),
  514. optionList
  515. );
  516. if (await this.detailData.goodsTypeId){
  517. this.form.goodsTypeId = this.detailData.goodsTypeId;
  518. }
  519. if (this.detailData.id) {
  520. this.getDetail(this.detailData.id);
  521. }else {
  522. let arr = localStorage.getItem('roleName').split(',')
  523. // this.whetherIntegralChange(this.form.whetherIntegral)
  524. if (arr.indexOf('admin') != -1) {
  525. this.findObject(this.option.column, "storeIntegral").disabled = false
  526. this.findObject(this.option.column, "referenceIntegral").disabled = false
  527. this.findObject(this.option.column, "salesmanIntegral").disabled = false
  528. this.findObject(this.option.column, "integral").disabled = false
  529. }
  530. }
  531. if (this.detailData.status == 1) {
  532. this.option.disabled = true;
  533. }
  534. // 获取供应商数据
  535. this.getListfun()
  536. this.getListppfun()
  537. this.getAllWorkDicts()
  538. },
  539. methods: {
  540. // 获取供应商数据
  541. getListfun(){
  542. getList(1,20, {corpType:'GYS'}).then(res=>{
  543. console.log(res.data)
  544. this.findObject(this.option.column, "corpId").dicData = res.data.data.records
  545. })
  546. },
  547. // 获取品牌数据
  548. getListppfun(){
  549. getListpp({
  550. current: 1,
  551. size: 20,
  552. }).then(res=>{
  553. this.findObject(this.option.column, "brandId").dicData = res.data.data.records
  554. })
  555. },
  556. getAllWorkDicts() {
  557. getGoodstype().then(res => {
  558. this.goodsTypeList = res.data.data;
  559. this.findObject(this.option2.column, "parentId").dicData = res.data.data;
  560. });
  561. getStoragelist().then(res => {
  562. this.findObject(this.optionList.column, "storageId").dicData = res.data;
  563. this.findObject(this.option3.column, "parentId").dicData = res.data;
  564. });
  565. this.getWorkDicts("unit").then(res => {
  566. this.unitList = res.data.data;
  567. });
  568. },
  569. cellStyle() {
  570. return "padding:0;height:40px;";
  571. },
  572. addRow() {
  573. this.data.push({$cellEdit: true})
  574. },
  575. rowCell(row, index) {
  576. this.$refs.crud.rowCell(row, index)
  577. },
  578. rowSave(form, done) {
  579. done()
  580. },
  581. rowUpdate(form, index, done) {
  582. done()
  583. },
  584. rowDel(row, index) {
  585. this.$confirm("确定删除数据?", {
  586. confirmButtonText: "确定",
  587. cancelButtonText: "取消",
  588. type: "warning"
  589. }).then(() => {
  590. if (row.id) {
  591. itemRemove({ids: row.id}).then(res => {
  592. this.$message({
  593. type: "success",
  594. message: "删除成功!"
  595. });
  596. this.data.splice(index, 1);
  597. });
  598. } else {
  599. this.$message({
  600. type: "success",
  601. message: "删除成功!"
  602. });
  603. this.data.splice(index, 1);
  604. }
  605. });
  606. },
  607. disabled(val) {
  608. disabled({ id: this.form.id, status: val }).then(res => {
  609. this.getDetail(this.detailData.id);
  610. })
  611. },
  612. saveGoodstype() {
  613. this.$refs["goodsType"].validate((valid, done) => {
  614. done();
  615. if (valid) {
  616. goodsTypesubmit({ ...this.form2, status: 0 }).then(res => {
  617. this.getAllWorkDicts()
  618. })
  619. this.goodsTypeVisible = false
  620. } else {
  621. return false;
  622. }
  623. });
  624. },
  625. savestorage() {
  626. // this.$refs["storage"].validate((valid, done) => {
  627. // done();
  628. // if (valid) {
  629. // storagesubmit({ ...this.form3, status: 0 }).then(res => {
  630. // this.getAllWorkDicts()
  631. // })
  632. // this.storageVisible = false
  633. // } else {
  634. // return false;
  635. // }
  636. // });
  637. this.getAllWorkDicts()
  638. this.goodsTypeVisible = false
  639. },
  640. goodsTypeClosed() {
  641. // this.reload = Math.random();
  642. // this.form2 = this.$options.data().form2
  643. },
  644. storageClosed() {
  645. this.reload2 = Math.random();
  646. this.form3 = this.$options.data().form3
  647. },
  648. getDetail(id) {
  649. this.loadingBtn = true
  650. getDetails({ goodsId: id })
  651. .then(res => {
  652. this.form = res.data.data;
  653. this.form.categoryitemList = this.form.categoryitemId?this.form.categoryitemId.split(','):'';
  654. this.data = res.data.data.stockGoodsList;
  655. this.filesList = res.data.data.filesList
  656. // 判断是否是admin 权限
  657. this.roleNameqx = localStorage.getItem('roleName').split(',')
  658. let arr = localStorage.getItem('roleName').split(',')
  659. // this.whetherIntegralChange(this.form.whetherIntegral)
  660. if (arr.indexOf('admin') != -1 && res.data.data.whetherIntegral == 0) {
  661. this.findObject(this.option.column, "storeIntegral").disabled = false
  662. this.findObject(this.option.column, "referenceIntegral").disabled = false
  663. this.findObject(this.option.column, "salesmanIntegral").disabled = false
  664. this.findObject(this.option.column, "integral").disabled = false
  665. }
  666. this.whetherChange(res.data.data.whether)
  667. })
  668. .finally(() => {
  669. this.loadingBtn = false;
  670. });
  671. },
  672. // 是否为积分商品的change事件
  673. whetherIntegralChange(val){
  674. console.log(val,557)
  675. if (this.form.whetherIntegral == 1) {
  676. // disabled:true,
  677. this.findObject(this.option.column, "storeIntegral").disabled = true
  678. this.findObject(this.option.column, "referenceIntegral").disabled = true
  679. this.findObject(this.option.column, "salesmanIntegral").disabled = true
  680. this.findObject(this.option.column, "integral").disabled = true
  681. // 四个售价变成正整数
  682. this.findObject(this.option.column, "wholesalePrice").rules[0].pattern = /^[+]{0,1}(\d+)$/
  683. this.findObject(this.option.column, "repairDepotPrice").rules[0].pattern = /^[+]{0,1}(\d+)$/
  684. this.findObject(this.option.column, "storePrice").rules[0].pattern = /^[+]{0,1}(\d+)$/
  685. this.findObject(this.option.column, "price").rules[0].pattern = /^[+]{0,1}(\d+)$/
  686. }else if (this.form.whetherIntegral == 0 && this.roleNameqx.indexOf('admin') == -1) {
  687. this.findObject(this.option.column, "storeIntegral").disabled = false
  688. this.findObject(this.option.column, "referenceIntegral").disabled = false
  689. this.findObject(this.option.column, "salesmanIntegral").disabled = false
  690. this.findObject(this.option.column, "integral").disabled = false
  691. }
  692. },
  693. // 是否管理批次号的change事件
  694. whetherChange(val){
  695. console.log(val)
  696. if (val == 0||val==null) {
  697. this.findObject(this.optionList.column, "lotNo").hide = true
  698. this.findObject(this.optionList.column, "lotNo").showColumn = false
  699. } else {
  700. this.findObject(this.optionList.column, "lotNo").hide = false
  701. this.findObject(this.optionList.column, "lotNo").showColumn = true
  702. }
  703. },
  704. //修改提交触发
  705. editCustomer() {
  706. this.$refs["form"].validate((valid, done) => {
  707. done();
  708. if (valid) {
  709. this.loadingBtn = true;
  710. var categoryitemId = '';
  711. var categoryitem = '';
  712. var categoryitemList = this.form.categoryitemList
  713. for (let key in categoryitemList) {
  714. if (categoryitemList.length - 1 != key) {
  715. categoryitemId += categoryitemList[key]
  716. categoryitemId += ','
  717. } else {
  718. categoryitemId += categoryitemList[key]
  719. }
  720. }
  721. var data = {}
  722. var obj2 = new Map();
  723. var params = { type : 'GN'}
  724. listAllP(params).then(res => {
  725. data = res.data.data
  726. obj2 = new Map();
  727. for (let datum of data) {
  728. obj2.set(datum.id, datum.cname)
  729. }
  730. for (let key in categoryitemList) {
  731. var id = categoryitemList[key]
  732. if (categoryitemList.length -1 > key) {
  733. categoryitem += obj2.get(id)
  734. categoryitem += ','
  735. } else {
  736. categoryitem += obj2.get(id)
  737. }
  738. }
  739. this.form.categoryitemId = categoryitemId;
  740. this.form.categoryitem = categoryitem;
  741. submit({
  742. ...this.form,
  743. code: this.form.cname,
  744. type: 0,
  745. stockGoodsList: this.data,
  746. filesList: this.filesList
  747. }).then(res => {
  748. this.$message.success("保存成功");
  749. this.form = res.data.data;
  750. this.data = res.data.data.stockGoodsList;
  751. this.filesList = res.data.data.filesList;
  752. setTimeout(() => {
  753. this.backToList()
  754. }, 1000);
  755. }).finally(() => {
  756. this.loadingBtn = false;
  757. });
  758. })
  759. } else {
  760. return false;
  761. }
  762. });
  763. },
  764. async saveColumn() {
  765. const inSave = await this.saveColumnData(
  766. this.getColumnName(218),
  767. this.optionList
  768. );
  769. if (inSave) {
  770. this.$nextTick(() => {
  771. this.$refs.crud.doLayout();
  772. });
  773. this.$message.success("保存成功");
  774. //关闭窗口
  775. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  776. }
  777. },
  778. async resetColumn() {
  779. this.optionList = optionList;
  780. const inSave = await this.delColumnData(
  781. this.getColumnName(218),
  782. optionList
  783. );
  784. if (inSave) {
  785. this.$nextTick(() => {
  786. this.$refs.crud.doLayout();
  787. });
  788. this.getAllWorkDicts()
  789. this.$message.success("重置成功");
  790. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  791. }
  792. },
  793. //返回列表
  794. backToList() {
  795. this.$emit("goBack");
  796. }
  797. },
  798. };
  799. </script>
  800. <style lang="scss" scoped>
  801. .trading-form ::v-deep .el-form-item {
  802. margin-bottom: 8px !important;
  803. }
  804. ::v-deep .el-dialog__body {
  805. padding: 0px 20px 15px 20px;
  806. }
  807. ::v-deep .el-form-item__error {
  808. display: none !important;
  809. }
  810. .img-form ::v-deep .el-form-item {
  811. height: 150px;
  812. line-height: 150px;
  813. margin-bottom: 8px !important;
  814. }
  815. .img-form ::v-deep .avue-upload__icon {
  816. font-size: 20px;
  817. width: 150px;
  818. height: 150px;
  819. line-height: 150px;
  820. }
  821. ::v-deep .el-table .cell {
  822. padding: 0 2px !important;
  823. }
  824. ::v-deep .avue-crud .el-table .el-form-item__label {
  825. left: -1px;
  826. }
  827. .addressTabs {
  828. display: flex;
  829. justify-content: center;
  830. span {
  831. width: 100px;
  832. font-size: 18px;
  833. font-weight: 600;
  834. text-align: center;
  835. }
  836. }
  837. </style>