order.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437
  1. <!-- 任务单列表 -->
  2. <template>
  3. <div class="order">
  4. <template v-if="!attachVisible && !addOrUpdateVisible && !detailVisible && !arrivedVisible && !confirmVisible && !noticeChangeAttachVisible && !amountMaskSettingVisible">
  5. <el-form :inline="true" :model="dataForm" @keyup.enter.native="queryData()">
  6. <el-form-item label="客户名称">
  7. <cus-component v-model="dataForm.customerId" :cus-id="dataForm.customerId"></cus-component>
  8. </el-form-item>
  9. <el-form-item label="合同编码">
  10. <el-input v-model="dataForm.contractNumber" placeholder="合同号" clearable></el-input>
  11. </el-form-item>
  12. <el-form-item label="状态" prop="orderState">
  13. <el-select
  14. v-model="dataForm.orderState"
  15. remote
  16. placeholder="请选择">
  17. <el-option
  18. v-for="item in optionsOrderState"
  19. :key="item.code"
  20. :label="item.value"
  21. :value="item.code">
  22. </el-option>
  23. </el-select>
  24. </el-form-item>
  25. <el-form-item label="创建日期">
  26. <el-date-picker
  27. v-model="dataForm.createTime"
  28. value-format="yyyy-MM-dd"
  29. type="date">
  30. </el-date-picker>
  31. </el-form-item>
  32. <el-form-item>
  33. <el-button @click="queryData()">查询</el-button>
  34. <el-button v-if="isAuth('order:ctl:save')" @click="addOrUpdateHandle(0, false)" type="primary">创建任务单</el-button>
  35. <el-button v-if="isAuth('order:ctl:noteChangeConfig')" type="primary" @click="setNoticeChangeHandel()">任务单变更通知设置</el-button>
  36. <el-button v-if="isAuth('order:ctl:priceConfig')" type="primary" @click="setAmountMaskHandel()">任务单金额屏蔽设置</el-button>
  37. </el-form-item>
  38. </el-form>
  39. <el-table
  40. :data="dataList"
  41. border
  42. v-loading="dataListLoading"
  43. @selection-change="selectionChangeHandle"
  44. style="width: 100%;">
  45. <el-table-column
  46. label="序号"
  47. type="index"
  48. width="50"
  49. align="center">
  50. </el-table-column>
  51. <el-table-column
  52. prop="orderCode"
  53. header-align="center"
  54. align="center"
  55. min-width="180"
  56. :show-tooltip-when-overflow="true"
  57. label="任务单编码">
  58. </el-table-column>
  59. <el-table-column
  60. prop="productName"
  61. header-align="center"
  62. align="center"
  63. min-width="160"
  64. :show-tooltip-when-overflow="true"
  65. label="物料名称">
  66. </el-table-column>
  67. <el-table-column
  68. prop="mapNumber"
  69. header-align="center"
  70. align="center"
  71. min-width="160"
  72. :show-tooltip-when-overflow="true"
  73. label="主图号">
  74. </el-table-column>
  75. <el-table-column
  76. prop="productSpec"
  77. header-align="center"
  78. align="center"
  79. min-width="160"
  80. :show-tooltip-when-overflow="true"
  81. label="物料规格">
  82. </el-table-column>
  83. <el-table-column
  84. prop="cnt"
  85. header-align="center"
  86. align="center"
  87. min-width="80"
  88. label="单套数量">
  89. </el-table-column>
  90. <el-table-column
  91. prop="customerName"
  92. header-align="center"
  93. align="center"
  94. min-width="180"
  95. :show-overflow-tooltip="true"
  96. label="客户名称">
  97. </el-table-column>
  98. <el-table-column
  99. prop="contractNumber"
  100. header-align="center"
  101. align="center"
  102. min-width="120"
  103. :show-tooltip-when-overflow="true"
  104. label="合同号">
  105. </el-table-column>
  106. <el-table-column
  107. prop="createTime"
  108. header-align="center"
  109. align="center"
  110. min-width="160"
  111. label="下单时间">
  112. </el-table-column>
  113. <el-table-column
  114. fixed="right"
  115. prop="deliveryDate"
  116. header-align="center"
  117. align="center"
  118. min-width="160"
  119. label="合同交期">
  120. </el-table-column>
  121. <el-table-column
  122. fixed="right"
  123. prop="state"
  124. header-align="center"
  125. align="center"
  126. min-width="120"
  127. :formatter="formatState"
  128. label="评审状态">
  129. </el-table-column>
  130. <el-table-column
  131. fixed="right"
  132. prop="orderState"
  133. header-align="center"
  134. align="center"
  135. min-width="120"
  136. :formatter="formatOrderState"
  137. label="任务单状态">
  138. </el-table-column>
  139. <el-table-column
  140. prop="approver"
  141. header-align="center"
  142. align="center"
  143. :min-width="140"
  144. :show-overflow-tooltip="true"
  145. label="当前审批人">
  146. </el-table-column>
  147. <el-table-column
  148. prop="completeDate"
  149. header-align="center"
  150. align="center"
  151. min-width="160"
  152. label="任务单完成时间">
  153. </el-table-column>
  154. <el-table-column
  155. prop="notes"
  156. header-align="center"
  157. align="center"
  158. min-width="180"
  159. :show-overflow-tooltip="true"
  160. label="备注">
  161. </el-table-column>
  162. <el-table-column
  163. header-align="center"
  164. align="center"
  165. label="附件">
  166. <template slot-scope="scope">
  167. <el-button :disabled="!scope.row.attachList || scope.row.attachList.length === 0" type="text" size="small" @click="attachDetails(scope.row)">查看</el-button>
  168. </template>
  169. </el-table-column>
  170. <el-table-column
  171. fixed="right"
  172. header-align="center"
  173. align="center"
  174. width="120"
  175. label="操作">
  176. <template slot-scope="scope">
  177. <el-button v-if="isAuth('order:ctl:info')" type="text" size="small" @click="detailHandle(scope.row.orderId)">查看</el-button>
  178. <el-button v-if="isAuth('order:ctl:editor') && (Number(scope.row.state) === 0 || Number(scope.row.state) === 2)" type="text" size="small" @click="addOrUpdateHandle(scope.row.orderId,false)">编辑</el-button>
  179. <el-button v-if="isAuth('order:clt:revoke') && Number(scope.row.state) === 1 && scope.row.creatorId === userId.toString()" type="text" size="small" @click="cancelOrder(scope.row)">撤回</el-button>
  180. <el-button v-if="isAuth('order:ctl:determine') && Number(scope.row.state) === 3 && Number(scope.row.orderState) === 6" type="text" size="small" @click="techConfirm(scope.row)">技术确定</el-button>
  181. </template>
  182. </el-table-column>
  183. </el-table>
  184. <el-pagination
  185. @size-change="sizeChangeHandle"
  186. @current-change="currentChangeHandle"
  187. :current-page="pageIndex"
  188. :page-sizes="[10, 20, 50, 100]"
  189. :page-size="pageSize"
  190. :total="totalPage"
  191. layout="total, sizes, prev, pager, next, jumper">
  192. </el-pagination>
  193. </template>
  194. <!-- 弹窗, 新增 / 修改 -->
  195. <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" @onChose="onChose"></add-or-update>
  196. <detail v-if="detailVisible" ref="detail" @onChose="onChose"/>
  197. <dispatch-arrived v-if="arrivedVisible" ref="arrived" @refreshDataList="getDataList" @onChose="onChose"></dispatch-arrived>
  198. <notice-change-setting v-if="noticeChangeAttachVisible" ref="noticeChangeSetting" @onChose="onChose"/>
  199. <amount-mask-setting v-if="amountMaskSettingVisible" ref="amountMaskSetting" @onChose="onChose"/>
  200. <!-- 文件预览 -->
  201. <attach-detail v-if="attachVisible" ref="attachDetail" @onChose="onChose"/>
  202. </div>
  203. </template>
  204. <script>
  205. import AddOrUpdate from './order-add-or-update'
  206. import Detail from './order-detail'
  207. import { getOrderList, deliverOrder, revokeOrder } from '@/api/sale'
  208. import CusComponent from '../common/cus-component'
  209. import DispatchArrived from './dispatch-arrived'
  210. import NoticeChangeSetting from './order-notice-change-setting'
  211. import AmountMaskSetting from './order-amount-mask-setting'
  212. import AttachDetail from '@/views/modules/common/attach-detail.vue'
  213. export default {
  214. name: 'order',
  215. components: {
  216. AttachDetail,
  217. DispatchArrived,
  218. CusComponent,
  219. AddOrUpdate,
  220. Detail,
  221. NoticeChangeSetting,
  222. AmountMaskSetting
  223. },
  224. created () {
  225. this.optionsState = this.$store.state.common.approveStates
  226. this.userId = this.$store.state.user.id
  227. this.queryData()
  228. },
  229. data () {
  230. return {
  231. addOrUpdateVisible: false,
  232. detailVisible: false,
  233. arrivedVisible: false,
  234. confirmVisible: false,
  235. noticeChangeAttachVisible: false,
  236. amountMaskSettingVisible: false,
  237. dataForm: {},
  238. dataList: [],
  239. pageIndex: 1,
  240. pageSize: 10,
  241. totalPage: 0,
  242. dataListLoading: false,
  243. dataListSelections: [],
  244. optionsState: [ ],
  245. userId: 0,
  246. optionsOrderState: [
  247. {
  248. code: '1', value: '未开始'
  249. },
  250. {
  251. code: '2', value: '进行中'
  252. },
  253. {
  254. code: '3', value: '已完成'
  255. },
  256. {
  257. code: '4', value: '已发货'
  258. },
  259. {
  260. code: '5', value: '已送达'
  261. },
  262. {
  263. code: '6', value: '技术待确定'
  264. }
  265. ],
  266. optionsCustomer: [],
  267. attachVisible: false
  268. }
  269. },
  270. methods: {
  271. onChose () {
  272. this.addOrUpdateVisible = false
  273. this.detailVisible = false
  274. this.arrivedVisible = false
  275. this.confirmVisible = false
  276. this.noticeChangeAttachVisible = false
  277. this.amountMaskSettingVisible = false
  278. this.attachVisible = false
  279. },
  280. // 查询
  281. queryData () {
  282. this.pageIndex = 1
  283. this.getDataList()
  284. },
  285. // 获取数据列表
  286. getDataList () {
  287. this.dataListLoading = true
  288. let params = {
  289. 'current': this.pageIndex,
  290. 'size': this.pageSize,
  291. 'createTime': this.dataForm.createTime ? this.dataForm.createTime : null,
  292. 'contractNumber': this.dataForm.contractNumber ? this.dataForm.contractNumber : null,
  293. 'customerId': this.dataForm.customerId ? this.dataForm.customerId : null,
  294. 'orderState': this.dataForm.orderState ? this.dataForm.orderState : null
  295. }
  296. getOrderList(params).then(({data}) => {
  297. if (data && data.code === '200') {
  298. this.dataList = data.data.records
  299. this.totalPage = Number(data.data.total)
  300. } else {
  301. this.dataList = []
  302. this.totalPage = 0
  303. }
  304. this.dataListLoading = false
  305. })
  306. },
  307. // 每页数
  308. sizeChangeHandle (val) {
  309. this.pageSize = val
  310. this.pageIndex = 1
  311. this.getDataList()
  312. },
  313. // 当前页
  314. currentChangeHandle (val) {
  315. this.pageIndex = val
  316. this.getDataList()
  317. },
  318. // 多选
  319. selectionChangeHandle (val) {
  320. this.dataListSelections = val
  321. },
  322. // 新增 / 修改
  323. addOrUpdateHandle (id, disable) {
  324. this.addOrUpdateVisible = true
  325. this.$nextTick(() => {
  326. this.$refs.addOrUpdate.init(id, disable)
  327. })
  328. },
  329. // 转换属性“审批状态”
  330. formatState (row) {
  331. if (!row.state) return ''
  332. const item1 = this.optionsState.find((item) => item.code === row.state.toString())
  333. return item1 ? item1.value : ''
  334. },
  335. // 转换属性“任务单状态”
  336. formatOrderState (row) {
  337. if (!row.orderState) return ''
  338. const item1 = this.optionsOrderState.find((item) => item.code === row.orderState.toString())
  339. return item1 ? item1.value : ''
  340. },
  341. // 详情
  342. detailHandle (id) {
  343. this.detailVisible = true
  344. this.$nextTick(() => {
  345. this.$refs.detail.init(id)
  346. })
  347. },
  348. // 发货
  349. deliverHandle (orderId) {
  350. if (!orderId) return
  351. this.$confirm(`确定发货?`, '提示', {
  352. confirmButtonText: '确定',
  353. cancelButtonText: '取消',
  354. type: 'warning'
  355. }).then(() => {
  356. deliverOrder({orderId: orderId}).then(({data}) => {
  357. if (data && data.code === '200') {
  358. this.$message({
  359. message: '操作成功',
  360. type: 'success',
  361. duration: 1500,
  362. onClose: () => {
  363. this.getDataList()
  364. }
  365. })
  366. } else {
  367. this.$message.error(data.msg)
  368. }
  369. })
  370. }).catch(() => {})
  371. },
  372. // 送达
  373. arrivedHandle (row) {
  374. this.arrivedVisible = true
  375. this.$nextTick(() => {
  376. this.$refs.arrived.init(row.orderId, row.orderCode)
  377. })
  378. },
  379. // 技术确定
  380. techConfirm (row) {
  381. this.addOrUpdateVisible = true
  382. this.$nextTick(() => {
  383. this.$refs.addOrUpdate.init(row.orderId, false, 2)
  384. })
  385. },
  386. // 变更通知人设置
  387. setNoticeChangeHandel () {
  388. this.noticeChangeAttachVisible = true
  389. this.$nextTick(() => {
  390. this.$refs.noticeChangeSetting.init()
  391. })
  392. },
  393. // 撤回任务单
  394. cancelOrder (row) {
  395. this.$confirm(`确定撤回任务单${row.orderCode}?`, '提示', {
  396. confirmButtonText: '确定',
  397. cancelButtonText: '取消',
  398. type: 'warning'
  399. }).then(() => {
  400. revokeOrder({id: row.orderId}).then(({data}) => {
  401. if (data && data.code === '200') {
  402. this.$message({
  403. message: '撤回成功',
  404. type: 'success',
  405. duration: 1500,
  406. onClose: () => {
  407. this.getDataList()
  408. }
  409. })
  410. } else {
  411. this.$message.error(data.msg)
  412. }
  413. })
  414. }).catch(() => {})
  415. },
  416. // 采购金额屏蔽设置
  417. setAmountMaskHandel () {
  418. this.amountMaskSettingVisible = true
  419. this.$nextTick(() => {
  420. this.$refs.amountMaskSetting.init()
  421. })
  422. },
  423. // 附件
  424. attachDetails (row) {
  425. this.attachVisible = true
  426. this.$nextTick(() => {
  427. this.$refs.attachDetail.init(row.attachList)
  428. })
  429. }
  430. }
  431. }
  432. </script>
  433. <style scoped>
  434. </style>