|
@@ -0,0 +1,156 @@
|
|
|
+<template>
|
|
|
+ <page-layer>
|
|
|
+ <template #header>
|
|
|
+ <el-input v-model="text" class="w-50 m-2" style="width: 320px" placeholder="请输入编码/名称/首拼/五笔" clearable>
|
|
|
+ <template #prepend>编码/名称/首拼/五笔 </template>
|
|
|
+ </el-input>
|
|
|
+ <el-button type="primary" icon="Search" @click="queryYpDict" style="margin-left: 5px">查询</el-button>
|
|
|
+ <el-button type="primary" icon="Plus" @click="addYpDic" style="margin-left: 5px">新增</el-button>
|
|
|
+ </template>
|
|
|
+ <template #main>
|
|
|
+ <el-table :data="drugDictData.slice(pageSize * (currentPage - 1), pageSize * currentPage)" border
|
|
|
+ style="width: 100%" :height="tableHeight" stripe highlight-current-row>
|
|
|
+ <el-table-column type="index" label="序号" width="60" />
|
|
|
+ <el-table-column prop="code" label="药品编码" width="90" />
|
|
|
+ <el-table-column prop="serial" label="药品包装" width="70" />
|
|
|
+ <el-table-column prop="name" label="药品名称" width="300" />
|
|
|
+ <el-table-column prop="specification" label="药品规格" width="200" />
|
|
|
+ <el-table-column prop="packRetprice" label="药品零售价" width="120" />
|
|
|
+ <el-table-column prop="delFlag" label="状态" width="80">
|
|
|
+ <template #default="scope">
|
|
|
+ <span v-if="scope.row.delFlag === '1'" style="color:#d12020;">停用</span>
|
|
|
+ <span v-else></span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="pyCode" label="拼音码" width="160" />
|
|
|
+ <el-table-column prop="dcode" label="五笔码" width="160" />
|
|
|
+ <el-table-column fixed="right" label="操作" min-width="180" width="180" center>
|
|
|
+ <template #default="scope">
|
|
|
+ <el-button type="primary" size="small" v-if="!scope.row.isEdit"
|
|
|
+ @click="editYpDict(scope.row)">编辑</el-button>
|
|
|
+ <el-button type="primary" size="small" v-if="!scope.row.isEdit"
|
|
|
+ @click="editYpDictName(scope.row)">别名</el-button>
|
|
|
+ <el-button :type="scope.row.delFlag === '1' ? 'primary' : 'warning'" size="small"
|
|
|
+ @click.prevent="stopYpDict(scope.row)">
|
|
|
+ <span v-if="scope.row.delFlag === '1'">启用</span>
|
|
|
+ <span v-else>停用</span>
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <el-pagination :current-page="currentPage" :page-size="pageSize" :page-sizes="[15, 30, 45, 60]"
|
|
|
+ :total="drugDictData.length" layout="total, sizes, prev, pager, next, jumper" style="margin-top: 5px"
|
|
|
+ @size-change="handleSizeChange" @current-change="handleCurrentChange">
|
|
|
+ </el-pagination>
|
|
|
+ </template>
|
|
|
+ </page-layer>
|
|
|
+ <el-dialog v-model="showYpEdit" :close-on-click-modal="false" :close-on-press-escape="false" :title="ypTitle"
|
|
|
+ width="70%" destroy-on-close>
|
|
|
+ <YpZdDict :ypDetail="ypDetail" @closeYpEditFor="closeYpEditAdd" />
|
|
|
+ </el-dialog>
|
|
|
+</template>
|
|
|
+<script setup name="YpDictInfo">
|
|
|
+import { ref, onMounted, nextTick } from 'vue'
|
|
|
+import PageLayer from '@/layout/PageLayer.vue'
|
|
|
+import store from '@/store'
|
|
|
+import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
+import { selectYpDict, updateYpStopOrUsed } from '@/api/yp-dict/yp-dict-info.js'
|
|
|
+import YpZdDict from '@/views/yp-dict/YpZdDict.vue'
|
|
|
+
|
|
|
+const windowSize = store.state.app.windowSize;
|
|
|
+const tableHeight = windowSize.h / 1.07;
|
|
|
+const text = ref('')
|
|
|
+const drugDictData = ref([])
|
|
|
+const ypTitle = ref('')
|
|
|
+const showYpEdit = ref(false)
|
|
|
+const ypDetail = ref({})
|
|
|
+
|
|
|
+const pageSize = ref(30)
|
|
|
+const currentPage = ref(1)
|
|
|
+const handleSizeChange = (val) => {
|
|
|
+ pageSize.value = val
|
|
|
+}
|
|
|
+const handleCurrentChange = (val) => {
|
|
|
+ currentPage.value = val
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ nextTick(() => {
|
|
|
+ queryYpDict()
|
|
|
+ })
|
|
|
+})
|
|
|
+
|
|
|
+// 查询
|
|
|
+const queryYpDict = () => {
|
|
|
+ selectYpDict(text.value)
|
|
|
+ .then((res) => {
|
|
|
+ res.forEach(row => {
|
|
|
+ // 是否标记
|
|
|
+ row['isEdit'] = false
|
|
|
+ // 是否新增
|
|
|
+ row['isAdd'] = false
|
|
|
+ })
|
|
|
+ drugDictData.value = res
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ drugDictData.value = []
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+// 新增
|
|
|
+const addYpDic = () => {
|
|
|
+ alert('功能开发中。。。')
|
|
|
+}
|
|
|
+
|
|
|
+const closeYpEditAdd = () => {
|
|
|
+ showYpEdit.value = false
|
|
|
+ queryYpDict()
|
|
|
+}
|
|
|
+
|
|
|
+// 编辑
|
|
|
+const editYpDict = () => {
|
|
|
+ alert('功能开发中。。。')
|
|
|
+}
|
|
|
+
|
|
|
+// 编辑别名
|
|
|
+const editYpDictName = () => {
|
|
|
+ alert('功能开发中。。。')
|
|
|
+}
|
|
|
+
|
|
|
+const stopYpDict = (row) => {
|
|
|
+ let delFlag
|
|
|
+ let title
|
|
|
+ if ('1' === row.delFlag) {
|
|
|
+ delFlag = '0'
|
|
|
+ title = '请确认是否启用<span style="color:#d12020;">' + row.name + '</span>?'
|
|
|
+ } else {
|
|
|
+ delFlag = '1'
|
|
|
+ title = '请确认是否停用<span style="color:#d12020;">' + row.name + '</span>?'
|
|
|
+ }
|
|
|
+
|
|
|
+ ElMessageBox.confirm(title, {
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ type: 'warning',
|
|
|
+ distinguishCancelAndClose: true,
|
|
|
+ dangerouslyUseHTMLString: true
|
|
|
+ }).then(() => {
|
|
|
+ updateYpStopOrUsed(row.code, delFlag).then((res) => {
|
|
|
+ ElMessage({
|
|
|
+ type: "success",
|
|
|
+ message: res.cg,
|
|
|
+ duration: 2500,
|
|
|
+ showClose: true,
|
|
|
+ });
|
|
|
+ queryYpDict()
|
|
|
+ return
|
|
|
+ })
|
|
|
+ }).catch((action) => {
|
|
|
+ if (action === 'cancel') {
|
|
|
+ queryYpDic()
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+</script>
|