123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980 |
- <template>
- <div class="main-contain">
- <div class="position">
- <bread-crumb :crumbs='crumbs'></bread-crumb>
- </div>
- <div class="tab-container">
- <el-tabs >
- <el-tab-pane label="医嘱模板">
- <div >
- <div class="filter-container">
- <el-button
- class="filter-item"
- style="margin-left: 10px;"
- @click="handleCreateTemplate"
- type="primary"
- size="small"
- icon="el-icon-circle-plus-outline"
- >{{$t('table.add')}}</el-button>
- </div>
-
- <el-table
- :data="adviceTemplates"
- v-loading="listLoading"
- border
- fit
- :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}"
- highlight-current-row
- style="width: 100%;min-height:500px;"
- >
- <el-table-column align="center" label="医嘱名称">
- <template slot-scope="scope">
- <span>{{scope.row.advice_name}}</span>
- </template>
- </el-table-column>
- <!-- <el-table-column align="center" label="医嘱内容">
- <template slot-scope="scope">
- <span>{{scope.row.advice_desc}}</span>
- </template>
- </el-table-column> -->
- <el-table-column align="center" label="单次用量">
- <template slot-scope="scope">
- <span>{{scope.row.single_dose}} {{scope.row.single_dose_unit}}</span>
- </template>
- </el-table-column>
- <el-table-column align="center" label="开药数量">
- <template slot-scope="scope">
- <span>{{scope.row.prescribing_number}} {{scope.row.prescribing_number_unit}}</span>
- </template>
- </el-table-column>
- <el-table-column align="center" label="给药途径">
- <template slot-scope="scope">
- <span>{{scope.row.delivery_way}}</span>
- </template>
- </el-table-column>
- <el-table-column align="center" label="执行频率">
- <template slot-scope="scope">
- <span>{{scope.row.execution_frequency}}</span>
- </template>
- </el-table-column>
- <el-table-column
- align="center"
- :label="$t('table.actions')"
- width="230"
- class-name="small-padding fixed-width"
- >
- <template slot-scope="scope">
- <el-button
- type="primary"
- size="small"
- icon="el-icon-edit-outline"
- @click="handleUpdateAdviceTemplate(scope.row, scope.$index)"
- ></el-button>
- <el-button
- v-if="scope.row.status!='deleted'"
- size="small"
- type="danger"
- icon="el-icon-delete"
- @click="handleDeleteAdviceTemplate(scope.row, scope.$index)"
- ></el-button>
- </template>
- </el-table-column>
- </el-table>
-
- <el-dialog :title="dialogTitle" :visible.sync="templateFormVisible" width="700px">
- <el-form
- ref="templateForm"
- :rules="templateRules"
- :model="templateForm"
- label-width="90px"
- >
- <el-row>
- <el-col :span="12">
- <el-form-item label="医嘱名称 :" required prop="advice_name">
- <el-input v-model="templateForm.advice_name" style="width:50%"></el-input>
- </el-form-item>
- </el-col>
- <!-- <el-form-item label="医嘱内容 :" prop="advice_desc">
- <el-input v-model="templateForm.advice_desc" style="width:50%"></el-input>
- </el-form-item> -->
- <el-col :span="12">
- <el-form-item label="单次用量 :" prop="single_dose">
- <el-col :span="8">
- <el-input v-model="templateForm.single_dose"></el-input>
- </el-col>
- <el-col class="line" :span="2"> </el-col>
- <el-col :span="14">
- <el-select
- v-model="templateForm.single_dose_unit"
- filterable
- clearable
- allow-create
- placeholder="选择"
- >
- <el-option
- v-for="item in unitsOption"
- :key="item.id"
- :label="item.name "
- :value="item.name"
- ></el-option>
- </el-select>
- </el-col>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="12">
- <el-form-item label="开药数量 :" prop="prescribing_number">
- <el-col :span="8">
- <el-input v-model="templateForm.prescribing_number"></el-input>
- </el-col>
- <el-col class="line" :span="2"> </el-col>
- <el-col :span="14">
- <el-select
- v-model="templateForm.prescribing_number_unit"
- filterable
- clearable
- allow-create
- placeholder="选择"
- >
- <el-option
- v-for="item in unitsOption"
- :key="item.id"
- :label="item.name "
- :value="item.name"
- ></el-option>
- </el-select>
- </el-col>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="给药途径 :" prop="delivery_way">
- <el-select
- v-model="templateForm.delivery_way"
- filterable
- clearable
- allow-create
- placeholder="请选择(输入可搜索)"
- style="width:100%"
- >
- <el-option
- v-for="item in drugways"
- :key="item.id"
- :label="item.name "
- :value="item.name"
- ></el-option>
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="12">
- <el-form-item label="执行频率 :" prop="execution_frequency">
- <el-select
- v-model="templateForm.execution_frequency"
- clearable
- allow-create
- filterable
- placeholder="请选择(输入可搜索)"
- style="width:100%"
- >
- <el-option
- v-for="item in executionFrequencyOptions"
- :key="item.id"
- :label="item.name"
- :value="item.name"
- ></el-option>
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click="templateFormVisible = false">取消</el-button>
- <el-button type="primary" @click="submitTemplate('templateForm')">保 存</el-button>
- </div>
- </el-dialog>
-
- <el-dialog :title="dialogTitle" :visible.sync="drugdicFormVisible" width="700px">
- <el-form
- ref="drugdicForm"
- :rules="drugdicRules"
- :model="drugdicForm"
- label-width="90px"
- >
- <el-form-item label="医嘱名称 :" required prop="name">
- <el-input v-model="drugdicForm.name" style="width:50%" placeholder="如:阿莫西林"></el-input>
- </el-form-item>
- <el-form-item label="医嘱内容 :" prop="spec">
- <el-input v-model="drugdicForm.spec" style="width:50%" placeholder="如:10克x9袋"></el-input>
- </el-form-item>
- <el-form-item label="医嘱类型 :" prop="form">
- <el-select
- v-model="drugdicForm.form"
- clearable
- allow-create
- filterable
- placeholder="请选择(输入可搜索)"
- >
- <el-option
- :label="item.name"
- :key="item.label"
- :value="item.name"
- v-for="item in drugforms"
- ></el-option>
- </el-select>
- </el-form-item>
- <el-row>
- <el-col :span="12">
- <el-form-item label="单次单位 :" prop="spec_unit">
- <el-select
- v-model="drugdicForm.spec_unit"
- clearable
- allow-create
- filterable
- placeholder="选择(输入可搜索)"
- >
- <el-option
- v-for="item in unitsOption"
- :key="item.label"
- :label="item.name "
- :value="item.name"
- ></el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="开药单位 :" prop="form_unit">
- <el-select
- v-model="drugdicForm.form_unit"
- clearable
- allow-create
- filterable
- placeholder="选择(输入可搜索)"
- >
- <el-option
- v-for="item in unitsOption"
- :key="item.label"
- :label="item.name "
- :value="item.name"
- ></el-option>
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click="drugdicFormVisible = false">取消</el-button>
- <el-button type="primary" @click="submitDrugDic('drugdicForm')">保 存</el-button>
- </div>
- </el-dialog>
- </div>
- </el-tab-pane>
- <el-tab-pane label="给药途径">
- <div class="app-container">
- <div class="filter-container">
- <el-button
- class="filter-item"
- style="margin-left: 10px;"
- @click="handleCreateDrugWay"
- type="primary"
- size="small"
- icon="el-icon-circle-plus-outline"
- >{{$t('table.add')}}</el-button>
- </div>
-
- <el-table
- :data="drugways"
- v-loading="listLoading"
- border
- fit
- highlight-current-row
- style="width: 100%;min-height:500px;"
- >
- <el-table-column align="center" label="名称">
- <template slot-scope="scope">
- <span>{{scope.row.name}}</span>
- </template>
- </el-table-column>
- <el-table-column
- align="center"
- :label="$t('table.actions')"
- width="230"
- class-name="small-padding fixed-width"
- >
- <template slot-scope="scope">
- <el-button type="text" size="mini" v-show="scope.row.org_id==0" disabled>系统设定</el-button>
- <el-button
- v-show="scope.row.org_id!=0"
- type="primary"
- size="small"
- icon="el-icon-edit-outline"
- @click="handleUpdateDrugWay(scope.row, scope.$index)"
- ></el-button>
- <el-button
- v-show="scope.row.org_id!=0"
- size="small"
- type="danger"
- icon="el-icon-delete"
- @click="handleDeleteDrugWay(scope.row, scope.$index)"
- ></el-button>
- </template>
- </el-table-column>
- </el-table>
- <el-dialog :title="dialogTitle" :visible.sync="drugwayFormVisible" width="700px">
- <el-form
- ref="drugwayForm"
- :rules="drugwayRules"
- :model="drugwayForm"
- label-width="90px"
- >
- <el-form-item label="给药途径 :" required prop="name">
- <el-input v-model="drugwayForm.name" placeholder="给药途径"></el-input>
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click="drugwayFormVisible = false">取消</el-button>
- <el-button type="primary" @click="submitDrugWay('drugwayForm')">保 存</el-button>
- </div>
- </el-dialog>
- </div>
- </el-tab-pane>
- <el-tab-pane label="执行频率">
- <div class="">
- <div class="filter-container">
- <el-button
- class="filter-item"
- style="margin-left: 10px;"
- @click="handleCreateEF"
- type="primary"
- size="small"
- icon="el-icon-circle-plus-outline"
- >{{$t('table.add')}}</el-button>
- </div>
-
- <el-table
- :data="executionFrequencyOptions"
- v-loading="listLoading"
- border
- fit
- highlight-current-row
- style="width: 100%;min-height:500px;"
- :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}"
- >
- <el-table-column align="center" label="名称">
- <template slot-scope="scope">
- <span>{{scope.row.name}}</span>
- </template>
- </el-table-column>
- <el-table-column
- align="center"
- :label="$t('table.actions')"
- width="230"
- class-name="small-padding fixed-width"
- >
- <template slot-scope="scope">
- <el-button type="text" size="mini" v-show="scope.row.org_id==0" disabled>系统设定</el-button>
- <el-button
- v-show="scope.row.org_id!=0"
- type="primary"
- size="small"
- icon="el-icon-edit-outline"
- @click="handleUpdateEF(scope.row, scope.$index)"
- ></el-button>
- <el-button
- v-show="scope.row.org_id!=0"
- size="small"
- type="danger"
- icon="el-icon-delete"
- @click="handleDeleteEF(scope.row, scope.$index)"
- ></el-button>
- </template>
- </el-table-column>
- </el-table>
- <el-dialog :title="dialogTitle" :visible.sync="efFormVisible" width="700px">
- <el-form ref="efForm" :rules="efRules" :model="efForm" label-width="90px">
- <el-form-item label="执行频率 :" required prop="name">
- <el-input v-model="efForm.name" placeholder="执行频率"></el-input>
- <el-input v-model="efForm.code" placeholder="编码"></el-input>
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click="efFormVisible = false">取 消</el-button>
- <el-button type="primary" @click="submitEF('efForm')">保 存</el-button>
- </div>
- </el-dialog>
- </div>
- </el-tab-pane>
- </el-tabs>
- </div>
- </template>
-
- <script>
- import {
- getAdviceConfig,
- CreateDrugDic,
- UpdateDrugDic,
- DeleteDrugDic,
- CreateDrugWay,
- UpdateDrugWay,
- DeleteDrugWay,
- CreateExecutionFrequency,
- UpdateExecutionFrequency,
- DeleteExecutionFrequency,
- CreateAdviceTemplate,
- UpdateAdviceTemplate,
- DeleteAdviceTemplate
- } from "@/api/advice";
- import BreadCrumb from "@/xt_pages/components/bread-crumb";
-
- export default {
- name: "tab",
- components: {BreadCrumb},
- data() {
- return {
- crumbs: [
- { path: false, name: '数据字典' },
- { path: '/patients/patients', name: '字段配置' },
- ],
- currentIndex: -1,
- isEdit: false,
- dialogTitle: "",
- drugdicFormVisible: false,
- drugwayFormVisible: false,
- templateFormVisible: false,
- efFormVisible: false,
- listLoading: true,
- activeName: "drugdic",
- createdTimes: 0,
- drugdics: [],
- adviceTemplates:[],
- drugways: [],
-
- executionFrequencyOptions: [],
- drugdicRules: {
- name: [{ required: true, message: "请填写医嘱名称" }]
- },
- drugwayRules: {
- name: [{ required: true, message: "请填写给药途径" }]
- },
- efRules: {
- name: [{ required: true, message: "请填写执行频率" }]
- },
- templateRules: {
- advice_name: [{ required: true, message: "请填写医嘱名称" }]
- },
- templateForm: {
- advice_name: "",
- advice_desc: "",
- single_dose: "",
- single_dose_unit: "",
- prescribing_number: "",
- prescribing_number_unit: "",
- delivery_way: "",
- execution_frequency: "",
- id: 0
- },
- drugdicForm: {
- name: "",
- spec: "",
- spec_unit: "",
- form: "",
- form_unit: "",
- id: 0
- },
- drugwayForm: {
- name: "",
- id: 0,
- code:"",
- },
- efForm: {
- name: "",
- id: 0,
- code:"",
- },
- unitsOption: [
- { lable: 1, name: "盒" },
- { lable: 2, name: "支" },
- { lable: 3, name: "瓶" },
- { lable: 4, name: "片" },
- { lable: 5, name: "袋" },
- { lable: 6, name: "g" },
- { lable: 7, name: "mg" },
- { lable: 8, name: "u" },
- { lable: 9, name: "ml" },
- { lable: 10, name: "枚" },
- { lable: 11, name: "粒" },
- { lable: 12, name: "μg" },
- { lable: 13, name: "iu" },
- { lable: 14, name: "包" },
- { lable: 15, name: "丸" }
- ],
- drugforms: [
- { lable: 1, name: "胶囊" },
- { lable: 2, name: "注射剂" },
- { lable: 3, name: "片剂" },
- { lable: 4, name: "注射液" },
- { lable: 5, name: "栓剂" },
- { lable: 6, name: "膏" },
- { lable: 7, name: "颗粒剂" },
- { lable: 8, name: "粉剂" },
- { lable: 9, name: "口服液" },
- { lable: 10, name: "干混悬剂" },
- { lable: 11, name: "丸剂" },
- { lable: 12, name: "气雾剂" },
- { lable: 13, name: "内服溶液" },
- { lable: 14, name: "外用溶液" },
- { lable: 15, name: "软膏剂" },
- { lable: 16, name: "胶剂" }
- ]
- };
- },
- created() {
- this.getAdviceConfig();
- },
- methods: {
- showCreatedTimes() {
- this.createdTimes = this.createdTimes + 1;
- },
- handleUpdateDrugDic(row, index) {
- this.currentIndex = index;
- this.drugdicForm = {
- name: row.name,
- spec: row.spec,
- spec_unit: row.spec_unit,
- form: row.form,
- form_unit: row.form_unit,
- id: row.id
- };
-
- this.drugdicFormVisible = true;
- this.dialogTitle = "编辑医嘱模版";
- this.isEdit = true;
- },
- handleCreateDrugDic() {
- this.drugdicForm = {
- name: "",
- spec: "",
- spec_unit: "",
- form: "",
- form_unit: "",
- id: 0
- };
- this.drugdicFormVisible = true;
- this.dialogTitle = "新增医嘱模版";
- this.isEdit = false;
- },
- handleCreateTemplate() {
- this.templateForm = {
- advice_name: "",
- advice_desc: "",
- single_dose: "",
- single_dose_unit: "",
- prescribing_number: "",
- prescribing_number_unit: "",
- delivery_way: "",
- execution_frequency: "",
- id: 0
- };
- this.templateFormVisible = true;
- this.dialogTitle = "新增医嘱模版";
- this.isEdit = false;
- },
- handleUpdateAdviceTemplate(row, index){
- this.templateForm = {
- advice_name: row.advice_name,
- advice_desc: row.advice_desc,
- single_dose: row.single_dose,
- single_dose_unit: row.single_dose_unit,
- prescribing_number: row.prescribing_number,
- prescribing_number_unit: row.prescribing_number_unit,
- delivery_way: row.delivery_way,
- execution_frequency: row.execution_frequency,
- id: row.id,
- };
- this.templateFormVisible = true;
- this.dialogTitle = "编辑医嘱模版";
- this.isEdit = true;
- this.currentIndex = index;
- },
- resetForm(formName) {
- this.$refs[formName].resetFields();
- },
- handleDeleteDrugDic(row, index) {
- this.$confirm("确认删除此医嘱模板?", "删除", {
- confirmButtonText: "确 定",
- cancelButtonText: "取 消",
- type: "warning"
- })
- .then(() => {
- DeleteDrugDic(row.id).then(response => {
- if (response.data.state == 0) {
- this.$message.error(response.data.msg);
- return false;
- } else {
- this.$notify({
- title: "成功",
- message: "医嘱模板已经删除",
- type: "success",
- duration: 2000
- });
- this.drugdics.splice(index, 1);
- }
- });
- })
- .catch(() => {});
- },
- handleDeleteAdviceTemplate(row, index) {
- this.$confirm("确认删除此医嘱模板?", "删除", {
- confirmButtonText: "确 定",
- cancelButtonText: "取 消",
- type: "warning"
- })
- .then(() => {
- DeleteAdviceTemplate(row.id).then(response => {
- if (response.data.state == 0) {
- this.$message.error(response.data.msg);
- return false;
- } else {
- this.$notify({
- title: "成功",
- message: "医嘱模板已经删除",
- type: "success",
- duration: 2000
- });
- this.adviceTemplates.splice(index, 1);
- }
- });
- })
- .catch(() => {});
- },
- submitDrugDic(formName) {
- this.$refs[formName].validate(valid => {
- if (valid) {
- if (this.isEdit) {
- UpdateDrugDic(this.drugdicForm.id, this.drugdicForm).then(
- response => {
- if (response.data.state == 0) {
- this.$message.error(response.data.msg);
- return false;
- } else {
- this.$notify({
- title: "成功",
- message: "修改成功",
- type: "success",
- duration: 2000
- });
- this.drugdicFormVisible = false;
- this.resetForm(formName);
- var drugdic = response.data.data.drugdic;
- this.drugdics[this.currentIndex].name = drugdic.name;
- this.drugdics[this.currentIndex].spec = drugdic.spec;
- this.drugdics[this.currentIndex].spec_unit =
- drugdic.spec_unit;
- this.drugdics[this.currentIndex].form = drugdic.form;
- this.drugdics[this.currentIndex].form_unit =
- drugdic.form_unit;
- this.drugdics[this.currentIndex].updated_time =
- drugdic.updated_time;
- this.currentIndex = -1;
- return false;
- }
- }
- );
- } else {
- CreateDrugDic(this.drugdicForm).then(response => {
- if (response.data.state == 0) {
- this.$message.error(response.data.msg);
- return false;
- } else {
- this.$notify({
- title: "成功",
- message: "添加成功",
- type: "success",
- duration: 2000
- });
- this.drugdicFormVisible = false;
- this.resetForm(formName);
- this.drugdics.unshift(response.data.data.drugdic);
- return false;
- }
- });
- }
- }
- });
- },
- submitTemplate(formName){
- this.$refs[formName].validate(valid => {
- this.templateForm.single_dose = parseFloat(this.templateForm.single_dose);
- this.templateForm.prescribing_number = parseFloat(this.templateForm.prescribing_number);
-
- if(isNaN(this.templateForm.single_dose)) {
- this.templateForm.single_dose = 0;
- }
- if(isNaN(this.templateForm.prescribing_number)) {
- this.templateForm.prescribing_number = 0;
- }
- if (valid) {
- if (this.isEdit) {
- UpdateAdviceTemplate(this.templateForm.id, this.templateForm).then(
- response => {
- if (response.data.state == 0) {
- this.$message.error(response.data.msg);
- return false;
- } else {
- this.$notify({
- title: "成功",
- message: "修改成功",
- type: "success",
- duration: 2000
- });
- this.templateFormVisible = false;
- this.resetForm(formName);
- var template = response.data.data.template;
- this.adviceTemplates[this.currentIndex].advice_name = template.advice_name;
- this.adviceTemplates[this.currentIndex].advice_desc = template.advice_desc;
- this.adviceTemplates[this.currentIndex].single_dose = template.single_dose;
- this.adviceTemplates[this.currentIndex].single_dose_unit = template.single_dose_unit;
- this.adviceTemplates[this.currentIndex].delivery_way = template.delivery_way;
- this.adviceTemplates[this.currentIndex].execution_frequency = template.execution_frequency;
- this.adviceTemplates[this.currentIndex].prescribing_number = template.prescribing_number;
- this.adviceTemplates[this.currentIndex].prescribing_number_unit = template.prescribing_number_unit;
- this.currentIndex = -1;
- return false;
- }
- }
- );
- } else {
- CreateAdviceTemplate(this.templateForm).then(response => {
- if (response.data.state == 0) {
- this.$message.error(response.data.msg);
- return false;
- } else {
- this.$notify({
- title: "成功",
- message: "添加成功",
- type: "success",
- duration: 2000
- });
- this.templateFormVisible = false;
- this.resetForm(formName);
- this.adviceTemplates.unshift(response.data.data.template);
- return false;
- }
- });
- }
- }
- });
- },
- handleCreateDrugWay() {
- this.drugwayForm = {
- name: "",
- id: 0,
- code:"",
- };
- this.drugwayFormVisible = true;
- this.dialogTitle = "新增给药途径";
- this.isEdit = false;
- },
- handleUpdateDrugWay(row, index) {
- console.log(row)
- this.currentIndex = index;
- this.drugwayForm = {
- name: row.name,
- id: row.id,
- code:row.code,
- };
-
- this.drugwayFormVisible = true;
- this.dialogTitle = "编辑给药途径";
- this.isEdit = true;
- },
- submitDrugWay(formName) {
- this.$refs[formName].validate(valid => {
- if (valid) {
- if (this.isEdit) {
- UpdateDrugWay(this.drugwayForm.id, this.drugwayForm).then(
- response => {
- if (response.data.state == 0) {
- this.$message.error(response.data.msg);
- return false;
- } else {
- this.$notify({
- title: "成功",
- message: "修改成功",
- type: "success",
- duration: 2000
- });
- this.drugwayFormVisible = false;
- this.resetForm(formName);
- var drugway = response.data.data.drugway;
- this.drugways[this.currentIndex].name = drugway.name;
- this.drugways[this.currentIndex].code = drugway.code;
- this.drugways[this.currentIndex].updated_time = drugway.updated_time;
- this.currentIndex = -1;
- return false;
- }
- }
- );
- } else {
- CreateDrugWay(this.drugwayForm).then(response => {
- if (response.data.state == 0) {
- this.$message.error(response.data.msg);
- return false;
- } else {
- this.$notify({
- title: "成功",
- message: "添加成功",
- type: "success",
- duration: 2000
- });
- this.drugwayFormVisible = false;
- this.resetForm(formName);
- this.drugways.unshift(response.data.data.drugway);
- return false;
- }
- });
- }
- }
- });
- },
- handleDeleteDrugWay(row, index) {
- this.$confirm("确认删除此给药途径?", "删除", {
- confirmButtonText: "确 定",
- cancelButtonText: "取 消",
- type: "warning"
- })
- .then(() => {
- DeleteDrugWay(row.id).then(response => {
- if (response.data.state == 0) {
- this.$message.error(response.data.msg);
- return false;
- } else {
- this.$notify({
- title: "成功",
- message: "给药途径已经删除",
- type: "success",
- duration: 2000
- });
- this.drugways.splice(index, 1);
- }
- });
- })
- .catch(() => {});
- },
- handleCreateEF() {
- this.efForm = {
- name: "",
- id: 0
- };
- this.efFormVisible = true;
- this.dialogTitle = "新增执行频率";
- this.isEdit = false;
- },
- handleUpdateEF(row, index) {
- this.currentIndex = index;
- this.efForm = {
- name: row.name,
- id: row.id
- };
-
- this.efFormVisible = true;
- this.dialogTitle = "编辑执行频率";
- this.isEdit = true;
- },
- submitEF(formName) {
- this.$refs[formName].validate(valid => {
- if (valid) {
- if (this.isEdit) {
- UpdateExecutionFrequency(this.efForm.id, this.efForm).then(
- response => {
- if (response.data.state == 0) {
- this.$message.error(response.data.msg);
- return false;
- } else {
- this.$notify({
- title: "成功",
- message: "修改成功",
- type: "success",
- duration: 2000
- });
- this.efFormVisible = false;
- this.resetForm(formName);
- var ef = response.data.data.ef;
- this.executionFrequencyOptions[this.currentIndex].name =
- ef.name;
- this.executionFrequencyOptions[
- this.currentIndex
- ].updated_time = ef.updated_time;
- this.currentIndex = -1;
- return false;
- }
- }
- );
- } else {
- CreateExecutionFrequency(this.efForm).then(response => {
- if (response.data.state == 0) {
- this.$message.error(response.data.msg);
- return false;
- } else {
- this.$notify({
- title: "成功",
- message: "添加成功",
- type: "success",
- duration: 2000
- });
- this.efFormVisible = false;
- this.resetForm(formName);
- this.executionFrequencyOptions.unshift(response.data.data.ef);
- return false;
- }
- });
- }
- }
- });
- },
- handleDeleteEF(row, index) {
- this.$confirm("确认删除此执行频率?", "删除", {
- confirmButtonText: "确 定",
- cancelButtonText: "取 消",
- type: "warning"
- })
- .then(() => {
- DeleteExecutionFrequency(row.id).then(response => {
- if (response.data.state == 0) {
- this.$message.error(response.data.msg);
- return false;
- } else {
- this.$notify({
- title: "成功",
- message: "执行频率已经删除",
- type: "success",
- duration: 2000
- });
- this.executionFrequencyOptions.splice(index, 1);
- }
- });
- })
- .catch(() => {});
- },
- getAdviceConfig() {
- getAdviceConfig().then(response => {
- if (response.data.state == 1) {
- this.drugways = response.data.data.drugways;
- this.executionFrequencyOptions = response.data.data.efs;
- this.drugdics = response.data.data.drugs;
- this.adviceTemplates = response.data.data.advice_templates;
- this.listLoading = false;
- }
- });
- }
- }
- };
- </script>
-
- <style scoped>
- .tab-container {
- margin: 30px;
- }
- </style>
|