|
@@ -3,10 +3,10 @@
|
|
|
<HcCard>
|
|
|
<template #header>
|
|
|
<div class="w-48">
|
|
|
- <el-input v-model="searchForm.queryValue1" clearable placeholder="请输入字典名称进行查询" size="large"/>
|
|
|
+ <el-input v-model="searchForm.dictName" clearable placeholder="请输入字典名称进行查询" size="large"/>
|
|
|
</div>
|
|
|
<div class="w-48 ml-2">
|
|
|
- <el-input v-model="searchForm.queryValue2" clearable placeholder="请输入字典编号进行查询" size="large"/>
|
|
|
+ <el-input v-model="searchForm.code" clearable placeholder="请输入字典编号进行查询" size="large"/>
|
|
|
</div>
|
|
|
<div class="ml-4">
|
|
|
<el-button type="primary" @click="searchClick" size="large">
|
|
@@ -29,28 +29,26 @@
|
|
|
</el-button>
|
|
|
</div>
|
|
|
<div class="ml-2">
|
|
|
- <el-button type="primary" @click="batcheditClick" size="large">
|
|
|
+ <el-button type="primary" @click="delModal" size="large">
|
|
|
<HcIcon name="delete-bin-2"/>
|
|
|
<span>删除</span>
|
|
|
</el-button>
|
|
|
</div>
|
|
|
</template>
|
|
|
- <HcTable :column="tableColumn" :datas="tableData" isCheck @selection-change="tableSelectionChange">
|
|
|
+ <HcTable :column="tableColumn" :datas="tableData" isCheck @selection-change="tableSelectionChange" :loading="tableLoaing">
|
|
|
<template #name="{row}">{{ row['name'] }}</template>
|
|
|
<template #text="{row}">{{ row['text'] }}</template>
|
|
|
<template #color="{row}">{{ row['color'] }}</template>
|
|
|
<template #action="{row, index}">
|
|
|
- <el-button size="small" type="primary" @click="eidtModal">编辑</el-button>
|
|
|
- <el-button size="small" type="primary" @click="delModal">删除</el-button>
|
|
|
+ <el-button size="small" type="primary" @click="eidtModal(row)">编辑</el-button>
|
|
|
+ <el-button size="small" type="primary" @click="delModal(row)">删除</el-button>
|
|
|
<el-button size="small" type="primary" @click="configModalclick">字典配置</el-button>
|
|
|
|
|
|
</template>
|
|
|
</HcTable>
|
|
|
- <template #action>
|
|
|
- <HcPages :pages="searchForm" @change="pageChange"></HcPages>
|
|
|
- </template>
|
|
|
+
|
|
|
<!-- 新增编辑字典 -->
|
|
|
- <HcDialog bgColor="#ffffff" isToBody :show="codeModal" :title="codeModalTitle" @close="codeModalClose" widths="62rem" >
|
|
|
+ <HcDialog bgColor="#ffffff" isToBody :show="codeModal" :title="codeModalTitle" @close="codeModalClose" widths="62rem" @save="saveparentClick">
|
|
|
<el-form label-position="left" label-width="auto" :model="formcode" :rules="formUserRules" size="large">
|
|
|
<el-row :gutter="20">
|
|
|
<el-col :span="24">
|
|
@@ -59,13 +57,13 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="字典名称:" prop="name">
|
|
|
- <el-input v-model="formcode.name"/>
|
|
|
+ <el-form-item label="字典名称:" prop="dictName">
|
|
|
+ <el-input v-model="formcode.dictName"/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12" v-if="isConfigedit">
|
|
|
- <el-form-item label="上级字典:" prop="parent">
|
|
|
- <el-select v-model="formcode.parent" class="m-2" placeholder="请选择" size="large" style="width: 100%;">
|
|
|
+ <el-form-item label="上级字典:" prop="parentId">
|
|
|
+ <el-select v-model="formcode.parentId" class="m-2" placeholder="请选择" size="large" style="width: 100%;">
|
|
|
<el-option
|
|
|
v-for="item in parentoptions"
|
|
|
:key="item.value"
|
|
@@ -102,10 +100,6 @@
|
|
|
</el-form-item>
|
|
|
</el-col> -->
|
|
|
</el-row>
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
</el-form>
|
|
|
</HcDialog>
|
|
|
<!-- 字典配置 -->
|
|
@@ -158,72 +152,148 @@
|
|
|
|
|
|
</template>
|
|
|
</HcTable>
|
|
|
- <template #action>
|
|
|
- <HcPages :pages="searchForm" @change="configpageChange"></HcPages>
|
|
|
- </template>
|
|
|
+
|
|
|
</HcDialog>
|
|
|
</HcCard>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import {ref, watch} from 'vue'
|
|
|
|
|
|
+import {onMounted, ref, watch} from "vue";
|
|
|
+import {submitDictionary,removeDictionary,getParentList,getChildList} from '~api/system/parameter.js';
|
|
|
+import {getArrValue,arrToId} from "js-fast-way"
|
|
|
+
|
|
|
+const props = defineProps({
|
|
|
+ cur: {
|
|
|
+ type: [String,Number],
|
|
|
+ default: ''
|
|
|
+ },
|
|
|
+ type:{
|
|
|
+ type: [String,Number],
|
|
|
+ default: ''
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
+const tabsKey = ref(props.cur)
|
|
|
+const tabsType = ref(props.type)
|
|
|
+
|
|
|
+//监听
|
|
|
+watch(() => [
|
|
|
+ props.cur,
|
|
|
+ props.type,
|
|
|
+], ([key,type]) => {
|
|
|
+ tabsKey.value = key
|
|
|
+ tabsType.value = type
|
|
|
+
|
|
|
+})
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ getTableData()
|
|
|
+
|
|
|
+
|
|
|
+})
|
|
|
//搜索表单
|
|
|
const searchForm = ref({
|
|
|
- projectType: null, user: null, project: null,
|
|
|
- current: 1, size: 20, total: 0
|
|
|
})
|
|
|
-const getTableData=()=>{
|
|
|
-
|
|
|
+const tableLoaing=ref(false)
|
|
|
+const getTableData=async()=>{
|
|
|
+ tableLoaing.value=true
|
|
|
+ const { error, code, data,msg } = await getParentList({
|
|
|
+ type:tabsType.value,
|
|
|
+ code:searchForm.value?.code||'',
|
|
|
+ dictName:searchForm.value?.dictName||'',
|
|
|
+
|
|
|
+ })
|
|
|
+ tableLoaing.value=false
|
|
|
+ if (!error && code === 200) {
|
|
|
+ tableData.value = getArrValue(data['records'])
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ tableData.value =[]
|
|
|
+ window.$message?.warning(msg)
|
|
|
+ }
|
|
|
}
|
|
|
//搜索
|
|
|
const searchClick = () => {
|
|
|
- searchForm.value.current = 1;
|
|
|
getTableData()
|
|
|
}
|
|
|
|
|
|
//重置搜索表单
|
|
|
const resetClick = () => {
|
|
|
- searchForm.value = {current: 1, size: 20, total: 0}
|
|
|
+ searchForm.value = {}
|
|
|
+ getTableData()
|
|
|
+
|
|
|
}
|
|
|
const addClick=()=>{
|
|
|
+ formcode.value={}
|
|
|
codeModal.value=true
|
|
|
}
|
|
|
+//新增一级科目
|
|
|
+const saveparentClick=async()=>{
|
|
|
+ const { error, code, data,msg } = await submitDictionary({
|
|
|
+ type:tabsType.value,
|
|
|
+ dictName:formcode.value?.dictName,
|
|
|
+ code:formcode.value?.code,
|
|
|
+ id:formcode.value?.id||null,
|
|
|
+ sort:formcode.value?.sort||null,
|
|
|
+ })
|
|
|
+
|
|
|
+ if (!error && code === 200) {
|
|
|
+ window.$message?.success(msg)
|
|
|
+ codeModal.value=false
|
|
|
+ getTableData()
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ window.$message?.warning(msg)
|
|
|
+ }
|
|
|
+}
|
|
|
const batcheditClick=()=>{
|
|
|
|
|
|
}
|
|
|
|
|
|
-//分页被点击
|
|
|
-const pageChange = ({current, size}) => {
|
|
|
- searchForm.value.current = current
|
|
|
- searchForm.value.size = size
|
|
|
-}
|
|
|
+
|
|
|
|
|
|
const tableColumn = [
|
|
|
- {key: 'key1', name: '字典编号'},
|
|
|
- {key: 'key2', name: '字典名称'},
|
|
|
- {key: 'key3', name: '封存'},
|
|
|
-
|
|
|
+ {key: 'code', name: '字典编号'},
|
|
|
+ {key: 'dictName', name: '字典名称'},
|
|
|
{key: 'action', name: '操作', width:250}
|
|
|
|
|
|
]
|
|
|
-const tableData = ref([
|
|
|
- {key1: '名称1', key2: '文本1', key3: 'red'},
|
|
|
- {key1: '名称1', key2: '文本1', key3: 'red'},
|
|
|
- {key1: '名称1', key2: '文本1', key3: 'red'},
|
|
|
-])
|
|
|
+const tableData = ref([])
|
|
|
const tableCheckedKeys = ref([]);
|
|
|
const tableSelectionChange = (rows) => {
|
|
|
tableCheckedKeys.value = rows
|
|
|
- if (tableCheckedKeys.value.length > 1) {
|
|
|
- window.$message.warning('只能选择一条数据')
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
-const eidtModal=()=>{
|
|
|
-
|
|
|
+const eidtModal=(row)=>{
|
|
|
+ formcode.value=row
|
|
|
+ codeModal.value=true
|
|
|
}
|
|
|
-const delModal=()=>{
|
|
|
-
|
|
|
+const delbtnloading=ref(false)
|
|
|
+const delModal=(item)=>{
|
|
|
+ const rows = tableCheckedKeys.value;
|
|
|
+ const ids = arrToId(rows)
|
|
|
+ delbtnloading.value=true
|
|
|
+ window?.$messageBox?.alert('您确定要删除该信息吗? 一旦注销数据将彻底清除,请谨慎操作?', '删除提醒', {
|
|
|
+ showCancelButton: true,
|
|
|
+ confirmButtonText: '确认注销',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ callback: async(action) => {
|
|
|
+ if (action === 'confirm') {
|
|
|
+ const {error, code, msg} = await removeDictionary({
|
|
|
+ ids: ids||item.id,
|
|
|
+ })
|
|
|
+ delbtnloading.value=false
|
|
|
+ if (!error && code === 200) {
|
|
|
+ window?.$message?.success('删除成功')
|
|
|
+ getTableData()
|
|
|
+ } else {
|
|
|
+ window?.$message?.warning(msg)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
const codeModal=ref(false)
|
|
@@ -235,22 +305,22 @@ const formcode=ref({})
|
|
|
const formUserRules = {
|
|
|
code: {
|
|
|
required: true,
|
|
|
- trigger: "blur"
|
|
|
+ trigger: "blur",
|
|
|
+ message: "请输入字典编号"
|
|
|
},
|
|
|
- name: {
|
|
|
+ dictName: {
|
|
|
required: true,
|
|
|
- trigger: "blur"
|
|
|
+ trigger: "blur",
|
|
|
+ message: "请输入字典名称"
|
|
|
},
|
|
|
sort: {
|
|
|
required: true,
|
|
|
- trigger: "blur"
|
|
|
+ trigger: "blur",
|
|
|
+ message: "请输入字典排序"
|
|
|
},
|
|
|
- isstorage:{
|
|
|
- required: true,
|
|
|
- trigger: "blur"
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
-const handleSortChange=()=>{
|
|
|
+const handleSortChange=(value)=>{
|
|
|
console.log(value)
|
|
|
}
|
|
|
//字典配置
|