|  | @@ -14,18 +14,19 @@
 | 
	
		
			
				|  |  |        </el-select>
 | 
	
		
			
				|  |  |        <el-button type="primary" icon="Search" @click="queryYpDict" style="margin-left: 5px">查询</el-button>
 | 
	
		
			
				|  |  |        <el-button type="primary" icon="Plus" @click="addYpDict" style="margin-left: 5px">新增</el-button>
 | 
	
		
			
				|  |  | +      <el-button type="primary" icon="Download" @click="exportData" style="margin-left: 5px">导出</el-button>
 | 
	
		
			
				|  |  |      </div>
 | 
	
		
			
				|  |  |      <div class="layout_display_flex_y layout_flex_1-y">
 | 
	
		
			
				|  |  |        <div class="layout_flex_1-y">
 | 
	
		
			
				|  |  |          <el-table :data="drugDictData.slice(pageSize * (currentPage - 1), pageSize * currentPage)" border
 | 
	
		
			
				|  |  |                    style="width: 100%" height="100%" stripe highlight-current-row>
 | 
	
		
			
				|  |  |            <el-table-column type="index" label="序号" width="60" />
 | 
	
		
			
				|  |  | -          <el-table-column prop="code" label="药品编码" width="70" />
 | 
	
		
			
				|  |  | +          <el-table-column prop="code" label="药品编码" width="80" />
 | 
	
		
			
				|  |  |            <el-table-column prop="serial" label="药品包装" width="70" />
 | 
	
		
			
				|  |  | -          <el-table-column prop="name" label="药品名称" width="300" show-overflow-tooltip />
 | 
	
		
			
				|  |  | +          <el-table-column prop="name" label="药品名称" width="240" show-overflow-tooltip />
 | 
	
		
			
				|  |  |            <el-table-column prop="specification" label="药品规格" width="180" show-overflow-tooltip />
 | 
	
		
			
				|  |  |            <el-table-column prop="packRetprice" label="药品零售价" width="100" />
 | 
	
		
			
				|  |  | -          <el-table-column prop="manuFactory" label="生产厂家" width="180" show-overflow-tooltip />
 | 
	
		
			
				|  |  | +          <el-table-column prop="manuFactory" label="生产厂家" width="200" show-overflow-tooltip />
 | 
	
		
			
				|  |  |            <el-table-column prop="delFlag" label="状态" width="70">
 | 
	
		
			
				|  |  |              <template #default="scope">
 | 
	
		
			
				|  |  |                <span v-if="scope.row.delFlag === '1'" style="color:#d12020;">停用</span>
 | 
	
	
		
			
				|  | @@ -39,7 +40,7 @@
 | 
	
		
			
				|  |  |              </template>
 | 
	
		
			
				|  |  |            </el-table-column>
 | 
	
		
			
				|  |  |            <el-table-column prop="pyCode" label="拼音码" width="150" />
 | 
	
		
			
				|  |  | -          <el-table-column prop="dcode" label="五笔码" width="150" />
 | 
	
		
			
				|  |  | +          <el-table-column prop="dCode" label="五笔码" width="150" />
 | 
	
		
			
				|  |  |            <el-table-column fixed="right" label="操作" min-width="400" width="400" center>
 | 
	
		
			
				|  |  |              <template #default="scope">
 | 
	
		
			
				|  |  |                <el-button type="primary" size="small" v-if="!scope.row.isEdit"
 | 
	
	
		
			
				|  | @@ -82,11 +83,19 @@
 | 
	
		
			
				|  |  |    </el-dialog>
 | 
	
		
			
				|  |  |  </template>
 | 
	
		
			
				|  |  |  <script setup name="YpDictInfo">
 | 
	
		
			
				|  |  | -import { ref, onMounted, nextTick } from 'vue'
 | 
	
		
			
				|  |  | -import { ElMessage, ElMessageBox } from 'element-plus'
 | 
	
		
			
				|  |  | +import {nextTick, onMounted, ref} from 'vue'
 | 
	
		
			
				|  |  | +import {ElMessage, ElMessageBox} from 'element-plus'
 | 
	
		
			
				|  |  | +import {clone} from '@/utils/clone'
 | 
	
		
			
				|  |  | +import {Export} from '@/utils/ExportExcel'
 | 
	
		
			
				|  |  |  import {
 | 
	
		
			
				|  |  | -    selectYpDict, updateYpStopOrUsed, selectYpDictByCode, selectYpGroupNameByYfFlag,
 | 
	
		
			
				|  |  | -    updateYpTempPurchase, updateYkYpStopOrUsed, updateYpJbFlag
 | 
	
		
			
				|  |  | +  selectYpDict,
 | 
	
		
			
				|  |  | +  selectYpDictByCode,
 | 
	
		
			
				|  |  | +  selectYpGroupNameByYfFlag,
 | 
	
		
			
				|  |  | +  selectYpStorageInfo,
 | 
	
		
			
				|  |  | +  updateYkYpStopOrUsed,
 | 
	
		
			
				|  |  | +  updateYpJbFlag,
 | 
	
		
			
				|  |  | +  updateYpStopOrUsed,
 | 
	
		
			
				|  |  | +  updateYpTempPurchase
 | 
	
		
			
				|  |  |  } from '@/api/yp-dict/yp-dict-info.js'
 | 
	
		
			
				|  |  |  import YpZdDict from '@/views/yp-dict/YpZdDict.vue'
 | 
	
		
			
				|  |  |  import YpPrintName from '@/views/yp-dict/YpPrintName.vue'
 | 
	
	
		
			
				|  | @@ -133,15 +142,12 @@ const queryYpGroupNameByYfFlag = (val) => {
 | 
	
		
			
				|  |  |  // 查询
 | 
	
		
			
				|  |  |  const queryYpDict = () => {
 | 
	
		
			
				|  |  |      isYk.value = !!groupNo.value;
 | 
	
		
			
				|  |  | +    if(groupNo.value === undefined){
 | 
	
		
			
				|  |  | +      groupNo.value = ''
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |      selectYpDict(text.value, groupNo.value)
 | 
	
		
			
				|  |  |          .then((res) => {
 | 
	
		
			
				|  |  | -            res.forEach(row => {
 | 
	
		
			
				|  |  | -                // 是否标记
 | 
	
		
			
				|  |  | -                row['isEdit'] = false
 | 
	
		
			
				|  |  | -                // 是否新增
 | 
	
		
			
				|  |  | -                row['isAdd'] = false
 | 
	
		
			
				|  |  | -            })
 | 
	
		
			
				|  |  | -            drugDictData.value = res
 | 
	
		
			
				|  |  | +          drugDictData.value = res
 | 
	
		
			
				|  |  |          })
 | 
	
		
			
				|  |  |          .catch(() => {
 | 
	
		
			
				|  |  |              drugDictData.value = []
 | 
	
	
		
			
				|  | @@ -192,30 +198,53 @@ const stopYpDict = (row) => {
 | 
	
		
			
				|  |  |          title = '请确认是否启用<span style="color:#d12020;">' + row.name + '</span>?'
 | 
	
		
			
				|  |  |      } else {
 | 
	
		
			
				|  |  |          delFlag = '1'
 | 
	
		
			
				|  |  | -        title = '请确认是否停用<span style="color:#d12020;">' + row.name + '</span>?'
 | 
	
		
			
				|  |  | +        title = '请确认是否停用<span style="color:#d12020;">(药房也全部停用)</span><span style="color:#d12020;">' + row.name + '</span>?'
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    ElMessageBox.confirm(title, {
 | 
	
		
			
				|  |  | -        cancelButtonText: '取消',
 | 
	
		
			
				|  |  | -        confirmButtonText: '确定',
 | 
	
		
			
				|  |  | -        type: 'warning',
 | 
	
		
			
				|  |  | -        distinguishCancelAndClose: true,
 | 
	
		
			
				|  |  | -        dangerouslyUseHTMLString: true
 | 
	
		
			
				|  |  | -    }).then(() => {
 | 
	
		
			
				|  |  | -        updateYpStopOrUsed(row.code, row.serial, delFlag).then((res) => {
 | 
	
		
			
				|  |  | -            ElMessage({
 | 
	
		
			
				|  |  | -                type: "success",
 | 
	
		
			
				|  |  | -                message: res.cg,
 | 
	
		
			
				|  |  | -                duration: 2500,
 | 
	
		
			
				|  |  | -                showClose: true,
 | 
	
		
			
				|  |  | -            });
 | 
	
		
			
				|  |  | -            queryYpDict()
 | 
	
		
			
				|  |  | +    // 查询停用药品是否存在库存
 | 
	
		
			
				|  |  | +    if('1' !== row.delFlag) {
 | 
	
		
			
				|  |  | +      selectYpStorageInfo(row.code, '').then((res) => {
 | 
	
		
			
				|  |  | +        ElMessageBox.confirm(res.msg, {
 | 
	
		
			
				|  |  | +          cancelButtonText: '取消',
 | 
	
		
			
				|  |  | +          confirmButtonText: '确定',
 | 
	
		
			
				|  |  | +          type: 'warning',
 | 
	
		
			
				|  |  | +          distinguishCancelAndClose: true,
 | 
	
		
			
				|  |  | +          dangerouslyUseHTMLString: true
 | 
	
		
			
				|  |  | +        }).then(() => {
 | 
	
		
			
				|  |  | +          callSaveYpDict(title, row, delFlag)
 | 
	
		
			
				|  |  | +        }).catch((action) => {
 | 
	
		
			
				|  |  | +          if (action === 'cancel') {
 | 
	
		
			
				|  |  | +             queryYpDict()
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  |          })
 | 
	
		
			
				|  |  | -    }).catch((action) => {
 | 
	
		
			
				|  |  | -        if (action === 'cancel') {
 | 
	
		
			
				|  |  | -            queryYpDict()
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | +      })
 | 
	
		
			
				|  |  | +    } else {
 | 
	
		
			
				|  |  | +      callSaveYpDict(title, row, delFlag)
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +const callSaveYpDict = (title, row, delFlag) => {
 | 
	
		
			
				|  |  | +  ElMessageBox.confirm(title, {
 | 
	
		
			
				|  |  | +    cancelButtonText: '取消',
 | 
	
		
			
				|  |  | +    confirmButtonText: '确定',
 | 
	
		
			
				|  |  | +    type: 'warning',
 | 
	
		
			
				|  |  | +    distinguishCancelAndClose: true,
 | 
	
		
			
				|  |  | +    dangerouslyUseHTMLString: true
 | 
	
		
			
				|  |  | +  }).then(() => {
 | 
	
		
			
				|  |  | +    updateYpStopOrUsed(row.code, row.serial, delFlag).then((res) => {
 | 
	
		
			
				|  |  | +      ElMessage({
 | 
	
		
			
				|  |  | +        type: "success",
 | 
	
		
			
				|  |  | +        message: res.cg,
 | 
	
		
			
				|  |  | +        duration: 2500,
 | 
	
		
			
				|  |  | +        showClose: true,
 | 
	
		
			
				|  |  | +      });
 | 
	
		
			
				|  |  | +      queryYpDict()
 | 
	
		
			
				|  |  |      })
 | 
	
		
			
				|  |  | +  }).catch((action) => {
 | 
	
		
			
				|  |  | +    if (action === 'cancel') {
 | 
	
		
			
				|  |  | +      queryYpDict()
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  })
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  // 设置成临购药品
 | 
	
	
		
			
				|  | @@ -276,27 +305,50 @@ const stopYkYpDict = (row) => {
 | 
	
		
			
				|  |  |          title = '请确认药库是否停用<span style="color:#d12020;">' + row.name + '</span>?'
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    ElMessageBox.confirm(title, {
 | 
	
		
			
				|  |  | -        cancelButtonText: '取消',
 | 
	
		
			
				|  |  | -        confirmButtonText: '确定',
 | 
	
		
			
				|  |  | -        type: 'warning',
 | 
	
		
			
				|  |  | -        distinguishCancelAndClose: true,
 | 
	
		
			
				|  |  | -        dangerouslyUseHTMLString: true
 | 
	
		
			
				|  |  | -    }).then(() => {
 | 
	
		
			
				|  |  | -        updateYkYpStopOrUsed(groupNo.value, row.code, row.serial, delFlag).then((res) => {
 | 
	
		
			
				|  |  | -            ElMessage({
 | 
	
		
			
				|  |  | -                type: "success",
 | 
	
		
			
				|  |  | -                message: res.cg,
 | 
	
		
			
				|  |  | -                duration: 2500,
 | 
	
		
			
				|  |  | -                showClose: true,
 | 
	
		
			
				|  |  | -            });
 | 
	
		
			
				|  |  | +    // 查询药库停用药品是否存在库存
 | 
	
		
			
				|  |  | +    if('1' !== row.ykFlag) {
 | 
	
		
			
				|  |  | +      selectYpStorageInfo(row.code, groupNo.value).then((res) => {
 | 
	
		
			
				|  |  | +        ElMessageBox.confirm(res.msg, {
 | 
	
		
			
				|  |  | +          cancelButtonText: '取消',
 | 
	
		
			
				|  |  | +          confirmButtonText: '确定',
 | 
	
		
			
				|  |  | +          type: 'warning',
 | 
	
		
			
				|  |  | +          distinguishCancelAndClose: true,
 | 
	
		
			
				|  |  | +          dangerouslyUseHTMLString: true
 | 
	
		
			
				|  |  | +        }).then(() => {
 | 
	
		
			
				|  |  | +          callYkYpStopOrUsed(title, row, delFlag)
 | 
	
		
			
				|  |  | +        }).catch((action) => {
 | 
	
		
			
				|  |  | +          if (action === 'cancel') {
 | 
	
		
			
				|  |  |              queryYpDict()
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  |          })
 | 
	
		
			
				|  |  | -    }).catch((action) => {
 | 
	
		
			
				|  |  | -        if (action === 'cancel') {
 | 
	
		
			
				|  |  | -            queryYpDict()
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | +      })
 | 
	
		
			
				|  |  | +    } else {
 | 
	
		
			
				|  |  | +      callYkYpStopOrUsed(title, row, delFlag)
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +const callYkYpStopOrUsed = (title, row, delFlag) => {
 | 
	
		
			
				|  |  | +  ElMessageBox.confirm(title, {
 | 
	
		
			
				|  |  | +    cancelButtonText: '取消',
 | 
	
		
			
				|  |  | +    confirmButtonText: '确定',
 | 
	
		
			
				|  |  | +    type: 'warning',
 | 
	
		
			
				|  |  | +    distinguishCancelAndClose: true,
 | 
	
		
			
				|  |  | +    dangerouslyUseHTMLString: true
 | 
	
		
			
				|  |  | +  }).then(() => {
 | 
	
		
			
				|  |  | +    updateYkYpStopOrUsed(groupNo.value, row.code, row.serial, delFlag).then((res) => {
 | 
	
		
			
				|  |  | +      ElMessage({
 | 
	
		
			
				|  |  | +        type: "success",
 | 
	
		
			
				|  |  | +        message: res.cg,
 | 
	
		
			
				|  |  | +        duration: 2500,
 | 
	
		
			
				|  |  | +        showClose: true,
 | 
	
		
			
				|  |  | +      });
 | 
	
		
			
				|  |  | +      queryYpDict()
 | 
	
		
			
				|  |  |      })
 | 
	
		
			
				|  |  | +  }).catch((action) => {
 | 
	
		
			
				|  |  | +    if (action === 'cancel') {
 | 
	
		
			
				|  |  | +      queryYpDict()
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  })
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  // 国家基本药物设置
 | 
	
	
		
			
				|  | @@ -333,12 +385,52 @@ const baseDrugConfirm = (row) => {
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      })
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +// 导出药品账页信息
 | 
	
		
			
				|  |  | +const exportData = () => {
 | 
	
		
			
				|  |  | +  if (drugDictData.value.length === 0) {
 | 
	
		
			
				|  |  | +    ElMessage({
 | 
	
		
			
				|  |  | +      message: "没有可以导出的数据!",
 | 
	
		
			
				|  |  | +      type: "warning",
 | 
	
		
			
				|  |  | +      duration: 2500,
 | 
	
		
			
				|  |  | +      showClose: true,
 | 
	
		
			
				|  |  | +    });
 | 
	
		
			
				|  |  | +  } else {
 | 
	
		
			
				|  |  | +    const title = {
 | 
	
		
			
				|  |  | +      code: "药品编码",
 | 
	
		
			
				|  |  | +      serial: "药品包装",
 | 
	
		
			
				|  |  | +      name: "药品名称",
 | 
	
		
			
				|  |  | +      specification: "药品规格",
 | 
	
		
			
				|  |  | +      packRetprice: "药品零售价",
 | 
	
		
			
				|  |  | +      manuFactory: '生产厂家',
 | 
	
		
			
				|  |  | +      delFlag: "状态",
 | 
	
		
			
				|  |  | +      ykFlag: "药库状态",
 | 
	
		
			
				|  |  | +      pyCode: "拼音码",
 | 
	
		
			
				|  |  | +      dCode: "五笔码",
 | 
	
		
			
				|  |  | +    };
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    const d = clone(drugDictData.value)
 | 
	
		
			
				|  |  | +    d.forEach(val => {
 | 
	
		
			
				|  |  | +      if (val.delFlag === '1') {
 | 
	
		
			
				|  |  | +        val.delFlag = '停用'
 | 
	
		
			
				|  |  | +      } else {
 | 
	
		
			
				|  |  | +        val.delFlag = ''
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +      if (val.ykFlag === '1') {
 | 
	
		
			
				|  |  | +        val.ykFlag = '药库停用'
 | 
	
		
			
				|  |  | +      } else {
 | 
	
		
			
				|  |  | +        val.ykFlag = ''
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    });
 | 
	
		
			
				|  |  | +    Export(d, title, "药品账页信息")
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  |  </script>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  <style lang="scss">
 | 
	
		
			
				|  |  |  .yp-edit-dialog {
 | 
	
		
			
				|  |  | -    .el-dialog__body {
 | 
	
		
			
				|  |  | -        padding: 2px 5px !important;
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | +  .el-dialog__body {
 | 
	
		
			
				|  |  | +    padding: 2px 5px !important;
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  </style>
 |