doum
3 天以前 078a5c4ced367fdbd5a16c27c8bada6e44e632d5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
<template>
  <TableLayout :permissions="['business:jksketch:query']">
    <!-- 搜索表单 -->
    <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline>
      <el-form-item label="送货日期" prop="dateInfo">
        <el-date-picker v-model="searchForm.dateInfo" value-format="yyyy-MM-dd" placeholder="请输入日期" @change="search"/>
      </el-form-item>
      <el-form-item label="状态" prop="status" >
        <el-select v-model="searchForm.status" placeholder="请选择" clearable @change="search">
          <el-option label="未优化" value="0"></el-option>
          <el-option label="优化中" value="1"></el-option>
          <el-option label="已优化" value="2"></el-option>
        </el-select>
      </el-form-item>
      <section>
        <el-button type="primary" @click="search">搜索</el-button>
        <el-button @click="reset">重置</el-button>
      </section>
    </el-form>
    <!-- 表格和分页 -->
    <template v-slot:table-wrap>
      <ul class="toolbar" v-permissions="['business:jksketch:create']">
        <li><el-button icon="el-icon-upload"  type="primary" @click="$refs.OperaJkSketchImportWindow.open('销售订单导入')"  v-permissions="['business:jksketch:create']">销售订单导入</el-button></li>
        <!--
                <li><el-button type="primary" @click="$refs.operaJkSketchWindow.open('新建交控-线路优化记录信息表')" icon="el-icon-plus" v-permissions="['business:jksketch:create']">新建</el-button></li>
        -->
        <li> <el-button type="primary" :loading="isWorking.export" v-permissions="['business:jksketch:exportExcel']" @click="exportExcel">导出列表数据</el-button></li>
        <li> <el-button type="primary" :loading="isWorking.export1" v-permissions="['business:jksketch:exportExcel']" @click="exportExcel1">导出优化结果</el-button></li>
        <li> <el-button type="primary" :loading="isWorking.export2" v-permissions="['business:jksketch:exportExcel']" @click="exportExcel2">导出销售订单</el-button></li>
      </ul>
      <el-table
          :height="tableHeightNew"
        v-loading="isWorking.search"
        :data="tableData.list"
        stripe
        @selection-change="handleSelectionChange"
      >
<!--
        <el-table-column type="selection" width="55"></el-table-column>
-->
        <el-table-column prop="dateInfo" label="送货日期" min-width="130px"></el-table-column>
        <el-table-column prop="categoryName" label="主线路" min-width="130px">
          <template slot-scope="{row}">
            <span class="blue" style="cursor: pointer" @click="$refs.operaJkSketchLineListWindow.open('配送线路明细', row)">{{ row.categoryName }}({{row.lineNum||0}}条线路)</span>
          </template>
        </el-table-column>
        <el-table-column prop="orderNum" label="客户数(户)" min-width="130px"></el-table-column>
        <el-table-column prop="totalNum" label="送货量(条)" min-width="130px"></el-table-column>
        <el-table-column prop="status" label="优化状态" min-width="100px">
          <template slot-scope="{row}">
            <span v-if="row.status === 0" class="blue">未优化</span>
            <span v-if="row.status === 1" class="red">优化中</span>
            <span v-if="row.status === 2" class="green">已优化</span>
          </template>
        </el-table-column>
        <el-table-column
          v-if="containPermissions(['business:jksketch:update', 'business:jksketch:delete'])"
          label="操作"
          min-width="120"
          fixed="right"
        >
          <template slot-scope="{row}">
            <el-button type="text" @click="$refs.operaJkSketchWindow.open('线路优化', row)" icon="el-icon-edit" v-permissions="['business:jksketch:update']">线路优化</el-button>
            <el-button type="text" @click="$refs.OperaJkSketchResultWindow.open('线路优化结果', row)" icon="el-icon-view" v-if="row.status ==2" >优化结果</el-button>
          </template>
        </el-table-column>
      </el-table>
      <pagination
        @size-change="handleSizeChange"
        @current-change="handlePageChange"
        :pagination="tableData.pagination"
      >
      </pagination>
    </template>
    <!-- 新建/修改 -->
    <OperaJkSketchWindow ref="operaJkSketchWindow" @success="handlePageChange"/>
    <OperaJkSketchResultWindow ref="OperaJkSketchResultWindow" @success="handlePageChange"/>
    <OperaJkSketchImportWindow ref="OperaJkSketchImportWindow" @success="handlePageChange"/>
    <OperaJkSketchLineListWindow ref="operaJkSketchLineListWindow"  />
  </TableLayout>
</template>
 
<script>
import BaseTable from '@/components/base/BaseTable'
import TableLayout from '@/layouts/TableLayout'
import Pagination from '@/components/common/Pagination'
import OperaJkSketchWindow from '@/components/business/OperaJkSketchWindow'
import OperaJkSketchLineListWindow from '@/components/business/OperaJkSketchLineListWindow'
import OperaJkSketchResultWindow from '@/components/business/OperaJkSketchResultWindow'
import OperaJkSketchImportWindow from '@/components/business/OperaJkSketchImportWindow'
export default {
  name: 'JkSketch',
  extends: BaseTable,
  components: { TableLayout, Pagination, OperaJkSketchWindow, OperaJkSketchResultWindow, OperaJkSketchImportWindow, OperaJkSketchLineListWindow },
  data () {
    return {
      // 搜索
      searchForm: {
        status: '',
        dateInfo: ''
      },
      isWorking: {
        export1: false,
        export2: false
      }
    }
  },
  created () {
    this.config({
      module: '交控-线路优化记录信息表',
      api: '/business/jkSketch',
      'field.id': 'id',
      'field.main': 'id'
    })
    this.search()
  },
  methods: {
    exportExcel1 () {
      if (!this.searchForm.dateInfo) {
        this.$message.error('请选择指定日期进行该导出操作!')
        return
      }
      this.$dialog.exportConfirm('确认导出吗?')
        .then(() => {
          this.exLoading = true
          this.api.exportResultExcel({
            page: 1,
            capacity: 1000000,
            model: {dateInfo:this.searchForm.dateInfo}
          })
            .then(response => {
              this.download(response)
            })
            .catch(e => {
              this.$tip.apiFailed(e)
            })
            .finally(() => {
              this.exLoading = false
            })
        })
    },
    exportExcel2 () {
      if (!this.searchForm.dateInfo) {
        this.$message.error('请选择指定日期进行该导出操作!')
        return
      }
      this.$dialog.exportConfirm('确认导出吗?')
        .then(() => {
          this.exLoading = true
          this.api.exportOrdersExcel({
            page: 1,
            capacity: 1000000,
            model: {dateInfo:this.searchForm.dateInfo}
          })
            .then(response => {
              this.download(response)
            })
            .catch(e => {
              this.$tip.apiFailed(e)
            })
            .finally(() => {
              this.exLoading = false
            })
        })
    }
  }
}
</script>