10000 complete fetching data from sy · supercoderhawk/emr-processor@da3720b · GitHub
[go: up one dir, main page]

Skip to content

Commit da3720b

Browse files
complete fetching data from sy
1 parent e97c1c3 commit da3720b

File tree

7 files changed

+56
-26
lines changed

7 files changed

+56
-26
lines changed

app/src/main/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ function createWindow () {
1212
* Initial window options
1313
*/
1414
mainWindow = new BrowserWindow({
15-
height: 600,
16-
width: 1400,
15+
height: 1200,
16+
width: 1600,
1717
'web-preferences' : {
1818
'web-security': false
1919
}

app/src/renderer/components/Converter.vue

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<div class="item">
77
<div class="row">
88
<div class="panel col-sm-12 col-xs-12 col-lg-12 content-wrapper">
9-
<bs-input ref="textarea" type="textarea" v-model="text" readonly></bs-input>
9+
<bs-input ref="textarea" type="textarea" v-model="plainText" readonly></bs-input>
1010
</div>
1111
</div>
1212
</div>
@@ -16,9 +16,7 @@
1616
<div class="col-sm-12 col-xs-12 col-lg-12 json-wrapper">
1717
<div id="json-container">
1818
</div>
19-
<div class="json-mode">
20-
21-
</div>
19+
<div class="json-mode" v-json-content="json"></div>
2220
</div>
2321
</div>
2422
</div>
@@ -27,9 +25,12 @@
2725
</template>
2826

2927
<script>
30-
// import JSONFormatter from 'json-formatter-js'
3128
import {input} from 'vue-strap'
3229
import panel from './Converter/Panel'
30+
import jsonFormatter from '../utils/formatter'
31+
32+
import Vue from 'vue'
33+
Vue.use(jsonFormatter)
3334
3435
export default {
3536
components: {
@@ -40,6 +41,19 @@
4041
return {
4142
text: 'aa'
4243
}
44+
},
45+
methods: {
46+
},
47+
computed: {
48+
plainText () {
49+
return this.$store.state.converter.plainText
50+
},
51+
jsonText () {
52+
return this.$store.state.converter.jsonText
53+
},
54+
json () {
55+
return JSON.parse(this.$store.state.converter.jsonText)
56+
}
4357
}
4458
}
4559
@@ -49,5 +63,7 @@
4963
.converter > div > .item{
5064
margin: 10px 20px;
5165
}
52-
66+
.panel textarea {
67+
height: 400px;
68+
}
5369
</style>

app/src/renderer/components/Converter/Panel.vue

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
<div class="col-sm-12 col-xs-12 col-lg-12">
55
<v-select v-model="input.value" :options="input.options" options-value="val"
66
name="records" @change="recordChange" @selected="recordSelected" justified required close-on-select></v-select>
7-
<button @click="getData" class="btn btn-default">获取数据</button>
8-
<button @click="test" class="btn btn-default">测试</button>
7+
<a @click="getData" class="btn btn-default">获取数据</a>
8+
<a @click="test" class="btn btn-default">测试</a>
99
</div>
1010
</div>
1111
<div class="row">
1212
<div class="col-sm-12 col-xs-12 col-lg-12">
1313
<v-select v-model="output.value" :options="output.options" options-value="val"
1414
name="types" justified close-on-select></v-select>
15-
<button @click="" class="btn btn-default">导出数据</button>
15+
<a @click="" class="btn btn-default">导出数据</a>
1616
</div>
1717
</div>
1818

@@ -49,12 +49,18 @@
4949
recordChange (value) {
5050
console.log('change:' + value)
5151
// 根据选中的病历ID设置内容
52+
let plain = this.$store.state.converter.records[value].plainText
53+
let json = this.$store.state.converter.records[value].jsonText
54+
this.$store.dispatch('modifyText', {plainText: plain, jsonText: json})
5255
},
5356
recordSelected (label) {
54-
// console.log('selected' + label)
57+
console.log('selected' + label)
5558
},
5659
// 获取森亿智库病历列表
5760
getData () {
61+
// 清除原有数据
62+
this.$store.dispatch('removeAllRecords')
63+
// 获取数据
5864
let $this = this
5965
syGet(CONVERTER.BASE_PATH, {start: 0, count: 27})
6066
.then(function (res) {
@@ -73,6 +79,7 @@
7379
.then(function (resConcept) {
7480
$this.$store.dispatch('addRecord',
7581
{id: resItem.id, name: resItem.name, plainText: resItem.content, jsonText: resConcept})
82+
$this.recordChange(0)
7683
})
7784
.catch(function (err) {
7885
console.log(err)

app/src/renderer/store/actions.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,8 @@ export const addRecord = ({ commit, state }, recItem) => {
2323
export const removeAllRecords = ({commit}) => {
2424
commit(types.REMOVE_ALL_RECORDS)
2525
}
26+
27+
export const modifyText = ({commit}, {plainText, jsonText}) => {
28+
commit(types.MODIFY_PLAIN_IN_DISPLAY, plainText)
29+
commit(types.MODIFY_JSON_IN_DISPLAY, jsonText)
30+
}

app/src/renderer/store/modules/converter.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,32 @@ const state = {
66
'id': 0,
77
'hash': '123',
88
'plainText': '',
9-
'jsonText': '',
9+
'jsonText': '{"a":1}',
1010
'name': '病历'
1111
}
1212
],
13-
amount: 1
13+
amount: 1,
14+
plainText: '纯文本',
15+
jsonText: '{"a":1}'
1416
}
1517

1618
const mutations = {
1719
[types.ADD_RECORD] (state, record) {
1820
state.records.push(record)
1921
},
20-
2122
[types.ADD_AMOUNT] (state) {
2223
state.amount ++
2324
},
24-
2525
[types.REMOVE_ALL_RECORDS] (state) {
2626
let records = state.records
2727
records.splice(0, records.length)
28+
state.amount = 0
29+
},
30+
[types.MODIFY_PLAIN_IN_DISPLAY] (state, text) {
31+
state.plainText = text
32+
},
33+
[types.MODIFY_JSON_IN_DISPLAY] (state, text) {
34+
state.jsonText = text
2835
}
2936
}
3037

app/src/renderer/store/mutation-types.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ export const ADD_ITEM = 'ADD_ITEM'
22
export const REMOVE_ALL_RECORDS = 'REMOVE_ALL_RECORDS'
33
export const ADD_RECORD = 'ADD_RECORD'
44
export const ADD_AMOUNT = 'ADD_AMOUNT'
5+
export const MODIFY_PLAIN_IN_DISPLAY = 'MODIFY_PLAIN_IN_DISPLAY'
6+
export const MODIFY_JSON_IN_DISPLAY = 'MODIFY_JSON_IN_DISPLAY'

webpack.renderer.config.js

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,10 @@ const HtmlWebpackPlugin = require('html-webpack-plugin')
1313
let rendererConfig = {
1414
devtool: '#eval-source-map',
1515
devServer: { overlay: true },
16-
entry:/*[
17-
'webpack-dev-server/client?http://0.0.0.0:9080',//资源服务器地址
18-
'webpack/hot/only-dev-server',
19-
path.join(__dirname, 'app/src/renderer/main.js'),
20-
'bootstrap/dist/css/bootstrap.min.css'
21-
], */{
16+
entry: {
2217
renderer: path.join(__dirname, 'app/src/renderer/main.js'),
23-
bootstrap: ['bootstrap/dist/css/bootstrap.min.css', 'bootstrap/dist/js/bootstrap.js'],
24-
jquery: 'jquery/dist/jquery.js'
18+
bootstrap: ['bootstrap/dist/css/bootstrap.min.css', 'bootstrap/dist/js/bootstrap.js']
19+
// jquery: 'jquery/dist/jquery.js'
2520
},
2621
externals: Object.keys(pkg.dependencies || {}),
2722
module: {
@@ -92,7 +87,6 @@ let rendererConfig = {
9287
filename: 'index.html',
9388
template: './app/index.ejs',
9489
headScripts: [
95-
'jquery.js',
9690
'bootstrap.js'
9791
],
9892
scripts: [
@@ -114,7 +108,6 @@ let rendererConfig = {
114108
output: {
115109
filename: '[name].js',
116110
libraryTarget: 'commonjs2',
117-
// publicPath: 'http://127.0.0.1:9080/app/dist/',
118111
path: path.join(__dirname, 'app/dist')
119112
},
120113
resolve: {

0 commit comments

Comments
 (0)
0