ee2148082a2a8eecbe63c1582a5b80fba298f895.svn-base 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  1. <template>
  2. <div class="app-container">
  3. <div class="search">
  4. <el-select v-model="table.getdataListParm.parammaps.feedid" filterable placeholder="饲料名称" class="filter-item" style="width: 150px;" clearable>
  5. <el-option v-for="item in feedNameList" :key="item.id" :label="item.fname" :value="item.id" />
  6. </el-select>
  7. <el-button class="successBorder" @click="handleSearch">查询</el-button>
  8. <el-button class="successBorder" @click="handleRefresh">重置</el-button>
  9. <el-button class="export" icon="el-icon-upload2" style="float: right;margin-right: 10px;" @click="handleExport">导出</el-button>
  10. </div>
  11. <div class="table">
  12. <el-table
  13. :key="table.tableKey"
  14. v-loading="table.listLoading"
  15. element-loading-text="给我一点时间"
  16. :data="table.list"
  17. border
  18. fit
  19. highlight-current-row
  20. style="width: 100%;"
  21. :row-style="rowStyle"
  22. :cell-style="cellStyle"
  23. class="elTable table-fixed"
  24. >
  25. <el-table-column label="序号" align="center" type="index" width="50px">
  26. <template slot-scope="scope">
  27. <span>{{ scope.$index + (table.pageNum-1) * table.pageSize + 1 }}</span>
  28. </template>
  29. </el-table-column>
  30. <el-table-column label="饲料名称" min-width="130px" align="center">
  31. <template slot-scope="scope">
  32. <span>{{ scope.row.feedname }}</span>
  33. </template>
  34. </el-table-column>
  35. <el-table-column label="批号" min-width="130px" align="center">
  36. <template slot-scope="scope">
  37. <span>{{ scope.row.pcpde }}</span>
  38. </template>
  39. </el-table-column>
  40. <el-table-column label="当前库存重量(kg)" min-width="110px" align="center">
  41. <template slot-scope="scope">
  42. <span>{{ scope.row.stockweight }}</span>
  43. </template>
  44. </el-table-column>
  45. <el-table-column label="金额(元)" min-width="110px" align="center">
  46. <template slot-scope="scope">
  47. <span>{{ scope.row.sumprice }}</span>
  48. </template>
  49. </el-table-column>
  50. <el-table-column label="操作" align="center" width="50" class-name="small-padding fixed-width" fixed="right">
  51. <template slot-scope="{row}">
  52. <el-button class="miniSuccess" icon="el-icon-search" :disabled="isokDisable" @click="handleSee(row)" />
  53. </template>
  54. </el-table-column>
  55. </el-table>
  56. <pagination v-show="table.total>=0" :total="table.total" :page.sync="table.getdataListParm.offset" :limit.sync="table.getdataListParm.pagecount" @pagination="getList" />
  57. </div>
  58. <el-dialog :fullscreen="dialogFull" :visible.sync="see.dialogFormVisible" :close-on-click-modal="false" width="90%">
  59. <template slot="title">
  60. <div class="avue-crud__dialog__header">
  61. <span class="el-dialog__title">
  62. <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px" />
  63. {{ textMap[see.dialogStatus] }}
  64. </span>
  65. <div class="avue-crud__dialog__menu" @click="dialogFull? dialogFull=false: dialogFull=true">
  66. <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
  67. <svg-icon v-else icon-class="fullscreen" />
  68. </div>
  69. </div>
  70. </template>
  71. <div class="app-see">
  72. <el-tabs v-model="see.activeName" @tab-click="handleTabClick">
  73. <el-tab-pane label="入库记录" name="first">
  74. <div class="search">
  75. <el-date-picker v-model="see.getdataListParm.parammaps.inputDatetime" class="inputDatetime filter-item" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 250px;" />
  76. <el-button class="successBorder" @click="handleSearch1">查询</el-button>
  77. </div>
  78. <div class="table">
  79. <el-table
  80. :key="see.tableKey"
  81. v-loading="see.listLoading"
  82. element-loading-text="给我一点时间"
  83. :data="see.list"
  84. border
  85. fit
  86. highlight-current-row
  87. style="width: 100%;"
  88. :row-style="rowStyle"
  89. :cell-style="cellStyle"
  90. class="elTable table-fixed"
  91. >
  92. <el-table-column label="序号" align="center" type="index" width="50px">
  93. <template slot-scope="scope">
  94. <span>{{ scope.$index + (see.pageNum-1) * see.pageSize + 1 }}</span>
  95. </template>
  96. </el-table-column>
  97. <el-table-column label="入库日期" min-width="130px" align="center">
  98. <template slot-scope="scope">
  99. <span>{{ scope.row.laiddate }}</span>
  100. </template>
  101. </el-table-column>
  102. <el-table-column label="操作重量(kg)" min-width="130px" align="center">
  103. <template slot-scope="scope">
  104. <span>{{ scope.row.operateweight }}</span>
  105. </template>
  106. </el-table-column>
  107. <el-table-column label="金额(元)" min-width="110px" align="center">
  108. <template slot-scope="scope">
  109. <span> {{ scope.row.sumprice }}</span>
  110. </template>
  111. </el-table-column>
  112. <el-table-column label="备注" min-width="110px" align="center">
  113. <template slot-scope="scope">
  114. <span>{{ scope.row.remark }}</span>
  115. </template>
  116. </el-table-column>
  117. </el-table>
  118. </div>
  119. <pagination v-show="see.total>=0" style="margin-bottom: 50px;" :total="see.total" :page.sync="see.getdataListParm.offset" :limit.sync="see.getdataListParm.pagecount" @pagination="getSeeList" />
  120. </el-tab-pane>
  121. <el-tab-pane label="出库记录" name="second">
  122. <div class="search">
  123. <el-select v-model="see.getdataListParm2.parammaps.usetype" placeholder="出库类型" class="filter-item" style="width: 150px;" clearable>
  124. <el-option v-for="item in deliveryTypeList" :key="item.id" :label="item.label" :value="item.value" />
  125. </el-select>
  126. <el-date-picker v-model="see.getdataListParm2.parammaps.inputDatetime" class="inputDatetime filter-item" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 250px;" />
  127. <el-button class="successBorder" @click="handleSearch2">查询</el-button>
  128. </div>
  129. <div class="table">
  130. <el-table
  131. :key="see.tableKey2"
  132. v-loading="see.listLoading2"
  133. element-loading-text="给我一点时间"
  134. :data="see.list2"
  135. border
  136. fit
  137. highlight-current-row
  138. style="width: 100%;"
  139. :row-style="rowStyle"
  140. :cell-style="cellStyle"
  141. class="elTable table-fixed"
  142. >
  143. <el-table-column label="序号" align="center" type="index" width="50px">
  144. <template slot-scope="scope">
  145. <span>{{ scope.$index + (see.pageNum2-1) * see.pageSize2 + 1 }}</span>
  146. </template>
  147. </el-table-column>
  148. <el-table-column label="出库日期" min-width="130px" align="center">
  149. <template slot-scope="scope">
  150. <span>{{ scope.row.usedate }}</span>
  151. </template>
  152. </el-table-column>
  153. <el-table-column label="出库类型" min-width="130px" align="center">
  154. <template slot-scope="scope">
  155. <span>{{ scope.row.usetype }}</span>
  156. </template>
  157. </el-table-column>
  158. <el-table-column label="牲畜类别" min-width="110px" align="center">
  159. <template slot-scope="scope">
  160. <span> {{ scope.row.cowclass }}</span>
  161. </template>
  162. </el-table-column>
  163. <el-table-column label="操作重量(kg)" min-width="110px" align="center">
  164. <template slot-scope="scope">
  165. <span> {{ scope.row.operateweight }}</span>
  166. </template>
  167. </el-table-column>
  168. <el-table-column label="备注" min-width="110px" align="center">
  169. <template slot-scope="scope">
  170. <span>{{ scope.row.remark }}</span>
  171. </template>
  172. </el-table-column>
  173. </el-table>
  174. </div>
  175. <pagination v-show="see.total2>=0" style="margin-bottom: 50px;" :total="see.total2" :page.sync="see.getdataListParm2.offset" :limit.sync="see.getdataListParm2.pagecount" @pagination="getSeeList2" />
  176. </el-tab-pane>
  177. </el-tabs>
  178. <div slot="footer" class="dialog-footer">
  179. <el-button class="cancelClose cancelClose1" @click="see.dialogFormVisible = false; ">关闭</el-button>
  180. </div>
  181. </div>
  182. </el-dialog>
  183. </div>
  184. </template>
  185. <script>
  186. import { GetDataByName, GetDataByNames, checkButtons } from '@/api/common'
  187. import Pagination from '@/components/Pagination'
  188. import Cookies from 'js-cookie'
  189. import { parseTime, json2excel } from '@/utils/index.js'
  190. export default {
  191. name: 'Statistics',
  192. components: { Pagination },
  193. data() {
  194. return {
  195. dialogFull: false,
  196. isRoleEdit: [],
  197. requestParams: [
  198. { name: 'getFeedListEnable', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }},
  199. { name: 'getDictByNameUse', offset: 0, pagecount: 0, params: ['人工用量操作类型'] }
  200. ],
  201. feedNameList: [], // 饲料名称
  202. deliveryTypeList: [], // 出库类型
  203. table: {
  204. getdataListParm: {
  205. name: 'getFeedstorageList',
  206. page: 1,
  207. offset: 1,
  208. pagecount: parseInt(Cookies.get('pageCount')),
  209. returntype: 'Map',
  210. parammaps: {
  211. pastureid: Cookies.get('pastureid'),
  212. feedid: ''
  213. }
  214. },
  215. tableKey: 0,
  216. list: [],
  217. total: 0,
  218. listLoading: true
  219. },
  220. textMap: {
  221. see: '库存'
  222. },
  223. see: {
  224. dialogFormVisible: false,
  225. dialogStatus: '',
  226. temp: {},
  227. rules: {},
  228. getdataListParm: {
  229. name: 'getFsLaidList',
  230. page: 1,
  231. offset: 1,
  232. pagecount: 10,
  233. returntype: 'Map',
  234. parammaps: {
  235. pastureid: '',
  236. feedid: '',
  237. inputDatetime: '',
  238. startTime: '',
  239. stopTime: ''
  240. }
  241. },
  242. tableKey: 0,
  243. list: [],
  244. total: 0,
  245. listLoading: true,
  246. activeName: 'first',
  247. getdataListParm2: {
  248. name: 'getFsUseList',
  249. page: 1,
  250. offset: 1,
  251. pagecount: 10,
  252. returntype: 'Map',
  253. parammaps: {
  254. pastureid: '',
  255. feedid: '',
  256. inputDatetime: '',
  257. startTime: '',
  258. stopTime: '',
  259. usetype: ''
  260. }
  261. },
  262. tableKey2: 0,
  263. list2: [],
  264. total2: 0,
  265. listLoading2: true
  266. },
  267. requestParam: {},
  268. download: {
  269. getdataListParm: {
  270. name: 'getFeedstorageList',
  271. page: 1,
  272. offset: 1,
  273. pagecount: 0,
  274. returntype: 'Map',
  275. parammaps: {
  276. pastureid: Cookies.get('pastureid'),
  277. feedid: ''
  278. }
  279. },
  280. list: []
  281. },
  282. isokDisable: false,
  283. rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },
  284. cellStyle: { padding: 0 + 'px' }
  285. }
  286. },
  287. created() {
  288. this.getButtons()
  289. this.getDownList()
  290. this.getList()
  291. },
  292. methods: {
  293. getButtons() {
  294. const Edit = 'Statistics'
  295. const isRoleEdit = checkButtons(JSON.parse(sessionStorage.getItem('buttons')), Edit)
  296. this.isRoleEdit = isRoleEdit
  297. },
  298. getDownList() {
  299. GetDataByNames(this.requestParams).then(response => {
  300. this.feedNameList = response.data.getFeedListEnable.list
  301. this.deliveryTypeList = response.data.getDictByNameUse.list
  302. })
  303. },
  304. getList() {
  305. this.table.listLoading = true
  306. GetDataByName(this.table.getdataListParm).then(response => {
  307. console.log('table数据', response.data.list)
  308. if (response.data.list !== null) {
  309. this.table.list = response.data.list
  310. this.table.pageNum = response.data.pageNum
  311. this.table.pageSize = response.data.pageSize
  312. this.table.total = response.data.total
  313. } else {
  314. this.table.list = []
  315. }
  316. setTimeout(() => {
  317. this.table.listLoading = false
  318. }, 100)
  319. })
  320. },
  321. handleSearch() {
  322. console.log('点击了查询')
  323. this.table.getdataListParm.offset = 1
  324. this.getList()
  325. },
  326. handleRefresh() {
  327. console.log('点击了重置')
  328. this.table.getdataListParm.offset = 1
  329. this.table.getdataListParm.parammaps.feedid = ''
  330. this.getList()
  331. },
  332. handleSee(row) {
  333. this.see.dialogStatus = 'see'
  334. this.dialogFull = false
  335. this.see.dialogFormVisible = true
  336. this.see.list = []
  337. this.see.getdataListParm.offset = 1
  338. this.see.getdataListParm2.offset = 1
  339. this.see.getdataListParm.parammaps.pastureid = row.pastureid
  340. this.see.getdataListParm.parammaps.feedid = row.feedid
  341. this.see.getdataListParm2.parammaps.pastureid = row.pastureid
  342. this.see.getdataListParm2.parammaps.feedid = row.feedid
  343. this.see.activeName = 'first'
  344. this.getSeeList()
  345. this.getSeeList2()
  346. },
  347. getSeeList() {
  348. this.see.listLoading = true
  349. GetDataByName(this.see.getdataListParm).then(response => {
  350. console.log('table数据', response.data.list)
  351. if (response.data.list !== null) {
  352. this.see.list = response.data.list
  353. this.see.pageNum = response.data.pageNum
  354. this.see.pageSize = response.data.pageSize
  355. this.see.total = response.data.total
  356. } else {
  357. this.see.list = []
  358. }
  359. setTimeout(() => {
  360. this.see.listLoading = false
  361. }, 100)
  362. })
  363. },
  364. getSeeList2() {
  365. this.see.listLoading2 = true
  366. GetDataByName(this.see.getdataListParm2).then(response => {
  367. console.log('table数据2', response.data.list)
  368. if (response.data.list !== null) {
  369. this.see.list2 = response.data.list
  370. this.see.pageNum2 = response.data.pageNum
  371. this.see.pageSize2 = response.data.pageSize
  372. this.see.total2 = response.data.total
  373. } else {
  374. this.see.list2 = []
  375. }
  376. setTimeout(() => {
  377. this.see.listLoading2 = false
  378. }, 100)
  379. })
  380. },
  381. handleTabClick(val) {
  382. if (val.name === 'first') {
  383. this.getSeeList()
  384. } else if (val.name === 'second') {
  385. this.getSeeList2()
  386. }
  387. },
  388. handleSearch1() {
  389. console.log('点击了库存入库记录查询')
  390. if (this.see.getdataListParm.parammaps.inputDatetime !== '' && this.see.getdataListParm.parammaps.inputDatetime !== null) {
  391. this.see.getdataListParm.parammaps.startTime = parseTime(this.see.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
  392. this.see.getdataListParm.parammaps.stopTime = parseTime(this.see.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
  393. } else {
  394. this.see.getdataListParm.parammaps.inputDatetime = ''
  395. this.see.getdataListParm.parammaps.startTime = ''
  396. this.see.getdataListParm.parammaps.stopTime = ''
  397. }
  398. this.getSeeList()
  399. },
  400. handleSearch2() {
  401. console.log('点击了库存出库记录查询')
  402. if (this.see.getdataListParm2.parammaps.inputDatetime !== '' && this.see.getdataListParm2.parammaps.inputDatetime !== null) {
  403. this.see.getdataListParm2.parammaps.startTime = parseTime(this.see.getdataListParm2.parammaps.inputDatetime[0], '{y}-{m}-{d}')
  404. this.see.getdataListParm2.parammaps.stopTime = parseTime(this.see.getdataListParm2.parammaps.inputDatetime[1], '{y}-{m}-{d}')
  405. } else {
  406. this.see.getdataListParm2.parammaps.inputDatetime = ''
  407. this.see.getdataListParm2.parammaps.startTime = ''
  408. this.see.getdataListParm2.parammaps.stopTime = ''
  409. }
  410. this.getSeeList2()
  411. },
  412. handleExport() {
  413. console.log('点击了导出')
  414. this.download.getdataListParm.parammaps = this.table.getdataListParm.parammaps
  415. GetDataByName(this.download.getdataListParm).then(response => {
  416. if (response.data.list !== null) {
  417. this.download.list = response.data.list
  418. } else {
  419. this.download.list = []
  420. }
  421. var excelDatas = [
  422. {
  423. tHeader: ['饲料名称', '批号', '当前库存重量(kg)', '金额(元)'],
  424. filterVal: ['feedname', 'pcpde', 'stockweight', 'sumprice'],
  425. tableDatas: this.download.list,
  426. sheetName: 'Sheet1'
  427. }
  428. ]
  429. json2excel(excelDatas, '库存统计', true, 'xlsx')
  430. })
  431. }
  432. }
  433. }
  434. </script>
  435. <style lang="scss" scoped>
  436. .search{margin-top:10px;}
  437. .table{margin-top:10px;}
  438. </style>