warehouselocation.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738
  1. <!--仓库管理-->
  2. <template>
  3. <div>
  4. <el-row>
  5. <el-col :span="12">
  6. <h2 class="bg-left title">库点费用</h2>
  7. </el-col>
  8. <el-col :span="12" class="bg-right">
  9. <el-button
  10. class="bg-bottom"
  11. type="primary"
  12. size="small"
  13. @click="returnsales()"
  14. ><img
  15. width="6"
  16. height="10"
  17. style="vertical-align: bottom; margin-right: 3px"
  18. src="../../../public/img/lujing.png"
  19. alt=""
  20. />返回</el-button
  21. >
  22. </el-col>
  23. </el-row>
  24. <el-row>
  25. <el-col class='bg-left' :span="12">
  26. <div style='align-items:center;' class='flex'>
  27. <ws-button class="find" type="primary" @click="addlist()"
  28. >添加</ws-button>
  29. <div style='align-items:center;' class='flex'>
  30. <div :class='{"forbidden":forbidden==true}' @click='minus'><i class="el-icon-arrow-left"></i></div>
  31. <ws-select
  32. v-model="year"
  33. placeholder=""
  34. @change="yearChange"
  35. :value="searchType"
  36. style="margin: 0 10px"
  37. >
  38. <ws-option
  39. v-for="item in yearList"
  40. :key="item.value"
  41. :label="item.value"
  42. :value="item.value"
  43. style="color: #8890b1"
  44. />
  45. </ws-select>
  46. <div :class='{"forbidden":forbidden1==true}' @click='add'><i class="el-icon-arrow-right"></i></div>
  47. </div>
  48. <span>合计:{{count}}元</span>
  49. </div>
  50. </el-col>
  51. <el-col :span="12" class="bg-right">
  52. <ws-select
  53. v-model="warehouseName"
  54. placeholder=""
  55. @change="warehouseNameChange"
  56. :value="searchType"
  57. style="margin: 0 10px"
  58. >
  59. <ws-option
  60. v-for="item in warehouseList1"
  61. :key="item.value"
  62. :label="item.value"
  63. :value="item.value"
  64. style="color: #8890b1"
  65. />
  66. </ws-select>
  67. <!-- v-hasPermission="'procurement.sparepart.directShip'" -->
  68. <ws-button class="find" type="primary" @click="find()"
  69. ><img
  70. width="16"
  71. height="16"
  72. style="
  73. vertical-align: text-top;
  74. position: relative;
  75. top: 0px;
  76. left: -8px;
  77. "
  78. src="../../../public/img/sousuo.png"
  79. alt=""
  80. /></ws-button>
  81. </el-col>
  82. </el-row>
  83. <el-table
  84. class="wenzi"
  85. :data="warehouseList.records"
  86. style="width: 100%; margin-top: 20px"
  87. height="780"
  88. >
  89. <el-table-column label="序号" type="index" show-overflow-tooltip width="50">
  90. </el-table-column>
  91. <el-table-column prop="expenseName" label="费用名称" >
  92. </el-table-column>
  93. <el-table-column prop="amount" label="金额(元)" >
  94. </el-table-column>
  95. <el-table-column prop="storage" label="附件">
  96. <template slot-scope="scope">
  97. <img
  98. width="18"
  99. height="20"
  100. style="vertical-align: text-top; position: relative; top: -1px"
  101. src="../../../public/img/fujian.png"
  102. @click="fujian(scope.row)"
  103. alt=""
  104. />
  105. </template>
  106. </el-table-column>
  107. <el-table-column prop="costDate" label="日期">
  108. </el-table-column>
  109. <el-table-column prop="address" label="操作" width="200">
  110. <template slot-scope="scope">
  111. <div class="adjustment" v-hasPermission="
  112. `warehouseManagement.warehouse.warehouseInfo.view`
  113. " @click="editlist(scope.row)">编辑</div>
  114. </template>
  115. </el-table-column>
  116. </el-table>
  117. <el-pagination
  118. @size-change="handleSizeChange"
  119. @current-change="handleCurrentChange"
  120. :current-page="currentPage"
  121. :page-size="deptCircularPage.pageSize"
  122. layout="total, sizes, prev, pager, next, jumper"
  123. :total="deptBudgetTotal"
  124. >
  125. </el-pagination>
  126. <WinseaContentModal
  127. v-model="accessoryTFs"
  128. :title="$t('system.noticeCircular.information')"
  129. @on-cancel="handleClose"
  130. >
  131. <ws-upload
  132. ref="upload"
  133. :comp-id="compId"
  134. :appendix-ids="appendixIdss"
  135. :editable="false"
  136. accept=".jpg, .jpeg, .png, .pdf, .doc, .zip, .rar"
  137. />
  138. </WinseaContentModal>
  139. <el-dialog :title="dialogtitle" :visible.sync="addvisible">
  140. <el-form label-width="140px" label-position='right'>
  141. <el-form-item label="费用名称" >
  142. <el-input v-model="expenseName" autocomplete="off"></el-input>
  143. </el-form-item>
  144. <el-form-item label="金额" >
  145. <el-input v-model="amount" autocomplete="off"></el-input>
  146. </el-form-item>
  147. <el-form-item label="付款截图" >
  148. <ws-upload
  149. ref="upload"
  150. :comp-id="compId"
  151. :appendix-ids="applUrl"
  152. :size-limit="size"
  153. :limit='limit'
  154. @onChange="onChange"
  155. accept=".jpg, .jpeg, .png, .pdf, .doc, .zip, .rar"
  156. />
  157. </el-form-item>
  158. </el-form>
  159. <div slot="footer" class="dialog-footer">
  160. <el-button @click="addvisible = false">取 消</el-button>
  161. <el-button type="primary" @click="addInventory">确 定</el-button>
  162. </div>
  163. </el-dialog>
  164. </div>
  165. </template>
  166. <script>
  167. import {
  168. selectWarehouseSelf
  169. } from '@/model/houseSelfCollect/index'
  170. import {
  171. getinventory,
  172. addinventory,
  173. editinventory,
  174. editcost,
  175. export1,
  176. editstatus,
  177. billoperatehis,
  178. clearancee,
  179. } from '@/model/warehouse/index'
  180. import { downloadFile } from '@/utils/batchDown'
  181. import Pagination from '@/components/Pagination'
  182. import WsUpload from '@/components/WsUpload'
  183. import { EventBus } from 'base-core-lib'
  184. export default {
  185. name: 'viewSpareMoney',
  186. components: {
  187. WsUpload,
  188. Pagination,
  189. },
  190. watch: {
  191. vesselId(val) {
  192. this.getList()
  193. },
  194. isShow(val) {
  195. this.showType = val
  196. },
  197. },
  198. data() {
  199. return {
  200. currectPage:1,
  201. pageSize:10,
  202. //弹出框
  203. dialogViewSpareMoney: false,
  204. dialogApproveFormVisible: false,
  205. // 船舶类型
  206. monetaryKey: null,
  207. // 表格显示数据
  208. tableDate: [],
  209. expenseName:'',
  210. yearList:[],
  211. dialogtitle:'',
  212. appendixIdss:[],
  213. amount:'',
  214. applUrl:'',
  215. price:'',
  216. costDate:'',
  217. // 是否显示
  218. showType: true,
  219. // 年
  220. year: '',
  221. searchType: 1,
  222. searchTypeText: '未完成',
  223. searchKeyWord: '',
  224. contractType: 2,
  225. currentPage:1,
  226. warehouseType: '1',
  227. // 提交类型
  228. submitType: true,
  229. size: 10,
  230. limit:1,
  231. spanArr: [],
  232. id:0,
  233. warehouseName: '',
  234. warehouseId:'',
  235. forbidden:false,
  236. forbidden1:false,
  237. addvisible:false,
  238. compId: sessionStorage.getItem('ws-pf_compId'),
  239. deptCircularPage: {},
  240. warehouseList: [],
  241. warehouseList1: [],
  242. deptBudgetList: {},
  243. historyList: [],
  244. count:0,
  245. deptBudgetTotal: 0,
  246. pickerBeginDateBefore: {
  247. disabledDate: (time) => {
  248. return time.getTime() > Date.now()
  249. },
  250. },
  251. accessoryTFs: false,
  252. }
  253. },
  254. activated() {
  255. this.year=new Date().getFullYear()
  256. for(var i=2021;i<=this.year;i++){
  257. this.yearList.push({value:i})
  258. }
  259. if(this.year>=new Date().getFullYear()){
  260. this.forbidden1=true
  261. }
  262. if(this.year<=2021){
  263. this.forbidden=true
  264. }
  265. this.selectWarehouse()
  266. // this.getList()
  267. this.showType = this.isShow
  268. },
  269. methods: {
  270. returnsales(){
  271. this.$router.go(-1)
  272. },
  273. fujian(row) {
  274. if (row.applUrl === null || row.applUrl === '') {
  275. EventBus.$emit(
  276. 'warning',
  277. this.$t('system.noticeCircular.NoInformation')
  278. )
  279. }
  280. this.appendixIdss = row.applUrl
  281. this.accessoryTFs = true
  282. },
  283. uploadSuccessHandle(e){
  284. this.applUrl=e.url
  285. },
  286. counttotal(){
  287. for (let i = 0; i < this.warehouseList.records.length; i++) {
  288. this.count+=this.warehouseList.records[i].amount
  289. }
  290. },
  291. onChange() {
  292. this.$refs.upload
  293. .handleSaveBill()
  294. .then(async response => {
  295. this.applUrl = response
  296. })
  297. .catch(res => {
  298. EventBus.$emit('error', (JSON.parse(res) || {}).message)
  299. this.$refs.upload.clearFiles()
  300. })
  301. },
  302. minus(){
  303. if(this.year<=2021){
  304. this.forbidden=true
  305. }else{
  306. this.year--
  307. }
  308. },
  309. add(){
  310. if(this.year>=new Date().getFullYear()){
  311. this.forbidden1=true
  312. }else{
  313. this.year++
  314. }
  315. },
  316. addInventory(){
  317. if(!this.expenseName){
  318. this.$message({
  319. message: '费用名称不能为空!',
  320. type: 'warning'
  321. })
  322. return
  323. }
  324. if(this.expenseName.length<1||this.expenseName.length>10){
  325. this.$message({
  326. message: '费用名称1-10个字!',
  327. type: 'warning'
  328. })
  329. return
  330. }
  331. if(!this.amount){
  332. this.$message({
  333. message: '金额不能为空!',
  334. type: 'warning'
  335. })
  336. return
  337. }
  338. if(this.amount<0||this.amount>100000000){
  339. this.$message({
  340. message: '金额输入错误!',
  341. type: 'warning'
  342. })
  343. return
  344. }
  345. addinventory({applUrl:this.applUrl,expenseName:this.expenseName,amount:this.amount,warehouseId:this.cangid,warehouseName:this.warehouseName}).toPromise()
  346. .then((response) => {
  347. this.$notify.success({
  348. title: '成功',
  349. message: '添加成功',
  350. })
  351. this.addvisible=false
  352. this.getList()
  353. })
  354. },
  355. editInventory(){
  356. if(!this.expenseName){
  357. this.$message({
  358. message: '费用名称不能为空!',
  359. type: 'warning'
  360. })
  361. return
  362. }
  363. if(this.expenseName.length<1||this.expenseName.length>10){
  364. this.$message({
  365. message: '费用名称1-10个字!',
  366. type: 'warning'
  367. })
  368. return
  369. }
  370. if(!this.amount){
  371. this.$message({
  372. message: '金额不能为空!',
  373. type: 'warning'
  374. })
  375. return
  376. }
  377. if(this.amount<0||this.amount>100000000){
  378. this.$message({
  379. message: '金额输入错误!',
  380. type: 'warning'
  381. })
  382. return
  383. }
  384. editinventory({applUrl:this.applUrl,expenseName:this.expenseName,amount:this.amount,warehouseId:this.cangid,warehouseName:this.warehouseName}).toPromise()
  385. .then((response) => {
  386. this.$notify.success({
  387. title: '成功',
  388. message: '编辑成功',
  389. })
  390. this.addvisible=false
  391. this.getList()
  392. })
  393. },
  394. yearChange(){
  395. },
  396. addlist(){
  397. this.addvisible=true
  398. this.dialogtitle='添加费用'
  399. },
  400. editlist(item){
  401. this.addvisible=true
  402. this.dialogtitle='编辑费用'
  403. this.id=item.id
  404. this.applUrl=item.applUrl
  405. this.expenseName=item.expenseName
  406. this.amount=item.amount
  407. },
  408. warehouselocation(){
  409. this.$router.push({ path: 'warehouselocation' })
  410. },
  411. warehouseNameChange(e) {
  412. for(let i = 0 ; i < this.warehouseList1.length; i++){
  413. if(this.warehouseList1[i].value == e){
  414. this.warehouseName = this.warehouseList1[i].value
  415. this.warehouseCount = this.warehouseList1[i].count
  416. this.warehouseNo = this.warehouseList1[i].No
  417. this.cangid = this.warehouseList1[i].id
  418. this.WAREHOUSE[1].payname = this.warehouseList1[i].value
  419. this.purchasePriceList = this.warehouseList1[i].purchasePriceList
  420. }
  421. }
  422. this.getList()
  423. },
  424. edit(item){
  425. this.price=item.cost
  426. this.editvisible=true
  427. this.id=item.id
  428. },
  429. editprice(){
  430. this.$confirm(`加权成本价格修改后不可恢复,确认提交`, {
  431. confirmButtonText: '确定',
  432. cancelButtonText: '取消',
  433. type: 'warning',
  434. })
  435. .then(() => {
  436. editcost({id:this.id,cost:this.price}).toPromise()
  437. .then((response) => {
  438. this.$notify.success({
  439. title: '成功',
  440. message: '价格修改成功',
  441. })
  442. this.editvisible=false
  443. this.getList()
  444. })
  445. })
  446. },
  447. //查看
  448. handleLook() {
  449. this.$router.push({ path: 'warehouseManagementLook' })
  450. },
  451. //添加
  452. handleAdd() {
  453. this.$router.push({ path: 'warehouseManagementAdd' })
  454. },
  455. //编辑
  456. handleEdit() {
  457. this.$router.push({ path: 'warehouseManagementEdit' })
  458. },
  459. handleDelete() {
  460. this.$router.push({ path: 'warehouseManagementDelete' })
  461. },
  462. //任务
  463. handlTask(){
  464. this.$router.push({ path: 'tranManagementWarehouseInOutTask' })
  465. },
  466. handleClose() {
  467. this.accessoryTFs = false
  468. },
  469. handleSizeChange(val) {
  470. console.log(`每页 ${val} 条`)
  471. this.pageSize = val
  472. this.getList()
  473. },
  474. handleCurrentChange(val) {
  475. this.currentPage = val
  476. console.log(`当前页: ${val}`)
  477. this.getList()
  478. },
  479. selectWarehouse(){
  480. selectWarehouseSelf({
  481. compId: sessionStorage.getItem('ws-pf_compId'),
  482. })
  483. .toPromise()
  484. .then((response) => {
  485. this.warehouseList1 = []
  486. for (let i = 0; i < response.length; i++) {
  487. this.warehouseList1.push({
  488. value: response[i].warehouseName,
  489. id: response[i].id,
  490. count: response[i].count,
  491. purchasePriceList: response[i].purchasePriceList,
  492. No:response[i].commonWarehouseNo
  493. })
  494. if (this.cangid&&this.cangid == response[i].id) {
  495. this.warehouseName = response[i].warehouseName
  496. this.warehouseCount = response[i].count
  497. this.warehouseNo = response[i].commonWarehouseNo
  498. this.purchasePriceList = response[i].purchasePriceList
  499. }
  500. }
  501. if(this.warehouseList1.length > 0 && !this.cangid){
  502. this.warehouseName = this.warehouseList1[0].value
  503. this.warehouseCount = this.warehouseList1[0].count
  504. this.warehouseNo = this.warehouseList1[0].No
  505. this.cangid = this.warehouseList1[0].id
  506. this.purchasePriceList = this.warehouseList1[0].purchasePriceList
  507. this.WAREHOUSE[1].payname = this.warehouseList1[0].value
  508. }
  509. this.getList()
  510. })
  511. },
  512. getList() {
  513. getinventory({
  514. compId: sessionStorage.getItem('ws-pf_compId'),
  515. warehouseId: this.cangid,
  516. year: this.year,
  517. currectPage:this.currectPage,
  518. pageSize:this.pageSize
  519. })
  520. .toPromise()
  521. .then((response) => {
  522. this.warehouseList = response
  523. this.counttotal()
  524. })
  525. },
  526. editClick(row) {
  527. var status = ''
  528. if (row.status == '待执行' || row.status == '已完成') {
  529. status = '执行中'
  530. } else if (row.status == '执行中') {
  531. status = '已完成'
  532. }
  533. //cancelButtonClass: "btn-custom-cancel"
  534. this.$confirm(`是否将状态改为${status}`, {
  535. confirmButtonText: '确定',
  536. cancelButtonText: '取消',
  537. type: 'warning',
  538. })
  539. .then(() => {
  540. editstatus({ id: row.id })
  541. .toPromise()
  542. .then((response) => {
  543. this.$notify.success({
  544. title: '成功',
  545. message: '状态修改成功',
  546. })
  547. this.getList()
  548. })
  549. .catch((response) => {
  550. // EventBus.$emit('error', this.$t('showMessage.asteriskRequired'))
  551. })
  552. })
  553. .catch(() => {
  554. return false
  555. })
  556. },
  557. selecttaskType(e) {
  558. for (var i = 0; i < this.taskTypeList.length; i++) {
  559. if (this.taskTypeList[i].value == e) {
  560. this.searchType = this.taskTypeList[i].type
  561. }
  562. }
  563. },
  564. handleExamine(row) {
  565. this.$router.push({
  566. name: 'salesContractExamine',
  567. query: { id: row.id },
  568. })
  569. },
  570. // 关闭 dialog时 处理文件url 初始化upload组件
  571. handleCloe() {
  572. this.dialogViewSpareMoney = false
  573. },
  574. history(row) {
  575. billoperatehis({ id: row.id })
  576. .toPromise()
  577. .then((response) => {
  578. this.historyList = response
  579. })
  580. },
  581. find() {
  582. this.currentPage = 1
  583. this.getList()
  584. },
  585. async exportlist() {
  586. const { data } = await export1(
  587. {
  588. compId: sessionStorage.getItem('ws-pf_compId'),
  589. contractType: this.contractType,
  590. currentPage: this.currentPage,
  591. pageSize: this.pageSize,
  592. searchType: this.searchType,
  593. searchKeyWord: this.searchKeyWord,
  594. startDate: this.startDate,
  595. endDate: this.endDate,
  596. },
  597. {},
  598. { responseType: 'blob' }
  599. ).toPromise()
  600. downloadFile({
  601. res: data,
  602. fileName: `${
  603. this.date.year + (this.date.month ? `-${this.date.month}` : '')
  604. }_采购合同`,
  605. type: 'xls',
  606. })
  607. },
  608. },
  609. }
  610. </script>
  611. <style lang="scss" scoped>
  612. .connert {
  613. width: 90%;
  614. margin: 0 auto;
  615. }
  616. .bg-left {
  617. padding-left: 30px;
  618. }
  619. .bg-right {
  620. text-align: right;
  621. padding: 16px 20px;
  622. }
  623. .el-icon-arrow-left,.el-icon-arrow-right{
  624. font-size:24px;
  625. }
  626. .vertical-text-left {
  627. width: 62px;
  628. text-align: right;
  629. }
  630. .el-button--primary {
  631. background-color: #5878e8;
  632. border-color: #5878e8;
  633. }
  634. .el-button--default {
  635. color: #8890b1;
  636. border-color: #e8eaf1;
  637. }
  638. /deep/.base_header_layout .grid-content.right .find.el-button--primary {
  639. width: 30px;
  640. margin-left: 0;
  641. border-top-left-radius: 0px;
  642. border-bottom-left-radius: 0px;
  643. }
  644. /deep/.findValue .el-input__inner {
  645. border-top-right-radius: 0px;
  646. border-bottom-right-radius: 0px;
  647. }
  648. .completed.el-button--default {
  649. border-color: #5878e8;
  650. background-color: #f6f7fc;
  651. color: #5878e8;
  652. }
  653. .putstorage.el-button--default,
  654. .deliverystorage.el-button--default {
  655. border-color: #8890b1;
  656. background-color: #fff;
  657. color: #8890b1;
  658. }
  659. /deep/.el-table td,
  660. /deep/.el-table th.is-leaf {
  661. border-right: 1px solid #e9ecf7;
  662. text-align: center;
  663. }
  664. /deep/.el-table tr td:first-child,
  665. /deep/.el-table tr th.is-leaf:first-child {
  666. border-left: 1px solid #e9ecf7;
  667. }
  668. /deep/.el-table .el-table__header .cell,
  669. /deep/.el-table .el-table__body .cell {
  670. -webkit-line-clamp: 10;
  671. max-height: 400px;
  672. }
  673. .record,
  674. .adjustment {
  675. display: inline-block;
  676. color: #5878e8;
  677. padding: 0 4px !important;
  678. position: relative;
  679. }
  680. .record:after {
  681. position: absolute;
  682. content: '';
  683. display: block;
  684. top: 5px;
  685. right: -2px;
  686. width: 1px;
  687. height: 12px;
  688. background: #e9ecf7;
  689. }
  690. /deep/.el-radio-button:first-child .el-radio-button__inner {
  691. margin-left: 10px;
  692. }
  693. //分页
  694. .el-pagination {
  695. text-align: center;
  696. white-space: nowrap;
  697. padding: 2px 5px;
  698. color: #303133;
  699. font-weight: 700;
  700. margin-bottom: 20px;
  701. }
  702. .forbidden{
  703. cursor: not-allowed;
  704. }
  705. .avatar-uploader .el-upload {
  706. border: 1px dashed #d9d9d9;
  707. border-radius: 6px;
  708. cursor: pointer;
  709. position: relative;
  710. overflow: hidden;
  711. }
  712. .avatar-uploader .el-upload:hover {
  713. border-color: #409EFF;
  714. }
  715. .avatar-uploader-icon {
  716. font-size: 28px;
  717. color: #8c939d;
  718. width: 178px;
  719. height: 178px;
  720. line-height: 178px;
  721. text-align: center;
  722. }
  723. .avatar {
  724. width: 178px;
  725. height: 178px;
  726. display: block;
  727. }
  728. </style>