| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658 |
- <template>
- <view class="mx3">
- <view class="main-color-bg main-bg-future"></view>
- <view class="p3 bg-color-white form-view">
- <u-form :model="form" ref="uForm" >
- <view class="main-color-text f-size-32 f-weight-6">基本信息</view>
- <u-form-item label="设备名称" :label-width="200" prop="sbId" required>
- <my-select
- :list="sbList"
- :disabled="id"
- :value-name="'id'"
- :label-name="'sbName'"
- v-model="form.sbId"
- placeholder="请选择设备"
- @selected="sbSelect"
- />
- </u-form-item>
- <u-form-item label="日期" :label-width="200" prop="sbId" required>
- <u-input
- :disabled="true"
- v-model="form.fillDate"
- placeholder="请输入日期"
- @click="showDateTime('fillDate')"/>
- <u-picker
- mode="time"
- :value="fillDateShow"
- @cancel="cancelDateTime('fillDate')"
- @confirm="confirmDateTime($event,'fillDate',null)"
- ></u-picker>
- </u-form-item>
- <template v-for="natureDict in natureList" >
- <view v-show="natureDict.show" :key="natureDict.id" class="main-color-text f-size-32 f-weight-6 mt-2">
- {{ natureDict.label }}
- </view>
- <template v-for="(fillInfo,listIndex ) in fillInfoList" v-if="fillInfo.nature === natureDict.value">
- <view :key="fillInfo.infoId" v-if="fillInfo.type === fillInfoTypeValue.FILL_INFO_TYPE_PROJECT_QUANTITY">
- <u-form-item
- label="作业名称"
- :label-width="260">
- <my-select
- :list="projectQuantityList"
- :value-name="'id'"
- :label-name="'name'"
- v-model="form[fillInfoList[listIndex].infoId]"
- @selected="changeProjectQuantity($event,fillInfo)"
- placeholder="请选择"
- />
- </u-form-item>
- <u-form-item
- label="作业位置"
- :label-width="260">
- <view class="d-flex">
- <u-input style="width: 70rpx;" v-model="form[fillInfoList[listIndex].infoId+'ProjectQuantityS']" type="number" placeholder="起始值" />
- <text class="px3">至</text>
- <u-input style="width: 70rpx;" v-model="form[fillInfoList[listIndex].infoId+'ProjectQuantityE']" type="number" placeholder="结束值" />
- <text v-show="false" class="px3">减</text>
- <u-input v-show="false" style="width: 70rpx;" v-model="form[fillInfoList[listIndex].infoId+'ProjectQuantityT']" type="number" placeholder="未工作值" />
- <u-input :disabled="true" style="width: 70rpx;" v-model="form[fillInfoList[listIndex].infoId+'SiteUnit']"/>
- </view>
- </u-form-item>
- <u-form-item
- label="完成量"
- :label-width="260">
- <view class="d-flex">
- <u-input style="width: 100rpx;" v-model="form[fillInfoList[listIndex].infoId+'ProjectQuantityV']" type="number" placeholder="完成量" />
- <u-input :disabled="true" style="width: 70rpx;" v-model="form[fillInfoList[listIndex].infoId+'Unit']"/>
- </view>
- </u-form-item>
- <u-form-item
- label="作业备注"
- :label-width="260">
- <u-input v-model="form[fillInfoList[listIndex].infoId+'RemarkProjectQuantity']" placeholder="请输入" type="textarea" :height="50" />
- </u-form-item>
- </view>
- <view :key="fillInfo.infoId" v-else-if="fillInfo.type === fillInfoTypeValue.FILL_INFO_TYPE_DATE_TIME">
- <u-form-item
- label="运行开始时间"
- :label-width="260">
- <u-input
- :disabled="true"
- v-model="form[fillInfoList[listIndex].infoId+'TimeS']"
- placeholder="请输入运行开始时间"
- @click="showDateTime('start')"/>
- <u-picker
- mode="time"
- :value="startTimeShow"
- @cancel="cancelDateTime('start')"
- @confirm="confirmDateTime($event,'start',fillInfoList[listIndex].infoId+'TimeS')"
- :params="dateTimeParams"></u-picker>
- </u-form-item>
- <u-form-item
- label="运行结束时间"
- :label-width="260">
- <u-input
- :disabled="true"
- v-model="form[fillInfoList[listIndex].infoId+'TimeE']"
- placeholder="请输入运行结束时间"
- @click="showDateTime('end')"/>
- <u-picker
- mode="time"
- :value="endTimeShow"
- @cancel="cancelDateTime('end')"
- @confirm="confirmDateTime($event,'end',fillInfoList[listIndex].infoId+'TimeE')"
- :params="dateTimeParams"></u-picker>
- </u-form-item>
- <u-form-item
- label="未工作小时"
- :label-width="260">
- <view class="d-flex">
- <u-input
- type="number"
- style="width: 100rpx;"
- v-model="form[fillInfoList[listIndex].infoId+'TimeR']"/>
- 小时
- </view>
- </u-form-item>
- </view>
- <u-form-item
- v-else
- :key="fillInfo.infoId"
- :label="fillInfo.name"
- :label-width="200">
- <my-select
- v-if="fillInfo.type === fillInfoTypeValue.FILL_INFO_TYPE_XIA_LA"
- :list="getSelectOptions(fillInfo)"
- :value-name="'id'"
- :label-name="'sbName'"
- v-model="form[fillInfoList[listIndex].infoId]"
- placeholder="请选择"
- />
- <u-radio-group
- v-else-if="fillInfo.type === fillInfoTypeValue.FILL_INFO_TYPE_DAN_XUAN"
- v-model="form[fillInfoList[listIndex].infoId]">
- <u-radio
- v-for="(item,value) in getRadioGroup(fillInfo)"
- :key="item.value"
- :name="item.value"
- >{{ item.label }}
- </u-radio>
- </u-radio-group>
- <template
- v-else-if="fillInfo.type === fillInfoTypeValue.FILL_INFO_TYPE_FAN_WEI"
- >
- <view class="d-flex">
- <u-input style="width: 60rpx;" v-model="form[fillInfoList[listIndex].infoId+'Start']" type="number" placeholder="起始值" />
- <text class="px3">至</text>
- <u-input style="width: 60rpx;" v-model="form[fillInfoList[listIndex].infoId+'End']" type="number" placeholder="结束值" />
- <text class="px3">减</text>
- <u-input style="width: 60rpx;" v-model="form[fillInfoList[listIndex].infoId+'Eliminate']" type="number" placeholder="未工作值" />
- <template v-if="fillInfo.codeValue === fillInfoCodeValue.FILL_INFO_CODE_VALUE_GLS">
- KM
- </template>
- <template v-if="fillInfo.codeValue === fillInfoCodeValue.FILL_INFO_CODE_VALUE_SJS">
- 小时
- </template>
- </view>
- </template>
- <u-input v-else v-model="form[fillInfoList[listIndex].infoId]" placeholder="请输入" type="textarea" :height="50" />
- </u-form-item>
- </template>
- </template>
- </u-form>
- <view class="mt-3">
- <u-button @click="submit" type="primary" shape="circle">提交</u-button>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- props: {
- useType: {
- type: Number,
- default: 1
- },
- sbId: {
- type: String,
- default: null
- },
- id: {
- type: String,
- default: null
- },
- projectQuantityList: {
- type: Array,
- default: () => []
- }
- },
- data() {
- return {
- form: {
- sbId: null
- },
- dateTimeParams: {
- year: true,
- month: true,
- day: true,
- hour: true,
- minute: true,
- second: true
- },
- startTimeShow: false,
- endTimeShow: false,
- fillDateShow: false,
- sbInfo: {},
- sbList: [],
- fillInfoList: [],
- natureShowMap: {},
- natureList: [],
- selectOptionMap: {},
- radioGroupMap: {},
- fillInfoTypeValue: {},
- projectQuantityUnitMap: {},
- fillInfoCodeValue: {}
- };
- },
- watch: {
- sbId (nVal) {
- this.getSbInfo(nVal)
- },
- id (nVal) {
- this.updateModel(nVal)
- }
- },
- created () {
- this.fillInfoTypeValue = this.$DictCache.VALUE.FILL_INFO_TYPE;
- this.fillInfoCodeValue = this.$DictCache.VALUE.FILL_INFO_CODE_VALUE;
- this.projectQuantityUnitMap = this.$DictCache.getLabelByValueMapByType(this.$DictCache.TYPE.FILL_PROJECT_QUANTITY_UNIT)
- this.$Http.queryPageByFilter({ filter: 1, pageNum: 1, pageSize: 1000 }).then(res => {
- const sbList = res.data.rows;
- sbList.forEach(item => {
- item.sbName = item.name + '-' + item.no;
- })
- this.sbList = sbList;
- });
- // #ifdef H5
- this.getSbInfo(this.sbId)
- this.updateModel(this.id)
- // #endif
- },
- methods: {
- updateModel(id) {
- console.log(111, id)
- if (!id) {
- return
- }
- if (this.$DictCache.VALUE.FILL_INFO_USE_TYPE.FILL_INFO_USE_TYPE_YUN_XING === this.useType) {
- this.$Http.fetchSbRunFill({ id: id }).then(res => {
- this.setModel(res.data)
- })
- } else {
- this.$Http.fetchSbInspectionFill({ id: id }).then(res => {
- this.setModel(res.data)
- })
- }
- },
- getSbInfo(sbId) {
- if (sbId) {
- this.form.sbId = sbId
- this.$Http.fetchSbInfo({ id: sbId }).then(res => {
- this.sbSelect(sbId, res.data)
- })
- }
- },
- showDateTime(type) {
- this.startTimeShow = false
- this.endTimeShow = false
- this.fillDateShow = false
- if (type === 'start') {
- this.startTimeShow = true
- } else if (type === 'end') {
- this.endTimeShow = true
- } else {
- this.fillDateShow = true
- }
- },
- confirmDateTime(result, type, id) {
- console.log(1111, result, id)
- if (type === 'start') {
- this.form[id] = result.year + '-' + result.month + '-' + result.day +
- ' ' + result.hour + ':' + result.minute + ':' + result.second
- this.startTimeShow = false
- } else if (type === 'end') {
- this.form[id] = result.year + '-' + result.month + '-' + result.day +
- ' ' + result.hour + ':' + result.minute + ':' + result.second
- this.endTimeShow = false
- } else {
- this.form.fillDate = result.year + '-' + result.month + '-' + result.day
- this.fillDateShow = false
- }
- },
- cancelDateTime(type) {
- if (type === 'start') {
- this.startTimeShow = false
- } else if (type === 'end') {
- this.endTimeShow = false
- } else {
- this.fillDateShow = false
- }
- },
- setModel(model) {
- this.fillInfoList = [];
- this.natureList = [];
- this.natureShowMap = {}
- const sbInfo = {
- 'sbId': model.sbId,
- 'fillDate': model.fillDate,
- 'fillInfoList': model.fillInfoList
- }
- const myForm = this.getFillInfoList(model.fillInfoList)
- myForm.sbId = model.sbId;
- myForm.fillDate = model.fillDate;
- const natureList = this.$DictCache.getChildrenList(this.$DictCache.TYPE.FILL_INFO_NATURE)
- natureList.forEach(natureItem => {
- if (this.natureShowMap[natureItem.value]) {
- natureItem.show = true
- } else {
- natureItem.show = false
- }
- })
- this.form = myForm;
- this.sbInfo = sbInfo
- this.natureList = natureList;
- this.fillInfoList = model.fillInfoList;
- },
- getFillInfoList(fillInfoList) {
- const myForm = {}
- fillInfoList.forEach(fillInfo => {
- this.natureShowMap[fillInfo.nature] = true
- if (fillInfo.type === this.fillInfoTypeValue.FILL_INFO_TYPE_XIA_LA) {
- if (this.$BaseTool.Object.isNotBlank(fillInfo.resultValue)) {
- myForm[fillInfo.infoId] = fillInfo.resultValue
- } else {
- myForm[fillInfo.infoId] = this.getSelectOptionDefault(fillInfo)
- }
- } else if (fillInfo.type === this.fillInfoTypeValue.FILL_INFO_TYPE_DATE_TIME) {
- const nowDateTime = this.$u.timeFormat(null, 'yyyy-mm-dd hh:MM:ss');
- if (this.$BaseTool.Object.isNotBlank(fillInfo.startTime)) {
- myForm[fillInfo.infoId + 'TimeS'] = fillInfo.startTime
- } else {
- myForm[fillInfo.infoId + 'TimeS'] = nowDateTime
- }
- if (this.$BaseTool.Object.isNotBlank(fillInfo.endTime)) {
- myForm[fillInfo.infoId + 'TimeE'] = fillInfo.endTime
- } else {
- myForm[fillInfo.infoId + 'TimeE'] = nowDateTime
- }
- if (this.$BaseTool.Object.isNotBlank(fillInfo.resultEliminate)) {
- myForm[fillInfo.infoId + 'TimeR'] = fillInfo.resultEliminate
- } else {
- myForm[fillInfo.infoId + 'TimeR'] = 0
- }
- } else if (fillInfo.type === this.fillInfoTypeValue.FILL_INFO_TYPE_DAN_XUAN) {
- if (this.$BaseTool.Object.isNotBlank(fillInfo.resultValue)) {
- myForm[fillInfo.infoId] = fillInfo.resultValue
- } else {
- myForm[fillInfo.infoId] = this.getRadioGroupDefault(fillInfo)
- }
- } else if (fillInfo.type === this.fillInfoTypeValue.FILL_INFO_TYPE_FAN_WEI) {
- if (this.$BaseTool.Object.isNotBlank(fillInfo.resultStart)) {
- myForm[fillInfo.infoId + 'Start'] = fillInfo.resultStart;
- } else {
- myForm[fillInfo.infoId + 'Start'] = 0;
- }
- if (this.$BaseTool.Object.isNotBlank(fillInfo.resultEnd)) {
- myForm[fillInfo.infoId + 'End'] = fillInfo.resultEnd;
- } else {
- myForm[fillInfo.infoId + 'End'] = 0;
- }
- if (this.$BaseTool.Object.isNotBlank(fillInfo.resultEliminate)) {
- myForm[fillInfo.infoId + 'Eliminate'] = fillInfo.resultEliminate;
- } else {
- myForm[fillInfo.infoId + 'Eliminate'] = 0;
- }
- } else if (fillInfo.type === this.fillInfoTypeValue.FILL_INFO_TYPE_DECIMAL) {
- myForm[fillInfo.infoId] = fillInfo.resultNumber
- } else if (fillInfo.type === this.fillInfoTypeValue.FILL_INFO_TYPE_STRING) {
- myForm[fillInfo.infoId] = fillInfo.resultDesc
- } else if (fillInfo.type === this.fillInfoTypeValue.FILL_INFO_TYPE_PROJECT_QUANTITY) {
- myForm[fillInfo.infoId] = this.getProjectQuantityListIdValueDefault(fillInfo).resultDesc
- myForm[fillInfo.infoId + 'Unit'] = this.getUnit(fillInfo, 'unit')
- myForm[fillInfo.infoId + 'SiteUnit'] = this.getUnit(fillInfo, 'siteUnit')
- if (this.$BaseTool.Object.isNotBlank(fillInfo.resultStart)) {
- myForm[fillInfo.infoId + 'ProjectQuantityS'] = fillInfo.resultStart;
- } else {
- myForm[fillInfo.infoId + 'ProjectQuantityS'] = 0;
- }
- if (this.$BaseTool.Object.isNotBlank(fillInfo.resultEnd)) {
- myForm[fillInfo.infoId + 'ProjectQuantityE'] = fillInfo.resultEnd;
- } else {
- myForm[fillInfo.infoId + 'ProjectQuantityE'] = 0;
- }
- if (this.$BaseTool.Object.isNotBlank(fillInfo.resultEliminate)) {
- myForm[fillInfo.infoId + 'ProjectQuantityT'] = fillInfo.resultEliminate;
- } else {
- myForm[fillInfo.infoId + 'ProjectQuantityT'] = 0;
- }
- if (this.$BaseTool.Object.isNotBlank(fillInfo.resultNumber)) {
- myForm[fillInfo.infoId + 'ProjectQuantityV'] = fillInfo.resultNumber;
- } else {
- myForm[fillInfo.infoId + 'ProjectQuantityV'] = 0;
- }
- if (this.$BaseTool.Object.isNotBlank(fillInfo.remark)) {
- myForm[fillInfo.infoId + 'RemarkProjectQuantity'] = fillInfo.remark;
- } else {
- myForm[fillInfo.infoId + 'RemarkProjectQuantity'] = '';
- }
- } else {
- myForm[fillInfo.infoId] = fillInfo.resultValue
- }
- })
- return myForm
- },
- sbSelect(value, data) {
- // this.$DictCache.VALUE.FILL_INFO_USE_TYPE.FILL_INFO_USE_TYPE_YUN_XING
- this.fillInfoList = [];
- this.natureList = [];
- this.form = { sbId: value };
- this.$Http.queryFillExecuteBySbIdUseType({ sbId: value, useType: this.useType }).then(res => {
- const fillInfoList = res.data.fillInfoList
- const myForm = this.getFillInfoList(res.data.fillInfoList)
- myForm.sbId = this.form.sbId;
- const nowDateTime = this.$u.timeFormat(null, 'yyyy-mm-dd');
- myForm.fillDate = res.data.fillDate ? res.data.fillDate : nowDateTime;
- const sbInfo = {
- 'sbId': data.id,
- 'sbNo': data.no,
- 'sbName': data.name,
- 'fillDate': res.data.fillDate,
- 'fillInfoList': fillInfoList
- }
- this.natureShowMap = {}
- const natureList = this.$DictCache.getChildrenList(this.$DictCache.TYPE.FILL_INFO_NATURE)
- natureList.forEach(natureItem => {
- if (this.natureShowMap[natureItem.value]) {
- natureItem.show = true
- } else {
- natureItem.show = false
- }
- })
- this.form = myForm;
- this.sbInfo = sbInfo;
- this.natureList = natureList;
- this.fillInfoList = fillInfoList;
- })
- },
- changeProjectQuantity (val, fillInfo) {
- const selectList = this.projectQuantityList.filter((item) => { return item.id === val })
- this.form[fillInfo.infoId + 'Unit'] = this.projectQuantityUnitMap[selectList[0].unit]
- this.form[fillInfo.infoId + 'siteUnit'] = this.projectQuantityUnitMap[selectList[0].siteUnit]
- },
- getUnit (fillInfo, id) {
- const unit = this.getProjectQuantityListIdValueDefault(fillInfo)[id]
- if (unit) {
- return this.projectQuantityUnitMap[unit]
- }
- return '无'
- },
- getProjectQuantityListIdValueDefault (fillInfo) {
- let selectItem = {}
- let resultStr = null
- if (this.$BaseTool.String.isNotBlank(fillInfo.resultDesc)) {
- const selectList = this.projectQuantityList.filter((item) => { return item.id === fillInfo.resultDesc })
- if (selectList && selectList.length > 0) {
- selectItem = selectList[0]
- }
- resultStr = fillInfo.resultDesc
- } else {
- if (this.projectQuantityList && this.projectQuantityList.length > 0) {
- selectItem = this.projectQuantityList[0]
- resultStr = this.projectQuantityList[0].id
- }
- }
- selectItem.resultDesc = resultStr
- return selectItem
- },
- getSelectOptions (fillInfo) {
- if (this.$BaseTool.Object.isBlank(this.selectOptionMap[fillInfo.dictType])) {
- this.selectOptionMap[fillInfo.dictType] = this.$DictCache.getChildrenList(fillInfo.dictType)
- }
- return this.selectOptionMap[fillInfo.dictType]
- },
- getSelectOptionDefault (fillInfo) {
- if (this.$BaseTool.Object.isNotBlank(fillInfo.resultValue)) {
- return fillInfo.resultValue
- }
- const options = this.getSelectOptions(fillInfo)
- const keys = Object.keys(options)
- if (this.$BaseTool.Object.isNotBlank(keys) && keys.length > 0) {
- return parseInt(keys[0])
- }
- return null
- },
- getRadioGroup (fillInfo) {
- if (this.$BaseTool.Object.isBlank(this.radioGroupMap[fillInfo.dictType])) {
- this.radioGroupMap[fillInfo.dictType] = this.$DictCache.getChildrenList(fillInfo.dictType)
- }
- return this.radioGroupMap[fillInfo.dictType]
- },
- getRadioGroupDefault (fillInfo) {
- if (this.$BaseTool.Object.isNotBlank(fillInfo.resultValue)) {
- return fillInfo.resultValue
- }
- const options = this.getRadioGroup(fillInfo)
- if (this.$BaseTool.Object.isNotBlank(options) && options.length > 0) {
- return options[0].value
- }
- return null
- },
- fillInfoSaveValue (sbInfo, values) {
- const fillInfoList = sbInfo.fillInfoList
- const fillInfoMap = {}
- fillInfoList.forEach(item => {
- fillInfoMap[item.infoId] = item
- })
- Object.keys(values).forEach(infoId => {
- const startIndex = infoId.indexOf('Start')
- const endIndex = infoId.indexOf('End')
- const eliminateIndex = infoId.indexOf('Eliminate')
- const projectStartIndex = infoId.indexOf('ProjectQuantityS')
- const projectEndIndex = infoId.indexOf('ProjectQuantityE')
- const projectEliminateIndex = infoId.indexOf('ProjectQuantityT')
- const projectResultNumberIndex = infoId.indexOf('ProjectQuantityV')
- const remarkProjectQuantityIndex = infoId.indexOf('RemarkProjectQuantity')
- const startTimeIndex = infoId.indexOf('TimeS')
- const endTimeIndex = infoId.indexOf('TimeE')
- const eliminateTimeIndex = infoId.indexOf('TimeR')
- if (startIndex > 0) {
- const realInfoId = infoId.substring(0, startIndex)
- fillInfoMap[realInfoId].resultStart = values[infoId]
- } else if (endIndex > 0) {
- const realInfoId = infoId.substring(0, endIndex)
- fillInfoMap[realInfoId].resultEnd = values[infoId]
- } else if (eliminateIndex > 0) {
- const realInfoId = infoId.substring(0, eliminateIndex)
- fillInfoMap[realInfoId].resultEliminate = values[infoId]
- } else if (startTimeIndex > 0) {
- const realInfoId = infoId.substring(0, startTimeIndex)
- fillInfoMap[realInfoId].startTime = values[infoId]
- } else if (endTimeIndex > 0) {
- const realInfoId = infoId.substring(0, endTimeIndex)
- fillInfoMap[realInfoId].endTime = values[infoId]
- } else if (eliminateTimeIndex > 0) {
- const realInfoId = infoId.substring(0, eliminateTimeIndex)
- fillInfoMap[realInfoId].resultEliminate = values[infoId]
- } else if (projectStartIndex > 0) {
- const realInfoId = infoId.substring(0, projectStartIndex)
- fillInfoMap[realInfoId].resultStart = values[infoId]
- } else if (projectEndIndex > 0) {
- const realInfoId = infoId.substring(0, projectEndIndex)
- fillInfoMap[realInfoId].resultEnd = values[infoId]
- } else if (projectEliminateIndex > 0) {
- const realInfoId = infoId.substring(0, projectEliminateIndex)
- fillInfoMap[realInfoId].resultEliminate = values[infoId]
- } else if (projectResultNumberIndex > 0) {
- const realInfoId = infoId.substring(0, projectResultNumberIndex)
- fillInfoMap[realInfoId].resultNumber = values[infoId]
- } else if (remarkProjectQuantityIndex > 0) {
- const realInfoId = infoId.substring(0, remarkProjectQuantityIndex)
- fillInfoMap[realInfoId].remark = values[infoId]
- } else {
- const fillInfo = fillInfoMap[infoId]
- if (fillInfo != null) {
- if (fillInfo.type === this.$DictCache.VALUE.FILL_INFO_TYPE.FILL_INFO_TYPE_INT) {
- fillInfoMap[infoId].resultValue = values[infoId]
- } else if (fillInfo.type === this.$DictCache.VALUE.FILL_INFO_TYPE.FILL_INFO_TYPE_DECIMAL) {
- fillInfoMap[infoId].resultNumber = values[infoId]
- } else if (fillInfo.type === this.$DictCache.VALUE.FILL_INFO_TYPE.FILL_INFO_TYPE_STRING) {
- fillInfoMap[infoId].resultDesc = values[infoId]
- } else if (fillInfo.type === this.$DictCache.VALUE.FILL_INFO_TYPE.FILL_INFO_TYPE_XIA_LA) {
- fillInfoMap[infoId].resultValue = values[infoId]
- } else if (fillInfo.type === this.$DictCache.VALUE.FILL_INFO_TYPE.FILL_INFO_TYPE_DAN_XUAN) {
- fillInfoMap[infoId].resultValue = values[infoId]
- } else if (fillInfo.type === this.$DictCache.VALUE.FILL_INFO_TYPE.FILL_INFO_TYPE_PROJECT_QUANTITY) {
- console.log(555555, values[infoId])
- fillInfoMap[infoId].resultDesc = values[infoId]
- } else {
- }
- }
- }
- })
- const resultInfoList = []
- Object.values(fillInfoMap).forEach(fillInfo => {
- resultInfoList.push(fillInfo)
- })
- return resultInfoList
- },
- submit() {
- console.log(this.form);
- if (Object.keys(this.form).length <= 1) {
- uni.showToast({ icon: 'none', title: '请填写填报项' });
- return
- }
- this.sbInfo.fillInfoList = this.fillInfoSaveValue(this.sbInfo, this.form)
- this.sbInfo.fillDate = this.form.fillDate
- const fill = {
- id: this.id,
- sbId: this.form.sbId,
- fillDate: this.form.fillDate
- }
- fill.fillInfoList = this.sbInfo.fillInfoList
- if (this.$DictCache.VALUE.FILL_INFO_USE_TYPE.FILL_INFO_USE_TYPE_YUN_XING === this.useType) {
- if (this.id) {
- this.$Http.updateSbRunFill(fill).then(() => {
- uni.redirectTo({
- url: '/pages/running/running'
- });
- }).catch(() => {
- })
- } else {
- this.$Http.addSbRunFills([this.sbInfo])
- .then(() => {
- uni.redirectTo({
- url: '/pages/running/running'
- });
- }).catch(() => {
- })
- }
- } else if (this.$DictCache.VALUE.FILL_INFO_USE_TYPE.FILL_INFO_USE_TYPE_XUN_JIAN === this.useType) {
- if (this.id) {
- this.$Http.updateSbInspectionFill(fill).then(() => {
- uni.redirectTo({
- url: '/pages/inspection/inspection'
- });
- }).catch(() => {
- })
- } else {
- this.$Http.addSbInspectionFill([this.sbInfo])
- .then(() => {
- uni.redirectTo({
- url: '/pages/inspection/inspection'
- });
- }).catch(() => {
- })
- }
- }
- }
- }
- };
- </script>
- <style></style>
|