Browse Source

样品管理

ZaiZai 1 year ago
parent
commit
f48fc06b56

+ 15 - 0
src/styles/tentative/material/testSample.scss

@@ -0,0 +1,15 @@
+.hc-test-sample-body {
+    .hc-test-sample-card-item {
+        padding: 0;
+        background: transparent;
+        &.hc-card-item-box.is-header.is-action .hc-card-item-body {
+            height: calc(100% - 89px);
+        }
+        .hc-card-item-action {
+            display: flex;
+            align-items: center;
+            justify-content: flex-end;
+            margin-top: 10px;
+        }
+    }
+}

+ 94 - 0
src/views/tentative/material/modules/testSample/flow.vue

@@ -0,0 +1,94 @@
+<template>
+    <hc-card-item class="hc-test-sample-card-item">
+        <template #header>
+            <div class="w-200px">
+                <el-select v-model="searchForm.contractId" placeholder="选择合同段" filterable clearable block>
+                    <el-option label="测试1" value="1" />
+                    <el-option label="测试2" value="2" />
+                </el-select>
+            </div>
+            <div class="ml-2 w-150px">
+                <el-date-picker v-model="searchForm.date" class="block" type="date" format="YYYY-MM-DD" value-format="YYYY-MM-DD" clearable placeholder="委托上报时间" />
+            </div>
+            <div class="ml-2 w-250px">
+                <hc-search-input v-model="searchForm.queryValue" @search="searchClick" />
+            </div>
+        </template>
+        <hc-table :column="tableColumn" :datas="tableData" :loading="tableLoading" :index-style="{ width: 60 }">
+            <template #key9="{ row }">
+                <el-button v-if="row.key9 === 1" type="success" size="small">已同意</el-button>
+                <el-button v-if="row.key9 === 2" type="info" size="small">待审批</el-button>
+                <el-button v-if="row.key9 === 3" type="danger" size="small">已废除</el-button>
+            </template>
+        </hc-table>
+        <template #action>
+            <hc-pages :pages="searchForm" @change="pageChange" />
+        </template>
+    </hc-card-item>
+</template>
+
+<script setup>
+import { onMounted, ref, watch } from 'vue'
+import { useAppStore } from '~src/store'
+import { getObjValue } from 'js-fast-way'
+
+//参数
+const props = defineProps({
+    tree: {
+        type: Object,
+        default: () => ({}),
+    },
+})
+
+//变量
+const store = useAppStore()
+const projectId = ref(store.getProjectId)
+const contractId = ref(store.getContractId)
+
+//渲染完成
+onMounted(() => {
+
+})
+
+//监听数据
+const treeInfo = ref({})
+watch(() => props.tree, (obj) => {
+    treeInfo.value = getObjValue(obj)
+})
+
+//搜索表单
+const searchForm = ref({ current: 1, size: 20, total: 0 })
+
+//搜索
+const searchClick = () => {
+    searchForm.value.current = 1
+    getTableData()
+}
+
+//分页被点击
+const pageChange = ({ current, size }) => {
+    searchForm.value.current = current
+    searchForm.value.size = size
+    getTableData()
+}
+
+//表格数据
+const tableColumn = ref([
+    { key: 'key1', name: '取样名称' },
+    { key: 'key2', name: '规格型号', align: 'center' },
+    { key: 'key3', name: '试样数量', align: 'center' },
+    { key: 'key4', name: '计算单位', align: 'center' },
+    { key: 'key5', name: '拟用部位' },
+    { key: 'key6', name: '代表数量', align: 'center' },
+    { key: 'key7', name: '取样人', align: 'center' },
+    { key: 'key8', name: '委托单上报时间', align: 'center' },
+    { key: 'key9', name: '委托单状态', align: 'center' },
+])
+const tableData = ref([{ key9:1 }, { key9:2 }, { key9:3 }])
+
+//获取表格数据
+const tableLoading = ref(false)
+const getTableData = async () => {
+
+}
+</script>

+ 195 - 0
src/views/tentative/material/modules/testSample/inventory.vue

