safetyStockList.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  1. <template>
  2. <div>
  3. <a-card :bordered="false" class="top" style="margin-bottom:1%;margin-top:1%">
  4. <!-- 查询区域 -->
  5. <div class="table-page-search-wrapper">
  6. <a-form layout="inline" @keyup.enter.native="searchQuery">
  7. <a-row :gutter="24">
  8. <a-col :md="4" :sm="24">
  9. <a-form-item label="料品编码">
  10. <a-input placeholder="请输入" v-model="queryParam.inventoryCode" ></a-input>
  11. </a-form-item>
  12. </a-col>
  13. <a-col :md="4" :sm="24">
  14. <a-form-item label="料品名称">
  15. <a-input placeholder="请输入" v-model="queryParam.inventoryName"></a-input>
  16. </a-form-item>
  17. </a-col>
  18. <a-col :md="4" :sm="24">
  19. <a-form-item label="料品属性">
  20. <a-input placeholder="请输入" v-model="queryParam.attribute" ></a-input>
  21. </a-form-item>
  22. </a-col>
  23. <a-col :md="4" :sm="24">
  24. <a-form-item label="规格">
  25. <a-input placeholder="请输入" v-model="queryParam.specs"></a-input>
  26. </a-form-item>
  27. </a-col>
  28. <template v-if="toggleSearchStatus">
  29. <a-col :md="4" :sm="24">
  30. <a-form-item label="型号">
  31. <a-input placeholder="请输入" v-model="queryParam.model" ></a-input>
  32. </a-form-item>
  33. </a-col>
  34. <a-col :md="4" :sm="24">
  35. <a-form-item label="安全库存">
  36. <a-input placeholder="请输入" v-model="queryParam.safetyStock"></a-input>
  37. </a-form-item>
  38. </a-col>
  39. </template>
  40. <a-col :md="4" :sm="24">
  41. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  42. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  43. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  44. <a @click="handleToggleSearch" style="margin-left: 8px">
  45. {{ toggleSearchStatus ? '收起' : '展开' }}
  46. <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
  47. </a>
  48. </span>
  49. </a-col>
  50. </a-row>
  51. </a-form>
  52. </div>
  53. </a-card>
  54. <a-card class="middle" style="margin-bottom:1%">
  55. <!-- 操作按钮区域 -->
  56. <div class="table-operator">
  57. <a-button type="danger" size="small" @click='addList'>新增</a-button>
  58. <a-button size="small" @click='editList'>修改</a-button>
  59. <a-button size="small" @click="delectList">删除</a-button>
  60. <a-button size="small" @click="detailList">详情</a-button>
  61. <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl">
  62. <a-button size="small">导入</a-button>
  63. </a-upload>
  64. <a-button size="small" @click="exportList('安全库存列表')">导出</a-button>
  65. </div>
  66. <!-- table区域-begin -->
  67. <div>
  68. <a-table
  69. ref="table"
  70. size="middle"
  71. bordered
  72. rowKey="id"
  73. :columns="columns"
  74. :dataSource="dataSource"
  75. :pagination="ipagination"
  76. :scroll="{ x: 1500, y: 300 }"
  77. :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  78. @change="handleTableChange"
  79. :customRow ="clickRow"
  80. >
  81. </a-table>
  82. </div>
  83. <!-- table区域-end -->
  84. </a-card>
  85. <safetyStockListAdd ref="safetyStockListAdd" @ok='getTableList'></safetyStockListAdd>
  86. <safetyStockListDetail ref="safetyStockListDetail"></safetyStockListDetail>
  87. </div>
  88. </template>
  89. <script>
  90. import alertModal from '../../../plugins/modal'
  91. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  92. import moment from 'dayjs'
  93. import { httpAction ,getAction,postAction,putAction,deleteAction,downFile} from '@/api/manage'
  94. import {queryDepartTreeList} from '@/api/api'
  95. import safetyStockListAdd from './modules/safetyStockListAdd'
  96. import safetyStockListDetail from './modules/safetyStockListDetail'
  97. //---------workflow by fhf end -------------
  98. export default {
  99. name: "SafetyStockList",
  100. mixins: [JeecgListMixin],
  101. components: {
  102. safetyStockListAdd,
  103. safetyStockListDetail,
  104. },
  105. data () {
  106. return {
  107. description: '安全库存列表页面',
  108. queryParam:{},
  109. selectedRowKeys:[],
  110. selectedRow:[],
  111. documentData:[],
  112. toggleSearchStatus:false,
  113. dataSource:[{}],
  114. ipagination:{
  115. current: 1,
  116. pageSize: 10,
  117. pageSizeOptions: ['10', '20', '30'],
  118. showTotal: (total, range) => {
  119. return range[0] + '-' + range[1] + ' 共' + total + '条'
  120. },
  121. showQuickJumper: true,
  122. showSizeChanger: true,
  123. total: 0
  124. },
  125. // 表头
  126. columns: [
  127. {
  128. title: '#',
  129. dataIndex: '',
  130. key: 'rowIndex',
  131. width: 60,
  132. align: "center",
  133. customRender:function (t, r, index) {
  134. return parseInt(index)+1;
  135. }
  136. },
  137. {
  138. title: '料品编码',
  139. align:"center",
  140. dataIndex: 'inventoryCode',
  141. ellipsis: true,
  142. },
  143. {
  144. title: '料品名称',
  145. align:"center",
  146. dataIndex: 'inventoryName',
  147. ellipsis: true,
  148. },
  149. {
  150. title: '料品属性',
  151. align:"center",
  152. dataIndex: 'attribute',
  153. ellipsis: true,
  154. },
  155. {
  156. title: '规格',
  157. align:"center",
  158. dataIndex: 'specs',
  159. ellipsis: true,
  160. },
  161. {
  162. title: '型号',
  163. align:"center",
  164. dataIndex: 'model',
  165. ellipsis: true,
  166. },
  167. {
  168. title: '安全库存',
  169. align:"center",
  170. dataIndex: 'safetyStock',
  171. ellipsis: true,
  172. },
  173. ],
  174. url: {
  175. list: "/production/safetyStock/list",
  176. },
  177. importExcelUrl:'/production/safetyStock/importExcel',
  178. // ---------workflow by fhf start -------------
  179. serviceName: 'assetAllocationService',
  180. // ---------workflow by fhf end -------------
  181. }
  182. },
  183. created () {
  184. this.getTableList()
  185. },
  186. computed: {
  187. importExcelUrl: function(){
  188. return `${window._CONFIG['domianURL']}/${this.importExcelUrl}`;
  189. },
  190. },
  191. methods: {
  192. //获取数据
  193. getTableList(){
  194. alertModal.loading("执行中,请稍后!")
  195. getAction('/production/safetyStock/list',this.queryParam).then(res=>{
  196. alertModal.closeLoading();
  197. if(res.success){
  198. this.dataSource =res.result.records
  199. this.ipagination = {
  200. total: res.result.total,
  201. current: res.result.current,
  202. pageSize: res.result.size
  203. }
  204. }else{
  205. this.$message.error(res.message);
  206. }
  207. })
  208. },
  209. onSearch(){
  210. // this.$refs.materialProcurementSearch.visible = true
  211. },
  212. //导出
  213. exportList(fileName){
  214. this.$confirm({
  215. title: '确认导出',
  216. content: '是否导出数据?',
  217. onOk: ()=> {
  218. alertModal.loading("执行中,请稍后!")
  219. downFile('/production/safetyStock/exportXls', this.queryParam).then(data => {
  220. alertModal.closeLoading();
  221. if (!data) {
  222. this.$message.warning('文件下载失败')
  223. return
  224. }
  225. if (typeof window.navigator.msSaveBlob !== 'undefined') {
  226. window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xlsx')
  227. } else {
  228. let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
  229. let link = document.createElement('a')
  230. link.style.display = 'none'
  231. link.href = url
  232. link.setAttribute('download', fileName + '.xlsx')
  233. document.body.appendChild(link)
  234. link.click()
  235. document.body.removeChild(link) // 下载完成移除元素
  236. window.URL.revokeObjectURL(url) // 释放掉blob对象
  237. }
  238. })
  239. }
  240. })
  241. },
  242. //重置
  243. searchReset(){
  244. this.queryParam={}
  245. this.getTableList()
  246. },
  247. //查询
  248. searchQuery(){
  249. this.queryParam.pageNo = '1'
  250. this.getTableList()
  251. },
  252. //新增
  253. addList(){
  254. this.$refs.safetyStockListAdd.visible=true
  255. this.$refs.safetyStockListAdd.defaultMethod='add'
  256. },
  257. //编辑
  258. editList(){
  259. if(this.selectedRowKeys.length==0){
  260. this.$message.warning('请勾选数据!')
  261. }else if(this.selectedRowKeys.length>1){
  262. this.$message.warning('只可勾选一条数据')
  263. }else{
  264. this.$refs.safetyStockListAdd.visible=true
  265. this.$refs.safetyStockListAdd.defaultMethod='edit'
  266. this.$refs.safetyStockListAdd.getEditData(this.selectedRowKeys[0])
  267. }
  268. },
  269. //删除
  270. delectList(){
  271. if(this.selectedRowKeys.length==0){
  272. this.$message.warning('请勾选数据!')
  273. }else if(this.selectedRowKeys.length>1){
  274. this.$confirm({
  275. title: '确认删除',
  276. content: '是否删除选中数据?',
  277. onOk: ()=> {
  278. var ids = this.selectedRowKeys.toString()
  279. var that = this
  280. alertModal.loading("执行中,请稍后!")
  281. deleteAction('/production/safetyStock/deleteBatch', {ids: ids}).then((res) => {
  282. alertModal.closeLoading();
  283. if (res.success) {
  284. this.$message.success('删除成功!');
  285. this.getTableList()
  286. } else {
  287. this.$message.error(res.message);
  288. }
  289. });
  290. }
  291. })
  292. }else{
  293. this.$confirm({
  294. title: '确认删除',
  295. content: '是否删除选中数据?',
  296. onOk: ()=> {
  297. alertModal.loading("执行中,请稍后!")
  298. deleteAction('/production/safetyStock/delete', {id: this.selectedRowKeys[0]}).then((res) => {
  299. alertModal.closeLoading();
  300. if (res.success) {
  301. this.$message.success('删除成功!');
  302. this.getTableList()
  303. } else {
  304. this.$message.error(res.message);
  305. }
  306. });
  307. }
  308. })
  309. }
  310. },
  311. //勾选
  312. onSelectChange(selectedRowKeys, selectionRows) {
  313. this.selectedRowKeys = selectedRowKeys;
  314. this.selectedRow = selectionRows;
  315. },
  316. handleTableChange(pagination, filters, sorter) {
  317. // console.log('当前页信息>>>>',pagination)
  318. this.queryParam.pageNo = pagination.current
  319. this.queryParam.pageSize = pagination.pageSize
  320. this.getTableList()
  321. },
  322. detailList(){
  323. if(this.selectedRowKeys.length==0){
  324. this.$message.warning('请选择数据!')
  325. }else if(this.selectedRowKeys.length>1){
  326. this.$message.warning('请选择一条数据!')
  327. }else{
  328. this.$refs.safetyStockListDetail.visible=true
  329. this.$refs.safetyStockListDetail.getEditData(this.selectedRowKeys[0])
  330. }
  331. },
  332. //双击
  333. clickRow(record, index){
  334. return {
  335. on: {
  336. dblclick: () => {
  337. this.$refs.safetyStockListDetail.visible=true
  338. this.$refs.safetyStockListDetail.getEditData(record.id)
  339. },
  340. }
  341. }
  342. }
  343. }
  344. }
  345. </script>
  346. <style scoped lang="less">
  347. /* @import '~@assets/less/common.less' */
  348. /deep/.ant-input{
  349. height:29px;
  350. }
  351. /deep/.ant-select-selection--single {
  352. height: 29px;
  353. }
  354. /deep/.ant-select{
  355. font-size: 12px;
  356. }
  357. /deep/.ant-form label{
  358. font-size: 12px;
  359. }
  360. /deep/.table-page-search-wrapper .ant-form-inline .ant-form-item{
  361. margin-bottom:9px
  362. }
  363. /deep/.top>.ant-card-body{
  364. padding-bottom:0px;
  365. padding-top: 12px;
  366. }
  367. /deep/.ant-btn{
  368. height:28px
  369. }
  370. /deep/.ant-table-thead > tr > th{
  371. padding: 6px 8px !important;
  372. }
  373. /deep/ .ant-table-tbody > tr > td{
  374. padding: 6px 8px !important;
  375. }
  376. /deep/ .ant-table{
  377. font-size:12px
  378. }
  379. /deep/.ant-table-fixed-header .ant-table-scroll .ant-table-header{
  380. width: calc(100% + 9px);//减去滚动条的宽度
  381. }
  382. /deep/.middle>.ant-card-body{
  383. padding-bottom:14px;
  384. padding-top:14px;
  385. }
  386. /deep/.ant-select-sm .ant-select-selection__rendered{
  387. line-height: 27px;
  388. }
  389. </style>