feat: 完善各个下拉框数据请求接口
parent
63606632aa
commit
a6eb7381ea
|
@ -306,6 +306,7 @@
|
|||
|
||||
<script>
|
||||
import { formatDate } from '@/utils/tools';
|
||||
import { getDepartmentTree, getPersonnelList, getHiddenLevelTree } from "@/api";
|
||||
import { getInspectedItemGoShow } from '../../api';
|
||||
import sign from '@/components/sign/sign.vue';
|
||||
import uniDrawer from '@/components/uni-drawer/uni-drawer.vue';
|
||||
|
@ -333,6 +334,23 @@ export default {
|
|||
modalShowVideo: false,
|
||||
/** 视频播放路径地址 */
|
||||
videoSrc: '',
|
||||
/** 检查的表单项校验 */
|
||||
inspectedRules: [
|
||||
{ name: 'INSPECTION_ID', message: '安全环保检查ID不能为空' },
|
||||
],
|
||||
/** 部门下拉框数据源 */
|
||||
treeNode: [],
|
||||
/** 检查类型下拉数据 */
|
||||
inspectionTypeTreeList: [],
|
||||
/** 隐患部位下拉数据 */
|
||||
hiddenRegionTreeList: [],
|
||||
/** 隐患级别下拉数据 */
|
||||
hiddenLevelTreeList: [],
|
||||
/** 隐患类型下拉数据 */
|
||||
hiddenTypeTreeList: [],
|
||||
/** 隐患类型 2 下拉数据 */
|
||||
hiddenType2TreeList: [],
|
||||
// form 表单项状态
|
||||
form: {
|
||||
/** 检查ID */
|
||||
INSPECTION_ID: '',
|
||||
|
@ -431,9 +449,12 @@ export default {
|
|||
},
|
||||
onLoad(options) {
|
||||
this.form.INSPECTION_ID = options.INSPECTION_ID;
|
||||
this.inspectedForm.INSPECTION_ID = options.INSPECTION_ID;
|
||||
this.todayDate = formatDate(new Date(), 'yyyy-MM-dd hh:mm');
|
||||
this.msg = "edit";
|
||||
this.fnGetData();
|
||||
this.getDept();
|
||||
this.getDict();
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
|
@ -548,6 +569,13 @@ export default {
|
|||
current: this.$store.state.filePath + url
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 被检查单位现场负责人意见的单选选择动作
|
||||
*/
|
||||
changeRadioGroup(e) {
|
||||
this.inspectedForm.INSPECTED_EXPLAIN = ''
|
||||
this.inspectedForm.INSPECTION_STATUS = e.detail.value
|
||||
},
|
||||
/**
|
||||
* 播放视频处理
|
||||
*/
|
||||
|
@ -558,7 +586,67 @@ export default {
|
|||
/**
|
||||
* 提交逻辑处理
|
||||
*/
|
||||
goSubmit() { },
|
||||
goSubmit() {
|
||||
var _this = this;
|
||||
let required = true;
|
||||
this.inspectedRules.map(({ name, message }) => {
|
||||
if (!this.inspectedForm[name]) {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: message,
|
||||
duration: 1500
|
||||
});
|
||||
required = false
|
||||
}
|
||||
})
|
||||
if (!required) {
|
||||
return
|
||||
}
|
||||
if (this.inspectedForm.INSPECTION_STATUS === '-2' && !this.validStr(this.inspectedForm.INSPECTED_EXPLAIN)) {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '请填写申辩说明',
|
||||
duration: 1500
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (this.signImgList.length === 0) {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '请签字',
|
||||
duration: 1500
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.$set(this.inspectedForm, 'CREATOR', loginUser.USER_ID)
|
||||
this.$set(this.inspectedForm, 'CORPINFO_ID', corpinfoId)
|
||||
this.$set(this.inspectedForm, 'ACTION_USER', loginUser.NAME)
|
||||
var _this = this;
|
||||
uni.showLoading({
|
||||
title: '请稍候'
|
||||
})
|
||||
uni.uploadFile({
|
||||
url: basePath + "/app/safetyenvironmentalexplain/add",
|
||||
filePath: _this.signImgList[0].filePath,
|
||||
name: 'FFILE',
|
||||
formData: this.inspectedForm,
|
||||
success: (res) => {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '保存成功',
|
||||
duration: 2000
|
||||
});
|
||||
_this.goback()
|
||||
},
|
||||
fail: (err) => {
|
||||
uni.hideLoading();
|
||||
uni.showModal({
|
||||
content: err.errMsg,
|
||||
showCancel: false
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 返回逻辑处理
|
||||
*/
|
||||
|
@ -569,6 +657,116 @@ export default {
|
|||
uni.navigateBack({ delta: 1 });
|
||||
uni.hideLoading();
|
||||
},
|
||||
/**
|
||||
* 获取部门下拉信息
|
||||
*/
|
||||
async getDept() {
|
||||
var _this = this;
|
||||
const resData = await getDepartmentTree({
|
||||
loading: false,
|
||||
CORPINFO_ID: this.$store.state.userInfo.CORPINFO_ID
|
||||
});
|
||||
if (resData.data.result === 'success') {
|
||||
_this.treeNode = eval(resData.data.zTreeNodes);
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: resData.data.message,
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 获取人员列表
|
||||
*/
|
||||
async getUserList(list, dept, i) {
|
||||
var _this = this;
|
||||
const resData = await getPersonnelList({
|
||||
DEPARTMENT_ID: dept,
|
||||
NOMAIN: '1',
|
||||
tm: new Date().getTime()
|
||||
})
|
||||
if (resData.data.result === 'success') {
|
||||
if (i > -1) {
|
||||
_this[list][i] = [];
|
||||
_this[list][i] = resData.data.userList;
|
||||
_this.$forceUpdate(); // 强制刷新
|
||||
} else {
|
||||
_this[list] = resData.data.userList;
|
||||
}
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: resData.data.message,
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
},
|
||||
/** 获取数据字典数据 */
|
||||
async getDict() {
|
||||
var _this = this;
|
||||
await getHiddenLevelTree({
|
||||
tm: new Date().getTime(),
|
||||
DICTIONARIES_ID: '60e6481d96e44a5390ff5c347c4d1ffe'
|
||||
}).then((hiddenLevelResData) => {
|
||||
_this.inspectionTypeTreeList = eval(hiddenLevelResData.data.zTreeNodes);
|
||||
}).catch((err) => {
|
||||
uni.showToast({
|
||||
title: hiddenLevelResData.data.message,
|
||||
duration: 2000
|
||||
});
|
||||
});
|
||||
|
||||
await getHiddenPositionTree({
|
||||
CORPINFO_ID: this.$store.state.userInfo.CORPINFO_ID,
|
||||
tm: new Date().getTime()
|
||||
}).then((hiddenPositionTreeResData) => {
|
||||
var json = hiddenPositionTreeResData.data.zTreeNodes;
|
||||
_this.hiddenRegionTreeList = JSON.parse(json);
|
||||
}).catch((err) => {
|
||||
uni.showToast({
|
||||
title: hiddenPositionTreeResData.data.message,
|
||||
duration: 2000
|
||||
});
|
||||
});
|
||||
|
||||
await getHiddenLevelTree({
|
||||
tm: new Date().getTime(),
|
||||
DICTIONARIES_ID: '5e7cf8620ba54ad89719d0be62133c7a'
|
||||
}).then((hiddenLevelResData) => {
|
||||
var data = hiddenLevelResData.data.zTreeNodes;
|
||||
_this.hiddenLevelTreeList = JSON.parse(data);
|
||||
}).catch((err) => {
|
||||
uni.showToast({
|
||||
title: hiddenLevelResData.data.message,
|
||||
duration: 2000
|
||||
});
|
||||
});
|
||||
|
||||
await getHiddenLevelTree({
|
||||
tm: new Date().getTime(),
|
||||
DICTIONARIES_ID: '3babc15144444bdc8d763d0af2bdfff6'
|
||||
}).then((hiddenLevelResData) => {
|
||||
var data = hiddenLevelResData.data.zTreeNodes;
|
||||
_this.hiddenTypeTreeList = JSON.parse(data);
|
||||
}).catch((err) => {
|
||||
uni.showToast({
|
||||
title: hiddenLevelResData.data.message,
|
||||
duration: 2000
|
||||
});
|
||||
});
|
||||
|
||||
await getHiddenLevelTree({
|
||||
tm: new Date().getTime(),
|
||||
DICTIONARIES_ID: '18c0a9aea6e54feab9f4ab3f46e0bc86'
|
||||
}).then((hiddenLevelResData) => {
|
||||
var data = hiddenLevelResData.data.zTreeNodes;
|
||||
_this.hiddenType2TreeList = JSON.parse(data);
|
||||
}).catch((err) => {
|
||||
uni.showToast({
|
||||
title: hiddenLevelResData.data.message,
|
||||
duration: 2000
|
||||
});
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 重置隐患键入表单
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue