Blame view

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