adPaList-clothes.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893
  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">
  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. </div>
  224. </template>
  225. <script>
  226. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  227. import JEllipsis from '@/components/jeecg/JEllipsis'
  228. import moment from 'moment'
  229. import { downFile } from '@/api/manage'
  230. import addAdpackingDrawer from '@views/advance-packingList/addAdpackingDrawer.vue'
  231. import detailsAdpackingDrawer from '@views/advance-packingList/detailsAdpackingDrawer.vue'
  232. import { getadPaList, itemByMainId, submit, cancelSubmit, deleteAdPaList,batchSubmit,batchPush,push,batchCanelSubmit,exportList} from '@api/document/advance-packingList.js'
  233. export default {
  234. productName: 'AdPaListClothes', // 预装箱单-成衣
  235. mixins: [JeecgListMixin],
  236. components: { JEllipsis, moment, addAdpackingDrawer, detailsAdpackingDrawer },
  237. data() {
  238. let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} />
  239. return {
  240. loading: false, // 表格加载
  241. id: '',
  242. range:[],//预发货日期数组
  243. rangeMode:['date','date'],
  244. timeRange:'',
  245. // 表头
  246. adPaListClothesColumns: [
  247. {
  248. title: '单据号',
  249. dataIndex: 'documentNo',
  250. ellipsis: true,
  251. width: 120,
  252. // fixed: 'left',
  253. className: 'replacecolor'
  254. },
  255. {
  256. title: '订单号',
  257. dataIndex: 'orderNumber',
  258. width: 120,
  259. ellipsis: true,
  260. // fixed: 'left',
  261. className: 'replacecolor'
  262. },
  263. {
  264. title: '款号',
  265. dataIndex: 'itemNumber',
  266. width: 120,
  267. ellipsis: true,
  268. // fixed: 'left',
  269. className: 'replacecolor'
  270. },
  271. {
  272. title: '客户(简称)',
  273. dataIndex: 'customerAbbreviation',
  274. width: 100,
  275. ellipsis: true,
  276. // fixed: 'left',
  277. className: 'replacecolor'
  278. },
  279. {
  280. title: '预发货日期',
  281. dataIndex: 'preDeliveryDate',
  282. width: 120,
  283. ellipsis: true,
  284. customRender: text => {
  285. return moment(text).format('YYYY-MM-DD')
  286. },
  287. className: 'replacecolor'
  288. },
  289. {
  290. title: '小po',
  291. dataIndex: 'smallPo',
  292. width: 100,
  293. ellipsis: true,
  294. className: 'replacecolor'
  295. },
  296. {
  297. title: '分销点',
  298. dataIndex: 'distributionPoint',
  299. width: 120,
  300. ellipsis: true,
  301. className: 'replacecolor'
  302. },
  303. {
  304. title: '存货名称',
  305. dataIndex: 'inventoryName',
  306. width: 120,
  307. ellipsis: true,
  308. className: 'replacecolor'
  309. },
  310. {
  311. title: '颜色',
  312. dataIndex: 'colour',
  313. width: 180,
  314. ellipsis: true,
  315. className: 'replacecolor'
  316. },
  317. {
  318. title: '采购/委外订单号',
  319. dataIndex: 'spurOrSubOrder',
  320. width: 220,
  321. ellipsis: true,
  322. className: 'replacecolor'
  323. },
  324. // {
  325. // title: '订单类型',
  326. // dataIndex: 'orderType',
  327. // width: 100,
  328. // ellipsis: true,
  329. // className: 'replacecolor'
  330. // },
  331. // {
  332. // title: '工厂单价',
  333. // dataIndex: 'factoryUnitPrice',
  334. // width: 100,
  335. // ellipsis: true,
  336. // className: 'replacecolor'
  337. // },
  338. {
  339. title: '数量(按合并规则累计)',
  340. dataIndex: 'total',
  341. width: 200,
  342. ellipsis: true,
  343. className: 'replacecolor'
  344. },
  345. {
  346. title: '箱数',
  347. dataIndex: 'totalBoxes',
  348. width: 100,
  349. ellipsis: true,
  350. className: 'replacecolor'
  351. },
  352. {
  353. title: '总净重',
  354. dataIndex: 'totalNetWeight',
  355. width: 100,
  356. ellipsis: true,
  357. className: 'replacecolor'
  358. },
  359. {
  360. title: '总毛重',
  361. dataIndex: 'totalGrossWeight',
  362. width: 100,
  363. ellipsis: true,
  364. className: 'replacecolor'
  365. },
  366. {
  367. title: '总体积',
  368. dataIndex: 'totalVolume',
  369. ellipsis: true,
  370. width: 100,
  371. className: 'replacecolor'
  372. },
  373. // {
  374. // title: '总价',
  375. // dataIndex: 'totalPrice',
  376. // width: 100,
  377. // className: 'replacecolor'
  378. // },
  379. {
  380. title: '集装箱代号',
  381. dataIndex: 'containerCode',
  382. width: 120,
  383. ellipsis: true,
  384. className: 'replacecolor'
  385. },
  386. {
  387. title: '集装箱号',
  388. dataIndex: 'containerNumber',
  389. width: 120,
  390. ellipsis: true,
  391. className: 'replacecolor'
  392. },
  393. {
  394. title: '预托书号',
  395. dataIndex: 'depositaryReceiptNo',
  396. width: 100,
  397. ellipsis: true,
  398. className: 'replacecolor'
  399. },
  400. {
  401. title: '成衣工厂',
  402. dataIndex: 'garmentFactory',
  403. width: 160,
  404. ellipsis: true,
  405. className: 'replacecolor'
  406. },
  407. {
  408. title: '推送状态',
  409. dataIndex: 'pushStatus',
  410. width: 80,
  411. scopedSlots: { customRender: 'pushStatesSlot' },
  412. fixed: 'right',
  413. className: 'replacecolor'
  414. },
  415. {
  416. title: '单据状态',
  417. dataIndex: 'status',
  418. width: 80,
  419. scopedSlots: { customRender: 'statusSlot' },
  420. fixed: 'right',
  421. className: 'replacecolor'
  422. },
  423. // {
  424. // title: '原因',
  425. // dataIndex: 'memo',
  426. // width: 220,
  427. // fixed: 'right',
  428. // customRender: t => ellipsis(t),
  429. // className: 'replacecolor'
  430. // },
  431. {
  432. title: '操作',
  433. dataIndex: 'operation',
  434. scopedSlots: { customRender: 'operationSlot' },
  435. width: 180,
  436. fixed: 'right',
  437. className: 'replacecolor'
  438. }
  439. ],
  440. adPaListClothesData: [],
  441. queryParam: {
  442. pageSize:20
  443. // pageNo: '',
  444. // orderNumber: '',
  445. // itemNumber: '',
  446. // productName: '' // 品名
  447. },
  448. pagination: {
  449. // total: '',
  450. // current: 0,
  451. // pageSize: 0
  452. },
  453. selectedRowKeys: [], // 勾选航
  454. dateFormat: 'YYYY-MM-DD',
  455. url: {
  456. list: '/sys/user/list',
  457. importExcelUrl: '/spapl/syPreAssembledPackingList/importExcel3' // 导入
  458. },
  459. }
  460. },
  461. created() {
  462. this.getadPaListClothes()
  463. },
  464. methods: {
  465. // 分页查询 预装箱单-成衣
  466. getadPaListClothes() {
  467. console.log(this.queryParam)
  468. this.$nextTick(() => {
  469. getadPaList(this.queryParam).then(res => {
  470. if (res.success) {
  471. this.adPaListClothesData = [];
  472. if (res.result.records != null){
  473. this.adPaListClothesData = res.result.records;
  474. }
  475. this.pagination = {
  476. total: res.result.total,
  477. current: res.result.current,
  478. pageSize: res.result.size
  479. }
  480. }
  481. })
  482. })
  483. },
  484. // 编辑
  485. edit(record) {
  486. itemByMainId({id:record.id}).then(res => {
  487. if (res.success) {
  488. this.$refs.addAdpackingDrawer.visible = true;
  489. this.$refs.addAdpackingDrawer.editDecide = 'edit';
  490. this.$refs.addAdpackingDrawer.addAdpacking = res.result; //接口参数
  491. this.$refs.addAdpackingDrawer.addState = '0';
  492. this.$refs.addAdpackingDrawer.loadSizeTables(res.result.syPreAssembledPackingListItemList[0].sizeTables);
  493. // var totalNetWeight = 0;
  494. // var totalGrossWeight = 0;
  495. // var totalVolume = 0;
  496. // var totalPrice = 0;
  497. // var total = 0;
  498. for (var i=0; i<res.result.syPreAssembledPackingListItemList.length;i++){
  499. var row = res.result.syPreAssembledPackingListItemList[i];
  500. var sizeTables = row.sizeTables;
  501. for (var j=0; j<sizeTables.length;j++){
  502. row['size-'+sizeTables[j].size] = sizeTables[j].proportion;
  503. }
  504. // totalNetWeight += row.totalNetWeight*1;
  505. // totalGrossWeight += row.totalGrossWeight*1;
  506. // totalVolume += row.totalVolume*1;
  507. // totalPrice += row.totalPrice*1;
  508. // total += row.total*1
  509. }
  510. // res.result.totalNetWeight = totalNetWeight;
  511. // res.result.totalGrossWeight = totalGrossWeight;
  512. // res.result.totalVolume = totalVolume;
  513. // res.result.totalPrice = totalPrice;
  514. // res.result.total = total;
  515. }else{
  516. this.$message.error(res.message);
  517. }
  518. });
  519. },
  520. // 详情
  521. details(record) {
  522. itemByMainId({id:record.id}).then(res => {
  523. if (res.success) {
  524. this.$refs.detailsAdpackingDrawer.visible = true;
  525. this.$refs.detailsAdpackingDrawer.addAdpacking = res.result; //接口参数
  526. this.$refs.detailsAdpackingDrawer.loadSizeTables(res.result.syPreAssembledPackingListItemList[0].sizeTables);
  527. var totalNetWeight = 0;
  528. var totalGrossWeight = 0;
  529. var totalVolume = 0;
  530. var totalPrice = 0;
  531. for (var i=0; i<res.result.syPreAssembledPackingListItemList.length;i++){
  532. var row = res.result.syPreAssembledPackingListItemList[i];
  533. var sizeTables = row.sizeTables;
  534. for (var j=0; j<sizeTables.length;j++){
  535. row['size-'+sizeTables[j].size] = sizeTables[j].proportion;
  536. }
  537. totalNetWeight += row.totalNetWeight*1;
  538. totalGrossWeight += row.totalGrossWeight*1;
  539. totalVolume += row.totalVolume*1;
  540. totalPrice += row.totalPrice*1;
  541. }
  542. res.result.totalNetWeight = totalNetWeight;
  543. res.result.totalGrossWeight = totalGrossWeight;
  544. res.result.totalVolume = totalVolume;
  545. res.result.totalPrice = totalPrice;
  546. }else{
  547. this.$message.error(res.message);
  548. }
  549. });
  550. },
  551. // 新增
  552. addAdpacking() {
  553. this.$refs.addAdpackingDrawer.visible = true;
  554. this.$refs.addAdpackingDrawer.addState = '0';
  555. },
  556. // 列表导出
  557. handleExportXls(fileName,sta) {
  558. var data = sta
  559. downFile('/spapl/syPreAssembledPackingList/exportXls',{status:data}).then(data => {
  560. if (!data) {
  561. this.$message.warning('文件下载失败')
  562. return
  563. }
  564. if (typeof window.navigator.msSaveBlob !== 'undefined') {
  565. window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xls')
  566. } else {
  567. let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
  568. let link = document.createElement('a')
  569. link.style.display = 'none'
  570. link.href = url
  571. link.setAttribute('download', fileName + '.xls')
  572. document.body.appendChild(link)
  573. link.click()
  574. document.body.removeChild(link) // 下载完成移除元素
  575. window.URL.revokeObjectURL(url) // 释放掉blob对象
  576. }
  577. })
  578. },
  579. // 删除
  580. handleDelete(record) {
  581. console.log('点击删除项id:', record.id)
  582. this.$nextTick(() => {
  583. if(this.queryParam.pageNo > 1 && this.adPaListClothesData.length === 1){
  584. this.queryParam.pageNo = this.queryParam.pageNo -1
  585. }
  586. deleteAdPaList({ id: record.id }).then(res => {
  587. if (res.success) {
  588. console.log('res:', res)
  589. this.getadPaListClothes()
  590. this.$message.success('删除成功')
  591. } else {
  592. this.$message.error('删除成功')
  593. }
  594. })
  595. })
  596. },
  597. searchQuery() {
  598. this.toggleSearchStatus = false
  599. this.queryParam.pageNo = ''
  600. this.queryParam.pageSize = 20
  601. this.getadPaListClothes()
  602. },
  603. searchReset() {
  604. this.range = []
  605. this.queryParam = {
  606. pageSize:20
  607. }
  608. this.getadPaListClothes()
  609. },
  610. // 操作 单条数据导出
  611. itemXls(record,sta) {
  612. var data = sta
  613. downFile('/spapl/syPreAssembledPackingList/exportXls',{id:record.id,status:data}).then(data => {
  614. if (!data) {
  615. this.$message.warning('文件下载失败')
  616. return
  617. }
  618. if (typeof window.navigator.msSaveBlob !== 'undefined') {
  619. window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), item + '.xlsx')
  620. }else {
  621. let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
  622. let link = document.createElement('a')
  623. link.style.display = 'none'
  624. link.href = url
  625. link.setAttribute('download', '预装箱单' + '.xlsx')
  626. document.body.appendChild(link)
  627. link.click()
  628. document.body.removeChild(link) // 下载完成移除元素
  629. window.URL.revokeObjectURL(url) // 释放掉blob对象
  630. }
  631. })
  632. },
  633. // 提交
  634. submit(record) {
  635. var that = this;
  636. this.$nextTick(() => {
  637. submit({ id: record.id }).then(res => {
  638. if (res.success) {
  639. this.adPaListClothesData.map(item =>{
  640. if(item.id == record.id){
  641. item.status = 1
  642. }
  643. })
  644. this.$forceUpdate()
  645. that.$message.success('提交成功');
  646. }else{
  647. that.$message.error(res.message);
  648. }
  649. })
  650. })
  651. },
  652. // // 取消提交
  653. // cancelSubmit(record){
  654. // var that = this;
  655. // this.$nextTick(() => {
  656. // if(record.isReference == 2){
  657. // that.$message.error('不可取消提交!');
  658. // }else {
  659. // cancelSubmit({ id: record.id }).then(res => {
  660. // if (res.success) {
  661. // record.status=0;
  662. // that.$message.success('取消提交成功');
  663. // }else{
  664. // that.$message.error(res.message);
  665. // }
  666. // })
  667. // }
  668. // })
  669. // },
  670. //批量提交
  671. batchSubmit(){
  672. this.$nextTick(() => {
  673. for(var i =0;i<this.selectedRows.length;i++){
  674. var tickRow = this.selectedRows[i]
  675. if(tickRow.status === '1'){
  676. var clo = i+1
  677. this.$message.error("部分数据是已提交,请勿重复提交!");
  678. return
  679. }
  680. }
  681. var ids = this.selectedRowKeys.toString()
  682. batchSubmit({ id: ids }).then(res => {
  683. if (res.success) {
  684. this.getadPaListClothes()
  685. this.$message.success('批量提交成功');
  686. this.selectedRowKeys = []
  687. }else {
  688. this.$message.error(res.message);
  689. }
  690. })
  691. })
  692. },
  693. //批量取消提交
  694. batchCanelSubmit(){
  695. this.$nextTick(() => {
  696. for(var i =0;i<this.selectedRows.length;i++){
  697. var tickRow = this.selectedRows[i]
  698. if(tickRow.status === '0'){
  699. this.$message.error("含有未提交数据,请重新选择!");
  700. return
  701. }
  702. }
  703. var ids = this.selectedRowKeys.toString()
  704. batchCanelSubmit({ ids:ids }).then(res => {
  705. if (res.success) {
  706. this.getadPaListClothes()
  707. this.selectedRowKeys = []
  708. this.$message.success('批量取消提交成功');
  709. }else if(res.code == 111){
  710. for(var i=0;i<this.selectedRows.length;i++){
  711. if(res.result.indexOf(this.selectedRows[i].id) !== -1){
  712. this.$message.error(res.message+'(所选第'+(i+1) +'行数据)');
  713. return
  714. }
  715. }
  716. }else {
  717. this.$message.error(res.message);
  718. }
  719. })
  720. })
  721. },
  722. //批量推送
  723. batchPush(){
  724. this.$nextTick(() => {
  725. for(var i =0;i<this.selectedRows.length;i++){
  726. var tickRow = this.selectedRows[i]
  727. var clo = i+1
  728. if(tickRow.status == '0'){
  729. this.$message.error("勾选的第"+clo+"行数据未提交,不能推送!");
  730. return
  731. }
  732. if(tickRow.status === '1' && tickRow.pushStatus === '1'){
  733. this.$message.error("勾选的第"+clo+"行数据是已推送!");
  734. return
  735. }
  736. }
  737. var ids = this.selectedRowKeys.toString()
  738. batchPush({ id: ids }).then(res => {
  739. if (res.success) {
  740. this.selectedRows.map(item=>{
  741. item.pushStatus = 1
  742. })
  743. this.$message.success('批量推送成功');
  744. }else {
  745. this.$message.error(res.message);
  746. this.selectedRows.map(item=>{
  747. item.pushStatus = 2
  748. })
  749. this.$message.error(res.message);
  750. }
  751. })
  752. this.selectedRowKeys = []
  753. })
  754. },
  755. //推送
  756. push(record){
  757. this.$nextTick(() => {
  758. push({ id: record.id }).then(res => {
  759. if (res.success) {
  760. record.pushStatus=1;
  761. this.$message.success('推送成功');
  762. }else{
  763. record.pushStatus = 2
  764. this.$message.error(res.message);
  765. }
  766. })
  767. })
  768. },
  769. // 选中行
  770. onSelectChange(keys, rows) {
  771. this.selectedRowKeys = keys
  772. this.selectedRows = rows
  773. },
  774. handleTableChange(pagination, filters, sorter) {
  775. // console.log('当前页信息>>>>',pagination)
  776. this.queryParam.pageNo = pagination.current
  777. this.getadPaListClothes()
  778. },
  779. aa() {},
  780. onDateChange(value, dateString) {
  781. this.queryParam.startTime = dateString[0]
  782. this.queryParam.endTime = dateString[1]
  783. },
  784. rangeSelectChange(value) {
  785. this.range = value
  786. if (value.length == 0){
  787. this.queryParam.stratDate = "";
  788. this.queryParam.endDate = "";
  789. }else{
  790. this.queryParam.stratDate = value[0].format('YYYY-MM-DD');
  791. this.queryParam.endDate = value[1].format('YYYY-MM-DD');
  792. }
  793. }
  794. },
  795. computed: {
  796. // 导入
  797. importExcelUrl() {
  798. return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
  799. // this.
  800. },
  801. // 选中项
  802. rowSelection() {
  803. return {
  804. onChange: (selectedRowKeys, selectedRows) => {
  805. console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows)
  806. },
  807. getCheckboxProps: record => ({
  808. props: {
  809. disabled: record.title === 'Disabled User',
  810. // Column configuration not to be checked
  811. title: record.title
  812. }
  813. })
  814. }
  815. }
  816. }
  817. }
  818. </script>
  819. <style lang="less" scoped>
  820. @import '~@assets/less/common.less';
  821. @import '~@assets/less/overwriter.less';
  822. /deep/ .ant-table-thead > tr > th {
  823. text-align: center;
  824. // font-weight: 700;
  825. }
  826. /deep/ .ant-table-tbody {
  827. text-align: center;
  828. }
  829. // /deep/ th.replacecolor {
  830. // background-color: #ccc;
  831. // }
  832. </style>