safecheck-client 3.0.30-50 → 3.0.30-52

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.
@@ -1,47 +1,123 @@
1
1
  <template>
2
- <div>
3
- <input type="text" v-model="inputText" placeholder="Enter text here">
4
- <button @click="handleClick">测试</button>
5
- <iframe v-if="showSketchPage" :src="sketchPageSrc" ref="sketchIframe" id="sketchIframe"
6
- style="width: 100%; height: 500px;"></iframe>
7
- </div>
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: 600px;"></iframe>
6
+ </div>
8
7
  </template>
9
8
 
10
9
  <script>
10
+ import HttpResetClass from "vue-client/src/plugins/HttpResetClass";
11
+ import * as util from "../Util"
12
+
11
13
  export default {
12
- name: 'App',
13
- data() {
14
- return {
15
- inputText: '',
16
- showSketchPage: false,
17
- sketchPageSrc: '/sketch'
18
- };
14
+ title: 'App',
15
+ data() {
16
+ return {
17
+ inputText: '',
18
+ showSketchPage: false,
19
+ sketchPageSrc: '/sketch',
20
+ sketchId: '',
21
+ title: '',
22
+ paperMessage: ''
23
+ };
24
+ },
25
+ props: {
26
+ row: {
27
+ type: Object
28
+ }
29
+ },
30
+ ready() {
31
+ if (this.row) {
32
+ try {
33
+ let hex = Buffer.from(this.row.blob, 'hex').toString('utf8');
34
+ if (!hex.includes('{')) {
35
+ this.inputText = Buffer.from(hex, 'hex').toString('utf8');
36
+ } else {
37
+ this.inputText = hex;
38
+ }
39
+ } catch (e) {
40
+ this.$showMessage('网络异常请联系管理员')
41
+ }
42
+ }
43
+ this.handleClick()
44
+ },
45
+ methods: {
46
+ handleClick() {
47
+ this.showSketchPage = true;
48
+ this.$nextTick(() => {
49
+ const sketchIframe = document.getElementById('aaaa2');
50
+
51
+ window.addEventListener('message', (event) => {
52
+ if (JSON.parse(event.data.param).gadgets.length > 0) {
53
+ this.paperMessage = event.data.param;
54
+ }
55
+ });
56
+
57
+ sketchIframe.contentWindow.postMessage(this.inputText, '*');
58
+ })
19
59
  },
20
- methods: {
21
- handleClick() {
22
- this.showSketchPage = true;
23
- //this.sketchPageSrc = `/sketch?data=${encodeURIComponent(this.inputText)}`;
24
-
25
- // 使用 $nextTick 确保 iframe 已经加载到 DOM
26
- this.$nextTick(() => {
27
- const sketchIframe = document.getElementById('sketchIframe').contentWindow;
28
-
29
- // 监听来自 iframe 的消息
30
- window.addEventListener('message', (event) => {
31
- if (event.origin !== window.location.origin) {
32
- return;
33
- }
34
- console.log('Message received from sketch:', event.data);
35
- });
36
-
37
- // 发送消息到 iframe
38
- sketchIframe.onload = () => {
39
- sketchIframe.postMessage(this.inputText, window.location.origin);
40
- };
41
- }); // 逻辑空着
60
+ savePaper() {
61
+ if (!this.paperMessage) {
62
+ this.$showMessage('请先点击左上角保存图标')
63
+ return
64
+ }
65
+ let param = JSON.parse(this.paperMessage)
66
+ if (!param.title) {
67
+ this.$showMessage('请填写示意图标题')
68
+ return
69
+ }
70
+ param.sketchId = param.sketchId ? param.sketchId : util.generateUUID()
71
+ let gadgets = param.gadgets
72
+ if (gadgets.length > 0) {
73
+ var jsonString = JSON.stringify(param);
74
+ var reqdata = {
75
+ blob: Buffer.from(jsonString,'utf8').toString('hex'),
76
+ orgid: this.$login.f.orgid,
77
+ orgname: this.$login.f.orgs,
78
+ title: param.title,
79
+ sketchId: param.sketchId
42
80
  }
81
+ new HttpResetClass().load('POST', 'rs/logic/savePaperEdit', {data: reqdata}).then(res => {
82
+ if (res.data.code === 200) {
83
+ this.$showMessage('保存成功')
84
+ } else {
85
+ this.$showMessage('保存失败')
86
+ }
87
+ })
88
+ }
43
89
  },
90
+ hexToBytes(hex) {
91
+ for (var bytes = [], c = 0; c < hex.length; c += 2)
92
+ bytes.push(parseInt(hex.substring(c, 2), 16));
93
+ return new Uint8Array(bytes);
94
+ },
95
+ decodeHexStringToJSON(hexString) {
96
+ // 去除前缀 "0x"
97
+ var cleanHexString = hexString.slice(2);
98
+
99
+ // 将十六进制字符串转换为字节数组
100
+ var byteArray = this.hexToBytes(cleanHexString);
101
+
102
+ // 创建 Blob 对象
103
+ var blob = new Blob([byteArray], {type: 'application/json'});
44
104
 
105
+ // 读取 Blob 为文本
106
+ return new Promise(function(resolve, reject) {
107
+ var reader = new FileReader();
108
+ reader.onloadend = function() {
109
+ resolve(reader.result);
110
+ };
111
+ reader.onerror = function() {
112
+ reject(reader.error);
113
+ };
114
+ reader.readAsText(blob, 'UTF-8');
115
+ });
116
+ }
117
+ },
118
+ // beforeDestroy() {
119
+ // this.savePaper()
120
+ // }
45
121
  }
46
122
  </script>
47
123
 
@@ -6,32 +6,37 @@
6
6
  <div novalidate class="form-horizontal select-overspread container-fluid auto" partial>
7
7
  <div class="row">
8
8
  <div class="form-group col-sm-2">
9
- <label class="font_normal_body">用户分类</label>
10
- <input type="text" class="input_search" v-model="model.f_userinfo_code"
11
- style="width: 60%" placeholder="用户分类" condition="f_userinfo_code='{}'">
9
+ <label class="font_normal_body">用户编号</label>
10
+ <input type="text" class="input_search" v-model="model.title"
11
+ condition="tui.f_userinfo_code like '%{}%'"
12
+ style="width: 60%" placeholder="示意图标题" >
12
13
  </div>
13
14
  <div class="form-group col-sm-2">
14
- <label class="font_normal_body">用气单位</label>
15
- <input type="text" class="input_search" v-model="model.f_user_name"
16
- style="width: 60%" placeholder="客户名称" condition="f_user_name like '%{}%'">
15
+ <label class="font_normal_body">示意图标题</label>
16
+ <input type="text" class="input_search" v-model="model.title"
17
+ condition="tcs.title like '%{}%'"
18
+ style="width: 60%" placeholder="示意图标题" >
17
19
  </div>
18
20
  <div class="form-group col-sm-2">
19
- <label class="font_normal_body">示意图</label>
20
- <input type="text" class="input_search" v-model="model.f_user_phone"
21
- style="width: 60%" placeholder="客户电话" condition="f_user_phone like '%{}%'">
21
+ <label class="font_normal_body">示意图id</label>
22
+ <input type="text" class="input_search" v-model="model.blob_id"
23
+ condition="tcs.blob_id like '%{}%'"
24
+ style="width: 60%" placeholder="示意图id" >
22
25
  </div>
23
26
  <div class="form-group col-sm-2">
24
- <label class="font_normal_body">单位编号</label>
25
- <input type="text" class="input_search" v-model="model.f_meternumber"
26
- style="width: 60%" placeholder="客户表号" condition="f_meternumber like '%{}%'">
27
+ <label class="font_normal_body">单位名称</label>
28
+ <input type="text" class="input_search" v-model="model.gas_point_name"
29
+ condition="tcs.gas_point_name like '%{}%'"
30
+ style="width: 60%" placeholder="单位名称" >
27
31
  </div>
28
32
  <div class="form-group col-sm-2" style="width: auto;margin-top:8px;float: right">
29
33
  <export-excel-safe :data="$parent.$parent.searchData"
30
34
  :field="$parent.$parent.excelHeaders"
31
35
  :choose-col="true"
32
- sqlurl="rs/logic/SafeExportExcel" sql-name="查找安检单"
33
- template-name='安检计划明细'></export-excel-safe>
34
- <button class="button_spacing button_search" @click="$parent.$parent.change()">查询</button>
36
+ sqlurl="rs/logic/SafeExportExcel" sql-name="queryPaperEdit"
37
+ template-name='图纸编辑'></export-excel-safe>
38
+ <button class="button_spacing button_search" @click="$parent.$parent.search()">查询</button>
39
+ <button class="button_spacing button_search" @click="$parent.$parent.change()">新建</button>
35
40
  </div>
36
41
  </div>
37
42
  </div>
@@ -40,61 +45,58 @@
40
45
  <template partial='head'>
41
46
  <tr>
42
47
  <th>
43
- <nobr>是否有示意图</nobr>
48
+ <nobr>序号</nobr>
44
49
  </th>
45
50
  <th>
46
- <nobr>单位编号</nobr>
51
+ <nobr>分公司</nobr>
47
52
  </th>
48
53
  <th>
49
- <nobr>单位地址</nobr>
54
+ <nobr>单位编号</nobr>
50
55
  </th>
51
56
  <th>
52
57
  <nobr>单位名称</nobr>
53
58
  </th>
54
59
  <th>
55
- <nobr>联系人</nobr>
56
- </th>
57
- <th>
58
- <nobr>分公司</nobr>
60
+ <nobr>示意图标题</nobr>
59
61
  </th>
60
62
  <th>
61
63
  <nobr>示意图id</nobr>
62
64
  </th>
65
+
63
66
  <th>
64
67
  <nobr>操作</nobr>
65
68
  </th>
66
69
  </tr>
67
70
  </template>
68
71
  <template partial='body'>
69
-
70
- <td style="text-align: center">{{ row.uptodate }}</td>
72
+ <td style="text-align: center">{{ $index+1 }}</td>
73
+ <td style="text-align: center">{{ row.gas_point_name }}</td>
71
74
  <td style="text-align: center">{{ row.gas_point_id }}</td>
72
75
  <td style="text-align: center">{{ row.gas_point_name }}</td>
73
76
  <td style="text-align: center">{{ row.title }}</td>
74
- <td style="text-align: center">{{ row.title12 }}</td>
75
- <td style="text-align: center">{{ row.title1 }}</td>
76
- <td style="text-align: center">{{ row.blod_id }}</td>
77
+ <td style="text-align: center">{{ row.blob_id }}</td>
78
+
77
79
  <td style="text-align: center">
78
- <button class="button_spacing button_search-1" @click='change(row)'>查看</button>
80
+ <button class="button_spacing button_search-1" @click='$parent.$parent.$parent.change(row)'>查看</button>
79
81
  </td>
80
82
  </template>
81
83
  </data-grid>
82
84
  </criteria-paged>
83
85
  </div>
86
+ <modal :show.sync="showModal" v-ref:modal backdrop="false" :width="1200">
87
+ <div slot="modal-header" class="modal-header">
88
+ <h4 class="modal-title">
89
+ 打开图纸编辑
90
+ </h4>
91
+ </div>
92
+ <div slot="modal-body" class="modal-body">
93
+ <edit :row="rowData" v-if="showModal"></edit>
94
+ </div>
95
+ <div slot="modal-footer" class="modal-footer" style="text-align: center">
96
+ <button class="button_search" @click="cancel">取消</button>
97
+ </div>
98
+ </modal>
84
99
  </div>
85
- <modal :show.sync="showModal" v-ref:modal backdrop="false" :width="1200">
86
- <div slot="modal-header" class="modal-header">
87
- <h4 class="modal-title">
88
- 打开图纸编辑
89
- </h4>
90
- </div>
91
- <div slot="modal-body" class="modal-body">
92
- <edit></edit>
93
- </div>
94
- <div slot="modal-footer" class="modal-footer" style="text-align: center">
95
- <button class="button_search" @click="cancel">取消</button>
96
- </div>
97
- </modal>
98
100
  </template>
99
101
 
100
102
  <script>
@@ -110,34 +112,35 @@ export default {
110
112
  return {
111
113
  searchData: {
112
114
  condition: "1=1",
113
- f_plan_id: "",
114
- f_approved: '',
115
- f_entry_status: '',
116
- f_no_checkplan: '',
117
- f_filialeid: `('${this.$login.f.orgid}')`
118
115
  },
119
116
  model: new PagedList('rs/sql/queryPaperEdit', 20, {}),
120
117
  excelHeaders: {
121
- 'uptodate': '是否有示意图',
118
+ 'id': '序号',
119
+ 'orgname': '分公司',
122
120
  'gas_point_id': '单位编号',
123
- 'gas_point_name': '单位地址',
124
- 'title': '单位名称',
125
- 'title12': '联系人',
126
- 'title1': '分公司',
127
- 'blod_id': '示意图id',
121
+ 'gas_point_name': '单位名称',
122
+ 'title': '示意图标题',
123
+ 'blob_id': '示意图id',
128
124
  },
129
125
  showModal: false,
126
+ rowData:''
130
127
  }
131
128
  },
132
129
  methods: {
133
- change() {
130
+ change(row) {
131
+ this.rowData = row
134
132
  this.showModal = true
133
+ console.log(this)
135
134
  },
136
135
  search() {
137
136
  this.$refs.paged.$refs.criteria.search()
138
137
  },
139
138
  cancel() {
140
139
  this.showModal = false
140
+ },
141
+ selfSearch(args) {
142
+ this.searchData.condition = args.condition
143
+ this.model.search(args.condition, args.model, args.condValue)
141
144
  }
142
145
  },
143
146