Blame view

src/views/scheduler/SchedulerHeaderList.vue 12.3 KB
1
2
3
4
<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
DESKTOP-AO0VKC8\mahua authored
5
      <a-form layout="inline" @keyup.enter.native="searchQuery">
6
        <a-row :gutter="24">
游杰 authored
7
8
9
10
11
          <a-col :md="4" :sm="24">
            <a-form-item label="项目ID" :labelCol="{span: 6}" :wrapperCol="{span: 14, offset: 1}">
              <a-input placeholder="请输入项目ID" v-model="queryParam.id"></a-input>
            </a-form-item>
          </a-col>
游杰 authored
12
          <a-col :md="6" :sm="8">
DESKTOP-AO0VKC8\mahua authored
13
            <a-form-item label="项目名称" :labelCol="{span: 6}" :wrapperCol="{span: 14, offset: 1}">
14
15
16
              <a-input placeholder="请输入项目名称" v-model="queryParam.projectName"></a-input>
            </a-form-item>
          </a-col>
游杰 authored
17
          <a-col :md="6" :sm="8">
DESKTOP-AO0VKC8\mahua authored
18
            <a-form-item label="生产令号" :labelCol="{span: 6}" :wrapperCol="{span: 14, offset: 1}">
19
20
21
              <a-input placeholder="请输入生产令号" v-model="queryParam.orderNo"></a-input>
            </a-form-item>
          </a-col>
游杰 authored
22
23
24
25
26
27
28
29
30
31
32
33
34
35
          <a-col :md="6" :sm="8">
            <a-form-item label="项目进度">
              <a-select
                show-search
                placeholder="请选择项目进度"
                option-filter-prop="children"
                :filter-option="filterOption"
                @change="handleChange"
                v-model="queryParam.delay"
              >
                <a-select-option v-for="item in projectColumns" :key="item.key" :value="item.value">{{ item.key }}</a-select-option>
              </a-select>
            </a-form-item>
          </a-col>
游杰 authored
36
37
38
39
40
41
42
<!--          <a-col :md="4" :sm="8">-->
<!--            <span style="float: left;overflow: hidden;" class="table-pagesearch-search-submitButtons">-->
<!--              <a-button type="primary" @click="search" icon="search">查询</a-button>-->
<!--              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>-->
<!--            </span>-->
<!--          </a-col>-->
43
44
45
        </a-row>
      </a-form>
    </div>
DESKTOP-AO0VKC8\mahua authored
46
    <!-- 查询区域-END -->
47
48
49
50

    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
DESKTOP-AO0VKC8\mahua authored
51
52
      <a-button type="primary" icon="download" @click="handleExportXls('生产计划')">导出</a-button>
      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
53
54
        <a-button type="primary" icon="import">导入</a-button>
      </a-upload>
游杰 authored
55
56
57
      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importBomExcel" @change="handleImportExcel">
        <a-button type="primary" icon="import">导入Bom计划</a-button>
      </a-upload>
58
59
60
61
      <a-button @click="addPbom" type="primary" icon="plus">查询导入Bom计划</a-button>

      <a-button type="primary" @click="search" icon="search">查询</a-button>
      <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
62
63
    </div>
64
    <span style="font-size: 18px">项目总数:{{projects.total}}个,正在进行的项目:{{projects.normal}}个,结束的项目:{{projects.delay}}个</span>
65
66
    <!-- table区域-begin -->
    <div>
DESKTOP-AO0VKC8\mahua authored
67
68
69
70
71
72
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
DESKTOP-AO0VKC8\mahua authored
73
74
        class="j-table-force-nowrap"
        :scroll="{x:true}"
75
76
77
78
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
79
DESKTOP-AO0VKC8\mahua authored
80
        :customRow="clickThenSelect"
81
        @change="handleTableChange">
82
DESKTOP-AO0VKC8\mahua authored
83
84
        <span slot="action" slot-scope="text, record">
游杰 authored
85
          <a @click="handleEdit(record)">审核</a>
游杰 authored
86
87
           <a-divider type="vertical" />
          <a @click="printSchedulerList(record.id)">打印</a>
88
          <a-divider type="vertical" />
游杰 authored
89
90
           <a-popconfirm title="确定关闭这个项目吗?" @confirm="() =>handleFinish(record.id)">
            <a>关闭</a>
91
92
          </a-popconfirm>
           <a-divider type="vertical" />
DESKTOP-AO0VKC8\mahua authored
93
94
95
          <a-popconfirm title="确定删除吗?" @confirm="() =>handleDelete(record.id)">
            <a><a-icon type="delete"/>删除</a>
          </a-popconfirm>
96
97
        </span>
游杰 authored
98
		    <span slot="tags" slot-scope="tags">
99
100
101
102
          <a-tag :color="dataCompare(tags) ? 'red': 'geekblue'">
            {{ !tags?"":(tags.length>10?tags.substr(0,10):tags) }}
          </a-tag>
        </span>
