zenglf
2023-09-18 92ff846fb659c62037a32b1d8c15eae9df9d9b54
src/views/eam/modules/dailyMaintenanceOrder/FinishDevolutionModal.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,370 @@
<template>
  <a-modal
    :width="1250"
    :visible="visible"
    :maskClosable="false"
    @ok="handleOk"
    cancelText="关闭"
    @cancel="handleCancel"
    :confirmLoading="confirmLoading"
  >
    <!-- :title="title" -->
    <a-spin :spinning="confirmLoading">
      <a-form :form="form">
        <a-divider
          orientation="center"
          style="font-size: large;font-style: normal;font-size: 30px;color: #66aeed;"
        > ç”Ÿäº§è®¾å¤‡äºŒçº§ä¿å…»å®Œå·¥ç§»äº¤å• </a-divider>
        <a-row :gutter="24">
          <a-col :span="8">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="设备名称"
            >
              <span v-if="this.model != null">{{ this.model.equipmentName }}</span>
              <span v-else>-</span>
            </a-form-item>
          </a-col>
          <a-col :span="8">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="设备型号"
            >
              <span v-if="this.model != null">{{ this.model.equipmentModel }}</span>
              <span v-else>-</span>
            </a-form-item>
          </a-col>
          <a-col :span="8">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="统一编码"
            >
              <span v-if="this.model != null">{{ this.model.equipmentNum }}</span>
              <span v-else>-</span>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="8">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="使用单位"
            >
              <span v-if="this.model != null">{{ this.model.departName }}</span>
              <span v-else>-</span>
            </a-form-item>
          </a-col>
          <a-col :span="8">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="保养日期"
            >
              <span v-if="this.model != null">{{ this.model.actualEndTime }}</span>
              <span v-else>-</span>
            </a-form-item>
          </a-col>
        </a-row>
      </a-form>
    </a-spin>
    <a-table
      ref="table"
      bordered
      size="middle"
      rowKey='id'
      :columns="columns"
      :dataSource="dataSource"
    >
    </a-table>
    <div :style="{width: '100%',border: '1px solid #e9e9e9',padding: '10px 16px',background: '#fff',}">
      <div class="ant-descriptions-title">问题及相应处理措施描述:</div>
      <a-textarea
        allowClear
        :disabled="true"
        :placeholder="'请输入问题及处理措施描述'"
        v-model="model.description"
        rows="3"
      />
    </div>
    <div :style="{width: '100%',border: '1px solid #e9e9e9',padding: '10px 16px',background: '#fff',}">
      <div class="ant-descriptions-title">该设备经二级保养检查后,达到保养规范要求。</div>
      <a-row :gutter="24">
        <a-col :span="8">
          <a-form-item
            :labelCol="labelCol"
            :wrapperCol="wrapperCol"
            label="操作人员"
          >
            <span v-if="this.model != null">{{ this.model.operateUserName }}</span>
            <span v-else>-</span>
          </a-form-item>
        </a-col>
        <a-col :span="8">
          <a-form-item
            :labelCol="labelCol"
            :wrapperCol="wrapperCol"
            label="维修室主任"
          >
            <span v-if="this.model != null">{{ this.model.repairDirectorUserName }}</span>
            <span v-else>-</span>
          </a-form-item>
        </a-col>
      </a-row>
      <a-row :gutter="24">
        <a-col :span="8">
          <a-form-item
            :labelCol="labelCol"
            :wrapperCol="wrapperCol"
            label="维修人员"
          >
            <span v-if="this.model != null">{{ this.model.repairUserName }}</span>
            <span v-else>-</span>
          </a-form-item>
        </a-col>
        <a-col :span="8">
          <a-form-item
            :labelCol="labelCol"
            :wrapperCol="wrapperCol"
            label="设备检验员"
          >
            <span v-if="this.model != null">{{ this.model.equipmentInspectorUserName }}</span>
            <span v-else>-</span>
          </a-form-item>
        </a-col>
      </a-row>
    </div>
    <template slot="footer">
      <a-button
        :style="{marginRight: '8px'}"
        @click="handleCancel()"
      >
        å…³é—­
      </a-button>
      <a-button
        @click="handleOk()"
        type="primary"
        :loading="confirmLoading"
        :disabled="disableSubmit || confirmLoading"
      >确定</a-button>
    </template>
  </a-modal>
