|
@@ -6,32 +6,25 @@
|
|
|
<HcIcon name="add"/>
|
|
|
</el-button>
|
|
|
</template>
|
|
|
- <!-- <template #extra>
|
|
|
- <div style="float: right;">
|
|
|
- <el-button size="large" type="primary">
|
|
|
- <HcIcon name="save"/>
|
|
|
- <span>保存</span>
|
|
|
- </el-button>
|
|
|
- </div>
|
|
|
- </template> -->
|
|
|
- <HcTable :column="tasktableColumn" :datas="tasktableData">
|
|
|
+ <HcTable :column="tasktableColumn" :datas="tasktableData" :loading="tableLoaing">
|
|
|
+ <template #dictValue="{row}">
|
|
|
+ <div >{{row?.dictValue==='1'?'固定任务':'临时任务'}}</div>
|
|
|
+ </template>
|
|
|
<template #action="{row, index}">
|
|
|
- <el-button size="small" type="primary" @click="openTypeEdit(2)">编辑</el-button>
|
|
|
- <el-button size="small" type="primary" @click="delTasktype">删除</el-button>
|
|
|
+ <el-button size="small" type="primary" @click="openTypeEdit(2,row)">编辑</el-button>
|
|
|
+ <el-button size="small" type="primary" @click="delTasktype(row)">删除</el-button>
|
|
|
</template>
|
|
|
</HcTable>
|
|
|
- <template #action>
|
|
|
- <HcPages :pages="searchForm" @change="pageChange"></HcPages>
|
|
|
- </template>
|
|
|
+
|
|
|
|
|
|
<!--任务类型弹窗-->
|
|
|
- <HcDialog bgColor="#ffffff" isToBody widths="24rem" :show="tasktypeModal" :title="taskTypeTitle" @close="taskTypeModalClose">
|
|
|
+ <HcDialog bgColor="#ffffff" isToBody widths="24rem" :show="tasktypeModal" :title="taskTypeTitle" @close="taskTypeModalClose" @save="saveparentClick">
|
|
|
<el-form label-position="top" :model="formtaskType" label-width="auto" size="large">
|
|
|
<el-form-item label="任务类型名称">
|
|
|
- <el-input v-model="formtaskType.name"/>
|
|
|
+ <el-input v-model="formtaskType.dictName"/>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="类型">
|
|
|
- <el-select v-model="formtaskType.type" class="block" placeholder="请选择">
|
|
|
+ <el-select v-model="formtaskType.dictValue" class="block" placeholder="请选择">
|
|
|
<el-option v-for="item in typeoptions" :key="item.value" :label="item.label" :value="item.value"/>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
@@ -42,57 +35,95 @@
|
|
|
</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} from "js-fast-way"
|
|
|
+onMounted(() => {
|
|
|
+ getParentListData()
|
|
|
+
|
|
|
+})
|
|
|
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,
|
|
|
-], ([key]) => {
|
|
|
+ props.type,
|
|
|
+], ([key,type]) => {
|
|
|
tabsKey.value = key
|
|
|
+ tabsType.value = type
|
|
|
console.log(key)
|
|
|
})
|
|
|
|
|
|
-const searchForm = ref({
|
|
|
- postType: '', name: '',
|
|
|
- current: 1, size: 20, total: 0
|
|
|
-})
|
|
|
-//分页被点击
|
|
|
-const pageChange = ({current, size}) => {
|
|
|
- searchForm.value.current = current
|
|
|
- searchForm.value.size = size
|
|
|
-}
|
|
|
|
|
|
const tasktableColumn = [
|
|
|
- {key: 'name', name: '任务类型名称'},
|
|
|
- {key: 'text', name: '类型'},
|
|
|
+ {key: 'dictName', name: '任务类型名称'},
|
|
|
+ {key: 'dictValue', name: '类型'},
|
|
|
{key: 'action', name: '操作', width: 200}
|
|
|
]
|
|
|
-const tasktableData = ref([
|
|
|
- {name: '名称1', text: '文本1', color: 'red'},
|
|
|
- {name: '名称2', text: '文本2', color: 'blue'},
|
|
|
- {name: '名称3', text: '文本3', color: '无'}
|
|
|
-])
|
|
|
+const tasktableData = ref([])
|
|
|
|
|
|
const taskTypeTitle = ref('')
|
|
|
const tasktypeModal = ref(false)
|
|
|
-const openTypeEdit = (type) => {
|
|
|
+const editItem=ref({})
|
|
|
+const openTypeEdit = (type,row) => {
|
|
|
if (type === 1) {
|
|
|
taskTypeTitle.value = '新增任务'
|
|
|
+ formtaskType.value={}
|
|
|
+ editItem.value={}
|
|
|
} else {
|
|
|
taskTypeTitle.value = '编辑任务'
|
|
|
+ editItem.value=row
|
|
|
+ formtaskType.value=row
|
|
|
}
|
|
|
tasktypeModal.value = true
|
|
|
}
|
|
|
|
|
|
+//新增一级科目
|
|
|
+const saveparentClick=async()=>{
|
|
|
+ const { error, code, data,msg } = await submitDictionary({
|
|
|
+ type:tabsType.value,
|
|
|
+ dictValue:formtaskType.value?.dictValue,
|
|
|
+ dictName:formtaskType.value?.dictName,
|
|
|
+ id:editItem.value.id||null
|
|
|
+
|
|
|
+ })
|
|
|
+ tasktypeModal.value=false
|
|
|
+ if (!error && code === 200) {
|
|
|
+ window.$message?.success(msg)
|
|
|
+ getParentListData()
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ window.$message?.warning(msg)
|
|
|
+ }
|
|
|
+}
|
|
|
+const tableLoaing=ref(false)
|
|
|
+const getParentListData=async()=>{
|
|
|
+ tableLoaing.value=true
|
|
|
+ const { error, code, data,msg } = await getParentList({
|
|
|
+ type:tabsType.value,
|
|
|
+ })
|
|
|
+ tableLoaing.value=false
|
|
|
+ if (!error && code === 200) {
|
|
|
+ tasktableData.value = getArrValue(data['records'])
|
|
|
+
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ tasktableData.value=[]
|
|
|
+ window.$message?.warning(msg)
|
|
|
+ }
|
|
|
+}
|
|
|
const formtaskType = ref({})
|
|
|
const typeoptions = ref([
|
|
|
{
|
|
@@ -109,18 +140,26 @@ const taskTypeModalClose = () => {
|
|
|
tasktypeModal.value = false
|
|
|
}
|
|
|
|
|
|
-const delTasktype = () => {
|
|
|
- window?.$messageBox?.alert('您确定要删除该任务分类吗? 一旦注销数据将彻底清除,请谨慎操作?', '删除提醒', {
|
|
|
- showCancelButton: true,
|
|
|
- confirmButtonText: '确认注销',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning',
|
|
|
- callback: (action) => {
|
|
|
- if (action === 'confirm') {
|
|
|
- console.log(11111);
|
|
|
+const delTasktype = (item) => {
|
|
|
+ window?.$messageBox?.alert('您确定要删除该任务信息吗? 一旦注销数据将彻底清除,请谨慎操作?', '删除提醒', {
|
|
|
+ showCancelButton: true,
|
|
|
+ confirmButtonText: '确认注销',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ callback: async(action) => {
|
|
|
+ if (action === 'confirm') {
|
|
|
+ const {error, code, msg} = await removeDictionary({
|
|
|
+ ids: item?.id,
|
|
|
+ })
|
|
|
+ if (!error && code === 200) {
|
|
|
+ window?.$message?.success('删除成功')
|
|
|
+ getParentListData()
|
|
|
+ } else {
|
|
|
+ window?.$message?.warning(msg)
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- })
|
|
|
+ })
|
|
|
}
|
|
|
</script>
|
|
|
|