Blame view

src/views/scheduler/SchedulerHeaderList.vue 13 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">
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
          <a-col :md="6" :sm="8">
            <a-form-item label="项目进度">
              <a-select
                show-search
                placeholder="请选择项目进度"
                option-filter-prop="children"
                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>
34
35
36
37
38
39
40
41
42
43
44
45
          <a-col :md="6" :sm="8">
            <a-form-item label="是否关闭">
              <a-select
                show-search
                placeholder="请选择"
                option-filter-prop="children"
                v-model="queryParam.finish"
              >
                  <a-select-option v-for="item in whetherToClose" :key="item.key" :value="item.value">{{ item.key }}</a-select-option>
              </a-select>
            </a-form-item>
          </a-col>
46
47
48
49
50
51
<!--          <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>-->
52
53
54
        </a-row>
      </a-form>
    </div>
DESKTOP-AO0VKC8\mahua authored
55
    <!-- 查询区域-END -->
56
57
58
59

    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
DESKTOP-AO0VKC8\mahua authored
60
61
      <a-button type="primary" icon="download" @click="handleExportXls('生产计划')">导出</a-button>
      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
62
63
        <a-button type="primary" icon="import">导入</a-button>
      </a-upload>
游杰 authored
64
65
66
      <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>
67
68
69
70
      <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>
71
72
    </div>
73
    <span style="font-size: 18px">项目总数:{{projects.total}}个,正在进行的项目:{{projects.normal}}个,结束的项目:{{projects.delay}}个</span>
74
75
    <!-- table区域-begin -->
    <div>
DESKTOP-AO0VKC8\mahua authored
76
77
78
79
80
81
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
DESKTOP-AO0VKC8\mahua authored
82
83
        class="j-table-force-nowrap"
        :scroll="{x:true}"
84
85
86
87
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
88
DESKTOP-AO0VKC8\mahua authored
89
        :customRow="clickThenSelect"
90
        @change="handleTableChange">
91
DESKTOP-AO0VKC8\mahua authored
92
93
        <span slot="action" slot-scope="text, record">
游杰 authored
94
          <a @click="handleEdit(record)">审核</a>
游杰 authored
95
96
           <a-divider type="vertical" />
          <a @click="printSchedulerList(record.id)">打印</a>
97
          <a-divider type="vertical" />
游杰 authored
98
99
           <a-popconfirm title="确定关闭这个项目吗?" @confirm="() =>handleFinish(record.id)">
            <a>关闭</a>
100
101
          </a-popconfirm>
           <a-divider type="vertical" />
DESKTOP-AO0VKC8\mahua authored
102
103
104
          <a-popconfirm title="确定删除吗?" @confirm="() =>handleDelete(record.id)">
            <a><a-icon type="delete"/>删除</a>
          </a-popconfirm>
105
106
        </span>
游杰 authored
107
		    <span slot="tags" slot-scope="tags">
108
109
110
111
          <a-tag :color="dataCompare(tags) ? 'red': 'geekblue'">
            {{ !tags?"":(tags.length>10?tags.substr(0,10):tags) }}
          </a-tag>
        </span>
112
113
114
      </a-table>
    </div>
DESKTOP-AO0VKC8\mahua authored
115
116
117
118
119
120
121
    <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>
122
    <PBOMList ref="modalForm2" @ok="modalFormOk"></PBOMList>
123
124
125
126
127
  </a-card>
</template>

<script>
DESKTOP-AO0VKC8\mahua authored
128
129
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import SchedulerHeaderModal from './modules/SchedulerHeaderModal'
130
  import PBOMList from './modules/PBOMList'
DESKTOP-AO0VKC8\mahua authored
131
132
133
  import { getAction } from '@/api/manage'
  import SchedulerDetailList from './SchedulerDetailList'
  import '@/assets/less/TableExpand.less'
134
  import {calculateDelay} from '@/api/api'
DESKTOP-AO0VKC8\mahua authored
135
136
137
138
139
140

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