Blame view

ant-design-vue-jeecg/src/views/system/task/TaskDetailList.vue 8.56 KB
肖超群 authored
1
2
3
<template>
  <a-card :bordered="false" :class="'cust-erp-sub-tab'">
    <!-- 操作按钮区域 -->
4
    <!-- <div class="table-operator" v-if="mainId"> -->
5
6
    <!-- <a-button @click="handleAdd" v-has="'taskDetail:add'" type="primary" icon="plus">新增</a-button> -->
    <!-- <a-button type="primary" icon="download" @click="handleExportXls('任务详情')">导出</a-button>
肖超群 authored
7
8
9
10
11
12
13
      <a-upload
        name="file"
        :showUploadList="false"
        :multiple="false"
        :headers="tokenHeader"
        :action="importExcelUrl"
        @change="handleImportExcel">
肖超群 authored
14
        <a-button type="primary" icon="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"/> 删除
肖超群 authored
20
          </a-menu-item>
肖超群 authored
21
        </a-menu>
肖超群 authored
22
23
24
        <a-button style="margin-left: 8px"> 批量操作
          <a-icon type="down"/>
        </a-button>
25
26
      </a-dropdown> -->
    <!-- </div> -->
肖超群 authored
27
28
29

    <!-- table区域-begin -->
    <div>
30
      <!-- <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
肖超群 authored
31
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a
32
        style="font-weight: 600">{{ selectedRowKeys.length }}</a> 项
肖超群 authored
33
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
34
      </div> -->
肖超群 authored
35
36
37
38
39
40

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

        <span slot="action" slot-scope="text, record">
81
82
83
84
85
86
87
88
89
90
          <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)"
            >实盘登记<a-divider type="vertical"
          /></a>
谭毅彬 authored
91
          <a v-if="record.taskType == 1400 && record.status != 100" @click="qualityRegister(record)"
92
93
94
            >质检登记<a-divider type="vertical"
          /></a>
          <a v-has="'taskDetail:edit'" @click="handleEdit(record)">编辑<a-divider type="vertical"/></a>
肖超群 authored
95
          <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
易文鹏 authored
96
            <a v-has="'taskDetail:delete'">删除</a>
肖超群 authored
97
98
99
100
          </a-popconfirm>
        </span>
      </a-table>
    </div>
101
    <quality-register-detail-modal ref="qualityRegisterModal" @ok="modalFormOk"/>
肖超群 authored
102
103
104
105
106
    <taskDetail-modal ref="modalForm" @ok="modalFormOk" :mainId="mainId"></taskDetail-modal>
  </a-card>
</template>

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