华西海圻ELN前端工程
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.

119 lines
3.2 KiB

  1. <template>
  2. <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :title="$t(title)" @close="onCancel" :visible.sync="visible" append-to-body width="80%">
  3. <SelectTable ref="selectSjRef" :columns="columns"
  4. :selectedId="selectedId"
  5. :searchForm="searchForm"
  6. :listApi="listApi"
  7. :selectedCode="selectedCode"
  8. @radioSelect="handleSelect"/>
  9. <template slot="footer" class="dialog-footer">
  10. <el-button @click="onCancel">{{$t('form.cancel')}}</el-button>
  11. <el-button :disabled="isDisabled" type="primary" @click="onSubmit">{{$t('form.saveConfirm')}}</el-button>
  12. </template>
  13. </el-dialog>
  14. </template>
  15. <script>
  16. import SelectTable from '@/components/Template/SelectTable.vue';
  17. import SelectDept from "@/views/business/comps/select/SelectDept";
  18. import { public_yqList } from '@/api/business/public/public';
  19. export default {
  20. name: "SelectInstrumentDialog",
  21. components: {
  22. SelectTable,
  23. SelectDept
  24. },
  25. props: {
  26. type: {
  27. type: String,
  28. default: "",
  29. },
  30. title: {
  31. type: String,
  32. default: "选择仪器",
  33. },
  34. selectedCode: {
  35. type: String,
  36. default: "bh",
  37. },
  38. searchForm: {
  39. type: Object,
  40. default: () => {
  41. return {
  42. mc: {
  43. label:'仪器名称',
  44. },
  45. bh: {
  46. label:'仪器编号',
  47. },
  48. ly: {
  49. label:'来源',
  50. },
  51. }
  52. },
  53. },
  54. columns: {
  55. type: Array,
  56. default: () => [
  57. {
  58. prop: 'mc',
  59. label: '仪器名称',
  60. },
  61. {
  62. prop: 'bh',
  63. label: '仪器编号',
  64. },
  65. {
  66. prop: 'ly',
  67. label: '来源(厂家)',
  68. },
  69. {
  70. prop: 'jzrq',
  71. label: '下次校准时间',
  72. },
  73. ],
  74. },
  75. },
  76. data() {
  77. return {
  78. visible:false,
  79. listApi:public_yqList,
  80. selectedId: "",
  81. currentRow: {},
  82. }
  83. },
  84. computed: {
  85. isDisabled() {
  86. return !this.selectedId;
  87. }
  88. },
  89. methods: {
  90. show(){
  91. this.visible=true
  92. setTimeout(() => {
  93. this.$refs.selectSjRef.show()
  94. }, 500);
  95. },
  96. onCancel() {
  97. this.visible = false
  98. this.$emit('cancel');
  99. },
  100. onSubmit() {
  101. let row = this.currentRow;
  102. this.$emit('change', this.selectedId,row);
  103. this.visible = false;
  104. },
  105. handleSelect(code,row) {
  106. this.selectedId = code;
  107. this.currentRow = row;
  108. },
  109. }
  110. }
  111. </script>
  112. <style lang="scss" scoped>
  113. .header-row{
  114. display: flex;
  115. align-items: center;
  116. padding: 20px 0;
  117. }
  118. </style>