index.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858
  1. <template>
  2. <div class="my-container">
  3. <div class="bill-main" v-show="isShow==='ckb'" key="item">
  4. <module-view :propConfig="config" ref="moduleView" @pagination="getDataList" @search="getDataList"
  5. @resert="getDataList" @detail="openEdit" @onRefresh="onRefresh">
  6. </module-view>
  7. <!-- 注册/编辑弹窗 -->
  8. <el-dialog :title="popTitle+'仓库'" :visible.sync="dialogFormVisible" width="960px" height="450px">
  9. <!-- <by-form :propConfig="addConfig" ref="addFormId"></by-form> -->
  10. <ruleForm ref='addFormId' @toCargoOwner="toCargoOwner"></ruleForm>
  11. <div slot="footer" class="dialog-footer">
  12. <el-button @click="close">取 消</el-button>
  13. <el-button type="primary" @click="confirm">确 定</el-button>
  14. </div>
  15. </el-dialog>
  16. </div>
  17. <div class="bill-main" v-show="isShow==='cwb'" key="item2">
  18. <module-view :propConfig="config2" ref="moduleView2" @clickHandle="clickHandle2" @detail="openEdit2"
  19. @pagination="getDataList2" @search="getDataList2" @resert="getDataList2" @onRefresh="onRefresh2">
  20. </module-view>
  21. <!-- 注册/编辑弹窗 -->
  22. <el-dialog :title="popTitle+'仓位'" :visible.sync="dialogFormVisible2" :show-close="false" width="30%">
  23. <by-form :propConfig="addConfig2" ref="addFormId2">
  24. <template v-slot:organizationName="{value}">
  25. <el-input placeholder="请选择所属机构名称" size="small" v-model="value.organizationName"
  26. class="input-organizationName" :readonly="true">
  27. <el-button slot="append" icon="el-icon-more" @click="handleSupplier"></el-button>
  28. </el-input>
  29. </template>
  30. </by-form>
  31. <div slot="footer" class="dialog-footer">
  32. <el-button @click="closeStoringLocation">取 消</el-button>
  33. <el-button type="primary" @click="confirm2">确 定</el-button>
  34. </div>
  35. </el-dialog>
  36. </div>
  37. <supplier-modal ref="supplierModal" @confirm="confirmSupplier" :zIndex="9999" />
  38. </div>
  39. </template>
  40. <script lang="ts">
  41. import { Component, Prop, Vue, Watch } from "vue-property-decorator";
  42. import api from "@/api/currency";
  43. import ruleForm from "./components/ruleForm.vue";
  44. import Assembly from "@/components/Assembly/yesno.vue";
  45. @Component({ components: { ruleForm } })
  46. export default class Depots extends Vue {
  47. isShow : any = 'ckb'
  48. timeNum = 0;
  49. timer : any = null
  50. timeNum2 = 0;
  51. timer2 : any = null
  52. popTitle : any = ''
  53. tableData : any = {}
  54. dialogFormVisible : boolean = false
  55. dialogFormVisible2 : boolean = false
  56. isAdd : any = false
  57. config : any = {
  58. attr: {
  59. calculateH: true
  60. },
  61. search: {
  62. attr: {
  63. size: 'mini'
  64. },
  65. columns: [
  66. [{
  67. span: 6,
  68. label: '仓库名称',
  69. prop: 'name',
  70. component: 'by-input',
  71. labelWidth: '70px',
  72. compConfig: {
  73. attr: {
  74. placeholder: '请输入名称',
  75. clearable: true
  76. },
  77. },
  78. }, {
  79. span: 6,
  80. label: '地址',
  81. prop: 'address',
  82. component: 'by-input',
  83. labelWidth: '70px',
  84. compConfig: {
  85. attr: {
  86. placeholder: '请输入地址',
  87. clearable: true
  88. }
  89. }
  90. },
  91. ]
  92. ]
  93. },
  94. tool: {
  95. tools: {
  96. search: true,
  97. refresh: true
  98. },
  99. customTools: [
  100. {
  101. name: '注册', icon: 'el-icon-plus', audit: [''], event: {
  102. click: () => {
  103. (this as any).onAdd();
  104. }
  105. }
  106. }
  107. ]
  108. },
  109. table: {
  110. attr: {
  111. size: 'mini',
  112. align: 'left',
  113. triggerRowCheck: 'row'
  114. },
  115. columns: [{
  116. width: 200,
  117. title: '名称',
  118. field: 'name',
  119. isDetail: true,
  120. },
  121. {
  122. width: 120,
  123. title: '金蝶仓库名称',
  124. field: 'financeStorehouseName',
  125. },
  126. {
  127. width: 120,
  128. title: '金蝶仓库编号',
  129. field: 'financeStorehouseNo',
  130. },
  131. // {
  132. // width: 120,
  133. // title: '金蝶财务系统名称',
  134. // field: 'financeType',
  135. // },
  136. {
  137. width: 120,
  138. title: '绑定第三方系统',
  139. field: 'isThird',
  140. component: Assembly,
  141. },
  142. {
  143. width: 120,
  144. title: '第三方系统',
  145. field: 'thirdSysName',
  146. },
  147. {
  148. width: 120,
  149. title: '第三方货主',
  150. field: 'thirdPartnerName',
  151. },
  152. {
  153. width: 120,
  154. title: '第三方货仓库',
  155. field: 'thirdStorehouseName',
  156. },
  157. {
  158. width: 120,
  159. title: '省',
  160. field: 'province',
  161. },
  162. {
  163. width: 120,
  164. title: '市',
  165. field: 'city',
  166. },
  167. {
  168. width: 150,
  169. title: '县/区',
  170. field: 'region',
  171. },
  172. {
  173. width: 150,
  174. title: '街道',
  175. field: 'street',
  176. },
  177. {
  178. width: 200,
  179. title: '地址',
  180. field: 'address',
  181. },
  182. {
  183. width: 70,
  184. title: '仓位',
  185. action: true,
  186. plugins: [{
  187. icon: 'el-icon-edit',
  188. name: '查看',
  189. audit: '',
  190. event: {
  191. click: (item : any) => {
  192. (this as any).changeTab(item)
  193. }
  194. }
  195. }]
  196. }, {
  197. width: 104,
  198. title: '操作',
  199. action: true,
  200. plugins: [{
  201. icon: 'el-icon-edit',
  202. name: '编辑',
  203. audit: '',
  204. event: {
  205. click: (item : any) => {
  206. (this as any).openEdit(item)
  207. }
  208. }
  209. }, {
  210. name: '删除',
  211. event: {
  212. click: (item : any) => (this as any).doDelete2(item, 'maindataStorehouse')
  213. }
  214. }]
  215. }]
  216. },
  217. }
  218. config2 : any = {
  219. attr: {
  220. calculateH: true
  221. },
  222. search: {
  223. attr: {
  224. size: 'mini'
  225. },
  226. columns: [
  227. [
  228. {
  229. span: 6,
  230. label: '名称',
  231. prop: 'name',
  232. component: 'by-input',
  233. compConfig: {
  234. attr: {
  235. placeholder: '请输入名称',
  236. clearable: true
  237. },
  238. },
  239. },
  240. {
  241. span: 6,
  242. label: '所属机构名称',
  243. prop: 'organizationName',
  244. component: 'by-input',
  245. compConfig: {
  246. attr: {
  247. placeholder: '请输入所属机构名称',
  248. clearable: true
  249. }
  250. }
  251. },
  252. ],
  253. ]
  254. },
  255. tool: {
  256. tools: {
  257. return: true,
  258. search: true,
  259. refresh: true
  260. },
  261. // customTools: [
  262. // {
  263. // name: '注册', icon: 'el-icon-plus', audit: [''], event: {
  264. // click: () => {
  265. // (this as any).onAdd2();
  266. // }
  267. // }
  268. // },
  269. // {
  270. // name: '删除', icon: 'el-icon-delete', audit: [''], event: {
  271. // click: () => {
  272. // (this as any).onDelete('moduleView2', 'maindataStoringLocation')
  273. // }
  274. // }
  275. // },
  276. // ]
  277. },
  278. table: {
  279. attr: {
  280. size: 'mini',
  281. seq: true,
  282. align: 'left',
  283. checkbox: true,
  284. triggerRowCheck: 'row'
  285. },
  286. columns: [{
  287. width: 300,
  288. title: '仓位名称',
  289. field: 'name',
  290. isDetail: true,
  291. },
  292. {
  293. width: 250,
  294. title: '仓库名称',
  295. field: 'ckName',
  296. },
  297. {
  298. width: 200,
  299. title: '所属机构名称',
  300. field: 'organizationName',
  301. },
  302. {
  303. width: 150,
  304. title: '库存体积',
  305. field: 'stockVolume'
  306. },
  307. {
  308. width: 150,
  309. title: '库存数量上限',
  310. field: 'maxStockNumber'
  311. },
  312. {
  313. width: 150,
  314. title: '库存体积上限',
  315. field: 'maxStockVolume'
  316. }, {
  317. width: 120,
  318. title: '操作',
  319. action: true,
  320. plugins: [{
  321. icon: 'el-icon-edit',
  322. name: '编辑',
  323. audit: '',
  324. event: {
  325. click: (item : any) => {
  326. (this as any).openEdit2(item)
  327. }
  328. }
  329. },
  330. // {
  331. // name: '删除',
  332. // event: {
  333. // click: (item : any) => (this as any).doDelete3(item, 'maindataStoringLocation')
  334. // }
  335. // },
  336. ]
  337. }]
  338. },
  339. }
  340. addConfig = {
  341. attr: {
  342. size: 'small',
  343. rules: {
  344. name: [{
  345. required: true, message: '请输入名称', trigger: 'blur'
  346. }],
  347. address: [{
  348. required: true, message: '请输入详细地址', trigger: 'blur'
  349. }],
  350. province: [{
  351. required: true, message: '请选择仓库地址', trigger: 'change'
  352. }],
  353. }
  354. },
  355. columns: [
  356. [
  357. {
  358. span: 24,
  359. labelWidth: '110px',
  360. label: '名称',
  361. prop: 'name',
  362. component: 'by-input',
  363. },
  364. {
  365. span: 24,
  366. labelWidth: '110px',
  367. label: '第三方仓库名称',
  368. prop: 'financeStorehouseName',
  369. component: 'by-input',
  370. },
  371. {
  372. span: 24,
  373. labelWidth: '110px',
  374. label: '第三方系统名称',
  375. prop: 'financeType',
  376. component: 'by-input',
  377. },
  378. {
  379. span: 24,
  380. labelWidth: '110px',
  381. label: '第三方仓库编码',
  382. prop: 'financeStorehouseNo',
  383. component: 'by-input',
  384. },
  385. ],
  386. [{
  387. labelWidth: '110px',
  388. label: '仓库地址',
  389. prop: 'province',
  390. component: 'by-area',
  391. compConfig: {
  392. attr: {
  393. province: 'province', //省
  394. provinceCode: 'provinceCode', //省编码
  395. city: 'city', //市
  396. cityCode: 'cityCode', //市编码
  397. county: 'region', //县/区
  398. countyCode: 'regionCode', //县/区编码
  399. town: 'street', //街道
  400. townCode: 'streetCode', //街道编码
  401. }
  402. }
  403. },
  404. ],
  405. [
  406. {
  407. span: 24,
  408. labelWidth: '110px',
  409. label: '详细地址',
  410. prop: 'address',
  411. component: 'by-input',
  412. },
  413. ]
  414. ]
  415. }
  416. addConfig2 = {
  417. attr: {
  418. size: 'small',
  419. rules: {
  420. name: [{
  421. required: true, message: '请输入名称', trigger: 'change'
  422. }],
  423. organizationName: [{
  424. required: true, message: '请输入所属机构名称', trigger: 'change'
  425. }],
  426. stockVolume: [{
  427. required: true, message: '请输入库存体积', trigger: 'change'
  428. }],
  429. maxStockNumber: [{
  430. required: true, message: '请输入库存数量上限', trigger: 'change'
  431. }],
  432. maxStockVolume: [{
  433. required: true, message: '请输入库存体积上限', trigger: 'change'
  434. }]
  435. }
  436. },
  437. columns: [
  438. [
  439. {
  440. labelWidth: '110px',
  441. span: 23,
  442. label: '名称',
  443. prop: 'name',
  444. component: 'by-input',
  445. },
  446. {
  447. labelWidth: '110px',
  448. span: 23,
  449. label: '所属机构名称',
  450. prop: 'organizationName',
  451. slot: true,
  452. },
  453. {
  454. labelWidth: '110px',
  455. span: 23,
  456. label: '库存体积',
  457. prop: 'stockVolume',
  458. component: 'by-input',
  459. compConfig: {
  460. attr: {
  461. type: "number",
  462. },
  463. }
  464. },
  465. {
  466. labelWidth: '110px',
  467. span: 23,
  468. label: '库存数量上限',
  469. prop: 'maxStockNumber',
  470. component: 'by-input',
  471. compConfig: {
  472. attr: {
  473. type: "number"
  474. },
  475. }
  476. },
  477. {
  478. labelWidth: '110px',
  479. span: 23,
  480. label: '库存体积上限',
  481. prop: 'maxStockVolume',
  482. component: 'by-input',
  483. compConfig: {
  484. attr: {
  485. type: "number",
  486. },
  487. }
  488. },
  489. ]
  490. ]
  491. }
  492. created() {
  493. this.timer = setInterval(() => {
  494. this.getDataList()
  495. }, 500)
  496. }
  497. close(){
  498. (this as any).$refs.addFormId.clearValue();
  499. setTimeout(()=>{
  500. this.dialogFormVisible = false;
  501. },0)
  502. }
  503. // 跳转货主管理
  504. toCargoOwner(){
  505. this.dialogFormVisible = false;
  506. (this as any).$router.push('/oms/cargoOwner')
  507. }
  508. // 仓库确认注册/编辑
  509. confirm() {
  510. if(this.$refs.addFormId){
  511. (this.$refs.addFormId as any).validate().then(()=>{
  512. let query = (this as any).$refs.addFormId.getValue();
  513. // console.log(query.isThird)
  514. if(query.isThird == 0 || query.isThird == null){
  515. query.thirdSysName = '';
  516. query.thirdPartnerId = '';
  517. query.thirdPartnerCode = '',
  518. query.thirdPartnerName = '';
  519. query.thirdStorehouseCode = '';
  520. }
  521. // console.log(query);
  522. if (this.popTitle === '注册') {
  523. let loading = this.$loading({ target: '.main-container' });
  524. api.saveList(query, 'maindataStorehouse').then((res : any) => {
  525. loading.close();
  526. if (res.code === 200) {
  527. this.dialogFormVisible = false;
  528. // this.$message.success(this.popTitle + '成功');
  529. this.getDataList();
  530. // this.$confirm('是否注册仓位', '提示', {
  531. // confirmButtonText: '确定',
  532. // cancelButtonText: '取消',
  533. // }).then(() => {
  534. // api.single({ id: res.data }, 'maindataStorehouse').then((data : any) => {
  535. // this.changeTab(data.data);
  536. // this.onAdd2();
  537. // }).catch(() => {});
  538. // }).catch(() => {
  539. let data = {
  540. storehouseId: res.data,
  541. idDelete: 0,
  542. maxStockNumber: "9999999",
  543. maxStockVolume: "100000",
  544. name: "默认仓位",
  545. organizationId: 1,
  546. organizationName: "供应商A",
  547. stockVolume: "100000",
  548. };
  549. api.saveList(data, 'maindataStoringLocation').then((res : any) => {
  550. if (res.code === 200) {
  551. this.$message.success('仓库注册成功,同时新增一个默认仓位')
  552. // this.$alert('此仓库将新增一个默认仓位');
  553. } else this.$message.error(res.msg)
  554. }).catch(() => {});
  555. // });
  556. } else this.$message.error(res.msg)
  557. }).catch(() => loading.close());
  558. } else if (this.popTitle === '编辑') {
  559. let loading = this.$loading({ target: '.main-container' });
  560. api.updateList(query, 'maindataStorehouse').then((res : any) => {
  561. loading.close();
  562. if (res.code === 200) {
  563. this.dialogFormVisible = false;
  564. this.$message.success(this.popTitle + '成功');
  565. this.getDataList();
  566. } else this.$message.error(res.msg)
  567. }).catch(() => loading.close());
  568. }
  569. }).catch(() => {});
  570. }
  571. }
  572. // 仓位确认注册/编辑
  573. confirm2() {
  574. (this as any).$refs.addFormId2.validate().then(() => {
  575. let query = (this as any).$refs.addFormId2.getValue();
  576. query.storehouseId = this.tableData.id;
  577. query.idDelete = 0;
  578. if(query.maxStockNumber>2147483647) return this.$message.warning('库存数量上限不能超过2147483647');
  579. if (this.popTitle === '注册') {
  580. let loading = this.$loading({ target: '.main-container' });
  581. api.saveList(query, 'maindataStoringLocation').then((res : any) => {
  582. loading.close();
  583. if (res.code === 200) {
  584. this.dialogFormVisible2 = false;
  585. this.$message.success(this.popTitle + '成功');
  586. this.getOneself(query.storehouseId);
  587. } else this.$message.error(res.msg)
  588. }).catch(() => loading.close());
  589. } else if (this.popTitle === '编辑') {
  590. let loading = this.$loading({ target: '.main-container' });
  591. api.updateList(query, 'maindataStoringLocation').then((res : any) => {
  592. loading.close();
  593. if (res.code === 200) {
  594. this.dialogFormVisible2 = false;
  595. this.$message.success(this.popTitle + '成功');
  596. this.getOneself(query.storehouseId);
  597. } else this.$message.error(res.msg)
  598. }).catch(() => loading.close());
  599. }
  600. }).catch(() => {});
  601. }
  602. // 取消仓位注册
  603. closeStoringLocation() {
  604. this.dialogFormVisible2 = false;
  605. if (this.tableData.subList.length <= 0) {
  606. let data = {
  607. storehouseId: this.tableData.id,
  608. idDelete: 0,
  609. maxStockNumber: "9999999",
  610. maxStockVolume: "100000",
  611. name: "默认仓位",
  612. organizationId: 1,
  613. organizationName: "供应商A",
  614. stockVolume: "100000",
  615. };
  616. api.saveList(data, 'maindataStoringLocation').then((res : any) => {
  617. if (res.code === 200) {
  618. this.getOneself(this.tableData.id);
  619. this.$alert('此仓库将新增一个默认仓位');
  620. } else this.$message.error(res.msg)
  621. });
  622. }
  623. }
  624. // 通过id拿到当条数据
  625. getOneself(e : any) {
  626. api.single({ id: e }, 'maindataStorehouse').then((res : any) => {
  627. if (res.code === 200) {
  628. this.tableData = res.data;
  629. this.tableData.subList.map((v : any) => {
  630. v.ckName = this.tableData.name;
  631. });
  632. (this.$refs.moduleView2 as any).setTableValue(this.tableData.subList);
  633. }
  634. })
  635. }
  636. // 获取仓库列表数据
  637. getDataList() {
  638. if (!this.$refs.moduleView) {
  639. if (this.timeNum > 5) {
  640. clearInterval(this.timer)
  641. }
  642. this.timeNum++;
  643. return
  644. }
  645. clearInterval(this.timer)
  646. let query = (this.$refs.moduleView as any).getQuery();
  647. api.pageList(query, 'maindataStorehouse').then((res : any) => {
  648. if (res.code === 200) {
  649. (this.$refs.moduleView as any).setTableValue(res.data.records);
  650. let page = {
  651. pageNo: res.data.current, //当前页
  652. pageSize: res.data.size, //每页条数
  653. total: res.data.total //总条数
  654. };
  655. (this.$refs.moduleView as any).setPage(page)
  656. } else this.$message.error(res.msg)
  657. })
  658. }
  659. // 获取仓位列表数据
  660. getDataList2() {
  661. if (!this.$refs.moduleView2) {
  662. if (this.timeNum2 > 5) {
  663. clearInterval(this.timer2)
  664. }
  665. this.timeNum2++;
  666. return
  667. }
  668. clearInterval(this.timer2)
  669. let query = (this.$refs.moduleView2 as any).getQuery();
  670. // console.log(query);
  671. query.storehouseId = this.tableData.id;
  672. let loading = this.$loading({ target: '.main-container' });
  673. api.pageList(query, 'maindataStoringLocation').then((res : any) => {
  674. loading.close();
  675. if (res.code === 200) {
  676. res.data.records.map((v : any) => {
  677. v.ckName = this.tableData.name;
  678. });
  679. (this.$refs.moduleView2 as any).setTableValue(res.data.records);
  680. let page = {
  681. pageNo: res.data.current, //当前页
  682. pageSize: res.data.size, //每页条数
  683. total: res.data.total //总条数
  684. };
  685. (this.$refs.moduleView2 as any).setPage(page)
  686. } else this.$message.error(res.msg)
  687. }).catch(() => loading.close());
  688. }
  689. // 工具栏方法
  690. clickHandle2(e : any) {
  691. if (e === 'onAdd') this.onAdd2();
  692. if (e === 'onReturn') {
  693. this.isShow = 'ckb';
  694. this.getDataList();
  695. };
  696. }
  697. // 打开注册
  698. onAdd() {
  699. this.popTitle = '注册'
  700. this.dialogFormVisible = true;
  701. setTimeout(() => {
  702. (this as any).$refs.addFormId.clearValue();
  703. if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue({});
  704. }, 0)
  705. }
  706. // 打开编辑
  707. openEdit(e : any) {
  708. // console.log(e);
  709. this.popTitle = '编辑'
  710. this.dialogFormVisible = true;
  711. setTimeout(() => {
  712. (this as any).$refs.addFormId.clearValue();
  713. if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue(e);
  714. }, 0)
  715. }
  716. // 打开注册
  717. onAdd2() {
  718. this.popTitle = '注册'
  719. this.dialogFormVisible2 = true;
  720. this.isAdd = true;
  721. setTimeout(() => {
  722. if ((this as any).$refs.addFormId2) (this as any).$refs.addFormId2.setValue({});
  723. }, 0)
  724. }
  725. // 打开编辑
  726. openEdit2(e : any) {
  727. this.popTitle = '编辑'
  728. this.dialogFormVisible2 = true;
  729. this.isAdd = false;
  730. setTimeout(() => {
  731. if ((this as any).$refs.addFormId2) (this as any).$refs.addFormId2.setValue(e);
  732. }, 0)
  733. }
  734. // 打开机构选择
  735. handleSupplier() {
  736. (this.$refs.supplierModal as any).setShow(true);
  737. }
  738. // 确定机构选择
  739. confirmSupplier(e : any) {
  740. if (e.length == 0) return this.$message.warning('请选择机构名称');
  741. let value : any = (this.$refs.addFormId2 as any).getValue();
  742. value.organizationName = e[0].name;
  743. value.organizationId = e[0].id;
  744. (this.$refs.addFormId2 as any).setValue(value);
  745. }
  746. // 查看仓位
  747. changeTab(item : any) {
  748. let loading = this.$loading({ target: '.main-container' });
  749. api.single({ id: item.id }, 'maindataStorehouse').then((res : any) => {
  750. if (res.code === 200) {
  751. this.isShow = 'cwb';
  752. this.tableData = res.data;
  753. res.data.subList.map((v : any) => {
  754. v.ckName = res.data.name;
  755. })
  756. // console.log('仓库表数据 ==> ', res.data);
  757. (this.$refs.moduleView2 as any).setTableValue(res.data.subList);
  758. loading.close();
  759. } else loading.close();
  760. }).catch(() => loading.close());
  761. }
  762. // 刷新仓库
  763. onRefresh() {
  764. (this as any).$refs.moduleView.clearSearch();
  765. this.getDataList();
  766. }
  767. // 刷新仓位
  768. onRefresh2() {
  769. (this as any).$refs.moduleView2.clearSearch();
  770. this.getDataList2();
  771. }
  772. // 仓库操作删除
  773. doDelete2(item : any, url : any) {
  774. this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
  775. confirmButtonText: '确定',
  776. cancelButtonText: '取消',
  777. type: 'warning',
  778. center: true
  779. }).then(() => {
  780. let loading = this.$loading({ target: '.main-container' });
  781. // api.single({ id: item.id }, 'maindataStorehouse').then((res : any) => {
  782. // if (res.data.subList.length > 0) {
  783. // loading.close();
  784. // this.$message.warning('此仓库下有仓位,不可删除!');
  785. // } else {
  786. api.deleteList({ ids: item.id }, url).then((res : any) => {
  787. loading.close();
  788. if (res.code === 200) {
  789. this.getDataList();
  790. this.$message.success('删除成功');
  791. } else this.$message.error(res.msg)
  792. }).catch(() => loading.close());
  793. // }
  794. // }).catch(() => loading.close());
  795. }).catch(() => this.$message.info('已取消删除'));
  796. }
  797. // 仓位工具栏删除
  798. onDelete(moduleView : any, url : any) {
  799. let selectData = (this.$refs[moduleView] as any).getSelectData()
  800. let ids = '';
  801. if (selectData.length > 0) {
  802. selectData.map((v : any) => {
  803. ids += v.id + ','
  804. })
  805. } else return this.$message.warning('请选择删除数据');
  806. ids = ids.slice(0, ids.length - 1);
  807. this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
  808. confirmButtonText: '确定',
  809. cancelButtonText: '取消',
  810. type: 'warning',
  811. center: true
  812. }).then(() => {
  813. let loading = this.$loading({ target: '.main-container' });
  814. api.deleteList({ ids: ids }, url).then((res : any) => {
  815. loading.close();
  816. if (res.code === 200) {
  817. this.getDataList2();
  818. this.$message.success('删除成功');
  819. } else this.$message.error(res.msg)
  820. }).catch(() => loading.close());
  821. }).catch(() => this.$message.info('已取消删除'));
  822. }
  823. // 仓位操作删除
  824. doDelete3(item : any, url : any) {
  825. // console.log('仓位操作删除:', item, url);
  826. this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
  827. confirmButtonText: '确定',
  828. cancelButtonText: '取消',
  829. type: 'warning',
  830. center: true
  831. }).then(() => {
  832. let loading = this.$loading({ target: '.main-container' });
  833. api.deleteList({ ids: item.id }, url).then((res : any) => {
  834. loading.close();
  835. if (res.code === 200) {
  836. this.getDataList2();
  837. this.$message.success('删除成功');
  838. } else this.$message.error(res.msg)
  839. }).catch(() => loading.close());
  840. }).catch(() => this.$message.info('已取消删除'));
  841. }
  842. }
  843. </script>
  844. <style lang="scss" scoped>
  845. .my-container {
  846. width: 100%;
  847. box-sizing: border-box;
  848. display: flex;
  849. height: 100%;
  850. .bill-main {
  851. width: 100%;
  852. box-sizing: border-box;
  853. height: 100%;
  854. }
  855. }
  856. </style>