purchaseContract.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659
  1. <!--采购合同-->
  2. <!--2019年5月30日 20:25:16 by jlx-->
  3. <template>
  4. <div>
  5. <BaseHeaderLayout :leftSpan="10">
  6. <template slot="left">
  7. <ws-button
  8. type="primary"
  9. @click="handleAdd()"
  10. v-hasPermission="
  11. `${$permission('PERMISSIONS.PURSPAPPLINFO_CREATEINSTORE')}`
  12. "
  13. >添加</ws-button
  14. >
  15. <ws-button
  16. @click="exportlist()"
  17. v-hasPermission="
  18. `${$permission('PERMISSIONS.PURSPAPPLINFO_CREATEINSTORE')}`
  19. "
  20. >导出</ws-button
  21. >
  22. </template>
  23. <template slot="right">
  24. <ws-select
  25. v-model="searchTypeText"
  26. placeholder=""
  27. class="typeselect"
  28. @change="selecttaskType"
  29. :value="searchType"
  30. >
  31. <ws-option
  32. v-for="item in taskTypeList"
  33. :key="item.value"
  34. :label="item.value"
  35. :value="item.value"
  36. />
  37. </ws-select>
  38. <ws-date-picker
  39. :picker-options="pickerBeginDateBefore"
  40. v-model="startDate"
  41. type="date"
  42. default-value="1980-01-01"
  43. placeholder="起始日期"
  44. format="yyyy-MM-dd"
  45. value-format="yyyy-MM-dd"
  46. />
  47. <span>至</span>
  48. <ws-date-picker
  49. :picker-options="pickerBeginDateBefore"
  50. v-model="endDate"
  51. type="date"
  52. default-value="1980-01-01"
  53. placeholder="截止日期"
  54. format="yyyy-MM-dd"
  55. value-format="yyyy-MM-dd"
  56. />
  57. <ws-input
  58. v-model="searchKeyWord"
  59. placeholder="可按照合同编号、买方名称、卖方名称进行查找"
  60. clearable
  61. maxlength="500"
  62. type="input"
  63. class="findValue"
  64. ></ws-input>
  65. <!-- v-hasPermission="'procurement.sparepart.directShip'" -->
  66. <ws-button
  67. type="primary"
  68. @click="find()"
  69. v-hasPermission="
  70. `${$permission('PERMISSIONS.PURSPAPPLINFO_CREATEINSTORE')}`
  71. "
  72. >查找</ws-button
  73. >
  74. </template>
  75. </BaseHeaderLayout>
  76. <el-table
  77. class="wenzi"
  78. :data="contractList.records"
  79. style="width: 100%; margin-top: 10px"
  80. >
  81. <el-table-column type="index" label="序号" />
  82. <el-table-column prop="contractNo" label="合同编号" width="80">
  83. </el-table-column>
  84. <el-table-column prop="goodsName" label="货名" width="80">
  85. </el-table-column>
  86. <el-table-column prop="grade" label="品级"> </el-table-column>
  87. <el-table-column prop="weight" label="重量(吨)"> </el-table-column>
  88. <el-table-column prop="unitContractPrice" label="合同单价(元)">
  89. </el-table-column>
  90. <el-table-column prop="packingMethod" label="包装方式"> </el-table-column>
  91. <el-table-column prop="buyer" label="买方"> </el-table-column>
  92. <el-table-column prop="seller" label="卖方"> </el-table-column>
  93. <el-table-column prop="imperfectGrain" label="已完成(吨)">
  94. </el-table-column>
  95. <el-table-column prop="status" label="状态" >
  96. <template slot-scope="scope">
  97. <el-popover
  98. placement="left"
  99. :width="400"
  100. trigger="click"
  101. visible-arrow="false"
  102. @show="history(scope.row)"
  103. >
  104. <template >
  105. <span slot="reference">{{ scope.row.status }}</span>
  106. </template>
  107. <div>
  108. <p>操作历史</p>
  109. <div v-for="(item, index) in historyList">
  110. <div class="vertical-circle"></div>
  111. <div class="vertical-text">
  112. {{ item.operateUser }}{{ item.dealMsg }}<br />{{
  113. item.updateDate
  114. }}
  115. </div>
  116. <div
  117. v-if="index != historyList.length - 1"
  118. class="vertical-line"
  119. ></div>
  120. </div>
  121. </div>
  122. </el-popover>
  123. <i class="el-icon-edit" @click="editClick(scope.row)"></i>
  124. </template>
  125. </el-table-column>
  126. <el-table-column prop="signingDate" label="签订日期"> </el-table-column>
  127. <el-table-column prop="mildewGrain" label="已付款(元)">
  128. </el-table-column>
  129. <el-table-column prop="addressUrl" label="附件">
  130. <template slot-scope="scope">
  131. <i @click="fujian(scope.row)" class="el-icon-paperclip iconCss"></i>
  132. </template>
  133. </el-table-column>
  134. <el-table-column prop="address" label="操作" width="300">
  135. <template slot-scope="scope">
  136. <el-button
  137. type="success"
  138. size="small"
  139. @click="handleExamine(scope.row)"
  140. >查看</el-button
  141. >
  142. <el-button type="primary" size="small" @click="handleEdit(scope.row)"
  143. >编辑</el-button
  144. >
  145. <el-button type="danger" size="small" @click="handleDelete(scope.row)"
  146. >删除</el-button
  147. >
  148. </template>
  149. </el-table-column>
  150. </el-table>
  151. <el-pagination
  152. @size-change="handleSizeChange"
  153. @current-change="handleCurrentChange"
  154. :current-page="currentPage"
  155. :page-size="deptCircularPage.pageSize"
  156. layout="total, sizes, prev, pager, next, jumper"
  157. :total="deptBudgetTotal"
  158. >
  159. </el-pagination>
  160. <!-- 附件弹框 -->
  161. <WinseaContentModal
  162. v-model="accessoryTFs"
  163. :title="$t('system.noticeCircular.information')"
  164. @on-cancel="handleClose"
  165. >
  166. <p>查看附件</p>
  167. <ws-upload
  168. ref="upload"
  169. table-name="maintain_work_order"
  170. oss-key="mainPlan"
  171. :comp-id="compId"
  172. :appendix-ids="appendixIdsAdd"
  173. :vesselId="deptBudgetList.addressUrl"
  174. :size-limit="size"
  175. @uploadSuccess="uploadSuccess"
  176. accept=".jpg, .jpeg, .png, .pdf, .doc, .zip, .rar"
  177. />
  178. </WinseaContentModal>
  179. </div>
  180. </template>
  181. <script>
  182. import {
  183. getList,
  184. export1,
  185. editstatus,
  186. billoperatehis,
  187. deletecontract,
  188. } from '@/model/contarct/index'
  189. import { downloadFile } from '@/utils/batchDown'
  190. import Pagination from '@/components/Pagination'
  191. import WsUpload from '@/components/WsUpload'
  192. import { dayjs, fmoney, EventBus } from 'base-core-lib'
  193. export default {
  194. name: 'viewSpareMoney',
  195. components: {
  196. WsUpload,
  197. Pagination,
  198. },
  199. watch: {
  200. vesselId(val) {
  201. this.getList()
  202. },
  203. isShow(val) {
  204. this.showType = val
  205. },
  206. },
  207. data() {
  208. return {
  209. //弹出框
  210. dialogViewSpareMoney: false,
  211. dialogApproveFormVisible: false,
  212. // 船舶类型
  213. monetaryKey: null,
  214. // 表格显示数据
  215. tableDate: [],
  216. size: 10,
  217. // 是否显示
  218. showType: true,
  219. // 年
  220. year: '',
  221. deptBudgetTotal: 0,
  222. currentPage: 1,
  223. pageSize: 10,
  224. appendixIdsAdd: '',
  225. searchType: 1,
  226. searchTypeText: '未完成',
  227. searchKeyWord: '',
  228. contractType: 2,
  229. startDate: null,
  230. endDate: null,
  231. // 提交类型
  232. submitType: true,
  233. deptCircularPage: {},
  234. date: {
  235. year: dayjs().format('YYYY'),
  236. month: dayjs().format('MM'),
  237. },
  238. contractList: [],
  239. deptBudgetList: {},
  240. historyList: [],
  241. compId: sessionStorage.getItem('ws-pf_compId'),
  242. pickerBeginDateBefore: {
  243. disabledDate: (time) => {
  244. return time.getTime() > Date.now()
  245. },
  246. },
  247. accessoryTFs: false,
  248. taskTypeList: [
  249. { value: '未完成', type: 1 },
  250. { value: '已完成', type: 2 },
  251. { value: '全部合同', type: '' },
  252. ],
  253. }
  254. },
  255. activated() {
  256. //cg.viewBudget
  257. //cg.viewSpareMoney
  258. // this.getVesselData();
  259. this.getList()
  260. this.showType = this.isShow
  261. },
  262. methods: {
  263. handleClose() {
  264. this.accessoryTFs = false
  265. },
  266. handleSizeChange(val) {
  267. console.log(`每页 ${val} 条`)
  268. this.getList()
  269. },
  270. handleCurrentChange(val) {
  271. console.log(`当前页: ${val}`)
  272. this.getList()
  273. },
  274. getList() {
  275. getList({
  276. compId: sessionStorage.getItem('ws-pf_compId'),
  277. contractType: this.contractType,
  278. currentPage: this.currentPage,
  279. pageSize: this.pageSize,
  280. searchType: this.searchType,
  281. searchKeyWord: this.searchKeyWord,
  282. startDate: this.startDate,
  283. endDate: this.endDate,
  284. contrPage: this.contrPage,
  285. })
  286. .toPromise()
  287. .then((response) => {
  288. this.deptCircularPage.currentPage = response.current
  289. this.deptCircularPage.pageSize = response.size
  290. this.deptBudgetTotal = response.total
  291. this.contractList = response
  292. })
  293. },
  294. // 上传附件
  295. uploadSuccess(data, files, url) {
  296. console.log(data, files, url)
  297. // this.deptBudgetList.
  298. // this.formData.append('files', files)
  299. // this.feedbackObj.uploadNameAttachment = data.appendixName
  300. // this.feedbackObj.pathUploadAttachment = data.appendixPath
  301. // // this.newAppendixs = files
  302. // this.onChangeFlag = true
  303. },
  304. editClick(row) {
  305. var status = ''
  306. if (row.status == '待执行' || row.status == '已完成') {
  307. status = '执行中'
  308. } else if (row.status == '执行中') {
  309. status = '已完成'
  310. }
  311. this.$confirm(`是否将状态改为${status}`, '提示', {
  312. confirmButtonText: '确定',
  313. cancelButtonText: '取消',
  314. type: 'warning',
  315. })
  316. .then(() => {
  317. editstatus({ id: row.id })
  318. .toPromise()
  319. .then((response) => {
  320. this.$notify.success({
  321. title: '成功',
  322. message: '状态修改成功',
  323. })
  324. this.getList()
  325. })
  326. .catch((response) => {
  327. // EventBus.$emit('error', this.$t('showMessage.asteriskRequired'))
  328. })
  329. })
  330. .catch(() => {
  331. return false
  332. })
  333. },
  334. selecttaskType(e) {
  335. for (var i = 0; i < this.taskTypeList.length; i++) {
  336. if (this.taskTypeList[i].value == e) {
  337. this.searchType = this.taskTypeList[i].type
  338. }
  339. }
  340. },
  341. fujian(row) {
  342. if (
  343. row.receiveAttachmentPath === null ||
  344. row.receiveAttachmentPath === ''
  345. ) {
  346. EventBus.$emit(
  347. 'warning',
  348. this.$t('system.noticeCircular.NoInformation')
  349. )
  350. } else {
  351. this.accessoryTFs = true
  352. }
  353. this.appendixIdss = row.receiveAttachmentPath
  354. },
  355. handleExamine(row) {
  356. console.log(row)
  357. this.$router.push({
  358. name: 'purchaseContractExamine',
  359. params: { id: row.id },
  360. })
  361. },
  362. handleAdd() {
  363. this.$router.push({ path: 'purchaseContractAdd' })
  364. },
  365. handleEdit(row) {
  366. this.$router.push({
  367. name: 'purchaseContractEdit',
  368. query: { id: row.id },
  369. })
  370. },
  371. // 关闭 dialog时 处理文件url 初始化upload组件
  372. handleCloe() {
  373. this.dialogViewSpareMoney = false
  374. },
  375. history(row) {
  376. console.log(row)
  377. billoperatehis({ id: row.id })
  378. .toPromise()
  379. .then((response) => {
  380. this.historyList = response
  381. })
  382. },
  383. find() {
  384. this.getList()
  385. },
  386. async exportlist() {
  387. const { data } = await export1(
  388. {
  389. compId: sessionStorage.getItem('ws-pf_compId'),
  390. contractType: this.contractType,
  391. currentPage: this.currentPage,
  392. pageSize: this.pageSize,
  393. searchType: this.searchType,
  394. searchKeyWord: this.searchKeyWord,
  395. startDate: this.startDate,
  396. endDate: this.endDate,
  397. },
  398. {},
  399. { responseType: 'blob' }
  400. ).toPromise()
  401. downloadFile({
  402. res: data,
  403. fileName: `${
  404. this.date.year + (this.date.month ? `-${this.date.month}` : '')
  405. }_采购合同`,
  406. type: 'xls',
  407. })
  408. },
  409. // deletecontract(){},
  410. //删除
  411. handleDelete(row){
  412. var handleDelete = ' '//sfdkd
  413. if (row.handleDelete == '待执行' || row.handleDelete == '已完成') {
  414. handleDelete = '执行中'
  415. } else if (row.handleDelete == '执行中') {
  416. handleDelete = '已完成'
  417. }
  418. this.$confirm(`合同删除后不可恢复,是否继续删除?`, '提示', {
  419. confirmButtonText: '确定',
  420. cancelButtonText: '取消',
  421. type: 'warning',
  422. })
  423. .then(() => {
  424. deletecontract({id: row.id })
  425. .toPromise()
  426. .then((response) => {
  427. this.$notify.success({
  428. title: '成功',
  429. message: '删除成功',
  430. })
  431. this.getList()
  432. })
  433. .catch((response) => {
  434. // EventBus.$emit('error', this.$t('showMessage.asteriskRequired'))
  435. })
  436. })
  437. .catch(() => {
  438. return false
  439. })
  440. }
  441. },
  442. }
  443. </script>
  444. <style lang="scss" scoped>
  445. .wrap {
  446. width: 400px;
  447. position: absolute;
  448. top: 131px;
  449. left: 794px;
  450. transform-origin: right center;
  451. z-index: 2005;
  452. }
  453. .vertical-line {
  454. height: 100px;
  455. border-left: 2px solid;
  456. margin-left: 4px;
  457. // border-image: -webkit-linear-gradient(#00eba7, #08b8e6) 30 30;
  458. // border-image: -moz-linear-gradient(#00eba7, #08b8e6) 30 30;
  459. // border-image: linear-gradient(#00eba7, #08b8e6) 30 30;
  460. }
  461. .el-pagination {
  462. padding: 10px 15px;
  463. margin-bottom: 0;
  464. text-align: right;
  465. }
  466. .vertical-circle {
  467. float: left;
  468. width: 10px;
  469. height: 10px;
  470. border: 2px solid white;
  471. background-color: #08b8e6;
  472. -webkit-border-radius: 100px;
  473. }
  474. .vertical-circle:first-child {
  475. color: red;
  476. }
  477. .vertical-text {
  478. float: left;
  479. margin-top: -7px;
  480. }
  481. /deep/.el-table .el-table__header .cell,
  482. /deep/.el-table .el-table__body .cell {
  483. text-align: center;
  484. }
  485. .typeselect {
  486. width: 500px;
  487. }
  488. .padding-xs {
  489. padding: 15px;
  490. text-align: right;
  491. }
  492. .clearfix:after {
  493. content: '';
  494. display: block;
  495. clear: both;
  496. }
  497. .el-table {
  498. font-size: 16px;
  499. }
  500. .taskType {
  501. width: 100%;
  502. background-color: #fff;
  503. margin-top: 2px;
  504. margin-bottom: 10px;
  505. list-style: none;
  506. // padding-bottom: 20px;
  507. li {
  508. float: left;
  509. border: 1px solid #6ea0f3;
  510. border-radius: 5px;
  511. max-width: 190px;
  512. padding: 0 5px;
  513. text-align: center;
  514. margin: 10px 20px;
  515. cursor: pointer;
  516. font-size: 14px;
  517. p {
  518. margin: 8px 0px;
  519. span {
  520. color: #e74c3c;
  521. }
  522. }
  523. }
  524. li:hover {
  525. background-color: #e4eeff;
  526. color: #1d6ced;
  527. }
  528. }
  529. .el-date-editor--date {
  530. margin: 0 10px;
  531. }
  532. .findValue {
  533. margin: 0 10px;
  534. }
  535. .button-container {
  536. display: flex;
  537. flex-wrap: nowrap;
  538. justify-content: space-between;
  539. align-items: center;
  540. background-color: #fff;
  541. width: 100%;
  542. height: 50px;
  543. padding: 0 10px;
  544. & > div {
  545. margin-left: 10px;
  546. display: flex;
  547. flex-wrap: nowrap;
  548. flex-direction: row;
  549. & > span {
  550. line-height: 50px;
  551. }
  552. }
  553. /deep/.auditFlow-box {
  554. position: unset;
  555. margin-left: 10px;
  556. &/deep/.auditFlow-icon {
  557. width: auto;
  558. padding-right: 30px;
  559. }
  560. &/deep/.auditFlow-main {
  561. position: absolute;
  562. }
  563. }
  564. }
  565. .box-app {
  566. display: inline-block;
  567. float: left;
  568. margin-left: 30px;
  569. line-height: 50px;
  570. }
  571. /deep/.el-dialog {
  572. .el-form-item {
  573. margin-bottom: 0 !important;
  574. .el-input--medium {
  575. textarea {
  576. min-height: 100px !important;
  577. }
  578. }
  579. }
  580. }
  581. .collapse-bottom {
  582. margin-bottom: 20px;
  583. }
  584. .input-main .textarea .el-textarea__inner {
  585. width: 100%;
  586. z-index: 1;
  587. }
  588. /*.crt-main .textarea /deep/ .el-form-item__label {*/
  589. /* height: 82px;*/
  590. /*}*/
  591. // 控制select为只读的时候显示样式
  592. .hide-sel {
  593. .el-input__inner {
  594. border: 0px;
  595. }
  596. .el-icon-arrow-up {
  597. display: none;
  598. }
  599. .el-textarea__inner {
  600. background-color: #fff !important;
  601. border: 0;
  602. }
  603. .el-date-editor {
  604. i {
  605. display: none;
  606. }
  607. }
  608. .is-disabled {
  609. .el-input__inner:hover {
  610. background-color: #fff !important;
  611. border: 0;
  612. }
  613. color: #606266;
  614. .el-input__inner {
  615. background-color: #fff !important;
  616. border: 0;
  617. color: #606266;
  618. }
  619. .el-textarea__inner {
  620. background-color: #fff !important;
  621. border: 0;
  622. color: #606266;
  623. }
  624. }
  625. }
  626. // 控制select为只读的时候显示样式
  627. /deep/.ws-class-table-col {
  628. height: auto;
  629. padding: 0px 2px;
  630. /deep/.el-input__inner {
  631. padding: 0px 2px;
  632. }
  633. }
  634. /deep/.is-disabled {
  635. .el-input__prefix,
  636. .el-input__suffix {
  637. display: none;
  638. }
  639. .el-input__inner {
  640. background-color: #fff;
  641. border-color: #fff !important;
  642. color: #000 !important;
  643. font-size: 14px;
  644. cursor: text;
  645. padding: 0 !important;
  646. }
  647. }
  648. </style>