From b7f7f38d7ead0939d82a8a0fb301b30b72398acc Mon Sep 17 00:00:00 2001 From: WXL <1785969728@qq.com> Date: 星期四, 07 八月 2025 09:54:22 +0800 Subject: [PATCH] 测试完成 --- src/views/knowledge/drug/index.vue | 1072 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 1,061 insertions(+), 11 deletions(-) diff --git a/src/views/knowledge/drug/index.vue b/src/views/knowledge/drug/index.vue index aa54bde..5e45095 100644 --- a/src/views/knowledge/drug/index.vue +++ b/src/views/knowledge/drug/index.vue @@ -1,27 +1,1077 @@ <template> - <div> -鑽搧鐭ヨ瘑搴� + <div class="DrugKnowledgeManagement"> + <!-- 宸︿晶鏍� --> + <div class="sidecolumn"> + <div class="sidecolumn-top"> + <div class="top-wj">鑽搧鍒嗙被</div> + <div class="top-tj" @click="dialogFormVisible = true">+娣诲姞</div> + </div> + <div class="center-ss"> + <el-input + placeholder="璇疯緭鍏ュ唴瀹�" + v-model="sidecolumnval" + class="input-with-select" + size="medium"> + </el-input> + </div> + + <div class="head-container" style="margin-top: 20px"> + <el-tree + :data="deptOptions" + :props="defaultProps" + :expand-on-click-node="false" + :filter-node-method="filterNode" + ref="tree" + node-key="id" + default-expand-all + highlight-current + @node-click="handleNodeClick"> + <span class="custom-tree-node" slot-scope="{ node, data }"> + <span>{{ node.label }}</span> + <span v-if="data.id > 0"> + <el-button + type="text" + icon="el-icon-delete" + circle + size="mini" + @click="() => remove(node, data)"> + </el-button> + </span> + <span v-if="data.id > 0"> + <el-button + type="text" + circle + size="mini" + @click="() => altertag(node, data)"> + <span class="button-textxg"><i class="el-icon-edit-outline"></i></span> + </el-button> + </span> + </span> + </el-tree> + </div> + </div> + <!-- 鍙充晶鏁版嵁 --> + <div class="leftvlue"> + <div class="leftvlue-bg"> + <el-row :gutter="20"> + <!--鑽搧鏁版嵁--> + <el-col :span="24" :xs="24"> + <el-form + :model="queryParams" + ref="queryForm" + size="small" + :inline="true" + v-show="showSearch" + label-width="98px"> + <el-form-item label="鑽搧鍚嶇О" prop="drugName"> + <el-input + v-model="queryParams.drugName" + placeholder="璇疯緭鍏�" + clearable + style="width: 200px" + @keyup.enter.native="handleQuery"/> + </el-form-item> + <el-form-item label="鑽搧鍒嗙被" prop="categoryId"> + <el-select v-model="queryParams.categoryId" placeholder="璇烽�夋嫨"> + <el-option + v-for="item in drugCategories" + :key="item.id" + :label="item.categoryName" + :value="item.id"> + </el-option> + </el-select> + </el-form-item> + <el-form-item label="鑽搧绫诲瀷" prop="drugType"> + <el-select v-model="queryParams.drugType" placeholder="璇烽�夋嫨"> + <el-option + v-for="item in drugTypes" + :key="item.value" + :label="item.label" + :value="item.value"> + </el-option> + </el-select> + </el-form-item> + <el-form-item label="鏄惁澶勬柟鑽�" prop="isPrescription"> + <el-select v-model="queryParams.isPrescription" placeholder="璇烽�夋嫨"> + <el-option + v-for="item in prescriptionOptions" + :key="item.value" + :label="item.label" + :value="item.value"> + </el-option> + </el-select> + </el-form-item> + + <el-form-item> + <el-button + type="primary" + icon="el-icon-search" + size="medium" + @click="handleQuery">鎼滅储</el-button> + <el-button + icon="el-icon-refresh" + size="medium" + @click="resetQuery">閲嶇疆</el-button> + </el-form-item> + </el-form> + + <el-row :gutter="10" class="mb8"> + <el-col :span="1.5"> + <el-button + type="primary" + plain + icon="el-icon-plus" + size="medium" + @click="handleAdd">鏂板</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="danger" + plain + icon="el-icon-delete" + size="medium" + :disabled="multiple" + @click="handleDelete">鍒犻櫎</el-button> + </el-col> + </el-row> + + <el-table + v-loading="loading" + :data="filteredDrugList" + @selection-change="handleSelectionChange"> + <el-table-column type="selection" width="50" align="center" /> + <el-table-column + label="鑽搧鍚嶇О" + fixed + align="center" + key="drugName" + prop="drugName" + :show-overflow-tooltip="true"> + </el-table-column> + <el-table-column + label="閫氱敤鍚�" + align="center" + key="genericName" + prop="genericName" + :show-overflow-tooltip="true" + width="200"/> + <el-table-column + label="鑽搧鍒嗙被" + align="center" + key="categoryName" + prop="categoryName" + :show-overflow-tooltip="true"/> + <el-table-column + label="鑽搧绫诲瀷" + align="center" + key="drugType" + prop="drugType"> + <template slot-scope="scope"> + <dict-tag :options="drugTypes" :value="scope.row.drugType"/> + </template> + </el-table-column> + <el-table-column + label="鏄惁澶勬柟鑽�" + align="center" + key="isPrescription" + prop="isPrescription"> + <template slot-scope="scope"> + <dict-tag :options="prescriptionOptions" :value="scope.row.isPrescription"/> + </template> + </el-table-column> + <el-table-column + label="瑙勬牸" + align="center" + key="specification" + prop="specification" + width="120"/> + <el-table-column + label="鍗曚綅" + align="center" + key="unit" + prop="unit" + width="80"/> + <el-table-column + label="鐢熶骇鍘傚" + align="center" + key="manufacturer" + prop="manufacturer" + width="150"/> + <el-table-column + label="鎵瑰噯鏂囧彿" + align="center" + key="approvalNumber" + prop="approvalNumber" + width="150"/> + <el-table-column + label="鎿嶄綔" + fixed="right" + align="center" + width="200" + class-name="small-padding fixed-width"> + <template slot-scope="scope"> + <el-button + size="medium" + type="text" + @click="handleUpdate(scope.row)"> + <span class="button-textxg"><i class="el-icon-edit"></i>淇敼</span> + </el-button> + <el-button + size="medium" + type="text" + @click="handleDelete(scope.row)"> + <span class="button-textsc"><i class="el-icon-delete"></i>鍒犻櫎</span> + </el-button> + </template> + </el-table-column> + </el-table> + + <pagination + v-show="total>0" + :total="total" + :page.sync="queryParams.pageNum" + :limit.sync="queryParams.pageSize" + @pagination="getList"/> + </el-col> + </el-row> + + <!-- 娣诲姞鎴栦慨鏀硅嵂鍝佸璇濇 --> + <el-dialog + :title="title" + :visible.sync="drugOpen" + :close-on-click-modal="false" + width="900px" + append-to-body> + <el-form + ref="drugForm" + :model="drugForm" + :rules="rules" + label-width="100px"> + <div class="headline"> + <div class="basics">鍩虹淇℃伅</div> + </div> + <el-divider></el-divider> + <el-row> + <el-col :span="12"> + <el-form-item label="鑽搧鍚嶇О" prop="drugName"> + <el-input + v-model="drugForm.drugName" + placeholder="璇疯緭鍏ヨ嵂鍝佸悕绉�" + maxlength="40"/> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="閫氱敤鍚�" prop="genericName"> + <el-input + v-model="drugForm.genericName" + placeholder="璇疯緭鍏ヨ嵂鍝侀�氱敤鍚�" + maxlength="40"/> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="12"> + <el-form-item label="鑽搧鍒嗙被" prop="categoryId"> + <el-select + style="width: 300px;" + v-model="drugForm.categoryId" + size="medium" + filterable + placeholder="璇烽�夋嫨鍒嗙被"> + <el-option-group + v-for="group in deptOptions" + :key="group.id" + :label="group.categoryName"> + <el-option + v-for="item in group.children" + :key="item.id" + :label="item.categoryName" + :value="item.id"> + </el-option> + </el-option-group> + </el-select> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鑽搧绫诲瀷" prop="drugType"> + <el-select v-model="drugForm.drugType" placeholder="璇烽�夋嫨鑽搧绫诲瀷"> + <el-option + v-for="item in drugTypes" + :key="item.value" + :label="item.label" + :value="item.value"> + </el-option> + </el-select> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="12"> + <el-form-item label="鏄惁澶勬柟鑽�" prop="isPrescription"> + <el-radio-group v-model="drugForm.isPrescription"> + <el-radio + v-for="(item, index) in prescriptionOptions" + :label="item.value">{{ item.label }}</el-radio> + </el-radio-group> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鎵瑰噯鏂囧彿" prop="approvalNumber"> + <el-input + v-model="drugForm.approvalNumber" + placeholder="璇疯緭鍏ユ壒鍑嗘枃鍙�" + maxlength="40"/> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="12"> + <el-form-item label="瑙勬牸" prop="specification"> + <el-input + v-model="drugForm.specification" + placeholder="璇疯緭鍏ヨ嵂鍝佽鏍�" + maxlength="40"/> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鍗曚綅" prop="unit"> + <el-select v-model="drugForm.unit" placeholder="璇烽�夋嫨鍗曚綅"> + <el-option + v-for="item in unitOptions" + :key="item.value" + :label="item.label" + :value="item.value"> + </el-option> + </el-select> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="12"> + <el-form-item label="鐢熶骇鍘傚" prop="manufacturer"> + <el-input + v-model="drugForm.manufacturer" + placeholder="璇疯緭鍏ョ敓浜у巶瀹�" + maxlength="100"/> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鏉″舰鐮�" prop="barcode"> + <el-input + v-model="drugForm.barcode" + placeholder="璇疯緭鍏ユ潯褰㈢爜" + maxlength="40"/> + </el-form-item> + </el-col> + </el-row> + + <div class="headline"> + <div class="basics">鑽搧鎴愬垎</div> + </div> + <el-divider></el-divider> + <el-form-item prop="ingredients"> + <el-input + type="textarea" + :rows="3" + placeholder="璇疯緭鍏ヨ嵂鍝佷富瑕佹垚鍒�" + v-model="drugForm.ingredients"> + </el-input> + </el-form-item> + + <div class="headline"> + <div class="basics">鐢ㄦ硶鐢ㄩ噺</div> + </div> + <el-divider></el-divider> + <el-form-item prop="usageDosage"> + <el-input + type="textarea" + :rows="3" + placeholder="璇疯緭鍏ョ敤娉曠敤閲忚鏄�" + v-model="drugForm.usageDosage"> + </el-input> + </el-form-item> + + <div class="headline"> + <div class="basics">涓嶈壇鍙嶅簲</div> + </div> + <el-divider></el-divider> + <el-form-item prop="adverseReactions"> + <el-input + type="textarea" + :rows="3" + placeholder="璇疯緭鍏ヤ笉鑹弽搴旇鏄�" + v-model="drugForm.adverseReactions"> + </el-input> + </el-form-item> + + <div class="headline"> + <div class="basics">绂佸繉</div> + </div> + <el-divider></el-divider> + <el-form-item prop="contraindications"> + <el-input + type="textarea" + :rows="3" + placeholder="璇疯緭鍏ョ蹇岃鏄�" + v-model="drugForm.contraindications"> + </el-input> + </el-form-item> + + <div class="headline"> + <div class="basics">娉ㄦ剰浜嬮」</div> + </div> + <el-divider></el-divider> + <el-form-item prop="precautions"> + <el-input + type="textarea" + :rows="3" + placeholder="璇疯緭鍏ユ敞鎰忎簨椤�" + v-model="drugForm.precautions"> + </el-input> + </el-form-item> + </el-form> + <div slot="footer" class="dialog-footer"> + <el-button type="primary" @click="submitForm">淇� 瀛�</el-button> + <el-button @click="cancel">鍏� 闂�</el-button> + </div> + </el-dialog> + </div> + </div> + <!-- 娣诲姞绫诲埆寮规 --> + <el-dialog title="鏂板绫诲埆" width="30%" :visible.sync="dialogFormVisible"> + <div style="text-align: center; margin-bottom: 20px"> + <el-radio-group v-model="radio"> + <el-radio-button label="涓诲垎绫�"></el-radio-button> + <el-radio-button label="瀛愬垎绫�"></el-radio-button> + </el-radio-group> + </div> + <el-divider></el-divider> + + <el-form :model="classifyform"> + <el-form-item label="璇烽�夋嫨鑽搧澶х被" v-if="radio == '瀛愬垎绫�'"> + <el-select v-model="classifyform.pid" placeholder="璇烽�夋嫨"> + <el-option + v-for="item in deptOptions" + :key="item.id" + :label="item.categoryName" + :value="item.id"> + </el-option> + </el-select> + </el-form-item> + <el-form-item label="璇疯緭鍏ョ被鍒悕绉�"> + <el-input + v-model="classifyform.categoryName" + autocomplete="off"></el-input> + </el-form-item> + </el-form> + <div slot="footer" class="dialog-footer"> + <el-button @click="getDeptTree()">鍙� 娑�</el-button> + <el-button type="primary" @click="submitsidecolumn">纭� 瀹�</el-button> + </div> + </el-dialog> </div> </template> <script> export default { - data () { + name: "DrugKnowledge", + dicts: ["sys_normal_disable", "sys_user_sex"], + data() { return { - + // 閬僵灞� + loading: false, + // 閫変腑鏁扮粍 + ids: [], + // 闈炲崟涓鐢� + single: true, + // 闈炲涓鐢� + multiple: true, + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, + // 鎬绘潯鏁� + total: 0, + idds: "", + classifyform: { // 娣诲姞杩欎釜瀵硅薄 + id: undefined, + pid: undefined, + categoryName: undefined + }, + amendtag: false, //鏄惁淇敼绫诲埆 + dialogFormVisible: false, //淇敼娣诲姞绫诲埆寮规 + deleteVisible: false, //鍒嗙被鍒犻櫎寮规 + deletefenl: "楂樿鍘�", //鍒犻櫎椤� + radio: "涓诲垎绫�", + // 琛ㄦ牸鏁版嵁 + drugList: [ + { + id: 1, + drugName: "闃胯帿瑗挎灄鑳跺泭", + genericName: "闃胯帿瑗挎灄", + categoryId: 101, + categoryName: "鎶楃敓绱�", + drugType: "1", + isPrescription: "1", + specification: "0.25g脳24绮�", + unit: "鐩�", + manufacturer: "鍗庡寳鍒惰嵂", + approvalNumber: "鍥借嵂鍑嗗瓧H13024176", + barcode: "6923450601234", + ingredients: "闃胯帿瑗挎灄", + usageDosage: "鍙f湇銆傛垚浜轰竴娆�0.5g锛屾瘡6锝�8灏忔椂1娆★紝涓�鏃ュ墏閲忎笉瓒呰繃4g銆�", + adverseReactions: "1.鎭跺績銆佸憰鍚愩�佽吂娉诲強鍋囪啘鎬ц偁鐐庣瓑鑳冭偁閬撳弽搴斻��2.鐨柟銆佽嵂鐗╃儹鍜屽摦鍠樼瓑杩囨晱鍙嶅簲銆�", + contraindications: "闈掗湁绱犺繃鏁忓強闈掗湁绱犵毊鑲よ瘯楠岄槼鎬ф偅鑰呯鐢ㄣ��", + precautions: "1.闈掗湁绱犵被鍙f湇鑽墿鍋跺彲寮曡捣杩囨晱鎬т紤鍏嬶紝灏ゅ瑙佷簬鏈夐潚闇夌礌鎴栧ご瀛㈣弻绱犺繃鏁忓彶鐨勬偅鑰呫��2.浼犳煋鎬у崟鏍哥粏鑳炲澶氱棁鎮h�呭簲鐢ㄦ湰鍝佹槗鍙戠敓鐨柟锛屽簲閬垮厤浣跨敤銆�" + }, + { + id: 2, + drugName: "鏉胯摑鏍归绮�", + genericName: "鏉胯摑鏍�", + categoryId: 302, + categoryName: "鐗囧墏", + drugType: "3", + isPrescription: "0", + specification: "10g脳20琚�", + unit: "鐩�", + manufacturer: "鐧戒簯灞卞埗鑽�", + approvalNumber: "鍥借嵂鍑嗗瓧Z44023445", + barcode: "6923450605678", + ingredients: "鏉胯摑鏍�", + usageDosage: "寮�姘村啿鏈嶃�備竴娆�5锝�10g锛屼竴鏃�3锝�4娆°��", + adverseReactions: "灏氫笉鏄庣‘銆�", + contraindications: "灏氫笉鏄庣‘銆�", + precautions: "1.蹇岀儫銆侀厭鍙婅緵杈c�佺敓鍐枫�佹补鑵婚鐗┿��2.涓嶅疁鍦ㄦ湇鑽湡闂村悓鏃舵湇鐢ㄦ粙琛ユ�т腑鑽��" + }, + { + id: 3, + drugName: "澶嶆柟涓瑰弬鐗�", + genericName: "澶嶆柟涓瑰弬", + categoryId: 303, + categoryName: "鑳跺泭", + drugType: "3", + isPrescription: "0", + specification: "60鐗�", + unit: "鐡�", + manufacturer: "鍚屼粊鍫�", + approvalNumber: "鍥借嵂鍑嗗瓧Z11020672", + barcode: "6923450609012", + ingredients: "涓瑰弬銆佷笁涓冦�佸啺鐗�", + usageDosage: "鍙f湇銆備竴娆�3鐗囷紝涓�鏃�3娆°��", + adverseReactions: "灏氫笉鏄庣‘銆�", + contraindications: "瀛曞绂佺敤銆�", + precautions: "1.蹇岄鐢熷喎銆佽緵杈c�佹补鑵婚鐗┿��2.鏈嶈嵂鏈熼棿濡傛湁涓嶉�傦紝搴旂珛鍗冲仠鑽苟灏卞尰銆�" + }, + { + id: 4, + drugName: "甯冩礇鑺紦閲婅兌鍥�", + genericName: "甯冩礇鑺�", + categoryId: 102, + categoryName: "瑙g儹闀囩棝鑽�", + drugType: "1", + isPrescription: "0", + specification: "0.3g脳20绮�", + unit: "鐩�", + manufacturer: "涓編鍙插厠", + approvalNumber: "鍥借嵂鍑嗗瓧H10900089", + barcode: "6923450612345", + ingredients: "甯冩礇鑺�", + usageDosage: "鍙f湇銆傛垚浜轰竴娆�1绮掞紝涓�鏃�2娆�(鏃╂櫄鍚勪竴娆�)銆�", + adverseReactions: "1.灏戞暟鐥呬汉鍙嚭鐜版伓蹇冦�佸憰鍚愩�佽儍鐑х伡鎰熸垨杞诲害娑堝寲涓嶈壇銆佽儍鑲犻亾婧冪枴鍙婂嚭琛�銆佽浆姘ㄩ叾鍗囬珮銆佸ご鐥涖�佸ご鏅曘�佽�抽福銆佽鍔涙ā绯娿�佺簿绁炵揣寮犮�佸棞鐫°�佷笅鑲㈡按鑲挎垨浣撻噸楠ゅ銆�", + contraindications: "1.瀵瑰叾浠栭潪鐢句綋鎶楃値鑽繃鏁忚�呯鐢ㄣ��2.瀛曞鍙婂摵涔虫湡濡囧コ绂佺敤銆�3.瀵归樋鍙稿尮鏋楄繃鏁忕殑鍝枠鎮h�呯鐢ㄣ��", + precautions: "1.鏈搧涓哄鐥囨不鐤楄嵂锛屼笉瀹滈暱鏈熸垨澶ч噺浣跨敤锛岀敤浜庢鐥涗笉寰楄秴杩�5澶╋紝鐢ㄤ簬瑙g儹涓嶅緱瓒呰繃3澶╋紝濡傜棁鐘朵笉缂撹В锛岃鍜ㄨ鍖诲笀鎴栬嵂甯堛��2.涓嶈兘鍚屾椂鏈嶇敤鍏朵粬鍚湁瑙g儹闀囩棝鑽殑鑽搧(濡傛煇浜涘鏂规姉鎰熷啋鑽�)銆�" + }, + { + id: 5, + drugName: "鍏懗鍦伴粍涓�", + genericName: "鍏懗鍦伴粍", + categoryId: 201, + categoryName: "琛ョ泭鑽�", + drugType: "3", + isPrescription: "0", + specification: "200涓�", + unit: "鐡�", + manufacturer: "鍚屼粊鍫�", + approvalNumber: "鍥借嵂鍑嗗瓧Z11020061", + barcode: "6923450615678", + ingredients: "鐔熷湴榛勩�侀厭钀歌倝銆佺墶涓圭毊銆佸北鑽�佽尟鑻撱�佹辰娉�", + usageDosage: "鍙f湇銆備竴娆�8涓革紝涓�鏃�3娆°��", + adverseReactions: "灏氫笉鏄庣‘銆�", + contraindications: "灏氫笉鏄庣‘銆�", + precautions: "1.蹇岃緵杈i鐗┿��2.涓嶅疁鍦ㄦ湇鑽湡闂存湇鎰熷啋鑽��3.鏈嶈嵂鏈熼棿鍑虹幇椋熸涓嶆尟锛岃儍鑴樹笉閫傦紝澶т究绋�锛岃吂鐥涚瓑鐥囩姸鏃讹紝搴斿幓鍖婚櫌灏辫瘖銆�" + } + ], + // 寮瑰嚭灞傛爣棰� + title: "", + // 鏄惁鏄剧ず寮瑰嚭灞� + drugOpen: false, + // 鏃ユ湡鑼冨洿 + dateRange: [], + // 鑽搧鍒嗙被閫夐」 + drugCategories: [ + { id: 101, categoryName: "鎶楃敓绱�" }, + { id: 102, categoryName: "瑙g儹闀囩棝鑽�" }, + { id: 103, categoryName: "蹇冭绠¤嵂鐗�" }, + { id: 201, categoryName: "琛ョ泭鑽�" }, + { id: 202, categoryName: "娓呯儹鑽�" }, + { id: 203, categoryName: "绁涙箍鑽�" }, + { id: 301, categoryName: "涓稿墏" }, + { id: 302, categoryName: "鐗囧墏" }, + { id: 303, categoryName: "鑳跺泭" } + ], + // 娣诲姞銆佷慨鏀瑰弬鏁� + drugForm: {}, + deptOptions: [ + { + id: 1, + categoryName: "瑗胯嵂", + children: [ + { id: 101, categoryName: "鎶楃敓绱�" }, + { id: 102, categoryName: "瑙g儹闀囩棝鑽�" }, + { id: 103, categoryName: "蹇冭绠¤嵂鐗�" } + ] + }, + { + id: 2, + categoryName: "涓嵂", + children: [ + { id: 201, categoryName: "琛ョ泭鑽�" }, + { id: 202, categoryName: "娓呯儹鑽�" }, + { id: 203, categoryName: "绁涙箍鑽�" } + ] + }, + { + id: 3, + categoryName: "涓垚鑽�", + children: [ + { id: 301, categoryName: "涓稿墏" }, + { id: 302, categoryName: "鐗囧墏" }, + { id: 303, categoryName: "鑳跺泭" } + ] + } + ], + defaultProps: { + children: "children", + label: "categoryName", + }, + sidecolumnform: {}, //娣诲姞绫诲埆琛ㄥ崟 + dialogFormVisible: false, //娣诲姞绫诲埆寮规 + sidecolumnval: "", //绫诲埆鎼滅储 + // 鏌ヨ鍙傛暟 + queryParams: { + pageNum: 1, + pageSize: 10, + drugName: undefined, + categoryId: undefined, + drugType: undefined, + isPrescription: undefined + }, + // 鑽搧绫诲瀷閫夐」 + drugTypes: [ + { value: "1", label: "瑗胯嵂" }, + { value: "2", label: "涓嵂" }, + { value: "3", label: "涓垚鑽�" }, + { value: "4", label: "鐢熺墿鍒跺搧" }, + { value: "5", label: "鍏朵粬" } + ], + // 鏄惁澶勬柟鑽�夐」 + prescriptionOptions: [ + { value: "1", label: "澶勬柟鑽�" }, + { value: "0", label: "闈炲鏂硅嵂" } + ], + // 鍗曚綅閫夐」 + unitOptions: [ + { value: "鐩�", label: "鐩�" }, + { value: "鐡�", label: "鐡�" }, + { value: "鏀�", label: "鏀�" }, + { value: "琚�", label: "琚�" }, + { value: "鐗�", label: "鐗�" }, + { value: "绮�", label: "绮�" }, + { value: "g", label: "鍏�" }, + { value: "ml", label: "姣崌" } + ], + // 琛ㄥ崟鏍¢獙 + rules: { + drugName: [ + { required: true, message: "鑽搧鍚嶇О涓嶈兘涓虹┖", trigger: "blur" } + ], + genericName: [ + { required: true, message: "閫氱敤鍚嶄笉鑳戒负绌�", trigger: "blur" } + ], + categoryId: [ + { required: true, message: "鑽搧鍒嗙被涓嶈兘涓虹┖", trigger: "blur" } + ], + drugType: [ + { required: true, message: "鑽搧绫诲瀷涓嶈兘涓虹┖", trigger: "blur" } + ], + isPrescription: [ + { required: true, message: "鏄惁澶勬柟鑽笉鑳戒负绌�", trigger: "blur" } + ], + specification: [ + { required: true, message: "瑙勬牸涓嶈兘涓虹┖", trigger: "blur" } + ], + unit: [ + { required: true, message: "鍗曚綅涓嶈兘涓虹┖", trigger: "blur" } + ], + approvalNumber: [ + { required: true, message: "鎵瑰噯鏂囧彿涓嶈兘涓虹┖", trigger: "blur" } + ], + manufacturer: [ + { required: true, message: "鐢熶骇鍘傚涓嶈兘涓虹┖", trigger: "blur" } + ] + } + }; + }, + computed: { + filteredDrugList() { + let list = [...this.drugList]; + if (this.queryParams.drugName) { + list = list.filter(item => + item.drugName.includes(this.queryParams.drugName) + ); + } + if (this.queryParams.categoryId) { + list = list.filter(item => + item.categoryId == this.queryParams.categoryId + ); + } + if (this.queryParams.drugType) { + list = list.filter(item => + item.drugType == this.queryParams.drugType + ); + } + if (this.queryParams.isPrescription) { + list = list.filter(item => + item.isPrescription == this.queryParams.isPrescription + ); + } + return list; } }, - - created () { - + watch: { + // 鏍规嵁鍚嶇О绛涢�夐儴闂ㄦ爲 + sidecolumnval(val) { + this.$refs.tree.filter(val); + } }, - + created() { + // 鍒濆鍖栨暟鎹� + this.total = this.drugList.length; + }, methods: { + /** 鏌ヨ鑽搧鍒楄〃 */ + getList() { + this.loading = true; + setTimeout(() => { + this.loading = false; + }, 500); + }, + /** 鏌ヨ鑽搧鍒嗙被鏍戠粨鏋� */ + getDeptTree() { + this.dialogFormVisible = false; + }, + // 绛涢�夎妭鐐� + filterNode(value, data) { + if (!value) return true; + return data.categoryName.indexOf(value) !== -1; + }, + // 娣诲姞绫诲埆鏍� + submitsidecolumn() { + if (this.classifyform.id) { + // 妯℃嫙淇敼鍒嗙被 + const category = this.findCategory(this.classifyform.id); + if (category) { + category.categoryName = this.classifyform.categoryName; + if (this.classifyform.pid) { + category.pid = this.classifyform.pid; + } + } + this.$modal.msgSuccess("淇敼鎴愬姛"); + this.classifyform = {}; + this.dialogFormVisible = false; + return; + } + // 妯℃嫙鏂板鍒嗙被 + const newCategory = { + id: Math.max(...this.deptOptions.flatMap(group => + [group.id, ...(group.children || []).map(child => child.id)] + )) + 1, + categoryName: this.classifyform.categoryName, + pid: this.radio === "瀛愬垎绫�" ? this.classifyform.pid : null + }; + + if (this.radio === "瀛愬垎绫�") { + const parent = this.findCategory(this.classifyform.pid); + if (parent) { + if (!parent.children) parent.children = []; + parent.children.push(newCategory); + } + } else { + newCategory.children = []; + this.deptOptions.push(newCategory); + } + + this.$modal.msgSuccess("鏂板鎴愬姛"); + this.classifyform = {}; + this.dialogFormVisible = false; + }, + + findCategory(id) { + for (const group of this.deptOptions) { + if (group.id === id) return group; + if (group.children) { + for (const child of group.children) { + if (child.id === id) return child; + } + } + } + return null; + }, + + remove(a, b) { + if (b.pid) { + this.$modal + .confirm('鏄惁纭鍒犻櫎鍒嗙被椤逛负"' + b.categoryName + '"鐨勬暟鎹」锛�') + .then(() => { + // 妯℃嫙鍒犻櫎瀛愬垎绫� + const parent = this.findCategory(b.pid); + if (parent && parent.children) { + parent.children = parent.children.filter(child => child.id !== b.id); + } + this.$modal.msgSuccess("鍒犻櫎鎴愬姛"); + }) + .catch(() => {}); + } else { + this.$modal + .confirm( + '鏄惁纭鍒犻櫎涓�绾у垎绫�"' + + b.categoryName + + '"锛熷垹闄ゅ悗鍏朵笅鍒嗙被灏嗗綊绫烩�樻湭鍒嗙被鈥�' + ) + .then(() => { + // 妯℃嫙鍒犻櫎涓诲垎绫� + this.deptOptions = this.deptOptions.filter(group => group.id !== b.id); + this.$modal.msgSuccess("鍒犻櫎鎴愬姛"); + }) + .catch(() => {}); + } + }, + altertag(a, b) { + this.dialogFormVisible = true; + if (!b.pid) { + this.radio = "涓诲垎绫�"; + } else { + this.radio = "瀛愬垎绫�"; + } + this.classifyform = JSON.parse(JSON.stringify(b)); + this.dialogFormVisible = true; + }, + handleNodeClick(data) { + this.queryParams.categoryId = data.id; + }, + + // 鍙栨秷鎸夐挳 + cancel() { + this.drugForm = {}; + this.drugOpen = false; + this.reset(); + }, + + // 琛ㄥ崟閲嶇疆 + reset() { + this.drugForm = { + id: undefined, + drugName: undefined, + genericName: undefined, + categoryId: undefined, + drugType: undefined, + isPrescription: undefined, + specification: undefined, + unit: undefined, + manufacturer: undefined, + approvalNumber: undefined, + barcode: undefined, + ingredients: undefined, + usageDosage: undefined, + adverseReactions: undefined, + contraindications: undefined, + precautions: undefined + }; + }, + /** 鎼滅储鎸夐挳鎿嶄綔 */ + handleQuery() { + this.queryParams.pageNum = 1; + }, + /** 閲嶇疆鎸夐挳鎿嶄綔 */ + resetQuery() { + this.dateRange = []; + this.resetForm("queryForm"); + this.queryParams = { + pageNum: 1, + pageSize: 10, + drugName: undefined, + categoryId: undefined, + drugType: undefined, + isPrescription: undefined + }; + this.$refs.tree.setCurrentKey(null); + }, + // 澶氶�夋閫変腑鏁版嵁 + handleSelectionChange(selection) { + this.ids = selection.map(item => item.id); + this.single = selection.length != 1; + this.multiple = !selection.length; + }, + /** 鏂板鎸夐挳鎿嶄綔 */ + handleAdd() { + this.reset(); + this.title = "鏂板鑽搧"; + this.drugForm = {}; + this.drugOpen = true; + }, + /** 淇敼鎸夐挳鎿嶄綔 */ + handleUpdate(row) { + this.reset(); + this.title = "淇敼鑽搧淇℃伅"; + this.drugForm = Object.assign({}, row); + this.drugOpen = true; + }, + /** 鎻愪氦鎸夐挳 */ + submitForm: function() { + this.$refs["drugForm"].validate(valid => { + if (valid) { + if (this.drugForm.id != undefined) { + // 妯℃嫙淇敼鑽搧 + const index = this.drugList.findIndex(item => item.id === this.drugForm.id); + if (index !== -1) { + this.drugList.splice(index, 1, this.drugForm); + } + this.$modal.msgSuccess("淇敼鎴愬姛"); + } else { + // 妯℃嫙鏂板鑽搧 + this.drugForm.id = Math.max(...this.drugList.map(item => item.id)) + 1; + this.drugList.unshift(this.drugForm); + this.total = this.drugList.length; + this.$modal.msgSuccess("鏂板鎴愬姛"); + } + this.drugOpen = false; + } + }); + }, + /** 鍒犻櫎鎸夐挳鎿嶄綔 */ + handleDelete(row) { + const drugIds = row.id || this.ids; + this.$modal + .confirm('鏄惁纭鍒犻櫎鑽搧鍚嶇О涓�"' + row.drugName + '"鐨勬暟鎹」锛�') + .then(() => { + // 妯℃嫙鍒犻櫎鑽搧 + this.drugList = this.drugList.filter(item => item.id !== drugIds); + this.total = this.drugList.length; + this.$modal.msgSuccess("鍒犻櫎鎴愬姛"); + }) + .catch(() => {}); + } } -} +}; </script> -<style lang='scss' scoped> - +<style lang="scss" scoped> +.DrugKnowledgeManagement { + display: flex; +} +.sidecolumn { + width: 300px; + min-height: 100vh; + text-align: center; + margin-top: 20px; + margin: 20px; + padding: 30px; + background: #fff; + border: 1px solid #dcdfe6; + -webkit-box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.12), + 0 0 6px 0 rgba(0, 0, 0, 0.04); + .sidecolumn-top { + display: flex; + justify-content: space-between; + .top-wj { + font-size: 20px; + } + .top-tj { + font-size: 18px; + color: rgb(0, 89, 255); + cursor: pointer; + } + } + .center-ss { + margin-top: 30px; + .input-with-select { + height: 40px !important; + } + } + .bottom-fl { + margin-top: 30px; + display: center !important; + } +} +.headline { + display: flex; + justify-content: space-between; + font-size: 20px; + border-left: 4px solid #41a1be; + padding-left: 5px; + margin: 15px 0; +} +.leftvlue { + width: 80%; + margin-top: 20px; + padding: 30px; + background: #ffff; + border: 1px solid #dcdfe6; + -webkit-box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.12), + 0 0 6px 0 rgba(0, 0, 0, 0.04); +} +::v-deep .el-tree-node__content { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + height: 46px; + font-size: 20px; + cursor: pointer; +} +::v-deep .el-tree { + position: relative; + cursor: default; + border-radius: 5px; + background: #eff8fe; + color: #606266; + border: 1px solid #bbe1fa; + -webkit-box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.12), + 0 0 6px 0 rgba(0, 0, 0, 0.04); +} +::v-deep + .el-tree--highlight-current + .el-tree-node.is-current + > .el-tree-node__content { + background-color: #7799fb; + color: #fff; +} +::v-deep .el-button--mini.is-circle { + padding: 7px; + margin: 0; + color: red; +} +.button-text { + color: rgb(70, 204, 238); +} +.button-textcs { + color: rgb(39, 167, 67); +} +.button-textxg { + color: rgb(35, 81, 233); +} +.button-textsc { + color: rgb(235, 23, 23); +} </style> -- Gitblit v1.9.3