Blame view

src/views/material/OutsourcingIn.vue 11.5 KB
1
2
3
4
5
6
<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
7
          <a-col :md="6" :sm="8">
8
9
10
11
12
13
14
            <a-form-item label="项目名称">
              <a-select
                show-search
                placeholder="请输入项目名称"
                option-filter-prop="children"
                :filter-option="filterOption"
                @change="handleChange"
15
                v-model="queryParam.projectName"
16
17
18
19
20
              >
                <a-select-option v-for="item in projectNameList" :key="item" :value="item">{{ item }}</a-select-option>
              </a-select>
            </a-form-item>
          </a-col>
21
          <a-col :md="6" :sm="8">
22
23
24
25
26
27
28
            <a-form-item label="项目编码">
              <a-select
                show-search
                placeholder="请输入项目编码"
                option-filter-prop="children"
                :filter-option="filterOption"
                @change="handleChange"
29
                v-model="queryParam.projectNo"
30
31
32
33
34
              >
                <a-select-option v-for="item in projectNoList" :key="item" :value="item">{{ item }}</a-select-option>
              </a-select>
            </a-form-item>
          </a-col>
35
          <a-col :md="6" :sm="8">
36
37
38
39
40
41
42
            <a-form-item label="工作令号">
              <a-select
                show-search
                placeholder="请输入工作令号"
                option-filter-prop="children"
                :filter-option="filterOption"
                @change="handleChange"
43
                v-model="queryParam.workNo"
44
45
46
47
48
              >
                <a-select-option v-for="item in workNoList" :key="item" :value="item">{{ item }}</a-select-option>
              </a-select>
            </a-form-item>
          </a-col>
49
          <a-col :md="6" :sm="8">
50
            <a-form-item label="bomId">
51
52
53
54
55
56
57
58
59
60
              <a-select
                show-search
                placeholder="请选择BOM"
                option-filter-prop="children"
                :filter-option="filterOption"
                @change="handleBomChange"
                v-model="queryParam.bomId"
              >
                <a-select-option v-for="item in bomIdList" :key="item" :value="item">{{ item }}</a-select-option>
              </a-select>
61
62
            </a-form-item>
          </a-col>
63
          <a-col :md="6" :sm="8">
64
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
65
              <a-button type="primary" @click="query" icon="search">查询</a-button>
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
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>


    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
        <a-button type="primary" icon="import">导入</a-button>
      </a-upload>
      <a-button
        @click="batchDel"
        v-if="selectedRowKeys.length > 0"
        ghost
        type="primary"
        icon="delete">批量删除
      </a-button>
    </div>

    <!-- table区域-begin -->
    <div>

      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i>已选择&nbsp;<a style="font-weight: 600">{{
          selectedRowKeys.length }}</a>项&nbsp;&nbsp;
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>

      <a-table
        :columns="columns"
        :scroll="{x: 1500}"
        size="middle"
        :pagination="false"
        :dataSource="dataSource"
        :loading="loading"
        :expandedRowKeys="expandedRowKeys"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        @expandedRowsChange="handleExpandedRowsChange">

        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>

          <a-divider type="vertical"/>
          <a-dropdown>
            <a-menu slot="overlay">
              <a-menu-item>
                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>
        <!-- 字符串超长截取省略号显示 -->
        <span slot="url" slot-scope="text">
          <j-ellipsis :value="text" :length="25"/>
        </span>
        <!-- 字符串超长截取省略号显示-->
        <span slot="component" slot-scope="text">
          <j-ellipsis :value="text"/>
        </span>
      </a-table>
mahuandong authored
133
134
135
136
137
      <a-table
        ref="table"
        bordered
        size="middle"
        rowKey="id"
138
139
        :columns="planColumns"
        :dataSource="planDataSource"
mahuandong authored
140
141
142
143
144
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        @change="handleTableChange">
145
146
147
148
149
150
151
152
153
154
155
156
157
158
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>

          <a-divider type="vertical"/>
          <a-dropdown>
            <a-menu slot="overlay">
              <a-menu-item>
                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>
mahuandong authored
159
160
      </a-table>
161
162
    </div>
    <!-- table区域-end -->
163
    <outsourcing-in-modal ref="modalForm" @ok="modalFormOk"></outsourcing-in-modal>
164
165
166
167
168
169
  </a-card>

</template>

