diff --git a/src/views/backOfficeSystem/JudgmentHome/dataReduction/addForm.vue b/src/views/backOfficeSystem/JudgmentHome/dataReduction/addForm.vue
index 401fa3a..ab9e818 100644
--- a/src/views/backOfficeSystem/JudgmentHome/dataReduction/addForm.vue
+++ b/src/views/backOfficeSystem/JudgmentHome/dataReduction/addForm.vue
@@ -8,7 +8,41 @@
@@ -18,8 +52,10 @@
import FormMessage from "@/components/aboutTable/FormMessage.vue";
import UploadFile from "@/components/MyComponents/Upload/index.vue";
// import ChooseUser from "@/components/ChooseList/ChooseUser/index.vue"
-import { ref, defineExpose, reactive, defineEmits, getCurrentInstance, watch } from "vue";
-import { sjzlAddEntity, sjzlEditEntity, sjzlGetInfo } from '@//api/yj.js'
+import { ref, defineExpose, reactive, defineEmits, getCurrentInstance, watch, computed } from "vue";
+import { sjzlAddEntity, sjzlEditEntity, sjzlGetInfo, sjzlPerfectlnfo } from '@//api/yj.js'
+import { getItem } from '@//utils/storage.js'
+
const emit = defineEmits(["updateDate", "getList"]);
const props = defineProps({
dict: Object
@@ -30,11 +66,23 @@ const dialogForm = ref(false); //弹窗
const formData = ref([
]);
+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'
+})
const listQuery = ref({}); //表单
const loading = ref(false);
const elform = ref();
const title = ref("");
+const tableList = ref([])
+// const detailObj = ref({})
const rules = reactive({
+ // 可以在这里添加表单验证规则
});
watch(() => props.dict, (val) => {
if (val) {
@@ -45,9 +93,45 @@ watch(() => props.dict, (val) => {
{ label: "研判方式", prop: "ypfs", type: "radio", options: props.dict.D_BZ_YPFS, width: '48%' },
{ label: "参与研判部门", prop: "jsdxBmDm", type: "department", multiple: true, depMc: 'jsdxBmMc', width: '48%' },
{ label: "研判要求", prop: "ypyq", type: "textarea", width: '100%' },
+ { label: "列表", prop: "bmList", type: "slot", width: '100%' },
]
}
})
+function getFjArr(fj) {
+ if (typeof fj !== 'string' || !fj) return []
+ let fjArr = []
+ try {
+ fjArr = JSON.parse(fj)
+ } catch (error) {
+ console.log('error: ', error);
+ }
+ return fjArr
+}
+watch(() => listQuery.value.jsdxBmDm, (val) => {
+ /** @type {Array<{ypbmdm: string, ypbmmc: string, scyq: string, fj: Array, wcqk: string}>} 参与研判部门数据数组 */
+ const arr = Array.isArray(val) ? val : []
+ const cyypList = Array.isArray(listQuery.value.cyypList) ? listQuery.value.cyypList : []
+
+ tableList.value = arr.map((item, i) => {
+ /** 找原来的对象 */
+ const curr = cyypList.find(item2 => item2.ypbmdm == item) || {}
+ /** 是否是新增 */
+ const isAddForm = !listQuery.value.id
+ return {
+ // id: null,
+ // sjzlid: null, // 研判数据整理ID
+ /** 部门代码 */
+ ypbmdm: item,
+ ypbmmc: listQuery.value.jsdxBmMc[i],
+ /** 素材要求 */
+ scyq: isAddForm ? '' : curr.scyq,
+ fj: isAddForm ? [] : getFjArr(curr.fj),
+ /** 完成情况(01 准备中、02 已完成)*/
+ wcqk: isAddForm ? '01' : curr.wcqk || '01'
+ }
+ })
+})
+
// 初始化数据
const init = (type, row, wjlb) => {
dialogForm.value = true;
@@ -57,28 +141,56 @@ const init = (type, row, wjlb) => {
// 根据id查询详情
const getDataById = (id) => {
sjzlGetInfo(id).then((res) => {
- listQuery.value = res;
- listQuery.value.jsdxBmDm = res.cyypList.map(item => {
+ listQuery.value = res || {};
+ const cyypList = Array.isArray(res.cyypList) ? res.cyypList : []
+ listQuery.value.jsdxBmDm = cyypList.map(item => {
return item.ypbmdm
})
- listQuery.value.jsdxBmMc = res.cyypList.map(item => {
+ listQuery.value.jsdxBmMc = cyypList.map(item => {
return item.ypbmmc
})
});
};
+function getFjString(arr) {
+ arr = Array.isArray(arr) ? arr : []
+ return JSON.stringify(arr)
+}
+/**获取下发部门数据 */
+const getXfbmList = () => {
+ const cyypList = Array.isArray(listQuery.value.cyypList) ? listQuery.value.cyypList : []
+ return tableList.value.map((item, i) => {
+
+ /** 找原来的对象 */
+ const curr = cyypList.find(item => item.ypbmdm == item.ypbmdm) || {}
+ return {
+ id: curr.id || null,
+ sjzlid: curr.sjzlid || null, // 研判数据整理ID
+ ypbmdm: item.ypbmdm,
+ ypbmmc: listQuery.value.jsdxBmMc[i],
+ /** 素材要求 */
+ scyq: item.scyq,
+ fj: getFjString(item.fj),
+ /** 完成情况(01 准备中、02 已完成)*/
+ wcqk: item.wcqk
+ }
+
+ })
+}
// 提交
const submit = () => {
elform.value.submit(async (data) => {
+ const xfbmList = getXfbmList()
let params = {
...listQuery.value,
- cyypList: listQuery.value.jsdxBmDm.map((item, index) => {
- return {
- ypbmdm: item,
- ypbmmc: listQuery.value.jsdxBmMc[index],
- ypcylx: '01'
- }
- })
+ cyypList: xfbmList,
+ // cyypList: listQuery.value.jsdxBmDm.map((item, index) => {
+ // return {
+ // ypbmdm: item,
+ // ypbmmc: listQuery.value.jsdxBmMc[index],
+ // ypcylx: '01'
+ // }
+ // })
};
try {
loading.value = true;
@@ -97,7 +209,7 @@ const submit = () => {
loading.value = false;
} catch (error) {
- console.log(error);
+
loading.value = false;
}
});
@@ -110,6 +222,28 @@ const submit = () => {
// userList.value = val
// listQuery.value.jsrxm = val.map(item => item.userName).join(',')
// }
+// 修改状态
+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 close = () => {
listQuery.value = {};