outsource.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528
  1. <!-- 委外列表 -->
  2. <template>
  3. <div class="sale">
  4. <template v-if="!detailVisible && !addOrUpdateVisible && !changeFormVisible &&!changeAttachVisible && !attachVisible && !noticeChangeAttachVisible && !inboundVisible && !outsourceVisible && !noticeChangeAttachVisible && !amountMaskSettingVisible">
  5. <el-form :inline="true" :model="dataForm" @keyup.enter.native="search()">
  6. <el-form-item label="类别">
  7. <el-select
  8. v-model="dataForm.commissionType"
  9. remote
  10. placeholder="请选择">
  11. <el-option
  12. v-for="item in optionsType"
  13. :key="item.code"
  14. :label="item.value"
  15. :value="item.code">
  16. </el-option>
  17. </el-select>
  18. </el-form-item>
  19. <el-form-item label="名称或说明" prop="goodsName">
  20. <el-input v-model="dataForm.goodsName" placeholder="物料名称" clearable/>
  21. </el-form-item>
  22. <el-form-item label="申请日期">
  23. <el-date-picker
  24. v-model="dataForm.date"
  25. value-format="yyyy-MM-dd"
  26. type="daterange"
  27. range-separator="至"
  28. start-placeholder="开始日期"
  29. end-placeholder="结束日期">
  30. </el-date-picker>
  31. </el-form-item>
  32. <el-form-item label="状态">
  33. <el-select
  34. v-model="dataForm.purchaseState"
  35. remote
  36. placeholder="请选择">
  37. <el-option
  38. v-for="item in optionsOutsourceState"
  39. :key="item.code"
  40. :label="item.value"
  41. :value="item.code">
  42. </el-option>
  43. </el-select>
  44. </el-form-item>
  45. <el-form-item>
  46. <el-button @click="search()">查询</el-button>
  47. <el-button v-if="isAuth('pur:commDetail:noteChangeConfig')" type="primary" @click="setNoticeChangeHandel()">工作提示通知设置</el-button>
  48. <el-button v-if="isAuth('pur:commDetail:priceConfig')" type="primary" @click="setAmountMaskHandel()">委外金额屏蔽设置</el-button>
  49. </el-form-item>
  50. </el-form>
  51. <el-table
  52. :data="dataList"
  53. :row-class-name="tableRowClassName"
  54. border
  55. v-loading="dataListLoading"
  56. style="width: 100%;">
  57. <el-table-column
  58. label="序号"
  59. type="index"
  60. width="50"
  61. align="center">
  62. </el-table-column>
  63. <el-table-column
  64. prop="purchaseCode"
  65. header-align="center"
  66. align="center"
  67. min-width="120"
  68. :show-tooltip-when-overflow="true"
  69. label="采购编码">
  70. </el-table-column>
  71. <el-table-column
  72. prop="productName"
  73. header-align="center"
  74. align="center"
  75. min-width="140"
  76. :show-tooltip-when-overflow="true"
  77. label="物料名称">
  78. </el-table-column>
  79. <el-table-column
  80. prop="prodCode"
  81. header-align="center"
  82. align="center"
  83. min-width="120"
  84. :show-tooltip-when-overflow="true"
  85. label="物料编号">
  86. </el-table-column>
  87. <el-table-column
  88. prop="commissionTypeName"
  89. header-align="center"
  90. align="center"
  91. min-width="140"
  92. :show-overflow-tooltip="true"
  93. :formatter="formatType"
  94. label="委外类别">
  95. </el-table-column>
  96. <el-table-column
  97. prop="specificationExplian"
  98. header-align="center"
  99. align="center"
  100. min-width="100"
  101. :show-tooltip-when-overflow="true"
  102. label="型号及规格">
  103. </el-table-column>
  104. <el-table-column
  105. prop="cnt"
  106. header-align="center"
  107. align="center"
  108. label="数量">
  109. </el-table-column>
  110. <el-table-column
  111. prop="qualifiedCnt"
  112. header-align="center"
  113. align="center"
  114. label="合格数量">
  115. </el-table-column>
  116. <el-table-column
  117. prop="unitName"
  118. header-align="center"
  119. align="center"
  120. min-width="100"
  121. :show-tooltip-when-overflow="true"
  122. label="单位">
  123. </el-table-column>
  124. <el-table-column
  125. prop="deadline"
  126. header-align="center"
  127. align="center"
  128. min-width="160"
  129. :show-tooltip-when-overflow="true"
  130. label="采购期限">
  131. </el-table-column>
  132. <el-table-column
  133. prop="arrivedTime"
  134. header-align="center"
  135. align="center"
  136. min-width="160"
  137. :show-tooltip-when-overflow="true"
  138. label="到料时间">
  139. </el-table-column>
  140. <el-table-column
  141. prop="batchNumber"
  142. header-align="center"
  143. align="center"
  144. min-width="140"
  145. :show-tooltip-when-overflow="true"
  146. label="批次号/用途">
  147. </el-table-column>
  148. <el-table-column
  149. prop="supplierName"
  150. header-align="center"
  151. align="center"
  152. min-width="140"
  153. :show-tooltip-when-overflow="true"
  154. label="供应商">
  155. </el-table-column>
  156. <!-- <el-table-column-->
  157. <!-- prop="technologyFile"-->
  158. <!-- header-align="center"-->
  159. <!-- align="center"-->
  160. <!-- min-width="140"-->
  161. <!-- :show-tooltip-when-overflow="true"-->
  162. <!-- label="工艺文件">-->
  163. <!-- </el-table-column>-->
  164. <el-table-column
  165. header-align="center"
  166. align="center"
  167. label="附件">
  168. <template slot-scope="scope">
  169. <el-button :disabled="!scope.row.attachList || scope.row.attachList.length === 0" type="text" size="small" @click="attachDetails(scope.row)">查看</el-button>
  170. </template>
  171. </el-table-column>
  172. <el-table-column
  173. prop="applyTime"
  174. header-align="center"
  175. align="center"
  176. min-width="160"
  177. :show-tooltip-when-overflow="true"
  178. label="申请时间">
  179. </el-table-column>
  180. <el-table-column
  181. prop="applier"
  182. header-align="center"
  183. align="center"
  184. min-width="140"
  185. :show-tooltip-when-overflow="true"
  186. label="申请人">
  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. </el-table-column>
  196. <el-table-column
  197. prop="notes"
  198. header-align="center"
  199. align="center"
  200. min-width="180"
  201. :show-overflow-tooltip="true"
  202. label="备注">
  203. </el-table-column>
  204. <el-table-column
  205. fixed="right"
  206. prop="approvalState"
  207. header-align="center"
  208. align="center"
  209. :formatter="formatState"
  210. label="审批状态">
  211. </el-table-column>
  212. <el-table-column
  213. fixed="right"
  214. prop="purchaseState"
  215. header-align="center"
  216. align="center"
  217. :formatter="formatOutsourceState"
  218. label="委外状态">
  219. </el-table-column>
  220. <el-table-column
  221. fixed="right"
  222. header-align="center"
  223. align="center"
  224. width="150"
  225. label="操作">
  226. <template slot-scope="scope">
  227. <el-button v-if="isAuth('pur:commDetail:info')" type="text" size="small" @click="detailHandle(scope.row.purchaseId)">查看</el-button>
  228. <el-button v-if="isAuth('pur:commDetail:update') && (Number(scope.row.approvalState) === 1)" type="text" size="small" @click="addOrUpdateHandle(scope.row.purchaseId)">编辑</el-button>
  229. <el-button v-if="isAuth('pur:commDetail:updatePurCommissionDetail') && (Number(scope.row.approvalState) === 3) && (Number(scope.row.purchaseState) === 1)" type="text" size="small" @click="outsourceHandle(scope.row)">委外</el-button>
  230. <el-button v-if="isAuth('pur:commDetail:infoPutIn') && (Number(scope.row.approvalState) === 3) && (Number(scope.row.purchaseState) === 2||(Number(scope.row.purchaseState) === 5))" type="text" size="small" @click="inBound(scope.row)">入库</el-button>
  231. <el-button v-if="isAuth('pur:commDetail:infoPutInAgain') && (Number(scope.row.approvalState) === 3) && (Number(scope.row.purchaseState) === 5)" type="text" size="small" @click="inBound(scope.row)">再次入库</el-button>
  232. </template>
  233. </el-table-column>
  234. </el-table>
  235. <el-pagination
  236. @size-change="sizeChangeHandle"
  237. @current-change="currentChangeHandle"
  238. :current-page="pageIndex"
  239. :page-sizes="[10, 20, 50, 100]"
  240. :page-size="pageSize"
  241. :total="totalPage"
  242. layout="total, sizes, prev, pager, next, jumper">
  243. </el-pagination>
  244. </template>
  245. <!-- 弹窗, 新增 / 修改 -->
  246. <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" @onChose="onChose"></add-or-update>
  247. <detail v-if="detailVisible" ref="detail" @onChose="onChose"/>
  248. <attach-detail v-if="changeAttachVisible" ref="changeDetail" @onChose="onChose"/>
  249. <attach-detail v-if="attachVisible" ref="attachDetail" @onChose="onChose"/>
  250. <notice-change-setting v-if="noticeChangeAttachVisible" ref="noticeChangeSetting" @onChose="onChose"/>
  251. <change-form v-if="changeFormVisible" ref="changeForm" @refreshDataList="getDataList" @onChose="onChose"/>
  252. <!-- 入库 -->
  253. <stock-order-inbound v-if="inboundVisible" ref="inbound" @refreshDataList="getDataList" @onChose="onChose"/>
  254. <outsource-pop v-if="outsourceVisible" ref="refOutsource" @refreshDataList="getDataList" @onChose="onChose"/>
  255. <amount-mask-setting v-if="amountMaskSettingVisible" ref="amountMaskSetting" @onChose="onChose"/>
  256. </div>
  257. </template>
  258. <script>
  259. import AddOrUpdate from './outsource-add-or-update'
  260. import Detail from './outsource-detail'
  261. import { getOutsourceList } from '@/api/sale'
  262. import AttachDetail from '../common/attach-detail'
  263. import NoticeChangeSetting from './outsource-notice-change-setting'
  264. import ChangeForm from '../cus/contract-record-change'
  265. import { getDictList } from '@/api/dict'
  266. import StockOrderInbound from '../warehouse/stock-order-inbound'
  267. import OutsourcePop from './outsource-pop'
  268. import AmountMaskSetting from './outsource-amount-mask-setting'
  269. export default {
  270. name: 'outsource',
  271. components: {
  272. OutsourcePop,
  273. AttachDetail,
  274. AddOrUpdate,
  275. Detail,
  276. NoticeChangeSetting,
  277. ChangeForm,
  278. StockOrderInbound,
  279. AmountMaskSetting
  280. },
  281. data () {
  282. return {
  283. addOrUpdateVisible: false,
  284. detailVisible: false,
  285. attachVisible: false,
  286. changeAttachVisible: false,
  287. noticeChangeAttachVisible: false,
  288. amountMaskSettingVisible: false,
  289. changeFormVisible: false,
  290. inboundVisible: false, // 入库申请
  291. outsourceVisible: false, // 委外
  292. dataForm: {},
  293. dataList: [],
  294. pageIndex: 1,
  295. pageSize: 10,
  296. totalPage: 0,
  297. dataListLoading: false,
  298. dataListSelections: [],
  299. optionsType: [], // 类别
  300. // 委外状态
  301. optionsOutsourceState: [
  302. {code: null, value: '全部'},
  303. {code: '1', value: '待委外'},
  304. {code: '2', value: '委外中'},
  305. {code: '3', value: '已入库'},
  306. {code: '4', value: '入库中'},
  307. {code: '5', value: '入库异常'}
  308. ],
  309. // 审批状态
  310. optionsState: []
  311. }
  312. },
  313. created () {
  314. this.optionsState = this.$store.state.common.approveStates
  315. this.getType()
  316. this.getDataList()
  317. },
  318. methods: {
  319. onChose () {
  320. this.addOrUpdateVisible = false
  321. this.attachVisible = false
  322. this.detailVisible = false
  323. this.noticeChangeAttachVisible = false
  324. this.changeFormVisible = false
  325. this.changeAttachVisible = false
  326. this.inboundVisible = false
  327. this.outsourceVisible = false
  328. this.amountMaskSettingVisible = false
  329. },
  330. // 查询
  331. search () {
  332. this.pageIndex = 1
  333. this.getDataList()
  334. },
  335. // 获取类别
  336. getType () {
  337. getDictList({type: 'commission_type'}).then(({data}) => {
  338. if (data) {
  339. this.optionsType = data
  340. }
  341. })
  342. },
  343. // 获取数据列表
  344. getDataList () {
  345. this.dataListLoading = true
  346. let params = {
  347. 'current': this.pageIndex,
  348. 'size': this.pageSize,
  349. 'goodsName': this.dataForm.goodsName ? this.dataForm.goodsName : null,
  350. 'applyTimeBegin': this.dataForm.date ? this.dataForm.date[0] : null,
  351. 'applyTimeEnd': this.dataForm.date ? this.dataForm.date[1] : null,
  352. 'purchaseState': this.dataForm.purchaseState ? this.dataForm.purchaseState : null,
  353. 'commissionType': this.dataForm.commissionType ? this.dataForm.commissionType : null
  354. }
  355. getOutsourceList(params).then(({data}) => {
  356. if (data && data.code === '200' && data.data) {
  357. this.dataList = data.data.records
  358. this.totalPage = Number(data.data.total)
  359. } else {
  360. this.dataList = []
  361. this.totalPage = 0
  362. }
  363. this.dataListLoading = false
  364. })
  365. },
  366. deleteHandle (id) {
  367. if (!id) return
  368. let ids = []
  369. ids.push(id)
  370. this.$confirm(`确定删除?`, '提示', {
  371. confirmButtonText: '确定',
  372. cancelButtonText: '取消',
  373. type: 'warning'
  374. }).then(() => {
  375. this.$http({
  376. url: this.$http.adornUrl(`/biz-service/cusContractBook/delete`),
  377. method: 'DELETE',
  378. data: ids
  379. }).then(({data}) => {
  380. if (data && data.code === '200') {
  381. this.$message({
  382. message: '操作成功',
  383. type: 'success',
  384. duration: 1500,
  385. onClose: () => {
  386. this.getDataList()
  387. }
  388. })
  389. } else {
  390. this.$message.error(data.msg)
  391. }
  392. })
  393. }).catch(() => {})
  394. },
  395. // 每页数
  396. sizeChangeHandle (val) {
  397. this.pageSize = val
  398. this.pageIndex = 1
  399. this.getDataList()
  400. },
  401. // 当前页
  402. currentChangeHandle (val) {
  403. this.pageIndex = val
  404. this.getDataList()
  405. },
  406. // 多选
  407. selectionChangeHandle (val) {
  408. this.dataListSelections = val
  409. },
  410. // 新增 / 修改
  411. addOrUpdateHandle (id) {
  412. this.addOrUpdateVisible = true
  413. this.$nextTick(() => {
  414. this.$refs.addOrUpdate.init(id)
  415. })
  416. },
  417. // 变更
  418. changeHandle (id) {
  419. this.changeFormVisible = true
  420. this.$nextTick(() => {
  421. this.$refs.changeForm.init(id)
  422. })
  423. },
  424. // 详情
  425. detailHandle (id) {
  426. this.detailVisible = true
  427. this.$nextTick(() => {
  428. this.$refs.detail.init(id)
  429. })
  430. },
  431. // 变更通知人设置
  432. setNoticeChangeHandle () {
  433. this.noticeChangeAttachVisible = true
  434. this.$nextTick(() => {
  435. this.$refs.noticeChangeSetting.init()
  436. })
  437. },
  438. // 物料更改通知单
  439. changeDetails (row) {
  440. this.changeAttachVisible = true
  441. this.$nextTick(() => {
  442. this.$refs.changeDetail.init(row.noticeAttachList)
  443. })
  444. },
  445. // 转换属性“委外状态”
  446. formatOutsourceState (row) {
  447. if (!row.purchaseState) return ''
  448. const item1 = this.optionsOutsourceState.find((item) => item.code === row.purchaseState.toString())
  449. return item1 ? item1.value : ''
  450. },
  451. // 转换属性“类别”
  452. formatType (row) {
  453. if (!row.commissionType) return ''
  454. const item1 = this.optionsType.find((item) => item.code === row.commissionType.toString())
  455. return item1 ? item1.value : ''
  456. },
  457. // 转换属性“审批状态”
  458. formatState (row) {
  459. if (!row.approvalState) return ''
  460. const item1 = this.optionsState.find((item) => item.code === row.approvalState.toString())
  461. return item1 ? item1.value : ''
  462. },
  463. // 附件
  464. attachDetails (row) {
  465. this.attachVisible = true
  466. this.$nextTick(() => {
  467. this.$refs.attachDetail.init(row.attachList)
  468. })
  469. },
  470. // 高亮表格
  471. tableRowClassName ({row, rowIndex}) {
  472. if (!row.purchaseState) return ''
  473. if (Number(row.purchaseState) === 0) {
  474. return 'warning-row'
  475. }
  476. return ''
  477. },
  478. // 入库申请
  479. inBound (row) {
  480. if (!row) return
  481. let dataForm = {...row,
  482. buttonType: '1',
  483. sourceCategory: '3', // 入库依据类别
  484. materialName: row.productName,
  485. tableId: row.purComDetailId, // 主表ID
  486. specifications: row.specificationExplian
  487. }
  488. this.inboundVisible = true
  489. this.$nextTick(() => {
  490. this.$refs.inbound.init(0, false, dataForm)
  491. })
  492. },
  493. // 委外
  494. outsourceHandle (row) {
  495. this.outsourceVisible = true
  496. this.$nextTick(() => {
  497. this.$refs.refOutsource.init(row.purComDetailId, row.cnt)
  498. })
  499. },
  500. // 变更通知人设置
  501. setNoticeChangeHandel () {
  502. this.noticeChangeAttachVisible = true
  503. this.$nextTick(() => {
  504. this.$refs.noticeChangeSetting.init()
  505. })
  506. },
  507. // 委外金额屏蔽设置
  508. setAmountMaskHandel () {
  509. this.amountMaskSettingVisible = true
  510. this.$nextTick(() => {
  511. this.$refs.amountMaskSetting.init()
  512. })
  513. }
  514. }
  515. }
  516. </script>
  517. <style scoped>
  518. </style>
  519. <style>
  520. .el-table .warning-row {
  521. background: #fbc4c4;
  522. }
  523. </style>