Blame view

src/views/material/PurchaseIn.vue 22.4 KB
周峰 authored
1
2
<template>
  <a-card :bordered="false">
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
<!--    &lt;!&ndash; 查询区域 &ndash;&gt;-->
<!--    <div class="table-page-search-wrapper">-->
<!--      <a-form layout="inline" @keyup.enter.native="searchQuery">-->
<!--        <a-row :gutter="24">-->
<!--          <a-col :md="6" :sm="8">-->
<!--            <a-form-item label="项目名称">-->
<!--              <a-select-->
<!--                show-search-->
<!--                placeholder="请输入项目名称"-->
<!--                option-filter-prop="children"-->
<!--                :filter-option="filterOption"-->
<!--                v-model="queryParam.projectName"-->
<!--              >-->
<!--                <a-select-option v-for="item in projectNameList" :key="item" :value="item">{{ item }}</a-select-option>-->
<!--              </a-select>-->
<!--            </a-form-item>-->
<!--          </a-col>-->
<!--          <a-col :md="6" :sm="8">-->
<!--            <a-form-item label="项目编码">-->
<!--              <a-select-->
<!--                show-search-->
<!--                placeholder="请输入项目编码"-->
<!--                option-filter-prop="children"-->
<!--                :filter-option="filterOption"-->
<!--                v-model="queryParam.projectNo"-->
<!--              >-->
<!--                <a-select-option v-for="item in projectNoList" :key="item" :value="item">{{ item }}</a-select-option>-->
<!--              </a-select>-->
<!--            </a-form-item>-->
<!--          </a-col>-->
<!--          <a-col :md="6" :sm="8">-->
<!--            <a-form-item label="工作令号">-->
<!--              <a-select-->
<!--                show-search-->
<!--                placeholder="请输入工作令号"-->
<!--                option-filter-prop="children"-->
<!--                :filter-option="filterOption"-->
<!--                v-model="queryParam.workNo"-->
<!--              >-->
<!--                <a-select-option v-for="item in workNoList" :key="item" :value="item">{{ item }}</a-select-option>-->
<!--              </a-select>-->
<!--            </a-form-item>-->
<!--          </a-col>-->
<!--          <a-col :md="6" :sm="8">-->
<!--            <a-form-item label="bomId">-->
<!--              <a-select-->
<!--                show-search-->
<!--                placeholder="请选择BOM"-->
<!--                option-filter-prop="children"-->
<!--                :filter-option="filterOption"-->
<!--                @change="handleBomChange"-->
<!--                v-model="queryParam.bomId"-->
<!--                default-value="defaultValue"-->
<!--              >-->
<!--                <a-select-option v-for="item in bomIdList" :key="item" :value="item">{{ item }}</a-select-option>-->
<!--              </a-select>-->
<!--            </a-form-item>-->
<!--          </a-col>-->
<!--          <a-col :md="6" :sm="8">-->
<!--            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">-->
<!--              <a-button type="primary" @click="query" icon="search">查询</a-button>-->
<!--              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>-->
<!--            </span>-->
<!--          </a-col>-->
<!--        </a-row>-->
<!--      </a-form>-->
<!--    </div>-->
周峰 authored
70
71
72
<!--    &lt;!&ndash; table区域-begin &ndash;&gt;-->
<!--    <div>-->
周峰 authored
73
74
75
76
77
78
<!--      <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>-->
周峰 authored
79
80
81
82
83
84
85
86
87
<!--      <a-table-->
<!--        :columns="columns"-->
<!--        :scroll="{x: 1500}"-->
<!--        size="middle"-->
<!--        :dataSource="treeDataSource"-->
<!--        :loading="planLoading"-->
<!--        :expandedRowKeys="expandedRowKeys"-->
<!--        @expandedRowsChange="handleExpandedRowsChange">-->
周峰 authored
88
89
90
91
92
93
94
95
96
97
98
99
100
<!--        <span slot="action" slot-scope="text, record">-->
<!--          <a @click="handleEdit(record)">编辑</a>-->
<!--        </span>-->
<!--        &lt;!&ndash; 字符串超长截取省略号显示 &ndash;&gt;-->
<!--        <span slot="url" slot-scope="text">-->
<!--          <j-ellipsis :value="text" :length="25" />-->
<!--        </span>-->
<!--        &lt;!&ndash; 字符串超长截取省略号显示&ndash;&gt;-->
<!--        <span slot="component" slot-scope="text">-->
<!--          <j-ellipsis :value="text" />-->
<!--        </span>-->
<!--      </a-table>-->
周峰 authored
101
102
103
104
105
106
107
      <div class="table-page-search-wrapper" style="margin-top: 20px">
        <a-form layout="inline" @keyup.enter.native="searchQuery">
          <a-row :gutter="24">
            <a-input v-model="queryParam.bomId" v-show="false"></a-input>
            <a-col :md="6" :sm="8">
              <a-form-item label="工作令号">
