index.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880
  1. <template>
  2. <div class="app-container">
  3. <div v-show="pageShow">
  4. <el-form
  5. :model="queryParams"
  6. ref="queryForm"
  7. v-show="showSearch"
  8. label-width="70px"
  9. size="small"
  10. >
  11. <el-row>
  12. <el-col :span="6">
  13. <el-form-item label="业务类型" prop="fBilltype">
  14. <el-select
  15. clearable
  16. filterable
  17. placeholder="请选择"
  18. style="width: 100%"
  19. v-model="queryParams.fBilltype"
  20. >
  21. <el-option
  22. v-for="(item, index) in billTypeList"
  23. :key="index.dictValue"
  24. :label="item.dictLabel"
  25. :value="item.dictValue"
  26. />
  27. </el-select>
  28. </el-form-item>
  29. </el-col>
  30. <el-col :span="6">
  31. <el-form-item label="船公司" prop="fCorpid">
  32. <el-select
  33. clearable
  34. filterable
  35. placeholder="请输入关键词"
  36. style="width: 100%"
  37. v-model="queryParams.fCorpid"
  38. >
  39. <el-option
  40. v-for="(item, index) in fMblnoOptions"
  41. :key="index.fId"
  42. :label="item.fName"
  43. :value="item.fId"
  44. ></el-option>
  45. </el-select>
  46. </el-form-item>
  47. </el-col>
  48. <el-col :span="6">
  49. <el-form-item label="状态" prop="fBillstatus">
  50. <el-select
  51. clearable
  52. filterable
  53. placeholder="请选择"
  54. style="width: 100%"
  55. v-model="queryParams.fBillstatus"
  56. >
  57. <el-option
  58. v-for="(item, index) in statusList"
  59. :key="index.dictValue"
  60. :label="item.dictLabel"
  61. :value="item.dictValue"
  62. />
  63. </el-select>
  64. </el-form-item>
  65. </el-col>
  66. <el-col :span="6">
  67. <el-form-item label="起运港" prop="polId">
  68. <el-select
  69. v-model="queryParams.polId"
  70. clearable
  71. filterable
  72. placeholder="请输入关键词"
  73. style="width: 100%"
  74. >
  75. <el-option
  76. v-for="(item, index) in podList"
  77. :key="index.fId"
  78. :label="item.fName"
  79. :value="item.fId"
  80. ></el-option>
  81. </el-select>
  82. </el-form-item>
  83. </el-col>
  84. </el-row>
  85. <el-collapse-transition>
  86. <div v-show="show">
  87. <el-row>
  88. <el-col :span="6">
  89. <el-form-item label="目的港" prop=" podId">
  90. <el-select
  91. v-model="queryParams.podId"
  92. clearable
  93. filterable
  94. placeholder="请输入关键词"
  95. style="width: 100%"
  96. >
  97. <el-option
  98. v-for="(item, index) in podList"
  99. :key="index.fId"
  100. :label="item.fName"
  101. :value="item.fId"
  102. ></el-option>
  103. </el-select>
  104. </el-form-item>
  105. </el-col>
  106. <el-col :span="6">
  107. <el-form-item label="有效期" prop="validdateList">
  108. <el-date-picker
  109. v-model="queryParams.validdateList"
  110. type="daterange"
  111. value-format="yyyy-MM-dd HH:mm:ss"
  112. :default-time="['00:00:00', '23:59:59']"
  113. clearable
  114. style="width: 230px"
  115. range-separator="至"
  116. start-placeholder="开始日期"
  117. end-placeholder="结束日期"
  118. @keyup.enter.native="handleQuery"
  119. >
  120. </el-date-picker>
  121. </el-form-item>
  122. </el-col>
  123. <el-col :span="6">
  124. <el-form-item label="航线" prop="fLineid">
  125. <el-select
  126. size="small"
  127. clearable
  128. filterable
  129. placeholder="请选择"
  130. style="width: 80%"
  131. v-model="queryParams.fLineid"
  132. >
  133. <el-option
  134. v-for="(item, index) in fLineList"
  135. :key="index.fId"
  136. :label="item.fName"
  137. :value="item.fId"
  138. />
  139. </el-select>
  140. </el-form-item>
  141. </el-col>
  142. <el-col :span="6">
  143. <el-form-item label="订舱代理" prop="fBookagentid">
  144. <el-select
  145. size="small"
  146. clearable
  147. filterable
  148. placeholder="请选择"
  149. style="width: 80%"
  150. v-model="queryParams.fBookagentid"
  151. >
  152. <el-option
  153. v-for="(item, index) in fBookagentList"
  154. :key="index.fId"
  155. :label="item.fName"
  156. :value="item.fId"
  157. />
  158. </el-select>
  159. </el-form-item>
  160. </el-col>
  161. </el-row>
  162. </div>
  163. </el-collapse-transition>
  164. </el-form>
  165. <el-row :gutter="10" class="mb8">
  166. <el-col :span="1.5">
  167. <el-button
  168. type="primary"
  169. icon="el-icon-plus"
  170. size="mini"
  171. @click="handleAdd"
  172. v-hasPermi="['warehouseBusiness:stockTransfer:add']"
  173. >新增
  174. </el-button>
  175. </el-col>
  176. <el-col :span="1.5">
  177. <el-button
  178. type="success"
  179. icon="el-icon-edit"
  180. size="mini"
  181. :disabled="single"
  182. @click="handleUpdate"
  183. v-hasPermi="['warehouseBusiness:stockTransfer:edit']"
  184. >修改
  185. </el-button>
  186. </el-col>
  187. <el-col :span="1.5">
  188. <el-button
  189. type="warning"
  190. icon="el-icon-download"
  191. size="mini"
  192. @click="handleExport"
  193. v-hasPermi="['warehouseBusiness:stockTransfer:export']"
  194. >导出
  195. </el-button>
  196. </el-col>
  197. <el-col :span="1.5">
  198. <el-button
  199. type="warning"
  200. icon="el-icon-download"
  201. size="mini"
  202. @click="handleExport"
  203. :disabled="multiple"
  204. v-hasPermi="['warehouseBusiness:stockTransfer:export']"
  205. >导入
  206. </el-button>
  207. </el-col>
  208. <el-col :span="1.5">
  209. <el-button
  210. type="info"
  211. icon="el-icon-download"
  212. size="mini"
  213. :disabled="single"
  214. @click="copyUpdate"
  215. v-hasPermi="['agreement:agreementStorage:export']"
  216. >复制新增
  217. </el-button>
  218. </el-col>
  219. <div class="tabSetting">
  220. <div style="margin-right: 20px">
  221. <el-button
  222. type="cyan"
  223. icon="el-icon-search"
  224. size="mini"
  225. @click="handleQuery"
  226. >搜索</el-button
  227. >
  228. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
  229. >重置</el-button
  230. >
  231. <el-button
  232. v-show="show"
  233. @click="show = !show"
  234. icon="el-icon-arrow-up"
  235. size="mini"
  236. >展开</el-button
  237. >
  238. <el-button
  239. v-show="!show"
  240. @click="show = !show"
  241. icon="el-icon-arrow-down"
  242. size="mini"
  243. >展开</el-button
  244. >
  245. </div>
  246. <right-toolbar
  247. :showSearch.sync="showSearch"
  248. @queryTable="getList"
  249. ></right-toolbar>
  250. <div style="margin: 0 12px">
  251. <el-button
  252. icon="el-icon-setting"
  253. size="mini"
  254. circle
  255. @click="showSetting = !showSetting"
  256. ></el-button>
  257. </div>
  258. </div>
  259. </el-row>
  260. <el-dialog
  261. title="自定义列显示"
  262. :visible.sync="showSetting"
  263. width="700px"
  264. v-dialogDrag
  265. :close-on-click-modal="false"
  266. >
  267. <template slot="title">
  268. <div class="avue-crud__dialog__header">
  269. <span class="el-dialog__title">
  270. <span
  271. style="
  272. display: inline-block;
  273. width: 3px;
  274. height: 20px;
  275. margin-right: 5px;
  276. float: left;
  277. margin-top: 2px;
  278. "
  279. ></span>
  280. </span>
  281. </div>
  282. </template>
  283. <div>配置排序列数据(拖动调整顺序)</div>
  284. <div style="margin-left: 17px">
  285. <el-checkbox
  286. v-model="allCheck"
  287. label="全选"
  288. @change="allChecked"
  289. ></el-checkbox>
  290. </div>
  291. <div style="padding: 4px; display: flex; justify-content: center">
  292. <draggable
  293. v-model="setRowList"
  294. group="site"
  295. animation="300"
  296. @start="onStart"
  297. @end="onEnd"
  298. handle=".indraggable"
  299. >
  300. <transition-group>
  301. <div
  302. v-for="item in setRowList"
  303. :key="item.surface"
  304. class="listStyle"
  305. >
  306. <div style="width: 500px" class="indraggable">
  307. <div class="progress" :style="{ width: item.width + 'px' }">
  308. <el-checkbox
  309. :label="item.name"
  310. v-model="item.checked"
  311. :true-label="0"
  312. :false-label="1"
  313. >{{ item.name }}
  314. </el-checkbox>
  315. </div>
  316. </div>
  317. <el-input-number
  318. v-model.number="item.width"
  319. controls-position="right"
  320. :min="1"
  321. :max="500"
  322. size="mini"
  323. ></el-input-number>
  324. </div>
  325. </transition-group>
  326. </draggable>
  327. </div>
  328. <span slot="footer" class="dialog-footer">
  329. <el-button @click="showSetting = false">取 消</el-button>
  330. <el-button @click="delRow" type="danger">重 置</el-button>
  331. <el-button type="primary" @click="save()">确 定</el-button>
  332. </span>
  333. </el-dialog>
  334. <el-table
  335. v-loading="loading"
  336. :data="warehousebillsList"
  337. @selection-change="handleSelectionChange"
  338. show-summary
  339. :summary-method="getSum"
  340. >
  341. <el-table-column type="selection" width="50" fixed align="center" />
  342. <el-table-column
  343. type="index"
  344. label="行号"
  345. width="50"
  346. align="center"
  347. fixed
  348. />
  349. <el-table-column
  350. v-for="(item, index) in getRowList"
  351. :key="index"
  352. :label="item.name"
  353. :width="item.width"
  354. :prop="item.label"
  355. align="center"
  356. :fixed="item.fixed"
  357. :show-overflow-tooltip="true"
  358. sortable
  359. >
  360. <template slot-scope="scope">
  361. <span v-if="item.label == 'fMblno'">
  362. <el-link :underline="false" type="primary"
  363. ><div @click="handleUpdate(scope.row)">
  364. {{ scope.row.fMblno }}
  365. </div></el-link
  366. >
  367. </span>
  368. <span v-else-if="item.label == 'fValiddate'">
  369. {{ scope.row.fValiddate.slice(0,10) }}
  370. </span>
  371. <span v-else>{{ scope.row[item.label] }}</span>
  372. </template>
  373. </el-table-column>
  374. <el-table-column
  375. label="操作"
  376. align="center"
  377. class-name="small-padding fixed-width"
  378. min-width="180"
  379. fixed="right"
  380. >
  381. <template slot-scope="scope">
  382. <el-button
  383. size="mini"
  384. type="text"
  385. icon="el-icon-edit"
  386. @click="handleUpdate(scope.row, true)"
  387. v-hasPermi="['warehouseBusiness:stockTransfer:edit']"
  388. >查看
  389. </el-button>
  390. <el-button
  391. size="mini"
  392. type="text"
  393. icon="el-icon-edit"
  394. v-if="
  395. scope.row.fBillstatus == '录入' ||
  396. scope.row.fBillstatus == '暂存' ||
  397. scope.row.fBillstatus == '驳回'
  398. "
  399. @click="handleUpdate(scope.row, false)"
  400. v-hasPermi="['warehouseBusiness:stockTransfer:edit']"
  401. >修改
  402. </el-button>
  403. <el-button
  404. size="mini"
  405. type="text"
  406. icon="el-icon-delete"
  407. v-if="scope.row.fItemsStatus == '计划'"
  408. @click="handleDelete(scope.row)"
  409. v-hasPermi="['warehouseBusiness:stockTransfer:remove']"
  410. >删除
  411. </el-button>
  412. <el-button
  413. size="mini"
  414. type="text"
  415. icon="el-icon-delete"
  416. v-if="
  417. scope.row.fBillstatus == '请核' ||
  418. scope.row.fBillstatus == '审核中'
  419. "
  420. @click="handleUpdate(scope.row, true)"
  421. >审核进度
  422. </el-button>
  423. </template>
  424. </el-table-column>
  425. </el-table>
  426. <pagination
  427. v-show="total > 0"
  428. :total="total"
  429. :page.sync="queryParams.pageNum"
  430. :limit.sync="queryParams.pageSize"
  431. @pagination="getList"
  432. />
  433. </div>
  434. <add-or-update
  435. v-show="pageShow2"
  436. @changeShow="showAddOrUpdate"
  437. ref="addOrUpdateRef"
  438. :chiId="formId"
  439. :copyStatus="copyStatus"
  440. :key="timer"
  441. ></add-or-update>
  442. </div>
  443. </template>
  444. <script>
  445. import AddOrUpdate from "./AddOrUpdate.vue";
  446. import {listCorpsList, query, shippingCompany,listRoute} from "@/api/warehouseBusiness/shipping";
  447. import { listCorps } from "@/api/basicdata/corps";
  448. import { listWarehousesss } from "@/api/basicdata/warehouse";
  449. import { listGoods } from "@/api/basicdata/goods";
  450. import { listUser, queryUserVal } from "@/api/system/user";
  451. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  452. import Cookies from "js-cookie";
  453. import { addSet, select, resetModule } from "@/api/system/set";
  454. import draggable from "vuedraggable";
  455. export default {
  456. name: "plans",
  457. data() {
  458. return {
  459. timer: "",
  460. pageShow: true,
  461. pageShow2: false,
  462. queryParams: {
  463. pageNum: 1,
  464. pageSize: 10,
  465. fBilltype: null,
  466. fCorpid: null,
  467. polId: null,
  468. podId: null,
  469. fValiddate: null,
  470. remarks: null,
  471. },
  472. // 显示搜索条件
  473. showSearch: true,
  474. userOptions: [],
  475. fTrademodeidOptions: [],
  476. warehouseOptions: [],
  477. goodsOptions: [],
  478. fLineList:[],
  479. fBookagentList:[],
  480. fMblnoOptions: [],
  481. show: false,
  482. drag: false,
  483. tableDate: [
  484. {
  485. surface: "1",
  486. label: "fCorpName",
  487. name: "船公司",
  488. checked: 0,
  489. width: 100,
  490. },
  491. {
  492. surface: "2",
  493. label: "fBilltype",
  494. name: "业务类型",
  495. checked: 0,
  496. width: 100,
  497. },
  498. {
  499. surface: "3",
  500. label: "fBillstatus",
  501. name: "状态",
  502. checked: 0,
  503. width: 100,
  504. },
  505. {
  506. surface: "4",
  507. label: "polId",
  508. name: "起运港",
  509. checked: 0,
  510. width: 100,
  511. },
  512. {
  513. surface: "5",
  514. label: "podId",
  515. name: "目的港",
  516. checked: 0,
  517. width: 100,
  518. },
  519. {
  520. surface: "5",
  521. label: "fValiddate",
  522. name: "有效期",
  523. checked: 0,
  524. width: 100,
  525. },
  526. {
  527. surface: "5",
  528. label: "createBy",
  529. name: "录入人",
  530. checked: 0,
  531. width: 100,
  532. },{
  533. surface: "6",
  534. label: "fLineName",
  535. name: "航线",
  536. checked: 0,
  537. width: 100,
  538. },{
  539. surface: "7",
  540. label: "fBookagentName",
  541. name: "订舱代理",
  542. checked: 0,
  543. width: 100,
  544. },
  545. {
  546. surface: "8",
  547. label: "remarks",
  548. name: "备注",
  549. checked: 0,
  550. width: 100,
  551. },
  552. ],
  553. setRowList: [],
  554. getRowList: [],
  555. allCheck: false,
  556. showSetting: false,
  557. total: 0,
  558. warehousebillsList: [],
  559. loading: true,
  560. single: true,
  561. multiple: true,
  562. formId: null,
  563. ids: [],
  564. copyStatus: null,
  565. billTypeList: [],
  566. statusList: [],
  567. polList: [],
  568. podList: [],
  569. };
  570. },
  571. // 使用子组件
  572. components: { draggable, AddOrUpdate },
  573. created() {
  574. this.setRowList = this.tableDate;
  575. this.getRowList = this.tableDate;
  576. this.getDicts("data_trademodes").then((response) => {
  577. this.fTrademodeidOptions = response.data;
  578. });
  579. listGoods({ fStatus: 0, delFlag: 0 }).then((response) => {
  580. this.goodsOptions = response.rows;
  581. });
  582. listWarehousesss({ fStatus: 0, delFlag: 0 }).then((response) => {
  583. this.warehouseOptions = response.rows;
  584. });
  585. listCorpsList().then( response =>{
  586. this.fLineList = response.rows
  587. })
  588. shippingCompany().then( response =>{
  589. this.fBookagentList = response.rows
  590. })
  591. listUser().then((response) => {
  592. this.userOptions = response.rows;
  593. });
  594. listCorps({ type: 1 }).then((response) => {
  595. this.fMblnoOptions = response.rows;
  596. });
  597. this.getDicts("data_billType").then((response) => {
  598. this.billTypeList = response.data;
  599. });
  600. this.getDicts("data_status").then((response) => {
  601. this.statusList = response.data;
  602. });
  603. // this.getDicts("port_start").then((response) => {
  604. // this.polList = response.data;
  605. // });
  606. // this.getDicts("port_end").then((response) => {
  607. // this.podList = response.data;
  608. // });
  609. listRoute({}).then(response => {
  610. this.podList = response.rows
  611. });
  612. this.getRow();
  613. this.getList();
  614. },
  615. activated() {
  616. if (this.$route.query.id) {
  617. this.handleUpdate(this.$route.query.id);
  618. }
  619. },
  620. methods: {
  621. //列设置全选
  622. allChecked() {
  623. if (this.allCheck == true) {
  624. this.setRowList.map((e) => {
  625. return (e.checked = 0);
  626. });
  627. } else {
  628. this.setRowList.map((e) => {
  629. return (e.checked = 1);
  630. });
  631. }
  632. },
  633. //查询列数据
  634. getRow() {
  635. let that = this;
  636. this.data = {
  637. tableName: "调拨",
  638. userId: Cookies.get("userName"),
  639. };
  640. select(this.data).then((res) => {
  641. if (res.data.length != 0) {
  642. this.getRowList = res.data.filter((e) => e.checked == 0);
  643. this.setRowList = res.data;
  644. this.setRowList = this.setRowList.reduce((res, item) => {
  645. res.push({
  646. surface: item.surface,
  647. label: item.label,
  648. name: item.name,
  649. checked: item.checked,
  650. width: item.width,
  651. fixed: item.fixed,
  652. });
  653. return res;
  654. }, []);
  655. }
  656. });
  657. },
  658. //重置列表
  659. delRow() {
  660. this.data = {
  661. tableName: "调拨",
  662. userId: Cookies.get("userName"),
  663. };
  664. resetModule(this.data).then((res) => {
  665. if (res.code == 200) {
  666. this.showSetting = false;
  667. this.setRowList = this.$options.data().tableDate;
  668. this.getRowList = this.$options.data().tableDate;
  669. }
  670. });
  671. },
  672. //保存列设置
  673. save() {
  674. this.showSetting = false;
  675. this.data = {
  676. tableName: "调拨",
  677. userId: Cookies.get("userName"),
  678. sysTableSetList: this.setRowList,
  679. };
  680. addSet(this.data).then((res) => {
  681. if (res.code == 200) {
  682. this.showSetting = false;
  683. this.getRowList = this.setRowList.filter((e) => e.checked == 0);
  684. console.log(this.tableDate);
  685. }
  686. });
  687. },
  688. //开始拖拽事件
  689. onStart() {
  690. this.drag = true;
  691. },
  692. //拖拽结束事件
  693. onEnd() {
  694. this.drag = false;
  695. },
  696. getList() {
  697. //获取仓库
  698. query(this.queryParams).then((response) => {
  699. this.warehousebillsList = response.rows;
  700. this.total = response.total;
  701. this.loading = false;
  702. });
  703. },
  704. //合计
  705. getSum(param) {
  706. const { columns, data } = param;
  707. const sums = [];
  708. var values = [];
  709. columns.forEach((column, index) => {
  710. if (index === 0) {
  711. sums[index] = "";
  712. return;
  713. }
  714. if (column.property === "fGrossweight") {
  715. values = data.map((item) => Number(item["fGrossweight"]));
  716. }
  717. if (column.property === "fNetweight") {
  718. values = data.map((item) => Number(item["fNetweight"]));
  719. }
  720. if (column.property === "fQty") {
  721. values = data.map((item) => Number(item["fQty"]));
  722. }
  723. if (column.property === "fPlanqty") {
  724. values = data.map((item) => Number(item.fPlanqty));
  725. }
  726. if (
  727. column.property === "fGrossweight" ||
  728. column.property === "fNetweight" ||
  729. column.property === "fQty" ||
  730. column.property === "fPlanqty"
  731. ) {
  732. sums[index] = values.reduce((prev, curr) => {
  733. const value = Number(curr);
  734. if (!isNaN(value)) {
  735. return prev + curr;
  736. } else {
  737. return prev;
  738. }
  739. }, 0);
  740. if (column.property === "fGrossweight") {
  741. sums[index] = (sums[index] / 1000).toFixed(2) + "吨";
  742. }
  743. if (column.property === "fNetweight") {
  744. sums[index] = (sums[index] / 1000).toFixed(2) + "吨";
  745. }
  746. if (column.property === "fQty") {
  747. sums[index] = sums[index].toFixed(2);
  748. }
  749. if (column.property === "fPlanqty") {
  750. if (sums[index]) {
  751. sums[index] = sums[index];
  752. }
  753. }
  754. }
  755. });
  756. return sums;
  757. },
  758. handleAdd() {
  759. this.timer = new Date().getTime();
  760. this.pageShow = false;
  761. this.pageShow2 = true;
  762. },
  763. // 多选框选中数据
  764. handleSelectionChange(selection) {
  765. this.ids = selection.map((item) => item.fId);
  766. this.single =
  767. selection.length !== 1 ||
  768. selection.map((item) => item.fBillstatus) == 6 ||
  769. selection.map((item) => item.fBillstatus) == 4;
  770. this.multiple = !selection.length;
  771. },
  772. /** 修改按钮操作 */
  773. handleUpdate(row) {
  774. const fId = row.fId || this.ids[0] || row;
  775. this.copyStatus = null;
  776. this.formId = fId;
  777. this.$nextTick(() => {
  778. this.$refs.addOrUpdateRef.init();
  779. });
  780. setTimeout(() => {
  781. this.pageShow = false;
  782. this.pageShow2 = true;
  783. }, 200);
  784. },
  785. copyUpdate() {
  786. this.formId = this.ids[0];
  787. this.copyStatus = 2;
  788. this.$nextTick(() => {
  789. this.$refs.addOrUpdateRef.init();
  790. });
  791. setTimeout(() => {
  792. this.pageShow = false;
  793. this.pageShow2 = true;
  794. }, 200);
  795. },
  796. handleDelete(row) {
  797. const ids = row.fId || this.ids;
  798. delstockTransfer_s(ids).then((data) => {
  799. switch (data.msg) {
  800. case "0": {
  801. this.$message.error("当前数据已被其他操作员操作请刷新页面");
  802. break;
  803. }
  804. case "1": {
  805. this.delete(ids, "当前主表有数据从表无数据是否删除");
  806. break;
  807. }
  808. case "2": {
  809. this.delete(ids, "当前主表有数据从表有数据是否删除");
  810. break;
  811. }
  812. default: {
  813. return this.$message.error("未知错误,无状态");
  814. }
  815. }
  816. });
  817. },
  818. delete(ids, tips) {
  819. this.$confirm(tips, "警告", {
  820. confirmButtonText: "确定",
  821. cancelButtonText: "取消",
  822. type: "warning",
  823. }).then(() => {
  824. delStockTransfer(ids);
  825. this.msgSuccess("删除成功");
  826. this.getList();
  827. });
  828. },
  829. /** 导出按钮操作 */
  830. handleExport() {
  831. // require.ensure([], () => {
  832. // const { export_json_to_excel } = require("../../../excel/Export2Excel");
  833. // const tHeader = ["客户名称", "制单日期"];
  834. // // 上面设置Excel的表格第一行的标题
  835. // const filterVal = ["corpId", "createTime"];
  836. // // 上面的index、nickName、name是tableData里对象的属性
  837. // const list = this.ftmsorderbillsList; //把data里的tableData存到list
  838. // const data = this.formatJson(filterVal, list);
  839. // export_json_to_excel(
  840. // tHeader,
  841. // data,
  842. // "列表excel",
  843. // true,
  844. // );
  845. // });
  846. },
  847. formatJson(filterVal, jsonData) {
  848. return jsonData.map((v) => filterVal.map((j) => v[j]));
  849. },
  850. /** 搜索按钮操作 */
  851. handleQuery() {
  852. this.queryParams.pageNum = 1;
  853. this.getList();
  854. },
  855. /** 重置按钮操作 */
  856. resetQuery() {
  857. this.queryParams = {
  858. pageNum: 1,
  859. pageSize: 10,
  860. fBilltype: null,
  861. fCorpid: null,
  862. polId: null,
  863. podId: null,
  864. fValiddate: null,
  865. remarks: null,
  866. };
  867. this.handleQuery();
  868. },
  869. showAddOrUpdate(data) {
  870. if (data) {
  871. this.getList();
  872. this.pageShow = true;
  873. this.pageShow2 = false;
  874. }
  875. },
  876. },
  877. };
  878. </script>