adPaList-clothes.vue 31 KB

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