safecheck-client 3.0.30-73 → 3.0.30-74

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,132 @@
1
+ <template>
2
+ <div>
3
+ <button @click="handleClick">渲染</button>
4
+ <button @click="savePaper">保存</button>
5
+ <iframe v-if="showSketchPage" :src="sketchPageSrc" id="aaaa2" style="width: 100%; height: 500px;"></iframe>
6
+ </div>
7
+ </template>
8
+
9
+ <script>
10
+ import HttpResetClass from "vue-client/src/plugins/HttpResetClass";
11
+
12
+ export default {
13
+ title: 'App',
14
+ data() {
15
+ return {
16
+ inputText: '',
17
+ showSketchPage: false,
18
+ sketchPageSrc: '/sketch',
19
+ sketchId: '',
20
+ title: '',
21
+ paperMessage: ''
22
+ };
23
+ },
24
+ props: {
25
+ row: ''
26
+ },
27
+ async ready() {
28
+ if (this.row) {
29
+ await new HttpResetClass().load('POST', 'rs/sql/tel_singleTable_OrderBy', {
30
+ data: {
31
+ items: 'blob', tablename: 't_blob_sketch', condition: `id = '${this.row}'`, orderitem: 'id'
32
+ }
33
+ }).then(res => {
34
+ if (res.data.length === 0) {
35
+ this.handleClick()
36
+ return
37
+ }
38
+ try {
39
+ let hex = Buffer.from(res.data[0].blob, 'hex').toString('utf8');
40
+ if (!hex.includes('{')) {
41
+ this.inputText = Buffer.from(hex, 'hex').toString('utf8');
42
+ } else {
43
+ this.inputText = hex;
44
+ }
45
+ } catch (e) {
46
+ this.$showMessage('网络异常请联系管理员')
47
+ }
48
+ this.handleClick()
49
+ })
50
+ }
51
+ },
52
+ methods: {
53
+ handleClick() {
54
+ this.showSketchPage = true;
55
+ this.$nextTick(() => {
56
+ const sketchIframe = document.getElementById('aaaa2');
57
+
58
+ window.addEventListener('message', (event) => {
59
+ if (JSON.parse(event.data.param).gadgets.length > 0) {
60
+ this.paperMessage = event.data.param;
61
+ }
62
+ });
63
+
64
+ sketchIframe.contentWindow.postMessage(this.inputText, '*');
65
+ })
66
+ },
67
+ savePaper() {
68
+ if (!this.paperMessage) {
69
+ this.$showMessage('请先点击左上角保存图标')
70
+ return
71
+ }
72
+ let param = JSON.parse(this.paperMessage)
73
+ if (!param.title) {
74
+ this.$showMessage('请填写示意图标题')
75
+ return
76
+ }
77
+ let gadgets = param.gadgets
78
+ if (gadgets.length > 0) {
79
+ var jsonString = JSON.stringify(param);
80
+ var reqdata = {
81
+ blob: Buffer.from(jsonString, 'utf8').toString('hex'),
82
+ orgid: this.$login.f.orgid,
83
+ orgname: this.$login.f.orgs,
84
+ title: param.title,
85
+ f_userinfo_id: this.row
86
+ }
87
+ new HttpResetClass().load('POST', 'rs/logic/savePaperEdit', {data: reqdata}).then(res => {
88
+ if (res.data.code === 200) {
89
+ this.$showMessage('保存成功')
90
+ } else {
91
+ this.$showMessage('保存失败')
92
+ }
93
+ })
94
+ }
95
+ },
96
+ hexToBytes(hex) {
97
+ for (var bytes = [], c = 0; c < hex.length; c += 2)
98
+ bytes.push(parseInt(hex.substring(c, 2), 16));
99
+ return new Uint8Array(bytes);
100
+ },
101
+ decodeHexStringToJSON(hexString) {
102
+ // 去除前缀 "0x"
103
+ var cleanHexString = hexString.slice(2);
104
+
105
+ // 将十六进制字符串转换为字节数组
106
+ var byteArray = this.hexToBytes(cleanHexString);
107
+
108
+ // 创建 Blob 对象
109
+ var blob = new Blob([byteArray], {type: 'application/json'});
110
+
111
+ // 读取 Blob 为文本
112
+ return new Promise(function (resolve, reject) {
113
+ var reader = new FileReader();
114
+ reader.onloadend = function () {
115
+ resolve(reader.result);
116
+ };
117
+ reader.onerror = function () {
118
+ reject(reader.error);
119
+ };
120
+ reader.readAsText(blob, 'UTF-8');
121
+ });
122
+ }
123
+ },
124
+ // beforeDestroy() {
125
+ // this.savePaper()
126
+ // }
127
+ }
128
+ </script>
129
+
130
+ <style>
131
+ /* 这里可以添加样式 */
132
+ </style>
@@ -144,7 +144,7 @@
144
144
 
145
145
  export default {
146
146
  title: '安检单',
147
- props: ['f_plan_id', 'item', 'role','parentPage','source'],
147
+ props: ['f_plan_id', 'item', 'role','parentPage','source','openpaper'],
148
148
  // props: ['f_plan_id', 'role'],
149
149
  data() {
150
150
  return {
@@ -2480,7 +2480,7 @@
2480
2480
  tittle:'安检详情',
2481
2481
  safe:true
2482
2482
  }
2483
- this.$goto('safecheck-userinfo', {userinfo:this.data}, 'repair')
2483
+ this.$goto('safecheck-userinfo', {userinfo:this.data,openpaper:this.openpaper}, 'repair')
2484
2484
  }
2485
2485
  },
2486
2486
  watch: {
@@ -14,6 +14,8 @@
14
14
  @click="history('维修记录')">维修记录</label>
15
15
  <label style="color: #00b3ee;text-decoration:none;"
16
16
  @click="history('其他收费')">其他收费</label>
17
+ <label style="color: #00b3ee;text-decoration:none;" v-if="openpaper"
18
+ @click="openPaper(userinfo.f_userinfoid)">其他收费</label>
17
19
  </p>
18
20
  </div>
19
21
  <div class="col-xs-12" style="padding: 2px 0">
@@ -271,7 +273,7 @@
271
273
 
272
274
  export default {
273
275
  title: 'SafecheckUserInfo',
274
- props: ['userinfo'],
276
+ props: ['userinfo','openpaper'],
275
277
  data () {
276
278
  return this.$parent.$parent.data
277
279
  },
@@ -308,6 +310,9 @@
308
310
  this.safecheckStateReady()
309
311
  },
310
312
  methods: {
313
+ openPaper(userinfo_id){
314
+ this.$parent.$parent.$goto('edit', {row:userinfo_id})
315
+ },
311
316
  history(val) {
312
317
  this.$dispatch('gotoson', {
313
318
  _this: this.$parent.$parent,
@@ -9,7 +9,8 @@ let specialComp = {
9
9
  'safecheck-devices': (resolve) => { require(['./android/SafecheckDevices'], resolve) },
10
10
  'PhoneUpUserinfo': (resolve) => { require(['./android/PhoneUpUserinfo'], resolve) },
11
11
  'safecheck-userinfo': (resolve) => { require(['./android/SafecheckUserInfo'], resolve) },
12
- 'safecheck-order-v': (resolve) => { require(['./android/SafecheckOrderV'], resolve) }
12
+ 'safecheck-order-v': (resolve) => { require(['./android/SafecheckOrderV'], resolve) },
13
+ 'edit': (resolve) => { require(['./android/Edit'], resolve) }
13
14
  }
14
15
 
15
16
  exports.specialComp = specialComp