fabric-list.vue 15 KB

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