unitPopup.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  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. <div class="table-page-search-wrapper">
  13. <a-form layout="inline" @keyup.enter.native="searchQuery">
  14. <a-row :gutter="24">
  15. <a-col :md="8" :sm="24">
  16. <a-form-item label="名称">
  17. <a-input placeholder="请输入" v-model="queryParam.name" ></a-input>
  18. </a-form-item>
  19. </a-col>
  20. <!-- <template v-if="toggleSearchStatus"> -->
  21. <a-col :md="8" :sm="24">
  22. <a-form-item label="Code">
  23. <a-input placeholder="请输入" v-model="queryParam.code" ></a-input>
  24. </a-form-item>
  25. </a-col>
  26. <!-- </template> -->
  27. <a-col :md="8" :sm="24">
  28. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  29. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  30. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  31. <a @click="handleToggleSearch" style="margin-left: 8px">
  32. {{ toggleSearchStatus ? '收起' : '展开' }}
  33. <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
  34. </a>
  35. </span>
  36. </a-col>
  37. </a-row>
  38. </a-form>
  39. </div>
  40. <a-form-model ref="formRef">
  41. <a-table
  42. ref="table"
  43. size="middle"
  44. bordered
  45. id='sonList1'
  46. :loading="loading"
  47. :columns="columns"
  48. rowKey="rowIndex"
  49. :dataSource="dataSource"
  50. :pagination="pagination"
  51. :scroll="{ x: 800, y: 300 }"
  52. :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  53. @change="handleTableChange"
  54. :customRow ="clickRow"
  55. >
  56. </a-table>
  57. </a-form-model>
  58. </a-card >
  59. </a-modal>
  60. </template>
  61. <script>
  62. import { FormTypes } from '@/utils/JEditableTableUtil'
  63. import { JEditableTableModelMixin } from '@/mixins/JEditableTableModelMixin'
  64. import moment from "moment"
  65. import { httpAction ,getAction,postAction,putAction} from '@/api/manage'
  66. export default {
  67. name: 'inventoryPopup',
  68. mixins: [JEditableTableModelMixin],
  69. components: {
  70. },
  71. data() {
  72. return {
  73. visible:false,
  74. queryParam:{},
  75. selectedRowKeys:[],
  76. selectedRows:[],
  77. dataSource:[],
  78. loading:false,
  79. pagination:{
  80. current: 1,
  81. pageSize: 5,
  82. pageSizeOptions: ['5', '10', '20'],
  83. showTotal: (total, range) => {
  84. return range[0] + "-" + range[1] + " 共" + total + "条"
  85. },
  86. showQuickJumper: true,
  87. showSizeChanger: true,
  88. total: 0
  89. },
  90. queryParam:{
  91. pageNo:1
  92. },
  93. record:{},
  94. toggleSearchStatus:false,
  95. columns:[
  96. {
  97. title: '行号',
  98. dataIndex: '',
  99. key: 'rowIndex',
  100. width: 60,
  101. align: "center",
  102. customRender:function (t, r, index) {
  103. return parseInt(index)+1;
  104. }
  105. },
  106. {
  107. title: '名称',
  108. align:"center",
  109. dataIndex: 'Name',
  110. ellipsis: true,
  111. },
  112. {
  113. title: 'Code',
  114. align:"center",
  115. dataIndex: 'code',
  116. ellipsis: true,
  117. },
  118. ],
  119. whatUnit:'',
  120. }
  121. },
  122. created() {
  123. },
  124. methods: {
  125. handleCancel(){
  126. this.visible=false
  127. this.dataSource = []
  128. this.selectedRowKeys = []
  129. this.selectedRows = []
  130. },
  131. handleOk(){
  132. if(this.selectedRowKeys.length!==1){
  133. this.$message.warning('请选择一条数据!')
  134. }else{
  135. this.$emit('okData',this.selectedRows[0],this.whatUnit)
  136. this.handleCancel()
  137. }
  138. },
  139. getData(data){
  140. this.loading = true
  141. this.queryParam.Org = data
  142. this.selectedRowKeys = []
  143. this.selectedRows = []
  144. getAction('/production/safetyStock/selectUnit',this.queryParam).then(res=>{
  145. if(res.success){
  146. this.dataSource = res.result.records
  147. this.pagination = {
  148. total: res.result.total,
  149. current: res.result.current,
  150. pageSize: res.result.size
  151. }
  152. }else{
  153. this.$message.error(res.message);
  154. }
  155. }).finally(()=>{
  156. this.loading = false
  157. })
  158. },
  159. searchQuery(){
  160. this.getData(this.queryParam.Org)
  161. },
  162. searchReset(){
  163. this.queryParam.name = ''
  164. this.queryParam.code = ''
  165. this.getData(this.queryParam.Org)
  166. },
  167. handleTableChange(pagination, filters, sorter) {
  168. this.queryParam.pageNo = pagination.current
  169. this.queryParam.pageSize = pagination.pageSize
  170. this.getData()
  171. },
  172. onSelectChange(selectedRowKeys, selectionRows) {
  173. this.selectedRowKeys = selectedRowKeys;
  174. this.selectedRows = selectionRows;
  175. },
  176. handleToggleSearch(){
  177. this.toggleSearchStatus=!this.toggleSearchStatus
  178. },
  179. clickRow(record, index){
  180. return {
  181. on: {
  182. click: () => {
  183. this.selectedRowKeys=[]
  184. this.selectedRows=[]
  185. this.selectedRowKeys.push(index)
  186. this.selectedRows.push(record)
  187. },
  188. }
  189. }
  190. },
  191. }
  192. }
  193. </script>
  194. <style scoped lang="less">
  195. /* @import '~@assets/less/common.less' */
  196. /deep/.ant-input{
  197. height:29px;
  198. }
  199. /deep/.ant-select-selection--single {
  200. height: 29px;
  201. }
  202. /deep/.ant-select{
  203. font-size: 12px;
  204. }
  205. /deep/.ant-form label{
  206. font-size: 12px;
  207. }
  208. /deep/.table-page-search-wrapper .ant-form-inline .ant-form-item{
  209. margin-bottom:9px
  210. }
  211. /deep/.moddle>.ant-card-body{
  212. padding-bottom:0px;
  213. padding-top: 12px;
  214. }
  215. /deep/.top>.ant-card-body{
  216. padding-bottom: 12px;
  217. padding-top: 12px;
  218. }
  219. /deep/.ant-btn{
  220. height:28px
  221. }
  222. /deep/.ant-modal-body{
  223. padding-bottom: 0px;
  224. padding-top: 0px;
  225. }
  226. // /deep/.ant-modal-body{
  227. // background: #f0f2f5;
  228. // }
  229. /deep/.ant-modal-content{
  230. background: #f0f2f5;
  231. }
  232. /deep/.ant-card-body .table-operator {
  233. margin-bottom: 0px;
  234. }
  235. /deep/.three>.ant-card-body{
  236. padding-bottom:12px;
  237. padding-top: 12px;
  238. }
  239. /deep/.bottom>.ant-card-body{
  240. padding-bottom:0px;
  241. padding-top: 12px;
  242. }
  243. /deep/.ant-calendar-picker{
  244. min-width: 0px !important;
  245. }
  246. /deep/.sonItem {
  247. margin-bottom:0px !important
  248. }
  249. /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 {
  250. padding: 8px 8px !important;
  251. }
  252. /deep/.ant-table-fixed-header .ant-table-scroll .ant-table-header{
  253. width: calc(100% + 9px);//减去滚动条的宽度
  254. }
  255. </style>