410 lines
13 KiB
Vue
410 lines
13 KiB
Vue
<template>
|
|
<view class="todo-page">
|
|
<view class="background"></view>
|
|
<view class="card">
|
|
<!-- <uni-card margin="0" :is-shadow="true"> -->
|
|
<u--form labelPosition="left" labelWidth="auto" labelAlign="center" :model="model" :rules="rules" ref="wForm" errorType="border-bottom" class="demo-ruleForm">
|
|
<u-form-item label="生产单元:" prop="Product_Unit" @click="handleChange('minetype')" borderBottom>
|
|
<u--input v-model="model.Product_Unit" disabled disabledColor="#ffffff" placeholder="请选择生产单元" border="none" inputAlign="right" fontSize="14px">
|
|
</u--input>
|
|
<u-icon style="margin-left: 4px;" name="arrow-down" size="12">
|
|
</u-icon>
|
|
</u-form-item>
|
|
<u-form-item label="责任部门" prop="ENDTIME" borderBottom>
|
|
<u--input disabled v-if="model.Nav_Department" disabledColor="#ffffff" v-model="model.Nav_Department.NAME" border="none" inputAlign="right" fontSize="14px"></u--input>
|
|
</u-form-item>
|
|
<u-form-item label="责任人" prop="ENDTIME" borderBottom>
|
|
<u--input disabled v-if="model.Nav_User" disabledColor="#ffffff" v-model="model.Nav_User.NAME" border="none" inputAlign="right" fontSize="14px"></u--input>
|
|
</u-form-item>
|
|
|
|
<u-form-item label="设备设施名称" prop="Nav_Device.NAME" borderBottom @click="handleShowSheet({title: '设备名称', name: 'Nav_Device'})">
|
|
<u--input disabled fontSize="14px" disabledColor="#ffffff" v-model="model.Nav_DeviceBase.NAME" border="none" placeholder="请选择设备名称" inputAlign="right" v-if="model.Nav_DeviceBase"></u--input>
|
|
<u-icon style="margin-left: 4px;" name="arrow-down" size="12" slot="right">
|
|
</u-icon>
|
|
</u-form-item>
|
|
<u-form-item label="设备设施编号" prop="POSITION" borderBottom>
|
|
<u--input disabled disabledColor="#ffffff" v-model="model.MACHINE_CODE" border="none" inputAlign="right" fontSize="14px">
|
|
</u--input>
|
|
</u-form-item>
|
|
<u-form-item label="规格/型号" prop="POSITION" borderBottom>
|
|
<u--input disabled disabledColor="#ffffff" v-model="model.SPEC" border="none" inputAlign="right" fontSize="14px">
|
|
</u--input>
|
|
</u-form-item>
|
|
<u-form-item label="设备设施位置" prop="POSITION" borderBottom>
|
|
<u--input disabled disabledColor="#ffffff" v-model="model.POSITION" border="none" inputAlign="right" fontSize="14px">
|
|
</u--input>
|
|
</u-form-item>
|
|
<u-form-item label="检测检验结果" @click="handleChange('RESULT')" borderBottom>
|
|
<u--input v-model="model.RESULTShow" disabled disabledColor="#ffffff" placeholder="请选择检测检验结果" border="none" inputAlign="right" fontSize="14px">
|
|
</u--input>
|
|
<u-icon style="margin-left: 4px;" name="arrow-down" size="12">
|
|
</u-icon>
|
|
</u-form-item>
|
|
<u-form-item label="检测检验机构" prop="POSITION" borderBottom>
|
|
<u--input placeholder="请填写检测检验机构" disabledColor="#ffffff" v-model="model.MECHANISM" border="none" inputAlign="right" fontSize="14px">
|
|
</u--input>
|
|
</u-form-item>
|
|
<u-form-item label="检测检验资质" prop="POSITION" borderBottom>
|
|
<u--input placeholder="请填写检测检验资质" disabledColor="#ffffff" v-model="model.QUALIFICATION" border="none" inputAlign="right" fontSize="14px">
|
|
</u--input>
|
|
</u-form-item>
|
|
|
|
|
|
<u-form-item label="检测报告" prop="POSITION">
|
|
</u-form-item>
|
|
<full-upload v-model="model.Nav_Files" :isShowBtn="true" :listProp="listPropUpload" :listPropVal="listPropValUpload"></full-upload>
|
|
|
|
|
|
|
|
</u--form>
|
|
|
|
</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-picker :show="comPickerInfo.showSheet" :columns="comPickerInfo.columns" @confirm="onConfirmPicker" @close="comPickerInfo.showSheet=false" @cancel="comPickerInfo.showSheet=false" keyName="NAME"></u-picker>
|
|
<view style="padding: 10px 16px;display: flex;flex-direction: row;" class="bottom-button">
|
|
<u-button type="primary" @click="submit" color="#3d4b70" :disabled="isLoadOK">提交</u-button>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
mapState,
|
|
mapMutations
|
|
} from 'vuex'
|
|
import {
|
|
extendFilterGroup,
|
|
extendGroupRule,
|
|
extendInclude,
|
|
extendOrder,
|
|
extendRule,
|
|
guid,
|
|
initFilter,
|
|
initFilterGroup,
|
|
} from '../../../../utils/common'
|
|
import {
|
|
FMProductionUnit,
|
|
CheckPeriods,
|
|
CheckLevels,
|
|
MineTypeIndex,
|
|
MineTypeName
|
|
} from '../../../../utils/enums.js'
|
|
import {
|
|
DIRecordGet,
|
|
DIRecordFull,
|
|
DMDeviceBase,
|
|
DMDepartment,
|
|
DMOrderPagedAuthority
|
|
} from '../../../../services/apply/subPages/DM/dm';
|
|
|
|
import {
|
|
getEnum
|
|
} from '../../../../services/common';
|
|
|
|
import config from '../../../../config/common'
|
|
export default {
|
|
data() {
|
|
return {
|
|
tableKey: '0',
|
|
TaskID: '',
|
|
ID: '',
|
|
ORG_ID: uni.getStorageSync('orgId'),
|
|
isLoadOK: true,
|
|
stepsPageList: 0,
|
|
listISORNOT: [], //是否涉及
|
|
listISORNOTText: [],
|
|
listResult: [],
|
|
listResultText: [],
|
|
listPropUpload: ['PARENT_ID'],
|
|
listPropValUpload: [],
|
|
indexShow: 0,
|
|
isNew: true,
|
|
model: {
|
|
Nav_Department: {
|
|
NAME: ''
|
|
},
|
|
Nav_Repair_User: {
|
|
NAME: ""
|
|
},
|
|
Nav_Device: {
|
|
NAME: ''
|
|
},
|
|
ID: '',
|
|
IS_HELPShow: '否',
|
|
IS_HELP: false,
|
|
ORG_ID: '',
|
|
TaskID: null,
|
|
STATUS: 0,
|
|
},
|
|
rules: {
|
|
|
|
},
|
|
comPickerInfo: {
|
|
showSheet: false,
|
|
dataItem: {},
|
|
columns: [],
|
|
title: '',
|
|
dataIndex: undefined,
|
|
formIndex: undefined,
|
|
name: ''
|
|
},
|
|
|
|
selectorInfo: {
|
|
name: 'user',
|
|
isMultiple: false,
|
|
showPopup: false,
|
|
totalCount: 0,
|
|
title: '考核结果选择',
|
|
dataItem: {},
|
|
index: 0,
|
|
columns: [],
|
|
dataLists: [],
|
|
defaultText: '',
|
|
defaultChecked: []
|
|
},
|
|
}
|
|
},
|
|
onLoad(option) {
|
|
// this.TaskID = option.taskID ? option.taskID : '';
|
|
// this.model.ID = option.ID ? option.ID : '';
|
|
// this.JOBID = option.ID ? option.ID : '';
|
|
// this.tableKey = option.tableKey ? option.tableKey : '0'
|
|
// this.loadData();
|
|
|
|
this.ID = option.ID
|
|
this.TaskID = option.taskID
|
|
this.tableKey = option.tableKey
|
|
|
|
if (option.taskID != null && option.taskID != '')
|
|
this.model.TaskID = option.taskID
|
|
this.getEnums()
|
|
// this.loadData()
|
|
},
|
|
methods: {
|
|
getEnums() {
|
|
var dataParm = {
|
|
'name': "FMProductionUnit"
|
|
}
|
|
getEnum(dataParm).then(res => {
|
|
this.listISORNOT = res
|
|
this.listISORNOTText = []
|
|
this.listISORNOT.forEach(e => {
|
|
e.name = e.NAME
|
|
e.code = e.ID
|
|
this.listISORNOTText.push(e.NAME)
|
|
})
|
|
this.getConclusion()
|
|
})
|
|
},
|
|
getConclusion() {
|
|
var dataParm = {
|
|
'name': "DMInspectionResultEnum"
|
|
}
|
|
getEnum(dataParm).then(res => {
|
|
this.listResult = res
|
|
this.listResultText = []
|
|
this.listResult.forEach(e => {
|
|
e.name = e.NAME
|
|
e.code = e.ID
|
|
this.listResultText.push(e.NAME)
|
|
|
|
})
|
|
this.loadData()
|
|
})
|
|
},
|
|
changeConfirm(item) {
|
|
const validDetails = this.model.Nav_Details.filter(i => !i.IS_DELETED);
|
|
const index = validDetails.indexOf(item);
|
|
const realIndex = this.model.Nav_Details.findIndex(item => item === validDetails[index]);
|
|
this.model.Nav_Details[realIndex].ISOCONFIRM = true;
|
|
},
|
|
handleDelRowBefore(item) {
|
|
item.IS_DELETED = true
|
|
let indexNotDel = 1
|
|
this.model.Nav_Details.forEach((e, i) => {
|
|
if (!e.IS_DELETED) {
|
|
e.ROW_NO = indexNotDel
|
|
indexNotDel++
|
|
}
|
|
})
|
|
this.$forceUpdate()
|
|
},
|
|
stepAdd() {
|
|
this.stepsPageList = this.stepsPageList + 1
|
|
|
|
},
|
|
stepReduce() {
|
|
this.stepsPageList = this.stepsPageList - 1
|
|
},
|
|
loadData() {
|
|
if (this.ID == undefined || this.ID == '') {
|
|
this.model.ID = guid()
|
|
this.isNew = true
|
|
// this.model.Nav_Department.NAME = uni.getStorageSync('appInfo').User.Nav_Department.NAME
|
|
// this.model.Nav_User.NAME = uni.getStorageSync('appInfo').User.NAME
|
|
// let mint = Number(uni.getStorageSync('appInfo').User.MineType)
|
|
// this.model.Product_Unit = this.listISORNOT.find(item => item.code === mint).name
|
|
// this.model.MineType = this.listISORNOT.find(item => item.code === mint).code
|
|
this.isLoadOK = false
|
|
} else {
|
|
let json = initFilter(this.ORG_ID);
|
|
extendRule(json, 'ID', 1, this.ID);
|
|
extendInclude(json, 'Nav_User');
|
|
extendInclude(json, 'Nav_Department');
|
|
extendInclude(json, 'Nav_DeviceBase');
|
|
extendInclude(json, 'Nav_Files.Nav_ImgFile');
|
|
|
|
DIRecordGet(json).then(ret => {
|
|
this.isLoadOK = false
|
|
this.isNew = false
|
|
this.model = ret
|
|
this.model.ID = this.ID
|
|
this.listPropValUpload.push(this.ID)
|
|
this.model.Product_Unit = this.listISORNOT.find(item => item.code === this.model.MineType).name
|
|
this.model.RESULTShow = this.listResult.find(item => item.code === this.model.RESULT).name
|
|
// uni.$updateData()
|
|
|
|
});
|
|
}
|
|
this.listPropValUpload.push(this.model.ID)
|
|
},
|
|
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
|
|
|
|
|
|
if (p.val) {
|
|
extendRule(json, 'NAME', 9, p.val);
|
|
}
|
|
|
|
|
|
json.Limit = 20
|
|
if (p.pageIndex) {
|
|
json.Start = (p.pageIndex - 1) * json.Limit;
|
|
}
|
|
json.Sort = 'NAME'
|
|
// json.Sort = "NAME"
|
|
// json.Order = 1
|
|
extendRule(json, 'DEVICE_STATUS', 1, '1');
|
|
dataSelect = await DMDeviceBase(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
|
|
res.Data[i].code = res.Data[i].MACHINE_CODE
|
|
}
|
|
}
|
|
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,
|
|
}
|
|
} else {
|
|
// 暂无数据
|
|
}
|
|
},
|
|
//数据加载
|
|
handleSearch(val, pageIndex) {
|
|
var p = {
|
|
name: this.selectorInfo.name,
|
|
title: this.selectorInfo.title,
|
|
val: val,
|
|
pageIndex: pageIndex,
|
|
}
|
|
this.handleShowSheet(p)
|
|
},
|
|
|
|
handleSelected(e) {
|
|
this.selectorInfo.showPopup = false
|
|
this.model.Nav_DeviceBase = e;
|
|
this.model.DEVICE_BASE_ID = e.ID;
|
|
this.model.MACHINE_CODE = e.MACHINE_CODE;
|
|
this.model.SPEC = e.SPEC;
|
|
this.model.POSITION = e.POSITION;
|
|
|
|
|
|
|
|
},
|
|
submit() {
|
|
this.modelEdit = JSON.parse(JSON.stringify(this.model))
|
|
delete this.modelEdit.Nav_Department
|
|
delete this.modelEdit.Nav_User
|
|
delete this.modelEdit.Nav_DeviceBase
|
|
|
|
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
|
|
if (this.modelEdit.Nav_Files && this.modelEdit.Nav_Files.length > 0) {
|
|
this.modelEdit.Nav_Files.forEach(item => {
|
|
if (item.DEVICE_RECORD_ID == undefined) {
|
|
item.DEVICE_RECORD_ID = this.model.ID;
|
|
}
|
|
});
|
|
}
|
|
this.modelEdit.PUBLISH = 'SaveAndNotify'
|
|
// console.log(this.modelEdit, 'this.modelEdit')
|
|
DIRecordFull(this.modelEdit).then(res => {
|
|
uni.$showMsgFunc('操作成功!', () => {
|
|
uni.navigateBack()
|
|
}, 'success', 1000)
|
|
})
|
|
|
|
},
|
|
handleChange(name) {
|
|
|
|
this.comPickerInfo = {
|
|
showSheet: true,
|
|
columns: [name == 'minetype' ? this.listISORNOTText : this.listResultText],
|
|
name: name
|
|
}
|
|
|
|
|
|
},
|
|
onConfirmPicker(e) {
|
|
if (this.comPickerInfo.name == 'minetype') {
|
|
this.model.Product_Unit = e.value[0]
|
|
this.model.MineType = this.listISORNOT[e.indexs[0]].code
|
|
} else if (this.comPickerInfo.name == 'RESULT') {
|
|
this.model.RESULT = this.listResult[e.indexs[0]].code
|
|
this.model.RESULTShow = e.value[0]
|
|
}
|
|
this.comPickerInfo = {
|
|
showSheet: false,
|
|
columns: [],
|
|
title: '',
|
|
formIndex: undefined
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
@import url("../../../../style/css/newTemplate.css");
|
|
/* @import url("../../../../style/css/editTemplate.css"); */
|
|
|
|
/* .todo-page {
|
|
padding: 16px 16px 70px;
|
|
} */
|
|
</style> |