quoted.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588
  1. <!-- 报价管理 -->
  2. <template>
  3. <div>
  4. <template v-if="!addOrUpdateVisible && !detailVisible && !priceVisible && !accreditVisible && !resultVisible && !notifyVisible">
  5. <el-form
  6. :inline="true"
  7. :model="dataForm"
  8. @keyup.enter.native="queryData()"
  9. >
  10. <el-form-item label="项目名称">
  11. <el-input
  12. v-model="dataForm.projectName"
  13. placeholder="请输入项目名称"
  14. clearable
  15. />
  16. </el-form-item>
  17. <el-form-item label="部门">
  18. <org-component v-model="dataForm.orgId" />
  19. </el-form-item>
  20. <el-form-item>
  21. <el-button @click="queryData()">查询</el-button>
  22. <el-button
  23. v-if="isAuth('quoted:price:save')"
  24. type="primary"
  25. @click="addOrUpdateHandle(0)"
  26. >新建</el-button
  27. >
  28. </el-form-item>
  29. </el-form>
  30. <el-table
  31. :data="dataList"
  32. border
  33. v-loading="dataListLoading"
  34. style="width: 100%"
  35. >
  36. <el-table-column
  37. label="序号"
  38. type="index"
  39. width="50"
  40. align="center"
  41. ></el-table-column>
  42. <el-table-column
  43. prop="priceCode"
  44. header-align="center"
  45. align="center"
  46. min-width="140"
  47. :show-tooltip-when-overflow="true"
  48. label="报价编码"
  49. >
  50. </el-table-column>
  51. <el-table-column
  52. prop="projectName"
  53. header-align="center"
  54. align="center"
  55. min-width="140"
  56. :show-tooltip-when-overflow="true"
  57. label="项目名称"
  58. >
  59. </el-table-column>
  60. <el-table-column
  61. prop="type"
  62. header-align="center"
  63. align="center"
  64. min-width="140"
  65. :show-tooltip-when-overflow="true"
  66. label="项目类别"
  67. >
  68. <template slot-scope="scope">
  69. {{productTypeOption.find(t => t.value === scope.row.type).label}}
  70. </template>
  71. </el-table-column>
  72. <el-table-column
  73. prop="materialCost"
  74. header-align="center"
  75. align="center"
  76. min-width="140"
  77. :show-tooltip-when-overflow="true"
  78. label="报价小计"
  79. >
  80. </el-table-column>
  81. <el-table-column
  82. prop="mouldPrice"
  83. header-align="center"
  84. align="center"
  85. min-width="140"
  86. :show-tooltip-when-overflow="true"
  87. label="模具费"
  88. >
  89. </el-table-column>
  90. <el-table-column
  91. prop="managePrice"
  92. header-align="center"
  93. align="center"
  94. min-width="140"
  95. :show-tooltip-when-overflow="true"
  96. label="管理费"
  97. >
  98. </el-table-column>
  99. <el-table-column
  100. header-align="center"
  101. align="center"
  102. label="报价附件">
  103. <template slot-scope="scope">
  104. <el-button :disabled="!scope.row.attachList || scope.row.attachList.length === 0" type="text" size="small" @click="attachDetails(scope.row)">查看</el-button>
  105. </template>
  106. </el-table-column>
  107. <el-table-column
  108. prop="ratePrice"
  109. header-align="center"
  110. align="center"
  111. min-width="140"
  112. :show-tooltip-when-overflow="true"
  113. label="税率"
  114. >
  115. </el-table-column>
  116. <el-table-column
  117. prop="totalPrice"
  118. header-align="center"
  119. align="center"
  120. min-width="140"
  121. :show-tooltip-when-overflow="true"
  122. label="总价"
  123. >
  124. </el-table-column>
  125. <el-table-column
  126. prop="precisionMaterialCost"
  127. header-align="center"
  128. align="center"
  129. min-width="140"
  130. :show-tooltip-when-overflow="true"
  131. label="精准报价小计"
  132. >
  133. </el-table-column>
  134. <el-table-column
  135. prop="precisionMouldPrice"
  136. header-align="center"
  137. align="center"
  138. min-width="140"
  139. :show-tooltip-when-overflow="true"
  140. label="精准模具费"
  141. >
  142. </el-table-column>
  143. <el-table-column
  144. prop="precisionManagePrice"
  145. header-align="center"
  146. align="center"
  147. min-width="140"
  148. :show-tooltip-when-overflow="true"
  149. label="精准管理费"
  150. >
  151. </el-table-column>
  152. <el-table-column
  153. prop="precisionRatePrice"
  154. header-align="center"
  155. align="center"
  156. min-width="140"
  157. :show-tooltip-when-overflow="true"
  158. label="精准税率"
  159. >
  160. </el-table-column>
  161. <el-table-column
  162. prop="precisionTotalPrice"
  163. header-align="center"
  164. align="center"
  165. min-width="140"
  166. :show-tooltip-when-overflow="true"
  167. label="精准总价"
  168. >
  169. </el-table-column>
  170. <el-table-column
  171. prop="remark"
  172. header-align="center"
  173. align="center"
  174. min-width="140"
  175. :show-tooltip-when-overflow="true"
  176. label="备注"
  177. >
  178. </el-table-column>
  179. <el-table-column
  180. prop="creatorName"
  181. header-align="center"
  182. align="center"
  183. min-width="140"
  184. :show-tooltip-when-overflow="true"
  185. label="负责人"
  186. >
  187. </el-table-column>
  188. <el-table-column
  189. prop="orgName"
  190. header-align="center"
  191. align="center"
  192. min-width="140"
  193. :show-tooltip-when-overflow="true"
  194. label="部门"
  195. >
  196. </el-table-column>
  197. <el-table-column
  198. prop="accredit"
  199. header-align="center"
  200. align="center"
  201. min-width="160"
  202. :show-tooltip-when-overflow="true"
  203. label="授权情况"
  204. >
  205. </el-table-column>
  206. <el-table-column
  207. prop="state"
  208. fixed="right"
  209. header-align="center"
  210. align="center"
  211. min-width="120"
  212. :show-tooltip-when-overflow="true"
  213. label="项目状态"
  214. >
  215. <template slot-scope="scope">
  216. {{projectStateOption.find(t => t.value === scope.row.state).label}}
  217. </template>
  218. </el-table-column>
  219. <el-table-column
  220. prop="approveState"
  221. fixed="right"
  222. header-align="center"
  223. align="center"
  224. min-width="120"
  225. :show-tooltip-when-overflow="true"
  226. label="项目评估状态"
  227. >
  228. <template slot-scope="scope">
  229. {{approveStateOption.find(t => t.value === scope.row.approveState).label}}
  230. </template>
  231. </el-table-column>
  232. <el-table-column
  233. fixed="right"
  234. header-align="center"
  235. align="center"
  236. min-width="80"
  237. :formatter="formatReadState"
  238. :show-overflow-tooltip="true"
  239. label="读写状态">
  240. </el-table-column>
  241. <el-table-column
  242. fixed="right"
  243. header-align="center"
  244. align="center"
  245. min-width="180"
  246. label="操作"
  247. >
  248. <template slot-scope="scope">
  249. <el-button
  250. type="text"
  251. size="small"
  252. @click="showDetail(scope.row.priceId)"
  253. >查看</el-button
  254. >
  255. <el-button
  256. v-if="isAuth('quoted:price:update') && Number(scope.row.approveState) === 0 && Number(scope.row.state) === 1"
  257. type="text"
  258. size="small"
  259. @click="addOrUpdateHandle(scope.row.priceId)"
  260. >编辑</el-button
  261. >
  262. <el-button
  263. v-if="isAuth('quoted:price:revoke') && Number(scope.row.approveState) === 1 && Number(scope.row.state) === 1"
  264. type="text"
  265. size="small"
  266. @click="revokeHandle(scope.row.priceId)"
  267. >撤回</el-button
  268. >
  269. <el-button
  270. v-if="isAuth('quoted:price:updateFirst') && Number(scope.row.approveState) === 3 && (Number(scope.row.state) === 1 || Number(scope.row.state) === 2)"
  271. type="text"
  272. size="small"
  273. @click="priceHandle(scope.row.priceId,'first')"
  274. >报价</el-button
  275. >
  276. <el-button
  277. v-if="isAuth('quoted:price:updateTwo') && Number(scope.row.approveState) === 3 && (Number(scope.row.state) === 4 || Number(scope.row.state) === 5)"
  278. type="text"
  279. size="small"
  280. @click="priceHandle(scope.row.priceId,'second')"
  281. >精准报价</el-button
  282. >
  283. <el-button
  284. v-if="isAuth('work:clt:insertBatch') && Number(scope.row.approveState) === 3 && (Number(scope.row.state) === 2 || Number(scope.row.state) === 5)"
  285. type="text"
  286. size="small"
  287. @click="notifyHandle(scope.row.priceId)"
  288. >通知报价</el-button
  289. >
  290. <!-- <el-button
  291. v-if="isAuth('quoted:price:updateRestart') && Number(scope.row.approveState) === 3 && Number(scope.row.state) > 6"
  292. type="text"
  293. size="small"
  294. @click="priceHandle(scope.row.priceId, 'restart')"
  295. >重新报价</el-button
  296. > -->
  297. <el-button
  298. v-if="isAuth('quoted:price:updateFinish') && Number(scope.row.approveState) === 3 && (Number(scope.row.state) === 2 || Number(scope.row.state === 5))"
  299. type="text"
  300. size="small"
  301. @click="finishHandle(scope.row.priceId)"
  302. >报价完成</el-button
  303. >
  304. <el-button
  305. v-if="isAuth('quoted:price:updateAccredit') && Number(scope.row.approveState) === 3 && (Number(scope.row.state) === 3 || Number(scope.row.state) === 6)"
  306. type="text"
  307. size="small"
  308. @click="accreditHandle(scope.row.priceId)"
  309. >授权</el-button
  310. >
  311. <el-button
  312. v-if="isAuth('quoted:price:updateResult') && Number(scope.row.approveState) === 3 && (Number(scope.row.state) === 4 || Number(scope.row.state) === 7)"
  313. type="text"
  314. size="small"
  315. @click="resultHandle(scope.row.priceId)"
  316. >报价结果</el-button
  317. >
  318. <el-button v-if="isAuth('quoted:price:read') && Number(scope.row.writeState) === 2" type="text" size="small" @click="readHandle(scope.row.priceId)">只读</el-button>
  319. <el-button v-if="isAuth('quoted:price:write') && Number(scope.row.writeState) === 1" type="text" size="small" @click="writeHandle(scope.row.priceId)">读写</el-button>
  320. <el-button type="text" size="small" @click="exportExcel(scope.row.priceId)">导出</el-button>
  321. </template>
  322. </el-table-column>
  323. </el-table>
  324. <el-pagination
  325. @size-change="sizeChangeHandle"
  326. @current-change="currentChangeHandle"
  327. :current-page="pageIndex"
  328. :page-sizes="[10, 20, 50, 100]"
  329. :page-size="pageSize"
  330. :total="totalPage"
  331. layout="total, sizes, prev, pager, next, jumper">
  332. </el-pagination>
  333. </template>
  334. <quoted-add-or-update ref="addOrUpdate" v-if="addOrUpdateVisible" @onChose="onChose" @refreshDataList="queryData"/>
  335. <quoted-price ref="price" v-if="priceVisible" @onChose="onChose" @refreshDataList="queryData"/>
  336. <quoted-detail ref="detail" v-if="detailVisible" @onChose="onChose" />
  337. <quoted-accredit ref="accredit" v-if="accreditVisible" @onChose="onChose"/>
  338. <quoted-result ref="result" v-if="resultVisible" @onChose="onChose"/>
  339. <quoted-notify ref="notify" v-if="notifyVisible" @onChose="onChose"/>
  340. <attach-detail-dialog ref="attachDetail" @onChose="onChose" />
  341. </div>
  342. </template>
  343. <script>
  344. import OrgComponent from '../common/org-component'
  345. import {getList, revoke, updateFinish} from '@/api/quoted'
  346. import QuotedAddOrUpdate from './quoted-add-or-update'
  347. import {productTypeOption, approveStateOption, projectStateOption, writeStateOption} from '@/utils/enums'
  348. import QuotedPrice from './quoted-price'
  349. import QuotedDetail from './quoted-detail'
  350. import QuotedAccredit from './quoted-accredit'
  351. import QuotedResult from './quoted-result'
  352. import QuotedNotify from './quoted-notify'
  353. import AttachDetailDialog from '@/views/modules/common/attach-detail-dialog'
  354. import Vue from 'vue'
  355. export default {
  356. name: 'cus-quoted',
  357. components: { AttachDetailDialog, OrgComponent, QuotedAddOrUpdate, QuotedPrice, QuotedDetail, QuotedAccredit, QuotedResult, QuotedNotify },
  358. data () {
  359. return {
  360. addOrUpdateVisible: false,
  361. detailVisible: false,
  362. priceVisible: false,
  363. accreditVisible: false,
  364. resultVisible: false,
  365. notifyVisible: false,
  366. productTypeOption: productTypeOption,
  367. approveStateOption: approveStateOption,
  368. projectStateOption: projectStateOption,
  369. writeStateOption: writeStateOption,
  370. dataForm: {},
  371. dataList: [],
  372. pageIndex: 1,
  373. pageSize: 10,
  374. totalPage: 0,
  375. dataListLoading: false
  376. }
  377. },
  378. created () {
  379. this.getDataList()
  380. },
  381. methods: {
  382. onChose () {
  383. this.addOrUpdateVisible = false
  384. this.detailVisible = false
  385. this.priceVisible = false
  386. this.accreditVisible = false
  387. this.resultVisible = false
  388. this.notifyVisible = false
  389. },
  390. // 每页数
  391. sizeChangeHandle (val) {
  392. this.pageSize = val
  393. this.pageIndex = 1
  394. this.getDataList()
  395. },
  396. // 当前页
  397. currentChangeHandle (val) {
  398. this.pageIndex = val
  399. this.getDataList()
  400. },
  401. queryData () {
  402. this.pageIndex = 1
  403. this.getDataList()
  404. },
  405. getDataList () {
  406. this.dataListLoading = true
  407. let param = {
  408. current: this.pageIndex,
  409. size: this.pageSize,
  410. ...this.dataForm
  411. }
  412. getList(param).then(({data}) => {
  413. if (data && data.code === '200') {
  414. this.dataList = data.data.records
  415. this.totalPage = Number(data.data.total)
  416. } else {
  417. this.dataList = []
  418. this.totalPage = 0
  419. }
  420. this.dataListLoading = false
  421. })
  422. },
  423. addOrUpdateHandle (id, type) {
  424. this.addOrUpdateVisible = true
  425. this.$nextTick(() => {
  426. this.$refs.addOrUpdate.init(id, type)
  427. })
  428. },
  429. priceHandle (id, type) {
  430. this.priceVisible = true
  431. this.$nextTick(() => {
  432. this.$refs.price.init(id, type)
  433. })
  434. },
  435. notifyHandle (id) {
  436. this.notifyVisible = true
  437. this.$nextTick(() => {
  438. this.$refs.notify.init(id)
  439. })
  440. },
  441. showDetail (priceId) {
  442. this.detailVisible = true
  443. this.$nextTick(() => {
  444. this.$refs.detail.init(priceId)
  445. })
  446. },
  447. accreditHandle (priceId) {
  448. this.accreditVisible = true
  449. this.$nextTick(() => {
  450. this.$refs.accredit.init(priceId)
  451. })
  452. },
  453. revokeHandle (priceId) {
  454. this.$confirm('是否确认要撤回?', '提示', {
  455. confirmButtonText: '确定',
  456. cancelButtonText: '取消',
  457. type: 'warning'
  458. }).then(() => {
  459. revoke({id: priceId}).then(({data}) => {
  460. if (data && data.code === '200') {
  461. this.$message({
  462. type: 'success',
  463. message: '操作成功!'
  464. })
  465. } else {
  466. this.$message({
  467. type: 'error',
  468. message: data.msg
  469. })
  470. }
  471. })
  472. }).catch(() => {
  473. this.$message({
  474. type: 'info',
  475. message: '已取消撤回'
  476. })
  477. })
  478. },
  479. resultHandle (priceId) {
  480. this.resultVisible = true
  481. this.$nextTick(() => {
  482. this.$refs.result.init(priceId)
  483. })
  484. },
  485. finishHandle (priceId) {
  486. this.$confirm('是否确认完成报价?', '提示', {
  487. confirmButtonText: '确定',
  488. cancelButtonText: '取消',
  489. type: 'warning'
  490. }).then(() => {
  491. updateFinish({id: priceId}).then(({data}) => {
  492. if (data && data.code === '200') {
  493. this.$message({
  494. type: 'success',
  495. message: '操作成功!'
  496. })
  497. } else {
  498. this.$message({
  499. type: 'error',
  500. message: data.msg
  501. })
  502. }
  503. })
  504. }).catch(() => {
  505. this.$message({
  506. type: 'info',
  507. message: '已取消撤回'
  508. })
  509. })
  510. },
  511. attachDetails (attachList) {
  512. this.$refs.attachDetail.init(attachList)
  513. },
  514. formatReadState (row) {
  515. if (!row.writeState) return ''
  516. let option = this.writeStateOption.find(t => t.value === row.writeState)
  517. if (option != null) {
  518. return option.label
  519. }
  520. return ''
  521. },
  522. readHandle (id) {
  523. if (!id) return
  524. this.$confirm(`确定只读?`, '提示', {
  525. confirmButtonText: '确定',
  526. cancelButtonText: '取消',
  527. type: 'warning'
  528. }).then(() => {
  529. this.$http({
  530. url: this.$http.adornUrl(`/biz-service/quoted/read`),
  531. method: 'POST',
  532. data: {id: id}
  533. }).then(({data}) => {
  534. if (data && data.code === '200') {
  535. this.$message({
  536. message: '操作成功',
  537. type: 'success',
  538. duration: 1500,
  539. onClose: () => {
  540. this.getDataList()
  541. }
  542. })
  543. } else {
  544. this.$message.error(data.msg)
  545. }
  546. })
  547. }).catch(() => {})
  548. },
  549. writeHandle (id) {
  550. if (!id) return
  551. this.$confirm(`确定读写?`, '提示', {
  552. confirmButtonText: '确定',
  553. cancelButtonText: '取消',
  554. type: 'warning'
  555. }).then(() => {
  556. this.$http({
  557. url: this.$http.adornUrl(`/biz-service/quoted/write`),
  558. method: 'POST',
  559. data: {id: id}
  560. }).then(({data}) => {
  561. if (data && data.code === '200') {
  562. this.$message({
  563. message: '操作成功',
  564. type: 'success',
  565. duration: 1500,
  566. onClose: () => {
  567. this.getDataList()
  568. }
  569. })
  570. } else {
  571. this.$message.error(data.msg)
  572. }
  573. })
  574. }).catch(() => {})
  575. },
  576. exportExcel (id) {
  577. let url = this.$http.adornUrl(`/biz-service/quoted/exportExcel/${id}`) +
  578. '?_token=' + Vue.cookie.get('token')
  579. window.open(url, '_blank')
  580. }
  581. }
  582. }
  583. </script>
  584. <style scoped>
  585. </style>