feat: 修改状态更新
This commit is contained in:
@ -33,8 +33,7 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" width="120" align="center">
|
<el-table-column label="操作" width="120" align="center">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-button type="text" size="small" @click="updateStatus(row)"
|
<el-button type="text" size="small" @click="updateStatus(row)" :disabled="updateDis(row)">
|
||||||
:disabled="isShiQingBaoZhongXin || (row.cjrsfzh && row.cjrsfzh != deptCode)">
|
|
||||||
修改状态
|
修改状态
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
@ -45,7 +44,24 @@
|
|||||||
</FormMessage>
|
</FormMessage>
|
||||||
</div>
|
</div>
|
||||||
</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>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
@ -71,7 +87,6 @@ const { deptBizType, deptLevel, deptCode } = getItem('deptId')[0]
|
|||||||
const sfzh = getItem('idEntityCard')
|
const sfzh = getItem('idEntityCard')
|
||||||
/** 是否市情报指挥中心 */
|
/** 是否市情报指挥中心 */
|
||||||
const isShiQingBaoZhongXin = computed(() => {
|
const isShiQingBaoZhongXin = computed(() => {
|
||||||
|
|
||||||
const Jb = deptLevel[0] == '2' ? '01' : deptLevel[0] == '3' ? '02' : '03'
|
const Jb = deptLevel[0] == '2' ? '01' : deptLevel[0] == '3' ? '02' : '03'
|
||||||
return deptBizType == '23' && Jb == '01'
|
return deptBizType == '23' && Jb == '01'
|
||||||
})
|
})
|
||||||
@ -81,6 +96,13 @@ const elform = ref();
|
|||||||
const title = ref("");
|
const title = ref("");
|
||||||
const tableList = ref([])
|
const tableList = ref([])
|
||||||
// const detailObj = 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({
|
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) {
|
function getFjArr(fj) {
|
||||||
if (typeof fj !== 'string' || !fj) return []
|
if (typeof fj !== 'string' || !fj) return []
|
||||||
let fjArr = []
|
let fjArr = []
|
||||||
try {
|
try {
|
||||||
fjArr = JSON.parse(fj)
|
fjArr = JSON.parse(fj)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('error: ', error);
|
|
||||||
}
|
}
|
||||||
return fjArr
|
return fjArr
|
||||||
}
|
}
|
||||||
@ -131,11 +163,11 @@ watch(() => listQuery.value.jsdxBmDm, (val) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
// 初始化数据
|
// 初始化数据
|
||||||
const init = (type, row, wjlb) => {
|
const init = (type, row, wjlb) => {
|
||||||
dialogForm.value = true;
|
dialogForm.value = true;
|
||||||
title.value = type == "add" ? "新增" : type == "edit" ? "编辑" : "详情";
|
title.value = type == "add" ? "新增" : type == "edit" ? "编辑" : "详情";
|
||||||
|
outRow.value = row || {}
|
||||||
if (row) { getDataById(row.id) }
|
if (row) { getDataById(row.id) }
|
||||||
};
|
};
|
||||||
// 根据id查询详情
|
// 根据id查询详情
|
||||||
@ -224,26 +256,47 @@ const submit = () => {
|
|||||||
// }
|
// }
|
||||||
// 修改状态
|
// 修改状态
|
||||||
const updateStatus = (row) => {
|
const updateStatus = (row) => {
|
||||||
proxy.$confirm('确认修改状态?', '提示', {
|
const cyypList = Array.isArray(listQuery.value.cyypList) ? listQuery.value.cyypList : []
|
||||||
confirmButtonText: '确定',
|
/** 找原来的对象 */
|
||||||
cancelButtonText: '取消',
|
const curr = cyypList.find(item2 => item2.ypbmdm == row.ypbmdm) || {}
|
||||||
type: 'warning'
|
currentRow.value = { ...curr, row }
|
||||||
}).then(() => {
|
statusForm.value = { fj: [] }
|
||||||
// 调用xx接口,这里需要根据实际接口调整
|
statusDialog.value = true
|
||||||
// 例如:updateStatusApi(row.id).then(...)
|
|
||||||
if (row.wcqk == '01') {
|
|
||||||
row.wcqk = '02'
|
|
||||||
} else {
|
|
||||||
row.wcqk = '01'
|
|
||||||
}
|
|
||||||
proxy.$message({
|
|
||||||
type: 'success',
|
|
||||||
message: '修改成功'
|
|
||||||
});
|
|
||||||
// 更新本地状态
|
|
||||||
})
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 提交修改状态
|
||||||
|
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 = () => {
|
const close = () => {
|
||||||
listQuery.value = {};
|
listQuery.value = {};
|
||||||
|
|||||||
@ -48,7 +48,7 @@ import Pages from "@/components/aboutTable/Pages.vue";
|
|||||||
import Search from "@/components/aboutTable/Search.vue";
|
import Search from "@/components/aboutTable/Search.vue";
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import { sjzlGetPageList, sjzldeleteEntity } from "@/api/yj.js";
|
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";
|
import AddForm from "./addForm.vue";
|
||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
const { D_BZ_YPFS, D_BZ_YPLX } = proxy.$dict("D_BZ_YPFS", "D_BZ_YPLX")
|
const { D_BZ_YPFS, D_BZ_YPLX } = proxy.$dict("D_BZ_YPFS", "D_BZ_YPLX")
|
||||||
@ -64,7 +64,11 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
getList()
|
getList()
|
||||||
});
|
});
|
||||||
|
/** 是否市情报指挥中心 */
|
||||||
|
const isShiQingBaoZhongXin = computed(() => {
|
||||||
|
const Jb = deptLevel[0] == '2' ? '01' : deptLevel[0] == '3' ? '02' : '03'
|
||||||
|
return deptBizType == '23' && Jb == '01'
|
||||||
|
})
|
||||||
|
|
||||||
const searchConfiger = ref([
|
const searchConfiger = ref([
|
||||||
{ label: "研判议题", prop: 'ypyt', placeholder: "请输入研判议题", showType: "input" },
|
{ label: "研判议题", prop: 'ypyt', placeholder: "请输入研判议题", showType: "input" },
|
||||||
|
|||||||
Reference in New Issue
Block a user