123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371 |
- <template>
- <!-- 工单池 -->
- <template-page ref="pageRef" :getList="getList" :operation="operation()" :exportList="exportList"
- :optionsEvensGroup="optionsEvensGroup" :columnParsing="columnParsing" :tableAttributes="tableAttributes"
- :tableEvents="tableEvents" :moreParameters="moreParameters" :screeningAnalysis="screeningAnalysis"
- :filterMethod="filterMethod" :replaceOrNotMap="true" :defaultSearchData="defaultSearchData">
- <!-- 创建工单 -->
- <div class="cartographer_big">
- <el-dialog title="创建工单" width="100%" :modal="false" :visible.sync="createFormBool" :before-close="handleClose">
- <workOrderInfo :workOrderType="workOrderType" v-if="createFormBool" />
- </el-dialog>
- </div>
- <!-- 工单详情 -->
- <div class="cartographer_big">
- <el-dialog :title="'工单详情-' + id" width="100%" :modal="false" :visible.sync="detailFormBool"
- :before-close="handleClose">
- <Detail v-if="detailFormBool" :id="id" :workOrderType="workOrderType" />
- </el-dialog>
- </div>
- <!-- 批量预约/改约 -->
- <div class="cartographer_big">
- <el-dialog title="批量约单" width="100%" :modal="false" :visible.sync="rescheduleBool" :before-close="rescheduleClose">
- <Reschedule v-if="rescheduleBool" :recordSelected="recordSelected" @close="rescheduleClose" />
- </el-dialog>
- </div>
- <!-- 批量派工/改派 -->
- <div class="cartographer_big">
- <el-dialog title="批量派单" width="100%" :modal="false" :visible.sync="reassignmentBool"
- :before-close="reassignmentClose">
- <Reassignment v-if="reassignmentBool" :recordSelected="recordSelected" @close="reassignmentClose" />
- </el-dialog>
- </div>
- </template-page>
- </template>
- <script>
- import { EventBus } from '@/utils/eventBus'
- import TemplatePage from '@/components/template/template-page-1.vue'
- import import_mixin from '@/components/template/import_mixin.js'
- import operation_mixin from '@/components/template/operation_mixin.js'
- import { listPageV2 } from "@/api/workOrder/orderType";
- import { orderBaseList, orderBaseListExport, orderBaseStatusCount, orderBaseImport } from "@/api/workOrderPool.js"
- import workOrderInfo from './detailModule/workOrderInfo/index.vue'
- import Detail from './detail'
- import Reassignment from "./components/reassignment/index.vue"
- import Reschedule from "./components/reschedule/index.vue"
- import { commonTemplateDownload } from '@/api/common.js'
- import orderListColumn from "@/mixin/orderListColumn"
- export default {
- components: {
- TemplatePage,
- workOrderInfo,
- Detail,
- Reassignment,
- Reschedule
- },
- mixins: [import_mixin, operation_mixin, orderListColumn],
- data() {
- return {
- id: this.$route.query.id || '',
- // 创建表单
- createFormBool: false,
- // 详情
- detailFormBool: false,
- // 批量改约
- rescheduleBool: false,
- // 批量派工/改派
- reassignmentBool: false,
- // 表格属性
- tableAttributes: {
- // 启用勾选列
- selectColumn: true,
- selectable: this.selectable
- },
- // 表格事件
- tableEvents: {
- 'selection-change': this.selectionChange
- },
- recordSelected: [],
- orderTypeList: [],
- orderStatusList: [],
- defaultSearchData: [],
- workOrderType: 0
- }
- },
- computed: {
- moreParameters() {
- return [
- {
- name: '工单类型',
- key: 'orderSmallType',
- value: '',
- conditions: [{
- label: "全部",
- value: ""
- }, ...this.orderTypeList]
- },
- {
- name: '工单状态',
- key: 'orderStatus',
- value: this.pageType == "orderStatus" && this.pageCode ? this.pageCode : "",
- conditions: [{
- label: "全部",
- value: ""
- }, ...this.orderStatusList]
- }
- ]
- },
- // 用户信息
- userInfo() {
- return JSON.parse(localStorage.getItem('greemall_user'))
- },
- // 事件组合
- optionsEvensGroup() {
- return [
- [
- [
- this.optionsEvensAuth(["createWorkOrder", "createWbWorkOrder"], {
- name: "创建工单",
- click: () => { }
- }),
- this.optionsEvensAuth("createWorkOrder", {
- click: () => {
- this.workOrderType = 0
- this.createFormBool = true
- }
- }),
- this.optionsEvensAuth("createWbWorkOrder", {
- click: () => {
- this.workOrderType = 1
- this.createFormBool = true
- }
- })
- ],
- [
- this.optionsEvensAuth(["importTemplate", "downloadImportTemplate"], {
- name: '导入工单',
- click: () => { }
- }),
- this.optionsEvensAuth("importTemplate", ({ moduleName }) => {
- return {
- name: moduleName,
- render: () => {
- return this.importButton(orderBaseImport, moduleName)
- }
- }
- }),
- this.optionsEvensAuth("downloadImportTemplate", {
- click: () => {
- commonTemplateDownload({ name: '工单导入模板.xlsx' }, `${this.$route.meta.title}`)
- .then(res => {
- this.$message({
- message: '下载成功',
- type: 'success'
- })
- })
- .catch(err => {
- this.$message.error('下载失败')
- })
- }
- }),
- ],
- [
- this.optionsEvensAuth(["bulkOrder", "lotOrder"], {
- name: '批量操作',
- click: () => { }
- }),
- this.optionsEvensAuth("bulkOrder", {
- click: () => {
- if (this.recordSelected.length === 0) {
- this.$message.warning('请勾选工单')
- return
- }
- this.reassignmentBool = true
- }
- }),
- this.optionsEvensAuth("lotOrder", {
- click: () => {
- if (this.recordSelected.length === 0) {
- this.$message.warning('请勾选工单')
- return
- }
- this.rescheduleBool = true
- }
- }),
- ],
- ]
- ]
- }
- },
- created() {
- this.initFun()
- EventBus.$on('handleOrderClone', () => {
- this.handleClose()
- })
- // 获取工单类型
- listPageV2({ "pageNum": 1, "pageSize": -1, "params": [{ "param": "a.status", "compare": "=", "value": "true" }] }).then(res => {
- this.orderTypeList = res.data.records.map(item => ({
- value: item.id,
- label: item.orderSmallTypeText
- }))
- })
- },
- methods: {
- initFun() {
- if (this.pageType == "detail") {
- this.id = this.pageCode
- this.$nextTick(() => {
- this.detailFormBool = true
- })
- }
- if (this.pageType == "saleOrderId") {
- this.defaultSearchData = [{ "param": "a.sale_order_id", "compare": "=", "value": this.pageCode, label: "销售订单号" }]
- }
- if (this.pageType == "pgIncreItemId") {
- this.defaultSearchData = [{ "param": "a.pg_incre_order_id", "compare": "=", "value": this.pageCode, label: "增置服务明细ID" }]
- }
- if (this.pageType == "rpProjectRepairId") {
- this.defaultSearchData = [{ "param": "a.rp_project_repair_id", "compare": "=", "value": this.pageCode, label: "维保配置ID" }]
- }
- },
- selectable(row, index) {
- return !["YWG", "YJS", "YQX"].includes(Object.entries(row.selectMapData.orderStatus).find(([key, val]) => val == row.orderStatus)?.[0]) && !row.rpProjectRepairId
- },
- screeningAnalysis(jname, val) {
- if (jname == 'orderFlags') {
- return (val || []).map(item => item.tagName).join(',')
- } else {
- return val
- }
- },
- filterMethod(value, row, column) {
- if (column['property'] == 'orderFlags') {
- return (row[column['property']] || []).map(item => item.tagName).join(',') === value
- }
- return row[column['property']] === value
- },
- // 获取统计
- getOrderBaseStatusCount(...p) {
- orderBaseStatusCount(...p).then(res => {
- this.orderStatusList = [{
- label: "待预约",
- value: "DYY"
- }, {
- label: "待商户派工",
- value: "DSHPG"
- }, {
- label: "待网点派工",
- value: "DWDPG"
- }, {
- label: "待接单",
- value: "DJD"
- }, {
- label: "服务中",
- value: "FWZ"
- }, {
- label: "异常单",
- value: "YCD"
- }, {
- label: "已完工待结算",
- value: "YWG"
- }, {
- label: "已结算",
- value: "YJS"
- }, {
- label: "已取消",
- value: "YQX"
- }].map(item => {
- var data = res.data.find(val => val.orderStatus == item.value)
- if (data) {
- item.label = `${item.label}(${data.total})`
- }
- return item
- })
- })
- },
- // 列表请求函数
- getList(p, cb) {
- var pam = JSON.parse(JSON.stringify(p))
- try {
- if (pam.orderStatus) {
- pam.params.push({ "param": "a.order_status", "compare": "=", "value": pam.orderStatus })
- }
- if (pam.orderSmallType) {
- pam.params.push({ "param": "a.order_small_type", "compare": "=", "value": pam.orderSmallType })
- }
- // if (this.$route.query.saleOrderId && !pam.params.find(item => item.param == "a.sale_order_id")) {
- // pam.params.push({ "param": "a.sale_order_id", "compare": "like", "value": this.$route.query.saleOrderId, label: "销售订单号" })
- // }
- // if (this.$route.query.pgIncreItemId && !pam.params.find(item => item.param == "a.pg_incre_order_id")) {
- // pam.params.push({ "param": "a.pg_incre_order_id", "compare": "like", "value": this.$route.query.pgIncreItemId, label: "增置服务明细ID" })
- // }
- // if (this.$route.query.rpProjectRepairId && !pam.params.find(item => item.param == "a.rp_project_repair_id")) {
- // pam.params.push({ "param": "a.rp_project_repair_id", "compare": "=", "value": this.$route.query.rpProjectRepairId })
- // }
- cb && cb(pam)
- return orderBaseList(pam)
- } catch (err) {
- } finally {
- this.$nextTick(() => {
- this.getOrderBaseStatusCount({ orderSmallType: pam.orderSmallType || "" })
- })
- }
- },
- // 列表导出函数
- exportList: orderBaseListExport,
- // 监听勾选变化
- selectionChange(data) {
- this.recordSelected = data
- },
- operation() {
- return this.operationBtn({
- edit: {
- click: ({ row, index, column }) => {
- this.id = row.id
- if (row.rpProjectRepairId) {
- this.workOrderType = 1
- } else {
- this.workOrderType = 0
- }
- this.$nextTick(() => {
- this.detailFormBool = true
- })
- }
- }
- })
- },
- handleClose() {
- this.$router.push({
- name: "workOrderPool",
- params: {},
- query: {}
- })
- this.$nextTick(() => {
- this.createFormBool = false
- this.detailFormBool = false
- this.recordSelected = []
- this.$refs?.pageRef?.refreshList()
- })
- },
- rescheduleClose() {
- this.rescheduleBool = false
- this.recordSelected = []
- this.$refs?.pageRef?.refreshList()
- },
- reassignmentClose() {
- this.reassignmentBool = false
- this.recordSelected = []
- this.$refs?.pageRef?.refreshList()
- },
- }
- }
- </script>
- <style lang="scss" scoped></style>
|