zhaoxiaoqiang1
2026-01-04 f1d30d03186c79ca2cbcfe60d6d2ce7d73fba97b
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
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
<template>
  <div class="signet_list_main">
    <SearchCondition
      :info="info"
      ref="condRef"
      :conForm="conForm"
      :buttonsList="[1, 2]"
      :isShowDetail="isShowDetail"
      :screenWidth="screenWidth"
      @handleOnSeach="handleOnSeach"
      @handleOnRest="handleOnRest"
      @handleClick="isShowDetail = !isShowDetail"
    />
    <div />
    <!-- <el-row class="add-button">
      <el-col :span="24">
        <el-button
          type="primary"
          size="small"
          icon="el-icon-refresh"
          @click="handleAddPage"
          class="add-btn"
          >生效配置</el-button
        >
      </el-col>
    </el-row>-->
    <ProTable
      :pageInfo="pageInfo"
      @doAction="doAction"
      @handleCurrentChange="handleCurrentChange"
      @handleSizeChange="handleSizeChange"
      :isAutoIndex="true"
      :list="records"
      :header="tableHeader"
      :loading="loading"
    />
    <el-dialog
      title="上传图片"
      :visible.sync="dialogVisible"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      :destroy-on-close="true"
      :show-close="false"
      width="450"
      center
      custom-class="upload_dialog"
    >
      <FileUpload
        :fileInfo="fileInfo"
        :isUpload="true"
        :multiple="false"
        :isShowTitle="'false'"
        @beforeAvatarUpload="beforeAvatarUpload"
        @handleUpload="handleUpload"
        @handleCancle="handleCancle"
        @handleDelete="handleDelete"
      />
      <!-- <template slot="footer" class="dialog-footer">
        <el-button @click="handleCancle">取 消</el-button>
        <el-button type="primary" @click="saveHelpDoc">确 定</el-button>
      </template>-->
    </el-dialog>
  </div>
</template>
 
