|
@@ -1,36 +1,153 @@
|
|
|
<template>
|
|
|
- <div class="item_apply_container">
|
|
|
- <div class="item_apply_header">
|
|
|
- <el-select v-model="itemtype">
|
|
|
- <el-option label="医用耗材" value="medical"></el-option>
|
|
|
- <el-option label="后勤耗材" value="normal"></el-option>
|
|
|
+ <page-layer>
|
|
|
+ <template #header>
|
|
|
+ <el-select v-model="queryParams.type" style="width: 120px">
|
|
|
+ <el-option label="医用耗材" :value="1"></el-option>
|
|
|
+ <el-option label="后勤耗材" :value="2"></el-option>
|
|
|
</el-select>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ <el-divider direction="vertical"></el-divider>
|
|
|
+ 检索方式:
|
|
|
+ <el-select v-model="queryParams.method" style="width: 60px">
|
|
|
+ <el-option label="首拼" value="alpha"></el-option>
|
|
|
+ <el-option label="名称" value="name"></el-option>
|
|
|
+ </el-select>
|
|
|
+ <el-autocomplete v-model="queryParams.content" value-key="name" :fetch-suggestions="searchItem"
|
|
|
+ :trigger-on-focus="false" clearable style="width: 180px" @select="handleSelectItem"
|
|
|
+ placeholder="请输入关键字">
|
|
|
+ </el-autocomplete>
|
|
|
+ <el-divider direction="vertical"></el-divider>
|
|
|
+ <el-button type="primary" icon="Document" @click="inputSpecialRemark">特殊情况备注</el-button>
|
|
|
+ <el-button type="success" icon="Check" @click="beforeSubmitSupplies">提交</el-button>
|
|
|
+ <div style="margin-left: 12px; width: 200px;" class="ellipsis-text" :title="specialRemark">{{specialRemark}}</div>
|
|
|
+ </template>
|
|
|
+ <template #main>
|
|
|
+ <el-table :height="tableHeight" :data="queryParams.type === 1 ? medicalSupplies : normalSupplies"
|
|
|
+ stripe highlight-current-row ref="supplyRef">
|
|
|
+ <el-table-column prop="name" label="名称"></el-table-column>
|
|
|
+ <el-table-column label="规格">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-select v-if="scope.row.size" v-model="scope.row.size">
|
|
|
+ <el-option v-for="(size,index) in scope.row.sizes" :key="index"
|
|
|
+ :label="size.val" :value="size.val"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="数量">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-input v-model="scope.row.quantity" type="number" style="width: 80px"></el-input>
|
|
|
+ {{scope.row.unit}}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-button title="删除" @click="deleteRow(scope.$index)" circle type="danger" icon="Delete"></el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </template>
|
|
|
+ </page-layer>
|
|
|
</template>
|
|
|
|
|
|
-<script>
|
|
|
-import { ref } from 'vue'
|
|
|
-export default {
|
|
|
- setup() {
|
|
|
- const itemtype = ref('medical')
|
|
|
+<script setup>
|
|
|
+import PageLayer from "@/layout/PageLayer.vue";
|
|
|
+import {computed, ref} from 'vue'
|
|
|
+import {selectApplyItems,submitSupplies} from "@/api/utilities/item-apply";
|
|
|
+import store from "@/store";
|
|
|
+import {ElMessage, ElMessageBox} from "element-plus";
|
|
|
|
|
|
- return {
|
|
|
- itemtype,
|
|
|
- }
|
|
|
- },
|
|
|
+const windowSize = store.state.app.windowSize
|
|
|
+const tableHeight = windowSize.h - 15
|
|
|
+const supplyRef = ref(null)
|
|
|
+const queryParams = reactive({
|
|
|
+ type: 1,
|
|
|
+ method: 'alpha',
|
|
|
+ content: null,
|
|
|
+})
|
|
|
+
|
|
|
+const specialRemark = ref(null)
|
|
|
+
|
|
|
+const medicalSupplies = ref([])
|
|
|
+const normalSupplies = ref([])
|
|
|
+const selectedSuppliesIdList = ref([])
|
|
|
+
|
|
|
+const inputSpecialRemark = () => {
|
|
|
+ ElMessageBox.prompt('请输入特殊情况备注。', '提示', {
|
|
|
+ type: "warning",
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ inputPattern: /\S/,
|
|
|
+ inputErrorMessage: '请输入有效内容',
|
|
|
+ }).then(({value}) => {
|
|
|
+ specialRemark.value = value
|
|
|
+ }).catch(() => {
|
|
|
+ })
|
|
|
}
|
|
|
-</script>
|
|
|
|
|
|
-<style scoped>
|
|
|
-.item_apply_container {
|
|
|
- width: calc(100% - 40px);
|
|
|
- height: calc(100% - 20px);
|
|
|
- margin-left: 20px;
|
|
|
- margin-top: 10px;
|
|
|
- background: rgb(219, 219, 219);
|
|
|
+const searchItem = (queryString, cb) => {
|
|
|
+ selectApplyItems(queryParams).then(res => {
|
|
|
+ cb(res)
|
|
|
+ })
|
|
|
}
|
|
|
-.item_apply_header {
|
|
|
- padding: 4px;
|
|
|
+
|
|
|
+const handleSelectItem = (item) => {
|
|
|
+ if (selectedSuppliesIdList.value.indexOf(item.id) > -1) {
|
|
|
+ ElMessage({
|
|
|
+ message: '已有相同物品存在,请勿重复添加。',
|
|
|
+ type: 'warning',
|
|
|
+ duration: 2000,
|
|
|
+ showClose: true
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ item.size = item.sizes.length > 0 ? item.sizes[0].val : null;
|
|
|
+ queryParams.type === 1 ? medicalSupplies.value.push(item) : normalSupplies.value.push(item)
|
|
|
+ selectedSuppliesIdList.value.push(item.id)
|
|
|
+ queryParams.content = null
|
|
|
+ supplyRef.value.setCurrentRow(item)
|
|
|
+}
|
|
|
+
|
|
|
+const deleteRow = (index) => {
|
|
|
+ queryParams.type === 1 ? medicalSupplies.value.splice(index, 1)
|
|
|
+ : normalSupplies.value.splice(index, 1)
|
|
|
}
|
|
|
-</style>
|
|
|
+
|
|
|
+const beforeSubmitSupplies = () => {
|
|
|
+ if (selectedSuppliesIdList.value.length === 0) {
|
|
|
+ ElMessage({
|
|
|
+ message: '没有可以提交的物品,请添加后再提交。',
|
|
|
+ type: 'warning',
|
|
|
+ duration: 2000,
|
|
|
+ showClose: true
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ ElMessageBox.confirm('提交后不可撤回,是否确认提交?', '提示', {
|
|
|
+ type: 'warning',
|
|
|
+ confirmButtonText: '提交',
|
|
|
+ }).then(() => {
|
|
|
+ executeSubmit()
|
|
|
+ }).catch(() => {})
|
|
|
+}
|
|
|
+
|
|
|
+const userInfo = computed(() => {
|
|
|
+ return store.getters['user/info']
|
|
|
+})
|
|
|
+const executeSubmit = () => {
|
|
|
+ const body = {
|
|
|
+ specialRemark: specialRemark.value,
|
|
|
+ userName: userInfo.value.name,
|
|
|
+ codeRs: userInfo.value.codeRs,
|
|
|
+ deptName: userInfo.value.deptName,
|
|
|
+ supplies: queryParams.type === 1 ? medicalSupplies.value : normalSupplies.value
|
|
|
+ };
|
|
|
+ submitSupplies(body).then(() => {
|
|
|
+ ElMessage({
|
|
|
+ message: '提交成功。',
|
|
|
+ type: 'success',
|
|
|
+ duration: 2000,
|
|
|
+ showClose: true
|
|
|
+ })
|
|
|
+ })
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|