inventoryPopup.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <template>
  2. <a-modal
  3. title="存货列表"
  4. width="60%"
  5. :visible="visible"
  6. :maskClosable="false"
  7. switchFullscreen
  8. @cancel="handleCancel"
  9. @ok='handleOk'
  10. >
  11. <a-card :bordered="false" class="top" style="margin-bottom:1%;margin-top:1%">
  12. <a-form-model ref="formRef">
  13. <a-table
  14. ref="table"
  15. size="middle"
  16. bordered
  17. id='sonList1'
  18. :loading="loading"
  19. :columns="columns"
  20. rowKey="rowIndex"
  21. :dataSource="dataSource"
  22. :pagination="pagination"
  23. :scroll="{ x: 800, y: 300 }"
  24. :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  25. @change="handleTableChange"
  26. :customRow ="clickRow"
  27. >
  28. </a-table>
  29. </a-form-model>
  30. </a-card >
  31. </a-modal>
  32. </template>
  33. <script>
  34. import { FormTypes } from '@/utils/JEditableTableUtil'
  35. import { JEditableTableModelMixin } from '@/mixins/JEditableTableModelMixin'
  36. import moment from "moment"
  37. import { httpAction ,getAction,postAction,putAction} from '@/api/manage'
  38. export default {
  39. name: 'inventoryPopup',
  40. mixins: [JEditableTableModelMixin],
  41. components: {
  42. },
  43. data() {
  44. return {
  45. visible:false,
  46. selectedRowKeys:[],
  47. selectedRows:[],
  48. dataSource:[],
  49. loading:false,
  50. pagination:{
  51. current: 1,
  52. pageSize: 5,
  53. pageSizeOptions: ['5', '10', '20'],
  54. showTotal: (total, range) => {
  55. return range[0] + "-" + range[1] + " 共" + total + "条"
  56. },
  57. showQuickJumper: true,
  58. showSizeChanger: true,
  59. total: 0
  60. },
  61. queryParam:{
  62. pageNo:1
  63. },
  64. record:{},
  65. columns:[
  66. {
  67. title: '行号',
  68. dataIndex: '',
  69. key: 'rowIndex',
  70. width: 60,
  71. align: "center",
  72. customRender:function (t, r, index) {
  73. return parseInt(index)+1;
  74. }
  75. },
  76. {
  77. title: '存货名称',
  78. align:"center",
  79. dataIndex: 'Name',
  80. ellipsis: true,
  81. },
  82. {
  83. title: '存货编码',
  84. align:"center",
  85. dataIndex: 'Code',
  86. ellipsis: true,
  87. },
  88. {
  89. title: '规格',
  90. align:"center",
  91. dataIndex: 'SPECS',
  92. ellipsis: true,
  93. },
  94. {
  95. title: '主单位',
  96. align:"center",
  97. dataIndex: 'unit',
  98. ellipsis: true,
  99. },
  100. {
  101. title: '料品属性1',
  102. align:"center",
  103. dataIndex: 'Code1',
  104. ellipsis: true,
  105. },
  106. ]
  107. }
  108. },
  109. created() {
  110. },
  111. methods: {
  112. handleCancel(){
  113. this.visible=false
  114. this.dataSource = []
  115. this.selectedRowKeys = []
  116. this.selectedRows = []
  117. },
  118. handleOk(){
  119. if(this.selectedRowKeys.length!==1){
  120. this.$message.warning('请选择一条数据!')
  121. }else{
  122. this.$emit('okData',this.selectedRows[0],this.record)
  123. this.handleCancel()
  124. }
  125. },
  126. getData(data){
  127. this.loading = true
  128. this.queryParam.Org = data
  129. getAction('/production/safetyStock/selectItemMaster',this.queryParam).then(res=>{
  130. if(res.success){
  131. this.dataSource = res.result.records
  132. this.pagination = {
  133. total: res.result.total,
  134. current: res.result.current,
  135. pageSize: res.result.size
  136. }
  137. }else{
  138. this.$message.error(res.message);
  139. }
  140. }).finally(()=>{
  141. this.loading = false
  142. })
  143. },
  144. handleTableChange(pagination, filters, sorter) {
  145. this.queryParam.pageNo = pagination.current
  146. this.queryParam.pageSize = pagination.pageSize
  147. this.getData()
  148. },
  149. onSelectChange(selectedRowKeys, selectionRows) {
  150. this.selectedRowKeys = selectedRowKeys;
  151. this.selectedRows = selectionRows;
  152. },
  153. clickRow(record, index){
  154. return {
  155. on: {
  156. click: () => {
  157. this.selectedRowKeys.push(index)
  158. this.selectedRows.push(record)
  159. },
  160. }
  161. }
  162. },
  163. }
  164. }
  165. </script>
  166. <style scoped lang="less">
  167. /* @import '~@assets/less/common.less' */
  168. /deep/.ant-input{
  169. height:29px;
  170. }
  171. /deep/.ant-select-selection--single {
  172. height: 29px;
  173. }
  174. /deep/.ant-select{
  175. font-size: 12px;
  176. }
  177. /deep/.ant-form label{
  178. font-size: 12px;
  179. }
  180. /deep/.table-page-search-wrapper .ant-form-inline .ant-form-item{
  181. margin-bottom:9px
  182. }
  183. /deep/.moddle>.ant-card-body{
  184. padding-bottom:0px;
  185. padding-top: 12px;
  186. }
  187. /deep/.top>.ant-card-body{
  188. padding-bottom: 12px;
  189. padding-top: 12px;
  190. }
  191. /deep/.ant-btn{
  192. height:28px
  193. }
  194. /deep/.ant-modal-body{
  195. padding-bottom: 0px;
  196. padding-top: 0px;
  197. }
  198. // /deep/.ant-modal-body{
  199. // background: #f0f2f5;
  200. // }
  201. /deep/.ant-modal-content{
  202. background: #f0f2f5;
  203. }
  204. /deep/.ant-card-body .table-operator {
  205. margin-bottom: 0px;
  206. }
  207. /deep/.three>.ant-card-body{
  208. padding-bottom:12px;
  209. padding-top: 12px;
  210. }
  211. /deep/.bottom>.ant-card-body{
  212. padding-bottom:0px;
  213. padding-top: 12px;
  214. }
  215. /deep/.ant-calendar-picker{
  216. min-width: 0px !important;
  217. }
  218. /deep/.sonItem {
  219. margin-bottom:0px !important
  220. }
  221. /deep/#sonList1>.ant-spin-nested-loading>.ant-spin-container>.ant-table>.ant-table-content>.ant-table-scroll>.ant-table-body>.ant-table-fixed>.ant-table-tbody > tr > td {
  222. padding: 8px 8px !important;
  223. }
  224. /deep/.ant-table-fixed-header .ant-table-scroll .ant-table-header{
  225. width: calc(100% + 9px);//减去滚动条的宽度
  226. }
  227. </style>