adPaList-clothes.vue 37 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091
  1. <template>
  2. <!-- 预装箱单-成衣 列表-->
  3. <div id="adPaListClothes">
  4. <!-- 查询 -->
  5. <a-card :bordered="false">
  6. <div class="table-page-search-wrapper">
  7. <a-form layout="inline" @keyup.enter.native="searchQuery">
  8. <a-row :gutter="24">
  9. <!-- <a-col :md="6" :sm="8">
  10. <a-form-item label="单据号">
  11. <a-input placeholder="请输入单据号" v-model="queryParam.documentNo"></a-input>
  12. </a-form-item>
  13. </a-col> -->
  14. <!-- <a-col :md="6" :sm="8">
  15. <a-form-item label="订单号">
  16. <a-input placeholder="请输入订单号" v-model="queryParam.orderNumber"></a-input>
  17. </a-form-item>
  18. </a-col> -->
  19. <a-col :md="6" :sm="8">
  20. <a-form-item label="款号">
  21. <a-input placeholder="请输入款号" v-model="queryParam.itemNumber"></a-input>
  22. </a-form-item>
  23. </a-col>
  24. <a-col :md="6" :sm="8">
  25. <a-form-item label="小po">
  26. <a-input placeholder="请输入小po" v-model="queryParam.smallPo"></a-input>
  27. </a-form-item>
  28. </a-col>
  29. <a-col :md="6" :sm="8">
  30. <a-form-item label="分销点">
  31. <!-- <a-input placeholder="请输入分销点" v-model="queryParam.distributionPoint"></a-input> -->
  32. <j-search-select-tag
  33. placeholder="请选择分销点"
  34. v-model="queryParam.distributionPoint"
  35. dict="view_distributionpoint,distributionpoint,distributionpoint">
  36. </j-search-select-tag>
  37. </a-form-item>
  38. </a-col>
  39. <template v-if="toggleSearchStatus">
  40. <!-- <a-col :md="6" :sm="8">
  41. <a-form-item label="单据日期">
  42. <a-range-picker
  43. style="width: 100%"
  44. v-model="timeRange"
  45. format="YYYY-MM-DD"
  46. :placeholder="['开始日期', '结束日期']"
  47. @change="onDateChange"
  48. @ok="onDateOk"
  49. />
  50. </a-form-item>
  51. </a-col> -->
  52. <a-col :md="5" :sm="8">
  53. <a-form-model-item label="是否被参照">
  54. <a-select v-model="queryParam.isReference">
  55. <a-select-option value="">请选择</a-select-option>
  56. <a-select-option value="1">是</a-select-option>
  57. <a-select-option value="0">否</a-select-option>
  58. </a-select>
  59. </a-form-model-item>
  60. </a-col>
  61. <a-col :md="6" :sm="8">
  62. <a-form-item label="账套号">
  63. <j-search-select-tag
  64. placeholder="请选择账套号"
  65. v-model="queryParam.acSetNo"
  66. dict="view_account,account,account">
  67. </j-search-select-tag>
  68. </a-form-item>
  69. </a-col>
  70. <a-col :md="6" :sm="8">
  71. <a-form-item label="成衣工厂">
  72. <!-- <a-input placeholder="请输入成衣工厂" v-model="queryParam.garmentFactory"></a-input> -->
  73. <j-search-select-tag
  74. placeholder="请选择成衣广场"
  75. v-model="queryParam.garmentFactory"
  76. dict="view_garmentfactory,garmentfactory,garmentfactory">
  77. </j-search-select-tag>
  78. </a-form-item>
  79. </a-col>
  80. <a-col :md="6" :sm="8">
  81. <a-form-item label="预发货日期">
  82. <a-range-picker
  83. style="width: 100%"
  84. :mode="rangeMode"
  85. :placeholder="['开始日期', '结束日期']"
  86. :value="range"
  87. format = "YYYY-MM-DD"
  88. @change="rangeSelectChange"
  89. />
  90. </a-form-item>
  91. </a-col>
  92. <a-col :md="6" :sm="8">
  93. <a-form-item label="导入时间">
  94. <a-date-picker placeholder="请选择导入时间" v-model="queryParam.createTime" format="YYYY-MM-DD" @change="createTimeChange"></a-date-picker>
  95. </a-form-item>
  96. </a-col>
  97. <a-col :md="6" :sm="8">
  98. <a-form-item label="制单人">
  99. <a-input placeholder="请输入制单人" v-model="queryParam.createBy"></a-input>
  100. </a-form-item>
  101. </a-col>
  102. <a-col :md="6" :sm="8">
  103. <a-form-item label="预托书号">
  104. <a-input placeholder="请输入预托书号" v-model="queryParam.depositaryReceiptNo"></a-input>
  105. </a-form-item>
  106. </a-col>
  107. <a-col :md="6" :sm="8">
  108. <a-form-item label="是否提交">
  109. <a-select v-model="queryParam.status">
  110. <a-select-option value="">请选择</a-select-option>
  111. <a-select-option value="0">否</a-select-option>
  112. <a-select-option value="1">是</a-select-option>
  113. </a-select>
  114. </a-form-item>
  115. </a-col>
  116. </template>
  117. <a-col :md="6" :sm="8">
  118. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  119. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  120. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  121. <a @click="handleToggleSearch" style="margin-left: 8px">
  122. {{ toggleSearchStatus ? '收起' : '展开' }}
  123. <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
  124. </a>
  125. </span>
  126. </a-col>
  127. </a-row>
  128. </a-form>
  129. </div>
  130. </a-card>
  131. <!-- 操作按钮区域 导出 导入 新增-->
  132. <a-card :bordered="false" style="margin:10px 0">
  133. <div class="table-operator">
  134. <a-button type="primary" @click="addAdpacking" icon="plus">新增</a-button>
  135. <a-button type="primary" icon="download" @click="handleExportXls1('预装箱单-成衣','0')">预装箱单成衣导出</a-button>
  136. <a-button type="primary" icon="download" @click="handleExportXls('预装箱单-成衣','1')">预装箱单成衣导出-装箱单</a-button>
  137. <a-button type="primary" icon="download" @click="handleExportXls2('预装箱单列表')">预装箱单列表导出</a-button>
  138. <a-upload productName="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel" :customRequest="uploadFlie">
  139. <a-button type="primary" icon="import">导入-来源出运明细</a-button>
  140. </a-upload>
  141. <a-button type="primary" @click="batchSubmit" icon="check">批量提交</a-button>
  142. <a-button type="primary" @click="batchCanelSubmit" icon="close">批量取消提交</a-button>
  143. <a-button type="primary" @click="batchPush" icon="export">批量推送</a-button>
  144. </div>
  145. <!-- table rowKey="id" -->
  146. <a-table
  147. bordered
  148. :columns="adPaListClothesColumns"
  149. :data-source="adPaListClothesData"
  150. :loading="loading"
  151. :pagination="pagination"
  152. :row-key="record => record.id"
  153. :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
  154. @change="handleTableChange"
  155. :scroll="{ x: 1500 , y: 600}"
  156. >
  157. <!-- 推送状态 -->
  158. <span slot="pushStatesSlot" slot-scope="text, record" :title="record.memo">
  159. <a-tag color="#2db7f5" v-if="record.pushStatus == '0' || record.pushStatus == null ">未推送</a-tag>
  160. <a-tag color="#87d068" v-if="record.pushStatus == '1'">推送成功</a-tag>
  161. <a-tag color="#f50" v-if="record.pushStatus == '2'">推送失败</a-tag>
  162. </span>
  163. <!-- 单据状态 -->
  164. <span slot="statusSlot" slot-scope="text, record">
  165. <a-tag color="orange" v-if="record.status == 0 || record.status == null">未提交</a-tag>
  166. <a-tag color="green" v-if="record.status == 1">已提交</a-tag>
  167. </span>
  168. <!-- 操作 默认按钮 未提交未推送-->
  169. <span slot="operationSlot" slot-scope="text, record">
  170. <a href="javascript:void(0);" @click="itemXls(record,'0')" style="color:green">报表模版导出</a>
  171. <a-divider type="vertical" />
  172. <a-dropdown>
  173. <a class="ant-dropdown-link">更多<a-icon type="down"/></a>
  174. <!-- 已保存 -->
  175. <a-menu slot="overlay" v-if="record.status == '0' || record.status == null">
  176. <a-menu-item>
  177. <a @click="details(record)">详情</a>
  178. </a-menu-item>
  179. <a-menu-item>
  180. <a @click="edit(record)">编辑</a>
  181. </a-menu-item>
  182. <!-- <a-menu-item>
  183. <a href="javascript:void(0);" @click="itemXls(record,'1')" >成衣模版导出</a>
  184. </a-menu-item> -->
  185. <!-- <a-menu-item>
  186. <a-popconfirm title="确定提交吗?" ok-text="是" cancel-text="否" @confirm="submit(record)">
  187. <a href="javascript:void(0);" style="color:green;">提交</a>
  188. </a-popconfirm>
  189. </a-menu-item> -->
  190. <a-menu-item>
  191. <a-popconfirm title="确定删除吗?" ok-text="是" cancel-text="否" @confirm="handleDelete(record)">
  192. <a href="javascript:void(0);" style="color:red;">删除</a>
  193. </a-popconfirm>
  194. </a-menu-item>
  195. </a-menu>
  196. <!-- 已提交 且 推送成功 -->
  197. <a-menu slot="overlay" v-if="record.pushStatus == '1' && record.status == '1'">
  198. <a-menu-item>
  199. <a @click="details(record)">详情</a>
  200. </a-menu-item>
  201. <!-- <a-menu-item>
  202. <a href="javascript:void(0);" @click="itemXls(record,'1')" >成衣模版导出</a>
  203. </a-menu-item> -->
  204. </a-menu>
  205. <!-- 已提交 且 推送失败 -->
  206. <a-menu slot="overlay" v-if="record.pushStatus == '2' && record.status == '1'">
  207. <a-menu-item>
  208. <a @click="details(record)">详情</a>
  209. </a-menu-item>
  210. <a-menu-item>
  211. <a-popconfirm title="确定重新推送吗?" ok-text="是" cancel-text="否" @confirm="push(record)">
  212. <a href="javascript:void(0);" style="color:green;">重新推送</a>
  213. </a-popconfirm>
  214. </a-menu-item>
  215. <!-- <a-menu-item>
  216. <a href="javascript:void(0);" @click="itemXls(record,'1')" >成衣模版导出</a>
  217. </a-menu-item> -->
  218. </a-menu>
  219. <!-- 已提交 -->
  220. <a-menu slot="overlay" v-if="record.status == '1'">
  221. <a-menu-item>
  222. <a @click="details(record)">详情</a>
  223. </a-menu-item>
  224. <!-- <a-menu-item>
  225. <a-popconfirm title="确定取消提交吗?" ok-text="是" cancel-text="否" @confirm="cancelSubmit(record)">
  226. <a href="javascript:void(0);" style="color:red;">取消提交</a>
  227. </a-popconfirm>
  228. </a-menu-item> -->
  229. <!-- <a-menu-item>
  230. <a href="javascript:void(0);" @click="itemXls(record,'1')" >成衣模版导出</a>
  231. </a-menu-item> -->
  232. <a-menu-item>
  233. <a-popconfirm title="确定推送吗?" ok-text="是" cancel-text="否" @confirm="push(record)">
  234. <a href="javascript:void(0);" style="color:green;">推送</a>
  235. </a-popconfirm>
  236. </a-menu-item>
  237. </a-menu>
  238. <!-- 未推送 -->
  239. <a-menu slot="overlay" v-if="record.pushStatus == '0'">
  240. <a-menu-item>
  241. <a @click="details(record)">详情</a>
  242. </a-menu-item>
  243. <a-menu-item>
  244. <a-popconfirm title="确定推送吗?" ok-text="是" cancel-text="否" @confirm="push(record)">
  245. <a href="javascript:void(0);" style="color:green;">推送</a>
  246. </a-popconfirm>
  247. </a-menu-item>
  248. <!-- <a-menu-item>
  249. <a href="javascript:void(0);" @click="itemXls(record,'1')">成衣模版导出</a>
  250. </a-menu-item> -->
  251. </a-menu>
  252. </a-dropdown>
  253. </span>
  254. </a-table>
  255. <span style="position: absolute;bottom: 4%;">共勾选{{selectedNumber}}条数</span>
  256. </a-card>
  257. <!-- 抽屉 -->
  258. <div>
  259. <addAdpacking-drawer
  260. ref="addAdpackingDrawer"
  261. :fatherList="getadPaListClothes"
  262. @ok="modalFormOk"
  263. @hand-submit="submit"
  264. ></addAdpacking-drawer>
  265. <detailsAdpacking-drawer ref="detailsAdpackingDrawer" @ok="modalFormOk"></detailsAdpacking-drawer>
  266. </div>
  267. <!-- 导入确认框 -->
  268. <div>
  269. <a-modal :visible="visible" title="是否继续导入" @ok="handleOk" @cancel="handleCancel">
  270. <template #footer>
  271. <a-button @click="handleCancel" style="margin-left: 8px;">取消</a-button>
  272. <a-button type="primary" @click="handleOk" :disabled="handleOkButton">确定</a-button>
  273. </template>
  274. <ul>
  275. <li v-for="(item,index) in message" :key="index">{{item}}</li>
  276. </ul>
  277. </a-modal>
  278. </div>
  279. </div>
  280. </template>
  281. <script>
  282. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  283. import JEllipsis from '@/components/jeecg/JEllipsis'
  284. import moment from 'moment'
  285. import { downFile } from '@/api/manage'
  286. import addAdpackingDrawer from '@views/advance-packingList/addAdpackingDrawer.vue'
  287. import detailsAdpackingDrawer from '@views/advance-packingList/detailsAdpackingDrawer.vue'
  288. import { getadPaList, itemByMainId, submit, cancelSubmit, deleteAdPaList,batchSubmit,batchPush,push,batchCanelSubmit,exportList,fileDetail,upload} from '@api/document/advance-packingList.js'
  289. export default {
  290. productName: 'AdPaListClothes', // 预装箱单-成衣
  291. mixins: [JeecgListMixin],
  292. components: { JEllipsis, moment, addAdpackingDrawer, detailsAdpackingDrawer },
  293. data() {
  294. let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} />
  295. return {
  296. loading: false, // 表格加载
  297. id: '',
  298. range:[],//预发货日期数组
  299. rangeMode:['date','date'],
  300. timeRange:'',
  301. selectedNumber:0,//已选择条数
  302. handleOkButton:false,
  303. // 表头
  304. adPaListClothesColumns: [
  305. {
  306. title: '订单号',
  307. dataIndex: 'orderNumber',
  308. width: 150,
  309. ellipsis: true,
  310. // fixed: 'left',
  311. className: 'replacecolor'
  312. },
  313. {
  314. title: '款号',
  315. dataIndex: 'itemNumber',
  316. width: 120,
  317. ellipsis: true,
  318. // fixed: 'left',
  319. className: 'replacecolor'
  320. },
  321. {
  322. title: '客户(简称)',
  323. dataIndex: 'customerAbbreviation',
  324. width: 100,
  325. ellipsis: true,
  326. // fixed: 'left',
  327. className: 'replacecolor'
  328. },
  329. {
  330. title: '预发货日期',
  331. dataIndex: 'preDeliveryDate',
  332. width: 120,
  333. ellipsis: true,
  334. customRender: text => {
  335. return moment(text).format('YYYY-MM-DD')
  336. },
  337. className: 'replacecolor'
  338. },
  339. {
  340. title: '小po',
  341. dataIndex: 'smallPo',
  342. width: 90,
  343. ellipsis: true,
  344. className: 'replacecolor'
  345. },
  346. {
  347. title: '分销点',
  348. dataIndex: 'distributionPoint',
  349. width: 110,
  350. ellipsis: true,
  351. className: 'replacecolor'
  352. },
  353. {
  354. title: '存货名称',
  355. dataIndex: 'inventoryName',
  356. width: 220,
  357. ellipsis: true,
  358. className: 'replacecolor'
  359. },
  360. {
  361. title: '颜色',
  362. dataIndex: 'colour',
  363. width: 110,
  364. ellipsis: true,
  365. className: 'replacecolor'
  366. },
  367. {
  368. title: '成衣工厂',
  369. dataIndex: 'garmentFactory',
  370. width: 100,
  371. ellipsis: true,
  372. className: 'replacecolor'
  373. },
  374. // {
  375. // title: '订单类型',
  376. // dataIndex: 'orderType',
  377. // width: 100,
  378. // ellipsis: true,
  379. // className: 'replacecolor'
  380. // },
  381. // {
  382. // title: '工厂单价',
  383. // dataIndex: 'factoryUnitPrice',
  384. // width: 100,
  385. // ellipsis: true,
  386. // className: 'replacecolor'
  387. // },
  388. {
  389. title: '数量',
  390. dataIndex: 'total',
  391. width: 80,
  392. ellipsis: true,
  393. className: 'replacecolor'
  394. },
  395. {
  396. title: '箱数',
  397. dataIndex: 'totalBoxes',
  398. width: 90,
  399. ellipsis: true,
  400. className: 'replacecolor'
  401. },
  402. {
  403. title: '总净重',
  404. dataIndex: 'totalNetWeight',
  405. width: 90,
  406. ellipsis: true,
  407. className: 'replacecolor'
  408. },
  409. {
  410. title: '总毛重',
  411. dataIndex: 'totalGrossWeight',
  412. width: 90,
  413. ellipsis: true,
  414. className: 'replacecolor'
  415. },
  416. {
  417. title: '总体积',
  418. dataIndex: 'totalVolume',
  419. ellipsis: true,
  420. width: 90,
  421. className: 'replacecolor'
  422. },
  423. // {
  424. // title: '总价',
  425. // dataIndex: 'totalPrice',
  426. // width: 100,
  427. // className: 'replacecolor'
  428. // },
  429. // {
  430. // title: '集装箱代号',
  431. // dataIndex: 'containerCode',
  432. // width: 120,
  433. // ellipsis: true,
  434. // className: 'replacecolor'
  435. // },
  436. {
  437. title: '集装箱号',
  438. dataIndex: 'containerNumber',
  439. width: 100,
  440. ellipsis: true,
  441. className: 'replacecolor'
  442. },
  443. {
  444. title: '预托书号',
  445. dataIndex: 'depositaryReceiptNo',
  446. width: 100,
  447. ellipsis: true,
  448. className: 'replacecolor'
  449. },
  450. {
  451. title: '采购/委外订单号',
  452. dataIndex: 'spurOrSubOrder',
  453. width: 200,
  454. ellipsis: true,
  455. className: 'replacecolor'
  456. },
  457. {
  458. title: '单据号',
  459. dataIndex: 'documentNo',
  460. ellipsis: true,
  461. width: 160,
  462. // fixed: 'left',
  463. className: 'replacecolor',
  464. },
  465. {
  466. title: '推送状态',
  467. dataIndex: 'pushStatus',
  468. width: 100,
  469. scopedSlots: { customRender: 'pushStatesSlot' },
  470. fixed: 'right',
  471. className: 'replacecolor'
  472. },
  473. {
  474. title: '单据状态',
  475. dataIndex: 'status',
  476. width: 100,
  477. scopedSlots: { customRender: 'statusSlot' },
  478. fixed: 'right',
  479. className: 'replacecolor'
  480. },
  481. // {
  482. // title: '原因',
  483. // dataIndex: 'memo',
  484. // width: 220,
  485. // fixed: 'right',
  486. // customRender: t => ellipsis(t),
  487. // className: 'replacecolor'
  488. // },
  489. {
  490. title: '操作',
  491. dataIndex: 'operation',
  492. scopedSlots: { customRender: 'operationSlot' },
  493. width: 180,
  494. fixed: 'right',
  495. className: 'replacecolor'
  496. }
  497. ],
  498. adPaListClothesData: [],
  499. visible:false,
  500. message:[],//导入文件信息
  501. file:{},//导入文件
  502. queryParam: {
  503. isReference:'0',
  504. pageSize:50
  505. // pageNo: '',
  506. // orderNumber: '',
  507. // itemNumber: '',
  508. // productName: '' // 品名
  509. },
  510. pagination: {
  511. pageSizeOptions: ["50", "100", "150"],
  512. showSizeChanger: true,
  513. pageSize:50
  514. // total: '',
  515. // current: 0,
  516. // pageSize: 0
  517. },
  518. selectedRowKeys: [], // 勾选航
  519. dateFormat: 'YYYY-MM-DD',
  520. url: {
  521. list: '/sys/user/list',
  522. importExcelUrl: '/spapl/syPreAssembledPackingList/importExcel3' // 导入
  523. },
  524. }
  525. },
  526. created() {
  527. this.getadPaListClothes()
  528. },
  529. watch:{
  530. selectedRowKeys(newVal){
  531. this.selectedNumber =newVal.length
  532. }
  533. },
  534. methods: {
  535. // 分页查询 预装箱单-成衣
  536. getadPaListClothes() {
  537. console.log(this.queryParam)
  538. this.$nextTick(() => {
  539. this.loading = true
  540. getadPaList(this.queryParam).then(res => {
  541. this.loading = false
  542. if (res.success) {
  543. this.adPaListClothesData = [];
  544. if (res.result.records != null){
  545. this.adPaListClothesData = res.result.records;
  546. }
  547. this.selectedRowKeys = []
  548. this.pagination = {
  549. total: res.result.total,
  550. current: res.result.current,
  551. pageSize: res.result.size,
  552. pageSizeOptions: ["50", "100", "150"],
  553. showSizeChanger: true,
  554. }
  555. }else{
  556. this.$message.error(res.message);
  557. }
  558. })
  559. })
  560. },
  561. // 编辑
  562. edit(record) {
  563. itemByMainId({id:record.id}).then(res => {
  564. if (res.success) {
  565. this.$refs.addAdpackingDrawer.visible = true;
  566. this.$refs.addAdpackingDrawer.editDecide = 'edit';
  567. this.$refs.addAdpackingDrawer.addAdpacking = res.result; //接口参数
  568. this.$refs.addAdpackingDrawer.addState = '0';
  569. this.$refs.addAdpackingDrawer.loadSizeTables(res.result.syPreAssembledPackingListItemList[0].sizeTables);
  570. // var totalNetWeight = 0;
  571. // var totalGrossWeight = 0;
  572. // var totalVolume = 0;
  573. // var totalPrice = 0;
  574. // var total = 0;
  575. for (var i=0; i<res.result.syPreAssembledPackingListItemList.length;i++){
  576. var row = res.result.syPreAssembledPackingListItemList[i];
  577. var sizeTables = row.sizeTables;
  578. for (var j=0; j<sizeTables.length;j++){
  579. row['size-'+sizeTables[j].size] = sizeTables[j].proportion;
  580. }
  581. // totalNetWeight += row.totalNetWeight*1;
  582. // totalGrossWeight += row.totalGrossWeight*1;
  583. // totalVolume += row.totalVolume*1;
  584. // totalPrice += row.totalPrice*1;
  585. // total += row.total*1
  586. }
  587. // res.result.totalNetWeight = totalNetWeight;
  588. // res.result.totalGrossWeight = totalGrossWeight;
  589. // res.result.totalVolume = totalVolume;
  590. // res.result.totalPrice = totalPrice;
  591. // res.result.total = total;
  592. }else{
  593. this.$message.error(res.message);
  594. }
  595. });
  596. },
  597. // 详情
  598. details(record) {
  599. itemByMainId({id:record.id}).then(res => {
  600. if (res.success) {
  601. this.$refs.detailsAdpackingDrawer.visible = true;
  602. res.result.syPreAssembledPackingListItemList.map(item=>item.hod = moment(item.hod).format('YYYY-MM-DD'))
  603. this.$refs.detailsAdpackingDrawer.addAdpacking = res.result; //接口参数
  604. this.$refs.detailsAdpackingDrawer.loadSizeTables(res.result.syPreAssembledPackingListItemList[0].sizeTables);
  605. var totalNetWeight = 0;
  606. var totalGrossWeight = 0;
  607. var totalVolume = 0;
  608. var totalPrice = 0;
  609. for (var i=0; i<res.result.syPreAssembledPackingListItemList.length;i++){
  610. var row = res.result.syPreAssembledPackingListItemList[i];
  611. var sizeTables = row.sizeTables;
  612. for (var j=0; j<sizeTables.length;j++){
  613. row['size-'+sizeTables[j].size] = sizeTables[j].proportion;
  614. }
  615. // totalNetWeight += row.totalNetWeight*1;
  616. // totalGrossWeight += row.totalGrossWeight*1;
  617. // totalVolume += row.totalVolume*1;
  618. // totalPrice += row.totalPrice*1;
  619. }
  620. // res.result.totalNetWeight = totalNetWeight;
  621. // res.result.totalGrossWeight = totalGrossWeight;
  622. // res.result.totalVolume = totalVolume;
  623. // res.result.totalPrice = totalPrice;
  624. }else{
  625. this.$message.error(res.message);
  626. }
  627. });
  628. },
  629. // 新增
  630. addAdpacking() {
  631. this.$refs.addAdpackingDrawer.visible = true;
  632. this.$refs.addAdpackingDrawer.addState = '0';
  633. },
  634. // 列表导出
  635. handleExportXls(fileName,sta) {
  636. const data = this.queryParam
  637. data['status'] = sta
  638. downFile('/spapl/syPreAssembledPackingList/exportXls',data).then(data => {
  639. if (!data) {
  640. this.$message.warning('文件下载失败')
  641. return
  642. }
  643. if (typeof window.navigator.msSaveBlob !== 'undefined') {
  644. window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xlsx')
  645. } else {
  646. let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
  647. let link = document.createElement('a')
  648. link.style.display = 'none'
  649. link.href = url
  650. link.setAttribute('download', fileName + '.xlsx')
  651. document.body.appendChild(link)
  652. link.click()
  653. document.body.removeChild(link) // 下载完成移除元素
  654. window.URL.revokeObjectURL(url) // 释放掉blob对象
  655. }
  656. })
  657. },
  658. // 列表导出
  659. handleExportXls1(fileName,sta) {
  660. const data = this.queryParam
  661. downFile('/spapl/syPreAssembledPackingList/exportXls2',data).then(data => {
  662. if (!data) {
  663. this.$message.warning('文件下载失败')
  664. return
  665. }
  666. if (typeof window.navigator.msSaveBlob !== 'undefined') {
  667. window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xlsx')
  668. } else {
  669. let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
  670. let link = document.createElement('a')
  671. link.style.display = 'none'
  672. link.href = url
  673. link.setAttribute('download', fileName + '.xlsx')
  674. document.body.appendChild(link)
  675. link.click()
  676. document.body.removeChild(link) // 下载完成移除元素
  677. window.URL.revokeObjectURL(url) // 释放掉blob对象
  678. }
  679. })
  680. },
  681. handleExportXls2(fileName) {
  682. const data = this.queryParam
  683. downFile('/spapl/syPreAssembledPackingList/exportXls3',data).then(data => {
  684. if (!data) {
  685. this.$message.warning('文件下载失败')
  686. return
  687. }
  688. if (typeof window.navigator.msSaveBlob !== 'undefined') {
  689. window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xlsx')
  690. } else {
  691. let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
  692. let link = document.createElement('a')
  693. link.style.display = 'none'
  694. link.href = url
  695. link.setAttribute('download', fileName + '.xlsx')
  696. document.body.appendChild(link)
  697. link.click()
  698. document.body.removeChild(link) // 下载完成移除元素
  699. window.URL.revokeObjectURL(url) // 释放掉blob对象
  700. }
  701. })
  702. },
  703. // 导入信息
  704. uploadFlie(file) {
  705. const formData = new FormData()
  706. formData.append('file',file.file)
  707. fileDetail(formData).then(res => {
  708. if (res.success) {
  709. this.visible = true
  710. this.message = res.message.split(';').filter((element) => {
  711. return element !== "";
  712. });
  713. this.file = file
  714. }else{
  715. this.loading = false
  716. this.$message.error(res.message);
  717. }
  718. })},
  719. //继续导入
  720. handleOk(){
  721. this.handleOkButton = true
  722. const formData = new FormData()
  723. formData.append('file', this.file.file)
  724. upload(formData).then(res => {
  725. this.visible = false
  726. if (res.success) {
  727. this.getadPaListClothes()
  728. this.$message.success('导入成功')
  729. this.handleOkButton = false
  730. }else{
  731. this.loading = false
  732. this.$message.error(res.message);
  733. this.handleOkButton = false
  734. }
  735. })
  736. },
  737. //取消导入
  738. handleCancel(){
  739. this.visible = false
  740. this.loading = false
  741. },
  742. // 删除
  743. handleDelete(record) {
  744. console.log('点击删除项id:', record.id)
  745. this.$nextTick(() => {
  746. if(this.queryParam.pageNo > 1 && this.adPaListClothesData.length === 1){
  747. this.queryParam.pageNo = this.queryParam.pageNo -1
  748. }
  749. deleteAdPaList({ id: record.id }).then(res => {
  750. if (res.success) {
  751. console.log('res:', res)
  752. this.getadPaListClothes()
  753. this.$message.success('删除成功')
  754. } else {
  755. this.$message.error('删除成功')
  756. }
  757. })
  758. })
  759. },
  760. searchQuery() {
  761. this.toggleSearchStatus = false
  762. this.queryParam.pageNo = ''
  763. this.getadPaListClothes()
  764. },
  765. searchReset() {
  766. this.range = []
  767. var dd = this.queryParam
  768. this.queryParam = {
  769. isReference:'0',
  770. pageSize:this.queryParam.pageSize
  771. }
  772. this.getadPaListClothes()
  773. },
  774. // 操作 单条数据导出
  775. itemXls(record,sta) {
  776. var data = sta
  777. downFile('/spapl/syPreAssembledPackingList/exportXls',{id:record.id,status:data}).then(data => {
  778. if (!data) {
  779. this.$message.warning('文件下载失败')
  780. return
  781. }
  782. if (typeof window.navigator.msSaveBlob !== 'undefined') {
  783. window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), item + '.xlsx')
  784. }else {
  785. let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
  786. let link = document.createElement('a')
  787. link.style.display = 'none'
  788. link.href = url
  789. link.setAttribute('download', '预装箱单' + '.xlsx')
  790. document.body.appendChild(link)
  791. link.click()
  792. document.body.removeChild(link) // 下载完成移除元素
  793. window.URL.revokeObjectURL(url) // 释放掉blob对象
  794. }
  795. })
  796. },
  797. // 提交
  798. submit(record) {
  799. var that = this;
  800. this.$nextTick(() => {
  801. submit({ id: record.id }).then(res => {
  802. if (res.success) {
  803. this.adPaListClothesData.map(item =>{
  804. if(item.id == record.id){
  805. item.status = 1
  806. }
  807. })
  808. this.$forceUpdate()
  809. that.$message.success('提交成功');
  810. }else{
  811. that.$message.error(res.message);
  812. }
  813. })
  814. })
  815. },
  816. // // 取消提交
  817. // cancelSubmit(record){
  818. // var that = this;
  819. // this.$nextTick(() => {
  820. // if(record.isReference == 2){
  821. // that.$message.error('不可取消提交!');
  822. // }else {
  823. // cancelSubmit({ id: record.id }).then(res => {
  824. // if (res.success) {
  825. // record.status=0;
  826. // that.$message.success('取消提交成功');
  827. // }else{
  828. // that.$message.error(res.message);
  829. // }
  830. // })
  831. // }
  832. // })
  833. // },
  834. //批量提交
  835. batchSubmit(){
  836. this.$nextTick(() => {
  837. for(var i =0;i<this.selectedRows.length;i++){
  838. var tickRow = this.selectedRows[i]
  839. if(tickRow.status === '1'){
  840. var clo = i+1
  841. this.$message.error("部分数据是已提交,请勿重复提交!");
  842. return
  843. }
  844. }
  845. var ids = this.selectedRowKeys.toString()
  846. batchSubmit({ id: ids }).then(res => {
  847. if (res.success) {
  848. this.getadPaListClothes()
  849. this.$message.success('批量提交成功');
  850. this.selectedRowKeys = []
  851. }else {
  852. this.$message.error(res.message);
  853. }
  854. })
  855. })
  856. },
  857. //批量取消提交
  858. batchCanelSubmit(){
  859. this.$nextTick(() => {
  860. for(var i =0;i<this.selectedRows.length;i++){
  861. var tickRow = this.selectedRows[i]
  862. if(tickRow.status === '0'){
  863. this.$message.error("含有未提交数据,请重新选择!");
  864. return
  865. }
  866. }
  867. var ids = this.selectedRowKeys.toString()
  868. batchCanelSubmit({ ids:ids }).then(res => {
  869. if (res.success) {
  870. this.getadPaListClothes()
  871. this.selectedRowKeys = []
  872. this.$message.success('批量取消提交成功');
  873. }else if(res.code == 111){
  874. for(var i=0;i<this.selectedRows.length;i++){
  875. if(res.result.indexOf(this.selectedRows[i].id) !== -1){
  876. this.$message.error(res.message+'(所选第'+(i+1) +'行数据)');
  877. return
  878. }
  879. }
  880. }else {
  881. this.$message.error(res.message);
  882. }
  883. })
  884. })
  885. },
  886. //批量推送
  887. batchPush(){
  888. this.$nextTick(() => {
  889. for(var i =0;i<this.selectedRows.length;i++){
  890. var tickRow = this.selectedRows[i]
  891. var clo = i+1
  892. if(tickRow.status == '0'){
  893. this.$message.error("勾选的第"+clo+"行数据未提交,不能推送!");
  894. return
  895. }
  896. if(tickRow.status === '1' && tickRow.pushStatus === '1'){
  897. this.$message.error("勾选的第"+clo+"行数据是已推送!");
  898. return
  899. }
  900. }
  901. var ids = this.selectedRowKeys.toString()
  902. batchPush({ id: ids }).then(res => {
  903. if (res.success) {
  904. this.selectedRows.map(item=>{
  905. item.pushStatus = 1
  906. })
  907. this.$message.success('批量推送成功');
  908. }else {
  909. this.$message.error(res.message);
  910. this.selectedRows.map(item=>{
  911. item.pushStatus = 2
  912. })
  913. this.$message.error(res.message);
  914. }
  915. })
  916. this.selectedRowKeys = []
  917. })
  918. },
  919. //推送
  920. push(record){
  921. this.$nextTick(() => {
  922. push({ id: record.id }).then(res => {
  923. if (res.success) {
  924. record.pushStatus=1;
  925. this.$message.success('推送成功');
  926. }else{
  927. record.pushStatus = 2
  928. this.$message.error(res.message);
  929. }
  930. })
  931. })
  932. },
  933. // 选中行
  934. onSelectChange(keys, rows) {
  935. this.selectedRowKeys = keys
  936. this.selectedRows = rows
  937. },
  938. handleTableChange(pagination, filters, sorter) {
  939. // console.log('当前页信息>>>>',pagination)
  940. this.queryParam.pageNo = pagination.current
  941. this.queryParam.pageSize =pagination.pageSize
  942. this.getadPaListClothes()
  943. },
  944. aa() {},
  945. onDateChange(value, dateString) {
  946. this.queryParam.startTime = dateString[0]
  947. this.queryParam.endTime = dateString[1]
  948. },
  949. rangeSelectChange(value) {
  950. this.range = value
  951. if (value.length == 0){
  952. this.queryParam.stratDate = "";
  953. this.queryParam.endDate = "";
  954. }else{
  955. this.queryParam.stratDate = value[0].format('YYYY-MM-DD');
  956. this.queryParam.endDate = value[1].format('YYYY-MM-DD');
  957. }
  958. },
  959. createTimeChange(){
  960. this.queryParam.createTime = this.queryParam.createTime.format('YYYY-MM-DD')
  961. }
  962. },
  963. computed: {
  964. // 导入
  965. importExcelUrl() {
  966. return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
  967. // this.
  968. },
  969. // 选中项
  970. rowSelection() {
  971. return {
  972. onChange: (selectedRowKeys, selectedRows) => {
  973. console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows)
  974. },
  975. getCheckboxProps: record => ({
  976. props: {
  977. disabled: record.title === 'Disabled User',
  978. // Column configuration not to be checked
  979. title: record.title
  980. }
  981. })
  982. }
  983. }
  984. }
  985. }
  986. </script>
  987. <style lang="less" scoped>
  988. @import '~@assets/less/common.less';
  989. @import '~@assets/less/overwriter.less';
  990. /deep/ .ant-table-thead > tr > th {
  991. text-align: center;
  992. // font-weight: 700;
  993. }
  994. /deep/ .ant-table-tbody {
  995. text-align: center;
  996. }
  997. // /deep/ th.replacecolor {
  998. // background-color: #ccc;
  999. // }
  1000. /deep/ .ant-table-tbody .ant-table-row td{
  1001. padding-top: 8px;
  1002. padding-bottom: 8px;
  1003. }
  1004. /deep/.ant-card-body{
  1005. padding-top: 10px !important;
  1006. padding-bottom: 0px !important;
  1007. }
  1008. /deep/.table-operator .ant-btn{
  1009. margin: 0 8px 3px 0;
  1010. }
  1011. /deep/.table-page-search-wrapper .ant-form-inline .ant-form-item{
  1012. margin-bottom: 10px;
  1013. }
  1014. /deep/.table-page-search-wrapper .table-page-search-submitButtons{
  1015. margin-bottom: 10px;
  1016. }
  1017. /deep/ .ant-table-fixed-left table,.ant-table-fixed-right table{
  1018. width: min-content;
  1019. }
  1020. /deep/ thead.ant-table-thead>tr{
  1021. height: 0 !important;
  1022. }
  1023. /deep/ .ant-table-thead > tr > th, .ant-table-tbody > tr > td{
  1024. padding: 9px 16px
  1025. }
  1026. </style>