feat: 修改状态更新
This commit is contained in:
@ -33,8 +33,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="120" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-button type="text" size="small" @click="updateStatus(row)"
|
||||
:disabled="isShiQingBaoZhongXin || (row.cjrsfzh && row.cjrsfzh != deptCode)">
|
||||
<el-button type="text" size="small" @click="updateStatus(row)" :disabled="updateDis(row)">
|
||||
修改状态
|
||||
</el-button>
|
||||
</template>
|
||||
@ -45,7 +44,24 @@
|
||||
</FormMessage>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <ChooseUser v-model="chooseUserVisible" @choosedUsers="handleUserSelected" :roleIds="roleIds" :Single="false" /> -->
|
||||
|
||||
<!-- 修改状态弹框 -->
|
||||
<div class="dialog" v-if="statusDialog">
|
||||
<div class="head_box">
|
||||
<span class="title">修改状态</span>
|
||||
<div>
|
||||
<el-button type="primary" size="small" :loading="statusLoading" @click="submitStatus">保存</el-button>
|
||||
<el-button size="small" @click="closeStatusDialog">关闭</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form_cnt">
|
||||
<el-form :model="statusForm" label-width="80px">
|
||||
<el-form-item label="附件">
|
||||
<UploadFile v-model="statusForm.fj" :limit="2" :isImg="false" :isAll="true" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
@ -71,7 +87,6 @@ const { deptBizType, deptLevel, deptCode } = getItem('deptId')[0]
|
||||
const sfzh = getItem('idEntityCard')
|
||||
/** 是否市情报指挥中心 */
|
||||
const isShiQingBaoZhongXin = computed(() => {
|
||||
|
||||
const Jb = deptLevel[0] == '2' ? '01' : deptLevel[0] == '3' ? '02' : '03'
|
||||
return deptBizType == '23' && Jb == '01'
|
||||
})
|
||||
@ -81,6 +96,13 @@ const elform = ref();
|
||||
const title = ref("");
|
||||
const tableList = ref([])
|
||||
// const detailObj = ref({})
|
||||
const statusDialog = ref(false) // 修改状态弹框
|
||||
const statusLoading = ref(false)
|
||||
const statusForm = ref({ fj: [] }) // 修改状态表单
|
||||
const currentRow = ref({}) // 当前操作的行
|
||||
/** 外面行数据 */
|
||||
const outRow = ref({})
|
||||
|
||||
const rules = reactive({
|
||||
// 可以在这里添加表单验证规则
|
||||
});
|
||||
@ -97,13 +119,23 @@ watch(() => props.dict, (val) => {
|
||||
]
|
||||
}
|
||||
})
|
||||
/** 是否修改禁用 */
|
||||
function updateDis(row) {
|
||||
/** 无id 禁用 */
|
||||
if (!listQuery.value.id) return true
|
||||
/** 是否创建人 */
|
||||
const iscjr = !row.cjrsfzh || row?.cjrsfzh == deptCode
|
||||
/** 是否完成 */
|
||||
const isFinish = row.wcqk === '02'
|
||||
return isShiQingBaoZhongXin.value || !iscjr || isFinish
|
||||
}
|
||||
function getFjArr(fj) {
|
||||
if (typeof fj !== 'string' || !fj) return []
|
||||
let fjArr = []
|
||||
try {
|
||||
fjArr = JSON.parse(fj)
|
||||
} catch (error) {
|
||||
console.log('error: ', error);
|
||||
|
||||
}
|
||||
return fjArr
|
||||
}
|
||||
@ -131,11 +163,11 @@ watch(() => listQuery.value.jsdxBmDm, (val) => {
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
// 初始化数据
|
||||
const init = (type, row, wjlb) => {
|
||||
dialogForm.value = true;
|
||||
title.value = type == "add" ? "新增" : type == "edit" ? "编辑" : "详情";
|
||||
outRow.value = row || {}
|
||||
if (row) { getDataById(row.id) }
|
||||
};
|
||||
// 根据id查询详情
|
||||
@ -224,26 +256,47 @@ const submit = () => {
|
||||
// }
|
||||
// 修改状态
|
||||
const updateStatus = (row) => {
|
||||
proxy.$confirm('确认修改状态?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
// 调用xx接口,这里需要根据实际接口调整
|
||||
// 例如:updateStatusApi(row.id).then(...)
|
||||
if (row.wcqk == '01') {
|
||||
row.wcqk = '02'
|
||||
} else {
|
||||
row.wcqk = '01'
|
||||
}
|
||||
proxy.$message({
|
||||
type: 'success',
|
||||
message: '修改成功'
|
||||
});
|
||||
// 更新本地状态
|
||||
})
|
||||
const cyypList = Array.isArray(listQuery.value.cyypList) ? listQuery.value.cyypList : []
|
||||
/** 找原来的对象 */
|
||||
const curr = cyypList.find(item2 => item2.ypbmdm == row.ypbmdm) || {}
|
||||
currentRow.value = { ...curr, row }
|
||||
statusForm.value = { fj: [] }
|
||||
statusDialog.value = true
|
||||
};
|
||||
|
||||
// 提交修改状态
|
||||
const submitStatus = async () => {
|
||||
try {
|
||||
statusLoading.value = true
|
||||
const params = {
|
||||
id: currentRow.value.id,
|
||||
fj: statusForm.value.fj?.length > 0 ? getFjString(statusForm.value.fj) : '',
|
||||
wcqk: '02'
|
||||
}
|
||||
|
||||
const res = await sjzlPerfectlnfo(params)
|
||||
if (res && res > 0) {
|
||||
proxy.$message({ type: "success", message: "修改成功" })
|
||||
// 更新本地状态
|
||||
currentRow.value.wcqk = '02'
|
||||
|
||||
closeStatusDialog()
|
||||
if (outRow.value.id) { getDataById(outRow.value.id) }
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
} finally {
|
||||
statusLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 关闭修改状态弹框
|
||||
const closeStatusDialog = () => {
|
||||
statusDialog.value = false
|
||||
statusForm.value = { fj: [] }
|
||||
statusLoading.value = false
|
||||
}
|
||||
|
||||
// 关闭
|
||||
const close = () => {
|
||||
listQuery.value = {};
|
||||
|
||||
@ -48,7 +48,7 @@ import Pages from "@/components/aboutTable/Pages.vue";
|
||||
import Search from "@/components/aboutTable/Search.vue";
|
||||
import { useRoute } from 'vue-router'
|
||||
import { sjzlGetPageList, sjzldeleteEntity } from "@/api/yj.js";
|
||||
import { reactive, ref, onMounted, getCurrentInstance, watch } from "vue";
|
||||
import { reactive, ref, onMounted, getCurrentInstance, watch,computed } from "vue";
|
||||
import AddForm from "./addForm.vue";
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { D_BZ_YPFS, D_BZ_YPLX } = proxy.$dict("D_BZ_YPFS", "D_BZ_YPLX")
|
||||
@ -64,7 +64,11 @@ onMounted(() => {
|
||||
}
|
||||
getList()
|
||||
});
|
||||
|
||||
/** 是否市情报指挥中心 */
|
||||
const isShiQingBaoZhongXin = computed(() => {
|
||||
const Jb = deptLevel[0] == '2' ? '01' : deptLevel[0] == '3' ? '02' : '03'
|
||||
return deptBizType == '23' && Jb == '01'
|
||||
})
|
||||
|
||||
const searchConfiger = ref([
|
||||
{ label: "研判议题", prop: 'ypyt', placeholder: "请输入研判议题", showType: "input" },
|
||||
|
||||
Reference in New Issue
Block a user