order.vue 13 KB

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