inventoryAccount.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  1. <template>
  2. <div class="app-container">
  3. <formComponent
  4. :formOption="formOption"
  5. :dataList="dataList"
  6. :inDex="inDex"
  7. ref="avatar"
  8. @submitForm="submitForm"
  9. @returnToForm="returnToForm"
  10. />
  11. <listComponent
  12. :tableData="tableData"
  13. @modify="modification"
  14. @deletion="deletion"
  15. @buttonList="buttonList"
  16. @showSearch="showSearch"
  17. @feedback="feedback"
  18. @getList="getList"
  19. :hasPermi="hasPermi"
  20. :isItHidden="isItHidden"
  21. :customButton="customButton"
  22. :listStyle="listStyle"
  23. :queryList="queryList"
  24. :setRowList="setRowList"
  25. :tatolLabel="tatolLabel"
  26. />
  27. <pagination
  28. v-show="total > 0"
  29. :total="total"
  30. :page.sync="formDataList.pageNum"
  31. :limit.sync="formDataList.pageSize"
  32. @pagination="getList"
  33. />
  34. <!-- <el-pagination-->
  35. <!-- style="float: right;margin-top: 10px"-->
  36. <!-- @size-change="handleSizeChange"-->
  37. <!-- @current-change="handleCurrentChange"-->
  38. <!-- :page-sizes="[10, 20, 30, 50]"-->
  39. <!-- :page-size="this.formDataList.pageSize"-->
  40. <!-- background-->
  41. <!-- layout="sizes, prev, pager, next"-->
  42. <!-- :total="total">-->
  43. <!-- </el-pagination>-->
  44. </div>
  45. </template>
  46. <script>
  47. import {queryData, listExport, getustomer, getGoodName,getwarehouse } from '@/api/reportAnalysis/inventoryAccount'
  48. import Cookies from 'js-cookie'
  49. import { select } from '@/api/system/set'
  50. export default {
  51. name: 'inventoryAccount',
  52. data(){
  53. return{
  54. tatolLabel:['起初数量','期初金额'],
  55. dataList:{
  56. fCorpid:[],
  57. feeName:[],
  58. fFeeType:[],
  59. fWarehouseid:[]
  60. },
  61. tableData:[],
  62. setRowList:[],
  63. isItHidden: true,
  64. queryList: {
  65. tableName: '库存总账',
  66. columnList: []
  67. },
  68. hasPermi:{
  69. lookup:['anpin:stockControl:query'],
  70. disappear:['anpin:stockControl:remove']
  71. },
  72. customButton: [
  73. {
  74. type: 'primary',
  75. size: 'mini',
  76. icon: 'el-icon-edit',
  77. name: '导出',
  78. disabled: false,
  79. hasPermi:['anpin:stockControl:selectInventoryLedgerExcePorrt']
  80. }],
  81. inDex: 4,
  82. total:0,
  83. formDataList:{
  84. pageSize:10,
  85. pageNum:1,
  86. },
  87. listStyle: [
  88. {
  89. surface: '1',
  90. label: 'serialNumber',
  91. name: '序号',
  92. checked: 0,
  93. width: 100,
  94. onabort: ''
  95. },{
  96. surface: '2',
  97. label: 'fyears',
  98. name: '年',
  99. checked: 0,
  100. width: 100,
  101. onabort: ''
  102. },{
  103. surface: '3',
  104. label: 'fmonth',
  105. name: '月',
  106. checked: 0,
  107. width: 100,
  108. onabort: ''
  109. },{
  110. surface: '4',
  111. label: 'fCorpName',
  112. name: '供应商',
  113. checked: 0,
  114. width: 100,
  115. onabort: ''
  116. },{
  117. surface: '5',
  118. label: 'fFName',
  119. name: '货物',
  120. checked: 0,
  121. width: 100,
  122. onabort: ''
  123. },{
  124. surface: '6',
  125. label: 'fCurrency',
  126. name: '包装单位',
  127. checked: 0,
  128. width: 100,
  129. onabort: ''
  130. },{
  131. surface: '7',
  132. label: 'feeUnitName',
  133. name: '计量单位',
  134. checked: 0,
  135. width: 100,
  136. onabort: ''
  137. },{
  138. surface: '8',
  139. label: 'fWarehouseName',
  140. name: '库区',
  141. checked: 0,
  142. width: 100,
  143. onabort: ''
  144. },{
  145. surface: '9',
  146. label: 'fBeginQty',
  147. name: '期初数量',
  148. checked: 0,
  149. width: 100,
  150. onabort: ''
  151. },{
  152. surface: '10',
  153. label: 'fBeginUnitprice',
  154. name: '期初单价',
  155. checked: 0,
  156. width: 100,
  157. onabort: ''
  158. },{
  159. surface: '11',
  160. label: 'fBeginAmount',
  161. name: '期初金额',
  162. checked: 0,
  163. width: 100,
  164. onabort: ''
  165. },{
  166. surface: '12',
  167. label: ' rQty',
  168. name: '入库数量',
  169. checked: 0,
  170. width: 100,
  171. onabort: ''
  172. },{
  173. surface: '13',
  174. label: 'rfAmount',
  175. name: '入库金额',
  176. checked: 0,
  177. width: 100,
  178. onabort: ''
  179. },{
  180. surface: '14',
  181. label: ' cQty',
  182. name: '出库数量',
  183. checked: 0,
  184. width: 100,
  185. onabort: ''
  186. },{
  187. surface: '15',
  188. label: 'cfAmount',
  189. name: '出库金额',
  190. checked: 0,
  191. width: 100,
  192. onabort: ''
  193. },{
  194. surface: '16',
  195. label: 'fAfterQty',
  196. name: '结余数量',
  197. checked: 0,
  198. width: 100,
  199. onabort: ''
  200. },{
  201. surface: '17',
  202. label: ' fAfterUnitprice',
  203. name: '结余单价',
  204. checked: 0,
  205. width: 100,
  206. onabort: ''
  207. },{
  208. surface: '18',
  209. label: 'fAfterAmount',
  210. name: '结余金额',
  211. checked: 0,
  212. width: 100,
  213. onabort: ''
  214. }
  215. ],
  216. formOption:[
  217. {
  218. span: 6,
  219. label: 'fCorpid',
  220. name: '供应商',
  221. inputType: 1,
  222. width: 200,
  223. labelSize: '80',
  224. rules: [{ required: false, message: ' ' }]
  225. },{
  226. span: 6,
  227. label: 'fFeeType',
  228. name: '货物类别',
  229. inputType: 1,
  230. width: 200,
  231. labelSize: '80',
  232. rules: [{ required: false, message: ' ' }]
  233. },{
  234. span: 6,
  235. label: 'timeInterval',
  236. name: '期间',
  237. inputType: 3,
  238. width: 240,
  239. labelSize: '80',
  240. rules: [{ required: false, message: ' ' }]
  241. },
  242. {
  243. span: 6,
  244. label: 'fWarehouseid',
  245. name: '仓库',
  246. inputType: 1,
  247. width: 200,
  248. labelSize: '80',
  249. rules: [{ required: false, message: ' ' }]
  250. },
  251. {
  252. span: 6,
  253. label: 'feeName',
  254. name: '货物名称',
  255. inputType: 1,
  256. width: 200,
  257. labelSize: '80',
  258. rules: [{ required: false, message: ' ' }]
  259. },
  260. ]
  261. }
  262. },
  263. created() {
  264. this.queryList.columnList = this.listStyle
  265. this.setRowList = this.listStyle
  266. let queryParams = { pageNum: 1, fTypeid: 1}
  267. getustomer(queryParams).then(res => {
  268. for (let item in res.data) {
  269. this.dataList.fCorpid.push({
  270. label: res.data[item].fName,
  271. value: res.data[item].fId,
  272. })
  273. }
  274. })
  275. //获取品名
  276. getGoodName().then(res=>{
  277. for(let item in res.rows){
  278. this.dataList.feeName.push({
  279. label:res.rows[item].fName,
  280. value:res.rows[item].fId,
  281. })
  282. }
  283. })
  284. this.getDicts("data_cost_attribute").then((response) => {
  285. for(let item in response.data){
  286. this.dataList.fFeeType.push({
  287. value: response.data[item].dictValue,
  288. label:response.data[item].dictLabel
  289. })
  290. }
  291. });
  292. getwarehouse().then(res=>{
  293. for(let item in res.rows){
  294. this.dataList.fWarehouseid.push({
  295. label:res.rows[item].fName,
  296. value:res.rows[item].fId,
  297. })
  298. }
  299. })
  300. this.getList()
  301. let data = {
  302. tableName: this.queryList.tableName,
  303. userId: Cookies.get('userName')
  304. }
  305. this.getRow(data)
  306. },
  307. methods:{
  308. getRow(data,list) {
  309. select(data).then((res) => {
  310. if (res.data.length != 0) {
  311. this.queryList.columnList = res.data.filter((e) => e.checked == 0)
  312. this.queryList.columnList = res.data
  313. this.setRowList = res.data
  314. this.queryList.columnList = this.queryList.columnList.filter((e) => e.checked == 0)
  315. // this.waitFor = true
  316. } else {
  317. this.$set(this.queryList, 'columnList', this.$options.data().listStyle)
  318. this.setRowList = this.$options.data().listStyle
  319. }
  320. this.isItHidden = true
  321. // this.inDex = this.formOption.length
  322. this.inDex = 4
  323. })
  324. },
  325. //修改
  326. modification(scope) {
  327. console.log(scope)
  328. },
  329. //删除
  330. deletion(scope){},
  331. //所以按钮
  332. buttonList(row){
  333. console.log(row)
  334. switch (row.name){
  335. case '导出':
  336. const queryParams = this.formDataList;
  337. this.$confirm("是否确认导出所有销售出库数据项?", "警告", {
  338. confirmButtonText: "确定",
  339. cancelButtonText: "取消",
  340. type: "warning",
  341. })
  342. .then(function () {
  343. return listExport(queryParams);
  344. })
  345. .then((response) => {
  346. this.download(response.msg);
  347. });
  348. break
  349. }
  350. },
  351. // 显示搜索条件、点击后会调用此方法
  352. showSearch() {
  353. console.log('到我了')
  354. this.searchWhether = !this.searchWhether
  355. },
  356. //搜索、重置、展开
  357. feedback(res) {
  358. console.log(res)
  359. if (res == '展开') {
  360. if (this.inDex == 4) {
  361. this.inDex = this.formOption.length
  362. } else {
  363. this.inDex = 4
  364. }
  365. } else if (res == '搜索') {
  366. this.$refs.avatar.submitForm()
  367. } else if (res == '重置') {
  368. this.$refs.avatar.form = {}
  369. this.$refs.avatar.submitForm()
  370. }
  371. },
  372. //点击刷新会调用此方法
  373. getList() {
  374. console.log('到我了2')
  375. queryData(this.formDataList).then(res=>{
  376. this.tableData = res.rows
  377. this.total = res.total
  378. })
  379. },
  380. submitForm() {
  381. console.log(this.$refs.avatar.form)
  382. this.formDataList = this.$refs.avatar.form
  383. this.getList()
  384. },
  385. returnToForm(row) {
  386. console.log(row, 111)
  387. },
  388. //分页
  389. handleSizeChange(val) {
  390. // console.log(`每页 ${val} 条`);
  391. this.formDataList.pageSize = val
  392. this.query(this.formDataList)
  393. },
  394. handleCurrentChange(val) {
  395. // console.log(`当前页: ${val}`);
  396. this.formDataList.pageNum = val
  397. this.query(this.formDataList)
  398. },
  399. }
  400. }
  401. </script>
  402. <style scoped>
  403. </style>