103
104
105
      </a-table>
    </div>
DESKTOP-AO0VKC8\mahua authored
106
107
108
109
110
111
112
    <a-tabs defaultActiveKey="1">
      <a-tab-pane tab="生产计划明细" key="1" >
        <SchedulerDetailList :mainId="selectedMainId" />
      </a-tab-pane>
    </a-tabs>

    <schedulerHeader-modal ref="modalForm" @ok="modalFormOk"></schedulerHeader-modal>
113
    <PBOMList ref="modalForm2" @ok="modalFormOk"></PBOMList>
114
115
116
117
118
  </a-card>
</template>

<script>
DESKTOP-AO0VKC8\mahua authored
119
120
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import SchedulerHeaderModal from './modules/SchedulerHeaderModal'
121
  import PBOMList from './modules/PBOMList'
DESKTOP-AO0VKC8\mahua authored
122
123
124
  import { getAction } from '@/api/manage'
  import SchedulerDetailList from './SchedulerDetailList'
  import '@/assets/less/TableExpand.less'
125
  import {calculateDelay} from '@/api/api'
DESKTOP-AO0VKC8\mahua authored
126
127
128
129
130
131

  export default {
    name: "SchedulerHeaderList",
    mixins:[JeecgListMixin],
    components: {
      SchedulerDetailList,
132
133
      SchedulerHeaderModal,
      PBOMList
DESKTOP-AO0VKC8\mahua authored
134
135
136
137
138
139
140
    },
    data () {
      return {
        description: '生产计划管理页面',
        // 表头
        columns: [
          {
游杰 authored
141
            title:'项目ID',
DESKTOP-AO0VKC8\mahua authored
142
            align:"center",
游杰 authored
143
            dataIndex: 'id'
DESKTOP-AO0VKC8\mahua authored
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
          },
          {
            title:'项目名称',
            align:"center",
            dataIndex: 'projectName'
          },
          {
            title:'生产令号',
            align:"center",
            dataIndex: 'orderNo'
          },
          {
            title:'部件号',
            align:"center",
            dataIndex: 'partNo'
          },
          {
游杰 authored
161
162
            title:'是否关闭',
            align:"center",
游杰 authored
163
            dataIndex: 'finish',
游杰 authored
164
165
166
167
168
169
170
171
172
            customRender: function(text) {
              if (text === 0) {
                return "正常"
              } else {
                return "关闭"
              }
            }
          },
          {
173
174
175
176
177
178
179
180
181
182
183
184
185
186
            title:'状态',
            align:"center",
            dataIndex: 'status',
            customRender: function(text) {
              if (text === 0) {
                return "生产中"
              } else if (text === 1) {
                return "按时完成"
              } else if (text === 2) {
                return "超时完成"
              }
            }
          },
          {
游杰 authored
187
188
189
190
191
192
193
194
            title:'进度',
            align:"center",
            dataIndex: 'progress',
            customRender:function (text) {
              return !text?"":(text.length>10?text.substr(0,10):text)
            }
          },
          {
195
            title:'计划完成时间',
DESKTOP-AO0VKC8\mahua authored
196
            align:"center",
197
            dataIndex: 'completionTime',
游杰 authored
198
			      scopedSlots: {
199
200
              customRender: 'tags',
            },
DESKTOP-AO0VKC8\mahua authored
201
202
          },
          {
203
            title:'实际完成时间',
DESKTOP-AO0VKC8\mahua authored
204
            align:"center",
205
            dataIndex: 'actualCompletionTime',
DESKTOP-AO0VKC8\mahua authored
206
207
208
209
210
            customRender:function (text) {
              return !text?"":(text.length>10?text.substr(0,10):text)
            }
          },
          {
211
            title:'创建人',
DESKTOP-AO0VKC8\mahua authored
212
            align:"center",
213
214
215
216
217
218
            dataIndex: 'createBy'
          },
          {
            title:'创建日期',
            align:"center",
            dataIndex: 'createTime',
DESKTOP-AO0VKC8\mahua authored
219
220
221
222
223
            customRender:function (text) {
              return !text?"":(text.length>10?text.substr(0,10):text)
            }
          },
          {
224
            title:'更新人',
DESKTOP-AO0VKC8\mahua authored
225
            align:"center",
226
227
228
229
230
231
            dataIndex: 'updateBy'
          },
          {
            title:'更新日期',
            align:"center",
            dataIndex: 'updateTime',
DESKTOP-AO0VKC8\mahua authored
232
233
234
235
236
237
238
239
240
241
242
            customRender:function (text) {
              return !text?"":(text.length>10?text.substr(0,10):text)
            }
          },
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            fixed:"right",
            width:147,
            scopedSlots: { customRender: 'action' },
243
          }
DESKTOP-AO0VKC8\mahua authored
244
245
246
247
        ],
        url: {
          list: "/scheduler/schedulerHeader/list",
          delete: "/scheduler/schedulerHeader/delete",
游杰 authored
248
          finish: "/scheduler/schedulerHeader/finish",
DESKTOP-AO0VKC8\mahua authored
249
250
251
          deleteBatch: "/scheduler/schedulerHeader/deleteBatch",
          exportXlsUrl: "/scheduler/schedulerHeader/exportXls",
          importExcelUrl: "/scheduler/schedulerHeader/importExcel",
游杰 authored
252
          importBomExcel: "/scheduler/schedulerHeader/importBomExcel",
253
        },
DESKTOP-AO0VKC8\mahua authored
254
        dictOptions:{
255
        },
DESKTOP-AO0VKC8\mahua authored
256
257
258
259
260
261
262
263
264
265
266
        /* 分页参数 */
        ipagination:{
          current: 1,
          pageSize: 5,
          pageSizeOptions: ['5', '10', '50'],
          showTotal: (total, range) => {
            return range[0] + "-" + range[1] + " 共" + total + "条"
          },
          showQuickJumper: true,
          showSizeChanger: true,
          total: 0
267
        },
DESKTOP-AO0VKC8\mahua authored
268
269
        selectedMainId: '',
        superFieldList:[],
270
        projects: {},
游杰 authored
271
272
273
274
275
276
277
278
279
280
281
282
        projectColumns: [
          {
            key: '所有',
            value: ''
          }, {
            key: '正常',
            value: '0'
          },{
            key: '延期',
            value: '1'
          }
        ]
283
284
      }
    },
