|
@@ -1,302 +1,319 @@
|
|
|
<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 :loading="confirmLoading" type="primary" @click="save()">保存</a-button>
|
|
|
- <a-button style="margin-left: 8px" type="default" @click="handleCancel()">返回</a-button>
|
|
|
- </span>
|
|
|
- </a-col>
|
|
|
- </a-row>
|
|
|
- <a-form :form="form">
|
|
|
+ <a-modal
|
|
|
+ :title="modalTitle"
|
|
|
+ :width="900"
|
|
|
+ :visible="visible"
|
|
|
+ :confirmLoading="confirmLoading"
|
|
|
+ class="ant-modal2"
|
|
|
+ @cancel="handleCancel"
|
|
|
+ >
|
|
|
+ <a-form :form="form">
|
|
|
|
|
|
- <a-form-item v-show="false">
|
|
|
- <a-input v-decorator="['id']" type="hidden"/>
|
|
|
- </a-form-item>
|
|
|
+ <a-form-item v-show="false">
|
|
|
+ <a-input v-decorator="['id']" type="hidden" />
|
|
|
+ </a-form-item>
|
|
|
|
|
|
- <row-list :col="2">
|
|
|
- <row-item>
|
|
|
+ <row-list :col="2">
|
|
|
+ <row-item>
|
|
|
+ <a-form-item
|
|
|
+ label="建筑物"
|
|
|
+ :labelCol="BaseTool.Constant.labelCol"
|
|
|
+ :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
+ >
|
|
|
+ <a-cascader
|
|
|
+ :options="sbPositionList"
|
|
|
+ :load-data="loadData"
|
|
|
+ placeholder="请选择"
|
|
|
+ change-on-select
|
|
|
+ v-decorator="['positionId', {rules: [{required: true, message: '建筑物不能为空'}]}]"
|
|
|
+ />
|
|
|
+ </a-form-item>
|
|
|
+ </row-item>
|
|
|
+ <row-item>
|
|
|
+ <a-form-item
|
|
|
+ label="报修时间"
|
|
|
+ :labelCol="BaseTool.Constant.labelCol"
|
|
|
+ :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
+ >
|
|
|
+ <a-date-picker
|
|
|
+ showTime
|
|
|
+ style="width: 100%"
|
|
|
+ :format="BaseTool.Date.PICKER_NORM_DATETIME_PATTERN"
|
|
|
+ v-decorator="['applyTime', {rules: [{required: true, message: '报修时间不能为空'}]}]" />
|
|
|
+ </a-form-item>
|
|
|
+ </row-item>
|
|
|
+ <row-item>
|
|
|
|
|
|
- <a-form-item
|
|
|
- label="设备型号"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <a-input
|
|
|
- v-decorator="['positionId', {rules: [{required: true, message: '设备型号不能为空'}]}]"/>
|
|
|
- </a-form-item>
|
|
|
- </row-item>
|
|
|
- <row-item>
|
|
|
+ <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="['limitHours', {rules: [{required: true, message: '要求完成日期不能为空'}]}]" />
|
|
|
|
|
|
- <a-form-item
|
|
|
- label="申请人id"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <a-input
|
|
|
- v-decorator="['userId', {rules: [{required: true, message: '申请人id不能为空'}]}]"/>
|
|
|
- </a-form-item>
|
|
|
- </row-item>
|
|
|
- <row-item>
|
|
|
+ </a-form-item>
|
|
|
+ </row-item>
|
|
|
+ <row-item>
|
|
|
+ <a-form-item
|
|
|
+ label="备注"
|
|
|
+ :labelCol="BaseTool.Constant.labelCol"
|
|
|
+ :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
+ >
|
|
|
+ <a-input
|
|
|
+ v-decorator="['remark', {rules: [{required: true, message: '备注不能为空'}]}]" />
|
|
|
+ </a-form-item>
|
|
|
+ </row-item>
|
|
|
+ </row-list>
|
|
|
+ <row-list :col="1">
|
|
|
+ <row-item>
|
|
|
+ <a-form-item
|
|
|
+ label="问题描述"
|
|
|
+ :labelCol="BaseTool.Constant.labelCol2"
|
|
|
+ :wrapperCol="BaseTool.Constant.wrapperCol2"
|
|
|
+ >
|
|
|
+ <a-textarea
|
|
|
+ :rows="4"
|
|
|
+ v-decorator="['content', {rules: [{required: true, message: '委托内容描述不能为空'}]}]"/>
|
|
|
+ </a-form-item>
|
|
|
+ </row-item>
|
|
|
+<!-- <row-item>
|
|
|
|
|
|
- <a-form-item
|
|
|
- label="申请部门"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <a-input
|
|
|
- v-decorator="['departId', {rules: [{required: true, message: '申请部门不能为空'}]}]"/>
|
|
|
- </a-form-item>
|
|
|
- </row-item>
|
|
|
- <row-item>
|
|
|
+ <a-form-item
|
|
|
+ label="报修状态"
|
|
|
+ :labelCol="BaseTool.Constant.labelCol"
|
|
|
+ :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
+ >
|
|
|
+ </a-form-item>
|
|
|
+ </row-item>-->
|
|
|
+<!-- <row-item>
|
|
|
|
|
|
- <a-form-item
|
|
|
- label="报修时间"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <a-date-picker
|
|
|
- showTime
|
|
|
- style="width: 100%"
|
|
|
- :format="BaseTool.Date.PICKER_NORM_DATE_PATTERN"
|
|
|
- v-decorator="['applyTime', {rules: [{required: true, message: '报修时间不能为空'}]}]"/>
|
|
|
- </a-form-item>
|
|
|
- </row-item>
|
|
|
- <row-item>
|
|
|
+ <a-form-item
|
|
|
+ label="维修开始时间"
|
|
|
+ :labelCol="BaseTool.Constant.labelCol"
|
|
|
+ :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
+ >
|
|
|
+ <a-date-picker
|
|
|
+ showTime
|
|
|
+ style="width: 100%"
|
|
|
+ :format="BaseTool.Date.PICKER_NORM_DATE_PATTERN"
|
|
|
+ v-decorator="['repairStartTime', {rules: [{required: true, message: '维修开始时间不能为空'}]}]" />
|
|
|
+ </a-form-item>
|
|
|
+ </row-item>
|
|
|
+ <row-item>
|
|
|
|
|
|
- <a-form-item
|
|
|
- label="问题描述"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <a-input
|
|
|
- v-decorator="['content', {rules: [{required: true, message: '问题描述不能为空'}]}]"/>
|
|
|
- </a-form-item>
|
|
|
- </row-item>
|
|
|
- <row-item>
|
|
|
+ <a-form-item
|
|
|
+ label="维修结束时间"
|
|
|
+ :labelCol="BaseTool.Constant.labelCol"
|
|
|
+ :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
+ >
|
|
|
+ <a-date-picker
|
|
|
+ showTime
|
|
|
+ style="width: 100%"
|
|
|
+ :format="BaseTool.Date.PICKER_NORM_DATE_PATTERN"
|
|
|
+ v-decorator="['repairEndTime', {rules: [{required: true, message: '维修结束时间不能为空'}]}]" />
|
|
|
+ </a-form-item>
|
|
|
+ </row-item>
|
|
|
+ <row-item>
|
|
|
|
|
|
- <a-form-item
|
|
|
- label="报修状态"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- </a-form-item>
|
|
|
- </row-item>
|
|
|
- <row-item>
|
|
|
+ <a-form-item
|
|
|
+ label="维修耗时"
|
|
|
+ :labelCol="BaseTool.Constant.labelCol"
|
|
|
+ :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
+ >
|
|
|
+ <a-input-number
|
|
|
+ style="width: 100%"
|
|
|
+ :min="0"
|
|
|
+ :formatter="BaseTool.Amount.formatter"
|
|
|
+ :parser="BaseTool.Amount.parser"
|
|
|
+ v-decorator="['repairMinutes', {rules: [{required: true, message: '维修耗时不能为空'}]}]" />
|
|
|
+ </a-form-item>
|
|
|
+ </row-item>-->
|
|
|
+<!-- <row-item>
|
|
|
|
|
|
- <a-form-item
|
|
|
- label="备注"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <a-input
|
|
|
- v-decorator="['remark', {rules: [{required: true, message: '备注不能为空'}]}]"/>
|
|
|
- </a-form-item>
|
|
|
- </row-item>
|
|
|
- <row-item>
|
|
|
+ <a-form-item
|
|
|
+ label="维修人员id"
|
|
|
+ :labelCol="BaseTool.Constant.labelCol"
|
|
|
+ :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
+ >
|
|
|
+ <a-input
|
|
|
+ v-decorator="['repairUserId', {rules: [{required: true, message: '维修人员id不能为空'}]}]" />
|
|
|
+ </a-form-item>
|
|
|
+ </row-item>-->
|
|
|
+<!-- <row-item>
|
|
|
|
|
|
- <a-form-item
|
|
|
- label="维修开始时间"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <a-date-picker
|
|
|
- showTime
|
|
|
- style="width: 100%"
|
|
|
- :format="BaseTool.Date.PICKER_NORM_DATE_PATTERN"
|
|
|
- v-decorator="['repairStartTime', {rules: [{required: true, message: '维修开始时间不能为空'}]}]"/>
|
|
|
- </a-form-item>
|
|
|
- </row-item>
|
|
|
- <row-item>
|
|
|
+ <a-form-item
|
|
|
+ label="维修描述"
|
|
|
+ :labelCol="BaseTool.Constant.labelCol"
|
|
|
+ :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
+ >
|
|
|
+ <a-input
|
|
|
+ v-decorator="['repairContent', {rules: [{required: true, message: '维修描述不能为空'}]}]" />
|
|
|
+ </a-form-item>
|
|
|
+ </row-item>-->
|
|
|
+<!-- <row-item>
|
|
|
|
|
|
- <a-form-item
|
|
|
- label="维修结束时间"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <a-date-picker
|
|
|
- showTime
|
|
|
- style="width: 100%"
|
|
|
- :format="BaseTool.Date.PICKER_NORM_DATE_PATTERN"
|
|
|
- v-decorator="['repairEndTime', {rules: [{required: true, message: '维修结束时间不能为空'}]}]"/>
|
|
|
- </a-form-item>
|
|
|
- </row-item>
|
|
|
- <row-item>
|
|
|
+ <a-form-item
|
|
|
+ label="费用预算"
|
|
|
+ :labelCol="BaseTool.Constant.labelCol"
|
|
|
+ :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
+ >
|
|
|
+ <a-input-number
|
|
|
+ style="width: 100%"
|
|
|
+ :min="0"
|
|
|
+ :formatter="BaseTool.Amount.formatter"
|
|
|
+ :parser="BaseTool.Amount.parser"
|
|
|
+ v-decorator="['fee', {rules: [{required: true, message: '费用预算不能为空'}]}]" />
|
|
|
+ </a-form-item>
|
|
|
+ </row-item>-->
|
|
|
+<!-- <row-item>
|
|
|
|
|
|
- <a-form-item
|
|
|
- label="维修耗时"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <a-input-number
|
|
|
- style="width: 100%"
|
|
|
- :min="0"
|
|
|
- :formatter="BaseTool.Amount.formatter"
|
|
|
- :parser="BaseTool.Amount.parser"
|
|
|
- v-decorator="['repairMinutes', {rules: [{required: true, message: '维修耗时不能为空'}]}]"/>
|
|
|
- </a-form-item>
|
|
|
- </row-item>
|
|
|
- <row-item>
|
|
|
-
|
|
|
- <a-form-item
|
|
|
- label="维修人员id"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <a-input
|
|
|
- v-decorator="['repairUserId', {rules: [{required: true, message: '维修人员id不能为空'}]}]"/>
|
|
|
- </a-form-item>
|
|
|
- </row-item>
|
|
|
- <row-item>
|
|
|
-
|
|
|
- <a-form-item
|
|
|
- label="维修描述"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <a-input
|
|
|
- v-decorator="['repairContent', {rules: [{required: true, message: '维修描述不能为空'}]}]"/>
|
|
|
- </a-form-item>
|
|
|
- </row-item>
|
|
|
- <row-item>
|
|
|
-
|
|
|
- <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="['limitHours', {rules: [{required: true, message: '要求完成日期不能为空'}]}]"/>
|
|
|
-
|
|
|
- </a-form-item>
|
|
|
- </row-item>
|
|
|
- <row-item>
|
|
|
-
|
|
|
- <a-form-item
|
|
|
- label="费用预算"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <a-input-number
|
|
|
- style="width: 100%"
|
|
|
- :min="0"
|
|
|
- :formatter="BaseTool.Amount.formatter"
|
|
|
- :parser="BaseTool.Amount.parser"
|
|
|
- v-decorator="['fee', {rules: [{required: true, message: '费用预算不能为空'}]}]"/>
|
|
|
- </a-form-item>
|
|
|
- </row-item>
|
|
|
- <row-item>
|
|
|
-
|
|
|
- <a-form-item
|
|
|
- label="预算明细表"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <a-input
|
|
|
- v-decorator="['feeFile', {rules: [{required: true, message: '预算明细表不能为空'}]}]"/>
|
|
|
- </a-form-item>
|
|
|
- </row-item>
|
|
|
- </row-list>
|
|
|
- </a-form>
|
|
|
- </a-card>
|
|
|
+ <a-form-item
|
|
|
+ label="预算明细表"
|
|
|
+ :labelCol="BaseTool.Constant.labelCol"
|
|
|
+ :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
+ >
|
|
|
+ <a-input
|
|
|
+ v-decorator="['feeFile', {rules: [{required: true, message: '预算明细表不能为空'}]}]" />
|
|
|
+ </a-form-item>
|
|
|
+ </row-item>-->
|
|
|
+ </row-list>
|
|
|
+ </a-form>
|
|
|
+ <template slot="footer">
|
|
|
+ <a-button :loading="confirmLoading" type="primary" @click="save()">保存</a-button>
|
|
|
+ </template>
|
|
|
+ </a-modal>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import pick from 'lodash.pick'
|
|
|
- import {addPreparation, updatePreparation } from '@/api/preparation/preparation'
|
|
|
- export default {
|
|
|
- name: 'BasePreparation',
|
|
|
- data() {
|
|
|
- return {
|
|
|
- confirmLoading: false,
|
|
|
- modalTitle: null,
|
|
|
- form: this.$form.createForm(this),
|
|
|
- visible: false,
|
|
|
- // 下拉框map
|
|
|
- }
|
|
|
- },
|
|
|
- props: {},
|
|
|
- created() {
|
|
|
- // 下拉框map
|
|
|
- },
|
|
|
- methods: {
|
|
|
- base(record) {
|
|
|
- this.visible = true
|
|
|
- // 如果是空标识添加
|
|
|
- if (this.BaseTool.Object.isBlank(record)) {
|
|
|
- this.modalTitle = '添加'
|
|
|
- return
|
|
|
- }
|
|
|
- this.modalTitle = '编辑'
|
|
|
- const {form: {setFieldsValue}} = this
|
|
|
- // 日期处理
|
|
|
- record.applyTime = this.BaseTool.Moment(record.applyTime, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
|
|
|
- record.repairStartTime = this.BaseTool.Moment(record.repairStartTime, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
|
|
|
- record.repairEndTime = this.BaseTool.Moment(record.repairEndTime, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
|
|
|
- record.limitHours = this.BaseTool.Moment(record.limitHours, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
|
|
|
- this.$nextTick(() => {
|
|
|
- setFieldsValue(Object.assign(pick(record, [
|
|
|
- 'id',
|
|
|
- 'positionId',
|
|
|
- 'userId',
|
|
|
- 'departId',
|
|
|
- 'applyTime',
|
|
|
- 'content',
|
|
|
- 'status',
|
|
|
- 'remark',
|
|
|
- 'repairStartTime',
|
|
|
- 'repairEndTime',
|
|
|
- 'repairMinutes',
|
|
|
- 'repairUserId',
|
|
|
- 'repairContent',
|
|
|
- 'limitHours',
|
|
|
- 'fee',
|
|
|
- 'feeFile',
|
|
|
- ])))
|
|
|
- })
|
|
|
- },
|
|
|
- save() {
|
|
|
- const {form: {validateFieldsAndScroll}} = this
|
|
|
- this.confirmLoading = true
|
|
|
- validateFieldsAndScroll((errors, values) => {
|
|
|
- if (errors) {
|
|
|
- this.confirmLoading = false
|
|
|
- return
|
|
|
- }
|
|
|
- // 日期处理
|
|
|
- values.applyTime = this.BaseTool.Date.formatter(values.applyTime, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
|
|
|
- values.repairStartTime = this.BaseTool.Date.formatter(values.repairStartTime, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
|
|
|
- values.repairEndTime = this.BaseTool.Date.formatter(values.repairEndTime, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
|
|
|
- values.limitHours = this.BaseTool.Date.formatter(values.limitHours, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
|
|
|
- if (this.BaseTool.String.isBlank(values.id)) {
|
|
|
- addPreparation(values)
|
|
|
- .then(() => {
|
|
|
- this.handleCancel(values)
|
|
|
- }).catch(() => {
|
|
|
- this.confirmLoading = false
|
|
|
- })
|
|
|
- } else {
|
|
|
- updatePreparation(values)
|
|
|
- .then(() => {
|
|
|
- this.handleCancel(values)
|
|
|
- }).catch(() => {
|
|
|
- this.confirmLoading = false
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- handleCancel(values) {
|
|
|
- this.visible = false
|
|
|
- this.confirmLoading = false
|
|
|
- this.form.resetFields()
|
|
|
- if (this.BaseTool.Object.isNotBlank(values)) {
|
|
|
- this.$emit('ok', values)
|
|
|
- } else {
|
|
|
- this.$emit('ok')
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+import pick from 'lodash.pick'
|
|
|
+import { addPreparation, updatePreparation } from '@/api/preparation/preparation'
|
|
|
+import { getSbPositions } from '@/api/repair/application-form'
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: 'BasePreparation',
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ confirmLoading: false,
|
|
|
+ modalTitle: null,
|
|
|
+ form: this.$form.createForm(this),
|
|
|
+ visible: false,
|
|
|
+ sbPositionList: []
|
|
|
+ // 下拉框map
|
|
|
+ }
|
|
|
+ },
|
|
|
+ props: {},
|
|
|
+ created () {
|
|
|
+ // 下拉框map
|
|
|
+ this.getSbPositions()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ base (record) {
|
|
|
+ this.visible = true
|
|
|
+ // 如果是空标识添加
|
|
|
+ if (this.BaseTool.Object.isBlank(record)) {
|
|
|
+ this.modalTitle = '添加'
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.modalTitle = '编辑'
|
|
|
+ const { form: { setFieldsValue } } = this
|
|
|
+ // 日期处理
|
|
|
+ record.applyTime = this.BaseTool.Moment(record.applyTime, this.BaseTool.Date.PICKER_NORM_DATETIME_PATTERN)
|
|
|
+ record.repairStartTime = this.BaseTool.Moment(record.repairStartTime, this.BaseTool.Date.PICKER_NORM_DATETIME_PATTERN)
|
|
|
+ record.repairEndTime = this.BaseTool.Moment(record.repairEndTime, this.BaseTool.Date.PICKER_NORM_DATETIME_PATTERN)
|
|
|
+ record.limitHours = this.BaseTool.Moment(record.limitHours, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
|
|
|
+ this.$nextTick(() => {
|
|
|
+ setFieldsValue(Object.assign(pick(record, [
|
|
|
+ 'id',
|
|
|
+ 'positionId',
|
|
|
+ 'userId',
|
|
|
+ 'departId',
|
|
|
+ 'applyTime',
|
|
|
+ 'content',
|
|
|
+ 'status',
|
|
|
+ 'remark',
|
|
|
+ 'repairStartTime',
|
|
|
+ 'repairEndTime',
|
|
|
+ 'repairMinutes',
|
|
|
+ 'repairUserId',
|
|
|
+ 'repairContent',
|
|
|
+ 'limitHours',
|
|
|
+ 'fee',
|
|
|
+ 'feeFile'
|
|
|
+ ])))
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getSbPositions (parentId) {
|
|
|
+ getSbPositions({ parentId }).then(res => {
|
|
|
+ console.log(res)
|
|
|
+ this.sbPositionList = res.data.map(item => {
|
|
|
+ item = {
|
|
|
+ label: item.name,
|
|
|
+ value: item.name,
|
|
|
+ id: item.id,
|
|
|
+ isLeaf: false
|
|
|
+ }
|
|
|
+ return item
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ loadData (selectedOptions) {
|
|
|
+ console.log(selectedOptions)
|
|
|
+ const targetOption = selectedOptions[selectedOptions.length - 1]
|
|
|
+ targetOption.loading = true
|
|
|
+ getSbPositions({ parentId: targetOption.id }).then(res => {
|
|
|
+ targetOption.loading = false
|
|
|
+ targetOption.children = res.data.map(item => {
|
|
|
+ item = {
|
|
|
+ label: item.name,
|
|
|
+ value: item.id
|
|
|
+ }
|
|
|
+ return item
|
|
|
+ })
|
|
|
+ this.sbPositionList = [...this.sbPositionList]
|
|
|
+ })
|
|
|
+ },
|
|
|
+ save () {
|
|
|
+ const { form: { validateFieldsAndScroll } } = this
|
|
|
+ this.confirmLoading = true
|
|
|
+ validateFieldsAndScroll((errors, values) => {
|
|
|
+ if (errors) {
|
|
|
+ this.confirmLoading = false
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 日期处理
|
|
|
+ values.applyTime = this.BaseTool.Date.formatter(values.applyTime, this.BaseTool.Date.PICKER_NORM_DATETIME_PATTERN)
|
|
|
+ values.limitHours = this.BaseTool.Date.formatter(values.limitHours, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
|
|
|
+ values.positionId = values.positionId[1]
|
|
|
+ if (this.BaseTool.String.isBlank(values.id)) {
|
|
|
+ addPreparation(values)
|
|
|
+ .then(() => {
|
|
|
+ this.handleCancel(values)
|
|
|
+ }).catch(() => {
|
|
|
+ this.confirmLoading = false
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ updatePreparation(values)
|
|
|
+ .then(() => {
|
|
|
+ this.handleCancel(values)
|
|
|
+ }).catch(() => {
|
|
|
+ this.confirmLoading = false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleCancel (values) {
|
|
|
+ this.visible = false
|
|
|
+ this.confirmLoading = false
|
|
|
+ this.form.resetFields()
|
|
|
+ if (this.BaseTool.Object.isNotBlank(values)) {
|
|
|
+ this.$emit('ok', values)
|
|
|
+ } else {
|
|
|
+ this.$emit('ok')
|
|
|
+ }
|
|
|
}
|
|
|
+ }
|
|
|
+}
|
|
|
</script>
|