fabric-list.vue 15 KB

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