@@ -0,0 +1,195 @@
+<template>
+    <hc-card-item class="hc-test-sample-card-item">
+        <template #header>
+            <div class="w-200px">
+                <el-select v-model="searchForm.contractId" placeholder="选择合同段" filterable clearable block>
+                    <el-option label="测试1" value="1" />
+                    <el-option label="测试2" value="2" />
+                </el-select>
+            </div>
+            <div class="ml-2 w-150px">
+                <el-date-picker v-model="searchForm.date" class="block" type="date" format="YYYY-MM-DD" value-format="YYYY-MM-DD" clearable placeholder="入库时间" />
+            </div>
+            <div class="ml-2 w-250px">
+                <hc-search-input v-model="searchForm.queryValue" @search="searchClick" />
+            </div>
+        </template>
+        <hc-table :column="tableColumn" :datas="tableData" :loading="tableLoading" :index-style="{ width: 60 }">
+            <template #action="{ row }">
+                <el-link type="primary" @click="reportsShow(row)">创建报告</el-link>
+                <el-link type="warning" @click="detectionShow(row)">等待检测</el-link>
+            </template>
+        </hc-table>
+        <template #action>
+            <hc-pages :pages="searchForm" @change="pageChange" />
+        </template>
+
+        <!-- 创建报告 / 等待检测 -->
+        <hc-new-dialog v-model="rowActionModal" is-footer-center :title="rowActionTitle" widths="40rem" @close="rowActionModalClose">
+            <el-form ref="formRef" :model="formModel" :rules="formRules" label-position="top" label-width="auto">
+                <el-row :gutter="20">
+                    <el-col :span="12">
+                        <el-form-item label="委托单位:" prop="key1">
+                            <el-input v-model="formModel.key1" placeholder="委托单位" disabled />
+                        </el-form-item>
+                    </el-col>
+                    <el-col :span="12">
+                        <el-form-item label="委托单位名称:" prop="key2">
+                            <el-input v-model="formModel.key2" placeholder="委托单位名称" disabled />
+                        </el-form-item>
+                    </el-col>
+                    <el-col :span="12">
+                        <el-form-item label="取样名称:" prop="key3">
+                            <el-input v-model="formModel.key3" placeholder="取样名称" disabled />
+                        </el-form-item>
+                    </el-col>
+                    <el-col :span="12">
+                        <el-form-item label="取样数量:" prop="key4">
+                            <el-input v-model="formModel.key4" placeholder="取样数量" disabled />
+                        </el-form-item>
+                    </el-col>
+                    <el-col :span="12">
+                        <el-form-item label="样品编号:" prop="key5">
+                            <el-input v-model="formModel.key5" placeholder="样品编号" disabled />
+                        </el-form-item>
+                    </el-col>
+                    <el-col :span="12">
+                        <el-form-item label="试验数量:" prop="key6">
+                            <el-input v-model="formModel.key6" placeholder="试验数量" />
+                        </el-form-item>
+                    </el-col>
+                    <el-col :span="12">
+                        <el-form-item label="规格型号:" prop="key7">
+                            <el-input v-model="formModel.key7" placeholder="规格型号" disabled />
+                        </el-form-item>
+                    </el-col>
+                    <el-col :span="12">
+                        <el-form-item label="计算单位:" prop="key8">
+                            <el-input v-model="formModel.key8" placeholder="计算单位" disabled />
+                        </el-form-item>
+                    </el-col>
+                    <el-col v-if="rowActionTitle === '等待检测'" :span="24">
+                        <el-form-item label="试验检测时间:" prop="key9">
+                            <el-date-picker v-model="formModel.key9" class="block" type="date" format="YYYY-MM-DD" value-format="YYYY-MM-DD" />
+                        </el-form-item>
+                    </el-col>
+                </el-row>
+            </el-form>
+            <template #footer>
+                <el-button @click="rowActionModalClose">取消</el-button>
+                <el-button hc-btn type="primary" @click="rowActionSave">创建</el-button>
+            </template>
+        </hc-new-dialog>
+    </hc-card-item>
+</template>
+
+<script setup>
+import { onMounted, ref, watch } from 'vue'
+import { useAppStore } from '~src/store'
+import { getObjValue } from 'js-fast-way'
+
+//参数
+const props = defineProps({
+    tree: {
+        type: Object,
+        default: () => ({}),
+    },
+})
+
+//变量
+const store = useAppStore()
+const projectId = ref(store.getProjectId)
+const contractId = ref(store.getContractId)
+
+//渲染完成
+onMounted(() => {
+
+})
+
+//监听数据
+const treeInfo = ref({})
+watch(() => props.tree, (obj) => {
+    treeInfo.value = getObjValue(obj)
+})
+
+//搜索表单
+const searchForm = ref({ current: 1, size: 20, total: 0 })
+
+//搜索
+const searchClick = () => {
+    searchForm.value.current = 1
+    getTableData()
+}
+
+//分页被点击
+const pageChange = ({ current, size }) => {
+    searchForm.value.current = current
+    searchForm.value.size = size
+    getTableData()
+}
+
+//表格数据
+const tableColumn = ref([
+    { key: 'key1', name: '取样名称' },
+    { key: 'key2', name: '规格型号', align: 'center' },
+    { key: 'key3', name: '试样数量', align: 'center' },
+    { key: 'key4', name: '计算单位', align: 'center' },
+    { key: 'key5', name: '拟用部位' },
+    { key: 'key6', name: '代表数量', align: 'center' },
+    { key: 'key7', name: '取样人', align: 'center' },
+    { key: 'key8', name: '入库时间', align: 'center' },
+    { key: 'action', name: '操作', width: 150, align: 'center' },
+])
+const tableData = ref([
+    {},
+])
+
+//获取表格数据
+const tableLoading = ref(false)
+const getTableData = async () => {
+
+}
+
+//表单数据
+const formRef = ref(null)
+const formModel = ref({})
+const formRules = {
+    meterPeriodId: {
+        required: true,
+        trigger: 'blur',
+        message: '请选择计量期',
+    },
+}
+
+//弹窗
+const rowActionModal = ref(false)
+const rowActionTitle = ref('')
+
+//创建报告
+const reportsShow = (row) => {
+    formModel.value = row
+    rowActionTitle.value = '创建报告'
+    rowActionModal.value = true
+}
+
+//等待检测
+const detectionShow = (row) => {
+    formModel.value = row
+    rowActionTitle.value = '等待检测'
+    rowActionModal.value = true
+}
+
+//提交保存
+const rowActionSave = async () => {
+    const title = rowActionTitle.value
+    console.log(title)
+    rowActionModalClose()
+}
+
+//关闭弹窗
+const rowActionModalClose = () => {
+    rowActionModal.value = false
+    formModel.value = {}
+    rowActionTitle.value = ''
+}
+</script>

