|
@@ -16,9 +16,8 @@
|
|
<el-button hc-btn type="danger" @click="delClick">删除</el-button>
|
|
<el-button hc-btn type="danger" @click="delClick">删除</el-button>
|
|
</template>
|
|
</template>
|
|
<hc-table
|
|
<hc-table
|
|
- ref="tableRef" :column="tableColumn" :datas="tableData" :loading="tableLoading"
|
|
|
|
- is-check :check-style="{ width: 29 }" :index-style="{ width: 60 }"
|
|
|
|
- @selection-change="tableCheckChange"
|
|
|
|
|
|
+ ref="tableRef" :column="tableColumn" :datas="tableData" :loading="tableLoading" is-check
|
|
|
|
+ :check-style="{ width: 29 }" :index-style="{ width: 60 }" @selection-change="tableCheckChange"
|
|
>
|
|
>
|
|
<template #isSealed="{ row }">
|
|
<template #isSealed="{ row }">
|
|
{{ row.isSealed === 1 ? '是' : '否' }}
|
|
{{ row.isSealed === 1 ? '是' : '否' }}
|
|
@@ -34,26 +33,38 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<!-- 新增/修改 -->
|
|
<!-- 新增/修改 -->
|
|
- <hc-dialog v-model="isDialogShow" widths="400px" is-footer-center :title="dialogTitle" @close="dialogClose">
|
|
|
|
- <el-form ref="formRef" :model="formModel" :rules="formRules" label-position="top" label-width="auto">
|
|
|
|
- <el-form-item label="字典编号:" prop="code">
|
|
|
|
- <el-input v-model="formModel.code" clearable placeholder="请输入字典编号" />
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="字典名称:" prop="dictValue">
|
|
|
|
- <el-input v-model="formModel.dictValue" clearable placeholder="请输入字典名称" />
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="字典备注:">
|
|
|
|
- <el-input v-model="formModel.remark" clearable placeholder="请输入字典备注" />
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="字典排序:" prop="sort">
|
|
|
|
- <el-input-number v-model="formModel.sort" :min="1" block controls-position="right" />
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="字典封存:" prop="isSealed">
|
|
|
|
- <el-radio-group v-model="formModel.isSealed">
|
|
|
|
- <el-radio :value="1">是</el-radio>
|
|
|
|
- <el-radio :value="0">否</el-radio>
|
|
|
|
- </el-radio-group>
|
|
|
|
- </el-form-item>
|
|
|
|
|
|
+ <hc-dialog v-model="isDialogShow" widths="34rem" is-footer-center :title="dialogTitle" @close="dialogClose">
|
|
|
|
+ <el-form ref="formRef" :model="formModel" :rules="formRules" label-position="top" label-width="auto" size="large">
|
|
|
|
+ <el-row :gutter="20">
|
|
|
|
+ <el-col :span="12">
|
|
|
|
+ <el-form-item label="字典编号:" prop="code">
|
|
|
|
+ <el-input v-model="formModel.code" clearable placeholder="请输入字典编号" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="12">
|
|
|
|
+ <el-form-item label="字典名称:" prop="dictValue">
|
|
|
|
+ <el-input v-model="formModel.dictValue" clearable placeholder="请输入字典名称" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="12">
|
|
|
|
+ <el-form-item label="字典备注:">
|
|
|
|
+ <el-input v-model="formModel.remark" clearable placeholder="请输入字典备注" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="12">
|
|
|
|
+ <el-form-item label="字典排序:" prop="sort">
|
|
|
|
+ <el-input-number v-model="formModel.sort" :min="1" block controls-position="right" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="24">
|
|
|
|
+ <el-form-item label="字典封存:" prop="isSealed">
|
|
|
|
+ <el-radio-group v-model="formModel.isSealed">
|
|
|
|
+ <el-radio :value="1">是</el-radio>
|
|
|
|
+ <el-radio :value="0" class="ml-20px">否</el-radio>
|
|
|
|
+ </el-radio-group>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-row>
|
|
</el-form>
|
|
</el-form>
|
|
<template #footer>
|
|
<template #footer>
|
|
<el-button hc-btn @click="dialogClose">取消</el-button>
|
|
<el-button hc-btn @click="dialogClose">取消</el-button>
|
|
@@ -120,15 +131,10 @@ const getTableData = async () => {
|
|
if (searchName.value) {
|
|
if (searchName.value) {
|
|
form[searchType.value] = searchName.value
|
|
form[searchType.value] = searchName.value
|
|
}
|
|
}
|
|
- const { error, code, data } = await mainApi.page(form)
|
|
|
|
|
|
+ const { data } = await mainApi.page(form)
|
|
tableLoading.value = false
|
|
tableLoading.value = false
|
|
- if (!error && code === 200) {
|
|
|
|
- tableData.value = getArrValue(data['records'])
|
|
|
|
- searchForm.value.total = data['total']
|
|
|
|
- } else {
|
|
|
|
- tableData.value = []
|
|
|
|
- searchForm.value.total = 0
|
|
|
|
- }
|
|
|
|
|
|
+ tableData.value = getArrValue(data?.records)
|
|
|
|
+ searchForm.value.total = data?.total ?? 0
|
|
}
|
|
}
|
|
|
|
|
|
//表格被选择
|
|
//表格被选择
|
|
@@ -190,15 +196,11 @@ const editRowClick = (row) => {
|
|
|
|
|
|
//删除
|
|
//删除
|
|
const delRowClick = async ({ item }, resolve) => {
|
|
const delRowClick = async ({ item }, resolve) => {
|
|
- const { code, msg } = await mainApi.del(item.id)
|
|
|
|
- if (code === 200) {
|
|
|
|
- resolve()
|
|
|
|
- window.$message.success('删除成功')
|
|
|
|
- getTableData().then()
|
|
|
|
- } else {
|
|
|
|
- resolve()
|
|
|
|
- window.$message.error(msg ?? '删除失败')
|
|
|
|
- }
|
|
|
|
|
|
+ const { isRes } = await mainApi.del(item.id)
|
|
|
|
+ resolve() //关闭弹窗
|
|
|
|
+ if (!isRes) return
|
|
|
|
+ window.$message.success('删除成功')
|
|
|
|
+ getTableData().then()
|
|
}
|
|
}
|
|
|
|
|
|
//批量删除
|
|
//批量删除
|
|
@@ -210,18 +212,12 @@ const delClick = () => {
|
|
}
|
|
}
|
|
//确认删除
|
|
//确认删除
|
|
HcDelMsg(async (resolve) => {
|
|
HcDelMsg(async (resolve) => {
|
|
- //发起请求
|
|
|
|
const ids = arrToId(rows)
|
|
const ids = arrToId(rows)
|
|
- const { code, msg } = await mainApi.del(ids)
|
|
|
|
- //关闭弹窗的回调
|
|
|
|
- resolve()
|
|
|
|
- //处理结果
|
|
|
|
- if (code === 200) {
|
|
|
|
- window.$message.success('删除成功')
|
|
|
|
- getTableData().then()
|
|
|
|
- } else {
|
|
|
|
- window.$message.error(msg ?? '删除失败')
|
|
|
|
- }
|
|
|
|
|
|
+ const { isRes } = await mainApi.del(ids)
|
|
|
|
+ resolve() //关闭弹窗的回调
|
|
|
|
+ if (!isRes) return
|
|
|
|
+ window.$message.success('删除成功')
|
|
|
|
+ getTableData().then()
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
@@ -232,15 +228,12 @@ const dialogSubmit = async () => {
|
|
if (!formRes) return false
|
|
if (!formRes) return false
|
|
submitLoading.value = true
|
|
submitLoading.value = true
|
|
//发起请求
|
|
//发起请求
|
|
- const { error, code, msg } = await mainApi.submit(formModel.value)
|
|
|
|
|
|
+ const { isRes } = await mainApi.submit(formModel.value)
|
|
submitLoading.value = false
|
|
submitLoading.value = false
|
|
- if (!error && code === 200) {
|
|
|
|
- dialogClose()
|
|
|
|
- window?.$message?.success('操作成功')
|
|
|
|
- getTableData().then()
|
|
|
|
- } else {
|
|
|
|
- window?.$message?.error(msg ?? '操作失败')
|
|
|
|
- }
|
|
|
|
|
|
+ if (!isRes) return
|
|
|
|
+ dialogClose()
|
|
|
|
+ window?.$message?.success('操作成功')
|
|
|
|
+ getTableData().then()
|
|
}
|
|
}
|
|
|
|
|
|
//关闭弹窗
|
|
//关闭弹窗
|