order.vue 17 KB

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