unitPopup.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  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="编码">
  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: '编码',
  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,code){
  140. this.loading = true
  141. this.queryParam.Org = data
  142. this.queryParam.UOMClass = code
  143. this.selectedRowKeys = []
  144. this.selectedRows = []
  145. getAction('/production/safetyStock/selectUnit',this.queryParam).then(res=>{
  146. if(res.success){
  147. this.dataSource = res.result.records
  148. this.pagination = {
  149. total: res.result.total,
  150. current: res.result.current,
  151. pageSize: res.result.size
  152. }
  153. }else{
  154. this.$message.error(res.message);
  155. }
  156. }).finally(()=>{
  157. this.loading = false
  158. })
  159. },
  160. searchQuery(){
  161. this.queryParam.pageNo = 1
  162. this.getData(this.queryParam.Org,this.queryParam.UOMClass)
  163. },
  164. searchReset(){
  165. this.queryParam.name = ''
  166. this.queryParam.code = ''
  167. this.getData(this.queryParam.Org,this.queryParam.UOMClass)
  168. },
  169. handleTableChange(pagination, filters, sorter) {
  170. this.queryParam.pageNo = pagination.current
  171. this.queryParam.pageSize = pagination.pageSize
  172. this.getData(this.queryParam.Org,this.queryParam.UOMClass)
  173. },
  174. onSelectChange(selectedRowKeys, selectionRows) {
  175. this.selectedRowKeys = selectedRowKeys;
  176. this.selectedRows = selectionRows;
  177. },
  178. handleToggleSearch(){
  179. this.toggleSearchStatus=!this.toggleSearchStatus
  180. },
  181. clickRow(record, index){
  182. return {
  183. on: {
  184. click: () => {
  185. this.selectedRowKeys=[]
  186. this.selectedRows=[]
  187. this.selectedRowKeys.push(index)
  188. this.selectedRows.push(record)
  189. },
  190. }
  191. }
  192. },
  193. }
  194. }
  195. </script>
  196. <style scoped lang="less">
  197. /* @import '~@assets/less/common.less' */
  198. /deep/.ant-input{
  199. height:29px;
  200. }
  201. /deep/.ant-select-selection--single {
  202. height: 29px;
  203. }
  204. /deep/.ant-select{
  205. font-size: 12px;
  206. }
  207. /deep/.ant-form label{
  208. font-size: 12px;
  209. }
  210. /deep/.table-page-search-wrapper .ant-form-inline .ant-form-item{
  211. margin-bottom:9px
  212. }
  213. /deep/.moddle>.ant-card-body{
  214. padding-bottom:0px;
  215. padding-top: 12px;
  216. }
  217. /deep/.top>.ant-card-body{
  218. padding-bottom: 12px;
  219. padding-top: 12px;
  220. }
  221. /deep/.ant-btn{
  222. height:28px
  223. }
  224. /deep/.ant-modal-body{
  225. padding-bottom: 0px;
  226. padding-top: 0px;
  227. }
  228. // /deep/.ant-modal-body{
  229. // background: #f0f2f5;
  230. // }
  231. /deep/.ant-modal-content{
  232. background: #f0f2f5;
  233. }
  234. /deep/.ant-card-body .table-operator {
  235. margin-bottom: 0px;
  236. }
  237. /deep/.three>.ant-card-body{
  238. padding-bottom:12px;
  239. padding-top: 12px;
  240. }
  241. /deep/.bottom>.ant-card-body{
  242. padding-bottom:0px;
  243. padding-top: 12px;
  244. }
  245. /deep/.ant-calendar-picker{
  246. min-width: 0px !important;
  247. }
  248. /deep/.sonItem {
  249. margin-bottom:0px !important
  250. }
  251. /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 {
  252. padding: 8px 8px !important;
  253. }
  254. /deep/.ant-table-fixed-header .ant-table-scroll .ant-table-header{
  255. width: calc(100% + 9px);//减去滚动条的宽度
  256. }
  257. </style>