outsource.vue 14 KB

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