duy 2 mesi fa
parent
commit
35f193888a
2 ha cambiato i file con 183 aggiunte e 3 eliminazioni
  1. 177 2
      src/views/tentative/basic/code.vue
  2. 6 1
      src/views/tentative/basic/rule.vue

+ 177 - 2
src/views/tentative/basic/code.vue

@@ -1,3 +1,178 @@
 <template>
-    <div>111111111111</div>
-</template>
+    <hc-body split>
+        <template #left>
+            <hc-card scrollbar>
+                <hc-menu-simple 
+                    :datas="menuOptions" 
+                    :keys="menuKey" 
+                    @change="handleMenuValue"
+                />
+            </hc-card>
+        </template>
+        <hc-card>
+            <template #header>
+                <span class="text-orange">*编号更改后,所有已生成的资料删除编号内容,保存后重新自动生成。</span>
+            </template>
+            <template #extra>
+                <HcTooltip keys="tentative-basic-code-add">
+                    <el-button
+                        hc-btn
+                        type="primary"
+                    >
+                        <HcIcon name="add-circle" />
+                        <span>新增</span>
+                    </el-button>
+                </HcTooltip>
+              
+                <HcTooltip keys="tentative-basic-code-sort">
+                    <el-button hc-btn type="primary" color="#12C060" style="color: white;" @click="editFormModalClick">
+                        <HcIcon name="arrow-up-down" />
+                        <span>排序</span>
+                    </el-button>
+                </HcTooltip>
+                <HcTooltip keys="tentative-basic-code-resign">
+                    <el-button
+                        hc-btn
+                        color="#e03997" style="color: white;" 
+                    >
+                        <HcIcon name="restart" />
+                        <span>重置编号</span>
+                    </el-button>
+                </HcTooltip>
+                <HcTooltip keys="tentative-basic-code-delete">
+                    <el-button hc-btn color="red">
+                        <HcIcon name="delete-bin-2" />
+                        <span>删除</span>
+                    </el-button>
+                </HcTooltip>
+            </template>
+           
+
+            <HcTable
+                ref="tableRef" :column="tableColumn" :datas="tableData" :loading="tableLoad"
+                is-new :index-style="{ width: 60 }" is-check :check-style="{ width: 29 }"
+                @selection-change="tableSelection"
+            >
+                <template #action="{ row }">
+                    <el-button 
+                        v-if="!row.isEdit"
+                        type="primary" 
+                        link
+                        @click="handleEdit(row)"
+                    >
+                        <HcIcon name="edit-2" />
+                        编辑
+                    </el-button>
+                    <el-button 
+                        v-if="row.isEdit"
+                        type="success" 
+                        link
+                        @click="handleSave(row)"
+                    >
+                        <HcIcon name="save-3" />
+                        保存
+                    </el-button>
+                    <el-button 
+                        type="danger" 
+                        link
+                        @click="handleDelete(row)"
+                    >
+                        <HcIcon name="delete-bin-2" />
+                        删除
+                    </el-button>
+                </template>
+            </HcTable>
+
+            <template #action>
+                <HcPages :pages="searchForm" @change="pageChange" />
+            </template>
+        </hc-card>
+    </hc-body>
+</template>
+
+<script setup>
+import { onMounted, ref } from 'vue'
+import { getDictionary } from '~api/other'
+import { getArrValue } from 'js-fast-way'
+
+onMounted(()=>{
+    getMenuOptions()
+})
+//左侧菜单
+const menuKey = ref('1')
+const menuOptions = ref([])
+const getMenuOptions = async ()=>{
+        const { data } = await getDictionary({
+        code: 'trial_number_rule',
+    })
+    //处理数据
+    let newArr = []
+    const newData = getArrValue(data)
+    for (let i = 0; i < newData.length; i++) {
+        newArr.push({
+            label: newData[i]['dictValue'],
+            key: newData[i]['dictKey'],
+        })
+    }
+    menuOptions.value = newArr
+}
+const handleMenuValue = (item) => {
+    console.log(item)
+    menuKey.value = item.key
+}
+//搜索表单
+const searchForm = ref({
+ 
+    current: 1, size: 20, total: 0,
+})
+
+//分页被点击
+const pageChange = ({ current, size }) => {
+    searchForm.value.current = current
+    searchForm.value.size = size
+    getTableData()
+}
+//获取数据
+const tableLoad = ref(true)
+const tableData = ref([])
+const tableRef = ref(null)
+const tableColumn = ref([
+     { key: 'type', name: '规则' },
+     { key: 'data', name: '数据填充' },
+      { key: 'isAutoIncrement', name: '是否自增' },
+      { key: 'action', name: '操作' },
+   
+])
+const getTableData = async () => {
+    // tableLoad.value = true
+    // const { error, code, data } = await approachApi.queryPage({
+    //     projectId: projectId.value,
+    //     contractId: contractId.value,
+    //     ...searchForm.value,
+    // })
+    // //处理数据
+    // tableLoad.value = false
+    // if (!error && code === 200) {
+    //     tableData.value = getArrValue(data['records'])
+    //     searchForm.value.total = data.total || 0
+    // } else {
+    //     tableData.value = []
+    //     searchForm.value.total = 0
+    // }
+}
+
+// 编辑行
+const handleEdit = (row) => {
+    row.isEdit = true
+}
+
+// 保存行
+const handleSave = async (row) => {
+    row.isEdit = false
+}
+
+// 删除行
+const handleDelete = async (row) => {
+    console.log(row)
+}
+</script>

+ 6 - 1
src/views/tentative/basic/rule.vue

@@ -1,3 +1,8 @@
 <template>
-    <div>222222222</div>
+    <hc-body split>
+        <template #left>
+            <hc-card scrollbar />
+        </template>
+        <hc-card />
+    </hc-body>
 </template>