index.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851
  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. name: '删除',
  331. event: {
  332. click: (item : any) => (this as any).doDelete3(item, 'maindataStoringLocation')
  333. }
  334. }]
  335. }]
  336. },
  337. }
  338. addConfig = {
  339. attr: {
  340. size: 'small',
  341. rules: {
  342. name: [{
  343. required: true, message: '请输入名称', trigger: 'blur'
  344. }],
  345. address: [{
  346. required: true, message: '请输入详细地址', trigger: 'blur'
  347. }],
  348. province: [{
  349. required: true, message: '请选择仓库地址', trigger: 'change'
  350. }],
  351. }
  352. },
  353. columns: [
  354. [
  355. {
  356. span: 24,
  357. labelWidth: '110px',
  358. label: '名称',
  359. prop: 'name',
  360. component: 'by-input',
  361. },
  362. {
  363. span: 24,
  364. labelWidth: '110px',
  365. label: '第三方仓库名称',
  366. prop: 'financeStorehouseName',
  367. component: 'by-input',
  368. },
  369. {
  370. span: 24,
  371. labelWidth: '110px',
  372. label: '第三方系统名称',
  373. prop: 'financeType',
  374. component: 'by-input',
  375. },
  376. {
  377. span: 24,
  378. labelWidth: '110px',
  379. label: '第三方仓库编码',
  380. prop: 'financeStorehouseNo',
  381. component: 'by-input',
  382. },
  383. ],
  384. [{
  385. labelWidth: '110px',
  386. label: '仓库地址',
  387. prop: 'province',
  388. component: 'by-area',
  389. compConfig: {
  390. attr: {
  391. province: 'province', //省
  392. provinceCode: 'provinceCode', //省编码
  393. city: 'city', //市
  394. cityCode: 'cityCode', //市编码
  395. county: 'region', //县/区
  396. countyCode: 'regionCode', //县/区编码
  397. town: 'street', //街道
  398. townCode: 'streetCode', //街道编码
  399. }
  400. }
  401. },
  402. ],
  403. [
  404. {
  405. span: 24,
  406. labelWidth: '110px',
  407. label: '详细地址',
  408. prop: 'address',
  409. component: 'by-input',
  410. },
  411. ]
  412. ]
  413. }
  414. addConfig2 = {
  415. attr: {
  416. size: 'small',
  417. rules: {
  418. name: [{
  419. required: true, message: '请输入名称', trigger: 'change'
  420. }],
  421. organizationName: [{
  422. required: true, message: '请输入所属机构名称', trigger: 'change'
  423. }],
  424. stockVolume: [{
  425. required: true, message: '请输入库存体积', trigger: 'change'
  426. }],
  427. maxStockNumber: [{
  428. required: true, message: '请输入库存数量上限', trigger: 'change'
  429. }],
  430. maxStockVolume: [{
  431. required: true, message: '请输入库存体积上限', trigger: 'change'
  432. }]
  433. }
  434. },
  435. columns: [
  436. [
  437. {
  438. labelWidth: '110px',
  439. span: 23,
  440. label: '名称',
  441. prop: 'name',
  442. component: 'by-input',
  443. },
  444. {
  445. labelWidth: '110px',
  446. span: 23,
  447. label: '所属机构名称',
  448. prop: 'organizationName',
  449. slot: true,
  450. },
  451. {
  452. labelWidth: '110px',
  453. span: 23,
  454. label: '库存体积',
  455. prop: 'stockVolume',
  456. component: 'by-input',
  457. compConfig: {
  458. attr: {
  459. type: "number",
  460. },
  461. }
  462. },
  463. {
  464. labelWidth: '110px',
  465. span: 23,
  466. label: '库存数量上限',
  467. prop: 'maxStockNumber',
  468. component: 'by-input',
  469. compConfig: {
  470. attr: {
  471. type: "number",
  472. },
  473. }
  474. },
  475. {
  476. labelWidth: '110px',
  477. span: 23,
  478. label: '库存体积上限',
  479. prop: 'maxStockVolume',
  480. component: 'by-input',
  481. compConfig: {
  482. attr: {
  483. type: "number",
  484. },
  485. }
  486. },
  487. ]
  488. ]
  489. }
  490. created() {
  491. this.timer = setInterval(() => {
  492. this.getDataList()
  493. }, 500)
  494. }
  495. close(){
  496. (this as any).$refs.addFormId.clearValue();
  497. setTimeout(()=>{
  498. this.dialogFormVisible = false;
  499. },0)
  500. }
  501. // 跳转货主管理
  502. toCargoOwner(){
  503. this.dialogFormVisible = false;
  504. (this as any).$router.push('/oms/cargoOwner')
  505. }
  506. // 仓库确认注册/编辑
  507. confirm() {
  508. if(this.$refs.addFormId){
  509. (this.$refs.addFormId as any).validate().then(()=>{
  510. let query = (this as any).$refs.addFormId.getValue();
  511. // console.log(query.isThird)
  512. if(query.isThird == 0 || query.isThird == null){
  513. query.thirdSysName = '';
  514. query.thirdPartnerId = '';
  515. query.thirdPartnerName = '';
  516. query.thirdStorehouseName = '';
  517. }
  518. // console.log(query);
  519. if (this.popTitle === '注册') {
  520. let loading = this.$loading({ target: '.main-container' });
  521. api.saveList(query, 'maindataStorehouse').then((res : any) => {
  522. loading.close();
  523. if (res.code === 200) {
  524. this.dialogFormVisible = false;
  525. this.$message.success(this.popTitle + '成功');
  526. this.getDataList();
  527. this.$confirm('是否注册仓位', '提示', {
  528. confirmButtonText: '确定',
  529. cancelButtonText: '取消',
  530. }).then(() => {
  531. api.single({ id: res.data }, 'maindataStorehouse').then((data : any) => {
  532. this.changeTab(data.data);
  533. this.onAdd2();
  534. })
  535. }).catch(() => {
  536. let data = {
  537. storehouseId: res.data,
  538. idDelete: 0,
  539. maxStockNumber: "100000",
  540. maxStockVolume: "100000",
  541. name: "默认仓位",
  542. organizationId: 1,
  543. organizationName: "供应商A",
  544. stockVolume: "100000",
  545. };
  546. api.saveList(data, 'maindataStoringLocation').then((res : any) => {
  547. if (res.code === 200) {
  548. this.$alert('此仓库将新增一个默认仓位');
  549. } else this.$message.error(res.msg)
  550. })
  551. });
  552. } else this.$message.error(res.msg)
  553. }).catch(() => loading.close());
  554. } else if (this.popTitle === '编辑') {
  555. let loading = this.$loading({ target: '.main-container' });
  556. api.updateList(query, 'maindataStorehouse').then((res : any) => {
  557. loading.close();
  558. if (res.code === 200) {
  559. this.dialogFormVisible = false;
  560. this.$message.success(this.popTitle + '成功');
  561. this.getDataList();
  562. } else this.$message.error(res.msg)
  563. }).catch(() => loading.close());
  564. }
  565. })
  566. }
  567. }
  568. // 仓位确认注册/编辑
  569. confirm2() {
  570. (this as any).$refs.addFormId2.validate().then(() => {
  571. let query = (this as any).$refs.addFormId2.getValue();
  572. query.storehouseId = this.tableData.id;
  573. query.idDelete = 0;
  574. if (this.popTitle === '注册') {
  575. let loading = this.$loading({ target: '.main-container' });
  576. api.saveList(query, 'maindataStoringLocation').then((res : any) => {
  577. loading.close();
  578. if (res.code === 200) {
  579. this.dialogFormVisible2 = false;
  580. this.$message.success(this.popTitle + '成功');
  581. this.getOneself(query.storehouseId);
  582. } else this.$message.error(res.msg)
  583. }).catch(() => loading.close());
  584. } else if (this.popTitle === '编辑') {
  585. let loading = this.$loading({ target: '.main-container' });
  586. api.updateList(query, 'maindataStoringLocation').then((res : any) => {
  587. loading.close();
  588. if (res.code === 200) {
  589. this.dialogFormVisible2 = false;
  590. this.$message.success(this.popTitle + '成功');
  591. this.getOneself(query.storehouseId);
  592. } else this.$message.error(res.msg)
  593. }).catch(() => loading.close());
  594. }
  595. })
  596. }
  597. // 取消仓位注册
  598. closeStoringLocation() {
  599. this.dialogFormVisible2 = false;
  600. if (this.tableData.subList.length <= 0) {
  601. let data = {
  602. storehouseId: this.tableData.id,
  603. idDelete: 0,
  604. maxStockNumber: "100000",
  605. maxStockVolume: "100000",
  606. name: "默认仓位",
  607. organizationId: 1,
  608. organizationName: "供应商A",
  609. stockVolume: "100000",
  610. };
  611. api.saveList(data, 'maindataStoringLocation').then((res : any) => {
  612. if (res.code === 200) {
  613. this.getOneself(this.tableData.id);
  614. this.$alert('此仓库将新增一个默认仓位');
  615. } else this.$message.error(res.msg)
  616. });
  617. }
  618. }
  619. // 通过id拿到当条数据
  620. getOneself(e : any) {
  621. api.single({ id: e }, 'maindataStorehouse').then((res : any) => {
  622. if (res.code === 200) {
  623. this.tableData = res.data;
  624. this.tableData.subList.map((v : any) => {
  625. v.ckName = this.tableData.name;
  626. });
  627. (this.$refs.moduleView2 as any).setTableValue(this.tableData.subList);
  628. }
  629. })
  630. }
  631. // 获取仓库列表数据
  632. getDataList() {
  633. if (!this.$refs.moduleView) {
  634. if (this.timeNum > 5) {
  635. clearInterval(this.timer)
  636. }
  637. this.timeNum++;
  638. return
  639. }
  640. clearInterval(this.timer)
  641. let query = (this.$refs.moduleView as any).getQuery();
  642. api.pageList(query, 'maindataStorehouse').then((res : any) => {
  643. if (res.code === 200) {
  644. (this.$refs.moduleView as any).setTableValue(res.data.records);
  645. let page = {
  646. pageNo: res.data.current, //当前页
  647. pageSize: res.data.size, //每页条数
  648. total: res.data.total //总条数
  649. };
  650. (this.$refs.moduleView as any).setPage(page)
  651. } else this.$message.error(res.msg)
  652. })
  653. }
  654. // 获取仓位列表数据
  655. getDataList2() {
  656. if (!this.$refs.moduleView2) {
  657. if (this.timeNum2 > 5) {
  658. clearInterval(this.timer2)
  659. }
  660. this.timeNum2++;
  661. return
  662. }
  663. clearInterval(this.timer2)
  664. let query = (this.$refs.moduleView2 as any).getQuery();
  665. console.log(query);
  666. query.storehouseId = this.tableData.id;
  667. let loading = this.$loading({ target: '.main-container' });
  668. api.pageList(query, 'maindataStoringLocation').then((res : any) => {
  669. loading.close();
  670. if (res.code === 200) {
  671. res.data.records.map((v : any) => {
  672. v.ckName = this.tableData.name;
  673. });
  674. (this.$refs.moduleView2 as any).setTableValue(res.data.records);
  675. let page = {
  676. pageNo: res.data.current, //当前页
  677. pageSize: res.data.size, //每页条数
  678. total: res.data.total //总条数
  679. };
  680. (this.$refs.moduleView2 as any).setPage(page)
  681. } else this.$message.error(res.msg)
  682. }).catch(() => loading.close());
  683. }
  684. // 工具栏方法
  685. clickHandle2(e : any) {
  686. if (e === 'onAdd') this.onAdd2();
  687. if (e === 'onReturn') {
  688. this.isShow = 'ckb';
  689. this.getDataList();
  690. };
  691. }
  692. // 打开注册
  693. onAdd() {
  694. this.popTitle = '注册'
  695. this.dialogFormVisible = true;
  696. setTimeout(() => {
  697. if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue({});
  698. }, 0)
  699. }
  700. // 打开编辑
  701. openEdit(e : any) {
  702. console.log(e);
  703. this.popTitle = '编辑'
  704. this.dialogFormVisible = true;
  705. setTimeout(() => {
  706. if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue(e);
  707. }, 0)
  708. }
  709. // 打开注册
  710. onAdd2() {
  711. this.popTitle = '注册'
  712. this.dialogFormVisible2 = true;
  713. this.isAdd = true;
  714. setTimeout(() => {
  715. if ((this as any).$refs.addFormId2) (this as any).$refs.addFormId2.setValue({});
  716. }, 0)
  717. }
  718. // 打开编辑
  719. openEdit2(e : any) {
  720. this.popTitle = '编辑'
  721. this.dialogFormVisible2 = true;
  722. this.isAdd = false;
  723. setTimeout(() => {
  724. if ((this as any).$refs.addFormId2) (this as any).$refs.addFormId2.setValue(e);
  725. }, 0)
  726. }
  727. // 打开机构选择
  728. handleSupplier() {
  729. (this.$refs.supplierModal as any).setShow(true);
  730. }
  731. // 确定机构选择
  732. confirmSupplier(e : any) {
  733. if (e.length == 0) return this.$message.warning('请选择机构名称');
  734. let value : any = (this.$refs.addFormId2 as any).getValue();
  735. value.organizationName = e[0].name;
  736. value.organizationId = e[0].id;
  737. (this.$refs.addFormId2 as any).setValue(value);
  738. }
  739. // 查看仓位
  740. changeTab(item : any) {
  741. let loading = this.$loading({ target: '.main-container' });
  742. api.single({ id: item.id }, 'maindataStorehouse').then((res : any) => {
  743. if (res.code === 200) {
  744. this.isShow = 'cwb';
  745. this.tableData = res.data;
  746. res.data.subList.map((v : any) => {
  747. v.ckName = res.data.name;
  748. })
  749. console.log('仓库表数据 ==> ', res.data);
  750. (this.$refs.moduleView2 as any).setTableValue(res.data.subList);
  751. loading.close();
  752. } else loading.close();
  753. }).catch(() => loading.close());
  754. }
  755. // 刷新仓库
  756. onRefresh() {
  757. (this as any).$refs.moduleView.clearSearch();
  758. this.getDataList();
  759. }
  760. // 刷新仓位
  761. onRefresh2() {
  762. (this as any).$refs.moduleView2.clearSearch();
  763. this.getDataList2();
  764. }
  765. // 仓库操作删除
  766. doDelete2(item : any, url : any) {
  767. this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
  768. confirmButtonText: '确定',
  769. cancelButtonText: '取消',
  770. type: 'warning',
  771. center: true
  772. }).then(() => {
  773. let loading = this.$loading({ target: '.main-container' });
  774. api.single({ id: item.id }, 'maindataStorehouse').then((res : any) => {
  775. if (res.data.subList.length > 0) {
  776. loading.close();
  777. this.$message.warning('此仓库下有仓位,不可删除!');
  778. } else {
  779. api.deleteList({ ids: item.id }, url).then((res : any) => {
  780. loading.close();
  781. if (res.code === 200) {
  782. this.getDataList();
  783. this.$message.success('删除成功');
  784. } else this.$message.error(res.msg)
  785. }).catch(() => loading.close());
  786. }
  787. }).catch(() => loading.close());
  788. }).catch(() => this.$message.info('已取消删除'));
  789. }
  790. // 仓位工具栏删除
  791. onDelete(moduleView : any, url : any) {
  792. let selectData = (this.$refs[moduleView] as any).getSelectData()
  793. let ids = '';
  794. if (selectData.length > 0) {
  795. selectData.map((v : any) => {
  796. ids += v.id + ','
  797. })
  798. } else return this.$message.warning('请选择删除数据');
  799. ids = ids.slice(0, ids.length - 1);
  800. this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
  801. confirmButtonText: '确定',
  802. cancelButtonText: '取消',
  803. type: 'warning',
  804. center: true
  805. }).then(() => {
  806. let loading = this.$loading({ target: '.main-container' });
  807. api.deleteList({ ids: ids }, url).then((res : any) => {
  808. loading.close();
  809. if (res.code === 200) {
  810. this.getDataList2();
  811. this.$message.success('删除成功');
  812. } else this.$message.error(res.msg)
  813. }).catch(() => loading.close());
  814. }).catch(() => this.$message.info('已取消删除'));
  815. }
  816. // 仓位操作删除
  817. doDelete3(item : any, url : any) {
  818. console.log('仓位操作删除:', item, url);
  819. this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
  820. confirmButtonText: '确定',
  821. cancelButtonText: '取消',
  822. type: 'warning',
  823. center: true
  824. }).then(() => {
  825. let loading = this.$loading({ target: '.main-container' });
  826. api.deleteList({ ids: item.id }, url).then((res : any) => {
  827. loading.close();
  828. if (res.code === 200) {
  829. this.getDataList2();
  830. this.$message.success('删除成功');
  831. } else this.$message.error(res.msg)
  832. }).catch(() => loading.close());
  833. }).catch(() => this.$message.info('已取消删除'));
  834. }
  835. }
  836. </script>
  837. <style lang="scss" scoped>
  838. .my-container {
  839. width: 100%;
  840. box-sizing: border-box;
  841. display: flex;
  842. height: 100%;
  843. .bill-main {
  844. width: 100%;
  845. box-sizing: border-box;
  846. height: 100%;
  847. }
  848. }
  849. </style>