index.vue 37 KB

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