You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 lines
2.8 KiB

6 days ago
6 days ago
6 days ago
6 days ago
6 days ago
6 days ago
6 days ago
  1. <script setup lang="ts">
  2. import { addLog } from 'apis/log'
  3. import { editSols, getSolsList, saveSols } from 'apis/solution'
  4. import { userList as userListApi } from 'apis/user'
  5. import FtButton from 'components/common/FTButton/index.vue'
  6. import { FtMessage } from 'libs/message'
  7. import { useSystemStore } from 'stores/systemStore'
  8. import { inject, onMounted, ref } from 'vue'
  9. const props = defineProps({
  10. data: {
  11. type: Object,
  12. default: () => ({}),
  13. },
  14. })
  15. const emits = defineEmits(['ok', 'cancel'])
  16. const systemStore = useSystemStore()
  17. onMounted(async () => {
  18. await getUserList()
  19. await getSolutionList()
  20. })
  21. const form = ref<Log.LogItem>({})
  22. const formRef = ref()
  23. const rules = {
  24. name: [
  25. { required: true, message: '请输入溶液名称', trigger: 'blur' },
  26. ],
  27. }
  28. const userList = ref<User.User[]>([])
  29. const getUserList = async () => {
  30. userList.value = (await userListApi()).list
  31. }
  32. const solutionList = ref<Solution.SolutionItem[]>([])
  33. const getSolutionList = async () => {
  34. solutionList.value = (await getSolsList()).list
  35. }
  36. const okHandle = async () => {
  37. try {
  38. const valid = await formRef.value.validate()
  39. if (!valid) {
  40. return
  41. }
  42. const params = {
  43. ...form.value,
  44. channelCode: props.data.channelCode,
  45. }
  46. await addLog(params)
  47. FtMessage.success('保存成功')
  48. emits('ok', params)
  49. }
  50. catch (error) {
  51. console.log(error)
  52. }
  53. }
  54. const cancel = () => {
  55. emits('cancel')
  56. }
  57. const channelMap = {
  58. CHANNEL_1: '通道1',
  59. CHANNEL_2: '通道2',
  60. CHANNEL_3: '通道3',
  61. CHANNEL_4: '通道4',
  62. }
  63. </script>
  64. <template lang="pug">
  65. FtDialog(visible :title="`${channelMap[data?.channelCode]}-领取`" width="30%" :ok-handle="okHandle" @cancel="cancel")
  66. el-form(ref="formRef" label-width="auto" :model="form" :rules="rules")
  67. el-form-item(label="溶液名称" prop="solutionId")
  68. el-select(v-model="form.solutionId" placeholder="请选择溶液")
  69. el-option(v-for="item in solutionList" :key="item.id" :label="item.name" :value="item.id")
  70. el-form-item(label="溶液浓度" prop="concentration")
  71. ft-input(v-model="form.concentration" placeholder="请输入溶液浓度" layoutName="number")
  72. template(#append)
  73. span %
  74. el-form-item(label="发放人" prop="issuerId")
  75. el-select(v-model="form.issuerId" placeholder="请选择发放人")
  76. el-option(v-for="item in userList" :key="item.id" :label="item.nickname" :value="item.id")
  77. el-form-item(label="领取人" prop="receiverId")
  78. el-tag {{systemStore.systemStatus.currentUser.nickname}}
  79. el-form-item(label="容量" prop="receivedVolume")
  80. ft-input(v-model="form.receivedVolume" placeholder="请输入容量" layoutName="number")
  81. template(#append)
  82. span mL
  83. </template>
  84. <style lang="stylus" scoped>
  85. .el-tag
  86. margin-right 5px
  87. </style>