+ 1 - 0
src/views/tentative/material/sampling.vue

@@ -237,6 +237,7 @@
         <hc-new-dialog v-model="delegateModal" is-footer-center is-table title="创建委托" widths="60rem" @close="delegateModalClose">
             11231233
             <template #footer>
+                <el-button @click="delegateModalClose">取消</el-button>
                 <el-button hc-btn type="primary" @click="creatingDelegate">创建</el-button>
             </template>
         </hc-new-dialog>

+ 59 - 3
src/views/tentative/material/testSample.vue

@@ -1,11 +1,67 @@
 <template>
-    <div>检测样品</div>
+    <hc-body split :project-nmae="projectInfo?.projectName" class="hc-test-sample-body">
+        <template #tree>
+            <TestTree
+                :auto-expand-keys="treeAutoExpandKeys" :project-id="projectId" :tenant-id="userInfo?.tenant_id"
+                :wbs-temp-id="projectInfo?.referenceWbsTemplateIdTrial" :wbs-type="2" @node-tap="wbsElTreeClick"
+            />
+        </template>
+        <hc-tab-card :tabs="tabsData" :tab-key="tabsKey" @change="tabsChange">
+            <SampleFlow v-if="tabsKey === 'flow'" :tree="treeInfo" />
+            <SampleInventory v-if="tabsKey === 'inventory'" :tree="treeInfo" />
+        </hc-tab-card>
+    </hc-body>
 </template>
 
 <script setup>
+import { onMounted, ref } from 'vue'
+import { useAppStore } from '~src/store'
+import { getStoreValue, setStoreValue } from '~src/utils/storage'
+import { getObjValue } from 'js-fast-way'
+import TestTree from './components/TestTree.vue'
+import SampleFlow from './modules/testSample/flow.vue'
+import SampleInventory from './modules/testSample/inventory.vue'
 
-</script>
+//变量
+const store = useAppStore()
+const userInfo = ref(store.getUserInfo)
+const projectId = ref(store.getProjectId)
+const contractId = ref(store.getContractId)
+const projectInfo = ref(store.getProjectInfo)
+
+//自动展开缓存
+const treeAutoExpandKeys = ref(getStoreValue('testTreeExpandKeys') || [])
+
+//渲染完成
+onMounted(() => {
 
-<style scoped lang="scss">
+})
+
+//树被点击
+const treeInfo = ref({})
+const wbsElTreeClick = ({ data, keys }) => {
+    treeInfo.value = getObjValue(data)
+    // data['primaryKeyId'] || ''
+    //缓存自动展开
+    treeAutoExpandKeys.value = keys
+    setStoreValue('testTreeExpandKeys', keys)
+}
+
+//选项卡卡片
+const tabsKey = ref('inventory')
+const tabsData = ref([
+    { key: 'flow', name: '样品流转' },
+    { key: 'inventory', name: '样品库存' },
+    { key: 'tested', name: '待测样品' },
+    { key: 'testUnder', name: '在测样品' },
+    { key: 'leave', name: '留样样品' },
+    { key: 'dispose', name: '已处理样品' },
+])
+const tabsChange = ({ key }) => {
+    tabsKey.value = key
+}
+</script>
 
+<style lang="scss">
+@import '~src/styles/tentative/material/testSample';
 </style>