<script>
import {
  SIGNETMANAGECOND,
  SIGNETMANAGECONDDEF
} from "../config/condtion.config";
import { SIGNETMANAGECOLUMN } from "../config/column.config";
import ProTable from "../../components/ProTable";
import SearchCondition from "../../components/SearchCondition";
import FileUpload from "../../components/FileUpload";
import {
  qrySignatureList,
  qrySignatureImageInfo,
  uploadImageForSignature
} from "@/http/api";
export default {
  data() {
    return {
      info: [...SIGNETMANAGECOND],
      restFormItems: [...SIGNETMANAGECOND],
      tableHeader: [...SIGNETMANAGECOLUMN],
      conForm: { ...SIGNETMANAGECONDDEF },
      pageInfo: {
        currentPage: 1,
        pageSize: 10,
        total: 0
      },
      fileInfo: {
        required: false,
        description: "",
        count: 0,
        images: [],
        key: "signetInfo"
      },
      records: [],
      newTypeno: "",
      itemNo: "", //列表对应的签章编号
      screenWidth: document.body.offsetWidth,
      condtionValue: {}, // 表单value集合
      isShowBorder: true,
      isShowDetail: false, // 是否显示所有表单项
      isView: false,
      loading: false,
      btnLoading: false,
      dialogVisible: false
    };
  },
  components: {
    SearchCondition,
    ProTable,
    FileUpload
  },
  created() {},
  mounted() {
    window.addEventListener("resize", this.getScreenWidth);
    this.getSignatureList();
  },
  destroyed() {
    window.removeEventListener("resize", this.getScreenWidth);
  },
  methods: {
    getScreenWidth() {
      this.$set(this, "screenWidth", document.body.offsetWidth);
    },
    // 获取列表
    async getSignatureList() {
      const { currentPage, pageSize } = this.pageInfo;
      const { itemname, itemno, updateuser } = this.condtionValue;
      const loading = this.$loading({
        lock: true,
        text: "",
        background: "hsla(0,0%,100%,.9)"
      });
      setTimeout(() => {
        loading.close();
      }, 1500);
      const params = {
        currentPage,
        itemname,
        updateuser,
        itemno,
        pageSize
      };
      const listRes = await qrySignatureList(params);
      loading.close();
      if (listRes.code && listRes.code === "00") {
        const newList =
          listRes.result &&
          listRes.result.records.map(item => {
            const newItem = { ...item };
            newItem.operationOption = [
              { label: "上传图片", type: "upload", value: true }
            ];
            return newItem;
          });
        this.$set(this, "records", newList);
        this.$set(
          this.pageInfo,
          "total",
          listRes.result && listRes.result.total
        );
      }
    },
    // 获取签章信息
    async SignatureImageInfo() {
      const params = {
        itemno: this.itemNo
      };
      const signetInfoRes = await qrySignatureImageInfo(params);
      if (!signetInfoRes || signetInfoRes.code !== "00") {
        return false;
      }
      if (signetInfoRes.result.url) {
        const { url, filename } = signetInfoRes.result;
        this.$set(this.fileInfo, "images", [{ url, filename }]);
      }
    },
    // 搜索列表
    handleOnSeach() {
      const conRef = this.$refs.condRef;
      this.$set(this, "condtionValue", conRef.$refs["conform"].model);
      this.$set(this, "pageInfo", { currentPage: 1, pageSize: 10, total: 0 });
      this.getSignatureList();
    },
 
    // 获取筛选条件value
    setValueInfo(condtions) {
      this.$set(this, "condtionValue", condtions);
    },
 
    // 重置
    handleOnRest() {
      this.$set(this, "condtionValue", {});
      // this.$set(this, 'pageInfo', { currentPage: 1, pageSize: 10, total: 0 })
      // this.getProductList()
    },
    // 表单事件回调
    async doAction(name, item, { type }) {
      if (type === "upload") {
        this.itemNo = item.itemno;
        await this.SignatureImageInfo();
        this.dialogVisible = true;
      }
    },
    // 上传前事件
    beforeAvatarUpload() {
      const doclistRef = this.$refs.doclist;
      doclistRef.$refs["createForm"].validate(async valid => {
        if (valid) {
          return true;
        } else {
          this.$message.error("请完必填项!");
          return false;
        }
      });
    },
    //  上传文件
    handleUpload(fileData) {
      if (!fileData) {
        return false;
      }
      const { itemNo } = this;
      const formData = new FormData();
      formData.append("file", fileData);
      formData.append("itemNo ", itemNo);
      uploadImageForSignature(formData).then(res => {
        if (res.code === "00") {
          this.$message.success("上传成功!");
          this.SignatureImageInfo();
          this.dialogVisible = false;
          this.getSignatureList();
        }
      });
    },
    handleCancle() {
      this.fileInfo.images = [];
      this.getSignatureList();
      this.dialogVisible = false;
    },
    // 删除文件
    async handleDelete() {
      this.fileInfo.images = [];
    },
    // 新增
    handleAddPage() {},
    // 保存文档
    saveHelpDoc() {
      this.handleCancle();
    },
    // 修改翻页条数
    handleSizeChange(val) {
      this.pageInfo.pageSize = val;
      this.getSignatureList();
    },
 
    // 修改翻页数
    handleCurrentChange(val) {
      this.pageInfo.currentPage = val;
      this.getSignatureList();
    }
  }
};
</script>
 
<style lang="less">
.signet_list_main {
  padding: 16px 0px 0 20px;
  & .upload_dialog {
    width: 350px;
    & .is-always-shadow {
      box-shadow: none;
    }
    & .el-card__body {
      padding: 0px;
    }
    & .images {
      text-align: center;
      & .imagesList {
        position: relative;
        & .img-item {
          & .el-icon-error {
            display: none;
            position: absolute;
            right: 0;
            top: -2px;
          }
          & img {
            width: auto;
            height: auto;
          }
          & .real-images {
            max-height: 151px;
            max-width: 242px;
          }
        }
      }
      // & img {
      //   max-height: 151px;
      //   width: 242px;
      // }
      & .alone-upload {
        margin-top: 20px;
        & .button-upload {
          margin-top: 5px;
          display: flex;
          justify-content: center;
          & .el-upload-list__item-name {
            display: none;
          }
        }
      }
    }
    & .el-button--default {
      width: 120px;
      height: 30px;
      line-height: 7px;
      border-radius: 4px;
      border: 1px solid rgba(204, 204, 204, 1);
    }
    & .el-button--primary {
      width: 120px;
      height: 30px;
      line-height: 7px;
      background: #0081f0;
      border-color: #0081f0;
      border-radius: 4px;
      margin-left: 40px;
    }
  }
  & .add-button {
    padding: 2px 0 30px 0;
  }
}
</style>