outsource.vue 15 KB

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