108
109
<!--                <a-input placeholder="请输入工作令号" v-model="queryParam.workNo"></a-input>-->
                <j-popup  v-model="queryParam.workNo" code="find_projectc" field="field0056" orgFields="field0056" destFields="field0056" :multi="true"/>
110
111
              </a-form-item>
            </a-col>
112
113
114
115
116
117
118

            <a-col :md="6" :sm="8">
              <a-form-item label="采购单号">
                <a-input placeholder="请输入采购单号" v-model="queryParam.code"></a-input>
              </a-form-item>
            </a-col>
119
120
121
122
123
124
125
126
127
128
            <a-col :md="6" :sm="8">
              <a-form-item label="物料编码">
                <a-input placeholder="请输入物料编码" v-model="queryParam.materialCode"></a-input>
              </a-form-item>
            </a-col>
            <a-col :md="6" :sm="8">
              <a-form-item label="物料名称">
                <a-input placeholder="请输入物料名称" v-model="queryParam.materialName"></a-input>
              </a-form-item>
            </a-col>
129
130
131
132
133
134
<!--            <a-col :md="6" :sm="8">-->
<!--              <a-form-item label="项目名称">-->
<!--                <a-input placeholder="请输入项目名称" v-model="queryParam.projectName"></a-input>-->
<!--              </a-form-item>-->
<!--            </a-col>-->
135
136
137
138
139
140
141
142
143
144
            <a-col :md="6" :sm="8">
              <a-form-item label="状态">
                <a-select
                  v-model="queryParam.status"    placeholder="请选择状态" >
                  <a-select-option v-for="item in statusList" :key="item.value" :value="item.value">{{ item.text }}</a-select-option>
                </a-select>
              </a-form-item>
            </a-col>
145
146
            <a-col :md="6" :sm="8">
              <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
147
                <a-button type="primary" @click="queryPurchaseIn" icon="search">查询</a-button>
148
149
150
151
152
153
154
                <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">
155
        <span style="float: left;" class="table-page-search-submitButtons">
156
            <a-button type="primary" @click="print()" icon="printer">打印</a-button>
157
        </span>
158
159
160
161
162
163
        <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
             <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader"
                       :action="importExcelUrl" @change="handleImportExcel">
              <a-button type="primary" icon="import">导入</a-button>
              </a-upload>
          </span>
164
        <a-button type="primary" icon="download" @click="handleExportXls('采购表')">导出</a-button>
165
        <span>
166
            <a-button type="primary" @click="batchEditOpen()" icon="edit" style="margin-left: 8px">批量编辑</a-button>
167
168
        </span>
        <span>
陈翱 authored
169
            <a-button type="primary" @click="shipToSide()" v-has="'purchase:ship'" icon="car" style="margin-left: 8px">直发现场</a-button>
170
        </span>
171
      </div>
周峰 authored
172
173
174
175
176
177
      <a-table
        ref="table"
        bordered
        size="middle"
        rowKey="id"
        :columns="planColumns"
178
        :dataSource="dataSource"
周峰 authored
179
180
        :pagination="ipagination"
        :loading="loading"
181
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: selectChanges}"
周峰 authored
182
183
        @change="handleTableChange">
184
        <span slot="status" slot-scope="status">
185
          <a-tag :key="status" :color="solutionPurchaseColor(status)">
186
187
188
189
            {{ solutionPurchaseStatus(status) }}
          </a-tag>
        </span>
190
191
192
193
194
195
196
197
198
199
        <span slot="flag" slot-scope="flag">
          <a-tag :key="flag" :color="longTermColor(flag)">
            {{ longTerm(flag) }}
          </a-tag>
        </span>

        <span slot="tradeTime" slot-scope="time">
          {{ timeFormat(time) }}
        </span>
