b734420071efe338a9e7f59405531f0870e8c07e.svn-base 17 KB

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