adPaList-clothes.vue 25 KB

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