647556386
2026-01-16 07ed1a4d311753e2b999b9d6eb3faace50831b51
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
<template>
  <div class="message-container">
    <!-- 加载状态 -->
    <div v-if="loading" class="loading">加载中...</div>
    
    <!-- 空数据提示 -->
    <div v-else-if="!list.length" class="empty">暂无消息</div>
    
    <!-- 消息列表 -->
    <div v-else class="list-wrap">
      <div class="item" v-for="(item, index) in list" :key="index">
        <div class="title">{{ item.title }}({{ item.date }})</div>
        <div class="content">
          <el-row>
            <el-col :span="8">
              <label>质检结果:{{ item.formData.result || '未填写' }}</label>
            </el-col>
            <el-col :span="8">
              <label>质检单号:{{ item.formData.checkOrderNo || '未填写' }}</label>
            </el-col>
            <el-col :span="8">
              <label>批次:{{ item.formData.batchNo || item.formData.receiveDetailRowNo || '未填写' }}</label>
            </el-col>
          </el-row>
 
          <el-row>
            <el-col :span="8">
              <label>物料编号:{{ item.formData.materielCode || '未填写' }}</label>
            </el-col>
            <el-col :span="8">
              <label>质检数量:{{ item.formData.receivedQuantity || '未填写' }}</label>
            </el-col>
            <el-col :span="8">
              <label>检验次数:{{ item.formData.inspectionNumber || '未填写' }}</label>
            </el-col>
          </el-row>
 
          <!-- 补充展示更多字段 -->
          <el-row v-if="item.formData.message" style="margin-top: 10px">
            <el-col :span="24">
              <label>备注:{{ item.formData.message }}</label>
            </el-col>
          </el-row>
        </div>
        <div style="margin-top: 20px">
          <el-button type="primary" @click="handleAgree(item)">同意</el-button>
          <el-button type="danger" @click="handleReject(item)">驳回</el-button>
        </div>
      </div>
    </div>
  </div>
</template>
 
<script>
export default {
  name: 'CheckOrderApproval',
  props: {
    list: {
      type: Array,
      default: () => [],
    },
  },
  data() {
    return {
      // 本地维护列表数据(无初始模拟数据)
      localList: [],
      loading: false, // 加载状态
    };
  },
  created() {
    // 仅调用接口,无测试数据填充
    this.fetchCheckOrderList();
  },
  methods: {
    /**
     * 请求质检审批列表(无兜底数据)
     */
    fetchCheckOrderList() {
      const _this = this;
      _this.loading = true;
      
      _this.http
        .post(`api/CheckOrder/ReceiveReCheckOrder`, {}, "加载质检审批数据中...")
        .then((x) => {
          _this.loading = false;
          if (x.status) {
            // 仅赋值接口返回的真实数据
            _this.localList = x.data || [];
          } else {
            // 无兜底数据,仅提示错误,列表置空
            _this.$Message.error('加载质检审批数据失败');
            _this.localList = [];
          }
        })
        .catch((error) => {
          _this.loading = false;
          console.error('加载质检审批数据异常:', error);
          _this.$Message.error('加载质检审批数据异常,请稍后重试');
          // 异常时列表置空,无兜底数据
          _this.localList = [];
        });
    },
 
    /**
     * 同意审批(无测试逻辑)
     */
    handleAgree(item) {
      const _this = this;
      _this.$confirm('确定同意该质检审批吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'info',
      }).then(() => {
        _this.http
          .post(`api/CheckOrder/AgreeReCheckOrder?orderNo=${item.formData.checkOrderNo}`, {}, "审批处理中...")
          .then((x) => {
            if (x.status) {
              _this.$Message.success('审批同意完成');
              _this.fetchCheckOrderList(); // 刷新列表
            } else {
              return _this.$Message.error('审批同意失败');
            }
          })
          .catch((error) => {
            console.error('同意审批异常:', error);
            _this.$Message.error('审批同意异常,请稍后重试');
          });
      }).catch(() => {
        _this.$Message.info('已取消同意');
      });
    },
 
    /**
     * 驳回审批(无测试逻辑)
     */
    handleReject(item) {
      const _this = this;
      _this.$prompt('请输入驳回原因', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
      }).then(({ value }) => {
        _this.http
          .post(
            `api/CheckOrder/RejectReCheckOrder?orderNo=${item.formData.checkOrderNo}`,
            { rejectReason: value },
            "审批驳回处理中..."
          )
          .then((x) => {
            if (x.status) {
              _this.$Message.success('审批驳回完成');
              _this.fetchCheckOrderList(); // 刷新列表
            } else {
              return _this.$Message.error('审批驳回失败');
            }
          })
          .catch((error) => {
            console.error('驳回审批异常:', error);
            _this.$Message.error('审批驳回异常,请稍后重试');
          });
      }).catch(() => {
        _this.$Message.info('已取消驳回');
      });
    },
  },
  computed: {
    list() {
      return this.localList.length ? this.localList : this.$props.list;
    },
  },
};
</script>
 
<style scoped lang="less">
.message-container {
  min-height: 300px;
  padding: 10px;
 
  .loading,
  .empty {
    text-align: center;
    padding: 50px 0;
    color: #999;
    font-size: 14px;
  }
 
  .title {
    padding-bottom: 10px;
    font-weight: bold;
    font-size: 15px;
  }
 
  .item {
    border-bottom: 1px solid #eee;
    padding: 10px 20px;
    margin-bottom: 10px;
    background: #fafafa;
    border-radius: 4px;
  }
 
  .content {
    color: #1b1b1b;
    font-size: 14px;
    line-height: 1.8;
 
    label {
      display: block;
      word-break: break-all;
    }
  }
 
  .list-wrap {
    margin-top: 10px;
  }
}
</style>