adPaList-clothes.vue 25 KB

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