From d9aab92fa25860c6682debe50e10770dc7db42a0 Mon Sep 17 00:00:00 2001
From: cuikaidong <ckd2942379034@163.com>
Date: 星期四, 14 八月 2025 12:44:33 +0800
Subject: [PATCH] 组合刀模块增加
---
src/views/dnc/base/modules/TerminalIndex/ReportEquipmentFault.vue | 179 +++++++++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 159 insertions(+), 20 deletions(-)
diff --git a/src/views/dnc/base/modules/TerminalIndex/ReportEquipmentFault.vue b/src/views/dnc/base/modules/TerminalIndex/ReportEquipmentFault.vue
index 8514266..06e797d 100644
--- a/src/views/dnc/base/modules/TerminalIndex/ReportEquipmentFault.vue
+++ b/src/views/dnc/base/modules/TerminalIndex/ReportEquipmentFault.vue
@@ -3,22 +3,70 @@
<slot name="function"/>
<div class="content-container">
- <a-form-model ref="form" :model="model" :rules="validateRules" :labelCol="{span:10}" :wrapperCol="{span:6}">
- <a-form-model-item label="璁惧鍚嶇О" prop="equipmentId">
- <a-select placeholder="璇烽�夋嫨璁惧" v-model="model.equipmentId"></a-select>
- </a-form-model-item>
- <a-form-model-item label="鏁呴殰鍘熷洜" prop="faultReasonId">
- <a-select placeholder="璇烽�夋嫨鏁呴殰鍘熷洜" v-model="model.faultReasonId"></a-select>
- </a-form-model-item>
- <a-form-model-item label="鏁呴殰鎻忚堪" prop="faultDescription">
- <a-textarea placeholder="璇疯緭鍏ユ晠闅滄弿杩�" v-model="model.faultDescription"/>
- </a-form-model-item>
+ <a-form-model ref="form" :model="model" :rules="validateRules" :labelCol="labelCol" :wrapperCol="wrapperCol">
+ <a-row>
+ <a-col :span="12">
+ <a-form-model-item prop="equipmentId" label="璁惧缂栧彿">
+ <lx-search-equipment-select placeholder="璇疯緭鍏ヨ澶囩紪鍙锋垨鍚嶇О鎼滅储" v-model="model.equipmentId"/>
+ </a-form-model-item>
+ </a-col>
+
+ <a-col :span="12">
+ <a-form-model-item prop="faultName" label="鏁呴殰绠�绉�">
+ <a-select placeholder="璇烽�夋嫨鏁呴殰绠�绉�" v-model="model.faultName" @change="handleFaultNameChange">
+ <a-select-option v-for="item in faultReasonList" :key="item.faultName">
+ {{ item.faultName }}
+ </a-select-option>
+ </a-select>
+ </a-form-model-item>
+ </a-col>
+ </a-row>
+
+ <a-row>
+ <a-col :span="12">
+ <a-form-model-item label="鏁呴殰鍒嗙被">
+ <a-input placeholder="璇疯緭鍏ユ晠闅滃垎绫�" v-model="model.faultType_dictText" readOnly/>
+ </a-form-model-item>
+ </a-col>
+ <a-col :span="12">
+ <a-form-model-item label="鏁呴殰鎻忚堪" prop="faultDescription">
+ <a-textarea placeholder="璇疯緭鍏ユ晠闅滄弿杩�" v-model="model.faultDescription"/>
+ </a-form-model-item>
+ </a-col>
+ </a-row>
+
+ <a-row>
+ <a-col :span="12">
+ <a-form-model-item prop="faultStartTime" label="鏁呴殰寮�濮嬫椂闂�">
+ <a-date-picker showTime placeholder="璇烽�夋嫨鏁呴殰寮�濮嬫椂闂�" v-model="model.faultStartTime"
+ :allow-clear="false" value-format="YYYY-MM-DD HH:mm:ss" :disabledDate="disabledDate"
+ :disabledTime="disabledTime"/>
+ </a-form-model-item>
+ </a-col>
+
+ <a-col :span="12">
+ <a-form-model-item prop="breakdownFlag" label="鏄惁鍋滄満">
+ <j-dict-select-tag v-model="model.breakdownFlag" dictCode="breakdown_flag" type="radio"/>
+ </a-form-model-item>
+ </a-col>
+ </a-row>
+
+ <a-row>
+ <a-col :span="12">
+ <a-form-model-item prop="imageFiles" label="鎶ヤ慨鍥剧墖">
+ <lx-upload :returnUrl="false" :isMultiple="true" file-type="image" :number="3"
+ v-model="model.imageFilesResult"/>
+ </a-form-model-item>
+ </a-col>
+ <a-col :span="12">
+ <a-form-model-item prop="remark" label="澶囨敞">
+ <a-textarea placeholder="璇疯緭鍏ュ娉�" v-model="model.remark"/>
+ </a-form-model-item>
+ </a-col>
+ </a-row>
<div style="text-align: center">
- <a-space>
- <a-button @click="handleReportFault">鏁呴殰涓婃姤</a-button>
- <a-button>鏁呴殰瑙i櫎</a-button>
- </a-space>
+ <a-button type="primary" @click="handleReportFault" icon="alert" :loading="loading">鏁呴殰涓婃姤</a-button>
</div>
</a-form-model>
</div>
@@ -26,23 +74,114 @@
</template>
<script>
+ import { getAction, postAction } from '@/api/manage'
+ import LxSearchEquipmentSelect from '@views/eam/equipment/modules/LxSearchEquipmentSelect.vue'
+ import moment from 'moment'
+
export default {
name: 'ReportEquipmentFault',
+ components: { LxSearchEquipmentSelect },
data() {
return {
- model: {},
+ model: {
+ breakdownFlag: '1'
+ },
+ labelCol: {
+ xs: { span: 24 },
+ sm: { span: 8 }
+ },
+ wrapperCol: {
+ xs: { span: 24 },
+ sm: { span: 12 }
+ },
validateRules: {
- equipmentId: [{ required: true, message: '璇烽�夋嫨璁惧锛�' }],
- faultReasonId: [{ required: true, message: '璇烽�夋嫨鏁呴殰鍘熷洜锛�' }],
- faultDescription: [{ required: true, message: '璇疯緭鍏ユ晠闅滄弿杩帮紒' }]
+ equipmentId: [{ required: true, message: '璇烽�夋嫨璁惧锛�', trigger: 'change' }],
+ faultReasonId: [{ required: true, message: '璇烽�夋嫨鏁呴殰鍘熷洜锛�', trigger: 'change' }],
+ faultDescription: [{ required: true, message: '璇疯緭鍏ユ晠闅滄弿杩帮紒', trigger: 'change' }]
+ },
+ faultReasonList: [],
+ loading: false,
+ url: {
+ confirm: '/eam/eamReportRepair/add',
+ faultReasonList: '/eam/equipmentFaultReason/list'
}
}
},
+ created() {
+ this.getFaultReasonListByApi()
+ },
methods: {
+ // 璋冪敤鎺ュ彛鑾峰彇鏁呴殰鍘熷洜鍒楄〃
+ getFaultReasonListByApi() {
+ const that = this
+ getAction(this.url.faultReasonList)
+ .then(res => {
+ that.faultReasonList = res.result.records
+ })
+ },
+
+ /**
+ * 鏁呴殰绠�绉版敼鍙樻椂瑙﹀彂
+ * @params value 鏀瑰彉鍚庣殑鍊�
+ */
+ handleFaultNameChange(value) {
+ const faultReasonItem = this.faultReasonList.find(item => item.faultName === value)
+ this.model.faultType = faultReasonItem.faultCategory
+ this.model.faultType_dictText = faultReasonItem.faultCategory_dictText
+ this.model.faultDescription = faultReasonItem.faultDescription
+ if (this.model.faultDescription) this.$refs.form.clearValidate('faultDescription')
+ },
+
+ /**
+ * 绂佺敤鏃ユ湡
+ * @params current 琚鐢ㄧ殑鏃堕棿
+ */
+ disabledDate(current) {
+ // Can not select days after today
+ return current > moment().endOf('day')
+ },
+
+ /**
+ * 绂佺敤鏃ユ湡涓殑鏃堕棿
+ * @returns {{disabledHours: (function(): Array), disabledMinutes: (function(): Array)}}
+ */
+ disabledTime() {
+ function range(start, end) {
+ const result = []
+ for (let i = start; i < end; i++) {
+ result.push(i)
+ }
+ return result
+ }
+
+ return {
+ disabledHours: () => range(moment().hour() + 1, 24),
+ disabledMinutes: () => range(moment().minute() + 1, 60),
+ disabledSeconds: () => range(moment().second() + 1, 60)
+ }
+ },
+
handleReportFault() {
+ const that = this
this.$refs.form.validate(valid => {
if (valid) {
-
+ that.loading = true
+ postAction(that.url.confirm, this.model).then((res) => {
+ if (res.success) {
+ that.$notification.success({
+ message: '娑堟伅',
+ description: res.message
+ })
+ }
+ else {
+ that.$notification.warning({
+ message: '娑堟伅',
+ description: res.message
+ })
+ }
+ }).finally(() => {
+ that.loading = false
+ })
} else {
return false
}
@@ -60,7 +199,7 @@
align-items: center;
/deep/ .ant-form {
- width: 100%;
+ width: 75%;
}
}
</style>
\ No newline at end of file
--
Gitblit v1.9.3