|
|
|
@ -1,16 +1,38 @@ |
|
|
|
<template> |
|
|
|
<div> |
|
|
|
<el-card> |
|
|
|
<el-card class="elcard" style="border-radius: 15px"> |
|
|
|
<div class="publiccss">会员卡类别</div> |
|
|
|
<div style="display: flex;margin-top:20px"> |
|
|
|
<div style="display: flex; margin-top: 20px"> |
|
|
|
<div :style="'width:' + (window.pageWidth - 120 - 80) + 'px;'"> |
|
|
|
<el-table :data="dataList" border width="100%" :height="window.pageHeight < 600 ? 410 : window.pageHeight - 190" |
|
|
|
row-key="id" size="small" highlight-current-row ref="dataList" @selection-change="handleSelectionChange" |
|
|
|
@row-click="rowClick"> |
|
|
|
<el-table-column prop="displayName" label="卡类别名称" width="120" /> |
|
|
|
<el-table |
|
|
|
:data="dataList" |
|
|
|
border |
|
|
|
width="100%" |
|
|
|
:height="window.pageHeight < 600 ? 410 : window.pageHeight - 190" |
|
|
|
row-key="id" |
|
|
|
size="small" |
|
|
|
highlight-current-row |
|
|
|
ref="dataList" |
|
|
|
@selection-change="handleSelectionChange" |
|
|
|
@row-click="rowClick" |
|
|
|
> |
|
|
|
<el-table-column |
|
|
|
prop="displayName" |
|
|
|
label="卡类别名称" |
|
|
|
width="120" |
|
|
|
/> |
|
|
|
<el-table-column prop="cardModeId" label="卡模式" width="80"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<div>{{ dddw(dict.cardMode, "id", scope.row.cardModeId, "displayName") }}</div> |
|
|
|
<div> |
|
|
|
{{ |
|
|
|
dddw( |
|
|
|
dict.cardMode, |
|
|
|
"id", |
|
|
|
scope.row.cardModeId, |
|
|
|
"displayName" |
|
|
|
) |
|
|
|
}} |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="discount" label="折扣率" width="90" /> |
|
|
|
@ -24,31 +46,58 @@ |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="lastModifierName" label="修改人员" width="100" /> |
|
|
|
<el-table-column prop="lastModificationTime" label="修改日期" width="150"> |
|
|
|
<el-table-column |
|
|
|
prop="lastModifierName" |
|
|
|
label="修改人员" |
|
|
|
width="100" |
|
|
|
/> |
|
|
|
<el-table-column |
|
|
|
prop="lastModificationTime" |
|
|
|
label="修改日期" |
|
|
|
width="150" |
|
|
|
> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<div v-if="scope.row.lastModificationTime"> |
|
|
|
{{ moment(scope.row.lastModificationTime).format("yyyy-MM-DD") }} |
|
|
|
{{ |
|
|
|
moment(scope.row.lastModificationTime).format("yyyy-MM-DD") |
|
|
|
}} |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
</div> |
|
|
|
<div style="margin-left: 10px;width:110px;"> |
|
|
|
<div style="margin-left: 10px; width: 110px"> |
|
|
|
<div class="listBtn"> |
|
|
|
<el-button type="success" class="btnClass" @click="add">新增</el-button> |
|
|
|
<el-button type="success" class="btnClass" @click="add" |
|
|
|
>新增</el-button |
|
|
|
> |
|
|
|
</div> |
|
|
|
<div class="listBtn"> |
|
|
|
<el-button type="primary" class="btnClass" @click="edit">编辑</el-button> |
|
|
|
<el-button type="primary" class="btnClass" @click="edit" |
|
|
|
>编辑</el-button |
|
|
|
> |
|
|
|
</div> |
|
|
|
<div class="listBtn"> |
|
|
|
<el-button type="danger" class="btnClass" @click="del">删除</el-button> |
|
|
|
<el-button type="danger" class="btnClass" @click="del" |
|
|
|
>删除</el-button |
|
|
|
> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</el-card> |
|
|
|
<el-dialog :title="form.id ? '编辑' : '新增'" :visible.sync="dialogVisible" width="800px" :close-on-click-modal="false"> |
|
|
|
<el-form ref="form" :model="form" label-width="100px" :rules="rules" size="small"> |
|
|
|
<el-dialog |
|
|
|
:title="form.id ? '编辑' : '新增'" |
|
|
|
:visible.sync="dialogVisible" |
|
|
|
width="800px" |
|
|
|
:close-on-click-modal="false" |
|
|
|
> |
|
|
|
<el-form |
|
|
|
ref="form" |
|
|
|
:model="form" |
|
|
|
label-width="100px" |
|
|
|
:rules="rules" |
|
|
|
size="small" |
|
|
|
> |
|
|
|
<el-row> |
|
|
|
<el-col :span="8"> |
|
|
|
<el-form-item label="卡类别名称" prop="displayName"> |
|
|
|
@ -57,8 +106,17 @@ |
|
|
|
</el-col> |
|
|
|
<el-col :span="8"> |
|
|
|
<el-form-item label="卡模式" prop="cardModeId"> |
|
|
|
<el-select v-model="form.cardModeId" placeholder="请选择" filterable > |
|
|
|
<el-option v-for="item in dict.cardMode" :key="item.id" :label="item.displayName" :value="item.id" /> |
|
|
|
<el-select |
|
|
|
v-model="form.cardModeId" |
|
|
|
placeholder="请选择" |
|
|
|
filterable |
|
|
|
> |
|
|
|
<el-option |
|
|
|
v-for="item in dict.cardMode" |
|
|
|
:key="item.id" |
|
|
|
:label="item.displayName" |
|
|
|
:value="item.id" |
|
|
|
/> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
@ -73,7 +131,7 @@ |
|
|
|
<el-form-item label="有效期(天)" prop="expiryDay"> |
|
|
|
<el-input type="number" v-model="form.expiryDay" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-col> |
|
|
|
<el-col :span="16"> |
|
|
|
<el-form-item label="备注"> |
|
|
|
<el-input v-model="form.remark" /> |
|
|
|
@ -88,7 +146,14 @@ |
|
|
|
</el-col> |
|
|
|
<el-col :span="6"> |
|
|
|
<el-form-item label="创建时间" label-width="80px"> |
|
|
|
<el-input :value="form.creationTime ? moment(form.creationTime).format('yyyy-MM-DD') : ''" disabled></el-input> |
|
|
|
<el-input |
|
|
|
:value=" |
|
|
|
form.creationTime |
|
|
|
? moment(form.creationTime).format('yyyy-MM-DD') |
|
|
|
: '' |
|
|
|
" |
|
|
|
disabled |
|
|
|
></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="6"> |
|
|
|
@ -98,8 +163,14 @@ |
|
|
|
</el-col> |
|
|
|
<el-col :span="6"> |
|
|
|
<el-form-item label="修改时间" label-width="80px"> |
|
|
|
<el-input :value="form.lastModificationTime |
|
|
|
? moment(form.lastModificationTime).format('yyyy-MM-DD') : '' " disabled></el-input> |
|
|
|
<el-input |
|
|
|
:value=" |
|
|
|
form.lastModificationTime |
|
|
|
? moment(form.lastModificationTime).format('yyyy-MM-DD') |
|
|
|
: '' |
|
|
|
" |
|
|
|
disabled |
|
|
|
></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
@ -115,7 +186,13 @@ |
|
|
|
import moment from "moment"; |
|
|
|
import { mapState, mapActions } from "vuex"; |
|
|
|
import { getapi, postapi, putapi, deletapi } from "@/api/api"; |
|
|
|
import { dddw, objCopy, arrayReduce, arrayExistObj,deepCopy } from "@/utlis/proFunc"; |
|
|
|
import { |
|
|
|
dddw, |
|
|
|
objCopy, |
|
|
|
arrayReduce, |
|
|
|
arrayExistObj, |
|
|
|
deepCopy, |
|
|
|
} from "@/utlis/proFunc"; |
|
|
|
|
|
|
|
import PatientRegisterEdit from "../../components/patientRegister/PatientRegisterEdit.vue"; |
|
|
|
import Camera from "../../components/patientRegister/Camera.vue"; |
|
|
|
@ -133,13 +210,13 @@ export default { |
|
|
|
form: { |
|
|
|
id: null, |
|
|
|
displayName: null, |
|
|
|
cardModeId: '0', |
|
|
|
cardModeId: "0", |
|
|
|
discount: 100, |
|
|
|
expiryDay: 3650, |
|
|
|
displayOrder: 0, |
|
|
|
remark: '', |
|
|
|
remark: "", |
|
|
|
}, |
|
|
|
formInit:{}, |
|
|
|
formInit: {}, |
|
|
|
rules: { |
|
|
|
displayName: [ |
|
|
|
{ required: true, message: "请填写卡类别名称", trigger: "blur" }, |
|
|
|
@ -155,12 +232,11 @@ export default { |
|
|
|
], |
|
|
|
displayOrder: [ |
|
|
|
{ required: true, message: "请填写显示顺序", trigger: "blur" }, |
|
|
|
] |
|
|
|
], |
|
|
|
}, |
|
|
|
|
|
|
|
curChoosedRow: {}, //当前选择的行数据 |
|
|
|
curChoosedId:'', //当前选中的ID |
|
|
|
|
|
|
|
curChoosedId: "", //当前选中的ID |
|
|
|
}; |
|
|
|
}, |
|
|
|
|
|
|
|
@ -177,7 +253,8 @@ export default { |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
...mapActions(["getCustomerOrgGroup", "getPatientRegisterAbs"]), |
|
|
|
dddw, moment, |
|
|
|
dddw, |
|
|
|
moment, |
|
|
|
|
|
|
|
handleSelectionChange(val) { |
|
|
|
this.multipleSelection = val; |
|
|
|
@ -189,8 +266,7 @@ export default { |
|
|
|
}, |
|
|
|
|
|
|
|
async add() { |
|
|
|
|
|
|
|
objCopy(this.formInit,this.form); |
|
|
|
objCopy(this.formInit, this.form); |
|
|
|
this.dialogVisible = true; |
|
|
|
}, |
|
|
|
|
|
|
|
@ -214,25 +290,26 @@ export default { |
|
|
|
confirmButtonText: "是", |
|
|
|
cancelButtonText: "否", |
|
|
|
type: "warning", |
|
|
|
}).then(() => { |
|
|
|
//console.log('{patientRegisterIds}',{patientRegisterIds}) |
|
|
|
return postapi(`/api/app/cardtype/delete?id=${this.curChoosedId}`); |
|
|
|
}).then(res =>{ |
|
|
|
if(res.code != -1){ |
|
|
|
this.$message.success("操作成功!"); |
|
|
|
}) |
|
|
|
.then(() => { |
|
|
|
//console.log('{patientRegisterIds}',{patientRegisterIds}) |
|
|
|
return postapi(`/api/app/cardtype/delete?id=${this.curChoosedId}`); |
|
|
|
}) |
|
|
|
.then((res) => { |
|
|
|
if (res.code != -1) { |
|
|
|
this.$message.success("操作成功!"); |
|
|
|
|
|
|
|
lfind = arrayExistObj(this.dataList, 'id', this.curChoosedId); |
|
|
|
if (lfind > - 1) this.dataList.splice(lfind, 1); |
|
|
|
this.curChoosedId = null; |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
lfind = arrayExistObj(this.dataList, "id", this.curChoosedId); |
|
|
|
if (lfind > -1) this.dataList.splice(lfind, 1); |
|
|
|
this.curChoosedId = null; |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
//提交 |
|
|
|
onSubmit(formName) { |
|
|
|
let body={},lfind=-1; |
|
|
|
let body = {}, |
|
|
|
lfind = -1; |
|
|
|
this.$refs[formName].validate((valid, fields) => { |
|
|
|
if (!valid) { |
|
|
|
//console.log('fields',fields,Object.keys(fields)); |
|
|
|
@ -240,25 +317,27 @@ export default { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
body = deepCopy(this.form) |
|
|
|
body = deepCopy(this.form); |
|
|
|
delete body.id; |
|
|
|
delete body.displayOrder; |
|
|
|
|
|
|
|
//编辑 |
|
|
|
if (this.form.id) { |
|
|
|
postapi(`/api/app/cardtype/update?id=${this.form.id}`,body).then(res =>{ |
|
|
|
if(res.code != -1){ |
|
|
|
this.$message.success("操作成功!"); |
|
|
|
lfind = arrayExistObj(this.dataList,'id',this.form.id); |
|
|
|
if(lfind > -1) objCopy(this.form,this.dataList[lfind]); |
|
|
|
postapi(`/api/app/cardtype/update?id=${this.form.id}`, body).then( |
|
|
|
(res) => { |
|
|
|
if (res.code != -1) { |
|
|
|
this.$message.success("操作成功!"); |
|
|
|
lfind = arrayExistObj(this.dataList, "id", this.form.id); |
|
|
|
if (lfind > -1) objCopy(this.form, this.dataList[lfind]); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
); |
|
|
|
} else { |
|
|
|
//新增 |
|
|
|
postapi('/api/app/cardtype/create',body).then(res =>{ |
|
|
|
if(res.code != -1){ |
|
|
|
postapi("/api/app/cardtype/create", body).then((res) => { |
|
|
|
if (res.code != -1) { |
|
|
|
this.$message.success("操作成功!"); |
|
|
|
objCopy(res.data,this.form); |
|
|
|
objCopy(res.data, this.form); |
|
|
|
this.dataList.push(deepCopy(this.form)); |
|
|
|
} |
|
|
|
}); |
|
|
|
@ -267,14 +346,13 @@ export default { |
|
|
|
}, |
|
|
|
|
|
|
|
//查询 |
|
|
|
query() { |
|
|
|
console.log('/api/app/cardtype/getcardtypelist') |
|
|
|
getapi('/api/app/cardtype/getcardtypelist') |
|
|
|
.then((res) => { |
|
|
|
if(res.code != -1){ |
|
|
|
this.dataList = res.data; |
|
|
|
} |
|
|
|
}); |
|
|
|
query() { |
|
|
|
console.log("/api/app/cardtype/getcardtypelist"); |
|
|
|
getapi("/api/app/cardtype/getcardtypelist").then((res) => { |
|
|
|
if (res.code != -1) { |
|
|
|
this.dataList = res.data; |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
@ -287,11 +365,15 @@ export default { |
|
|
|
this.query(); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
}; |
|
|
|
</script> |
|
|
|
<style scoped> |
|
|
|
::v-deep .el-table__header th { |
|
|
|
/* font-size: px; */ |
|
|
|
background-color: rgb(245, 245, 245); /* 设置表头背景颜色 */ |
|
|
|
color: rgb(113, 113, 113); /* 设置表头文字颜色 */ |
|
|
|
} |
|
|
|
.box { |
|
|
|
display: flex; |
|
|
|
} |
|
|
|
|