lyh
2025-06-05 bf4cb4fdbd57f1785cdd1ddeadfb20a835d5fb6f
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
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
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
<template>
  <j-modal
    :width="1500"
    :visible="visible"
    switchFullscreen
    :confirmLoading="confirmLoading"
    @cancel="handleCancel"
    cancelText="关闭"
    :footer="null"
  >
    <!-- 查询区域 -->
    <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-input placeholder="请输入入库申请单编号" v-model="queryParam.inboundNum" />
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
              <a-form-item label="入库类型">
                <j-search-select-tag
                  placeholder="请选择入库类型"
                  v-model="queryParam.inStorehouseType"
                  dict="in_storehouse_type"
                />
              </a-form-item>
            </a-col>
          <!-- <a-col :md="6" :sm="8">
              <a-form-item label="经手人">
                <j-search-select-tag
                  placeholder="请选择经手人"
                  v-model="queryParam.handler"
                  dict="sys_user,realname,id,del_flag!=1"
                />
              </a-form-item>
            </a-col> -->
        </a-row>
      </a-form>
    </div>
 
    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
      <a-button type="primary" @click="searchReset" icon="reload">重置</a-button>
      <a-button @click="handleInbound" type="primary" icon="plus">入库</a-button>
    </div>
 
    <!-- table区域-begin -->
    <a-table
      ref="table"
      size="middle"
      bordered
      rowKey="id"
      :customRow="customRow"
      :columns="columns"
      :dataSource="dataSource"
      :pagination="ipagination"
      :loading="loading"
      :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange,type:'radio'}"
      @change="handleTableChange"
    >
    </a-table>
    <a-tabs defaultActiveKey="1">
      <a-tab-pane tab="工具入库明细" key="1">
        <inbound-apply-detail-list ref="inboundDetailList" @selectRows="selectRows"></inbound-apply-detail-list>
      </a-tab-pane>
    </a-tabs>
    <!-- table区域-end -->
  </j-modal>
</template>
 
<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import InboundApplyDetailList from './InboundApplyDetailList'
import { requestPut } from '@/api/manage'
import JDictSelectTag from '@/components/dict/JDictSelectTag'
import JSearchSelectTag from '@/components/dict/JSearchSelectTag'
import { postAction,getAction } from '@/api/manage'
 
export default {
  name: 'InboundApplyModelList',
  mixins: [JeecgListMixin],
  components: {
    InboundApplyDetailList,
    JDictSelectTag,
    JSearchSelectTag,
  },
  data() {
    return {
      description: '申请单入库选择界面',
      url: {
        list: '/tms/inboundOrder/list',
        importExcelUrl: '/tms/inboundOrder/importExcel',
        exportXlsUrl: '/tms/inboundOrder/exportXls',
        edit:'/tms/inboundOrder/edit',
        addApplyInStorage:'/tms/inboundOrder/addApplyInStorage'
      },
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          align: 'center',
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          },
        },
        {
          title: '入库申请单编号',
          align: 'center',
          dataIndex: 'inboundNum',
          sorter: true,
        },
        {
          title: '入库单类型',
          align: 'center',
          dataIndex: 'inStorehouseType_dictText',
        },
        {
          title: '经手人',
          align: 'center',
          dataIndex: 'handler_dictText',
        },
        {
          title: '申请原因',
          align: 'center',
          dataIndex: 'applicationReason',
        },
        {
          title: '入库时间',
          align: 'center',
          dataIndex: 'inboundTime',
          sorter: true,
        },
        {
          title: '审核人',
          align: 'center',
          dataIndex: 'reviewer_dictText',
        },
        {
          title: '审核时间',
          align: 'center',
          dataIndex: 'approvalDate',
          sorter: true,
        },
        {
          title: '审核状态',
          align: 'center',
          dataIndex: 'orderStatus_dictText',
        },
         {
          title: '借用单号',
          align: 'center',
          dataIndex: 'borrowNum',
        },
         {
          title: '审批意见',
          align: 'center',
          dataIndex: 'approvalOpinion',
        },
        // {
        //   width: 150,
        //   title: '操作',
        //   dataIndex: 'action',
        //   align: 'center',
        //   scopedSlots: { customRender: 'action' },
        // },
      ],
      visible:false,
      selectDetailRows:{},
      model:{},
      form: this.$form.createForm(this),
      confirmLoading: false,
      loading:false,
      disableMixinCreated: true,
    }
  },
  computed: {
    /* 导入路径页面重新计算 */
    importExcelUrl: function () {
      //  return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;//开发环境指向
      return `${window._CONFIG['hxFileURL']}/${this.url.importExcelUrl}`
    },
  },
  methods: {
    show(){
      this.visible = true
      this.loadData()
    },
    loadData(arg) {
        if(!this.url.list){
          this.$message.error("请设置url.list属性!")
          return
        }
        //加载数据 若传入参数1则加载第一页的内容
        if (arg === 1) {
          this.ipagination.current = 1;
        }
        this.onClearSelected()
        this.queryParam.orderStatus = '3'
        this.queryParam.inStatus = ['1','2'].join(',')
        var params = this.getQueryParams();//查询条件
        this.loading = true;
        getAction(this.url.list, params).then((res) => {
          if (res.success) {
            this.dataSource = res.result.records;
            this.ipagination.total = res.result.total;
          }
          if(res.code===510){
            this.$message.warning(res.message)
          }
          this.loading = false;
        })
      },
       onClearSelected() {
        this.selectedRowKeys = [];
        this.selectionRows = [];
      },
    searchReset() {
      this.queryParam = {}
      this.$refs.inboundDetailList.dataSource = []
      this.loadData(1);
    },
    customRow(record) {
      return {
        on: {
          click: (e) => {
            //将当前选中的记录传到子页面
            this.$bus.$emit('getToolingStorageData', record)
            this.onSelectChange(record.id.split(","), [record]);
            //点击当前行变色
            let oldList = document.querySelectorAll('.checked-td-of-add-table')
            if (oldList) {
              for (let j = 0; j < oldList.length; j++) {
                oldList[j].classList.remove('checked-td-of-add-table')
              }
            }
            let children = e.target.parentNode.children
            for (let i = 0; i < children.length; i++) {
              children[i].classList.add('checked-td-of-add-table')
            }
          },
        },
      }
    },
    onSelectChange(selectedRowKeys, selectionRows) {
        this.selectedRowKeys = selectedRowKeys;
        this.selectionRows = selectionRows;
      },
     selectRows(selectDetailRows) {
        this.selectDetailRows = selectDetailRows;
      },
    handleInbound() {
      let that = this
      this.form.validateFields((err, values) => {
        if (!err) {
          that.confirmLoading = true
          that.loading = true
          let formData = Object.assign(this.model, values)
          formData.detailData = this.selectDetailRows
          formData.inStorehouseType = this.selectionRows[0].inStorehouseType
          formData.orderId = this.selectionRows[0].id
          postAction(this.url.addApplyInStorage, formData)
            .then((res) => {
              if (res.success) {
                that.$message.success(res.message)
                that.$emit('ok', new Date())
              } else {
                that.$message.warning(res.message)
              }
            })
            .finally(() => {
              that.confirmLoading = false
              that.loading = false
              that.handleCancel()
            })
        }
      })
      },
      handleCancel(){
        this.visible = false
 
      }
  },
}
</script>
 
<style lang="less" scoped>
@import '~@assets/less/common.less';
/deep/ .notshow {
  display: none;
}
/deep/ .checked-td-of-add-table {
  background-color: rgba(220, 220, 220, 1);
}
</style>