13404089107
2 天以前 993e5fd593398926af72af660cb5ed6aba8e4e2b
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
<template>
  <el-dialog
    title="提交确认"
    :visible.sync="visible"
    width="80%"
    :close-on-click-modal="false"
    @close="handleClose"
    class="submit-confirm-dialog"
  >
    <div class="approval-content">
      <div class="sample-info">
        <div class="info-item" style="width: 100%">
          <span class="label">所属项目课题方案:</span>
          <span class="value">{{ formData.planName }}</span>
        </div>
        <div class="info-item">
          <span class="label">所属实验编号:</span>
          <span class="value">{{ formData.testCode }}</span>
        </div>
        <div class="info-item">
          <span class="label">所属实验名称:</span>
          <span class="value">{{ formData.testName }}</span>
        </div>
      </div>
 
      <Table :data="sampleData" :total="0" :height="null">
        <template>
          <el-table-column type="index" label="序号" width="60" align="center"></el-table-column>
          <el-table-column prop="termName" label="检测项名称"></el-table-column>
          <el-table-column prop="termCode" label="检测项编号"></el-table-column>
          <el-table-column prop="termType" label="定性/定量" align="center">
            <template slot-scope="scope">
              {{ scope.row.termType === 1 ? '定性' : '定量' }}
            </template>
          </el-table-column>
          <el-table-column prop="termMethodCode" label="检测方法编号"></el-table-column>
          <el-table-column prop="termMethod" label="检测方法"></el-table-column>
          <el-table-column prop="sampleRequire" label="收样要求" show-overflow-tooltip></el-table-column>
        </template>
      </Table>
 
      <div class="signature-section">
        <div class="signature-header">
          <span class="required">*</span>
          <span class="title">签字确认</span>
          <el-button type="primary" @click="openSignature">签名</el-button>
        </div>
        <div v-if="imgSrc" class="signature-preview">
          <img :src="imgSrc" alt="签名" />
        </div>
      </div>
    </div>
 
    <div slot="footer" class="dialog-footer">
      <el-button @click="handleClose">取 消</el-button>
      <el-button type="primary" @click="handleConfirm">确 认</el-button>
    </div>
 
    <SignatureCanvas
      :visible="signatureDialogVisible"
      @close="handleSignatureClose"
      @confirm="handleSignatureConfirm"
    />
  </el-dialog>
</template>
 
<script>
import SignatureCanvas from "@/components/SignatureCanvas.vue";
 
export default {
  name: "ConfirmDialog",
  components: {
    SignatureCanvas,
  },
  props: {
    visible: {
      type: Boolean,
      default: false,
    },
    formData: {
      type: Object,
      default: () => ({
        planName: '',
        planCode: '',
        testCode: '',
        testName: '',
        sampleCode: ''
      }),
    },
    sampleData: {
      type: Array,
      default: () => [],
    },
  },
  data() {
    return {
      signatureDialogVisible: false,
      imgSrc: "",
    };
  },
  methods: {
    handleClose() {
      this.$emit("update:visible", false);
      this.imgSrc = "";
    },
    openSignature() {
      this.signatureDialogVisible = true;
    },
    handleSignatureClose() {
      this.signatureDialogVisible = false;
    },
    handleSignatureConfirm(imageData) {
      this.signatureDialogVisible = false;
      this.imgSrc = imageData;
    },
    handleConfirm() {
      if (!this.imgSrc) {
        this.$message({
          type: 'warning',
          message: '请先完成签名确认',
          duration: 2000
        })
        return
      }
      this.$emit("confirm", this.imgSrc);
      this.handleClose();
    },
  },
};
</script>
 
<style lang="less" scoped>
.submit-confirm-dialog {
  :deep(.el-dialog__header) {
    padding: 15px 20px;
    border-bottom: 1px solid #e4e7ed;
    margin-right: 0;
  }
 
  :deep(.el-dialog__body) {
    padding: 20px;
  }
}
 
.approval-content {
  background: #ffffff;
}
 
.sample-info {
  margin-bottom: 25px;
  display: flex;
  flex-wrap: wrap;
  row-gap: 15px;
 
  .info-item {
    width: 50%;
    display: flex;
    align-items: center;
    padding-right: 20px;
    box-sizing: border-box;
 
    .label {
      color: #606266;
      margin-right: 10px;
      white-space: nowrap;
    }
 
    .value {
      color: #303133;
      font-weight: 500;
    }
  }
}
 
.signature-section {
  margin-top: 25px;
  padding: 0 20px;
 
  .signature-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
 
    .required {
      color: #f56c6c;
      margin-right: 5px;
    }
 
    .title {
      font-size: 14px;
      color: #606266;
      margin-right: 15px;
    }
  }
 
  .signature-preview {
    img {
      width: 200px;
      height: 100px;
      border: 2px dashed #009688;
      border-radius: 4px;
    }
  }
}
 
.dialog-footer {
  padding: 15px 20px;
  text-align: center;
  border-top: 1px solid #e4e7ed;
 
  .el-button {
    width: 120px;
    
    & + .el-button {
      margin-left: 12px;
    }
  }
}
</style>