DESKTOP-AO0VKC8\mahua authored
285
286
    created() {
      this.getSuperFieldList();
287
      this.calculateDelayProject();
DESKTOP-AO0VKC8\mahua authored
288
289
290
    },
    computed: {
      importExcelUrl: function(){
291
        return  `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
游杰 authored
292
293
294
      },
      importBomExcel: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importBomExcel}`;
DESKTOP-AO0VKC8\mahua authored
295
296
297
298
299
      }
    },
    methods: {
      initDictConfig(){
      },
300
301
302
      addPbom(){
        this.$refs.modalForm2.show()
      },
DESKTOP-AO0VKC8\mahua authored
303
304
305
306
      clickThenSelect(record) {
        return {
          on: {
            click: () => {
307
              this.onSelectChange(record.id);
DESKTOP-AO0VKC8\mahua authored
308
309
310
311
            }
          }
        }
      },
312
313
314
315
316
317
318
319
320
321
322
323
324
      search() {
        this.calculateDelayProject();
        this.searchQuery();
      },
      calculateDelayProject() {
        const that = this;
        let obj = calculateDelay(this.queryParam);
        obj.then((res) => {
          that.projects = res;
          console.log("workTotal:" + that.projects.total);
        })
      },
DESKTOP-AO0VKC8\mahua authored
325
326
      onClearSelected() {
        this.selectedRowKeys =  [];
327
        this.selectedMainId = ''
DESKTOP-AO0VKC8\mahua authored
328
329
      },
      onSelectChange(selectedRowKeys) {
330
331
        this.selectedMainId = String(selectedRowKeys);
        this.selectedRowKeys = [String(selectedRowKeys)];
DESKTOP-AO0VKC8\mahua authored
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
      },
      loadData(arg) {
        if(!this.url.list){
          this.$message.error("请设置url.list属性!")
          return
        }
        //加载数据 若传入参数1则加载第一页的内容
        if (arg === 1) {
          this.ipagination.current = 1;
        }
        this.onClearSelected()
        let params = this.getQueryParams();//查询条件
        this.loading = true;
        getAction(this.url.list, params).then((res) => {
          if (res.success) {
            this.dataSource = res.result.records;
            this.ipagination.total = res.result.total;
          }
          if(res.code===510){
            this.$message.warning(res.message)
          }
          this.loading = false;
        })
      },
      getSuperFieldList(){
        let fieldList=[];
        fieldList.push({type:'string',value:'projectCode',text:'项目号',dictCode:''})
        fieldList.push({type:'string',value:'projectName',text:'项目名称',dictCode:''})
        fieldList.push({type:'string',value:'orderNo',text:'生产令号',dictCode:''})
        fieldList.push({type:'string',value:'partNo',text:'部件号',dictCode:''})
        fieldList.push({type:'date',value:'created',text:'创建时间'})
        fieldList.push({type:'string',value:'createBy',text:'创建人',dictCode:''})
        this.superFieldList = fieldList
365
      },
游杰 authored
366
	  dataCompare(data) {
367
368
369
370
371
372
373
        if (data === undefined ) {
          return false;
        }
        let d = new Date(Date.parse(data .replace(/-/g,"/")));
        console.log(d)
        let curDate = new Date();
        return d <= curDate;
DESKTOP-AO0VKC8\mahua authored
374
      }
375
    }
DESKTOP-AO0VKC8\mahua authored
376
  }
377
378
</script>
<style scoped>
DESKTOP-AO0VKC8\mahua authored
379
  @import '~@assets/less/common.less'
380
</style>