Blame view

ant-design-vue-jeecg/src/views/system/task/TaskDetailList.vue 8.71 KB
肖超群 authored
1
2
3
<template>
  <a-card :bordered="false" :class="'cust-erp-sub-tab'">
    <!-- 操作按钮区域 -->
4
    <!-- <div class="table-operator" v-if="mainId"> -->
5
    <!-- <a-button @click="handleAdd" v-has="'taskDetail:add'" type="primary" icon="plus">{{ $t('button.new') }}</a-button> -->
pengyongcheng authored
6
    <!-- <a-button type="primary" icon="download" @click="handleExportXls('任务详情')">{{ $t('button.export') }}</a-button>
肖超群 authored
7
8
9
10
11
12
13
      <a-upload
        name="file"
        :showUploadList="false"
        :multiple="false"
        :headers="tokenHeader"
        :action="importExcelUrl"
        @change="handleImportExcel">
14
        <a-button type="primary" icon="import">{{ $t('button.import') }}</a-button>
15
      </a-upload> -->
16
    <!-- <a-dropdown v-if="selectedRowKeys.length > 0">
易文鹏 authored
17
        <a-menu slot="overlay" v-has="'taskDetail:deleteBatch'">
肖超群 authored
18
          <a-menu-item key="1" @click="batchDel">
19
            <a-icon type="delete"/>{{$t('button.delete')}}
肖超群 authored
20
          </a-menu-item>
肖超群 authored
21
        </a-menu>
22
        <a-button style="margin-left: 8px">{{$t('button.multiSelectActions')}}
肖超群 authored
23
24
          <a-icon type="down"/>
        </a-button>
25
26
      </a-dropdown> -->
    <!-- </div> -->
肖超群 authored
27
28
29
30
31
32
33
34
35

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

      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
36
        :scroll="{ x: true }"
肖超群 authored
37
38
39
40
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
41
42
43
44
        @change="handleTableChange"
      >
        <span slot="companyCode" slot-scope="companyCode">
          <a-tag :key="companyCode" color="blue">
45
46
47
48
            {{ solutionCompany(companyCode) }}
          </a-tag>
        </span>
易文鹏 authored
49
50
51
52
53
54
        <span slot="inventoryStatus_dictText" slot-scope="inventoryStatus_dictText">
          <a-tag :key="inventoryStatus_dictText" :color="getStatusColor(inventoryStatus_dictText)">
            {{ inventoryStatus_dictText }}
          </a-tag>
        </span>
肖超群 authored
55
56
57
58
59
        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>
        <template slot="imgSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
60
61
62
63
64
65
66
          <img
            v-else
            :src="getImgView(text)"
            height="25px"
            alt=""
            style="max-width:80px;font-size: 12px;font-style: italic;"
          />
肖超群 authored
67
68
69
        </template>
        <template slot="fileSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
70
          <a-button v-else :ghost="true" type="primary" icon="download" size="small" @click="downloadFile(text)">
肖超群 authored
71
72
73
74
75
            下载
          </a-button>
        </template>

        <span slot="action" slot-scope="text, record">
76
77
78
79
80
81
82
83
          <adjustment-doc-modal
            ref="adjustmentModal"
            @ok="modalFormOk"
            :id="record.id"
            :taskHeaderId="record.taskHeaderId"
          />

          <a v-if="record.taskType == 700 && record.status != 100" @click="createMany(record)"
肖超群 authored
84
            >{{$t('task.inventoryRegistration')}}<a-divider type="vertical"
85
          /></a>
谭毅彬 authored
86
          <a v-if="record.taskType == 1400 && record.status != 100" @click="qualityRegister(record)"
87
88
            >质检登记<a-divider type="vertical"
          /></a>
89
90
91
          <a v-has="'taskDetail:edit'" @click="handleEdit(record)">{{$t('button.edit')}}<a-divider type="vertical"/></a>
          <a-popconfirm :title="$t('button.deletingIt')" @confirm="() => handleDelete(record.id)">
            <a v-has="'taskDetail:delete'">{{$t('button.delete')}}</a>
肖超群 authored
92
93
94
95
          </a-popconfirm>
        </span>
      </a-table>
    </div>
96
    <quality-register-detail-modal ref="qualityRegisterModal" @ok="modalFormOk"/>
肖超群 authored
97
98
99
100
101
    <taskDetail-modal ref="modalForm" @ok="modalFormOk" :mainId="mainId"></taskDetail-modal>
  </a-card>
</template>

