689 lines
24 KiB
Vue
689 lines
24 KiB
Vue
<template>
|
||
<view class="todo-page">
|
||
<step-title :stepPage="stepsPage" :stepText="stepsText"></step-title>
|
||
<view class="allview">
|
||
<view class="card" v-if="stepsPageList === 0">
|
||
<u--form labelWidth="auto" :model="model" ref="wForm" class="demo-ruleForm">
|
||
<view style="position: relative;">
|
||
<view style="position: absolute;left: -10px;color: #3d4b70;top: -3px;">*</view>
|
||
</view>
|
||
|
||
<view style="font-size: 15px; font-weight: bold;color: #3d4b70;margin-bottom: 10px;">基本信息填写</view>
|
||
<u-form-item label="审核意见:" prop="CONTEXT" borderBottom v-if="model.STATUS==40">
|
||
</u-form-item>
|
||
<u--textarea v-html="model.CONTEXT" border="surround" v-if="model.STATUS==40" disabled></u--textarea>
|
||
<u-form-item label="生产单元:" prop="Product_Unit" @click="handleChange('SKProductionUnit')">
|
||
<u--input v-model="model.Product_Unit" placeholder="请选择生产单元" disabled disabledColor="#ffffff" border="none" inputAlign="right" fontSize="14px">
|
||
</u--input>
|
||
<u-icon style="margin-left: 4px;" slot="right" name="arrow-down" size="12">
|
||
</u-icon>
|
||
</u-form-item>
|
||
<u-form-item label="检查类型:" prop="Check_Type" @click="handleShowSheet({title: '检查类型', name: 'Nav_CheckType'})">
|
||
<u--input placeholder="请选择检查类型" v-model="(model.Nav_CheckType||{}).NAME" disabled disabledColor="#ffffff" border="none" inputAlign="right" fontSize="14px"></u--input>
|
||
<u-icon style="margin-left: 4px;" slot="right" name="arrow-down" size="12">
|
||
</u-icon>
|
||
</u-form-item>
|
||
<u-form-item label="检查周期:" prop="PLANCHECKFREQUENCYName" @click="handleChange('SKPLANCHECKFREQUENCYEnum')">
|
||
<u--input v-model="model.PLANCHECKFREQUENCYName" disabled placeholder="请选择检查周期" disabledColor="#ffffff" border="none" inputAlign="right" fontSize="14px"></u--input>
|
||
<u-icon style="margin-left: 4px;" slot="right" name="arrow-down" size="12">
|
||
</u-icon>
|
||
</u-form-item>
|
||
<u-form-item label="检查层级:" prop="DEPARTMENT_TYPEName" @click="handleChange('SKDepartmentTypeEnum')">
|
||
<u--input v-model="model.DEPARTMENT_TYPEName" disabled placeholder="请选择检查层级" disabledColor="#ffffff" border="none" inputAlign="right" fontSize="14px">
|
||
|
||
</u--input>
|
||
<u-icon style="margin-left: 4px;" slot="right" name="arrow-down" size="12">
|
||
</u-icon>
|
||
</u-form-item>
|
||
<u-form-item required label="检查时间:" prop="CHECK_TIME" @click="handleChangeDate()">
|
||
<u--input v-model="model.CHECK_TIME" disabled disabledColor="#ffffff" placeholder="请选择检查时间" border="none" inputAlign="right" fontSize="14px">
|
||
|
||
</u--input>
|
||
<u-icon style="margin-left: 4px;" slot="right" name="arrow-down" size="12">
|
||
</u-icon>
|
||
</u-form-item>
|
||
<view class="upload-title">附件:</view>
|
||
<full-upload v-model="model.Nav_CheckNoticeFiles" :isShowBtn='true' :listProp='listPropUpload' :listPropVal='listPropValUpload'></full-upload>
|
||
|
||
</u--form>
|
||
</view>
|
||
<view style="padding: 10px 16px;" v-if="stepsPageList === 0" class="bottom-button">
|
||
<u-button type="primary" @click="stepAdd" color="#3d4b70" :loading="stepLoad">下一步</u-button>
|
||
</view>
|
||
<view class="card" v-if="stepsPageList === 1">
|
||
<u--form labelPosition="left" labelWidth="auto" labelAlign="center" errorType="border-bottom" ref="wForm" class="sub-form">
|
||
|
||
|
||
<view style="position: relative;">
|
||
|
||
<view style="position: absolute;left: -10px;color: #3d4b70;top: -3px;">*</view>
|
||
</view>
|
||
|
||
<view style="font-size: 15px; font-weight: bold;color: #3d4b70;margin-bottom: 10px;margin-top: 20px;">检查内容</view>
|
||
<uni-collapse :border="false" accordion>
|
||
<view v-for="(item, index) in model.Nav_CheckNoticeDetails" :key="index">
|
||
<uni-collapse-item title-border="none" :border="false">
|
||
<template v-slot:title>
|
||
<view class="uni-collapse-item__title-box">
|
||
<view class="uni-collapse-item__title-text">
|
||
{{item.Nav_RiskArea?index+1+'.'+item.Nav_RiskArea.NAME:index+1+'.'}}
|
||
<span v-if="item.Nav_CheckNoticeDetailUsers && item.Nav_CheckNoticeDetailUsers.length">
|
||
({{ item.Nav_CheckNoticeDetailUsers.filter(i => !i.IS_DELETED).map(u => u.Nav_User.NAME).join('、') }})
|
||
</span>
|
||
</view>
|
||
<view @click.stop>
|
||
<u-icon @click="handleDelRowBefore(index)" name="trash" color="#ff4d4f" size="21" style="margin-right: 10px;"></u-icon>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
<view class="content">
|
||
<u-form-item label="检查区域:" prop="CHECK_TIME" @click="handleShowSheetForArea(item,{title: '检查区域', name: 'Nav_RiskArea'})">
|
||
<u--input disabled v-model="(item.Nav_RiskArea||{}).NAME" disabledColor="#ffffff" placeholder="请选择检查区域" border="none" inputAlign="right" fontSize="14px">
|
||
|
||
</u--input>
|
||
<u-icon style="margin-left: 4px;" slot="right" name="arrow-down" size="12">
|
||
</u-icon>
|
||
</u-form-item>
|
||
<u-form-item label="检查人员" @click="handleShowUserSelector(item,index)">
|
||
<u-icon name="man-add" size="24" color="#3d9cff" slot="right"></u-icon>
|
||
</u-form-item>
|
||
<view class="tag-view" v-if="item.Nav_CheckNoticeDetailUsers">
|
||
<uni-tag class="tag" v-for="(i, k) in item.Nav_CheckNoticeDetailUsers.filter(i => !i.IS_DELETED)" :key="k" :inverted="true" :text="i.Nav_User.NAME" type="primary" />
|
||
</view>
|
||
<u-form-item label="检查内容:" prop="CHECK_TIME" @click="handleShowSheetForArea(item,{title: '检查内容', name: 'Nav_Contents'})">
|
||
<u-icon style="margin-left: 4px;" slot="right" name="arrow-down" size="12">
|
||
</u-icon>
|
||
</u-form-item>
|
||
<u-textarea v-model="(item.Nav_Contents||{}).CHECKCONTENT" disabled placeholder="请选择检查内容"></u-textarea>
|
||
|
||
</view>
|
||
|
||
|
||
</uni-collapse-item>
|
||
</view>
|
||
</uni-collapse>
|
||
|
||
<u-form-item>
|
||
<u-button text="新增" type="primary" @click="handleNewCheckArea" style="margin-right: 10px;"></u-button>
|
||
<u-button text="向下同步检查人员" type="primary" color="#3d4b70" @click="syncCheckersDownward"></u-button>
|
||
</u-form-item>
|
||
</u--form>
|
||
|
||
</view>
|
||
|
||
<view style="padding: 10px 16px;display: flex;flex-direction: row;" v-if="stepsPageList === 1" class="bottom-button">
|
||
<u-button type="primary" @click="stepReduce" color="#3d4b70" :plain="true" style="margin-right: 5px;">上一步</u-button>
|
||
<u-button type="primary" @click="submit" color="#3d4b70" style="margin-left: 5px;">提交</u-button>
|
||
</view>
|
||
<query-selector :multiple="selectorInfo.isMultiple" :show="selectorInfo.showPopup" :title="selectorInfo.title" :lists="selectorInfo.dataLists" :defaultChecked="selectorInfo.defaultChecked"
|
||
@search="handleSearch" @select="handleSelected" @close="selectorInfo.showPopup=false" :total="selectorInfo.totalCount" />
|
||
<u-modal :show="showDelModalIndex >= 0" @confirm="confirmDel" @cancel="cacelDel" :showCancelButton="true" title="确认删除?"></u-modal>
|
||
<u-datetime-picker :show="showPopupDate" v-model="dateTime" mode="datetime" @confirm="confirmDate" @cancel="cancelDate"></u-datetime-picker>
|
||
<people-selector :defaultChecked="peopleSelectOption.defaultChecked" :show="peopleSelectOption.showSelector" @select="handleSelectorPeople" @close="peopleSelectOption.showSelector = false">
|
||
</people-selector>
|
||
<u-picker :show="comPickerInfo.showSheet" :columns="comPickerInfo.columns" @confirm="onConfirmPicker" @close="comPickerInfo.showSheet=false" @cancel="comPickerInfo.showSheet=false" keyName="NAME"></u-picker>
|
||
<u-modal :show="showDelModalIndexAll >= 0" @confirm="confirmDelAll" @cancel="cacelDelAll" :showCancelButton="true" title="是否确认执行?"></u-modal>
|
||
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import {
|
||
extendFilterGroup,
|
||
extendGroupRule,
|
||
extendInclude,
|
||
extendOrder,
|
||
extendRule,
|
||
guid,
|
||
initFilter,
|
||
initFilterGroup,
|
||
extendIgnoreDataRule
|
||
} from '../../../../utils/common'
|
||
import {
|
||
FMProductionUnit,
|
||
CheckPeriod,
|
||
CheckLevel,
|
||
MineTypeIndex,
|
||
MineTypeName
|
||
} from '../../../../utils/enums.js'
|
||
import {
|
||
GetCheckContentsInfo,
|
||
FullUpdate,
|
||
GetNewRiskAreaInfo,
|
||
GetIdentityUserEditNew,
|
||
CheckTypeNewOrderPaged
|
||
} from '../../../../services/apply/subPages/SK/SKServices.js'
|
||
import {
|
||
getEnum
|
||
} from '../../../../services/common';
|
||
import {
|
||
getRequest,
|
||
} from '../../../../services/apply/FOServices/FOServices';
|
||
import stepTitle from '@/components/custom/step-title.vue'
|
||
export default {
|
||
components: {
|
||
stepTitle,
|
||
},
|
||
data() {
|
||
return {
|
||
showDelModalIndex: undefined,
|
||
showDelModalIndexAll: undefined,
|
||
isMultiple: false,
|
||
listISORNOT: [], //是否涉及
|
||
listISORNOTText: [],
|
||
stepLoad: true,
|
||
showPopupDate: false,
|
||
listPropUpload: ['NOTIFY_ID'],
|
||
listPropValUpload: [],
|
||
ORG_ID: uni.getStorageSync('orgId'),
|
||
model: {
|
||
Nav_CheckNoticeFiles: [],
|
||
Product_Unit: '',
|
||
Check_Type: '',
|
||
PLANCHECKFREQUENCYName: '',
|
||
DEPARTMENT_TYPEName: '',
|
||
CHECK_TIME: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM'),
|
||
Nav_CheckNoticeDetails: [],
|
||
},
|
||
peopleSelectOption: {
|
||
showSelector: false,
|
||
value: null,
|
||
index: 0,
|
||
defaultChecked: []
|
||
},
|
||
selectorInfo: {
|
||
name: 'user',
|
||
isMultiple: false,
|
||
showPopup: false,
|
||
totalCount: 0,
|
||
title: '考核结果选择',
|
||
dataItem: {},
|
||
index: 0,
|
||
columns: [],
|
||
dataLists: [],
|
||
defaultText: '',
|
||
defaultChecked: []
|
||
},
|
||
comPickerInfo: {
|
||
showSheet: false,
|
||
dataItem: {},
|
||
columns: [],
|
||
title: '',
|
||
dataIndex: undefined,
|
||
formIndex: undefined,
|
||
name: ''
|
||
},
|
||
dateTime: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM'),
|
||
stepsText: ['发起', '审批', '确认', '归档'],
|
||
stepsPage: 0,
|
||
stepsPageList: 0,
|
||
chooseCheckContent: '',
|
||
nowIndex: 0,
|
||
nowName: '',
|
||
STATUS: 0,
|
||
enumsData: {}, // 存储所有枚举数据(键:枚举名称,值:处理后的枚举列表)
|
||
enumsText: {} // 存储枚举文本列表(用于下拉选择等场景)
|
||
|
||
}
|
||
},
|
||
onLoad(option) {
|
||
this.TaskID = option.taskID ? option.taskID : '';
|
||
this.model.ID = option.ID ? option.ID : '';
|
||
this.model.TaskID = option.taskID ? option.taskID : '';
|
||
this.ID = option.ID ? option.ID : '';
|
||
// 调用公共方法请求需要的枚举(示例:FMProductionUnit和SKPLANCHECKFREQUENCYEnum)
|
||
this.fetchEnums(['SKProductionUnit', 'SKPLANCHECKFREQUENCYEnum', 'SKDepartmentTypeEnum']);
|
||
},
|
||
methods: {
|
||
async fetchEnums(enumNames) {
|
||
try {
|
||
// 存储所有枚举请求的Promise
|
||
const enumPromises = enumNames.map(name => {
|
||
return getEnum({
|
||
name
|
||
}).then(res => {
|
||
// 统一处理枚举格式:添加name/code字段,便于后续映射
|
||
return {
|
||
enumName: name,
|
||
data: res.map(item => ({
|
||
...item,
|
||
name: item.NAME, // 统一显示名称字段
|
||
code: item.ID // 统一值字段
|
||
}))
|
||
};
|
||
});
|
||
});
|
||
|
||
// 等待所有枚举请求完成
|
||
const results = await Promise.all(enumPromises);
|
||
// 存储枚举结果到data中(键为枚举名称,值为处理后的数据)
|
||
results.forEach(({
|
||
enumName,
|
||
data
|
||
}) => {
|
||
this.enumsData[enumName] = data;
|
||
// 生成文本列表(如需要)
|
||
this.enumsText[enumName] = data.map(item => item.name);
|
||
});
|
||
// 所有枚举获取完成后,执行loadData
|
||
this.loadData();
|
||
} catch (error) {
|
||
console.error('枚举请求失败:', error);
|
||
uni.showToast({
|
||
title: '枚举数据加载失败',
|
||
icon: 'none'
|
||
});
|
||
}
|
||
},
|
||
|
||
loadData() {
|
||
if (this.ID == undefined || this.ID == '') {
|
||
this.stepLoad = false
|
||
this.model.Nav_Details = []
|
||
if (this.ID == undefined || this.ID == '')
|
||
this.ID = guid()
|
||
this.model.ID = guid()
|
||
} else {
|
||
const orgId = uni.getStorageSync('orgId')
|
||
const json = initFilter(orgId, "", "")
|
||
extendRule(json, 'ID', 1, this.ID)
|
||
extendInclude(json, 'Nav_ApplyDepartment');
|
||
extendInclude(json, 'Nav_ApplyUser');
|
||
extendInclude(json, 'Nav_CheckType');
|
||
extendInclude(json, 'Nav_CheckNoticeFiles.Nav_ImgFile');
|
||
extendInclude(json, 'Nav_CheckNoticeDetails');
|
||
extendInclude(json, 'Nav_CheckNoticeDetails.Nav_RiskArea');
|
||
extendInclude(json, 'Nav_CheckNoticeDetails.Nav_CheckNoticeDetailBasics.Nav_Law');
|
||
extendInclude(json, 'Nav_CheckNoticeDetails.Nav_Contents');
|
||
extendInclude(json, 'Nav_CheckNoticeDetails.Nav_CheckNoticeDetailUsers.Nav_User');
|
||
extendIgnoreDataRule(json)
|
||
GetIdentityUserEditNew(json).then(res => {
|
||
if (res) {
|
||
this.stepLoad = false
|
||
this.model = res
|
||
this.model.ID = this.ID
|
||
this.stepsPage = res.STATUS == 0 ? 0 : res.STATUS == 20 ? 1 : res.STATUS == 10 ? 2 : 3
|
||
this.model.Product_Unit = res.MineType !== undefined ? this.enumsData['SKProductionUnit'].find(item => item.code === res.MineType).name : '';
|
||
this.model.PLANCHECKFREQUENCYName = res.PLANCHECKFREQUENCY !== undefined ? this.enumsData['SKPLANCHECKFREQUENCYEnum'].find(item => item.code === res.PLANCHECKFREQUENCY).name : '';
|
||
this.model.DEPARTMENT_TYPEName = res.DEPARTMENT_TYPE !== undefined ? this.enumsData['SKDepartmentTypeEnum'].find(item => item.code === res.DEPARTMENT_TYPE).name : '';
|
||
}
|
||
|
||
|
||
})
|
||
}
|
||
},
|
||
stepAdd() {
|
||
if (!this.model.Product_Unit) {
|
||
uni.showToast({
|
||
title: '请选择生产单元',
|
||
icon: 'none'
|
||
})
|
||
return
|
||
}
|
||
if (!this.model.CHECK_TYPE_ID) {
|
||
uni.showToast({
|
||
title: '请选择检查类型',
|
||
icon: 'none'
|
||
})
|
||
return
|
||
}
|
||
if (!this.model.PLANCHECKFREQUENCYName) {
|
||
uni.showToast({
|
||
title: '请选择检查周期',
|
||
icon: 'none'
|
||
})
|
||
return
|
||
}
|
||
if (!this.model.DEPARTMENT_TYPEName) {
|
||
uni.showToast({
|
||
title: '请选择检查层级',
|
||
icon: 'none'
|
||
})
|
||
return
|
||
}
|
||
if (!this.model.CHECK_TIME) {
|
||
uni.showToast({
|
||
title: '请选择检查时间',
|
||
icon: 'none'
|
||
})
|
||
return
|
||
}
|
||
this.stepsPageList = this.stepsPageList + 1
|
||
},
|
||
stepReduce() {
|
||
this.stepsPageList = this.stepsPageList - 1
|
||
},
|
||
handleChange(name) {
|
||
console.log(this.enumsData[name],'mnn')
|
||
this.comPickerInfo = {
|
||
showSheet: true,
|
||
columns: [this.enumsData[name]],
|
||
name: name
|
||
}
|
||
},
|
||
onConfirmPicker(e) {
|
||
if (this.comPickerInfo.name == 'SKProductionUnit') {
|
||
this.model.Product_Unit = e.value[0].name
|
||
this.model.MineType = this.enumsData['SKProductionUnit'][e.indexs[0]].code
|
||
} else if (this.comPickerInfo.name == 'SKPLANCHECKFREQUENCYEnum') {
|
||
this.model.PLANCHECKFREQUENCYName = e.value[0].name
|
||
this.model.PLANCHECKFREQUENCY = this.enumsData['SKPLANCHECKFREQUENCYEnum'][e.indexs[0]].code
|
||
} else if (this.comPickerInfo.name == 'SKDepartmentTypeEnum') {
|
||
this.model.DEPARTMENT_TYPEName = e.value[0].name
|
||
this.model.DEPARTMENT_TYPE = this.enumsData['SKDepartmentTypeEnum'][e.indexs[0]].code
|
||
}
|
||
|
||
this.comPickerInfo = {
|
||
showSheet: false,
|
||
columns: [],
|
||
title: '',
|
||
formIndex: undefined
|
||
}
|
||
},
|
||
confirmDate(e) {
|
||
this.model.CHECK_TIME = uni.$u.timeFormat(e.value,
|
||
'yyyy-mm-dd hh:MM')
|
||
this.dateTime = this.model.CHECK_TIME
|
||
this.showPopupDate = false
|
||
},
|
||
handleChangeDate() {
|
||
this.showPopupDate = true
|
||
},
|
||
cancelDate() {
|
||
this.showPopupDate = false
|
||
},
|
||
handleSelectorPeople(e) {
|
||
const {
|
||
index: key
|
||
} = this.peopleSelectOption
|
||
this.model.Nav_CheckNoticeDetails[key].Nav_CheckNoticeDetailUsers = e.map(i => {
|
||
return {
|
||
USER_ID: i.USER_ID,
|
||
IS_DELETED: i.IS_DELETED,
|
||
NAME: i.NAME,
|
||
Nav_User: {
|
||
NAME: i.NAME,
|
||
ID: i.USER_ID
|
||
}
|
||
}
|
||
})
|
||
},
|
||
handleShowUserSelector(item, index) {
|
||
this.peopleSelectOption = {
|
||
showSelector: true,
|
||
value: item,
|
||
index,
|
||
defaultChecked: item.Nav_CheckNoticeDetailUsers?.map(i => {
|
||
return {
|
||
...i,
|
||
NAME: i.Nav_User.NAME,
|
||
USER_ID: i.Nav_User.ID,
|
||
}
|
||
})
|
||
}
|
||
},
|
||
handleNewCheckArea() {
|
||
this.model.Nav_CheckNoticeDetails.push({
|
||
Nav_RiskArea: {
|
||
NAME: ''
|
||
},
|
||
Nav_Contents: {
|
||
CHECKCONTENT: ''
|
||
},
|
||
ID: guid(),
|
||
ORG_ID: this.ORG_ID,
|
||
SECURITY_INSPECTION_NOTICE_ID: this.ID,
|
||
|
||
// showPackRegion: true,
|
||
Nav_CheckNoticeDetailUsers: [],
|
||
})
|
||
},
|
||
handleDelRowBefore(index) {
|
||
this.nowIndex = index
|
||
this.showDelModalIndex = index
|
||
|
||
},
|
||
confirmDel() {
|
||
this.model.Nav_CheckNoticeDetails.splice(this.nowIndex, 1)
|
||
this.showDelModalIndex = undefined
|
||
},
|
||
cacelDel() {
|
||
this.showDelModalIndex = undefined
|
||
},
|
||
syncCheckersDownward() {
|
||
this.showDelModalIndexAll = 1
|
||
|
||
},
|
||
confirmDelAll() {
|
||
this.syncCheckersDownwards()
|
||
this.showDelModalIndexAll = undefined
|
||
},
|
||
cacelDelAll() {
|
||
this.showDelModalIndexAll = undefined
|
||
},
|
||
syncCheckersDownwards() {
|
||
const validDetails = this.model.Nav_CheckNoticeDetails.filter(i => !i.IS_DELETED);
|
||
let sourceIndex = -1;
|
||
|
||
for (let i = 0; i < validDetails.length; i++) {
|
||
if (validDetails[i].Nav_CheckNoticeDetailUsers.filter(i => !i.IS_DELETED) && validDetails[i].Nav_CheckNoticeDetailUsers.filter(i => !i.IS_DELETED).length > 0) {
|
||
sourceIndex = i;
|
||
const sourceItem = validDetails[sourceIndex];
|
||
|
||
// 从当前有检查人员的行开始,向下同步
|
||
for (let j = i + 1; j < validDetails.length; j++) {
|
||
const targetItem = validDetails[j];
|
||
if (targetItem.Nav_CheckNoticeDetailUsers.filter(i => !i.IS_DELETED) && targetItem.Nav_CheckNoticeDetailUsers.filter(i => !i.IS_DELETED).length > 0) {
|
||
// 遇到下一个有检查人员的行,更新 sourceIndex 并跳出内层循环
|
||
sourceIndex = j;
|
||
break;
|
||
} else {
|
||
targetItem.Nav_CheckNoticeDetailUsers = [...sourceItem.Nav_CheckNoticeDetailUsers];
|
||
targetItem.Nav_CheckNoticeDetailUsersName = sourceItem.Nav_CheckNoticeDetailUsersName;
|
||
targetItem.Nav_User = {
|
||
...sourceItem.Nav_User
|
||
};
|
||
targetItem.USER_ID = sourceItem.USER_ID;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
// 如果没有找到有检查人员的行,则提示用户
|
||
if (sourceIndex === -1) {
|
||
uni.$showMsgFunc('没有找到有检查人员的行!', null, 'none', 1500);
|
||
return;
|
||
}
|
||
|
||
this.$forceUpdate();
|
||
},
|
||
|
||
handleShowSheetForArea(item, todo) {
|
||
const validDetails = this.model.Nav_CheckNoticeDetails.filter(i => !i.IS_DELETED);
|
||
const index = validDetails.indexOf(item);
|
||
this.handleShowSheet({
|
||
title: todo.title,
|
||
name: todo.name,
|
||
index: index
|
||
});
|
||
},
|
||
async handleShowSheet(p) {
|
||
const orgId = uni.getStorageSync('orgId')
|
||
const json = initFilter(orgId, "", "", 0, p.pageIndex ?? 1)
|
||
// const json = initFilter(this.ORG_ID, "", "", 0, p.pageIndex ?? 1)
|
||
let dataSelect = []
|
||
var defaultChecked = []
|
||
this.selectorInfo.isMultiple = false
|
||
|
||
|
||
|
||
|
||
|
||
json.Limit = 20
|
||
if (p.pageIndex) {
|
||
json.Start = (p.pageIndex - 1) * json.Limit;
|
||
}
|
||
json.Sort = 'NAME'
|
||
// json.SelectField = ["ID", "NAME", "NAME", "CODE"]
|
||
// json.Sort = "NAME"
|
||
// json.Order = 1
|
||
if (p.name == 'Nav_RiskArea') {
|
||
if (p.val) {
|
||
extendRule(json, 'NAME', 9, p.val);
|
||
}
|
||
// extendRule(json, 'DEVICE_STATUS', 1, '1');
|
||
dataSelect = await GetNewRiskAreaInfo(json).then(res => {
|
||
this.selectorInfo.totalCount = res.TotalCount
|
||
if (res != undefined && res.Data.length > 0) {
|
||
for (let i = 0; i < res.Data.length; i++) {
|
||
res.Data[i].name = res.Data[i].NAME
|
||
}
|
||
}
|
||
return res.Data
|
||
})
|
||
} else if (p.name == 'Nav_Contents') {
|
||
if (p.val) {
|
||
extendRule(json, 'CHECKCONTENT', 9, p.val);
|
||
}
|
||
dataSelect = await GetCheckContentsInfo(json).then(res => {
|
||
this.selectorInfo.totalCount = res.TotalCount
|
||
if (res != undefined && res.Data.length > 0) {
|
||
for (let i = 0; i < res.Data.length; i++) {
|
||
res.Data[i].name = res.Data[i].CHECKCONTENT
|
||
}
|
||
}
|
||
return res.Data
|
||
})
|
||
}else if(p.name =='Nav_CheckType'){
|
||
if (p.val) {
|
||
extendRule(json, 'NAME', 9, p.val);
|
||
}
|
||
if(this.model.MineType!==undefined&&this.model.MineType!==null){
|
||
extendRule(json, 'MineType', 1, String(this.model.MineType));
|
||
}
|
||
|
||
dataSelect = await CheckTypeNewOrderPaged(json).then(res => {
|
||
this.selectorInfo.totalCount = res.TotalCount
|
||
if (res != undefined && res.Data.length > 0) {
|
||
for (let i = 0; i < res.Data.length; i++) {
|
||
res.Data[i].name = res.Data[i].NAME
|
||
}
|
||
}
|
||
return res.Data
|
||
})
|
||
}
|
||
|
||
if (defaultChecked == null)
|
||
defaultChecked = []
|
||
if (dataSelect.length) {
|
||
this.selectorInfo = {
|
||
itemData: p.itemData != undefined ? p.itemData : this.selectorInfo
|
||
.itemData, //itemData: p.itemData, 搜索的时候 p.itemData为空 赋值修改 为 她自己本身 this.selectorInfo.itemData
|
||
isMultiple: this.selectorInfo.isMultiple,
|
||
totalCount: this.selectorInfo.totalCount,
|
||
showPopup: true,
|
||
title: p.title,
|
||
name: p.name,
|
||
dataLists: dataSelect,
|
||
defaultChecked: defaultChecked,
|
||
index: p.index
|
||
}
|
||
} else {
|
||
// 暂无数据
|
||
}
|
||
},
|
||
//数据加载
|
||
handleSearch(val, pageIndex) {
|
||
var p = {
|
||
name: this.selectorInfo.name,
|
||
title: this.selectorInfo.title,
|
||
val: val,
|
||
pageIndex: pageIndex,
|
||
index: this.selectorInfo.index
|
||
}
|
||
this.handleShowSheet(p)
|
||
},
|
||
|
||
handleSelected(e) {
|
||
this.selectorInfo.showPopup = false
|
||
const validDetails = this.model.Nav_CheckNoticeDetails.filter(i => !i.IS_DELETED);
|
||
const index = this.selectorInfo.index;
|
||
const realIndex = this.model.Nav_CheckNoticeDetails.findIndex(item => item === validDetails[index]);
|
||
if (this.selectorInfo.name == 'Nav_RiskArea') {
|
||
this.model.Nav_CheckNoticeDetails[realIndex].Nav_RiskArea = e;
|
||
this.model.Nav_CheckNoticeDetails[realIndex].RISK_AREA_ID = e.ID;
|
||
} else if (this.selectorInfo.name == 'Nav_Contents') {
|
||
this.model.Nav_CheckNoticeDetails[realIndex].Nav_Contents = e;
|
||
this.model.Nav_CheckNoticeDetails[realIndex].CHECK_CONTENTS_ID = e.ID;
|
||
}
|
||
else if (this.selectorInfo.name == 'Nav_CheckType') {
|
||
this.model.Nav_CheckType = e;
|
||
this.model.CHECK_TYPE_ID = e.ID;
|
||
}
|
||
|
||
|
||
},
|
||
submit() {
|
||
for (let item of this.model.Nav_CheckNoticeDetails) {
|
||
if (item.Nav_CheckNoticeDetailUsers.length == 0) {
|
||
uni.showToast({
|
||
title: '请选择检查人员',
|
||
icon: 'none'
|
||
})
|
||
return
|
||
}
|
||
if (!item.Nav_Contents.CHECKCONTENT) {
|
||
uni.showToast({
|
||
title: '请选择检查内容',
|
||
icon: 'none'
|
||
})
|
||
return
|
||
}
|
||
if (!item.Nav_RiskArea.NAME) {
|
||
uni.showToast({
|
||
title: '请选择检查区域',
|
||
icon: 'none'
|
||
})
|
||
return
|
||
}
|
||
}
|
||
this.modelEdit = JSON.parse(JSON.stringify(this.model))
|
||
delete this.modelEdit.Nav_ApplyDepartment
|
||
delete this.modelEdit.Nav_ApplyUser
|
||
delete this.modelEdit.Nav_CheckType
|
||
|
||
this.modelEdit.Nav_CheckNoticeDetails.map(item => {
|
||
item.PUBLISH = 'SaveAndNotify'
|
||
delete item.Nav_Contents
|
||
delete item.Nav_RiskArea
|
||
})
|
||
if (this.TaskID == null || this.TaskID == '') {
|
||
this.modelEdit.TaskID = '00000000-0000-0000-0000-000000000000'
|
||
} else {
|
||
this.modelEdit.TaskID = this.TaskID
|
||
}
|
||
if (this.modelEdit.ORG_ID == null || this.modelEdit.ORG_ID == '')
|
||
this.modelEdit.ORG_ID = this.ORG_ID
|
||
|
||
this.modelEdit.PUBLISH = 'SaveAndNotify'
|
||
FullUpdate(this.modelEdit).then(res => {
|
||
if (res) {
|
||
uni.$showMsgFunc('操作成功!', () => {
|
||
uni.navigateBack()
|
||
}, 'success', 1000)
|
||
}
|
||
})
|
||
|
||
}
|
||
|
||
}
|
||
|
||
|
||
|
||
}
|
||
</script>
|
||
|
||
<style scoped>
|
||
@import url("../../../../style/css/newTemplate.css");
|
||
</style> |