pengjun 4 months ago
parent
commit
9753942eca
  1. 2
      public/sysConfig.json
  2. 102
      src/views/fee-settings/cardRegister.vue

2
public/sysConfig.json

@ -1,5 +1,5 @@
{
"apiurl": "http://192.168.0.188:9530",
"apiurl": "http://192.168.0.188:9527",
"softName": "神豚体检管理系统",
"pacsApi": "http://192.168.0.188:9530",
"dcmViewers": "https://app.mzaktj.com:4436",

102
src/views/fee-settings/cardRegister.vue

@ -217,7 +217,7 @@
<el-button class="commonbutton" @click="refund">退费</el-button>
</div>
<div style="margin-top: 10px">
<a :underline="false" href="/files/单位体检人员名单导入模板.xlsx">
<a :underline="false" href="/files/会员卡导入模板.xls">
<el-button class="commonbutton" style="font-size: 12px">下载建卡模板</el-button>
</a>
</div>
@ -483,12 +483,41 @@
</div>
</span>
</el-dialog>
<!-- 通用进度条 -->
<el-dialog title="数据处理中……" :visible.sync="elProgress.display" width="700px" height="400" :show-close="false"
:close-on-click-modal="false" :append-to-body="true">
<ElProgressOCX />
</el-dialog>
<!--导入状态导出-->
<div v-show="false" id="tableExport">
<el-table :data="tableData" width="100%" row-key="cardNo" border>
<el-table-column type="index" label="序号" width="50" align="center" />
<el-table-column prop="importState" label="导入状态" align="center" />
<el-table-column prop="importDes" label="失败原因" align="center" />
<el-table-column prop="cardTypeName" label="卡类别" align="center" />
<el-table-column prop="cardNo" label="会员卡号" align="center" />
<el-table-column prop="discount" label="折扣率" align="center" />
<el-table-column prop="cardBalance" label="初始金额" align="center" />
<el-table-column prop="payModeName" label="充值方式" align="center" />
<el-table-column prop="expiryDate" label="有效期限" align="center" />
<el-table-column prop="customerName" label="卡主姓名" align="center" />
<el-table-column prop="idNo" label="卡主身份证号" align="center" />
<el-table-column prop="telephone" label="卡主电话" align="center" />
<el-table-column prop="mobileTelephone" label="卡主手机号" align="center" />
<el-table-column prop="remark" label="备注" align="center" />
</el-table>
</div>
</div>
</div>
</template>
<script>
import moment from "moment";
import { mapState, mapActions } from "vuex";
import FileSaver from "file-saver";
import { read, readFile, utils } from "xlsx";
import { getapi, postapi, putapi, deletapi } from "@/api/api";
import {
@ -641,11 +670,11 @@ export default {
dataCols: [
{ dispLabel: "不设置", val: "" },
{ dispLabel: "卡类别", val: "cardTypeId" },
{ dispLabel: "卡类别", val: "cardTypeName" },
{ dispLabel: "会员卡号", val: "cardNo" },
{ dispLabel: "折扣率", val: "discount" },
{ dispLabel: "初始金额", val: "cardBalance" },
{ dispLabel: "充值方式", val: "payMode" },
{ dispLabel: "充值方式", val: "payModeName" },
{ dispLabel: "有效期限", val: "expiryDate" },
{ dispLabel: "卡主姓名", val: "customerName" },
{ dispLabel: "卡主身份证号", val: "idNo" },
@ -655,6 +684,7 @@ export default {
//{ dispLabel: '', val: 'payTypeFlag' },
],
workBook: null, //EXCEL
sheetNames: [], //EXCEL {sheetName:}
readDataOpts: {
@ -663,10 +693,11 @@ export default {
titleRow: 1, //
},
readDataOptsInit: {},
dataImportOpts: {
dataImportOpts: {
startRow: 0, // excelData
},
dataImportOptsInit: {},
tableData: [], //
jsonFields: {
卡类别: "cardTypeId",
@ -761,6 +792,7 @@ export default {
"会员卡列表" + moment(new Date()).format("yyyyMMDDHHmmss") + ".xls";
return tableDatas;
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
@ -1118,9 +1150,9 @@ export default {
});
},
// --
btnImportCardOK() {
btnImportCardOK() {
this.elProgress.display = true;
this.elProgress.percentage = 0;
@ -1326,7 +1358,7 @@ export default {
e.id = "excelData" + index;
});
//console.log('this.excelCols',this.excelCols)
console.log('sheet_to_json excelData',this.excelData)
console.log('sheet_to_json excelData', this.excelData)
// Excel
this.parseExcelData();
@ -1464,7 +1496,7 @@ export default {
case "discount":
this.excelData.forEach((e) => {
tempVal = e[this.excelCols[oldColNum].dispLabel];
e[this.excelCols[oldColNum].dispLabel] = Number(tempVal)||100
e[this.excelCols[oldColNum].dispLabel] = Number(tempVal) || 100
});
break;
case "cardBalance":
@ -1480,41 +1512,44 @@ export default {
});
break;
}
},
// EXCELExcel
parseExcelData() {
let lfind = -1;
this.excelCols.forEach((e, i) => {
this.excelCols.forEach((e, i) => {
lfind = arrayExistObj(this.dataCols, "dispLabel", e.dispLabel);
console.log('e.dispLabel',e.dispLabel,lfind)
console.log('e.dispLabel', e.dispLabel, lfind)
if (lfind > -1) this.setColumn(i, this.dataCols[lfind]);
});
},
//
async importing(startRow) {
let body = {};
let medicalCenterId = window.sessionStorage.getItem('peisid')
for (let i = startRow; i < this.choosedData.length; i++) {
this.elProgress.percentage = Math.floor(
((i + 1) * 100) / this.choosedData.length
);
// Excel
body = this.excelDataToApiBody(this.choosedData[i]);
console.log(`this.choosedData[${i}],startRowNameType,body`,body);
body = this.excelDataToApiBody(this.choosedData[i]);
body.medicalCenterId = medicalCenterId
console.log(`this.choosedData[${i}],startRowNameType,body`, body);
try {
let res={code:0}
// let res = await postapi(
// "/api/app/patientregister/CreatePatientRegisterFromExcel",
// body
// );
let res = await postapi(
"/api/app/CardRegister/BatchCreateCardRegisterByExcel",
body
);
if (res.code >= 0) {
this.tableData.push(
Object.assign({ importState: "导入成功" }, body)
@ -1542,24 +1577,41 @@ export default {
this.seq = -1;
}
}
console.log('this.tableData',this.tableData)
//console.log('this.tableData',this.tableData)
this.exportImportState("tableExport", "批量建卡")
},
//Excel
excelDataToApiBody(ExcelData) {
let body = {
}
this.excelCols.forEach(e => {
if (e.val) {
body[e.val] = ExcelData[e.dispLabel]
body[e.val] = ExcelData[e.dispLabel]
}
})
return body
},
//
exportImportState(elId, title) {
// let table = this.$refs["tableExport"] //.cloneNode(true) true
let table = document.getElementById(elId)
// console.log('table,refsTable', table, refsTable)
this.$nextTick(() => {
let tableData = table.innerHTML
let fileName = title + moment(new Date()).format('yyyyMMDDHHmmss')
let blob = new Blob([tableData], { type: "text/plain;charset=utf-8" });
FileSaver.saveAs(blob, fileName + '.xls');
})
},
//
tableRowClassName({ row, rowIndex }) {
if (row.isActive == 'N') {

Loading…
Cancel
Save