YpPlanInfo.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412
  1. <template>
  2. <div class="layout_container">
  3. <header>
  4. <el-input v-model="fileText" class="w-50 m-2" style="width: 220px" placeholder="请输入文件id或者名称" clearable>
  5. </el-input>
  6. <el-select v-model="ztFlag" placeholder="请选择审核进度" clearable style="width: 140px;margin-left: 3px">
  7. <el-option v-for="item in ztOptions" :key="item.value" :label="item.label" :value="item.value">
  8. </el-option>
  9. </el-select>
  10. <el-date-picker v-model="dateRange" type="daterange" :shortcuts="maxHalfYear" range-separator="至"
  11. start-placeholder="开始时间" end-placeholder="结束时间" style="width: 260px;margin-left: 3px">
  12. </el-date-picker>
  13. <el-button type="primary" icon="Search" @click="queryYpPlanInfoData" style="margin-left: 5px">查询
  14. </el-button>
  15. <!-- <el-button type="primary" icon="Download" @click="exportData" style="margin-left: 5px">导出</el-button>-->
  16. </header>
  17. <div class="layout_main">
  18. <el-tabs class="el-tabs__fill" v-model="editableTabsValue" type="border-card" @tab-click="handleClick">
  19. <el-tab-pane key="ypPlanInfo" label="明细" name="ypPlanInfo">
  20. <div class="layout_container">
  21. <div class="layout_main layout_el-table">
  22. <el-table :data="ypPlanInfoData.slice(pageSize * (currentPage - 1), pageSize * currentPage)" border
  23. stripe highlight-current-row @row-dblclick="queryYpPlanDetail">
  24. <el-table-column type="index" label="序号" width="60" fixed/>
  25. <el-table-column prop="fileId" label="id" width="120" fixed/>
  26. <el-table-column prop="fileName" label="名称" width="220" show-overflow-tooltip fixed/>
  27. <el-table-column prop="totalFee" label="总价" width="120"/>
  28. <el-table-column prop="applyName" label="申请人" width="100"/>
  29. <el-table-column prop="applyDate" label="申请时间" width="140"/>
  30. <el-table-column prop="trialAudit" label="初审" width="100">
  31. <template #default="scope">
  32. <span v-if="scope.row.trialAudit === '1'">审核通过</span>
  33. <span v-else>未审核</span>
  34. </template>
  35. </el-table-column>
  36. <el-table-column prop="reviewAudit" label="复审" width="100">
  37. <template #default="scope">
  38. <span v-if="scope.row.reviewAudit === '1'">审核通过</span>
  39. <span v-else>未审核</span>
  40. </template>
  41. </el-table-column>
  42. <el-table-column prop="finalAudit" label="终审" width="100">
  43. <template #default="scope">
  44. <span v-if="scope.row.finalAudit === '1'">审核通过</span>
  45. <span v-else>未审核</span>
  46. </template>
  47. </el-table-column>
  48. <el-table-column prop="applyContent" label="药库负责人意见" width="200" show-overflow-tooltip/>
  49. <el-table-column prop="trialName" label="初审人" width="100"/>
  50. <el-table-column prop="trialContent" label="药剂科主任意见" width="200" show-overflow-tooltip/>
  51. <el-table-column prop="reviewName" label="复审人" width="100"/>
  52. <el-table-column prop="reviewContent" label="主管会计复审意见" width="200" show-overflow-tooltip/>
  53. <el-table-column prop="finalName" label="终审人" width="100"/>
  54. <el-table-column prop="finalContent" label="行政中心主任终审意见" width="200" show-overflow-tooltip/>
  55. <el-table-column fixed="right" label="操作" min-width="180" width="180" header-align="center" align="center">
  56. <template #default="scope">
  57. <el-button type="primary" size="small" @click="trialAuditPlan(scope.row)">初审
  58. </el-button>
  59. <el-button type="primary" size="small" @click="reviewAuditPlan(scope.row)">复审
  60. </el-button>
  61. <el-button type="primary" size="small" @click="finalAuditPlan(scope.row)">终审
  62. </el-button>
  63. </template>
  64. </el-table-column>
  65. </el-table>
  66. </div>
  67. <div>
  68. <el-pagination :current-page="currentPage" :page-size="pageSize" :page-sizes="[15, 30, 45, 60]"
  69. :total="ypPlanInfoData.length" layout="total, sizes, prev, pager, next, jumper"
  70. style="margin-top: 5px" @size-change="handleSizeChange"
  71. @current-change="handleCurrentChange">
  72. </el-pagination>
  73. </div>
  74. </div>
  75. <el-dialog v-model="showYpPlanDetails" :close-on-click-modal="false" :before-close="handleClose"
  76. :close-on-press-escape="false" :title="ypPlanDetailsTitle" width="80%" destroy-on-close>
  77. <YpPlanDetails :ypPlanDetails="ypPlanDetails" @closeYpPlanDetails="closeYpPlanDetails"/>
  78. </el-dialog>
  79. <el-dialog v-model="dialogFormVisible" title="审核" width="80%" :close-on-click-modal="false" top="6vh" :close-on-press-escape="false" destroy-on-close>
  80. <YpPlanDetails :ypPlanDetails="ypPlanDetails" :formData="formData" :zfy="zfy" @closeYpPlanDetails="closeYpPlanDetails"/>
  81. </el-dialog>
  82. </el-tab-pane>
  83. <el-tab-pane key="ypPlan" label="导入" name="ypPlan">
  84. <el-form ref="ruleFormRef" :model="ruleForm" :rules="rules" label-width="120px"
  85. class="demo-ruleForm" :size="formSize" status-icon>
  86. <el-row>
  87. <el-col :span="6">
  88. <el-form-item label="ID" prop="fileId">
  89. <el-input v-model="ruleForm.fileId" maxlength="12" show-word-limit placeholder="年月+第几次:例如20250201"/>
  90. </el-form-item>
  91. </el-col>
  92. <el-col :span="6">
  93. <el-form-item label="名称" prop="fileName">
  94. <el-input v-model="ruleForm.fileName" maxlength="60" show-word-limit placeholder="名称"/>
  95. </el-form-item>
  96. </el-col>
  97. <el-col :span="6">
  98. <el-form-item label="药库意见" prop="applyContent">
  99. <el-input v-model="ruleForm.applyContent" maxlength="60" show-word-limit placeholder="药库意见"/>
  100. </el-form-item>
  101. </el-col>
  102. <el-col :span="6">
  103. <el-form-item label="类别" prop="fileType">
  104. <el-select v-model="ruleForm.fileType" placeholder="请选择类别" clearable style="width: 100%">
  105. <el-option v-for="item in typeList" :key="item.value" :label="item.label" :value="item.value">
  106. <span style="float: left">{{ item.label }}</span>
  107. <span style="float: right; color: var(--el-text-color-secondary); font-size: 13px;">
  108. {{ item.value }}
  109. </span>
  110. </el-option>
  111. </el-select>
  112. </el-form-item>
  113. </el-col>
  114. </el-row>
  115. <el-row>
  116. <el-col :span="6" style="margin-left: 60px">
  117. <div style="margin-top: 10px">
  118. <el-upload
  119. class="upload-demo"
  120. ref="upload"
  121. accept=".xlsx,.xls"
  122. :action="apiUrl + '/ypPlan/saveYpPlanFile'"
  123. :headers="header"
  124. :file-list="fileList"
  125. :limit="1"
  126. :data="ruleForm"
  127. :on-exceed="fileSizeOutLimit"
  128. :on-success="uploadSuccess"
  129. :on-error="uploadError"
  130. :auto-upload="false"
  131. >
  132. <template #trigger>
  133. <el-button type="primary" icon="Picture">选取文件</el-button>
  134. </template>
  135. <el-button style="margin-left: 10px" type="success" icon="Upload" @click="submitUpload(ruleFormRef)">上传</el-button>
  136. <el-button type="info" @click="resetForm(ruleFormRef)">重置</el-button>
  137. <template #tip>
  138. <div class="el-upload__tip">
  139. 只能上传 xls/xlsx 文件,且同时只能上传一个文件
  140. </div>
  141. </template>
  142. </el-upload>
  143. </div>
  144. </el-col>
  145. </el-row>
  146. </el-form>
  147. </el-tab-pane>
  148. </el-tabs>
  149. </div>
  150. </div>
  151. </template>
  152. <script setup>
  153. import {useUserStore} from '@/pinia/user-store'
  154. import {nextTick, onMounted, ref} from "vue";
  155. import {formatDatetime, formatYear, getDateRangeFormatDate} from "@/utils/date.js";
  156. import {maxHalfYear} from "@/data/shortcuts.js";
  157. import {ElMessage} from "element-plus";
  158. import {selectYpPlanInfo, selectYpPlanDetailById, saveYpPlanFile, updateYpPlanAuditData} from "@/api/yp-inventory/yp-plan-info.js";
  159. import env from "@/utils/setting";
  160. import YpPlanDetails from "@/views/yp-inventory/YpPlanDetails.vue";
  161. const userInfo = useUserStore().userInfo
  162. const apiUrl = env.VITE_BASE_URL
  163. const upload = ref()
  164. const fileList = ref([])
  165. const header = {
  166. token: useUserStore().getToken,
  167. };
  168. const fileSizeOutLimit = () => {
  169. ElMessage.error("已经选取excel,如须更换请先移除已选取的excel!");
  170. };
  171. const uploadSuccess = (response, file, fileList) => {
  172. if(!response.success){
  173. ElMessage.error(response.message)
  174. } else {
  175. ElMessage.success("上传成功!");
  176. }
  177. };
  178. const uploadError = () => {
  179. ElMessage.error("上传失败!");
  180. };
  181. const editableTabsValue = ref('ypPlanInfo')
  182. const userCode = userInfo.code
  183. const userName = userInfo.name
  184. const ypPlanInfoData = ref([])
  185. const fileText = ref('')
  186. const chargeCode = ref('')
  187. const ztFlag = ref('')
  188. const dateRange = ref([])
  189. const now = formatDatetime(new Date())
  190. const start = formatDatetime(maxHalfYear[2].value[0])
  191. const end = formatDatetime(maxHalfYear[2].value[1])
  192. const pageSize = ref(30)
  193. const currentPage = ref(1)
  194. const handleSizeChange = (val) => {
  195. pageSize.value = val
  196. }
  197. const handleCurrentChange = (val) => {
  198. currentPage.value = val
  199. }
  200. const handleClick = (tab, event) => {
  201. editableTabsValue.value = tab.props.name
  202. if (editableTabsValue.value === 'ypPlanInfo') {
  203. queryYpPlanInfoData()
  204. }
  205. }
  206. const ztOptions = [
  207. {value: '1', label: '已初审'}, {value: '2', label: '未初审'}, {value: '3', label: '已复审'},
  208. {value: '4', label: '未复审'}, {value: '5', label: '已终审'}, {value: '6', label: '未终审'}]
  209. const typeList = [{value: '1', label: '普通药品'}, {value: '2', label: '大输液'},{value: '3', label: '麻精药品'},{value: '4', label: '其他药品'}]
  210. const queryData = ref({
  211. fileId: '',
  212. fileType: '',
  213. startTime: '',
  214. endTime: '',
  215. })
  216. onMounted(() => {
  217. nextTick(() => {
  218. queryData.startTime = start;
  219. queryData.endTime = end + " 23:59:59";
  220. dateRange.value = [start, end];
  221. queryYpPlanInfoData()
  222. })
  223. })
  224. const formSize = ref('default')
  225. const ruleFormRef = ref()
  226. const ruleForm = ref({
  227. fileId: '', // 文件id
  228. fileName: '', // 文件名称
  229. fileType: '', // 文件类型
  230. applyDate: now, // 申请日期
  231. applyId: '', // 申请人id
  232. applyName: '', // 申请人
  233. applyContent: '', // 申请人意见
  234. })
  235. const rules = ref({
  236. fileType: [
  237. {required: true, message: '请选择文件类型', trigger: 'change'},
  238. ],
  239. fileId: [
  240. {required: true, message: '请填写文件ID', trigger: 'blur'},
  241. ],
  242. fileName: [
  243. {required: true, message: '请填写文件名称', trigger: 'blur'},
  244. ],
  245. fileList: [
  246. {required: true, message: '请选择文件', trigger: 'blur'},
  247. ],
  248. })
  249. const submitUpload = async (formEl) => {
  250. if (!formEl) return
  251. await formEl.validate((valid, fields) => {
  252. if (valid) {
  253. nextTick(() => {
  254. upload.value.submit();
  255. });
  256. } else {
  257. console.log('error submit!', fields)
  258. }
  259. })
  260. }
  261. const submitForm = async (formEl) => {
  262. if (!formEl) return
  263. await formEl.validate((valid, fields) => {
  264. if (valid) {
  265. saveYpPlanFile(ruleForm.value).then((res) => {
  266. if (res.cg) {
  267. ElMessage({
  268. type: "success",
  269. message: res.cg,
  270. duration: 2500,
  271. showClose: true,
  272. });
  273. formEl.resetFields()
  274. editableTabsValue.value = 'ypPlanInfo'
  275. queryYpPlanInfoData()
  276. }
  277. });
  278. } else {
  279. console.log('error submit!', fields)
  280. }
  281. })
  282. }
  283. const resetForm = (formEl) => {
  284. if (!formEl) return
  285. formEl.resetFields()
  286. }
  287. const queryYpPlanInfoData = () => {
  288. if (dateRange.value) {
  289. let dateS = getDateRangeFormatDate(dateRange.value)
  290. queryData.value.startTime = dateS.startTime
  291. queryData.value.endTime = dateS.endTime
  292. }
  293. queryData.value.fileId = fileText.value
  294. queryData.value.ztFlag = ztFlag.value
  295. selectYpPlanInfo(queryData.value)
  296. .then((res) => {
  297. ypPlanInfoData.value = res
  298. })
  299. .catch(() => {
  300. ypPlanInfoData.value = []
  301. })
  302. }
  303. const ypPlanDetails = ref([]);
  304. const ypPlanDetailsTitle = ref('药品计划申请与审核明细')
  305. const showYpPlanDetails = ref(false);
  306. const queryYpPlanDetail = (row) => {
  307. let data = {
  308. fileId: row.fileId,
  309. }
  310. selectYpPlanDetailById(data)
  311. .then((res) => {
  312. ypPlanDetails.value = res;
  313. // showYpPlanDetails.value = true;
  314. })
  315. .catch(() => {
  316. ypPlanDetails.value = []
  317. });
  318. }
  319. const closeYpPlanDetails = (flag) => {
  320. if (flag) {
  321. showYpPlanDetails.value = false
  322. }
  323. queryYpPlanInfoData()
  324. }
  325. const handleClose = (done) => {
  326. queryYpPlanInfoData()
  327. done()
  328. }
  329. const dialogFormVisible = ref(false)
  330. const formData = ref({
  331. fileId: '', // 审核计划id
  332. content: '', // 审核意见
  333. trialAudit: '',
  334. reviewAudit: '',
  335. finalAudit: '',
  336. type: 0, // 审核类型(1:初审,2:复审,3:终审)
  337. })
  338. const zfy = ref(0)
  339. // 审核
  340. const trialAuditPlan = (row) => {
  341. formData.value = {}
  342. if(row.reviewAudit === '1' || row.finalAudit === '1'){
  343. ElMessage({
  344. type: "error",
  345. message: '已经复审或者终审,无法再进行初审!',
  346. duration: 2500,
  347. showClose: true,
  348. });
  349. return false
  350. }
  351. formData.value.fileId = row.fileId
  352. formData.value.type = 1
  353. formData.value.trialAudit = '1'
  354. zfy.value = row.totalFee
  355. dialogFormVisible.value = true
  356. queryYpPlanDetail(row)
  357. }
  358. const reviewAuditPlan = (row) => {
  359. formData.value = {}
  360. if(row.finalAudit === '1'){
  361. ElMessage({
  362. type: "error",
  363. message: '已经终审,无法再进行复审!',
  364. duration: 2500,
  365. showClose: true,
  366. });
  367. return false
  368. }
  369. if(row.trialAudit !== '1'){
  370. ElMessage({
  371. type: "error",
  372. message: '还未初审,无法进行复审!',
  373. duration: 2500,
  374. showClose: true,
  375. });
  376. return false
  377. }
  378. dialogFormVisible.value = true
  379. formData.value.fileId = row.fileId
  380. formData.value.type = 2
  381. formData.value.reviewAudit = '1'
  382. zfy.value = row.totalFee
  383. queryYpPlanDetail(row)
  384. }
  385. const finalAuditPlan = (row) => {
  386. formData.value = {}
  387. dialogFormVisible.value = true
  388. formData.value.fileId = row.fileId
  389. formData.value.type = 3
  390. formData.value.finalAudit = '1'
  391. zfy.value = row.totalFee
  392. queryYpPlanDetail(row)
  393. }
  394. </script>
  395. <style scoped>
  396. :deep(.my-header) {
  397. display: flex;
  398. flex-direction: row;
  399. justify-content: space-between;
  400. gap: 16px;
  401. }
  402. </style>