pengjun 2 years ago
parent
commit
47b888a8f3
  1. 124
      src/components/patientRegister/PatientRegisterList.vue
  2. 22
      src/main.js
  3. 2
      src/store/index.js
  4. 4
      src/views/Home.vue

124
src/components/patientRegister/PatientRegisterList.vue

@ -4,8 +4,8 @@
@contextmenu.prevent="onContextmenu">
<el-table :data="patientRegister.prList" border
:height="window.pageHeight < 600 ? 172 : Math.floor((window.pageHeight - 342) * 2 / 3)" highlight-current-row
@row-click="rowick" size="small" @selection-change="handleSelectionChange" @cell-contextmenu="onCellRightClick"
ref="info" @select="shiftSelect" :row-class-name="handleRowClassName">
@row-click="rowClick" size="small" @selection-change="handleSelectionChange" @cell-contextmenu="onCellRightClick"
ref="info" :row-class-name="handleRowClassName" >
<el-table-column type="selection" width="40">
</el-table-column>
<el-table-column prop="completeFlag" label="体检进度">
@ -328,7 +328,6 @@ export default {
return {
startPoint: -1,// -1
endPoint: -1,// -1
pin: false,//
multipleSelection: [], //
@ -367,32 +366,12 @@ export default {
created() {
},
//
mounted() {
this.quickAsb = this.dict.asbItemAll;
// keydown,code
window.addEventListener('keydown', code => {
// shiftkey: "Shift"
if (code.key == "Shift" && code.shiftKey) {
this.pin = true;// shift
}
console.log('this.pin', this.pin)
});
// keyup,code
window.addEventListener('keyup', code => {
// shiftcode.shiftKeytrue
if (code.key == "Shift") {
this.pin = false;// shift
// this.startPoint = undefined;//
// this.endPoint = undefined;//
}
console.log('this.pin', this.pin)
});
this.quickAsb = this.dict.asbItemAll;
},
computed: {
...mapState(["window", "dict", "patientRegister", "customerOrg"]),
@ -400,6 +379,7 @@ export default {
methods: {
...mapActions(["getCustomerOrgGroup", "getPatientRegisterAbs"]),
handleRowClassName({ row, rowIndex }) {
// highLightBg 'selected'
console.log(rowIndex, row)
@ -504,60 +484,9 @@ export default {
});
}
this.multipleSelection = JSON.parse(JSON.stringify(rows));
},
// shift
shiftSelect(rows, row) {
console.log('rows, row', rows, row)
// selectDatasrows
if (this.multipleSelection.length > rows.length) {
//
row.highLightBg = '';
} else {
//
row.highLightBg = 'selected';
}
//
if (rows.length < this.multipleSelection.length) {
this.startPoint = undefined;//
this.endPoint = undefined;//
return;
}
// shift
// .
//
// index
// index
// index
if (this.pin) { // shift
if (this.startPoint || this.startPoint == 0) { //
this.endPoint = row.index;// index
if (this.startPoint > this.endPoint) { //
let temp = this.startPoint;
this.startPoint = this.endPoint;
this.endPoint = temp;
}
// handleSelectionChange
setTimeout(() => {
//
for (let i = this.startPoint + 1; i < this.endPoint; i++) {
this.$refs.info.toggleRowSelection(this.patientRegister.prList[i], true);
}
this.startPoint = undefined;//
this.endPoint = undefined;//
}, 100);
} else { //
this.startPoint = row.index;// index
}
} else { // shift
this.startPoint = undefined;//
this.endPoint = undefined;//
}
},
// /api/app/customer-org-group/in-customer-org-id/3a0c0444-d7a0-871f-4074-19faf1655caf
getCustomerOrgGroup(customerOrgld) {
getapi(`/api/app/customer-org-group/in-customer-org-id/${customerOrgld}`)
@ -570,7 +499,7 @@ export default {
},
//
rowick(row) {
rowClick(row) {
this.patientRegister.photo = ""; //
this.patientRegister.patientRegisterId = row.id;
@ -583,21 +512,20 @@ export default {
this.dict.asbItem = [...this.dict.asbItemAll]
this.getPatientRegisterAbs(row.id);
//
this.patientRegister.prList.forEach(e => {
e.choosed = false;
});
console.log('this.patientRegister.prList',this.window, this.patientRegister.prList)
// shift
if (this.window.shift) {
//
this.patientRegister.prList.forEach(e => {
e.choosed = false;
return e
});
if (!this.pin) { // shift
this.patientRegister.prList[row.index].choosed = true;
this.startPoint = row.index;
console.log('this.patientRegister.prList',this.pin,this.startPoint, this.patientRegister.prList)
return
} else {
if (this.startPoint == - 1) {
this.patientRegister.prList[row.index].choosed = true;
this.startPoint = row.index;
console.log('this.patientRegister.prList',this.pin, this.startPoint, this.patientRegister.prList)
return
}
@ -610,9 +538,25 @@ export default {
this.patientRegister.prList[i].choosed = true
}
}
return
}
console.log('this.patientRegister.prList',this.pin, this.startPoint, this.patientRegister.prList)
// ctrl
if (this.window.ctrl) {
this.patientRegister.prList[row.index].choosed = true;
this.startPoint = row.index;
return
}
// ctrl shift
//
console.log('清除所有选择')
this.patientRegister.prList.forEach(e => {
e.choosed = false;
return e
});
this.patientRegister.prList[row.index].choosed = true;
this.startPoint = row.index;
},
//

22
src/main.js

@ -105,3 +105,25 @@ function onResize() {
store.commit('setData', { key: 'window.pageWidth', value: window.innerWidth})
}
onResize();
// 监听keydown:获取键盘按住事件,code返回按住的键信息
window.addEventListener('keydown', code => {
if (code.key == "Shift" && code.shiftKey) {
store.commit('setData', { key: 'window.shift', value: true });// 标记按住了shift键
}
if (code.key == "Control" && code.ctrlKey) {
store.commit('setData', { key: 'window.ctrl', value: true });// 标记按住了ctrl键
}
});
// 监听keyup:获取键盘松开事件,code返回按住的键信息
window.addEventListener('keyup', code => {
console.log('keyup',code)
if (code.key == "Shift") {
store.commit('setData', { key: 'window.shift', value: false });// 标记松开了shift键
}
if (code.key == "Control") {
store.commit('setData', { key: 'window.ctrl', value: false });// 标记松开了ctrl键
}
});

2
src/store/index.js

@ -18,6 +18,8 @@ export default new Vuex.Store({
window: {
pageHeight: 960, //页面高度
pageWidth: 1920, //页面宽度
shift:false, //是否按下 shift键
ctrl:false, //是否按下 ctrl键
},
customerOrg: {
//体检单位设置

4
src/views/Home.vue

@ -836,6 +836,10 @@ export default {
},
//
toggleDevTools() {
if(!this.$peisAPI) {
this.$message.info("此功能,需要在壳客户端才可运行!")
return
}
this.$peisAPI.toggleDevTools();
},
},

Loading…
Cancel
Save