zhangherong
昨天 77fe33ce3227c630f0f646e992e60916fd54dd34
1
2
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
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<template>
  <j-modal
    :title="title"
    :width="width"
    :visible="visible"
    switchFullscreen
    @ok="handleOk"
    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
    @cancel="handleCancel"
    cancelText="关闭">
 
    <a-table
      ref="table"
      size="middle"
      :scroll="{x:true}"
      bordered
      rowKey=""
      :columns="columns"
      :dataSource="dataSource"
      :pagination="false"
      :loading="loading"
      class="j-table-force-nowrap">
 
      <template slot="checkFlag" slot-scope="text, record">
        <span v-if="text === '0'" style="color: red">否</span>
        <span v-if="text === '1'" style="color: green">是</span>
      </template>
    </a-table>
  </j-modal>
</template>
 
<script>
import { postAction, getAction } from '@api/manage'
 
export default {
  name: 'MesProductionWorkOrderReportModal',
  data () {
    return {
      title: '齐套性检查',
      width: 800,
      visible: false,
      loading: false,
      disableSubmit: false,
      model: {},
      validatorRules: {
      },
      labelCol: {
        xs: { span: 24 },
        sm: { span: 6 },
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 18 },
      },
      dataSource: [],
      columns: [
        {
          title: '#',
          dataIndex: '',
          key:'rowIndex',
          width:60,
          align:"center",
          customRender:function (t,r,index) {
            return parseInt(index)+1;
          }
        },
        {
          title:'物料编号',
          align:"center",
          dataIndex: 'materialNumber'
        },
        {
          title:'物料名称',
          align:"center",
          dataIndex: 'materialName'
        },
        {
          title:'需求数量',
          align:"center",
          dataIndex: 'requiredQuantity'
        },
        {
          title:'实际数量',
          align:"center",
          dataIndex: 'actualQuantity'
        },
        {
          title:'基本单位',
          align:"center",
          dataIndex: 'productionUnit'
        },
        {
          title:'是否齐备',
          align:"center",
          dataIndex: 'checkFlag',
          scopedSlots: { customRender: 'checkFlag' }
        },
        // {
        //   title: '操作',
        //   dataIndex: 'action',
        //   align:"center",
        //   fixed:"right",
        //   width:147,
        //   scopedSlots: { customRender: 'action' }
        // }
      ],
      url: {
        report: '/mesworkreporting/mesWorkReporting/add',
        selectReportWorkOrderList: '/mes/productionOrder/selectReportWorkOrderList',
        workOrderCompletenessCheck: '/mesproductionworkorder/mesProductionWorkOrder/workOrderCompletenessCheck',
        add: '/meskittingcompletenesscheck/mesKittingCompletenessCheck/addBatch'
      },
      workOrderOptions: []
    }
  },
  computed: {
    formDisabled(){
      return this.disabled
    },
  },
  methods: {
    check (record) {
      this.loading = true
      getAction(this.url.workOrderCompletenessCheck, {id: record.id}).then(res => {
        if (res.success) {
          res.result.map(item => item.workOrderId = record.id)
          this.dataSource = res.result
        }
      }).finally(() => {
        this.loading = false
      })
      this.visible = true
    },
    close () {
      this.$emit('close');
      this.visible = false;
    },
    handleOk () {
      postAction(this.url.add, this.dataSource).then(res => {
        if (res.success) {
          this.$message.success('检查结果已保存')
          this.submitCallback()
        } else {
          this.$message.warning(res.message)
        }
      })
    },
    submitCallback(){
      this.$emit('ok');
      this.visible = false;
    },
    handleCancel () {
      this.close()
    }
  }
}
</script>