<script>
import {JeecgListMixin} from '../../mixins/JeecgListMixin'
170
171
172
173
174
175
176
177
178
179
import {
  getProjectName,
  getWorkNo,
  getProjectNo,
  getBomTree,
  getOutsourcing,
  getBomIdList,
  getBomId
} from '../../api/api'
import OutsourcingInModal from './modules/OutsourcingInModal'
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
const columns = [
  {
    title: '图号',
    dataIndex: 'drawingNo',
    key: 'drawingNo'
  },
  {
    //   title: 'BOM',
    //   dataIndex: 'bomId',
    //   key: 'bomId'
    // }, {
    title: '物料编码',
    dataIndex: 'code',
    key: 'code'
  }, {
    title: '物料名称',
    dataIndex: 'name',
    key: 'name'
  },{
    title: '物料单位',
    dataIndex: 'unit',
    key: 'unit'
  }, {
    title: '用量',
    dataIndex: 'number',
    key: 'number'
  },{
    title: '状态',
    dataIndex: 'status',
    key: 'status'
  },{
    title: '制造方式',
    dataIndex: 'method',
    key: 'method'
  },{
    title: '设计类型',
    dataIndex: 'designType',
    key: 'designType'
  },{
    title: 'WIP属性',
    dataIndex: 'wipType',
    key: 'wipType'
  },{
    title: '品牌',
    dataIndex: 'brand',
    key: 'brand'
  }, {
    title: '分类',
    dataIndex: 'categories',
    key: 'categories'
  },{
    title: '操作',
    dataIndex: 'action',
    fixed: 'right',
    scopedSlots: { customRender: 'action' },
    align: 'center',
    width: 150
  }
]
export default {
  name: 'OutsourcingIn',
  mixins: [JeecgListMixin],
  components: {
243
    OutsourcingInModal
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259

  },
  data() {
    return {
      description: '这是外协入库页面',
      // 表头
      columns: columns,
      loading: false,
      // 展开的行,受控属性
      expandedRowKeys: [],
      url: {
        list: '/config/bom/list',
        delete: '/config/bom/delete',
        deleteBatch: '/config/bom/deleteBatch',
        importExcelUrl: '/config/bom/importExcel'
      },
260
      planDataSource: [],
261
262
263
      queryParam: [],
      projectNameList: [],
      workNoList: [],
264
      projectNoList: [],
265
      bomIdList: [],
266
267
268
      planColumns: [
        {
          title: '物料编码',
269
          dataIndex: 'materialCode',
270
271
272
          key: 'code'
        }, {
          title: '物料名称',
273
          dataIndex: 'materialName',
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
          key: 'name'
        },{
          title: '物料单位',
          dataIndex: 'unit',
          key: 'unit'
        }, {
          title: '数量',
          dataIndex: 'qty',
          key: 'qty'
        },{
          title: '公司',
          dataIndex: 'vendor',
          key: 'vendor'
        },{
          title: '联系方式',
          dataIndex: 'phone',
          key: 'phone'
        },{
          title: '计划开始时间',
          dataIndex: 'planStartTime',
          key: 'planStartTime'
        },{
          title: '计划完成时间',
          dataIndex: 'planEndTime',
          key: 'planEndTime'
        },{
          title: '实际开始时间',
          dataIndex: 'actualStartTime',
          key: 'actualStartTime'
        }, {
          title: '实际完成时间',
          dataIndex: 'actualEndTime',
          key: 'actualEndTime'
        },{
          title: '操作',
          dataIndex: 'action',
          fixed: 'right',
          scopedSlots: { customRender: 'action' },
          align: 'center',
          width: 150
        }
      ]
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
    }
  },
  created() {
    this.loadFrom()
  },
  methods: {
    loadFrom() {
      getProjectName().then((res) => {
        if (res.success) {
          this.projectNameList = res.result
        }
      })
      getWorkNo().then((res) => {
        if (res.success) {
          this.workNoList = res.result
        }
      })
      getProjectNo().then((res) => {
        if (res.success) {
          this.projectNoList = res.result
        }
      })
338
339
340
341
342
      getBomIdList().then((res) => {
        if (res.success) {
          this.bomIdList = res.result
        }
      })
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
    },
    handleChange(value) {
      console.log(`selected ${value}`);
    },
    filterOption(input, option) {
      return (
        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
      );
    },
    loadData(tree) {
      this.dataSource = tree;
    },

    handleExpandedRowsChange(expandedRows) {
      this.expandedRowKeys = expandedRows
    },
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
    handleBomChange(value) {
      this.initBomTree(value);
    },
    query()  {
      let params = {
        "bomId": this.queryParam.bomId,
        "projectName": this.queryParam.projectName,
        "projectNo": this.queryParam.projectNo,
        "workNo": this.queryParam.workNo
      }
      getBomId(params).then((res) => {
        if (res.success) {
          this.bomIdList.push(res.result)
          this.initBomTree(this.bomIdList[0])
        }
      })
      getOutsourcing(params).then((res) => {
        if (res.success) {
          this.planDataSource = res.result.records||res.result;
          if(res.result.total)
          {
            this.ipagination.total = res.result.total;
          }else{
            this.ipagination.total = 0;
          }
        }
      })
386
    },
387
    initBomTree(bomId) {
388
      let params = {
389
        "bomId": bomId
390
      }
391
      getBomTree(params).then((res) => {
392
393
394
395
        if (res.success) {
          this.loadData(res.result)
        }
      })
396
397
      getOutsourcing(params).then((res) => {
        if (res.success) {
398
399
          console.log(res)
          this.planDataSource = res.result.records;
400
401
402
403
404
405
406
407
          if(res.result.total)
          {
            this.ipagination.total = res.result.total;
          }else{
            this.ipagination.total = 0;
          }
        }
      })
408
409
410
411
412
413
414
415
416
417
418
419
420
    }
  },
  computed: {
    importExcelUrl: function(){
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
    }
  }
}
</script>

<style scoped>

</style>