<template>
  <el-dialog
    title="批量填报"
    append-to-body
    :modelValue="openShow"
    width="100%"
    fullscreen
    @close="closeDialog"
  >
    <avue-crud
      :option="option"
      :table-loading="loading"
      :data="data"
      v-model:page="page"
      v-model="form"
      ref="crud"
      @row-update="rowUpdate"
      @row-save="rowSave"
      @row-del="rowDel"
      @search-change="searchChange"
      @search-reset="searchReset"
      @selection-change="selectionChange"
      @current-change="currentChange"
      @size-change="sizeChange"
      @refresh-change="refreshChange"
      @on-load="onLoad"
    >
      <template #meterNum="scope">
        <div class="inpu-text"><el-input v-model="input" /><i>(单位)</i></div>
      </template>
      <template #needAdd="scope">
        <div class="inpu-text"><el-input v-model="input" /><i>(单位)</i></div>
      </template>
      <template #actualAdd>
        <div class="inpu-text"><el-input v-model="input" /><i>(单位)</i></div>
      </template>
      <template #fuceceliangzhi>
        <div class="inpu-text"><el-input v-model="input" /><i>(单位)</i></div>
      </template>
    </avue-crud>
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="closeDialog">取 消</el-button>
        <el-button type="primary" @click="submit">确 定</el-button>
      </span>
    </template>
  </el-dialog>