</template>
<script>
import { getAction, postAction, requestPut } from '@/api/manage'
import pick from 'lodash.pick'
import JMultiSelectTag from '@/components/dict/JMultiSelectTag'
import Tooltip from 'ant-design-vue/es/tooltip'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import { getFileAccessHttpUrl } from '@/api/manage';
export default {
  name: "MaintenanceOrderModal",
  mixins: [JeecgListMixin],
  components: {
    JMultiSelectTag,
    Tooltip,
  },
  data() {
    return {
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          align: 'center',
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          },
          width: 50,
        },
        {
          title: '类型',
          align: 'center',
          dataIndex: 'maintenanceMethod1'
        },
        {
          title: '部位',
          align: 'center',
          dataIndex: 'location'
        },
        {
          title: '保养项目',
          align: 'center',
          dataIndex: 'maintenanceProjectNum'
        },
        {
          title: '保养标准',
          align: 'center',
          dataIndex: 'standard'
        },
        {
          title: '执行情况',
          align: 'center',
          dataIndex: 'maintenanceTool1'
        },
        {
          title: '执行人',
          align: 'center',
          dataIndex: 'photo1',
        },
      ],
      title: "操作",
      visible: false,
      disableSubmit: false,
      codeDisable: true,
      dataSource: [],
      model: {},
      departs: [],
      labelCol: {
        xs: { span: 24 },
        sm: { span: 6 },
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 18 },
      },
      confirmLoading: false,
      form: this.$form.createForm(this),
      validatorRules: {
        num: {
          rules: [
            { required: true, message: '请输入保养工单编码!' },
          ]
        },
      },
      url: {
        add: "/eam/dailyMaintenanceOrder/add",
        edit: "/eam/dailyMaintenanceOrder/approve",
        getSysDeparts: "/eam/dailyMaintenanceOrder/getSysDeparts",
        list: "/eam/dailyMaintenanceOrder/getMaintenanceCycleByStandardId",
      },
    }
  },
  methods: {
    edit(record) {
      let that = this;
      this.getSysDeparts()
      this.form.resetFields();
      this.model = Object.assign({}, record);
      this.visible = true;
      if (record.dailyMaintenanceDetails != undefined) {
        const temp = [...record.dailyMaintenanceDetails];
        that.dataSource = temp;
      }
      that.$nextTick(() => {
        that.form.setFieldsValue(pick(that.model, 'num', 'teamId', 'remark'));
      });
      if (record.id) {
        this.codeDisable = true;
      } else {
        this.codeDisable = false;
      }
    },
    close() {
      this.$emit('close');
      this.visible = false;
    },
    handleCancel() {
      this.close();
    },
    handleOk() {
      const that = this;
      this.form.validateFields((err, values) => {
        if (!err) {
          that.confirmLoading = true;
          let formData = Object.assign(this.model, values);
          requestPut(this.url.edit, formData, { id: this.model.id }).then((res) => {
            if (res.success) {
              that.$message.success(res.message);
              that.$emit('ok');
            } else {
              that.$message.warning(res.message);
            }
          }).finally(() => {
            that.confirmLoading = false;
            that.close();
          })
        }
      })
    },
    handleDelete(text, record, index) {
      this.dataSource.splice(index, 1);
    },
    getSysDeparts() {
      getAction(this.url.getSysDeparts).then((res) => {
        if (res.success) {
          this.departs = res.result
        }
      })
    },
  },
}
</script>
<style lang="less" scoped>
/deep/ .frozenRowClass {
  color: #c9c9c9;
}
.fontweight {
  font-weight: bold;
}
.ant-btn {
  padding: 0 10px;
  margin-left: 3px;
}
.ant-form-item-control {
  line-height: 0px;
}
/** ä¸»è¡¨å•行间距 */
.ant-form .ant-form-item {
  margin-bottom: 10px;
}
/** Tab页面行间距 */
.ant-tabs-content .ant-form-item {
  margin-bottom: 0px;
}
.hightColor {
  height: 10%;
  font-weight: bold;
  font-size: 20px;
  color: #1b1e1e;
}
.frozenRowClass {
  color: #c9c9c9;
}
.fontweight {
  font-weight: bold;
}
.hight {
  color: #f5222d;
}
/deep/ .red {
  color: red;
}
</style>