周峰 authored
200
        <span slot="action" slot-scope="text, record">
陈翱 authored
201
202
203
204
          <a v-has="'purchase:change'" @click="handleEdit(record)">变更计划</a>
          <a-divider v-has="'purchase:change'" type="vertical" />
          <a-popconfirm v-has="'purchase:delete'" title="回退会删除此采购计划,确定继续吗?" @confirm="() => returnPlan(record.id,record.status)">
            <a v-has="'purchase:delete'">回退计划</a>
205
          </a-popconfirm>
周峰 authored
206
        </span>
周峰 authored
207
208
209
      </a-table>

    <!-- table区域-end -->
周峰 authored
210
    <purchase-in-modal ref="modalForm" @ok="modalFormOk"></purchase-in-modal>
211
    <purchase-in-batch-modal ref="batchModalForm"></purchase-in-batch-modal>
212
    <merge-modal ref="mergeModal"></merge-modal>
213
    <purchase-in-print-modal ref="purchaseInPrintModal"></purchase-in-print-modal>
214
    <ship-header-purchase-form ref="shipHeaderFrom"></ship-header-purchase-form>
周峰 authored
215
216
  </a-card>
217
周峰 authored
218
219
220
</template>

<script>
221
import { JeecgListMixin } from '../../mixins/JeecgListMixin'
222
import { deleteAction} from '@/api/manage'
周峰 authored
223
224
225
226
227
228
229
import {
  getProjectName,
  getWorkNo,
  getProjectNo,
  getBomTree,
  getPurchase,
  getBomIdList,
230
  getBomId,
231
  ajaxGetDictItems
周峰 authored
232
233
} from '../../api/api'
import PurchaseInModal from './modules/PurchaseInModal'
234
import PurchaseInBatchModal from './modules/PurchaseInBatchModal'
235
import PurchaseInPrintModal from './modules/PurchaseInPrintModal'
236
237
import moment from 'moment'
import MergeModal from './modules/mergeModal'
238
import ShipHeaderPurchaseForm from "./modules/ShipHeaderPurchaseForm";
239
周峰 authored
240
241
242
243
244
245
246
247
248
249
250
const columns = [
  {
    title: '图号',
    dataIndex: 'drawingNo',
    key: 'drawingNo'
  },
  {
    //   title: 'BOM',
    //   dataIndex: 'bomId',
    //   key: 'bomId'
    // }, {
251
    title: '编码',
周峰 authored
252
253
254
    dataIndex: 'code',
    key: 'code'
  }, {
255
    title: '名称',
周峰 authored
256
257
    dataIndex: 'name',
    key: 'name'
258
  }, {
259
    title: '单位',
周峰 authored
260
261
262
263
264
265
    dataIndex: 'unit',
    key: 'unit'
  }, {
    title: '用量',
    dataIndex: 'number',
    key: 'number'
266
  }, {
周峰 authored
267
268
269
    title: '状态',
    dataIndex: 'status',
    key: 'status'
270
  }, {
周峰 authored
271
272
273
    title: '制造方式',
    dataIndex: 'method',
    key: 'method'
274
  }, {
周峰 authored
275
276
277
    title: '设计类型',
    dataIndex: 'designType',
    key: 'designType'
278
  }, {
周峰 authored
279
280
281
    title: 'WIP属性',
    dataIndex: 'wipType',
    key: 'wipType'
282
  }, {
周峰 authored
283
284
285
286
287
288
289
290
291
292
    title: '品牌',
    dataIndex: 'brand',
    key: 'brand'
  }, {
    title: '分类',
    dataIndex: 'categories',
    key: 'categories'
  }
]
export default {
周峰 authored
293
  name: 'PurchaseIn',
周峰 authored
294
295
  mixins: [JeecgListMixin],
  components: {
296
    PurchaseInPrintModal,
297
    MergeModal,
298
    PurchaseInModal,
299
300
    PurchaseInBatchModal,
    ShipHeaderPurchaseForm
周峰 authored
301
302
303
  },
  data() {
    return {
304
      disableMixinCreated: true,
305
306
      ids: '',
      printVisible: false,
307
      confirmLoading: false,
308
      planLoading: false,
周峰 authored
309
      description: '这是采购入库页面',
310
      defaultValue: '',
311
312
      purchasedStatusList: [],
      treeDataSource: [],
周峰 authored
313
314
315
316
317
      // 表头
      columns: columns,
      loading: false,
      // 展开的行,受控属性
      expandedRowKeys: [],
318
319
      printDataSource: [],
      printLoading: false,
周峰 authored
320
321
322
323
      queryParam: [],
      projectNameList: [],
      workNoList: [],
      projectNoList: [],
324
      statusList:[],
325
      workNoArr:'',
陈翱 authored
326
      projectNameStr:'',
327
328
329
330
      materialCodeArr:'',
      materialNameArr:'',
      unitArr:'',
      qtyArr:'',
331
332
333
334
335
336
337
338
339
      /* 分页参数 */
      ipagination:{
        current: 1,
        pageSize: 5,
        pageSizeOptions: ['10', '50', '100', '200', '300'],
        showTotal: (total, range) => {
          return range[0] + "-" + range[1] + " 共" + total + "条"
        },
        showQuickJumper: true,
340
        showSizeChanger: true,
341
        total: 0
342
      },
周峰 authored
343
      bomIdList: [],
344
      batchForm: this.$form.createForm(this),
周峰 authored
345
346
      planColumns: [
        {
347
348
349
350
351
          title: '项目名称',
          dataIndex: 'projectName',
          key: 'projectName'
        },
        {
陈翱 authored
352
353
354
355
356
          title: '工作令',
          dataIndex: 'workNo',
          key: 'workNo'
        },
        {
357
358
359
360
          title: '采购单号',
          dataIndex: 'code',
          key: 'code'
        }, {
361
          title: '编码',
周峰 authored
362
          dataIndex: 'materialCode',
周峰 authored
363
          key: 'materialCode'
周峰 authored
364
        }, {
365
          title: '名称',
周峰 authored
366
          dataIndex: 'materialName',
周峰 authored
367
          key: 'materialName'
368
        }, {
369
          title: '单位',
周峰 authored
370
371
          dataIndex: 'unit',
          key: 'unit'
陈翱 authored
372
373
374
375
376
        }
        , {
          title: '规格',
          dataIndex: 'spec',
          key: 'spec'
周峰 authored
377
378
379
380
        }, {
          title: '数量',
          dataIndex: 'qty',
          key: 'qty'
381
        },{
382
          title: '到货',
383
384
          dataIndex: 'inQty',
          key: 'inQty'
陈翱 authored
385
386
387
388
389
390
391
        },
        // {
        //   title: '发货',
        //   dataIndex: 'outQty',
        //   key: 'outQty'
        // },
        {
392
393
394
395
396
          title: '状态',
          dataIndex: 'status',
          key: 'status',
          align: 'center',
          scopedSlots: { customRender: 'status' }
陈翱 authored
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
        },
        // {
        //   title: '供应商',
        //   dataIndex: 'supplier',
        //   key: 'supplier'
        // }, {
        //   title: '联系人',
        //   dataIndex: 'contact',
        //   key: 'contact'
        // },
        // {
        //   title: '联系方式',
        //   dataIndex: 'phone',
        //   key: 'phone'
        //   // },{
        //   //   title: '计划开始时间',
        //   //   dataIndex: 'planStartTime',
        //   //   key: 'planStartTime'
        // },
        {
陈翱 authored
417
          title: '预计',
周峰 authored
418
          dataIndex: 'planEndTime',
419
420
421
422
423
          key: 'planEndTime',
          align: 'center',
          scopedSlots: {
            customRender: 'tradeTime'
          }
陈翱 authored
424
425
         },{
          title: '变更',
426
427
428
429
430
          dataIndex: 'changePlanEndTime',
          key: 'changePlanEndTime',
          scopedSlots: {
            customRender: 'tradeTime'
          }
陈翱 authored
431
432
        },{
          title: '到货时间',
周峰 authored
433
          dataIndex: 'actualEndTime',
434
435
436
437
438
          key: 'actualEndTime',
          align: 'center',
          scopedSlots: {
            customRender: 'tradeTime'
          }
陈翱 authored
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
        },
        // ,{
        //   title: '收货时间',
        //   dataIndex: 'receiptTime',
        //   key: 'receiptTime',
        //   align: 'center',
        //   scopedSlots: {
        //     customRender: 'tradeTime'
        //   }
        // },{
        //   title: '领料时间',
        //   dataIndex: 'pickingTime',
        //   key: 'pickingTime',
        //   align: 'center',
        //   scopedSlots: {
        //     customRender: 'tradeTime'
        //   }
        // }
        // , {
        //   title: '长周期',
        //   dataIndex: 'flag',
        //   key: 'flag',
        //   align: 'center',
        //   scopedSlots: { customRender: 'flag' },
        // },
        {
465
466
467
          title: '备注',
          dataIndex: 'remark',
          key: 'remark'
468
        }, {
周峰 authored
469
470
471
472
473
474
475
          title: '操作',
          dataIndex: 'action',
          fixed: 'right',
          scopedSlots: { customRender: 'action' },
          align: 'center',
          width: 150
        }
476
477
478
      ],
      url: {
        list: '/material/purchase/list',
479
        importExcelUrl: '/material/purchase/importExcel',
480
        exportXlsUrl: '/material/purchase/exportXls',
481
        delete: "/material/purchase/delete",
482
      }
周峰 authored
483
484
485
486
    }
  },
  created() {
    this.loadFrom()
487
    this.getPurchaseStatus()
周峰 authored
488
489
  },
  methods: {
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
    returnPlan(id,status){
      var that = this;
      if (status!="0"){
        that.$message.warning("只有采购中状态才能回退!");
        return false;
      }

      deleteAction(that.url.delete, {id: id}).then((res) => {
        if (res.success) {
          that.$message.success(res.message);
          that.loadData();
        } else {
          that.$message.warning(res.message);
        }
      });
    },
506
507
508
509
510
511
512
513
    selectChanges(selectedRowKeys, selectionRows) {
      this.selectedRowKeys = selectedRowKeys;
      this.selectionRows = selectionRows;
      var array='';
      var array1='';
      var array2='';
      var array3='';
      var array4='';
514
      var firstWorkNo='';
陈翱 authored
515
      var firstName='';
516
      var i=0;
517
      this.selectionRows.forEach(function (row) {
518
519
520
        i++;
        if (i=1){
          firstWorkNo=row.workNo;
陈翱 authored
521
          firstName=row.projectName;
522
523
524
525
526
        }
        if (firstWorkNo!=row.workNo){
          this.$message.warning("请选择一个工作令里的物料");
          return false;
        }
527
528
529
530
531
        array1 += row.materialCode + ",";
        array2 += row.materialName + ",";
        array3 += row.unit + ",";
        array4 += row.qty + ",";
      });
532
      this.workNoArr=firstWorkNo;
陈翱 authored
533
      this.projectNameStr=firstName;
534
535
536
537
538
539
      this.materialCodeArr=array1;
      this.materialNameArr=array2;
      this.unitArr=array3;
      this.qtyArr=array4;
    },
    shipToSide(){
陈翱 authored
540
      this.$refs.shipHeaderFrom.edit(this.projectNameStr,this.workNoArr,this.materialCodeArr,this.materialNameArr,this.unitArr,this.qtyArr,'采购');
541
    },
周峰 authored
542
    loadFrom() {
543
544
545
546
547
      ajaxGetDictItems('purchased_status').then((res)=> {
        if (res.success) {
          this.statusList = res.result
        }
      })
周峰 authored
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
      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
        }
      })
