index.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890
  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, exportSeaprice } 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. import { exportList } from '@/api/finance/query'
  456. export default {
  457. name: "plans",
  458. data() {
  459. return {
  460. timer: "",
  461. pageShow: true,
  462. pageShow2: false,
  463. queryParams: {
  464. pageNum: 1,
  465. pageSize: 10,
  466. fBilltype: null,
  467. fCorpid: null,
  468. polId: null,
  469. podId: null,
  470. fValiddate: null,
  471. remarks: null,
  472. },
  473. // 显示搜索条件
  474. showSearch: true,
  475. userOptions: [],
  476. fTrademodeidOptions: [],
  477. warehouseOptions: [],
  478. goodsOptions: [],
  479. fLineList:[],
  480. fBookagentList:[],
  481. fMblnoOptions: [],
  482. show: false,
  483. drag: false,
  484. tableDate: [
  485. {
  486. surface: "1",
  487. label: "fCorpName",
  488. name: "船公司",
  489. checked: 0,
  490. width: 100,
  491. },
  492. {
  493. surface: "2",
  494. label: "fBilltype",
  495. name: "业务类型",
  496. checked: 0,
  497. width: 100,
  498. },
  499. {
  500. surface: "3",
  501. label: "fBillstatus",
  502. name: "状态",
  503. checked: 0,
  504. width: 100,
  505. },
  506. {
  507. surface: "4",
  508. label: "polName",
  509. name: "起运港",
  510. checked: 0,
  511. width: 100,
  512. },
  513. {
  514. surface: "5",
  515. label: "podName",
  516. name: "目的港",
  517. checked: 0,
  518. width: 100,
  519. },
  520. {
  521. surface: "5",
  522. label: "fValiddate",
  523. name: "有效期",
  524. checked: 0,
  525. width: 100,
  526. },
  527. {
  528. surface: "5",
  529. label: "createBy",
  530. name: "录入人",
  531. checked: 0,
  532. width: 100,
  533. },{
  534. surface: "6",
  535. label: "fLineName",
  536. name: "航线",
  537. checked: 0,
  538. width: 100,
  539. },{
  540. surface: "7",
  541. label: "fBookagentName",
  542. name: "订舱代理",
  543. checked: 0,
  544. width: 100,
  545. },
  546. {
  547. surface: "8",
  548. label: "remarks",
  549. name: "备注",
  550. checked: 0,
  551. width: 100,
  552. },
  553. ],
  554. setRowList: [],
  555. getRowList: [],
  556. allCheck: false,
  557. showSetting: false,
  558. total: 0,
  559. warehousebillsList: [],
  560. loading: true,
  561. single: true,
  562. multiple: true,
  563. formId: null,
  564. ids: [],
  565. copyStatus: null,
  566. billTypeList: [],
  567. statusList: [],
  568. polList: [],
  569. podList: [],
  570. };
  571. },
  572. // 使用子组件
  573. components: { draggable, AddOrUpdate },
  574. created() {
  575. this.setRowList = this.tableDate;
  576. this.getRowList = this.tableDate;
  577. this.getDicts("data_trademodes").then((response) => {
  578. this.fTrademodeidOptions = response.data;
  579. });
  580. listGoods({ fStatus: 0, delFlag: 0 }).then((response) => {
  581. this.goodsOptions = response.rows;
  582. });
  583. listWarehousesss({ fStatus: 0, delFlag: 0 }).then((response) => {
  584. this.warehouseOptions = response.rows;
  585. });
  586. listCorpsList().then( response =>{
  587. this.fLineList = response.rows
  588. })
  589. shippingCompany().then( response =>{
  590. this.fBookagentList = response.rows
  591. })
  592. listUser().then((response) => {
  593. this.userOptions = response.rows;
  594. });
  595. listCorps({ type: 1 }).then((response) => {
  596. this.fMblnoOptions = response.rows;
  597. });
  598. this.getDicts("data_billType").then((response) => {
  599. this.billTypeList = response.data;
  600. });
  601. this.getDicts("data_status").then((response) => {
  602. this.statusList = response.data;
  603. });
  604. // this.getDicts("port_start").then((response) => {
  605. // this.polList = response.data;
  606. // });
  607. // this.getDicts("port_end").then((response) => {
  608. // this.podList = response.data;
  609. // });
  610. listRoute({}).then(response => {
  611. this.podList = response.rows
  612. });
  613. this.getRow();
  614. this.getList();
  615. },
  616. activated() {
  617. if (this.$route.query.id) {
  618. this.handleUpdate(this.$route.query.id);
  619. }
  620. },
  621. methods: {
  622. //列设置全选
  623. allChecked() {
  624. if (this.allCheck == true) {
  625. this.setRowList.map((e) => {
  626. return (e.checked = 0);
  627. });
  628. } else {
  629. this.setRowList.map((e) => {
  630. return (e.checked = 1);
  631. });
  632. }
  633. },
  634. //查询列数据
  635. getRow() {
  636. let that = this;
  637. this.data = {
  638. tableName: "调拨",
  639. userId: Cookies.get("userName"),
  640. };
  641. select(this.data).then((res) => {
  642. if (res.data.length != 0) {
  643. this.getRowList = res.data.filter((e) => e.checked == 0);
  644. this.setRowList = res.data;
  645. this.setRowList = this.setRowList.reduce((res, item) => {
  646. res.push({
  647. surface: item.surface,
  648. label: item.label,
  649. name: item.name,
  650. checked: item.checked,
  651. width: item.width,
  652. fixed: item.fixed,
  653. });
  654. return res;
  655. }, []);
  656. }
  657. });
  658. },
  659. //重置列表
  660. delRow() {
  661. this.data = {
  662. tableName: "调拨",
  663. userId: Cookies.get("userName"),
  664. };
  665. resetModule(this.data).then((res) => {
  666. if (res.code == 200) {
  667. this.showSetting = false;
  668. this.setRowList = this.$options.data().tableDate;
  669. this.getRowList = this.$options.data().tableDate;
  670. }
  671. });
  672. },
  673. //保存列设置
  674. save() {
  675. this.showSetting = false;
  676. this.data = {
  677. tableName: "调拨",
  678. userId: Cookies.get("userName"),
  679. sysTableSetList: this.setRowList,
  680. };
  681. addSet(this.data).then((res) => {
  682. if (res.code == 200) {
  683. this.showSetting = false;
  684. this.getRowList = this.setRowList.filter((e) => e.checked == 0);
  685. console.log(this.tableDate);
  686. }
  687. });
  688. },
  689. //开始拖拽事件
  690. onStart() {
  691. this.drag = true;
  692. },
  693. //拖拽结束事件
  694. onEnd() {
  695. this.drag = false;
  696. },
  697. getList() {
  698. //获取仓库
  699. query(this.queryParams).then((response) => {
  700. this.warehousebillsList = response.rows;
  701. this.total = response.total;
  702. this.loading = false;
  703. });
  704. },
  705. //合计
  706. getSum(param) {
  707. const { columns, data } = param;
  708. const sums = [];
  709. var values = [];
  710. columns.forEach((column, index) => {
  711. if (index === 0) {
  712. sums[index] = "";
  713. return;
  714. }
  715. if (column.property === "fGrossweight") {
  716. values = data.map((item) => Number(item["fGrossweight"]));
  717. }
  718. if (column.property === "fNetweight") {
  719. values = data.map((item) => Number(item["fNetweight"]));
  720. }
  721. if (column.property === "fQty") {
  722. values = data.map((item) => Number(item["fQty"]));
  723. }
  724. if (column.property === "fPlanqty") {
  725. values = data.map((item) => Number(item.fPlanqty));
  726. }
  727. if (
  728. column.property === "fGrossweight" ||
  729. column.property === "fNetweight" ||
  730. column.property === "fQty" ||
  731. column.property === "fPlanqty"
  732. ) {
  733. sums[index] = values.reduce((prev, curr) => {
  734. const value = Number(curr);
  735. if (!isNaN(value)) {
  736. return prev + curr;
  737. } else {
  738. return prev;
  739. }
  740. }, 0);
  741. if (column.property === "fGrossweight") {
  742. sums[index] = (sums[index] / 1000).toFixed(2) + "吨";
  743. }
  744. if (column.property === "fNetweight") {
  745. sums[index] = (sums[index] / 1000).toFixed(2) + "吨";
  746. }
  747. if (column.property === "fQty") {
  748. sums[index] = sums[index].toFixed(2);
  749. }
  750. if (column.property === "fPlanqty") {
  751. if (sums[index]) {
  752. sums[index] = sums[index];
  753. }
  754. }
  755. }
  756. });
  757. return sums;
  758. },
  759. handleAdd() {
  760. this.timer = new Date().getTime();
  761. this.pageShow = false;
  762. this.pageShow2 = true;
  763. },
  764. // 多选框选中数据
  765. handleSelectionChange(selection) {
  766. this.ids = selection.map((item) => item.fId);
  767. this.single =
  768. selection.length !== 1 ||
  769. selection.map((item) => item.fBillstatus) == 6 ||
  770. selection.map((item) => item.fBillstatus) == 4;
  771. this.multiple = !selection.length;
  772. },
  773. /** 修改按钮操作 */
  774. handleUpdate(row) {
  775. const fId = row.fId || this.ids[0] || row;
  776. this.copyStatus = null;
  777. this.formId = fId;
  778. this.$nextTick(() => {
  779. this.$refs.addOrUpdateRef.init();
  780. });
  781. setTimeout(() => {
  782. this.pageShow = false;
  783. this.pageShow2 = true;
  784. }, 200);
  785. },
  786. copyUpdate() {
  787. this.formId = this.ids[0];
  788. this.copyStatus = 2;
  789. this.$nextTick(() => {
  790. this.$refs.addOrUpdateRef.init();
  791. });
  792. setTimeout(() => {
  793. this.pageShow = false;
  794. this.pageShow2 = true;
  795. }, 200);
  796. },
  797. handleDelete(row) {
  798. const ids = row.fId || this.ids;
  799. delstockTransfer_s(ids).then((data) => {
  800. switch (data.msg) {
  801. case "0": {
  802. this.$message.error("当前数据已被其他操作员操作请刷新页面");
  803. break;
  804. }
  805. case "1": {
  806. this.delete(ids, "当前主表有数据从表无数据是否删除");
  807. break;
  808. }
  809. case "2": {
  810. this.delete(ids, "当前主表有数据从表有数据是否删除");
  811. break;
  812. }
  813. default: {
  814. return this.$message.error("未知错误,无状态");
  815. }
  816. }
  817. });
  818. },
  819. delete(ids, tips) {
  820. this.$confirm(tips, "警告", {
  821. confirmButtonText: "确定",
  822. cancelButtonText: "取消",
  823. type: "warning",
  824. }).then(() => {
  825. delStockTransfer(ids);
  826. this.msgSuccess("删除成功");
  827. this.getList();
  828. });
  829. },
  830. /** 导出按钮操作 */
  831. handleExport() {
  832. this.$confirm("是否确认导出所有运价数据项?", "警告", {
  833. confirmButtonText: "确定",
  834. cancelButtonText: "取消",
  835. type: "warning",
  836. }).then(() => {
  837. return exportSeaprice(this.queryParams)
  838. }).then(res => {
  839. this.download(res.msg)
  840. })
  841. // require.ensure([], () => {
  842. // const { export_json_to_excel } = require("../../../excel/Export2Excel");
  843. // const tHeader = ["客户名称", "制单日期"];
  844. // // 上面设置Excel的表格第一行的标题
  845. // const filterVal = ["corpId", "createTime"];
  846. // // 上面的index、nickName、name是tableData里对象的属性
  847. // const list = this.ftmsorderbillsList; //把data里的tableData存到list
  848. // const data = this.formatJson(filterVal, list);
  849. // export_json_to_excel(
  850. // tHeader,
  851. // data,
  852. // "列表excel",
  853. // true,
  854. // );
  855. // });
  856. },
  857. formatJson(filterVal, jsonData) {
  858. return jsonData.map((v) => filterVal.map((j) => v[j]));
  859. },
  860. /** 搜索按钮操作 */
  861. handleQuery() {
  862. this.queryParams.pageNum = 1;
  863. this.getList();
  864. },
  865. /** 重置按钮操作 */
  866. resetQuery() {
  867. this.queryParams = {
  868. pageNum: 1,
  869. pageSize: 10,
  870. fBilltype: null,
  871. fCorpid: null,
  872. polId: null,
  873. podId: null,
  874. fValiddate: null,
  875. remarks: null,
  876. };
  877. this.handleQuery();
  878. },
  879. showAddOrUpdate(data) {
  880. if (data) {
  881. this.getList();
  882. this.pageShow = true;
  883. this.pageShow2 = false;
  884. }
  885. },
  886. },
  887. };
  888. </script>