index.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930
  1. <template>
  2. <div>
  3. <basic-container>
  4. <el-row>
  5. <el-col :span="4">
  6. <avue-tree ref="treeRef" :option="treeOption" :data="treeData" @node-click="nodeClick" style="height:73vh;"
  7. @save="corpTypeVisible = true">
  8. </avue-tree>
  9. </el-col>
  10. <el-col :span="20">
  11. <avue-crud :option="option" :search.sync="search" v-model="form" :table-loading="loading" :data="dataList"
  12. ref="crud" :key="key" @on-load="onLoad" @selection-change="selectionChange" :before-open="beforeOpen"
  13. @row-update="rowUpdate" @search-change="searchChange" @search-reset="resetChange"
  14. @refresh-change="refreshChange" @row-del="rowDel"
  15. @resetColumn="resetColumnTwo('crud', 'option', 'optionList', 273)"
  16. @saveColumn="saveColumnTwo('crud', 'option', 'optionList', 273)" :page.sync="page">
  17. <template slot="filesListForm">
  18. <span style="font-size: 12px;">(图片文件像素推荐700X700,有且只允许有一张主图,其余均为副图)</span>
  19. <c-upload :data="form.filesList" display basic deleteUrl="/api/blade-sales-part/productLaunchFiles/remove"
  20. :enumerationValue="160" />
  21. </template>
  22. <template slot="detailsTextForm">
  23. <avue-ueditor v-model="form.detailsText"
  24. :options="optionsUeditor">
  25. </avue-ueditor>
  26. </template>
  27. <template slot-scope="{type,size,row,index}" slot="menu">
  28. <el-button :size="size" :type="type" :disabled="row.upAndDownShelves"
  29. @click="$refs.crud.rowEdit(row, index)">编辑
  30. </el-button>
  31. <el-button :size="size" :type="type" :disabled="row.upAndDownShelves"
  32. @click="$refs.crud.rowDel(row, index)">删除
  33. </el-button>
  34. <el-button :size="size" :type="type" :disabled="row.upAndDownShelves"
  35. @click="annexOpen(row, index)">商城图片
  36. </el-button>
  37. <el-tooltip :content="`${row.upAndDownShelves == 0 ? '上架' : '下架'}`" placement="top">
  38. <el-switch style="margin-left: 10px" v-model="row.upAndDownShelves" @change="check(row)" :active-value="1"
  39. :inactive-value="0">
  40. </el-switch>
  41. </el-tooltip>
  42. </template>
  43. <template slot-scope="{type,size,row,$index}" slot="menuLeft">
  44. <el-button type="primary" icon="el-icon-plus" size="small" @click="commoditySelection">选择产品
  45. </el-button>
  46. <el-button class="el-icon-bottom" type="warning" size="small" @click="excelBox = true">
  47. 导入
  48. </el-button>
  49. <el-button class="el-icon-document-copy" :disabled="selectionList.length === 0" type="primary" size="small"
  50. @click="change(row, 'up')">批量上架
  51. </el-button>
  52. <el-button class="el-icon-document-copy" :disabled="selectionList.length === 0" type="danger" size="small"
  53. @click="change(row, 'down')">批量下架
  54. </el-button>
  55. </template>
  56. </avue-crud>
  57. </el-col>
  58. </el-row>
  59. </basic-container>
  60. <el-dialog title="选择产品" v-if="dialogVisibles" append-to-body class="el-dialogDeep" :visible.async="dialogVisibles" width="80%"
  61. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" @close="dialogVisibles = false">
  62. <el-row :style="{ height: rowHeight }">
  63. <el-col :span="5" style="height: 100%;overflow-y: auto">
  64. <div>
  65. <el-scrollbar>
  66. <basic-container>
  67. <avue-tree :option="treeOption" :data="treeData" @node-click="nodeClick" />
  68. </basic-container>
  69. </el-scrollbar>
  70. </div>
  71. </el-col>
  72. <el-col :span="19">
  73. <!-- <basic-container> -->
  74. <avue-crud :option="optionTwo" :table-loading="loading" :data="goodsListShow" ref="cruds"
  75. @refresh-change="refreshChangeCost" @selection-change="selectionChangeCost" @search-change="goodsSearchCost"
  76. :page.sync="pages" @on-load="onLoad" @saveColumn="saveGoodsColumn"
  77. @resetColumn="resetGoodsColumn">
  78. <template slot="menuLeft">
  79. <el-tabs v-model="activeName" @tab-click="tabHandle">
  80. <el-tab-pane label="查询结果" name="searchList" />
  81. <el-tab-pane label="已选定数据" name="importStaging" />
  82. </el-tabs>
  83. </template>
  84. <template slot="priceOne" slot-scope="{row}">
  85. <el-input v-model="row.priceOne" size="small" :controls="false" :precision="0"
  86. style="width: 100%" />
  87. </template>
  88. <template slot="priceTwo" slot-scope="{ row }">
  89. <el-input v-model="row.priceTwo" size="small"></el-input>
  90. <!-- <span v-else>{{ row.refreshChange | IntegerFormat }}</span> -->
  91. </template>
  92. <!--花纹-->
  93. <template slot-scope="{row}" slot="brandItem">
  94. <!--<el-select-->
  95. <!-- v-model="row.brandItem"-->
  96. <!-- multiple-->
  97. <!-- filterable-->
  98. <!-- remote-->
  99. <!-- reserve-keyword-->
  100. <!-- placeholder="请输入关键词"-->
  101. <!-- :remote-method="remoteMethod"-->
  102. <!-- :loading="loading">-->
  103. <!-- <el-option-->
  104. <!-- v-for="item in goodsListShow"-->
  105. <!-- :key="item.value"-->
  106. <!-- :label="item.brandItem"-->
  107. <!-- :value="item.value">-->
  108. <!-- </el-option>-->
  109. <!--</el-select>-->
  110. </template>
  111. <template slot="priceThree" slot-scope="{ row }">
  112. <el-input v-model="row.priceThree" size="small"></el-input>
  113. <!-- <span v-else>{{ row.refreshChange | IntegerFormat }}</span> -->
  114. </template>
  115. <template slot="priceFour" slot-scope="{ row }">
  116. <el-input v-model="row.priceFour" size="small"></el-input>
  117. <!-- <span v-else>{{ row.refreshChange | IntegerFormat }}</span> -->
  118. </template>
  119. <template slot="sharedCompany" slot-scope="{ row, index }">
  120. <span style="display:flex">
  121. <el-select v-model="row.sharedCompany" multiple placeholder="请选择" size="small" filterable
  122. style="width:60%">
  123. <el-option v-for="item in sharedCompanyoptions" :key="item.id" :label="item.fullName"
  124. :value="item.id">
  125. </el-option>
  126. </el-select>
  127. </span>
  128. </template>
  129. <template slot-scope="scope" slot="menu">
  130. <el-button type="text" icon="el-icon-edit" size="small"
  131. @click.stop="importStagList(scope.row, scope.index)" v-if="activeName == 'searchList'"
  132. :disabled="goodsListSave.findIndex(item => item.id == scope.row.id) !== -1">选择
  133. </el-button>
  134. <el-button type="text" icon="el-icon-delete" size="small"
  135. @click.stop="removeStagList(scope.row, scope.index)" v-else>移除
  136. </el-button>
  137. </template>
  138. </avue-crud>
  139. <!-- </basic-container> -->
  140. </el-col>
  141. </el-row>
  142. <span slot="footer" class="dialog-footer">
  143. <el-button @click="dialogVisibles = false" :loading="saveLoading">取 消</el-button>
  144. <el-button type="primary" @click="importGoods" v-if="commodityData !== true" :loading="saveLoading">导入</el-button>
  145. <el-button type="primary" @click="importChoice" v-if="commodityData === true" :loading="saveLoading"
  146. :disabled="tableData.length !== 1">导入</el-button>
  147. </span>
  148. </el-dialog>
  149. <el-dialog title="添加产品" v-if="excelBox" append-to-body :visible.sync="excelBox" :close-on-click-modal="false" width="555px">
  150. <avue-form :option="excelOption" v-model="excelForm" :upload-after="uploadAfter">
  151. <template slot="excelTemplate">
  152. <el-button type="primary" @click="derivation">
  153. 点击下载<i class="el-icon-download el-icon--right"></i>
  154. </el-button>
  155. </template>
  156. </avue-form>
  157. <p style="text-align: center;color: #DC0505">
  158. 温馨提示 第一次导入时请先下载模板
  159. </p>
  160. </el-dialog>
  161. <el-dialog
  162. title="商城图片 (图片文件像素推荐700X700,有且只允许有一张主图,其余均为副图)"
  163. :visible.sync="enclosure"
  164. append-to-body
  165. width="70%">
  166. <c-upload :data="orderList" display basic deleteUrl="/api/blade-sales-part/productLaunchFiles/remove"
  167. :enumerationValue="160" />
  168. <span slot="footer" class="dialog-footer">
  169. <el-button @click="enclosure = false" size="small">取 消</el-button>
  170. <el-button type="primary" @click="saveAnnex" size="small">保 存</el-button>
  171. </span>
  172. </el-dialog>
  173. </div>
  174. </template>
  175. <script>
  176. import {
  177. getList,
  178. groundingList,
  179. submit,
  180. batchOperationProductLaunch,
  181. getDetail,
  182. remove,
  183. productLaunch,
  184. deptList, listAllP
  185. } from "@/api/tirePartsMall/basicData/listingManagement/index.js";
  186. import { getToken } from "@/util/auth";
  187. import commodity from "./commodity.json"
  188. import {getCorpTypes} from "@/api/tirePartsMall/basicData/commodityInformation";
  189. export default {
  190. name: "index",
  191. data() {
  192. return {
  193. orderList:[],
  194. enclosure:false,
  195. dataId:0,
  196. rowImg:[],
  197. data: [],
  198. sharedCompanyoptions: [],
  199. activeName: 'searchList',
  200. dialogVisibles: false,
  201. selectedNodes: [],// 存储选择节点的数组
  202. tableData: [],
  203. //上架列表
  204. goodsListShow: [],
  205. // 商品列表暂存
  206. goodsListSave: [],
  207. goodsListPolicy: [],
  208. optionsUeditor: {
  209. //普通上传地址
  210. // action:'https://avuejs.com/imgupload',
  211. action: "/api/blade-resource/oss/endpoint/put-file",
  212. headers: { "Blade-Auth": "Bearer " + getToken() },
  213. props: {
  214. res: "data",
  215. url: 'link'
  216. }
  217. },
  218. optionTwo: commodity,
  219. excelForm: {},
  220. excelOption: {
  221. submitBtn: false,
  222. emptyBtn: false,
  223. column: [
  224. {
  225. label: "模板下载",
  226. prop: "excelTemplate",
  227. formslot: true,
  228. span: 24
  229. },
  230. {
  231. label: "模板上传",
  232. prop: "excelFile",
  233. type: "upload",
  234. drag: true,
  235. loadText: "模板上传中,请稍等",
  236. span: 24,
  237. propsHttp: {
  238. res: "data"
  239. },
  240. tip: "请上传 .xls,.xlsx 标准格式文件",
  241. action: "/api/blade-sales-part/productLaunch/import-productLaunch"
  242. }
  243. ]
  244. },
  245. treeOption: {
  246. addBtn: false,
  247. menu: false,
  248. size: "small",
  249. props: {
  250. labelText: "标题",
  251. label: "cname",
  252. value: "id",
  253. }
  254. },
  255. excelBox: false,
  256. corpTypeVisible: false,
  257. // 左侧搜索
  258. treeData: [],
  259. loading: false,
  260. search: {},
  261. form: {},
  262. dataList: [],
  263. selectionList: [],
  264. page: {
  265. pageSize: 20,
  266. currentPage: 1,
  267. total: 0,
  268. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  269. },
  270. pageList: {
  271. pageSize: 10,
  272. currentPage: 1,
  273. total: 0
  274. },
  275. key: 0,
  276. option: {},
  277. optionList: {
  278. viewBtn: false,
  279. editBtn: false,
  280. delBtn: false,
  281. addBtn: false,
  282. index: true,
  283. span: 8,
  284. border: true,
  285. selection: true,
  286. height: "auto",
  287. updateBtnText:'保存',
  288. searchMenuPosition: "right",
  289. align: "center",
  290. menuWidth: 220,
  291. searchSpan: 8,
  292. searchIcon: true,
  293. searchIndex: 2,
  294. highlightCurrentRow: true,
  295. dialogWidth: "90%",
  296. column: [{
  297. label: '轮胎名称',
  298. prop: 'cname',
  299. search: true,
  300. disabled: true,
  301. overHidden: true,
  302. }, {
  303. label: '规格型号',
  304. prop: 'specificationAndModel',
  305. disabled: true,
  306. search: true,
  307. overHidden: true,
  308. },{
  309. label: '花纹',
  310. prop: 'brandItem',
  311. disabled: true,
  312. search: true, // 是否搜索
  313. // type: 'select',
  314. // remote:true, // 是否为远程搜索
  315. // dicUrl:'/api/blade-sales-part/productLaunch/list?brandItem={{key}}', //key为当前输入值
  316. overHidden: true,
  317. }, {
  318. label: '公司',
  319. prop: 'salesCompanyName',
  320. disabled: true,
  321. overHidden: true,
  322. type: 'select',
  323. props: {
  324. label: 'fullName',
  325. value: 'id'
  326. },
  327. dicUrl: '/api/blade-system/dept/top-list'
  328. }, {
  329. label: '库存',
  330. prop: 'inventory',
  331. disabled: true,
  332. overHidden: true,
  333. }, {
  334. label: '产品状态',
  335. prop: 'upAndDownShelves',
  336. filterable: true,
  337. display: false,
  338. search: true,
  339. hide: true,
  340. disabled: true,
  341. showColumn: false,
  342. type: 'select',
  343. dicData: [{
  344. label: "上架",
  345. value: 1
  346. }, {
  347. label: "下架",
  348. value: 0
  349. }]
  350. }, {
  351. label: "品牌",
  352. prop: "brandId",
  353. search: true,
  354. type: 'select',
  355. props: {
  356. label: 'cname',
  357. value: 'id'
  358. },
  359. dicUrl: '/api/blade-sales-part/brandDesc/listAll?type=PP&enableOrNot=1',
  360. hide: true,
  361. disabled: true,
  362. overHidden: false,
  363. }, {
  364. label: "品牌",
  365. prop: "brandName",
  366. disabled: true,
  367. overHidden: false,
  368. },
  369. {
  370. label: "售价1",
  371. prop: "priceOne",
  372. hide: false,
  373. overHidden: true,
  374. }, {
  375. label: "售价2",
  376. prop: "priceTwo",
  377. hide: false,
  378. overHidden: true,
  379. }, {
  380. label: "售价3",
  381. prop: "priceThree",
  382. hide: false,
  383. overHidden: true,
  384. }, {
  385. label: "售价4",
  386. prop: "priceFour",
  387. hide: false,
  388. overHidden: true,
  389. },
  390. {
  391. label: "共享公司",
  392. prop: "sharedCompany",
  393. // searchProp: "sharedCompanyList",
  394. search: true,
  395. overHidden: true,
  396. // tags: true,
  397. multiple: true, //将可选变为多选
  398. searchMultiple:false,
  399. type: 'select',
  400. props: {
  401. label: 'fullName',
  402. value: 'id'
  403. },
  404. dicUrl: '/api/blade-system/dept/deptList'
  405. },
  406. {
  407. label: "轮胎图片",
  408. prop: "filesList",
  409. hide: true,
  410. showColumn: false,
  411. overHidden: true,
  412. span: 24,
  413. },{
  414. label: "防爆",
  415. prop: "explosionProof",
  416. display:false,
  417. search: true,
  418. span: 8,
  419. type: 'select',
  420. dicData: [{
  421. label: '否',
  422. value: 0
  423. }, {
  424. label: '是',
  425. value: 1
  426. }],
  427. }, {
  428. label: "静音棉",
  429. prop: "originalFactory",
  430. display:false,
  431. search: true,
  432. span: 8,
  433. type: 'select',
  434. dicData: [{
  435. label: '否',
  436. value: "0"
  437. }, {
  438. label: '是',
  439. value: "1"
  440. }],
  441. },
  442. {
  443. label: "自修补",
  444. prop: "selfRecovery",
  445. display:false,
  446. search: true,
  447. span: 8,
  448. type: 'select',
  449. dicData: [{
  450. label: '否',
  451. value: "0"
  452. }, {
  453. label: '是',
  454. value: "1"
  455. }],
  456. }, {
  457. label: "轮胎详情",
  458. prop: "detailsText",
  459. hide: true,
  460. span: 24,
  461. showColumn: false,
  462. overHidden: true,
  463. }]
  464. }
  465. }
  466. },
  467. activated() {
  468. // getCorpTypes().then(res=>{
  469. // this.treeData = res.data.data
  470. // })
  471. listAllP().then(res=>{
  472. this.treeData = res.data.data
  473. })
  474. this.onLoad(this.page, this.search)
  475. },
  476. async created() {
  477. this.option = await this.getColumnData(this.getColumnName(273), this.optionList);
  478. this.optionTwo = await this.getColumnData(
  479. this.getColumnName(280),
  480. this.optionTwo
  481. );
  482. this.key++
  483. let i = 0;
  484. this.option.column.forEach(item => {
  485. if (item.search) i++
  486. })
  487. this.$refs.crud.dicInit()
  488. if (i % 3 !== 0) {
  489. const num = 3 - Number(i % 3)
  490. this.option.searchMenuSpan = num * 8;
  491. this.option.searchMenuPosition = "right";
  492. }
  493. },
  494. methods: {
  495. //打开附件
  496. annexOpen(row, index) {
  497. this.dataId = index
  498. this.rowImg = row
  499. this.orderList = row.filesList?row.filesList:[];
  500. for (let order of this.orderList) {
  501. order.paymentType = order.typeFiles
  502. }
  503. this.enclosure = true
  504. },
  505. // 附件保存
  506. saveAnnex() {
  507. if (this.orderList.length > 0) {
  508. // 循环把编辑状态变成保存状态
  509. this.orderList.map((item)=>{
  510. if (item.$cellEdit == true) {
  511. item.$cellEdit = false
  512. } else {
  513. item.$cellEdit = true
  514. }
  515. })
  516. let flag = this.orderList.some(item => {
  517. return item.$version == '主图'
  518. })
  519. if (!flag) {
  520. this.$message.warning('请选择主图')
  521. return
  522. }
  523. }
  524. this.rowImg.filesList = this.orderList;
  525. submit({
  526. ...this.rowImg
  527. }).then(res=>{
  528. this.$message.success("添加成功")
  529. // this.onLoad(this.page, this.search)
  530. })
  531. this.enclosure = false
  532. },
  533. derivation() {
  534. window.open(
  535. `/api/blade-sales-part/productLaunch/export-productLaunch?${this.website.tokenHeader
  536. }=${getToken()}`
  537. );
  538. },
  539. uploadAfter(res, done, loading, column) {
  540. this.excelBox = false;
  541. this.refreshChange();
  542. done();
  543. },
  544. nodeClick(data) {
  545. this.search.brandId = data.id
  546. this.page.currentPage = 1;
  547. this.onLoad(this.page, this.search);
  548. },
  549. //刷新
  550. refreshChange() {
  551. this.onLoad(this.page, this.search)
  552. },
  553. //刷新触发
  554. refreshChangeCost() {
  555. // this.treeDeptId = ''
  556. this.page.currentPage = 1;
  557. this.onLoad(this.page);
  558. },
  559. searchChange(params, done) {
  560. // sharedCompanyList
  561. // this.search.sharedCompanyList = params.sharedCompany;
  562. // Vue.delete(params, 'sharedCompany');
  563. // Vue.delete(this.search, 'sharedCompany');
  564. this.page.currentPage = 1;
  565. this.onLoad(this.page, params)
  566. done();
  567. },
  568. selectionChange(list) {
  569. this.selectionList = list
  570. },
  571. selectionChangeCost(list) {
  572. this.goodsListSave = list
  573. this.tableData = list
  574. },
  575. //新增
  576. commoditySelection() {
  577. delete this.page.brandId
  578. this.goodsListShow = []
  579. this.dialogVisibles = !this.dialogVisibles
  580. this.tableData = []
  581. this.goodsListSave = [];
  582. },
  583. //打开表单前
  584. beforeOpen(done, type) {
  585. // 查看和编辑逻辑
  586. if (['view', 'edit'].includes(type)) {
  587. getDetail({ id: this.form.id }).then(res => {
  588. this.form = res.data.data
  589. done();
  590. })
  591. }
  592. },
  593. // 标签页切换
  594. tabHandle(data) {
  595. if (data.name == 'searchList') {
  596. this.goodsListShow = this.data;
  597. this.page.total = this.pageList.total
  598. } else if (data.name == 'importStaging') {
  599. this.goodsListShow = this.goodsListSave;
  600. this.page.total = 0
  601. }
  602. },
  603. removeStagList(row, index, type) {
  604. if (type === 'policy') {
  605. this.goodsListPolicy.splice(row.$index, 1)
  606. if (this.goodsListPolicy.length == 0) {
  607. this.customerBuyFree.selection = true
  608. this.optionPolicy.selection = true
  609. this.$set(this.customerBuyFree, 'menu', true)
  610. }
  611. } else if (type === 'policy_buyAndGive') {
  612. this.buyAndGiveList.splice(row.$index, 1)
  613. if (this.buyAndGiveList.length == 0) {
  614. this.customerBuyFree.selection = true
  615. this.optionPolicy.selection = true
  616. this.$set(this.optionPolicy, 'menu', true)
  617. }
  618. } else {
  619. this.goodsListSave.splice(row.$index, 1)
  620. }
  621. },
  622. rowDel(row, index) {
  623. this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
  624. confirmButtonText: '确定',
  625. cancelButtonText: '取消',
  626. type: 'warning'
  627. }).then(() => {
  628. remove(row.id).then((res) => {
  629. this.$message({
  630. type: 'success',
  631. message: '删除成功!'
  632. });
  633. this.dataList.splice(index, 1);
  634. this.onLoad(this.page)
  635. })
  636. })
  637. },
  638. //编辑确定
  639. rowUpdate(form, index, done, loading) {
  640. if (this.form.filesList.length > 0) {
  641. let flag = this.form.filesList.some(item => {
  642. return item.$version == '主图'
  643. })
  644. if (!flag) {
  645. this.$message.warning('请选择主图')
  646. // done()
  647. loading()
  648. return
  649. }
  650. // 循环把编辑状态变成保存状态
  651. this.form.filesList.map((item)=>{
  652. if (item.$cellEdit == true) {
  653. // this.$set(item, "$cellEdit", false);
  654. item.$cellEdit = false
  655. } else {
  656. // this.$set(item, "$cellEdit", true);
  657. item.$cellEdit = true
  658. }
  659. })
  660. }
  661. console.log({...this.form}.detailsText,651)
  662. submit({
  663. ...this.form
  664. }).then(res => {
  665. this.$message.success("修改成功")
  666. this.onLoad(this.page, this.search)
  667. done()
  668. }).catch((err) => {
  669. loading()
  670. })
  671. },
  672. resetChange() {
  673. if(document.getElementsByClassName("is-current")[0]){
  674. let selected = document.getElementsByClassName("is-current")[0]
  675. selected.classList.remove("is-current")
  676. }
  677. },
  678. check(row) {
  679. batchOperationProductLaunch({
  680. flag: row.upAndDownShelves,
  681. ids: row.id
  682. }).then(res => {
  683. this.onLoad(this.page, this.search)
  684. })
  685. },
  686. // 确认导入
  687. importGoods() {
  688. if (!this.goodsListSave.length) {
  689. this.$message.error('请选择')
  690. }
  691. if (this.goodsListSave.some(item => item.priceOne == undefined || item.priceTwo == undefined || item.priceThree == undefined || item.priceFour == undefined)) {
  692. this.$message.error('请填写所有售价');
  693. } else {
  694. if (this.goodsListSave.length > 0) {
  695. this.goodsListSaveHandle()
  696. }
  697. }
  698. },
  699. goodsListSaveHandle() {
  700. this.goodsListSave.forEach(item => {
  701. // item.sharedCompany ? item.sharedCompany.join(',') : ''
  702. item.sharedCompany = item.sharedCompany?item.sharedCompany.toString():'';
  703. this.goodsListSave.specificationAndModel = item.typeno
  704. delete this.goodsListSave.typeno
  705. // item.sharedCompany = JSON.stringify(item.sharedCompany)
  706. })
  707. productLaunch(this.goodsListSave).then(res => {
  708. this.dialogVisibles = !this.dialogVisibles
  709. })
  710. },
  711. //导入商品触发
  712. importChoice() {
  713. return
  714. // this.contactsData = this.contactsData.concat(this.tableData)
  715. if (this.tableData.length === 1) {
  716. this.goodsShowData[this.choiceIndexT].cname = this.tableData[0].cname
  717. this.goodsShowData[this.choiceIndexT].code = this.tableData[0].code
  718. this.goodsShowData[this.choiceIndexT].typeno = this.tableData[0].typeno
  719. this.goodsShowData[this.choiceIndexT].itemType = this.tableData[0].typeno
  720. this.goodsShowData[this.choiceIndexT].itemId = this.tableData[0].id
  721. this.goodsShowData[this.choiceIndexT].priceCategory = this.tableData[0].goodsTypeName
  722. this.goodsShowData[this.choiceIndexT].integralMultiples = this.tableData[0].integralMultiples
  723. this.goodsShowData[this.choiceIndexT].corpId = this.tableData[0].corpId
  724. this.goodsShowData[this.choiceIndexT].corpName = this.tableData[0].corpName
  725. this.quantityChange(this.goodsShowData[this.choiceIndexT])
  726. selectGoodsNum({
  727. goodsId: this.tableData[0].id,
  728. itemType: this.tableData[0].typeno,
  729. tradeType: 'GN',
  730. warehouseId: this.form.storageId
  731. }).then(res => {
  732. if (res.data.data.length > 0) {
  733. this.goodsShowData[this.choiceIndexT].storageQuantityList = res.data.data
  734. this.goodsShowData[this.choiceIndexT].storageId = res.data.data[0].storageId
  735. this.goodsShowData[this.choiceIndexT].storageName = res.data.data[0].storageName
  736. this.goodsShowData[this.choiceIndexT].storageQuantity = res.data.data[0].surplusRouteQuantity
  737. if (res.data.data[0].tenantId !== "681169") {
  738. this.goodsShowData[this.choiceIndexT].purchaseAmount = res.data.data[0].stockPrice
  739. }
  740. }
  741. })
  742. }
  743. this.dialogVisible = !this.dialogVisible
  744. this.commodityData = false
  745. },
  746. importStagList(row, index, type) {
  747. if (type === 'policy') {
  748. this.goodsListPolicy.push(row);
  749. if (this.goodsListPolicy.length > 0) {
  750. this.customerBuyFree.selection = false
  751. this.optionPolicy.selection = true
  752. this.$set(this.customerBuyFree, 'menu', false)
  753. }
  754. } else if (type === 'policy_buyAndGive') {
  755. this.buyAndGiveList.push(row);
  756. if (this.buyAndGiveList.length > 0) {
  757. this.customerBuyFree.selection = true
  758. this.optionPolicy.selection = false
  759. this.$set(this.optionPolicy, 'menu', false)
  760. }
  761. } else {
  762. this.goodsListSave.push(row);
  763. }
  764. },
  765. change(row, type) {
  766. let data = []
  767. for (let item of this.selectionList) {
  768. data.push(item.id)
  769. }
  770. if (type === "up") {
  771. // for (let item of this.selectionList) {
  772. // if (!Number(item.salesPrice)) return this.$message.error("上架失败,商城价格不能为0")
  773. // }
  774. this.$confirm('是否确认全部上架?', '提示', {
  775. confirmButtonText: '确定',
  776. cancelButtonText: '取消',
  777. type: 'warning'
  778. }).then(() => {
  779. batchOperationProductLaunch({
  780. flag: 1,
  781. ids: data.join(",")
  782. }).then(res => {
  783. this.onLoad(this.page, this.search)
  784. })
  785. })
  786. } else if (type === "down") {
  787. this.$confirm('是否确认全部下架?', '提示', {
  788. confirmButtonText: '确定',
  789. cancelButtonText: '取消',
  790. type: 'warning'
  791. }).then(() => {
  792. batchOperationProductLaunch({
  793. flag: 0,
  794. ids: data.join(",")
  795. }).then(res => {
  796. this.onLoad(this.page, this.search)
  797. })
  798. })
  799. }
  800. },
  801. //新增搜索
  802. goodsSearchCost(params, done) {
  803. this.treeDeptId = ''
  804. params = {
  805. ...params,
  806. // artsVision: this.form.belongToCorpId
  807. }
  808. this.onLoad(this.page, params);
  809. done()
  810. },
  811. onLoad(page, params = {}) {
  812. // 深拷贝一份防止弹出框的搜索参数和外面表格的搜索参数一样
  813. let search = JSON.parse(JSON.stringify(this.search))
  814. search.cname = params.cname
  815. // this.search.cname = params.cname
  816. // params.sharedCompany = params.$sharedCompany
  817. params = {
  818. ...params,
  819. current: page.currentPage,
  820. size: page.pageSize,
  821. ...Object.assign(params, search),
  822. // ...Object.assign(params, this.search),
  823. billType: 0
  824. }
  825. this.loading = true
  826. getList(params).then(res => {
  827. this.dataList = res.data.data.records
  828. this.page.total = res.data.data.total
  829. this.pageList.total = res.data.data.total
  830. this.$nextTick(() => {
  831. this.$refs.crud.doLayout();
  832. });
  833. this.loading = false
  834. }).finally(() => {
  835. this.loading = false
  836. })
  837. this.loading = true
  838. groundingList(params).then(res => {
  839. this.goodsListShow = res.data.data.records
  840. this.data = res.data.data.records;
  841. this.pages.total = res.data.data.total
  842. this.loading = false
  843. }).finally(() => {
  844. this.loading = false
  845. })
  846. deptList().then(res => {
  847. this.sharedCompanyoptions = res.data.data
  848. })
  849. },
  850. async saveGoodsColumn() {
  851. const inSave = await this.saveColumnData(
  852. this.getColumnName(280),
  853. this.optionTwo
  854. );
  855. if (inSave) {
  856. this.$message.success("保存成功");
  857. //关闭窗口
  858. this.$refs.cruds.$refs.dialogColumn.columnBox = false;
  859. this.$nextTick(() => {
  860. this.$refs.cruds.doLayout()
  861. })
  862. }
  863. },
  864. async resetGoodsColumn() {
  865. this.optionTwo = commodity;
  866. const inSave = await this.delColumnData(
  867. this.getColumnName(280),
  868. commodity
  869. );
  870. if (inSave) {
  871. this.$nextTick(() => {
  872. this.$refs.cruds.doLayout()
  873. })
  874. this.$message.success("重置成功");
  875. //关闭窗口
  876. setTimeout(() => {
  877. this.$refs.cruds.$refs.dialogColumn.columnBox = false;
  878. }, 1000);
  879. }
  880. },
  881. //自定义列保存
  882. async saveColumnTwo(ref, option, optionBack, code) {
  883. /**
  884. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  885. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  886. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  887. */
  888. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  889. if (inSave) {
  890. this.$message.success("保存成功");
  891. //关闭窗口
  892. this.$nextTick(() => {
  893. this.$refs.crud.doLayout();
  894. });
  895. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  896. }
  897. },
  898. //自定义列重置
  899. async resetColumnTwo(ref, option, optionBack, code) {
  900. this[option] = this[optionBack];
  901. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  902. if (inSave) {
  903. this.$message.success("重置成功");
  904. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  905. this.$nextTick(() => {
  906. this.$refs.crud.doLayout();
  907. });
  908. }
  909. }
  910. }
  911. }
  912. </script>
  913. <style scoped></style>