tranManagementWarehouseInOutTask.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665
  1. <!--出入库任务-->
  2. <template>
  3. <div class="container">
  4. <BaseHeaderLayout :leftSpan="12">
  5. <template slot="left">
  6. <ws-button type="primary" @click="handleAdd()" v-hasPermission="
  7. `warehouseManagement.warehouse.warehouseInfoTask.add`
  8. ">添加
  9. </ws-button>
  10. </template>
  11. <template slot="right">
  12. <span style="width: 98px; display: inline-block; color: #8890b1">状态:</span>
  13. <ws-select v-model="searchTypeText" placeholder class="typeselect" @change="selecttaskType" :value="searchType">
  14. <ws-option v-for="item in taskTypeList" :key="item.value" :label="item.value" :value="item.value"
  15. style="color: #8890b1" />
  16. </ws-select>
  17. <ws-select v-model="inOutType" placeholder class="typeselect" @change="selectinOutType" :value="inOutType">
  18. <ws-option v-for="item in inOutTypeList" :key="item.value" :label="item.value" :value="item.value"
  19. style="color: #8890b1" />
  20. </ws-select>
  21. <ws-input @keyup.enter.native="find()" class='findValue' v-model="searchKeyWord" placeholder="可按合同编号或任务编号查找" clearable maxlength="500" type="input"></ws-input>
  22. <ws-button class="find" type="primary" @click="lookUp()">
  23. <img width="16" height="16" style="
  24. vertical-align: text-top;
  25. position: relative;
  26. top: 0px;
  27. left: -8px;
  28. " src="../../../public/img/sousuo.png" alt />
  29. </ws-button>
  30. </template>
  31. </BaseHeaderLayout>
  32. <el-table class="wenzi" :data="gainList.records" style="width: 100%" height="calc(100% - 110px)">
  33. <el-table-column type="index" label="序号">
  34. <template scope="scope">
  35. <span v-if="scope.$index < 9">0{{ scope.$index + 1 }}</span>
  36. <span v-else>{{ scope.$index + 1 }}</span>
  37. </template>
  38. </el-table-column>
  39. <el-table-column prop="inOutTaskNo" label="任务编号" width="160"></el-table-column>
  40. <el-table-column prop="contractNo" label="合同编号/移库编号" width="160">
  41. <template scope="scope">
  42. <div
  43. v-if="
  44. scope.row.inOutType == '移库入库' ||
  45. scope.row.inOutType == '移库出库'
  46. "
  47. >
  48. {{ scope.row.moveTaskNo }}
  49. </div>
  50. <div
  51. v-if="
  52. scope.row.inOutType != '移库入库' &&
  53. scope.row.inOutType != '移库出库'
  54. "
  55. >
  56. {{ scope.row.contractNo }}
  57. </div>
  58. </template>
  59. </el-table-column>
  60. <el-table-column prop="warehouseName" class="table_td" label="仓库名"></el-table-column>
  61. <el-table-column prop="inOutType" class="table_td" label="出入库类型"></el-table-column>
  62. <el-table-column prop="goodsName" class="table_td" label="货名"></el-table-column>
  63. <el-table-column prop="weight" class="table_td" label="重量(吨)"></el-table-column>
  64. <el-table-column prop="predictDate" class="table_td" label="预计日期"></el-table-column>
  65. <el-table-column prop="publisher" class="table_td" label="发布者"></el-table-column>
  66. <el-table-column prop="completedQuantity" class="table_td" label="已完成量(吨)">
  67. <template slot-scope="scope">
  68. {{scope.row.completedQuantity == 0 ? 0:scope.row.completedQuantity.toFixed(3)}}
  69. </template>
  70. </el-table-column>
  71. <el-table-column prop="taskStatus" label="状态" width="90">
  72. <template slot-scope="scope">
  73. <template>
  74. <span slot="reference">
  75. <span v-if="scope.row.taskStatus == '待审核'" class="executory"></span>
  76. <span v-if="scope.row.taskStatus == '执行中'" class="inExecution"></span>
  77. <span v-if="scope.row.taskStatus == '已完成'" class="done"></span>
  78. {{ scope.row.taskStatus }}
  79. </span>
  80. </template>
  81. <img v-if="scope.row.taskStatus == '执行中'" width="17" height="18"
  82. style="vertical-align: text-top; position: relative; top: -1px" src="../../../public/img/edit.png"
  83. @click="editClick(scope.row)" alt />
  84. </template>
  85. </el-table-column>
  86. <el-table-column prop="establishDate" class="table_td" label="创建时间" width="150"></el-table-column>
  87. <el-table-column prop="seller" label="操作" width="230">
  88. <template slot-scope="scope">
  89. <span class="corles" @click="nocomplete(scope.row)" v-hasPermission="
  90. `warehouseManagement.warehouse.warehouseInfoTask.View`
  91. ">查看</span>
  92. <span v-hasPermission="`warehouseManagement.warehouse.warehouseInfoTask.audit`">
  93. <el-divider direction="vertical" v-if="scope.row.taskStatus == '待审核'"></el-divider>
  94. </span>
  95. <span class="corles" v-hasPermission="
  96. `warehouseManagement.warehouse.warehouseInfoTask.audit`
  97. " v-if="scope.row.taskStatus == '待审核'&&scope.row.taskId" @click="audit(scope.row)">审核</span>
  98. <el-divider direction="vertical" class="divider" v-if="
  99. scope.row.taskStatus == '待审核'&&scope.row.taskId ||
  100. scope.row.taskStatus == '执行中' ||
  101. scope.row.taskStatus == '已驳回'
  102. "></el-divider>
  103. <span class="corles" v-hasPermission="
  104. `warehouseManagement.warehouse.warehouseInfoTask.edit`
  105. " v-if="
  106. scope.row.taskStatus == '执行中' ||
  107. scope.row.taskStatus == '已驳回'
  108. " @click="delivery(scope.row)">编辑</span>
  109. <span v-hasPermission="`warehouseManagement.warehouse.warehouseInfoTask.delete`">
  110. <el-divider direction="vertical" v-if=" scope.row.taskStatus == '执行中' ||
  111. scope.row.taskStatus == '已驳回'"></el-divider>
  112. </span>
  113. <span class="corles" v-hasPermission="
  114. `warehouseManagement.warehouse.warehouseInfoTask.delete`
  115. " v-if="scope.row.show" @click="rectify(scope.row)">矫正</span>
  116. <span v-hasPermission="`warehouseManagement.warehouse.warehouseInfoTask.delete`">
  117. <el-divider direction="vertical" v-if="scope.row.show"></el-divider>
  118. </span>
  119. <span class="corles" v-hasPermission="
  120. `warehouseManagement.warehouse.warehouseInfoTask.delete`
  121. " v-if="scope.row.taskId == null" @click="deleteclick(scope.row)">删除</span>
  122. </template>
  123. </el-table-column>
  124. </el-table>
  125. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
  126. :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="deptBudgetTotal"></el-pagination>
  127. </div>
  128. </template>
  129. <script>
  130. import {
  131. getoreditoutput,
  132. outdelete,
  133. movestates,
  134. setcorrect
  135. } from '@/model/tasksport/index'
  136. import {
  137. downloadFile
  138. } from '@/utils/batchDown'
  139. import Pagination from '@/components/Pagination'
  140. import WsUpload from '@/components/WsUpload'
  141. import {
  142. dayjs,
  143. fmoney,
  144. EventBus
  145. } from 'base-core-lib'
  146. export default {
  147. name: 'viewSpareMoney',
  148. components: {
  149. WsUpload,
  150. Pagination,
  151. },
  152. watch: {
  153. vesselId(val) {
  154. this.getList()
  155. },
  156. isShow(val) {
  157. this.showType = val
  158. },
  159. },
  160. data() {
  161. return {
  162. //弹出框
  163. dialogViewSpareMoney: false,
  164. dialogApproveFormVisible: false,
  165. // 船舶类型
  166. monetaryKey: null,
  167. // 表格显示数据
  168. tableDate: [],
  169. // 是否显示
  170. showType: true,
  171. // 年
  172. year: '',
  173. gainList: [],
  174. currentPage: 1,
  175. primary: '1',
  176. pageSize: 10,
  177. searchType: 1,
  178. searchTypeText: '待审核',
  179. searchKeyWord: '',
  180. inOutType:'',
  181. inOutTypeList:[
  182. {
  183. value: '销售出库',
  184. type: 1
  185. },
  186. {
  187. value: '移库出库',
  188. type: 3
  189. },
  190. {
  191. value: '暂存出库',
  192. type: 2
  193. },
  194. {
  195. value: '贸易服务出库',
  196. type: 4
  197. },
  198. {
  199. value: '采购出库',
  200. type: 5
  201. },
  202. {
  203. value: '采购入库',
  204. type: 6
  205. },
  206. {
  207. value: '移库入库',
  208. type: 7
  209. },
  210. {
  211. value: '暂存入库',
  212. type: 8
  213. },
  214. {
  215. value: '贸易服务入库',
  216. type: 9
  217. },
  218. {
  219. value: '退库',
  220. type: 10
  221. },
  222. ],
  223. contractType: 2,
  224. taskTypeList: [{
  225. value: '待审核',
  226. type: 1
  227. },
  228. {
  229. value: '执行中',
  230. type: 3
  231. },
  232. {
  233. value: '已驳回',
  234. type: 2
  235. },
  236. {
  237. value: '已完成',
  238. type: 4
  239. },
  240. {
  241. value: '全部任务',
  242. type: ''
  243. },
  244. ],
  245. // 提交类型
  246. submitType: true,
  247. size: 10,
  248. spanArr: [],
  249. warehouseName: '',
  250. deptBudgetTotal: 0,
  251. compId: localStorage.getItem('ws-pf_compId'),
  252. deptCircularPage: {},
  253. historyList: [],
  254. pickerBeginDateBefore: {
  255. disabledDate: (time) => {
  256. return time.getTime() > Date.now()
  257. },
  258. },
  259. accessoryTFs: false,
  260. }
  261. },
  262. activated() {
  263. this.getList()
  264. this.showType = this.isShow
  265. },
  266. mounted() {
  267. this.getList()
  268. this.showType = this.isShow
  269. },
  270. methods: {
  271. rectify(row){
  272. this.$confirm('确定矫正出库任务重量并结束任务?', {
  273. confirmButtonText: '确定',
  274. cancelButtonText: '取消',
  275. type: 'warning',
  276. })
  277. .then(() => {
  278. setcorrect({id:row.id}).toPromise()
  279. .then((response) => {
  280. this.$notify.success({
  281. title: '成功',
  282. message: '矫正成功',
  283. })
  284. this.getList()
  285. }).catch(() => {
  286. this.$notify.error({
  287. title: '失败',
  288. message: '矫正失败',
  289. })
  290. })
  291. }).catch(() => {
  292. return false
  293. })
  294. },
  295. selectinOutType(){
  296. this.getList()
  297. },
  298. //添加
  299. handleAdd() {
  300. this.$router.push({
  301. path: 'tranManagementWarehouseInOuttaskAdd'
  302. })
  303. },
  304. //查找
  305. lookUp() {
  306. this.currentPage = 1
  307. this.getList()
  308. },
  309. deleteclick(row) {
  310. var text = ''
  311. if (
  312. (row.taskTypeKey == 3 && row.inOutType == '移库出库') ||
  313. (row.taskTypeKey == 4 && row.inOutType == '销售出库') ||
  314. (row.taskTypeKey == 4 && row.inOutType == '退库')
  315. ) {
  316. text = '相同任务编号的任务将一并删除且不可恢复,是否确定删除?'
  317. } else {
  318. text = `任务删除后不可恢复,是否确定删除?`
  319. }
  320. //cancelButtonClass: "btn-custom-cancel"
  321. this.$confirm(text, {
  322. confirmButtonText: '确定',
  323. cancelButtonText: '取消',
  324. type: 'warning',
  325. })
  326. .then(() => {
  327. outdelete({
  328. id: row.id,
  329. relevanceId: row.relevanceId,
  330. inOutFlag: row.inOutFlag,
  331. })
  332. .toPromise()
  333. .then((response) => {
  334. this.getList()
  335. })
  336. })
  337. .catch(() => {
  338. return false
  339. })
  340. },
  341. getList() {
  342. getoreditoutput({
  343. compId: localStorage.getItem('ws-pf_compId'),
  344. currentPage: this.currentPage,
  345. pageSize: this.pageSize,
  346. searchType: this.searchType,
  347. searchKeyWord: this.searchKeyWord,
  348. inOutType:this.inOutType
  349. })
  350. .toPromise()
  351. .then((response) => {
  352. for (let i = 0; i < response.records.length; i++) {
  353. // response.records[i].completedQuantity=response.records[i].completedQuantity/1000
  354. if(response.records[i].taskStatus=='执行中'&&response.records[i].inOutType=='销售出库'&&response.records[i].taskTypeKey==1&&response.records[i].completedQuantity<response.records[i].weight
  355. ||response.records[i].taskStatus=='执行中'&&response.records[i].inOutType=='移库出库'&&response.records[i].completedQuantity<response.records[i].weight){
  356. response.records[i].show=true
  357. }else if(response.records[i].taskStatus=='已完成'&&response.records[i].inOutType=='销售出库'&&response.records[i].taskTypeKey==1&&response.records[i].completedQuantity<response.records[i].weight
  358. ||response.records[i].taskStatus=='执行中'&&response.records[i].inOutType=='移库出库'&&response.records[i].completedQuantity<response.records[i].weight){
  359. response.records[i].show=true
  360. }else{
  361. response.records[i].show=false
  362. }
  363. }
  364. this.gainList = response
  365. this.currentPage = response.current
  366. this.pageSize = response.size
  367. this.deptBudgetTotal = response.total
  368. })
  369. },
  370. //编辑
  371. delivery(item) {
  372. this.$router.push({
  373. path: 'tranManagementWarehouseInOuttaskedit',
  374. query: {
  375. relevanceId: item.relevanceId,
  376. inOutFlag: item.inOutFlag
  377. },
  378. })
  379. },
  380. audit(item) {
  381. this.$router.push({
  382. path: 'tranManagementWarehouseInOuttaskaudit',
  383. query: {
  384. relevanceId: item.relevanceId,
  385. taskId: item.taskId,
  386. businessKey: item.id,
  387. workflowId: item.workflowId,
  388. },
  389. })
  390. },
  391. getSpanArr(data) {
  392. let that = this
  393. //页面展示的数据,不一定是全部的数据,所以每次都清空之前存储的 保证遍历的数据是最新的数据。以免造成数据渲染混乱
  394. that.spanArr = []
  395. that.pos = 0
  396. //遍历数据
  397. data.forEach((item, index) => {
  398. //判断是否是第一项
  399. // if (index === 0) {
  400. // this.spanArr.push(1)
  401. // this.pos = 0
  402. // } else {
  403. //不是第一项时,就根据标识去存储
  404. if (data[index].warehouseNumViewList.length > 1) {
  405. // 查找到符合条件的数据时每次要把之前存储的数据+1
  406. this.spanArr[this.pos] = data[index].warehouseNumViewList.length
  407. this.spanArr.push(0)
  408. } else {
  409. // 没有符合的数据时,要记住当前的index
  410. this.spanArr.push(1)
  411. this.pos = index
  412. }
  413. // }
  414. })
  415. },
  416. //查看//传参
  417. nocomplete(row) {
  418. this.$router.push({
  419. path: 'inOutWarehousetaskEdit',
  420. query: {
  421. relevanceId: row.relevanceId,
  422. businessKey: row.id,
  423. workflowId: row.workflowId,
  424. },
  425. })
  426. },
  427. dateFormat(fmt, date) {
  428. let ret
  429. const opt = {
  430. 'Y+': date.getFullYear().toString(), // 年
  431. 'm+': (date.getMonth() + 1).toString(), // 月
  432. 'd+': date.getDate().toString(), // 日
  433. 'H+': date.getHours().toString(), // 时
  434. // "M+": date.getMinutes().toString(), // 分
  435. // "S+": date.getSeconds().toString() // 秒
  436. // 有其他格式化字符需求可以继续添加,必须转化成字符串
  437. }
  438. for (let k in opt) {
  439. ret = new RegExp('(' + k + ')').exec(fmt)
  440. if (ret) {
  441. fmt = fmt.replace(
  442. ret[1],
  443. ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, '0')
  444. )
  445. }
  446. }
  447. return fmt
  448. },
  449. handleClose() {
  450. this.accessoryTFs = false
  451. },
  452. handleSizeChange(val) {
  453. console.log(`每页 ${val} 条`)
  454. this.pageSize = val
  455. this.getList()
  456. },
  457. handleCurrentChange(val) {
  458. this.currentPage = val
  459. console.log(`当前页: ${val}`)
  460. this.getList()
  461. },
  462. editClick(row) {
  463. var status = ''
  464. if (row.taskStatus == '待审核' || row.taskStatus == '已完成') {
  465. status = '执行中'
  466. } else if (row.taskStatus == '执行中') {
  467. status = '已完成'
  468. }
  469. //cancelButtonClass: "btn-custom-cancel"
  470. this.$confirm(`是否将状态改为${status}`, {
  471. confirmButtonText: '确定',
  472. cancelButtonText: '取消',
  473. type: 'warning',
  474. })
  475. .then(() => {
  476. movestates({
  477. id: row.id
  478. })
  479. .toPromise()
  480. .then((response) => {
  481. this.$notify.success({
  482. title: '成功',
  483. message: '状态修改成功',
  484. })
  485. this.getList()
  486. })
  487. .catch((response) => {
  488. // EventBus.$emit('error', this.$t('showMessage.asteriskRequired'))
  489. })
  490. })
  491. .catch(() => {
  492. return false
  493. })
  494. },
  495. selecttaskType(e) {
  496. for (var i = 0; i < this.taskTypeList.length; i++) {
  497. if (this.taskTypeList[i].value == e) {
  498. this.searchType = this.taskTypeList[i].type
  499. }
  500. }
  501. this.currentPage = 1,
  502. this.getList()
  503. },
  504. handleExamine(row) {
  505. this.$router.push({
  506. name: 'salesContractExamine',
  507. query: {
  508. id: row.id
  509. },
  510. })
  511. },
  512. // 关闭 dialog时 处理文件url 初始化upload组件
  513. handleCloe() {
  514. this.dialogViewSpareMoney = false
  515. },
  516. history(row) {
  517. billoperatehis({
  518. id: row.id
  519. })
  520. .toPromise()
  521. .then((response) => {
  522. this.historyList = response
  523. })
  524. },
  525. find() {
  526. this.currentPage = 1
  527. this.getList()
  528. },
  529. },
  530. }
  531. </script>
  532. <style lang="scss" scoped>
  533. .vertical-text-left {
  534. width: 62px;
  535. text-align: right;
  536. }
  537. .el-button--primary {
  538. background-color: #5878e8;
  539. border-color: #5878e8;
  540. }
  541. .el-button--default {
  542. color: #8890b1;
  543. border-color: #e8eaf1;
  544. }
  545. /deep/.base_header_layout .grid-content.right .find.el-button--primary {
  546. width: 30px;
  547. border-top-left-radius: 0px;
  548. border-bottom-left-radius: 0px;
  549. }
  550. /deep/.findValue .el-input__inner {
  551. border-top-right-radius: 0px;
  552. border-bottom-right-radius: 0px;
  553. }
  554. .completed.el-button--default {
  555. border-color: #5878e8;
  556. background-color: #f6f7fc;
  557. color: #5878e8;
  558. }
  559. .putstorage.el-button--default,
  560. .deliverystorage.el-button--default {
  561. border-color: #8890b1;
  562. background-color: #fff;
  563. color: #8890b1;
  564. }
  565. /deep/.el-table td,
  566. /deep/.el-table th.is-leaf {
  567. border-right: 1px solid #e9ecf7;
  568. text-align: center;
  569. }
  570. /deep/.el-table tr td:first-child,
  571. /deep/.el-table tr th.is-leaf:first-child {
  572. border-left: 1px solid #e9ecf7;
  573. }
  574. .el-row {
  575. height: 50px;
  576. }
  577. .findValue {
  578. // width: 0%;
  579. margin-left: 10px;
  580. }
  581. .search {
  582. margin-left: -250px;
  583. }
  584. .Value {
  585. width: 300px;
  586. margin-left: 766px;
  587. }
  588. .el-pagination {
  589. text-align: center;
  590. }
  591. .winseaview-main {
  592. background: #e8ecf6;
  593. box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.1);
  594. }
  595. .spans {
  596. display: table-caption;
  597. width: 17px;
  598. line-height: 19px;
  599. }
  600. //执行样式
  601. .executory,
  602. .inExecution,
  603. .done {
  604. width: 6px;
  605. height: 6px;
  606. display: inline-block;
  607. border-radius: 50%;
  608. position: relative;
  609. top: -1px;
  610. font-size: 14px;
  611. }
  612. .executory {
  613. background: #ff9f24;
  614. }
  615. .inExecution {
  616. background: #5878e8;
  617. }
  618. .done {
  619. background: #50cad4;
  620. }
  621. .el-select {
  622. width: 30%;
  623. margin-right: 10px;
  624. }
  625. /deep/.typeselect .el-input__inner {
  626. color: #8890b1;
  627. }
  628. .corles {
  629. color: #5878e8;
  630. font-size: 14px;
  631. }
  632. </style>