adPaList-clothes.vue 27 KB

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