|
@@ -1,7 +1,8 @@
|
|
|
<template>
|
|
|
<div class="pblm-detail-wrapper">
|
|
|
<van-form @submit="onSubmit">
|
|
|
- <card01 :description="`工程地址:${pblm.location}<br/>问题类型:${listTypeConvert(pblm.listType)}`"
|
|
|
+ <card01 v-if="pblm && pblm.length > 0"
|
|
|
+ :description="`工程地址:${pblm.location}<br/>问题类型:${listTypeConvert(pblm.listType)}`"
|
|
|
:title="pblm.name + ''" icon="label"
|
|
|
style="margin-top: 0;"/>
|
|
|
<div class="pblm-detail-label">
|
|
@@ -70,7 +71,6 @@
|
|
|
<van-icon color="#000" name="delete-o" size="1rem"/>
|
|
|
</van-col>
|
|
|
</van-row>
|
|
|
-
|
|
|
</div>
|
|
|
<van-button block hairline plain round @click="addPblmSubject">
|
|
|
<van-icon color="#000" name="plus" size="1rem" style="margin-right: 5px;"/>
|
|
@@ -85,8 +85,8 @@
|
|
|
</van-form>
|
|
|
|
|
|
<van-popup v-model:show="tacObjPblmstbShow" :style="{ width: '80%', height: '100%' }" position="left">
|
|
|
- <tacObjPblmstbList :listType="pblm.listType" style="z-index:3000;" @change="changeTacObjPblmstb">
|
|
|
- </tacObjPblmstbList>
|
|
|
+ <tacObjPblmstbList :listType="pblm.listType" style="z-index:3000;"
|
|
|
+ @change="changeTacObjPblmstb"></tacObjPblmstbList>
|
|
|
</van-popup>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -99,16 +99,17 @@ import GwSelect02 from '@/components/GwSelect02.vue';
|
|
|
import tacObjPblmstbList from './TacObjPblmstbList.vue';
|
|
|
import {listTypeConvert} from "@/utils/convert";
|
|
|
import {getTacQuestionById} from "@/api/inspect";
|
|
|
-import {addTacQuestion, getTacUnitList} from "@/api/questions";
|
|
|
+import {addTacQuestion, getIllegalActById, getTacUnitList} from "@/api/questions";
|
|
|
import {copyObj} from "@/utils/ruoyi";
|
|
|
+import {useUserStore} from "@/stores/user";
|
|
|
|
|
|
const route = useRoute();
|
|
|
+const userStore = useUserStore();
|
|
|
+const listType = ref(route.query.inspectType || '1');
|
|
|
const pblm = ref({});
|
|
|
const tacObjPblmstb = computed(() => pblm.value.tacObjPblmstb || {});
|
|
|
-const cateObjList = computed(() => tacObjPblmstb.value?.cateObjList?.map(i => {
|
|
|
- return {text: i.desc, value: i.cate}
|
|
|
-}) || []);
|
|
|
-const objSubjectList = computed(() => pblm.value.tacObjPblmstb.objSubjectList || []);
|
|
|
+const cateObjList = ref([]);
|
|
|
+const objSubjectList = ref([]);
|
|
|
const objSubjectTypeColumns = computed(() => objSubjectList.value?.map(i => {
|
|
|
return {text: i.subName, value: i.id}
|
|
|
}) || []);
|
|
@@ -119,14 +120,20 @@ const gwComFileList = computed(() => pblm.value.gwComFileList?.map(i => {
|
|
|
/**
|
|
|
* 责任主体
|
|
|
*/
|
|
|
-const subjectList = ref([])
|
|
|
-
|
|
|
+const subjectList = ref([]);
|
|
|
const tacObjPblmstbShow = ref(false);
|
|
|
|
|
|
function getQuestionData() {
|
|
|
getTacQuestionById(route.params.id).then(res => {
|
|
|
- pblm.value = res.data
|
|
|
- subjectList.value = res.data.pblmSubjectList;
|
|
|
+ if (res.data && Object.keys(res.data).length > 0) {
|
|
|
+ pblm.value = res.data
|
|
|
+ listType.value = res.data.listType
|
|
|
+ subjectList.value = res.data.pblmSubjectList;
|
|
|
+ cateObjList.value = res.data.tacObjPblmstb.cateObjList.map(i => {
|
|
|
+ return {text: i.desc, value: i.cate}
|
|
|
+ }) || []
|
|
|
+ objSubjectList.value = pblm.value.tacObjPblmstb.objSubjectList
|
|
|
+ }
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -138,9 +145,44 @@ function showTacObjPblmstbPopup() {
|
|
|
}
|
|
|
|
|
|
function changeTacObjPblmstb(data) {
|
|
|
- tacObjPblmstbShow.value = false;
|
|
|
- pblm.value.tacObjPblmstb = data;
|
|
|
- pblm.value.pblmstdId = data.id;
|
|
|
+ if (!data || !data.id) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ getIllegalActById(data.id).then(res => {
|
|
|
+ tacObjPblmstbShow.value = false;
|
|
|
+ pblm.value.tacObjPblmstb = res.data;
|
|
|
+ pblm.value.pblmstdId = res.data.id;
|
|
|
+ cateObjList.value = res.data.cateObjList.map(i => {
|
|
|
+ return {text: i.desc, value: i.cate}
|
|
|
+ }) || []
|
|
|
+ objSubjectList.value = res.data.objSubjectList
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+// eslint-disable-next-line no-unused-vars
|
|
|
+function uniArr(tempArr) {
|
|
|
+ var newTempArr = [];
|
|
|
+ if (tempArr && tempArr.length > 0) {
|
|
|
+ tempArr.forEach((item) => {
|
|
|
+ if (item.unitNm || item.subId) {
|
|
|
+ newTempArr.push(item);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ for (let i = 0; i < newTempArr.length; i++) {
|
|
|
+ for (let j = i + 1; j < newTempArr.length; j++) {
|
|
|
+ if ((newTempArr[i].unitNm == newTempArr[j].unitNm) && (newTempArr[i].subId == newTempArr[j].subId)) {
|
|
|
+ newTempArr.splice(j, 1);
|
|
|
+ j--;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return newTempArr;
|
|
|
+ } else {
|
|
|
+ return [];
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -148,8 +190,63 @@ function changeTacObjPblmstb(data) {
|
|
|
*/
|
|
|
function onSubmit() {
|
|
|
const data = copyObj(pblm.value)
|
|
|
+ if (!data.pblmstdId) {
|
|
|
+ showNotify({type: 'warning', message: '请选择问题'});
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!data.sn) {
|
|
|
+ data.sn = 0
|
|
|
+ }
|
|
|
+ if (data.pblmReason && data.pblmReason.length >= 500) {
|
|
|
+ showNotify({type: 'warning', message: '主要原因分析需字数小于500字!'});
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (data.pblmSggtn && data.pblmSggtn.length >= 1000) {
|
|
|
+ showNotify({type: 'warning', message: '整改意见及建议字数需小于1000字!'});
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (data.spclRvwOptn && data.spclRvwOptn.length >= 500) {
|
|
|
+ showNotify({type: 'warning', message: '稽察组长意见字数需小于500字!'});
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (data.pblmRevision && data.pblmRevision.length >= 500) {
|
|
|
+ showNotify({type: 'warning', message: '问题修改理由字数需小于500字!'});
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ data.relativeLaw = data.tacObjPblmstb.relativeLaw
|
|
|
+ data.lawContent = data.tacObjPblmstb.lawContent
|
|
|
data.pblmSubjectList = subjectList.value
|
|
|
- addTacQuestion(data).then(() => {
|
|
|
+ if (!data.id) {
|
|
|
+ // data.stepId = stepId
|
|
|
+ data.objId = route.query.objId;
|
|
|
+ data.rgstrId = route.query.rgstrId;
|
|
|
+ data.listType = listType.value;
|
|
|
+ data.persId = userStore.userId;
|
|
|
+ }
|
|
|
+
|
|
|
+ let unitNames = []
|
|
|
+ let subIds = []
|
|
|
+ const unitArray = uniArr(subjectList.value);
|
|
|
+ unitArray.forEach((ele) => {
|
|
|
+ unitNames.push(ele.unitNm)
|
|
|
+ subIds.push(ele.subId)
|
|
|
+ })
|
|
|
+ unitNames = unitNames.filter(function (s) {
|
|
|
+ return s && s.trim();
|
|
|
+ });
|
|
|
+ subIds = subIds.filter(function (s) {
|
|
|
+ return s && s.trim();
|
|
|
+ });
|
|
|
+ if ((unitNames.length != subIds.length) && unitNames.length != 0 && subIds.length != 0) {
|
|
|
+ showNotify({type: 'warning', message: '对应的单位性质或单位名称其中一个不能为空'});
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ data.subjectNames = unitNames.join(',')
|
|
|
+ data.subjectIds = subIds.join(',')
|
|
|
+
|
|
|
+
|
|
|
+ addTacQuestion(data).then(res => {
|
|
|
+ pblm.value.id = res.data.id
|
|
|
showNotify({type: 'success', message: '保存成功'});
|
|
|
})
|
|
|
}
|