warehouselocation.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730
  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="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. start:2021,
  236. forbidden:false,
  237. forbidden1:false,
  238. addvisible:false,
  239. compId: sessionStorage.getItem('ws-pf_compId'),
  240. deptCircularPage: {},
  241. warehouseList: [],
  242. warehouseList1: [],
  243. deptBudgetList: {},
  244. historyList: [],
  245. count:0,
  246. deptBudgetTotal: 0,
  247. pickerBeginDateBefore: {
  248. disabledDate: (time) => {
  249. return time.getTime() > Date.now()
  250. },
  251. },
  252. accessoryTFs: false,
  253. }
  254. },
  255. activated() {
  256. this.year=new Date().getFullYear()
  257. for(var i=this.start;i<=this.year;i++){
  258. this.yearList.push({value:i})
  259. }
  260. if(this.year>=new Date().getFullYear()){
  261. this.forbidden1=true
  262. }
  263. if(this.year<=this.start){
  264. this.forbidden=true
  265. }
  266. this.selectWarehouse()
  267. // this.getList()
  268. this.showType = this.isShow
  269. },
  270. methods: {
  271. returnsales(){
  272. this.$router.go(-1)
  273. },
  274. fujian(row) {
  275. if (row.applUrl === null || row.applUrl === '') {
  276. EventBus.$emit(
  277. 'warning',
  278. this.$t('system.noticeCircular.NoInformation')
  279. )
  280. }
  281. this.appendixIdss = row.applUrl
  282. this.accessoryTFs = true
  283. },
  284. uploadSuccessHandle(e){
  285. this.applUrl=e.url
  286. },
  287. counttotal(){
  288. for (let i = 0; i < this.warehouseList.records.length; i++) {
  289. this.count+=this.warehouseList.records[i].amount
  290. }
  291. },
  292. onChange() {
  293. this.$refs.upload
  294. .handleSaveBill()
  295. .then(async response => {
  296. this.applUrl = response
  297. })
  298. .catch(res => {
  299. EventBus.$emit('error', (JSON.parse(res) || {}).message)
  300. this.$refs.upload.clearFiles()
  301. })
  302. },
  303. minus(){
  304. if(this.year<=this.start){
  305. this.forbidden=true
  306. }else{
  307. this.year--
  308. }
  309. },
  310. add(){
  311. if(this.year>=new Date().getFullYear()){
  312. this.forbidden1=true
  313. }else{
  314. this.year++
  315. }
  316. },
  317. addInventory(){
  318. if(!this.expenseName){
  319. this.$message({
  320. message: '费用名称不能为空!',
  321. type: 'warning'
  322. })
  323. return
  324. }
  325. if(this.expenseName.length<1||this.expenseName.length>10){
  326. this.$message({
  327. message: '费用名称1-10个字!',
  328. type: 'warning'
  329. })
  330. return
  331. }
  332. if(!this.amount){
  333. this.$message({
  334. message: '金额不能为空!',
  335. type: 'warning'
  336. })
  337. return
  338. }
  339. if(this.amount<0||this.amount>100000000||(String(this.amount).indexOf('.') != -1 &&
  340. String(this.amount).length -
  341. (String(this.amount).indexOf('.') +1) >
  342. 2)){
  343. this.$message({
  344. message: '金额输入错误!',
  345. type: 'warning'
  346. })
  347. return
  348. }
  349. addinventory({applUrl:this.applUrl,expenseName:this.expenseName,amount:this.amount,warehouseId:this.cangid,warehouseName:this.warehouseName}).toPromise()
  350. .then((response) => {
  351. this.$notify.success({
  352. title: '成功',
  353. message: '添加成功',
  354. })
  355. this.addvisible=false
  356. this.expenseName=''
  357. this.amount=''
  358. this.applUrl=''
  359. this.getList()
  360. })
  361. },
  362. editInventory(){
  363. if(!this.expenseName){
  364. this.$message({
  365. message: '费用名称不能为空!',
  366. type: 'warning'
  367. })
  368. return
  369. }
  370. if(this.expenseName.length<1||this.expenseName.length>10){
  371. this.$message({
  372. message: '费用名称1-10个字!',
  373. type: 'warning'
  374. })
  375. return
  376. }
  377. if(!this.amount){
  378. this.$message({
  379. message: '金额不能为空!',
  380. type: 'warning'
  381. })
  382. return
  383. }
  384. if(this.amount<0||this.amount>100000000){
  385. this.$message({
  386. message: '金额输入错误!',
  387. type: 'warning'
  388. })
  389. return
  390. }
  391. editinventory({applUrl:this.applUrl,expenseName:this.expenseName,amount:this.amount,warehouseId:this.cangid,warehouseName:this.warehouseName}).toPromise()
  392. .then((response) => {
  393. this.$notify.success({
  394. title: '成功',
  395. message: '编辑成功',
  396. })
  397. this.addvisible=false
  398. this.expenseName=''
  399. this.amount=''
  400. this.applUrl=''
  401. this.getList()
  402. })
  403. },
  404. yearChange(){
  405. },
  406. addlist(){
  407. this.addvisible=true
  408. this.dialogtitle='添加费用'
  409. },
  410. editlist(item){
  411. this.addvisible=true
  412. this.dialogtitle='编辑费用'
  413. this.id=item.id
  414. this.applUrl=item.applUrl
  415. this.expenseName=item.expenseName
  416. this.amount=item.amount
  417. },
  418. warehouselocation(){
  419. this.$router.push({ path: 'warehouselocation' })
  420. },
  421. warehouseNameChange(e) {
  422. for(let i = 0 ; i < this.warehouseList1.length; i++){
  423. if(this.warehouseList1[i].value == e){
  424. this.warehouseName = this.warehouseList1[i].value
  425. this.warehouseCount = this.warehouseList1[i].count
  426. this.warehouseNo = this.warehouseList1[i].No
  427. this.cangid = this.warehouseList1[i].id
  428. this.WAREHOUSE[1].payname = this.warehouseList1[i].value
  429. this.purchasePriceList = this.warehouseList1[i].purchasePriceList
  430. }
  431. }
  432. this.getList()
  433. },
  434. edit(item){
  435. this.price=item.cost
  436. this.editvisible=true
  437. this.id=item.id
  438. },
  439. editprice(){
  440. this.$confirm(`加权成本价格修改后不可恢复,确认提交`, {
  441. confirmButtonText: '确定',
  442. cancelButtonText: '取消',
  443. type: 'warning',
  444. })
  445. .then(() => {
  446. editcost({id:this.id,cost:this.price}).toPromise()
  447. .then((response) => {
  448. this.$notify.success({
  449. title: '成功',
  450. message: '价格修改成功',
  451. })
  452. this.editvisible=false
  453. this.getList()
  454. })
  455. })
  456. },
  457. handleClose() {
  458. this.accessoryTFs = false
  459. },
  460. handleSizeChange(val) {
  461. console.log(`每页 ${val} 条`)
  462. this.pageSize = val
  463. this.getList()
  464. },
  465. handleCurrentChange(val) {
  466. this.currentPage = val
  467. console.log(`当前页: ${val}`)
  468. this.getList()
  469. },
  470. selectWarehouse(){
  471. selectWarehouseSelf({
  472. compId: sessionStorage.getItem('ws-pf_compId'),
  473. })
  474. .toPromise()
  475. .then((response) => {
  476. this.warehouseList1 = []
  477. for (let i = 0; i < response.length; i++) {
  478. this.warehouseList1.push({
  479. value: response[i].warehouseName,
  480. id: response[i].id,
  481. count: response[i].count,
  482. purchasePriceList: response[i].purchasePriceList,
  483. No:response[i].commonWarehouseNo
  484. })
  485. if (this.cangid&&this.cangid == response[i].id) {
  486. this.warehouseName = response[i].warehouseName
  487. this.warehouseCount = response[i].count
  488. this.warehouseNo = response[i].commonWarehouseNo
  489. this.purchasePriceList = response[i].purchasePriceList
  490. }
  491. }
  492. if(this.warehouseList1.length > 0 && !this.cangid){
  493. this.warehouseName = this.warehouseList1[0].value
  494. this.warehouseCount = this.warehouseList1[0].count
  495. this.warehouseNo = this.warehouseList1[0].No
  496. this.cangid = this.warehouseList1[0].id
  497. this.purchasePriceList = this.warehouseList1[0].purchasePriceList
  498. this.WAREHOUSE[1].payname = this.warehouseList1[0].value
  499. }
  500. this.getList()
  501. })
  502. },
  503. getList() {
  504. getinventory({
  505. compId: sessionStorage.getItem('ws-pf_compId'),
  506. warehouseId: this.cangid,
  507. year: this.year,
  508. currectPage:this.currectPage,
  509. pageSize:this.pageSize
  510. })
  511. .toPromise()
  512. .then((response) => {
  513. this.warehouseList = response
  514. this.deptBudgetTotal=response.total
  515. this.counttotal()
  516. })
  517. },
  518. editClick(row) {
  519. var status = ''
  520. if (row.status == '待执行' || row.status == '已完成') {
  521. status = '执行中'
  522. } else if (row.status == '执行中') {
  523. status = '已完成'
  524. }
  525. //cancelButtonClass: "btn-custom-cancel"
  526. this.$confirm(`是否将状态改为${status}`, {
  527. confirmButtonText: '确定',
  528. cancelButtonText: '取消',
  529. type: 'warning',
  530. })
  531. .then(() => {
  532. editstatus({ id: row.id })
  533. .toPromise()
  534. .then((response) => {
  535. this.$notify.success({
  536. title: '成功',
  537. message: '状态修改成功',
  538. })
  539. this.getList()
  540. })
  541. .catch((response) => {
  542. // EventBus.$emit('error', this.$t('showMessage.asteriskRequired'))
  543. })
  544. })
  545. .catch(() => {
  546. return false
  547. })
  548. },
  549. selecttaskType(e) {
  550. for (var i = 0; i < this.taskTypeList.length; i++) {
  551. if (this.taskTypeList[i].value == e) {
  552. this.searchType = this.taskTypeList[i].type
  553. }
  554. }
  555. },
  556. handleExamine(row) {
  557. this.$router.push({
  558. name: 'salesContractExamine',
  559. query: { id: row.id },
  560. })
  561. },
  562. // 关闭 dialog时 处理文件url 初始化upload组件
  563. handleCloe() {
  564. this.dialogViewSpareMoney = false
  565. },
  566. history(row) {
  567. billoperatehis({ id: row.id })
  568. .toPromise()
  569. .then((response) => {
  570. this.historyList = response
  571. })
  572. },
  573. find() {
  574. this.currentPage = 1
  575. this.getList()
  576. },
  577. async exportlist() {
  578. const { data } = await export1(
  579. {
  580. compId: sessionStorage.getItem('ws-pf_compId'),
  581. contractType: this.contractType,
  582. currentPage: this.currentPage,
  583. pageSize: this.pageSize,
  584. searchType: this.searchType,
  585. searchKeyWord: this.searchKeyWord,
  586. startDate: this.startDate,
  587. endDate: this.endDate,
  588. },
  589. {},
  590. { responseType: 'blob' }
  591. ).toPromise()
  592. downloadFile({
  593. res: data,
  594. fileName: `${
  595. this.date.year + (this.date.month ? `-${this.date.month}` : '')
  596. }_采购合同`,
  597. type: 'xls',
  598. })
  599. },
  600. },
  601. }
  602. </script>
  603. <style lang="scss" scoped>
  604. .connert {
  605. width: 90%;
  606. margin: 0 auto;
  607. }
  608. .bg-left {
  609. padding-left: 30px;
  610. }
  611. .bg-right {
  612. text-align: right;
  613. padding: 16px 20px;
  614. }
  615. .el-icon-arrow-left,.el-icon-arrow-right{
  616. font-size:24px;
  617. }
  618. .vertical-text-left {
  619. width: 62px;
  620. text-align: right;
  621. }
  622. .el-button--primary {
  623. background-color: #5878e8;
  624. border-color: #5878e8;
  625. }
  626. .el-button--default {
  627. color: #8890b1;
  628. border-color: #e8eaf1;
  629. }
  630. /deep/.base_header_layout .grid-content.right .find.el-button--primary {
  631. width: 30px;
  632. margin-left: 0;
  633. border-top-left-radius: 0px;
  634. border-bottom-left-radius: 0px;
  635. }
  636. /deep/.findValue .el-input__inner {
  637. border-top-right-radius: 0px;
  638. border-bottom-right-radius: 0px;
  639. }
  640. .completed.el-button--default {
  641. border-color: #5878e8;
  642. background-color: #f6f7fc;
  643. color: #5878e8;
  644. }
  645. .putstorage.el-button--default,
  646. .deliverystorage.el-button--default {
  647. border-color: #8890b1;
  648. background-color: #fff;
  649. color: #8890b1;
  650. }
  651. /deep/.el-table td,
  652. /deep/.el-table th.is-leaf {
  653. border-right: 1px solid #e9ecf7;
  654. text-align: center;
  655. }
  656. /deep/.el-table tr td:first-child,
  657. /deep/.el-table tr th.is-leaf:first-child {
  658. border-left: 1px solid #e9ecf7;
  659. }
  660. /deep/.el-table .el-table__header .cell,
  661. /deep/.el-table .el-table__body .cell {
  662. -webkit-line-clamp: 10;
  663. max-height: 400px;
  664. }
  665. .record,
  666. .adjustment {
  667. display: inline-block;
  668. color: #5878e8;
  669. padding: 0 4px !important;
  670. position: relative;
  671. }
  672. .record:after {
  673. position: absolute;
  674. content: '';
  675. display: block;
  676. top: 5px;
  677. right: -2px;
  678. width: 1px;
  679. height: 12px;
  680. background: #e9ecf7;
  681. }
  682. /deep/.el-radio-button:first-child .el-radio-button__inner {
  683. margin-left: 10px;
  684. }
  685. //分页
  686. .el-pagination {
  687. text-align: center;
  688. white-space: nowrap;
  689. padding: 2px 5px;
  690. color: #303133;
  691. font-weight: 700;
  692. margin-bottom: 20px;
  693. }
  694. .forbidden{
  695. cursor: not-allowed;
  696. }
  697. .avatar-uploader .el-upload {
  698. border: 1px dashed #d9d9d9;
  699. border-radius: 6px;
  700. cursor: pointer;
  701. position: relative;
  702. overflow: hidden;
  703. }
  704. .avatar-uploader .el-upload:hover {
  705. border-color: #409EFF;
  706. }
  707. .avatar-uploader-icon {
  708. font-size: 28px;
  709. color: #8c939d;
  710. width: 178px;
  711. height: 178px;
  712. line-height: 178px;
  713. text-align: center;
  714. }
  715. .avatar {
  716. width: 178px;
  717. height: 178px;
  718. display: block;
  719. }
  720. </style>