123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920 |
- <template>
- <a-card :bordered="false" v-show="visible" class="card" :title="modalTitle">
- <a-row :gutter="48" slot="extra">
- <a-col :md="48" :sm="48">
- <span class="table-page-search-submitButtons" style="float: right">
- <a-button type="primary" @click="save()">提交</a-button>
- <a-button style="margin-left: 8px" @click="handleCancel()">返回</a-button>
- </span>
- </a-col>
- </a-row>
- <title-divider title="基本信息" width="90px"></title-divider>
- <a-form :form="form">
- <a-form-item v-show="false" >
- <a-input v-decorator="['id']" type="hidden"/>
- <a-input v-decorator="['parentId']" type="hidden"/>
- </a-form-item>
- <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
- <a-col :lg="12" :md="24" :sm="24">
- <a-form-item
- label="计量设备编号"
- :labelCol="BaseTool.Constant.labelCol"
- :wrapperCol="BaseTool.Constant.wrapperCol"
- >
- <a-input
- v-decorator="['cardNo', {rules: [{required: true, message: '不能为空'}]}]" />
- </a-form-item>
- </a-col>
- <a-col :lg="12" :md="24" :sm="24">
- <a-form-item
- label="设备编号"
- :labelCol="BaseTool.Constant.labelCol"
- :wrapperCol="BaseTool.Constant.wrapperCol"
- >
- <a-input
- v-decorator="['no', {rules: [{required: false, message: '不能为空'}]}]" />
- </a-form-item>
- </a-col>
- <a-col :lg="12" :md="24" :sm="24">
- <a-form-item
- label="设备名称"
- :labelCol="BaseTool.Constant.labelCol"
- :wrapperCol="BaseTool.Constant.wrapperCol"
- >
- <a-input
- v-decorator="['name', {rules: [{required: true, message: '设备名称不能为空'}]}]" />
- </a-form-item>
- </a-col>
- <a-col :lg="12" :md="24" :sm="24">
- <a-form-item
- label="型号"
- :labelCol="BaseTool.Constant.labelCol"
- :wrapperCol="BaseTool.Constant.wrapperCol"
- >
- <a-input
- v-decorator="['model', {rules: [{required: false, message: '设备型号不能为空'}]}]" />
- </a-form-item>
- </a-col>
- <a-col :lg="12" :md="24" :sm="24">
- <a-form-item
- label="出厂编号"
- :labelCol="BaseTool.Constant.labelCol"
- :wrapperCol="BaseTool.Constant.wrapperCol"
- >
- <a-input
- v-decorator="['zzh']" />
- </a-form-item>
- </a-col>
- <a-col :lg="12" :md="24" :sm="24">
- <a-form-item
- label="要求准确度等级"
- :labelCol="BaseTool.Constant.labelCol"
- :wrapperCol="BaseTool.Constant.wrapperCol"
- >
- <a-input
- v-decorator="['zz']" />
- </a-form-item>
- </a-col>
- <a-col :lg="12" :md="24" :sm="24">
- <a-form-item
- label="使用部门"
- :labelCol="BaseTool.Constant.labelCol"
- :wrapperCol="BaseTool.Constant.wrapperCol"
- >
- <a-input
- v-decorator="['useDept']" />
- </a-form-item>
- </a-col>
- <a-col :lg="12" :md="24" :sm="24">
- <a-form-item
- label="使用地点"
- :labelCol="BaseTool.Constant.labelCol"
- :wrapperCol="BaseTool.Constant.wrapperCol"
- >
- <a-input
- v-decorator="['cph']" />
- </a-form-item>
- </a-col>
- <a-col :lg="12" :md="24" :sm="24">
- <a-form-item
- label="生产商"
- :labelCol="BaseTool.Constant.labelCol"
- :wrapperCol="BaseTool.Constant.wrapperCol"
- >
- <a-select
- show-search
- option-filter-prop="children"
- :filter-option="filterOptionProducer"
- v-decorator="['producerId']"
- placeholder="请选择">
- <a-select-option
- v-for="({id, name}) in producerList"
- :key="id"
- :label="name"
- :value="id">{{ name }}
- </a-select-option>
- </a-select>
- <!-- <a-input
- v-decorator="['producerId']" /> -->
- </a-form-item>
- </a-col>
- <a-col :lg="12" :md="24" :sm="24">
- <a-form-item
- label="管理状态"
- :labelCol="BaseTool.Constant.labelCol"
- :wrapperCol="BaseTool.Constant.wrapperCol"
- >
- <a-select v-decorator="['status', {rules: [{required: true, message: '状态不能为空'}]}]" placeholder="请选择">
- <a-select-option
- v-for="(label,value) in statusMap"
- :key="value"
- :label="label"
- :value="parseInt(value)">{{ label }}
- </a-select-option>
- </a-select>
- </a-form-item>
- </a-col>
- <a-col :lg="12" :md="24" :sm="24">
- <a-form-item
- label="是否固定设备"
- :labelCol="BaseTool.Constant.labelCol"
- :wrapperCol="BaseTool.Constant.wrapperCol"
- >
- <a-select v-decorator="['isFinancing', { rules: [{required: true, message: '是否显示不能为空'}]}]" placeholder="请选择">
- <a-select-option
- v-for="(label,value) in isFinancingMap"
- :key="value"
- :label="label"
- :value="parseInt(value)">{{ label }}
- </a-select-option>
- </a-select>
- </a-form-item>
- </a-col>
- <a-col :lg="12" :md="24" :sm="24">
- <a-form-item
- label="固定设备编号"
- :labelCol="BaseTool.Constant.labelCol"
- :wrapperCol="BaseTool.Constant.wrapperCol"
- >
- <a-input
- v-decorator="['financingNo']" />
- </a-form-item>
- </a-col>
- <a-col :lg="12" :md="24" :sm="24">
- <a-form-item
- label="准确度等级"
- :labelCol="BaseTool.Constant.labelCol"
- :wrapperCol="BaseTool.Constant.wrapperCol"
- >
- <a-input
- v-decorator="['fdjxh']" />
- </a-form-item>
- </a-col>
- <a-col :lg="12" :md="24" :sm="24">
- <a-form-item
- label="检定单位"
- :labelCol="BaseTool.Constant.labelCol"
- :wrapperCol="BaseTool.Constant.wrapperCol"
- >
- <a-input
- v-decorator="['dph']" />
- </a-form-item>
- </a-col>
- <a-col :lg="12" :md="24" :sm="24">
- <a-form-item
- label="检定人"
- :labelCol="BaseTool.Constant.labelCol"
- :wrapperCol="BaseTool.Constant.wrapperCol"
- >
- <a-input
- v-decorator="['zaiz']" />
- </a-form-item>
- </a-col>
- <a-col :lg="12" :md="24" :sm="24">
- <a-form-item
- label="检定结论"
- :labelCol="BaseTool.Constant.labelCol"
- :wrapperCol="BaseTool.Constant.wrapperCol"
- >
- <a-select v-decorator="['rlType']" placeholder="请选择">
- <a-select-option
- v-for="(label,value) in measureMap"
- :key="value"
- :label="label"
- :value="parseInt(value)">{{ label }}
- </a-select-option>
- </a-select>
- </a-form-item>
- </a-col>
- <a-col :lg="12" :md="24" :sm="24">
- <a-form-item
- label="是否周检查"
- :labelCol="BaseTool.Constant.labelCol"
- :wrapperCol="BaseTool.Constant.wrapperCol"
- >
- <a-select v-decorator="['color']" placeholder="请选择">
- <a-select-option
- key="0"
- label="否"
- value="0">否
- </a-select-option>
- <a-select-option
- key="1"
- label="是"
- value="1">是
- </a-select-option>
- </a-select>
- </a-form-item>
- </a-col>
- <a-col :lg="12" :md="24" :sm="24">
- <a-form-item
- label="检定证书编号"
- :labelCol="BaseTool.Constant.labelCol"
- :wrapperCol="BaseTool.Constant.wrapperCol"
- >
- <a-input
- v-decorator="['sbdh']" />
- </a-form-item>
- </a-col>
- <a-col :lg="12" :md="24" :sm="24">
- <a-form-item
- label="预警天数"
- :labelCol="BaseTool.Constant.labelCol"
- :wrapperCol="BaseTool.Constant.wrapperCol"
- >
- <a-input-number
- style="width: 100%"
- :min="0"
- :step="0.01"
- :formatter="BaseTool.Amount.formatter"
- :parser="BaseTool.Amount.parser"
- v-decorator="['seatNumber']" />
- </a-form-item>
- </a-col>
- <a-col :lg="12" :md="24" :sm="24">
- <a-form-item
- label="检定日期"
- :labelCol="BaseTool.Constant.labelCol"
- :wrapperCol="BaseTool.Constant.wrapperCol"
- >
- <a-date-picker
- style="width: 100%"
- :format="BaseTool.Date.PICKER_NORM_DATE_PATTERN"
- v-decorator="['checkDate']" />
- </a-form-item>
- </a-col>
- <a-col :lg="12" :md="24" :sm="24">
- <a-form-item
- label="检定周期"
- :labelCol="BaseTool.Constant.labelCol"
- :wrapperCol="BaseTool.Constant.wrapperCol"
- >
- <a-input
- style="width: 100%"
- suffix="月"
- :formatter="BaseTool.Amount.formatter"
- :parser="BaseTool.Amount.parser"
- v-decorator="['checkPeriod']" />
- </a-form-item>
- </a-col>
- <a-col :lg="12" :md="24" :sm="24">
- <a-form-item
- label="检定有效期"
- :labelCol="BaseTool.Constant.labelCol"
- :wrapperCol="BaseTool.Constant.wrapperCol"
- >
- <a-date-picker
- style="width: 100%"
- disabled
- :format="BaseTool.Date.PICKER_NORM_DATE_PATTERN"
- v-decorator="['nextCheckDate']" />
- </a-form-item>
- </a-col>
- <a-col :lg="12" :md="24" :sm="24">
- <a-form-item
- label="检定校准记录"
- :labelCol="BaseTool.Constant.labelCol"
- :wrapperCol="BaseTool.Constant.wrapperCol"
- >
- <a-input
- v-decorator="['zbh']" />
- </a-form-item>
- </a-col>
- <a-col :lg="12" :md="24" :sm="24">
- <a-form-item
- label="备注"
- :labelCol="BaseTool.Constant.labelCol"
- :wrapperCol="BaseTool.Constant.wrapperCol"
- >
- <a-input
- v-decorator="['remark']" />
- </a-form-item>
- </a-col>
- <a-col :lg="12" :md="24" :sm="24">
- <a-form-item
- label="备注2"
- :labelCol="BaseTool.Constant.labelCol"
- :wrapperCol="BaseTool.Constant.wrapperCol"
- >
- <a-input
- v-decorator="['remark2']" />
- </a-form-item>
- </a-col>
- </a-row>
- </a-form>
- <sb-model-select-modal ref="sbModelSelectModal" @selected="handleSbModelSelected"/>
- <sb-info-select-modal ref="sbInfoSelectModal" @selected="handleSbSelectd"/>
- <firm-producer-select-modal ref="producerSelectModal" @selected="handleProducerSelected"/>
- </a-card>
- </template>
- <script>
- import pick from 'lodash.pick'
- import { addSbInfo, updateSbInfo, fetchSbInfo, copySbInfo } from '@/api/sb/measure'
- import { fetchSbTypeTree } from '@/api/sb/type'
- import { querySbPosition } from '@/api/sb/position'
- import FirmProducerSelectModal from '@/views/firm/producer/modules/FirmProducerSelectModal'
- import SbGuigeSelectModal from '@/views/sb/guige/modules/SbGuigeSelectModal'
- import SbModelSelectModal from '@/views/sb/model/modules/SbModelSelectModal'
- import BaseTool from '../../../../utils/tool'
- import { queryUserDeptByUserDeptId } from '@/api/upms/user-dept'
- import { ACCESS_TOKEN } from '@/store/mutation-types'
- import Vue from 'vue'
- import { uploadUrl } from '@/api/upms/file'
- import { queryDept, getDeptsAllByParentId } from '@/api/upms/dept'
- import { queryUser } from '@/api/upms/user'
- import DetailList from '@/components/tools/DetailList'
- import SbInfoSelectModal from '@/views/sb/info/modules/SbInfoSelectModal'
- import { queryFirmProducer } from '@/api/firm/producer'
- const DetailListItem = DetailList.Item
- export default {
- name: 'BaseSbInfo',
- components: {
- FirmProducerSelectModal,
- SbGuigeSelectModal,
- SbModelSelectModal,
- SbInfoSelectModal,
- DetailList,
- DetailListItem
- },
- data () {
- return {
- confirmLoading: false,
- modalTitle: null,
- form: this.$form.createForm(this),
- areaList: {},
- companyList: {},
- paramList: [],
- projectList: {},
- deptList: {},
- groupList: {},
- visible: false,
- sbTypeTreeData: [],
- sbPositionData: [],
- measureMap: {},
- statusMap: {},
- isFinancingMap: {},
- producerList: {},
- userList: {},
- sbInfoSelectType: null,
- repairFileList: [], // 维修手册
- defaultRepairFileList: [],
- defaultUseFileList: [],
- defaultRecheckFileList: [],
- defaultSbFileList: [],
- useFileList: [], // 使用手册
- recheckFileList: [], // 验收手册
- sbFileList: [], // 设备图片,
- uploadUrl: uploadUrl,
- qrcodesrc: null,
- id: null,
- fileList: [],
- type: null,
- headers: {
- Authorization: 'Bearer ' + Vue.ls.get(ACCESS_TOKEN)
- }
- }
- },
- created () {
- this.measureMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_MEASURE_RESULT)
- this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_MEASURE_STATUS)
- this.isFinancingMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_IS_FINANCING)
- queryFirmProducer({}).then(res => {
- this.producerList = res.data
- })
- },
- methods: {
- base (record, type) {
- this.setTree(record)
- // 清除文件列表
- this.visible = true
- // 选择框查询条件
- // 如果是空标识添加
- if (this.BaseTool.Object.isBlank(record)) {
- this.qrcodesrc = null
- this.modalTitle = '添加'
- this.clearFileList()
- return
- }
- this.modalTitle = '编辑'
- this.id = record.id
- this.qrcodesrc = record.qrCode
- this.repairFileList = record.repairFileList
- this.useFileList = record.useFileList
- this.recheckFileList = record.recheckFileList
- this.sbFileList = record.sbFileList
- this.defaultRepairFileList = this.BaseTool.UPLOAD.transImg(this.repairFileList)
- this.defaultUseFileList = this.BaseTool.UPLOAD.transImg(this.useFileList)
- this.defaultRecheckFileList = this.BaseTool.UPLOAD.transImg(this.recheckFileList)
- this.defaultSbFileList = this.BaseTool.UPLOAD.transImg(this.sbFileList)
- this.paramList = JSON.parse(record.paramList)
- if (type === 1) {
- this.type = type
- this.modalTitle = '复制'
- this.qrcodesrc = null
- record.no = null
- this.clearFileList()
- }
- const { form: { setFieldsValue } } = this
- // 日期处理
- // record.buyDate = this.BaseTool.Moment(record.buyDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
- // record.startDate = this.BaseTool.Moment(record.startDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
- // record.nextCheckDate = this.BaseTool.Moment(record.nextCheckDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
- // record.guaranteeDate = this.BaseTool.Moment(record.guaranteeDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
- // record.retirementDate = this.BaseTool.Moment(record.retirementDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
- // record.lastRepaireTime = this.BaseTool.Moment(record.lastRepaireTime, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
- // record.lastBaoyangTime = this.BaseTool.Moment(record.lastBaoyangTime, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
- if (record.buyDate != null) {
- record.buyDate = this.BaseTool.Moment(record.buyDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
- this.$nextTick(() => {
- setFieldsValue(Object.assign(pick(record, [
- 'buyDate'
- ])))
- })
- }
- if (record.startDate != null) {
- record.startDate = this.BaseTool.Moment(record.startDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
- this.$nextTick(() => {
- setFieldsValue(Object.assign(pick(record, [
- 'startDate'
- ])))
- })
- }
- if (record.checkDate != null) {
- record.checkDate = this.BaseTool.Moment(record.checkDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
- this.$nextTick(() => {
- setFieldsValue(Object.assign(pick(record, [
- 'checkDate'
- ])))
- })
- }
- if (record.nextCheckDate != null) {
- record.nextCheckDate = this.BaseTool.Moment(record.nextCheckDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
- this.$nextTick(() => {
- setFieldsValue(Object.assign(pick(record, [
- 'nextCheckDate'
- ])))
- })
- }
- if (record.retirementDate != null) {
- record.retirementDate = this.BaseTool.Moment(record.retirementDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
- this.$nextTick(() => {
- setFieldsValue(Object.assign(pick(record, [
- 'retirementDate'
- ])))
- })
- }
- if (record.registerDate != null) {
- record.registerDate = this.BaseTool.Moment(record.registerDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
- this.$nextTick(() => {
- setFieldsValue(Object.assign(pick(record, [
- 'registerDate'
- ])))
- })
- }
- record.unitName = this.BaseTool.Object.getField(this.unitMap, record.unit)
- this.$nextTick(() => {
- setFieldsValue(Object.assign(pick(record, [
- 'id',
- 'no',
- 'parentId',
- 'parentSbName',
- 'zz',
- 'zbh',
- 'isChild',
- 'isShow',
- 'isFinancing',
- 'financingNo',
- 'financingNoTwo',
- 'financingNoThird',
- 'financingNoFour',
- 'financingNoFive',
- 'name',
- 'model',
- 'cph',
- 'positionId',
- 'producerName',
- 'useArea',
- 'useCompany',
- 'useProject',
- 'useDept',
- 'saveUser',
- 'repairUser',
- 'useGroup',
- 'typeId',
- 'level',
- 'initialValue',
- // 'cutValue',
- 'producerId',
- // 'sourceType',
- 'unit',
- 'buyDate',
- 'startDate',
- 'zbh',
- // 'wbFile',
- // 'useFile',
- // 'checkFile',
- // 'sbImage',
- 'status',
- 'remark',
- 'remark2',
- 'zzh',
- 'zz',
- 'zjm',
- 'jbdh',
- 'useType',
- 'cardNo',
- 'fdjxh',
- 'checkDate',
- 'checkPeriod',
- 'nextCheckDate',
- 'dph',
- 'zaiz',
- 'rlType',
- 'color',
- 'sbdh',
- 'seatNumber',
- 'registerNo',
- 'characterType',
- 'usedNo',
- 'supplier',
- 'repairUserSecond',
- 'batchNo',
- 'workYear',
- 'retirementDate',
- 'registerDate'
- ])))
- })
- },
- save () {
- const { form: { validateFieldsAndScroll } } = this
- this.confirmLoading = true
- validateFieldsAndScroll((errors, values) => {
- if (errors) {
- this.confirmLoading = false
- return
- }
- // 日期数据的处理
- values.buyDate = BaseTool.Date.formatter(values.buyDate, BaseTool.Date.PICKER_NORM_DATE_PATTERN)
- values.startDate = BaseTool.Date.formatter(values.startDate, BaseTool.Date.PICKER_NORM_DATE_PATTERN)
- values.checkDate = BaseTool.Date.formatter(values.checkDate, BaseTool.Date.PICKER_NORM_DATE_PATTERN)
- values.nextCheckDate = BaseTool.Date.formatter(values.nextCheckDate, BaseTool.Date.PICKER_NORM_DATE_PATTERN)
- values.guaranteeDate = BaseTool.Date.formatter(values.guaranteeDate, BaseTool.Date.PICKER_NORM_DATE_PATTERN)
- values.retirementDate = BaseTool.Date.formatter(values.retirementDate, BaseTool.Date.PICKER_NORM_DATE_PATTERN)
- values.lastRepaireTime = this.BaseTool.Date.formatter(values.lastRepaireTime, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
- values.lastBaoyangTime = this.BaseTool.Date.formatter(values.lastBaoyangTime, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
- values.spDate = this.BaseTool.Date.formatter(values.spDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
- values.jbdDate = this.BaseTool.Date.formatter(values.jbdDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
- values.sbdDate = this.BaseTool.Date.formatter(values.sbdDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
- values.sbDate = this.BaseTool.Date.formatter(values.sbDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
- // 上传文件
- values.repairFileList = this.repairFileList
- values.useFileList = this.useFileList
- values.recheckFileList = this.recheckFileList
- values.sbFileList = this.sbFileList
- values.paramList = JSON.stringify(this.paramList)
- if (this.BaseTool.String.isBlank(values.id)) {
- addSbInfo(values)
- .then(() => {
- this.handleCancel(values)
- }).catch(() => {
- this.confirmLoading = false
- })
- } else {
- if (this.type == null) {
- updateSbInfo(values)
- .then(() => {
- this.handleCancel(values)
- }).catch(() => {
- this.confirmLoading = false
- })
- } else {
- copySbInfo(values)
- .then(() => {
- this.handleCancel(values)
- }).catch(() => {
- this.confirmLoading = false
- })
- }
- }
- })
- },
- getQrcodeSrc () {
- console.log(111, 22)
- },
- handleCancel () {
- this.visible = false
- this.confirmLoading = false
- this.form.resetFields()
- this.$emit('ok')
- },
- handleFresh () {
- fetchSbInfo({ id: this.id }).then(res => {
- const { form: { setFieldsValue } } = this
- const record = res.data
- this.$nextTick(() => {
- setFieldsValue(Object.assign(pick(record, [
- 'zjm',
- 'jbdh'
- ])))
- })
- })
- },
- setTree (record = {}) {
- fetchSbTypeTree().then(res => {
- this.sbTypeTreeData = res.data
- })
- querySbPosition().then(res => {
- this.sbPositionData = res.data
- })
- // getSbInfoTree({ id: record.id }).then(res => {
- // this.sbInfoTreeData = res.data
- // this.sourceSbInfoTreeData = res.data
- // })
- // getSbPositionTree().then(res => {
- // this.sbPositionTreeData = res.data
- // })
- queryDept({ nature: this.DictCache.VALUE.SYS_DEPT_NATURE.JITUAN }).then(res => {
- this.areaList = res.data
- })
- if (record.useArea != null) {
- getDeptsAllByParentId({ deptId: record.useArea, nature: this.DictCache.VALUE.SYS_DEPT_NATURE.FEN_GONG_SI }).then(res => {
- this.companyList = res.data
- })
- getDeptsAllByParentId({ deptId: record.useCompany, nature: this.DictCache.VALUE.SYS_DEPT_NATURE.XIANG_MU_BU }).then(res => {
- this.projectList = res.data
- })
- getDeptsAllByParentId({ deptId: record.useProject, nature: this.DictCache.VALUE.SYS_DEPT_NATURE.BU_MEN }).then(res => {
- this.deptList = res.data
- })
- getDeptsAllByParentId({ deptId: record.useDept, nature: this.DictCache.VALUE.SYS_DEPT_NATURE.BAN_ZU }).then(res => {
- this.groupList = res.data
- })
- queryUser({ }).then(res => {
- this.userList = res.data
- })
- }
- queryUser({ }).then(res => {
- this.userList = res.data
- })
- },
- handleSbModelSelect () {
- const modal = this.$refs.sbModelSelectModal
- modal.base()
- },
- handleSbModelSelected (keys, rows) {
- const [ key ] = keys
- const [ row ] = rows
- const { form: { setFieldsValue } } = this
- this.$nextTick(() => {
- setFieldsValue({
- 'modelId': key,
- 'name': row.name,
- 'model': row.model,
- 'nameModel': row.nameModel,
- 'typeId': row.typeId,
- 'typeName': row.typeName,
- 'level': row.level,
- 'initialValue': row.value,
- 'useType': row.useType,
- 'useTypeName': this.BaseTool.Object.getField(this.useTypeMap, row.useType),
- 'producerId': row.producerId,
- 'producerName': row.producerName,
- 'unit': row.unit,
- 'unitName': this.BaseTool.Object.getField(this.unitMap, row.unit)
- })
- })
- },
- beforeRecheckFileListUpload (file) {
- const reg = /\.(xls|xlsx)(\?.*)?$/
- return new Promise((resolve, reject) => {
- if (reg.test(file.name)) {
- this.recheckFileList = [file]
- return true
- } else {
- this.$message.error(`请上传正确的xls|xlsx文件`)
- reject(new Error('请上传正确的xls|xlsx文件'))
- return false
- }
- })
- },
- beforeUploadPic (file) {
- const reg = /\.(jpg|jpeg|png)(\?.*)?$/
- return new Promise((resolve, reject) => {
- if (reg.test(file.name)) {
- this.sbFileList = [file]
- return true
- } else {
- this.$message.error(`请上传正确的jpg|jpeg|png文件`)
- reject(new Error('请上传正确的jpg|jpeg|png文件'))
- return false
- }
- })
- },
- clearFileList () {
- this.repairFileList = []
- this.useFileList = []
- this.recheckFileList = []
- this.sbFileList = []
- },
- handleRepairFileChange (info) {
- this.defaultRepairFileList = info.fileList
- this.repairFileList = this.setFileList(info, 1)
- },
- handleUseFileChange (info) {
- this.defaultUseFileList = info.fileList
- this.useFileList = this.setFileList(info, 2)
- },
- handleAreaChange (value) {
- getDeptsAllByParentId({ deptId: value, nature: this.DictCache.VALUE.SYS_DEPT_NATURE.FEN_GONG_SI }).then(res => {
- this.companyList = res.data
- })
- },
- handleCompanyChange (value) {
- getDeptsAllByParentId({ deptId: value, nature: this.DictCache.VALUE.SYS_DEPT_NATURE.XIANG_MU_BU }).then(res => {
- this.projectList = res.data
- })
- },
- handleProjectChange (value) {
- getDeptsAllByParentId({ deptId: value, nature: this.DictCache.VALUE.SYS_DEPT_NATURE.BU_MEN }).then(res => {
- this.deptList = res.data
- })
- },
- handleDeptChange (value) {
- getDeptsAllByParentId({ deptId: value, nature: this.DictCache.VALUE.SYS_DEPT_NATURE.BAN_ZU }).then(res => {
- this.groupList = res.data
- })
- },
- handleGroupChange (value) {
- queryUserDeptByUserDeptId({ deptId: value }).then(res => {
- this.userList = res.data
- })
- },
- handleRecheckFileChange (info) {
- this.defaultRecheckFileList = info.fileList
- this.recheckFileList = this.setFileList(info, 3)
- },
- handleSbFileChange (info) {
- this.defaultSbFileList = info.fileList
- this.sbFileList = this.setFileList(info, 4)
- },
- setFileList1 (info, type) {
- const fileList = [...info.fileList]
- const file = [...info.file]
- if (file.status === 'done') {
- return this.BaseTool.UPLOAD.getUploadFileDTO(fileList, type)
- } else if (file.status === 'removed') {
- return this.BaseTool.UPLOAD.getUploadFileDTO(fileList, type)
- } else if (file.status === 'error') {
- this.$message.error('上传失败')
- return []
- }
- },
- clearParent () {
- const { form: { setFieldsValue } } = this
- // 日期处理
- this.$nextTick(() => {
- setFieldsValue(Object.assign({
- 'parentId': null,
- 'parentSbName': null
- }))
- })
- },
- // 主子设备切换
- childChange (value) {
- if (value === this.DictCache.VALUE.SB_IS_CHILD.IS_PARENT || value === this.DictCache.VALUE.SB_IS_CHILD.IS_NORMAL) {
- const { form: { setFieldsValue } } = this
- // 日期处理
- this.$nextTick(() => {
- setFieldsValue(Object.assign({
- 'parentId': null,
- 'parentSbName': null
- }))
- })
- }
- },
- handleSbSelect () {
- this.$refs.sbInfoSelectModal.base({}, { isChild: this.DictCache.VALUE.SB_IS_CHILD.IS_PARENT })
- },
- handleSbSelectd (keys, rows) {
- const [ key ] = keys
- const [ row ] = rows
- const { form: { setFieldsValue } } = this
- // 日期处理
- this.$nextTick(() => {
- setFieldsValue(Object.assign({
- 'parentId': key,
- 'parentSbName': row.name,
- 'isChild': this.DictCache.VALUE.SB_IS_CHILD.IS_CHILD
- }))
- })
- },
- handleChange (value) {
- },
- handleProducerSelect () {
- const modal = this.$refs.producerSelectModal
- modal.base({}, { type: 1 })
- },
- handleProducerSelected (record, selectedRowKeys, selectedRow) {
- const { form: { setFieldsValue } } = this
- const [ key ] = selectedRowKeys
- const [ row ] = selectedRow
- setFieldsValue({
- 'producerId': key,
- 'producerName': row.name
- })
- },
- filterOptionProducer (input, option) {
- return (
- option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
- )
- },
- setFileList (info, type) {
- // { file, fileList }
- const file = info.file
- const fileList = info.fileList
- // fileList = fileList.slice(-2)
- // console.log(111, this.BaseTool.UPLOAD.getUploadFileDTO(fileList, type))
- if (file.status === 'done') {
- return this.BaseTool.UPLOAD.getUploadFileDTO(fileList, type)
- } else if (file.status === 'removed') {
- return this.BaseTool.UPLOAD.getUploadFileDTO(fileList, type)
- } else if (file.status === 'error') {
- this.$message.error('上传失败')
- return null
- }
- },
- handlePoint () {
- const { form: { getFieldValue } } = this
- const zjm = getFieldValue('zjm')
- const jbdh = getFieldValue('jbdh')
- const a = document.createElement('a')
- a.href = '/hitch-screen/point.html?id=' + this.id + '&zjm=' + zjm + '&jbdh=' + jbdh
- a.target = '_blank'
- a.click()
- },
- handleParam () {
- const modal = this.$refs.paramForm
- modal.base(this.model)
- },
- handleParamList (values) {
- console.log(values)
- if (this.paramList == null) {
- this.paramList = []
- }
- this.paramList.push(values)
- },
- handleDelParam (index) {
- console.log(index)
- this.paramList.splice(index, 1)
- }
- }
- }
- </script>
|