order.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. <!-- 订单 -->
  2. <template>
  3. <div class="order">
  4. <template v-if="!addOrUpdateVisible && !detailVisible && !arrivedVisible && !confirmVisible && !noticeChangeAttachVisible">
  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-form-item>
  37. </el-form>
  38. <el-table
  39. :data="dataList"
  40. border
  41. v-loading="dataListLoading"
  42. @selection-change="selectionChangeHandle"
  43. style="width: 100%;">
  44. <el-table-column
  45. label="序号"
  46. type="index"
  47. width="50"
  48. align="center">
  49. </el-table-column>
  50. <el-table-column
  51. prop="orderCode"
  52. header-align="center"
  53. align="center"
  54. min-width="180"
  55. :show-tooltip-when-overflow="true"
  56. label="订单编码">
  57. </el-table-column>
  58. <el-table-column
  59. prop="customerName"
  60. header-align="center"
  61. align="center"
  62. min-width="180"
  63. :show-overflow-tooltip="true"
  64. label="客户名称">
  65. </el-table-column>
  66. <el-table-column
  67. prop="contractNumber"
  68. header-align="center"
  69. align="center"
  70. min-width="120"
  71. :show-tooltip-when-overflow="true"
  72. label="合同号">
  73. </el-table-column>
  74. <el-table-column
  75. prop="createTime"
  76. header-align="center"
  77. align="center"
  78. min-width="160"
  79. label="下单时间">
  80. </el-table-column>
  81. <el-table-column
  82. prop="deliveryDate"
  83. header-align="center"
  84. align="center"
  85. min-width="160"
  86. label="合同交期">
  87. </el-table-column>
  88. <el-table-column
  89. prop="batchNumber"
  90. header-align="center"
  91. align="center"
  92. width="140"
  93. :show-tooltip-when-overflow="true"
  94. label="批次号">
  95. </el-table-column>
  96. <el-table-column
  97. prop="-"
  98. header-align="center"
  99. align="center"
  100. min-width="120"
  101. :formatter="formatState"
  102. label="审批状态">
  103. </el-table-column>
  104. <el-table-column
  105. prop="-"
  106. header-align="center"
  107. align="center"
  108. min-width="120"
  109. :formatter="formatOrderState"
  110. label="订单状态">
  111. </el-table-column>
  112. <el-table-column
  113. prop="approver"
  114. header-align="center"
  115. align="center"
  116. :min-width="140"
  117. :show-overflow-tooltip="true"
  118. label="当前审批人">
  119. </el-table-column>
  120. <el-table-column
  121. prop="completeDate"
  122. header-align="center"
  123. align="center"
  124. min-width="160"
  125. label="订单完成时间">
  126. </el-table-column>
  127. <el-table-column
  128. prop="notes"
  129. header-align="center"
  130. align="center"
  131. min-width="180"
  132. :show-overflow-tooltip="true"
  133. label="备注">
  134. </el-table-column>
  135. <el-table-column
  136. fixed="right"
  137. header-align="center"
  138. align="center"
  139. width="120"
  140. label="操作">
  141. <template slot-scope="scope">
  142. <el-button v-if="isAuth('order:ctl:info')" type="text" size="small" @click="detailHandle(scope.row.orderId)">查看</el-button>
  143. <el-button v-if="isAuth('order:ctl:editor') && Number(scope.row.state) === 1" type="text" size="small" @click="addOrUpdateHandle(scope.row.orderId,false)">编辑</el-button>
  144. <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>
  145. <!-- <el-button v-if="isAuth('order:ctl:deliver') && Number(scope.row.orderState) === 3" type="text" size="small" @click="deliverHandle(scope.row.orderId)">发货</el-button>-->
  146. <!-- <el-button v-if="isAuth('order:ctl:arrived') && Number(scope.row.orderState) === 4 " type="text" size="small" @click="arrivedHandle(scope.row)">送达</el-button>-->
  147. </template>
  148. </el-table-column>
  149. </el-table>
  150. <el-pagination
  151. @size-change="sizeChangeHandle"
  152. @current-change="currentChangeHandle"
  153. :current-page="pageIndex"
  154. :page-sizes="[10, 20, 50, 100]"
  155. :page-size="pageSize"
  156. :total="totalPage"
  157. layout="total, sizes, prev, pager, next, jumper">
  158. </el-pagination>
  159. </template>
  160. <!-- 弹窗, 新增 / 修改 -->
  161. <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" @onChose="onChose"></add-or-update>
  162. <detail v-if="detailVisible" ref="detail" @onChose="onChose"/>
  163. <dispatch-arrived v-if="arrivedVisible" ref="arrived" @refreshDataList="getDataList" @onChose="onChose"></dispatch-arrived>
  164. <notice-change-setting v-if="noticeChangeAttachVisible" ref="noticeChangeSetting" @onChose="onChose"/>
  165. </div>
  166. </template>
  167. <script>
  168. import AddOrUpdate from './order-add-or-update'
  169. import Detail from './order-detail'
  170. import { getOrderList, deliverOrder } from '@/api/sale'
  171. import CusComponent from '../common/cus-component'
  172. import DispatchArrived from './dispatch-arrived'
  173. import NoticeChangeSetting from './order-notice-change-setting'
  174. export default {
  175. name: 'order',
  176. components: {
  177. DispatchArrived,
  178. CusComponent,
  179. AddOrUpdate,
  180. Detail,
  181. NoticeChangeSetting
  182. },
  183. created () {
  184. this.optionsState = this.$store.state.common.approveStates
  185. this.queryData()
  186. },
  187. data () {
  188. return {
  189. addOrUpdateVisible: false,
  190. detailVisible: false,
  191. arrivedVisible: false,
  192. confirmVisible: false,
  193. noticeChangeAttachVisible: false,
  194. dataForm: {},
  195. dataList: [],
  196. pageIndex: 1,
  197. pageSize: 10,
  198. totalPage: 0,
  199. dataListLoading: false,
  200. dataListSelections: [],
  201. optionsState: [ ],
  202. optionsOrderState: [
  203. {
  204. code: '1', value: '未开始'
  205. },
  206. {
  207. code: '2', value: '进行中'
  208. },
  209. {
  210. code: '3', value: '已完成'
  211. },
  212. {
  213. code: '4', value: '已发货'
  214. },
  215. {
  216. code: '5', value: '已送达'
  217. },
  218. {
  219. code: '6', value: '技术待确定'
  220. }
  221. ],
  222. optionsCustomer: []
  223. }
  224. },
  225. methods: {
  226. onChose () {
  227. this.addOrUpdateVisible = false
  228. this.detailVisible = false
  229. this.arrivedVisible = false
  230. this.confirmVisible = false
  231. this.noticeChangeAttachVisible = false
  232. },
  233. // 查询
  234. queryData () {
  235. this.pageIndex = 1
  236. this.getDataList()
  237. },
  238. // 获取数据列表
  239. getDataList () {
  240. this.dataListLoading = true
  241. let params = {
  242. 'current': this.pageIndex,
  243. 'size': this.pageSize,
  244. 'createTime': this.dataForm.createTime ? this.dataForm.createTime : null,
  245. 'contractNumber': this.dataForm.contractNumber ? this.dataForm.contractNumber : null,
  246. 'customerId': this.dataForm.customerId ? this.dataForm.customerId : null,
  247. 'orderState': this.dataForm.orderState ? this.dataForm.orderState : null
  248. }
  249. getOrderList(params).then(({data}) => {
  250. if (data && data.code === '200') {
  251. this.dataList = data.data.records
  252. this.totalPage = Number(data.data.total)
  253. } else {
  254. this.dataList = []
  255. this.totalPage = 0
  256. }
  257. this.dataListLoading = false
  258. })
  259. },
  260. // 每页数
  261. sizeChangeHandle (val) {
  262. this.pageSize = val
  263. this.pageIndex = 1
  264. this.getDataList()
  265. },
  266. // 当前页
  267. currentChangeHandle (val) {
  268. this.pageIndex = val
  269. this.getDataList()
  270. },
  271. // 多选
  272. selectionChangeHandle (val) {
  273. this.dataListSelections = val
  274. },
  275. // 新增 / 修改
  276. addOrUpdateHandle (id, disable) {
  277. this.addOrUpdateVisible = true
  278. this.$nextTick(() => {
  279. this.$refs.addOrUpdate.init(id, disable)
  280. })
  281. },
  282. // 转换属性“审批状态”
  283. formatState (row) {
  284. if (!row.state) return ''
  285. const item1 = this.optionsState.find((item) => item.code === row.state.toString())
  286. return item1 ? item1.value : ''
  287. },
  288. // 转换属性“订单状态”
  289. formatOrderState (row) {
  290. if (!row.orderState) return ''
  291. const item1 = this.optionsOrderState.find((item) => item.code === row.orderState.toString())
  292. return item1 ? item1.value : ''
  293. },
  294. // 详情
  295. detailHandle (id) {
  296. this.detailVisible = true
  297. this.$nextTick(() => {
  298. this.$refs.detail.init(id)
  299. })
  300. },
  301. // 发货
  302. deliverHandle (orderId) {
  303. if (!orderId) return
  304. this.$confirm(`确定发货?`, '提示', {
  305. confirmButtonText: '确定',
  306. cancelButtonText: '取消',
  307. type: 'warning'
  308. }).then(() => {
  309. deliverOrder({orderId: orderId}).then(({data}) => {
  310. if (data && data.code === '200') {
  311. this.$message({
  312. message: '操作成功',
  313. type: 'success',
  314. duration: 1500,
  315. onClose: () => {
  316. this.getDataList()
  317. }
  318. })
  319. } else {
  320. this.$message.error(data.msg)
  321. }
  322. })
  323. }).catch(() => {})
  324. },
  325. // 送达
  326. arrivedHandle (row) {
  327. this.arrivedVisible = true
  328. this.$nextTick(() => {
  329. this.$refs.arrived.init(row.orderId, row.orderCode)
  330. })
  331. },
  332. // 技术确定
  333. techConfirm (row) {
  334. this.addOrUpdateVisible = true
  335. this.$nextTick(() => {
  336. this.$refs.addOrUpdate.init(row.orderId, false, 2)
  337. })
  338. },
  339. // 变更通知人设置
  340. setNoticeChangeHandel () {
  341. this.noticeChangeAttachVisible = true
  342. this.$nextTick(() => {
  343. this.$refs.noticeChangeSetting.init()
  344. })
  345. }
  346. }
  347. }
  348. </script>
  349. <style scoped>
  350. </style>