outsource.vue 17 KB

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