index.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. <template>
  2. <!-- 工单池 -->
  3. <template-page ref="pageRef" :getList="getList" :operation="operation" :exportList="exportList"
  4. :optionsEvensGroup="optionsEvensGroup" :columnParsing="columnParsing" :tableAttributes="tableAttributes"
  5. :tableEvents="tableEvents" :moreParameters="moreParameters" :screeningAnalysis="screeningAnalysis"
  6. :filterMethod="filterMethod" :replaceOrNotMap="true">
  7. <!-- 创建工单 -->
  8. <div class="cartographer_big">
  9. <el-dialog title="创建工单" width="100%" :modal="false" :visible.sync="createFormBool" :before-close="handleClose">
  10. <workOrderInfo v-if="createFormBool" />
  11. </el-dialog>
  12. </div>
  13. <!-- 工单详情 -->
  14. <div class="cartographer_big">
  15. <el-dialog title="工单详情" width="100%" :modal="false" :visible.sync="detailFormBool" :before-close="handleClose">
  16. <Detail v-if="detailFormBool" :id="id" />
  17. </el-dialog>
  18. </div>
  19. <!-- 批量预约/改约 -->
  20. <div class="cartographer_big">
  21. <el-dialog title="批量约单" width="100%" :modal="false" :visible.sync="rescheduleBool"
  22. :before-close="rescheduleClose">
  23. <Reschedule v-if="rescheduleBool" :recordSelected="recordSelected" @close="rescheduleClose" />
  24. </el-dialog>
  25. </div>
  26. <!-- 批量派工/改派 -->
  27. <div class="cartographer_big">
  28. <el-dialog title="批量派单" width="100%" :modal="false" :visible.sync="reassignmentBool"
  29. :before-close="reassignmentClose">
  30. <Reassignment v-if="reassignmentBool" :recordSelected="recordSelected" @close="reassignmentClose" />
  31. </el-dialog>
  32. </div>
  33. </template-page>
  34. </template>
  35. <script>
  36. import { EventBus } from '@/utils/eventBus'
  37. import TemplatePage from '@/components/template/template-page-1.vue'
  38. import import_mixin from '@/components/template/import_mixin.js'
  39. import { listPageV2 } from "@/api/workOrder/orderType";
  40. import { orderBaseList, orderBaseListExport, orderBaseStatusCount } from "@/api/workOrderPool.js"
  41. import workOrderInfo from './detailModule/workOrderInfo/index.vue'
  42. import Detail from './detail'
  43. import Reassignment from "./components/reassignment/index.vue"
  44. import Reschedule from "./components/reschedule/index.vue"
  45. export default {
  46. components: {
  47. TemplatePage,
  48. workOrderInfo,
  49. Detail,
  50. Reassignment,
  51. Reschedule
  52. },
  53. mixins: [import_mixin],
  54. data() {
  55. return {
  56. id: this.$route.query.id || '',
  57. // 创建表单
  58. createFormBool: false,
  59. // 详情
  60. detailFormBool: false,
  61. // 批量改约
  62. rescheduleBool: false,
  63. // 批量派工/改派
  64. reassignmentBool: false,
  65. // 表格属性
  66. tableAttributes: {
  67. // 启用勾选列
  68. selectColumn: true
  69. },
  70. // 表格事件
  71. tableEvents: {
  72. 'selection-change': this.selectionChange
  73. },
  74. recordSelected: [],
  75. orderTypeList: []
  76. }
  77. },
  78. computed: {
  79. moreParameters() {
  80. return [
  81. {
  82. name: '工单类型',
  83. key: 'orderSmallType',
  84. value: '',
  85. conditions: [{
  86. label: "全部",
  87. value: ""
  88. }, ...this.orderTypeList]
  89. },
  90. {
  91. name: '工单状态',
  92. key: 'orderStatus',
  93. value: '',
  94. conditions: [{
  95. label: "全部",
  96. value: ""
  97. }, {
  98. label: "待预约",
  99. value: "DYY"
  100. }, {
  101. label: "待商户派工",
  102. value: "DSHPG"
  103. }, {
  104. label: "待网点派工",
  105. value: "DWDPG"
  106. }, {
  107. label: "待接单",
  108. value: "DJD"
  109. }, {
  110. label: "服务中",
  111. value: "FWZ"
  112. }, {
  113. label: "异常单",
  114. value: "YCD"
  115. }, {
  116. label: "已完工待结算",
  117. value: "YWG"
  118. }, {
  119. label: "已结算",
  120. value: "YJS"
  121. }, {
  122. label: "已取消",
  123. value: "YQX"
  124. }]
  125. }
  126. ]
  127. },
  128. // 用户信息
  129. userInfo() {
  130. return JSON.parse(localStorage.getItem('greemall_user'))
  131. },
  132. // 事件组合
  133. optionsEvensGroup() {
  134. return [
  135. [
  136. [
  137. {
  138. name: '创建工单',
  139. click: () => {
  140. this.createFormBool = true
  141. }
  142. },
  143. ],
  144. [
  145. {
  146. name: '批量操作',
  147. click: () => { }
  148. },
  149. {
  150. name: '批量下派改派',
  151. click: () => {
  152. if (this.recordSelected.length === 0) {
  153. this.$message.warning('请勾选工单')
  154. return
  155. }
  156. this.reassignmentBool = true
  157. }
  158. },
  159. {
  160. name: '批量预约改约',
  161. click: () => {
  162. if (this.recordSelected.length === 0) {
  163. this.$message.warning('请勾选工单')
  164. return
  165. }
  166. this.rescheduleBool = true
  167. }
  168. },
  169. ],
  170. ]
  171. ]
  172. }
  173. },
  174. created() {
  175. EventBus.$on('handleOrderClone', () => {
  176. this.handleClose()
  177. })
  178. // 获取工单类型
  179. listPageV2({ "pageNum": 1, "pageSize": -1, "params": [{ "param": "a.status", "compare": "=", "value": "true" }] }).then(res => {
  180. this.orderTypeList = res.data.records.map(item => ({
  181. value: item.id,
  182. label: item.orderSmallTypeText
  183. }))
  184. })
  185. },
  186. methods: {
  187. screeningAnalysis(jname, val) {
  188. if (jname == 'orderFlags') {
  189. return (val || []).map(item => item.tagName).join(',')
  190. } else {
  191. return val
  192. }
  193. },
  194. filterMethod(value, row, column) {
  195. if (column['property'] == 'orderFlags') {
  196. return (row[column['property']] || []).map(item => item.tagName).join(',') === value
  197. }
  198. return row[column['property']] === value
  199. },
  200. // 列表请求函数
  201. getList(p, cb) {
  202. try {
  203. var pam = JSON.parse(JSON.stringify(p))
  204. if (pam.orderStatus) {
  205. pam.params.push({ "param": "a.order_status", "compare": "=", "value": pam.orderStatus })
  206. }
  207. if (pam.orderSmallType) {
  208. pam.params.push({ "param": "a.order_small_type", "compare": "=", "value": pam.orderSmallType })
  209. }
  210. cb && cb(pam)
  211. return orderBaseList(pam)
  212. } catch (err) {
  213. } finally {
  214. this.$nextTick(() => {
  215. orderBaseStatusCount().then(res => {
  216. console.log(res)
  217. })
  218. })
  219. }
  220. },
  221. // 列表导出函数
  222. exportList: orderBaseListExport,
  223. // 表格列解析渲染数据更改
  224. columnParsing(item, defaultData) {
  225. if (item.jname === 'orderFlags') {
  226. defaultData.render = (h, { row, index, column }) => {
  227. return (
  228. <div style="padding:0 6px;cursor: pointer;">
  229. {(row[column.columnAttributes.prop] || []).map(item => {
  230. return (
  231. <div style="display: inline-block;border:1px solid #409EFF; color:#409EFF;padding:0 2px;border-radius: 4px;margin:2px 2px 0 0;">
  232. {item.tagName}
  233. </div>
  234. )
  235. })}
  236. </div>
  237. )
  238. }
  239. }
  240. return defaultData
  241. },
  242. // 监听勾选变化
  243. selectionChange(data) {
  244. this.recordSelected = data
  245. },
  246. operation(h, { row, index, column }) {
  247. return (
  248. <div class='operation-btns'>
  249. <el-button type="text" onClick={() => {
  250. this.id = row.id
  251. this.$nextTick(() => {
  252. this.detailFormBool = true
  253. })
  254. }}>编辑</el-button>
  255. </div>
  256. )
  257. },
  258. handleClose() {
  259. this.$router.push({
  260. name: "workOrderPool",
  261. params: {},
  262. query: {}
  263. })
  264. this.$nextTick(() => {
  265. this.createFormBool = false
  266. this.detailFormBool = false
  267. this.recordSelected = []
  268. this.$refs?.pageRef?.refreshList()
  269. })
  270. },
  271. rescheduleClose() {
  272. this.rescheduleBool = false
  273. this.recordSelected = []
  274. this.$refs?.pageRef?.refreshList()
  275. },
  276. reassignmentClose() {
  277. this.reassignmentBool = false
  278. this.recordSelected = []
  279. this.$refs?.pageRef?.refreshList()
  280. },
  281. }
  282. }
  283. </script>
  284. <style>
  285. #pane-workOrderInfo {
  286. width: 100%;
  287. height: 100%;
  288. }
  289. </style>
  290. <style lang="scss" scoped>
  291. .worker {
  292. display: flex;
  293. justify-content: space-between;
  294. .worker_left {
  295. font-size: 12px;
  296. font-weight: 400;
  297. text-align: left;
  298. color: #666;
  299. line-height: 28px;
  300. margin-right: 10px;
  301. }
  302. .worker_right {
  303. flex: 1;
  304. ::v-deep .el-button {
  305. margin: 0 10px 10px 0px;
  306. }
  307. }
  308. }
  309. .creatOrderPopuc {
  310. ::v-deep &>.zj-page-container {
  311. height: calc(100vh - 165px) !important;
  312. }
  313. }
  314. </style>