周峰 authored
563
564
565
566
567
      getBomIdList().then((res) => {
        if (res.success) {
          this.bomIdList = res.result
        }
      })
周峰 authored
568
569
570
571
    },
    filterOption(input, option) {
      return (
        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
572
      )
周峰 authored
573
    },
574
    loadTreeData(tree) {
575
576
      this.planLoading = false
      this.treeDataSource = tree
周峰 authored
577
578
579
580
581
    },

    handleExpandedRowsChange(expandedRows) {
      this.expandedRowKeys = expandedRows
    },
周峰 authored
582
    handleBomChange(value) {
583
      this.initBomTree(value)
周峰 authored
584
    },
585
    query() {
586
587
      this.planLoading = true
      this.loading = true
周峰 authored
588
      let params = {
589
590
591
592
        'bomId': this.queryParam.bomId,
        'projectName': this.queryParam.projectName,
        'projectNo': this.queryParam.projectNo,
        'workNo': this.queryParam.workNo
周峰 authored
593
594
      }
      getBomId(params).then((res) => {
595
        this.bomIdList = []
周峰 authored
596
        if (res.success) {
597
598
599
          for (let i = 0; i < res.result.length; i++) {
            this.bomIdList.push(res.result[i])
          }
周峰 authored
600
          this.initBomTree(this.bomIdList[0])
601
602
603
604
        } else {
          this.$message.warning(res.message)
          this.loading = false
          this.planLoading = false
周峰 authored
605
606
        }
      })
周峰 authored
607
    },
