safetyStockList.vue 16 KB

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