fabric-list.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  1. <template>
  2. <!-- 装箱单-面料列表 -->
  3. <div id="fabricList">
  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.containerNumber"></a-input>
  22. </a-form-item>
  23. </a-col>
  24. <a-col :md="6" :sm="8">
  25. <a-form-item label="外销发票号">
  26. <a-input placeholder="请输入外销发票号" v-model="queryParam.exportInvoiceNo"></a-input>
  27. </a-form-item>
  28. </a-col>
  29. <a-col :md="6" :sm="8">
  30. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  31. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  32. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  33. <a @click="handleToggleSearch" style="margin-left: 8px">
  34. {{ toggleSearchStatus ? '收起' : '展开' }}
  35. <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
  36. </a>
  37. </span>
  38. </a-col>
  39. </a-row>
  40. </a-form>
  41. </div>
  42. </a-card>
  43. <!-- 操作按钮区域 推送 新增-->
  44. <a-card :bordered="false" style="marginTop:10px;">
  45. <div class="table-operator">
  46. <a-button type="primary" @click="addFabric" icon="plus">新增</a-button>
  47. <a-button type="primary" @click="bitchSubmitList" icon="check">批量提交</a-button>
  48. <a-button type="primary" @click="bitchCancelSubmitList" icon="close">批量取消提交</a-button>
  49. <a-button type="primary" @click="push" icon="export">推送</a-button>
  50. </div>
  51. <!-- 子表 :scroll="{ x: 1500 }" 内容少 无需滚动-->
  52. <a-table
  53. bordered
  54. :columns="fabricListColumns"
  55. :data-source="fabricListData"
  56. :loading="loading"
  57. :scroll="{ x: 1500 , y: 500 }"
  58. :pagination="pagination"
  59. :row-key="record => record.id"
  60. :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
  61. @change="handleTableChange"
  62. >
  63. <!-- 集装箱号 输入框
  64. <a-form-model
  65. slot="containerNo"
  66. slot-scope="text, record"
  67. :ref="record.index"
  68. :model="record"
  69. style="width:100%;height:40px"
  70. >
  71. <a-form-model-item prop="containerNo">
  72. <a-input style="width:100%" v-model="record.containerNumber" />
  73. </a-form-model-item>
  74. </a-form-model> -->
  75. <!-- 单据状态 -->
  76. <span slot="state" slot-scope="text, record">
  77. <a-tag color="orange" v-if="record.status == '0'">已保存</a-tag>
  78. <a-tag color="green" v-if="record.status == '1'">已提交</a-tag>
  79. </span>
  80. <!-- 操作 -->
  81. <span slot="operationSlot" slot-scope="text, record">
  82. <a @click="accessoryUpload(record)" style="color:green;">附件上传</a>
  83. <a-divider type="vertical" />
  84. <a-dropdown>
  85. <a class="ant-dropdown-link">更多<a-icon type="down"/></a>
  86. <a-menu slot="overlay" v-if="record.status=='0'">
  87. <a-menu-item><a @click="details(record)">详情</a></a-menu-item>
  88. <a-menu-item><a @click="edit(record)">编辑</a></a-menu-item>
  89. <!-- <a-menu-item><a @click="submit(record)">提交</a></a-menu-item> -->
  90. <a-menu-item>
  91. <a-popconfirm title="确定删除吗?" ok-text="是" cancel-text="否" @confirm="handleDelete(record.id)">
  92. <a href="javascript:void(0);" style="color:red;">删除</a>
  93. </a-popconfirm>
  94. </a-menu-item>
  95. </a-menu>
  96. <!-- 已提交 -->
  97. <a-menu slot="overlay" v-if="record.status=='1'">
  98. <a-menu-item><a @click="details(record)">详情</a></a-menu-item>
  99. <!-- <a-menu-item><a @click="cancel(record)">取消提交</a></a-menu-item> -->
  100. </a-menu>
  101. </a-dropdown>
  102. </span>
  103. </a-table>
  104. </a-card>
  105. <!-- 抽屉 -->
  106. <div>
  107. <addFabric-drawer ref="addFabricDrawer" :father="aa" @ok="modalFormOk" :fatherList="getFabricList"></addFabric-drawer>
  108. <detailsFabric-drawer ref="detailsFabricDrawer" :father="bb" @ok="modalFormOk"></detailsFabric-drawer>
  109. <editFabric-drawer ref="editFabricDrawer" :father="cc" @ok="modalFormOk"></editFabric-drawer>
  110. </div>
  111. </div>
  112. </template>
  113. <script>
  114. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  115. import JEllipsis from '@/components/jeecg/JEllipsis'
  116. import moment from 'moment'
  117. import addFabricDrawer from '@views/packing-list/packinglist-fabrics/addFabricDrawer.vue'
  118. import detailsFabricDrawer from '@views/packing-list/packinglist-fabrics/detailsFabricDrawer.vue'
  119. import editFabricDrawer from '@views/packing-list/packinglist-fabrics/editFabricDrawer.vue'
  120. import { fabricList,fabricListId,deleteFabricList,submitList,cancelSubmit,bitchSubmit,bitchCancelSubmit} from '@api/document/packing-list/packinglist-fabrics'
  121. export default {
  122. name: 'FabricList', // 装箱单-面料
  123. mixins: [JeecgListMixin],
  124. components: { JEllipsis, moment, addFabricDrawer, detailsFabricDrawer, editFabricDrawer },
  125. data() {
  126. // let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} />
  127. return {
  128. // 表头
  129. fabricListColumns: [
  130. {
  131. title: '单据号',
  132. dataIndex: 'documentNo',
  133. width: 160,
  134. ellipsis: true,
  135. className: 'replacecolor'
  136. },
  137. // {
  138. // title: '订单号',
  139. // dataIndex: 'orderNumber',
  140. // width: 160,
  141. // className: 'replacecolor'
  142. // },
  143. {
  144. title: '集装箱号',
  145. dataIndex: 'containerNumber',
  146. width: 120,
  147. ellipsis: true,
  148. // scopedSlots: { customRender: 'containerNo' },
  149. className: 'replacecolor'
  150. },
  151. // {
  152. // title: '发票号',
  153. // dataIndex: 'invoiceNo',
  154. // width: 160,
  155. // ellipsis: true,
  156. // className: 'replacecolor'
  157. // },
  158. {
  159. title: '外销发票号',
  160. dataIndex: 'exportInvoiceNo',
  161. width: 150,
  162. ellipsis: true,
  163. className: 'replacecolor'
  164. },
  165. {
  166. title: '装柜日期',
  167. dataIndex: 'latestDateOfShipment',
  168. width: 120,
  169. ellipsis: true,
  170. className: 'replacecolor'
  171. },
  172. {
  173. title: '成衣工厂',
  174. dataIndex: 'garmentFactory',
  175. width: 140,
  176. ellipsis: true,
  177. className: 'replacecolor'
  178. },
  179. {
  180. title: '制单人',
  181. dataIndex: 'createBy',
  182. width: 120,
  183. ellipsis: true,
  184. className: 'replacecolor'
  185. },
  186. {
  187. title: '制单日期',
  188. dataIndex: 'preparedDate',
  189. width: 140,
  190. ellipsis: true,
  191. // 有问题,自动显示当日日期
  192. // customRender: text => {
  193. // return moment(text).format('YYYY-MM-DD')
  194. // },
  195. className: 'replacecolor'
  196. },
  197. {
  198. title: '托书号',
  199. dataIndex: 'shippingOrderNumber',
  200. width: 160,
  201. ellipsis: true,
  202. className: 'replacecolor'
  203. },
  204. {
  205. title: '状态',
  206. dataIndex: 'status',
  207. scopedSlots: { customRender: 'state' },
  208. width: 140,
  209. className: 'replacecolor'
  210. },
  211. {
  212. title: '操作',
  213. dataIndex: 'operation',
  214. scopedSlots: { customRender: 'operationSlot' },
  215. width: 150,
  216. // fixed: 'right',
  217. className: 'replacecolor'
  218. }
  219. ],
  220. fabricListData: [],
  221. selectedRowKeys: [], // 勾选航
  222. loading: false, // 表格加载
  223. // 查询条件
  224. queryParam: {
  225. pageNo: '' // 初始页
  226. },
  227. pagination:{},
  228. url: {
  229. // syncUser: '/act/process/extActProcess/doSyncUser',
  230. list: '/sys/user/list',
  231. // delete: '/sys/user/delete',
  232. // deleteBatch: '/sys/user/deleteBatch',
  233. exportXlsUrl: '/sys/user/exportXls', // 导出
  234. importExcelUrl: 'sys/user/importExcel' // 导入
  235. }
  236. }
  237. },
  238. created() {
  239. this.getFabricList()
  240. },
  241. methods: {
  242. //分页查询
  243. getFabricList(){
  244. this.$nextTick(() => {
  245. this.queryParam.pageSize = 20
  246. fabricList(this.queryParam).then(res => {
  247. if (res.success) {
  248. this.fabricListData = res.result.records;
  249. this.pagination = {
  250. total: res.result.total,
  251. current: res.result.current,
  252. pageSize: res.result.size
  253. }
  254. }else{
  255. this.$message.error(res.message);
  256. }
  257. })
  258. })
  259. },
  260. // 查询按钮
  261. searchQuery() {
  262. this.toggleSearchStatus = false
  263. this.queryParam.pageNo = ''
  264. this.getFabricList()
  265. },
  266. //重置查询
  267. searchReset() {
  268. this.queryParam = {}
  269. this.getFabricList()
  270. },
  271. // ------------------------------------
  272. // 推送
  273. push() {},
  274. // 新增
  275. addFabric() {
  276. console.log('新增-装箱单面料')
  277. this.$refs.addFabricDrawer.visible = true
  278. },
  279. // --------------------------------------
  280. // 操作 附件上传
  281. accessoryUpload() {},
  282. // 操作 详情
  283. details(record) {
  284. console.log('详情', record.id)
  285. // console.log('编辑')
  286. this.$nextTick(() => {
  287. fabricListId({id:record.id}).then(res => {
  288. if (res.success) {
  289. var data = res.result
  290. this.$refs.detailsFabricDrawer.visible = true
  291. this.$refs.detailsFabricDrawer.addFabric ={
  292. documentNo:data.documentNo,
  293. // orderNumber:data.orderNumber,
  294. containerNumber:data.containerNumber,
  295. latestDateOfShipment:data.latestDateOfShipment,
  296. garmentFactory:data.garmentFactory,
  297. invoiceNo:data.invoiceNo,
  298. preparedBy:data.preparedBy,
  299. preparedDate:data.preparedDate,
  300. exportInvoiceNo:data.exportInvoiceNo,
  301. shippingOrderNumber:data.shippingOrderNumber,
  302. remarks:data.remarks,
  303. plumbumNo:data.plumbumNo,
  304. }
  305. if(record.documentNo.substr(0, 2) == "FL"){
  306. this.$refs.detailsFabricDrawer.judageCloumn()
  307. }
  308. data.syPackingListFabricItem.map(item =>{
  309. if(item.manualYarnFlag == 0){
  310. item.manualYarnFlag = '否'
  311. }else {
  312. item.manualYarnFlag = '是'
  313. }
  314. })
  315. this.$refs.detailsFabricDrawer.addFabricData = data.syPackingListFabricItem
  316. }else{
  317. this.$message.error(res.message);
  318. }
  319. })
  320. })
  321. },
  322. // 操作 编辑
  323. edit(record) {
  324. // console.log('编辑')
  325. this.$nextTick(() => {
  326. fabricListId({id:record.id}).then(res => {
  327. if (res.success) {
  328. var data = res.result
  329. this.$refs.addFabricDrawer.visible = true
  330. this.$refs.addFabricDrawer.defaultMethod = 'edit'
  331. this.$refs.addFabricDrawer.addFabric ={
  332. id:data.id,
  333. // orderNumber:data.orderNumber,
  334. documentNo:data.documentNo,
  335. containerNumber:data.containerNumber,
  336. latestDateOfShipment:data.latestDateOfShipment,
  337. garmentFactory:data.garmentFactory,
  338. invoiceNo:data.invoiceNo,
  339. preparedBy:data.preparedBy,
  340. preparedDate:data.preparedDate,
  341. exportInvoiceNo:data.exportInvoiceNo,
  342. shippingOrderNumber:data.shippingOrderNumber,
  343. remarks:data.remarks,
  344. plumbumNo:data.plumbumNo,
  345. }
  346. if(record.documentNo.substr(0, 2) == "FL"){
  347. this.$refs.addFabricDrawer.judageCloumn()
  348. }
  349. data.syPackingListFabricItem.map(item =>{
  350. if(item.manualYarnFlag == 0){
  351. this.$refs.addFabricDrawer.manualYarnDisabled = true
  352. this.$forceUpdate()
  353. }else {
  354. this.$refs.addFabricDrawer.manualYarnDisabled = false
  355. }
  356. })
  357. this.$refs.addFabricDrawer.addFabricData = data.syPackingListFabricItem
  358. }else{
  359. this.$message.error(res.message);
  360. }
  361. })
  362. })
  363. },
  364. //提交
  365. submit(record){
  366. console.log(record.id)
  367. submitList({id:record.id}).then(res =>{
  368. if (res.success) {
  369. record.status = 1
  370. this.getFabricList()
  371. this.$message.success('提交成功')
  372. }else{
  373. this.$message.error(res.message);
  374. }
  375. })
  376. },
  377. cancel(record){
  378. console.log(record.id)
  379. cancelSubmit({id:record.id}).then(res =>{
  380. if (res.success) {
  381. record.status = 0
  382. this.getFabricList()
  383. this.$message.success('取消提交成功')
  384. }else{
  385. this.$message.error(res.message);
  386. }
  387. })
  388. },
  389. //批量提交
  390. bitchSubmitList(){
  391. for(var i =0;i<this.selectedRows.length;i++){
  392. var tickRow = this.selectedRows[i]
  393. if(tickRow.status === '1'){
  394. this.$message.error("部分数据是已提交,请勿重复提交!");
  395. return
  396. }
  397. }
  398. var ids = this.selectedRowKeys.toString()
  399. bitchSubmit({ids : ids}).then(res =>{
  400. if (res.success) {
  401. this.getFabricList()
  402. this.selectedRowKeys = []
  403. this.$message.success('提交成功');
  404. }else{
  405. this.$message.error(res.message);
  406. }
  407. })
  408. },
  409. //批量取消推送
  410. bitchCancelSubmitList(){
  411. for(var i =0;i<this.selectedRows.length;i++){
  412. var tickRow = this.selectedRows[i]
  413. if(tickRow.status === '0'){
  414. this.$message.error("含未提交数据,请重新选择!");
  415. return
  416. }
  417. }
  418. var ids = this.selectedRowKeys.toString()
  419. bitchCancelSubmit({ids : ids}).then(res =>{
  420. if (res.success) {
  421. this.getFabricList()
  422. this.selectedRowKeys = []
  423. this.$message.success('取消提交成功');
  424. }else{
  425. this.$message.error(res.message);
  426. }
  427. })
  428. },
  429. // 操作 删除
  430. handleDelete(id) {
  431. this.$nextTick(() => {
  432. if(this.queryParam.pageNo > 1 && this.fabricListData.length === 1){
  433. this.queryParam.pageNo = this.queryParam.pageNo -1
  434. }
  435. deleteFabricList({ id: id }).then(res => {
  436. if (res.success) {
  437. this.getFabricList()
  438. this.$message.success('删除成功')
  439. } else {
  440. this.$message.error('删除成功')
  441. }
  442. })
  443. })
  444. },
  445. // --------------------------------------
  446. // ??
  447. modalFormOk() {},
  448. // 选中行
  449. onSelectChange(keys, rows) {
  450. this.selectedRowKeys = keys
  451. this.selectedRows = rows
  452. },
  453. // --------------------------------------
  454. aa() {},
  455. bb() {},
  456. cc() {},
  457. // 分页、排序、筛选变化时触发
  458. handleTableChange(pagination, filters, sorter) {
  459. // console.log('当前页信息>>>>',pagination)
  460. this.queryParam.pageNo = pagination.current
  461. this.getFabricList()
  462. }
  463. },
  464. computed: {
  465. // 选中项
  466. rowSelection() {
  467. return {
  468. onChange: (selectedRowKeys, selectedRows) => {
  469. console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows)
  470. },
  471. getCheckboxProps: record => ({
  472. props: {
  473. disabled: record.title === 'Disabled User',
  474. // Column configuration not to be checked
  475. title: record.title
  476. }
  477. })
  478. }
  479. }
  480. },
  481. mounted() {}
  482. }
  483. </script>
  484. <style lang="less" scoped>
  485. @import '~@assets/less/common.less';
  486. @import '~@assets/less/overwriter.less';
  487. /deep/ .ant-table-thead > tr > th {
  488. text-align: center;
  489. // font-weight: 700;
  490. }
  491. /deep/ .ant-table-tbody {
  492. text-align: center;
  493. }
  494. // /deep/ th.replacecolor {
  495. // background-color: #ccc;
  496. // }
  497. </style>