608
609
610
611
612
    queryPurchaseIn() {
      this.loading = true
      let params = {
        'workNo': this.queryParam.workNo,
        'materialCode': this.queryParam.materialCode,
613
        'materialName': this.queryParam.materialName,
614
        'status': this.queryParam.status,
615
616
        'code': this.queryParam.code,
        'projectName': this.queryParam.projectName,
617
618
619
      }
      this.getPurchaseList(params)
    },
620
621
622
623
624
625
626
627
    batchEditOpen() {
      if (this.selectedRowKeys.length <= 0) {
        this.$message.warning('请选择一条记录!')
      } else {
        this.ids = ''
        for (var a = 0; a < this.selectedRowKeys.length; a++) {
          this.ids += this.selectedRowKeys[a] + ','
        }
628
        this.$refs.batchModalForm.edit(this.ids)
629
630
      }
    },
周峰 authored
631
    initBomTree(bomId) {
周峰 authored
632
      let params = {
633
        'bomId': bomId
周峰 authored
634
      }
635
      this.queryParam.bomId = bomId
周峰 authored
636
637
      getBomTree(params).then((res) => {
        if (res.success) {
638
          this.loadTreeData(res.result)
639
640
        } else {
          this.$message.warning(res.message)
周峰 authored
641
642
        }
      })
643
644
645
      this.getPurchaseList(params)
    },
    getPurchaseList(params) {
周峰 authored
646
      getPurchase(params).then((res) => {
周峰 authored
647
        if (res.success) {
648
649
          this.loading = false
          this.dataSource = res.result.records
650
651
652
653
          if (res.result.total) {
            this.ipagination.total = res.result.total
          } else {
            this.ipagination.total = 0
周峰 authored
654
655
656
          }
        }
      })
657
658
    },
    print() {
659
660
661
662
      if (this.selectedRowKeys.length <= 0) {
        this.$message.warning('请选择一条记录!')
        return "";
      }
663
      this.$refs.purchaseInPrintModal.open(this.selectedRowKeys)
664
665
    },
    handleCancel(e) {
666
      this.printVisible = false
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
    },
    getPurchaseStatus() {
      ajaxGetDictItems('purchased_status').then((res) => {
        if (res.success) {
          this.purchasedStatusList = res.result
        }
      })
    },
    solutionPurchaseStatus(value) {
      var actions = []
      Object.keys(this.purchasedStatusList).some((key) => {
        if (this.purchasedStatusList[key].value == ('' + value)) {
          actions.push(this.purchasedStatusList[key].text)
          return true
        }
      })
      return actions.join('')
    },
685
    solutionPurchaseColor(value) {
686
687
688
689
690
691
692
      var actions = ''
      Object.keys(this.purchasedStatusList).some((key) => {
        if (this.purchasedStatusList[key].value == ('' + value)) {
          actions = this.purchasedStatusList[key].color
        }
      })
      return actions
693
694
695
696
697
698
    },
    longTerm(flag) {
      if (flag == '0') {
        return "否"
      } else {
        return "是"
699
      }
700
701
702
703
704
705
    },
    longTermColor(flag) {
      if (flag == '0') {
        return "volcano"
      } else {
        return "blue"
706
      }
707
708
    },
    timeFormat(val) {
709
710
711
712
713
      if(val==undefined){
        return "";
      }else{
        return moment(val).format('YYYY-MM-DD')
      }
714
715
716
    },
    merge(record) {
      this.$refs.mergeModal.open(record)
717
    }
周峰 authored
718
719
  },
  computed: {
720
721
    importExcelUrl: function() {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
周峰 authored
722
723
724
725
726
727
728
729
    }
  }
}
</script>

<style scoped>

</style>