</template>
<script>
export default {
    props: {
        showDialog: {
            type: Boolean,
            default: false
        },
    },
    data() {
        return {
            openShow: false,
            page: {
                pageSize: 10,
                currentPage: 1,
                total: 0,
            },
            option: {
                page: false, // 关闭分页
                height: 'auto',
                addRowBtn: true,
                tip: false,
                calcHeight: 50,
                searchShow: true,
                searchMenuSpan: 6,
                searchIcon: true,
                searchIndex: 3,
                columnSort: true,
                tree: false,
                border: true,
                index: true,
                selection: false,
                viewBtn: false,
                delBtn: false,
                addBtn: false,
                editBtn: false,
                editBtnText: '修改',
                viewBtnText: '详情',
                addBtnIcon: ' ',
                viewBtnIcon: ' ',
                delBtnIcon: ' ',
                editBtnIcon: ' ',
                labelWidth: 120,
                // menuWidth: 330,
                dialogWidth: 600,
                dialogClickModal: false,
                searchEnter: true,
                filterBtn: true,
                searchShowBtn: false,
                excelBtn: true,
                showOverflowTooltip: true,
                align: 'center',
                menu: false,
                header: false,
                searchLabelPosition: 'left',
                searchLabelPosition: 'left',
                searchGutter: 24,
                searchSpan: 6,
                menuAlign: 'left',
                gridBtn: false,
                searchMenuPosition: 'right',
                column: [
                    {
                        label: '任务号',
                        prop: 'taskNum',
                        sortable: true,
                        filter: true,
                        span: 24,
                        search: false,
                        width: 110

                    },
                    {
                        label: '作业中心',
                        prop: 'wcName',
                        bind: 'bsWorkCenter.wcName',
                        sortable: true,
                        filter: true,
                        span: 24,
                        search: false,
                        width: 110,
                        dicUrl: '/blade-desk/bsWorkCenter/getList',
                        props: {
                            label: 'wcName',
                            value: 'id',
                        },
                    },
                    {
                        label: '作业槽',
                        prop: 'slotNo',
                        search: false,
                        sortable: true,
                        filter: true,
                        span: 24,
                        width: 120

                    },
                    {
                        label: '分析项目',
                        prop: 'testEle',
                        type: 'textarea',
                        search: false,
                        sortable: true,
                        filter: true,
                        span: 24,
                        width: 110

                    },

                    {
                        label: '药品名称',
                        prop: 'drugName',
                        sortable: true,
                        filter: true,
                        span: 24,
                        search: false,
                        width: 110

                    },
                    {
                        label: '药品物料号',
                        prop: 'drugMatterCode',
                        sortable: true,
                        filter: true,
                        span: 24,
                        search: false,
                        width: 120
                    },
                    {
                        label: '药品物料名称',
                        prop: 'drugMatterName',
                        sortable: true,
                        filter: true,
                        span: 24,
                        search: false,
                        width: 140

                    },
                    {
                        label: '规范上下限',
                        prop: 'bound',
                        sortable: true,
                        filter: true,
                        span: 24,
                        search: false,
                        width: 140

                    },
                    {
                        label: '目标上下限',
                        prop: 'bound',
                        sortable: true,
                        filter: true,
                        span: 24,
                        search: false,
                        width: 140

                    },
                    {
                        label: '温度',
                        prop: 'proContent',
                        sortable: true,
                        filter: true,
                        span: 24,
                        search: false,
                        width: 110

                    },
                    {
                        label: 'PH值',
                        prop: 'proContent',
                        sortable: true,
                        filter: true,
                        span: 24,
                        search: false,
                        width: 110

                    },
                    {
                        label: '目标值',
                        prop: 'targetValue',
                        sortable: true,
                        filter: true,
                        span: 24,
                        search: false,
                        width: 110

                    },
                    {
                        label: '添加点',
                        prop: 'addPoints',
                        sortable: true,
                        filter: true,
                        span: 24,
                        search: false,
                        width: 110

                    },
                    {
                        label: '测量值',
                        prop: 'meterNum',
                        sortable: true,
                        filter: true,
                        span: 24,
                        search: false,
                        width: 170,
                        // cell: true,

                    },
                    {
                        label: '是否合格',
                        prop: 'proContent',
                        sortable: true,
                        filter: true,
                        span: 24,
                        search: false,
                        width: 110

                    },
                    {
                        label: '电导率测量值',
                        prop: 'condNum',

                        sortable: true,
                        filter: true,
                        span: 24,
                        search: false,
                        width: 140,
                        cell: true,

                    },
                    {
                        label: '实测温度',
                        prop: 'proContent',
                        sortable: true,
                        filter: true,
                        span: 24,
                        search: false,
                        width: 110,
                        cell: true,

                    },
                    {
                        label: '实测PH值',
                        prop: 'proContent',
                        sortable: true,
                        filter: true,
                        span: 24,
                        search: false,
                        width: 110,
                        cell: true,

                    },
                    {
                        label: '体积',
                        prop: 'volume',
                        sortable: true,
                        filter: true,
                        span: 24,
                        search: false,

                    },

                    {
                        label: '需添加量',
                        prop: 'needAdd',
                        sortable: true,
                        filter: true,
                        span: 24,
                        search: false,
                        width: 200,
                    },
                    {
                        label: '实际添加量',
                        prop: 'actualAdd',
                        sortable: true,
                        filter: true,
                        span: 24,
                        search: false,
                        width: 170,
                        // cell: true,
                    },
                    {
                        label: '加药后理论值',
                        prop: 'addContent',
                        sortable: true,
                        filter: true,
                        span: 24,
                        search: false,
                        width: 150,
                        cell: true,
                    },
                    {
                        label: '化验时间',
                        prop: 'lastTest',
                        sortable: true,
                        filter: true,
                        span: 24,
                        search: false,
                        width: 170,
                        cell: true,
                        type: 'datetime',

                    },
                    {
                        label: '复测测量值',
                        prop: 'fuceceliangzhi',
                        sortable: true,
                        filter: true,
                        span: 24,
                        search: false,
                        width: 200,

                    },
                    {
                        label: '复测电导率测量值',
                        prop: 'unit',
                        sortable: true,
                        filter: true,
                        span: 24,
                        search: false,
                        width: 220,
                        cell: true

                    },

                ]
            },
        }
    },
    mounted() {
        this.openShow = this.showDialog
    },
    methods: {
        closeDialog() {
            this.openShow = false
            this.$emit('closeDialog');
        },
        onLoad() {
            this.loading = true
            this.data = [
                {
                    $cellEdit: true,
                    id: '6',
                    taskCode: 'CYSYXXXXXXXXX',
                    slotNo: '#25', wcName: '化学镀镍作业中心', testEle: '氰化钠',
                    proContent: 32,
                    targetValue: 40,
                    targetLowerLimit: 4,
                    drugMatterCode: 'XXXX',
                    drugName: 'XXXX',
                    addPoints: 45,
                    drugMatterName: "XXXX",
                    targetUpperLimit: 45,
                    testMan: {
                        userId: '',
                        userName: '张三',
                        testEle: '张三'
                    }, taskMethod: 1, taskMethodName: '需求生成',
                    status: 0,
                    statusName: '待接收',
                    taskTime: '2025-01-22 12:23:35',
                    testTime: '2025-01-22',
                    needAdd: 444,
                    actualAdd: 444,
                    initialInspectionTime: '2025-01-23 11:12:23',
                    finishTime: '',
                    finishReason: '',
                    meterNum: 32,
                    condNum: 181,
                    auditResult: 1,
                    auditResultName: '审核通过',
                    auditOpinion: '审核通过',
                    auditUser: '张三',
                    auditTime: '2025-01-25 15:33:26',
                    drugBatch: '1002',
                    drugRecipient: '',
                    drugRecipientName: '张三',
                    drugTime: '2025-01-25 11:23:56',
                    meterNumTwo: 32,
                    condNumTwo: 32,
                    recheckUser: '李四',
                    recheckTime: '2025-01-26 11:23:23',
                    recheckSubmit: '2025-01-26 11:23:23'
                },
                {
                    $cellEdit: true,
                    id: '1',
                    taskCode: 'CYSYXXXXXXXXX',
                    slotNo: '#21', wcName: '化学镀镍作业中心', testEle: '氰化钠',
                    proContent: 32,
                    targetValue: 40,
                    targetLowerLimit: 4,
                    drugMatterCode: 'XXXX',
                    drugName: 'XXXX',
                    addPoints: 45,
                    drugMatterName: "XXXX",
                    targetUpperLimit: 45,
                    testMan: {
                        userId: '',
                        userName: '张三',
                        testEle: '张三'
                    }, taskMethod: 1, taskMethodName: '周期生成',
                    status: 1,
                    statusName: '待检测',
                    taskTime: '2025-01-22 12:23:35',
                    testTime: '2025-01-22',
                    needAdd: 444,
                    actualAdd: 444,
                    initialInspectionTime: '2025-01-23 11:12:23',
                    finishTime: '',
                    finishReason: '',
                    meterNum: 32,
                    condNum: 181,
                    auditResult: 1,
                    auditResultName: '审核通过',
                    auditOpinion: '审核通过',
                    auditUser: '张三',
                    auditTime: '2025-01-25 15:33:26',
                    drugBatch: '1002',
                    drugRecipient: '',
                    drugRecipientName: '张三',
                    drugTime: '2025-01-25 11:23:56',
                    meterNumTwo: 32,
                    condNumTwo: 32,
                    recheckUser: '李四',
                    recheckTime: '2025-01-26 11:23:23',
                    recheckSubmit: '2025-01-26 11:23:23'
                },
                {
                    $cellEdit: true,
                    id: '2',
                    taskCode: 'CYSYXXXXXXXXX',
                    slotNo: '#22', wcName: '化学镀镍作业中心', testEle: '氰化钠',
                    proContent: 32,
                    targetValue: 40,
                    targetLowerLimit: 4,
                    drugMatterCode: 'XXXX',
                    drugName: 'XXXX',
                    addPoints: 45,
                    drugMatterName: "XXXX",
                    targetUpperLimit: 45,
                    testMan: {
                        userId: '',
                        userName: '张三',
                        testEle: '张三'
                    }, taskMethod: 1, taskMethodName: '周期生成',
                    status: 4,
                    statusName: '待复检',
                    taskTime: '2025-01-22 12:23:35',
                    testTime: '2025-01-22',
                    needAdd: 444,
                    actualAdd: 444,
                    initialInspectionTime: '2025-01-23 11:12:23',
                    finishTime: '',
                    finishReason: '',
                    meterNum: 32,
                    condNum: 181,
                    auditResult: 1,
                    auditResultName: '审核通过',
                    auditOpinion: '审核通过',
                    auditUser: '张三',
                    auditTime: '2025-01-25 15:33:26',
                    drugBatch: '1002',
                    drugRecipient: '',
                    drugRecipientName: '张三',
                    drugTime: '2025-01-25 11:23:56',
                    meterNumTwo: 32,
                    condNumTwo: 32,
                    recheckUser: '李四',
                    recheckTime: '2025-01-26 11:23:23',
                    recheckSubmit: '2025-01-26 11:23:23'
                },
                {
                    $cellEdit: true,
                    id: '3',
                    taskCode: 'CYSYXXXXXXXXX',
                    slotNo: '#23', wcName: '化学镀镍作业中心', testEle: '氰化钠',
                    proContent: 32,
                    targetValue: 40,
                    targetLowerLimit: 4,
                    drugMatterCode: 'XXXX',
                    drugName: 'XXXX',
                    addPoints: 45,
                    drugMatterName: "XXXX",
                    targetUpperLimit: 45,
                    testMan: {
                        userId: '',
                        userName: '张三',
                        testEle: '张三'
                    }, taskMethod: 1, taskMethodName: '周期生成',
                    status: 5,
                    statusName: '已完成',

                    taskTime: '2025-01-22 12:23:35',
                    testTime: '2025-01-22',
                    needAdd: 444,
                    actualAdd: 444,
                    initialInspectionTime: '2025-01-23 11:12:23',
                    finishTime: '',
                    finishReason: '',
                    meterNum: 32,
                    condNum: 181,
                    auditResult: 1,
                    auditResultName: '审核通过',
                    auditOpinion: '审核通过',
                    auditUser: '张三',
                    auditTime: '2025-01-25 15:33:26',
                    drugBatch: '1002',
                    drugRecipient: '',
                    drugRecipientName: '张三',
                    drugTime: '2025-01-25 11:23:56',
                    meterNumTwo: 32,
                    condNumTwo: 32,
                    recheckUser: '李四',
                    recheckTime: '2025-01-26 11:23:23',
                    recheckSubmit: '2025-01-26 11:23:23'
                },

            ]
            this.page.total = this.data.length
            this.loading = false
            setTimeout(() => {
                this.selectionClear();
            }, 500)
        }
    }
}
</script>
<style lang="scss" scoped>
.inpu-text {
  display: flex;

  .el-input {
    height: 32px;
    margin-top: 9px;
  }

  i {
    font-style: normal;
    line-height: 50px;
    padding-left: 5px;
  }
}
</style>
