index.vue 33 KB

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