|
|
- <template>
- <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%">
- <SelectTable ref="selectSjRef" :columns="columns"
- :selectedId="selectedId"
- :searchForm="searchForm"
- :listApi="listApi"
- :selectedCode="selectedCode"
- @radioSelect="handleSelect"/>
- <template slot="footer" class="dialog-footer">
- <el-button @click="onCancel">{{$t('form.cancel')}}</el-button>
- <el-button :disabled="isDisabled" type="primary" @click="onSubmit">{{$t('form.saveConfirm')}}</el-button>
- </template>
- </el-dialog>
- </template>
-
- <script>
- import SelectTable from '@/components/Template/SelectTable.vue';
- import SelectDept from "@/views/business/comps/select/SelectDept";
- import { public_yqList } from '@/api/business/public/public';
- export default {
- name: "SelectInstrumentDialog",
- components: {
- SelectTable,
- SelectDept
- },
- props: {
- type: {
- type: String,
- default: "",
- },
- title: {
- type: String,
- default: "选择仪器",
- },
- selectedCode: {
- type: String,
- default: "bh",
- },
- searchForm: {
- type: Object,
- default: () => {
- return {
- mc: {
- label:'仪器名称',
- },
- bh: {
- label:'仪器编号',
- },
- ly: {
- label:'来源',
- },
- }
- },
- },
- columns: {
- type: Array,
- default: () => [
- {
- prop: 'mc',
- label: '仪器名称',
- },
- {
- prop: 'bh',
- label: '仪器编号',
- },
- {
- prop: 'ly',
- label: '来源(厂家)',
- },
- {
- prop: 'jzrq',
- label: '下次校准时间',
- },
- ],
- },
- },
- data() {
- return {
- visible:false,
- listApi:public_yqList,
- selectedId: "",
- currentRow: {},
- }
- },
- computed: {
- isDisabled() {
- return !this.selectedId;
- }
- },
- methods: {
- show(){
- this.visible=true
- setTimeout(() => {
- this.$refs.selectSjRef.show()
- }, 500);
- },
- onCancel() {
- this.visible = false
- this.$emit('cancel');
- },
- onSubmit() {
- let row = this.currentRow;
- this.$emit('change', this.selectedId,row);
- this.visible = false;
- },
- handleSelect(code,row) {
- this.selectedId = code;
- this.currentRow = row;
- },
- }
- }
- </script>
-
- <style lang="scss" scoped>
- .header-row{
- display: flex;
- align-items: center;
- padding: 20px 0;
- }
- </style>
|