<script>
102
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
103
import { getCompanyList } from '@api/api'
104
105
106
import TaskDetailModal from './modules/TaskDetailModal'
import AdjustmentDocModal from '../stocktaking/modules/AdjustmentDocModal'
import QualityRegisterDetailModal from './modules/QualityRegisterDetailModal'
肖超群 authored
107
肖超群 authored
108
export default {
109
  name: 'TaskDetailList',
肖超群 authored
110
  mixins: [JeecgListMixin],
111
112
113
114
115
  components: {
    TaskDetailModal,
    AdjustmentDocModal,
    QualityRegisterDetailModal,
  },
肖超群 authored
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
  props: {
    mainId: {
      type: String,
      default: '',
      required: false
    }
  },
  watch: {
    mainId: {
      immediate: true,
      handler(val) {
        if (!this.mainId) {
          this.clearList()
        } else {
          this.queryParam['taskHeaderId'] = val
131
          this.loadData(1)
肖超群 authored
132
133
        }
      }
肖超群 authored
134
135
136
137
138
139
    }
  },
  data() {
    return {
      description: '任务表管理页面',
      disableMixinCreated: true,
140
      companyList: [],
肖超群 authored
141
142
143
      // 表头
      columns: [
        {
144
          title: this.$t('task.detailId'),
145
          align: 'center',
肖超群 authored
146
147
148
          dataIndex: 'id'
        },
        {
pengyongcheng authored
149
          title: this.$t('inventory.company'),
150
          align: 'center',
151
152
          dataIndex: 'companyCode',
          key: 'companyCode',
153
          scopedSlots: { customRender: 'companyCode' }
肖超群 authored
154
155
        },
        {
肖超群 authored
156
          title: this.$t('inventory.materialCode'),
157
          align: 'center',
肖超群 authored
158
159
160
          dataIndex: 'materialCode'
        },
        {
肖超群 authored
161
          title: this.$t('inventory.materialName'),
162
          align: 'center',
肖超群 authored
163
164
165
          dataIndex: 'materialName'
        },
        {
肖超群 authored
166
          title: this.$t('inventory.materialSpec'),
167
          align: 'center',
肖超群 authored
168
169
170
          dataIndex: 'materialSpec'
        },
        {
肖超群 authored
171
          title: this.$t('inventory.materialUnit'),
172
          align: 'center',
肖超群 authored
173
174
175
          dataIndex: 'materialUnit'
        },
        {
肖超群 authored
176
          title: this.$t('inventory.qty'),
177
          align: 'center',
肖超群 authored
178
179
180
          dataIndex: 'qty'
        },
        {
肖超群 authored
181
          title: this.$t('inventory.batch'),
182
          align: 'center',
肖超群 authored
183
184
185
          dataIndex: 'batch'
        },
        {
肖超群 authored
186
          title: this.$t('inventory.serialNumber'),
肖超群 authored
187
188
189
190
          align: 'center',
          dataIndex: 'sn'
        },
        {
肖超群 authored
191
          title: this.$t('inventory.inventoryStatus'),
192
          align: 'center',
谭毅彬 authored
193
          dataIndex: 'inventoryStatus_dictText' + this.$ls.get('language'),
194
          scopedSlots: { customRender: 'inventoryStatus_dictText' }
肖超群 authored
195
        },
肖超群 authored
196
        {
肖超群 authored
197
          title: this.$t('task.receiptId2'),
198
199
200
201
          align: 'center',
          dataIndex: 'receiptId'
        },
        {
肖超群 authored
202
          title: this.$t('task.shipmentId'),
203
204
205
206
          align: 'center',
          dataIndex: 'shipmentId'
        },
        {
207
          title: this.$t('system.createBy'),
208
          align: 'center',
肖超群 authored
209
210
211
          dataIndex: 'createBy'
        },
        {
212
          title: this.$t('system.createTime'),
213
          align: 'center',
肖超群 authored
214
215
216
          dataIndex: 'createTime'
        },
        {
217
          title: this.$t('system.updater'),
218
          align: 'center',
肖超群 authored
219
220
221
          dataIndex: 'updateBy'
        },
        {
222
          title: this.$t('system.updateTime'),
223
          align: 'center',
肖超群 authored
224
225
226
          dataIndex: 'updateTime'
        },
        {
227
          title: this.$t('system.options'),
肖超群 authored
228
          dataIndex: 'action',
229
230
          align: 'center',
          fixed: 'right',
肖超群 authored
231
          width: 147,
232
          scopedSlots: { customRender: 'action' }
肖超群 authored
233
        }
肖超群 authored
234
235
      ],
      url: {
236
237
238
239
240
        list: '/task/taskHeader/listTaskDetailByMainId',
        delete: '/task/taskHeader/deleteTaskDetail',
        deleteBatch: '/task/taskHeader/deleteBatchTaskDetail',
        exportXlsUrl: '/task/taskHeader/exportTaskDetail',
        importUrl: '/task/taskHeader/importTaskDetail'
肖超群 authored
241
242
243
244
245
      },
      dictOptions: {
        taskType: [],
        isEmptyOut: [],
        isDoubleIn: [],
246
        status: []
肖超群 authored
247
248
      }
    }
肖超群 authored
249
250
  },
  created() {
251
    this.loadFrom()
肖超群 authored
252
253
254
  },
  computed: {
    importExcelUrl() {
255
      return `${window._CONFIG['domianURL']}/${this.url.importUrl}/${this.mainId}`
肖超群 authored
256
257
258
    }
  },
  methods: {
259
    loadFrom() {
260
      getCompanyList().then(res => {
261
262
263
        if (res.success) {
          this.companyList = res.result
        }
264
      })
265
266
267
    },
    solutionCompany(value) {
      var actions = []
268
269
      Object.keys(this.companyList).some(key => {
        if (this.companyList[key].code == '' + value) {
270
271
272
273
274
275
          actions.push(this.companyList[key].name)
          return true
        }
      })
      return actions.join('')
    },
肖超群 authored
276
277
278
279
    clearList() {
      this.dataSource = []
      this.selectedRowKeys = []
      this.ipagination.current = 1
280
    },
肖超群 authored
281
    createMany(record) {
282
      this.$refs.adjustmentModal.edit(record)
肖超群 authored
283
      this.$refs.adjustmentModal.title = this.$t('task.inventoryRegistration')
284
    },
285
    qualityRegister(record) {
286
287
288
      this.$refs.qualityRegisterModal.edit(record)
      this.$refs.qualityRegisterModal.title = '质检登记'
    }
肖超群 authored
289
  }
肖超群 authored
290
}
肖超群 authored
291
292
</script>
<style scoped>
293
@import '~@assets/less/common.less';
肖超群 authored
294
</style>