负面行业策略

V0.1
yujialong 1 year ago
parent 184b529830
commit 5118e5696d
  1. 1
      src/views/product/strategy/155.vue
  2. 204
      src/views/product/strategy/156.vue
  3. 2
      src/views/product/strategy/CardList.vue

@ -353,7 +353,6 @@ const getName = (str: string): string | number => {
};
//
const addRecord = async (data: Record<string, any>) => {
console.log(33, data[1].ruleOne, getName(data[1].ruleOne));
const preIds = `1,${Cookies.get('sand-level')},42,67,147,155`; // 1id
const rule: Array<Record<string, any>> = [
handleId(387, 150, data[0].ruleOne, preIds + ',384,387', 5),

@ -0,0 +1,204 @@
<template>
<!-- 负面行业策略 -->
<el-table class="c-table"
:data="form"
:max-height="height"
:span-method="span"
border>
<el-table-column label="序号"
width="80"
align="center">
<template #default="{ row, $index }">
<p v-if="isRule($index)"
class="text-left font-semibold text-base text-[#333]">{{ row.name }}</p>
<span v-else>{{ row.index }}</span>
</template>
</el-table-column>
<el-table-column prop="name"
label="禁入行业"
min-width="150"
align="center">
</el-table-column>
<el-table-column label="本人工作单位"
min-width="150"
align="center">
<template #default="{ row, $index }">
<el-checkbox v-model="row.myselfWorkplace"></el-checkbox>
</template>
</el-table-column>
<el-table-column label="配偶工作单位"
min-width="150"
align="center">
<template #default="{ row }">
<el-checkbox v-model="row.spouseWorkplace"></el-checkbox>
</template>
</el-table-column>
<el-table-column label="本人名下企业"
min-width="150"
align="center">
<template #default="{ row }">
<el-checkbox v-model="row.myselfEnterprise"></el-checkbox>
</template>
</el-table-column>
<el-table-column label="配偶名下企业"
min-width="150"
align="center">
<template #default="{ row }">
<el-checkbox v-model="row.spouseEnterprise"></el-checkbox>
</template>
</el-table-column>
</el-table>
<div class="flex justify-end">
<div class="submit"
@click="submit">确认完成配置</div>
</div>
</template>
<script setup lang="ts">
import { ref, computed, watch, onMounted } from 'vue';
import { ElMessage } from 'element-plus';
import { accessStrategyNegativeIndustryStrategyFind, accessStrategyNegativeIndustryStrategySave } from '@/api/model';
import { getProcessInformationBasedOnRoles, addOperation } from '@/api/judgment';
import type { TableColumnCtx } from 'element-plus';
import { useRouter, useRoute } from 'vue-router';
import { handleId, getNum, getChinese } from '@/utils/common';
import Cookies from 'js-cookie';
const router = useRouter();
const route = useRoute();
const projectId = +Cookies.get('sand-projectId');
const levelId = +Cookies.get('sand-level');
const form = ref<Record<string, any>[]>([]);
const info = ref<Record<string, any>[]>([]);
const height = window.innerHeight - 270;
//
const getConfig = async () => {
const { process } = await getProcessInformationBasedOnRoles(156);
const result = [];
let index = 0;
process.map((e) => {
let temp = {
checkpointId: levelId,
projectId,
name: e.name,
};
result.push(temp);
e?.recordChildren.forEach((n, i) => {
index++;
temp = JSON.parse(JSON.stringify(temp));
const cur = info.value.find((j) => j.stRecordId === n.id);
temp.stRecordId = n.id;
temp.subjectId = n.subjectId;
temp.parentId = e.id;
temp.name = n.name;
temp.index = index;
temp.myselfEnterprise = !!cur?.myselfEnterprise;
temp.myselfWorkplace = !!cur?.myselfWorkplace;
temp.spouseEnterprise = !!cur?.spouseEnterprise;
temp.spouseWorkplace = !!cur?.spouseWorkplace;
result.push(temp);
});
});
form.value = result;
};
//
const getDetail = async () => {
try {
const { data } = await accessStrategyNegativeIndustryStrategyFind(levelId, projectId);
info.value = data;
getConfig();
} finally {
}
};
watch(
() => route.query,
() => {
getDetail();
},
{
immediate: true,
},
);
const isRule = (rule: number): boolean => {
return !rule || rule === 43 || rule === 63 || rule === 89;
};
interface SpanMethodProps {
row: Record<string, any>;
column: TableColumnCtx<Record<string, any>>;
rowIndex: number;
columnIndex: number;
}
//
const span = ({ row, column, rowIndex, columnIndex }: SpanMethodProps) => {
if (isRule(rowIndex)) {
if (!columnIndex) {
return {
rowspan: 1,
colspan: 6,
};
} else {
return {
rowspan: 0,
colspan: 0,
};
}
}
};
//
const submit = async () => {
let param = [];
form.value.map((e, i) => {
if (e.index) {
param.push({
checkpointId: levelId,
projectId,
stRecordId: e.stRecordId,
id: info.value.find((j) => j.stRecordId === e.stRecordId)?.id ?? '',
myselfEnterprise: e.myselfEnterprise ? 1 : 0,
myselfWorkplace: e.myselfWorkplace ? 1 : 0,
spouseEnterprise: e.spouseEnterprise ? 1 : 0,
spouseWorkplace: e.spouseWorkplace ? 1 : 0,
});
}
});
await accessStrategyNegativeIndustryStrategySave({ negativeIndustryStrategyList: param });
addRecord(param);
getDetail();
ElMessage.success('提交成功!');
};
//
const addRecord = async (data: Record<string, any>) => {
const preIds = `1,${Cookies.get('sand-level')},42,67,147,156`; // 1id
const rule: Array<Record<string, any>> = [];
form.value.map((e) => {
if (e.index) {
const temp = [];
e.myselfWorkplace && temp.push(383);
e.spouseWorkplace && temp.push(384);
e.myselfEnterprise && temp.push(385);
e.spouseEnterprise && temp.push(386);
temp.length && rule.push(handleId(e.stRecordId, e.subjectId, temp.join(), preIds + ',' + e.parentId + ',' + e.stRecordId, 1));
}
});
await addOperation({
checkpointId: levelId,
parentId: preIds,
lcJudgmentRuleReq: rule,
projectId,
});
};
</script>
<style lang="scss" scoped>
@import url(../../../styles/form.scss);
.c-table {
:deep(.el-input__inner) {
@apply px-2;
}
}
</style>

@ -24,6 +24,7 @@
<Com4 v-else-if="id == 153" />
<Com5 v-else-if="id == 154" />
<Com6 v-else-if="id == 155" />
<Com7 v-else-if="id == 156" />
</div>
</div>
</el-tab-pane>
@ -46,6 +47,7 @@ import Com3 from './152.vue';
import Com4 from './153.vue';
import Com5 from './154.vue';
import Com6 from './155.vue';
import Com7 from './156.vue';
const router = useRouter();
const route = useRoute();

Loading…
Cancel
Save