index.vue 29 KB

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