|
@@ -76,7 +76,11 @@
|
|
|
<view class="module-name">
|
|
<view class="module-name">
|
|
|
{{ $t("equipmentMaintenance.repairCode") }}: {{ item.failureCode }}
|
|
{{ $t("equipmentMaintenance.repairCode") }}: {{ item.failureCode }}
|
|
|
</view>
|
|
</view>
|
|
|
- <view class="module-status" :class="{ pending: item.status == 'tx' }" v-if="statusDict[item.status]">
|
|
|
|
|
|
|
+ <view
|
|
|
|
|
+ class="module-status"
|
|
|
|
|
+ :class="{ pending: item.status == 'tx' }"
|
|
|
|
|
+ v-if="statusDict[item.status]"
|
|
|
|
|
+ >
|
|
|
<!-- 状态 -->
|
|
<!-- 状态 -->
|
|
|
<span>{{ statusDict[item.status] }}</span>
|
|
<span>{{ statusDict[item.status] }}</span>
|
|
|
</view>
|
|
</view>
|
|
@@ -148,7 +152,10 @@
|
|
|
<span>{{ item.maintainType }}</span>
|
|
<span>{{ item.maintainType }}</span>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
- <view class="item-btn flex-row align-center justify-end">
|
|
|
|
|
|
|
+ <view
|
|
|
|
|
+ class="item-btn flex-row align-center justify-end"
|
|
|
|
|
+ v-if="companyInfo.data !== 'rh'"
|
|
|
|
|
+ >
|
|
|
<button
|
|
<button
|
|
|
type="primary"
|
|
type="primary"
|
|
|
:plain="false"
|
|
:plain="false"
|
|
@@ -161,14 +168,87 @@
|
|
|
{{ $t("operation.fill") }}
|
|
{{ $t("operation.fill") }}
|
|
|
</button>
|
|
</button>
|
|
|
</view>
|
|
</view>
|
|
|
|
|
+
|
|
|
|
|
+ <view class="item-btn flex-row align-center justify-end" v-else>
|
|
|
|
|
+ <button type="primary" :plain="false" @click="onView(item)">
|
|
|
|
|
+ {{ $t("workOrder.viewDetails") }}
|
|
|
|
|
+ </button>
|
|
|
|
|
+
|
|
|
|
|
+ <button
|
|
|
|
|
+ type="primary"
|
|
|
|
|
+ :plain="false"
|
|
|
|
|
+ v-if="
|
|
|
|
|
+ item.status === 'personnel' && userInfo.id === item.maintainPerson
|
|
|
|
|
+ "
|
|
|
|
|
+ @click="changeMethod(item)"
|
|
|
|
|
+ >
|
|
|
|
|
+ 维修方式
|
|
|
|
|
+ </button>
|
|
|
|
|
+
|
|
|
|
|
+ <button
|
|
|
|
|
+ type="primary"
|
|
|
|
|
+ @click="onEdit(item)"
|
|
|
|
|
+ v-if="
|
|
|
|
|
+ item.status === 'tx' &&
|
|
|
|
|
+ (item.auditStatus === 20 || item.auditStatus === null)
|
|
|
|
|
+ "
|
|
|
|
|
+ >
|
|
|
|
|
+ {{ $t("operation.fill") }}
|
|
|
|
|
+ </button>
|
|
|
|
|
+ </view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
</z-paging>
|
|
</z-paging>
|
|
|
|
|
+
|
|
|
|
|
+ <uni-popup type="dialog" ref="chooseMethodRef" @close="cancelRepairMethod">
|
|
|
|
|
+ <view class="popup-content">
|
|
|
|
|
+ <view class="popup-title">维修方式</view>
|
|
|
|
|
+ <view class="form-item">
|
|
|
|
|
+ <text class="label">*</text>
|
|
|
|
|
+ <text class="label-text">维修方式</text>
|
|
|
|
|
+ <picker
|
|
|
|
|
+ @change="onPickerChange"
|
|
|
|
|
+ :value="selectedValue"
|
|
|
|
|
+ :range="methodOptions"
|
|
|
|
|
+ >
|
|
|
|
|
+ <view class="picker-view">
|
|
|
|
|
+ {{ methodOptions[selectedValue] || "请选择维修方式" }}
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </picker>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- <uni-data-select
|
|
|
|
|
+ :clear="false"
|
|
|
|
|
+ v-model="selectedValue"
|
|
|
|
|
+ :localdata="methodOptions"
|
|
|
|
|
+ @change="onPickerChange"
|
|
|
|
|
+ >
|
|
|
|
|
+ </uni-data-select> -->
|
|
|
|
|
+ </view>
|
|
|
|
|
+
|
|
|
|
|
+ <view class="form-item">
|
|
|
|
|
+ <text class="label">*</text>
|
|
|
|
|
+ <text class="label-text">备注说明</text>
|
|
|
|
|
+ <textarea
|
|
|
|
|
+ v-model="repairMethodForm.remark"
|
|
|
|
|
+ placeholder="请输入备注说明"
|
|
|
|
|
+ class="textarea"
|
|
|
|
|
+ maxlength="200"
|
|
|
|
|
+ ></textarea>
|
|
|
|
|
+ </view>
|
|
|
|
|
+
|
|
|
|
|
+ <view class="popup-footer">
|
|
|
|
|
+ <view class="btn-cancel" @click="cancelRepairMethod">取消</view>
|
|
|
|
|
+ <view class="btn-confirm" @click="submitRepairMethod">确定</view>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </uni-popup>
|
|
|
</template>
|
|
</template>
|
|
|
<script setup>
|
|
<script setup>
|
|
|
import { ref, reactive, onMounted, nextTick } from "vue";
|
|
import { ref, reactive, onMounted, nextTick } from "vue";
|
|
|
import { onShow } from "@dcloudio/uni-app";
|
|
import { onShow } from "@dcloudio/uni-app";
|
|
|
-import { getRepairCount, getRepairList } from "@/api/repair";
|
|
|
|
|
|
|
+import { getRepairCount, getRepairList, maintainMethod } from "@/api/repair";
|
|
|
|
|
+import { getLoginUserInfo } from "@/api/login";
|
|
|
|
|
+import { getDeptName } from "@/api/recordFilling";
|
|
|
import dayjs from "dayjs";
|
|
import dayjs from "dayjs";
|
|
|
import { useDataDictStore } from "@/store/modules/dataDict";
|
|
import { useDataDictStore } from "@/store/modules/dataDict";
|
|
|
// 字典项
|
|
// 字典项
|
|
@@ -184,6 +264,14 @@ const auditStatusDict = reactive({});
|
|
|
getDataDictList("crm_audit_status").map((item) => {
|
|
getDataDictList("crm_audit_status").map((item) => {
|
|
|
auditStatusDict[item.value] = item.label;
|
|
auditStatusDict[item.value] = item.label;
|
|
|
});
|
|
});
|
|
|
|
|
+
|
|
|
|
|
+const methodOptions = ref([]); // 使用 ref 创建数组
|
|
|
|
|
+const methodOptionsMap = reactive({}); // 保存 value -> label 的映射
|
|
|
|
|
+
|
|
|
|
|
+getDataDictList("maintain_method").forEach((item) => {
|
|
|
|
|
+ methodOptions.value.push(item.label); // 只存储 label 用于显示
|
|
|
|
|
+ methodOptionsMap[item.value] = item.label;
|
|
|
|
|
+});
|
|
|
console.log("auditStatusDict", auditStatusDict);
|
|
console.log("auditStatusDict", auditStatusDict);
|
|
|
|
|
|
|
|
// --- 列表 ---start---
|
|
// --- 列表 ---start---
|
|
@@ -227,6 +315,81 @@ const getCount = () => {
|
|
|
statistics.average = 4.8;
|
|
statistics.average = 4.8;
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
|
|
|
+const currentRepairItem = ref(null); // 当前操作的工单项
|
|
|
|
|
+const repairMethodForm = ref({
|
|
|
|
|
+ // 表单数据
|
|
|
|
|
+ maintainMethod: "",
|
|
|
|
|
+ remark: "",
|
|
|
|
|
+});
|
|
|
|
|
+const chooseMethodRef = ref(null); // 控制弹窗显示
|
|
|
|
|
+
|
|
|
|
|
+const selectedValue = ref(null);
|
|
|
|
|
+const changeMethod = (item) => {
|
|
|
|
|
+ console.log("选择维修方式的工单项", item);
|
|
|
|
|
+ // 打开弹窗前先初始化表单数据
|
|
|
|
|
+ currentRepairItem.value = item;
|
|
|
|
|
+ repairMethodForm.value.maintainMethod = "";
|
|
|
|
|
+ repairMethodForm.value.remark = "";
|
|
|
|
|
+ chooseMethodRef.value.open();
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+const submitRepairMethod = () => {
|
|
|
|
|
+ if (!repairMethodForm.value.maintainMethod) {
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: "请选择维修方式",
|
|
|
|
|
+ icon: "none",
|
|
|
|
|
+ });
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!repairMethodForm.value.remark) {
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: "请输入备注说明",
|
|
|
|
|
+ icon: "none",
|
|
|
|
|
+ });
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 调用接口
|
|
|
|
|
+ maintainMethod({
|
|
|
|
|
+ id: currentRepairItem.value.id,
|
|
|
|
|
+ maintainMethod: repairMethodForm.value.maintainMethod,
|
|
|
|
|
+ remark: repairMethodForm.value.remark,
|
|
|
|
|
+ })
|
|
|
|
|
+ .then((res) => {
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: "提交成功",
|
|
|
|
|
+ icon: "success",
|
|
|
|
|
+ });
|
|
|
|
|
+ chooseMethodRef.value.close();
|
|
|
|
|
+ // 可选:刷新列表或更新当前项状态
|
|
|
|
|
+ onSearch(); // 刷新列表
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch((err) => {
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: "提交失败",
|
|
|
|
|
+ icon: "none",
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+const cancelRepairMethod = () => {
|
|
|
|
|
+ chooseMethodRef.value.close();
|
|
|
|
|
+ repairMethodForm.value.maintainMethod = "";
|
|
|
|
|
+ repairMethodForm.value.remark = "";
|
|
|
|
|
+ selectedValue.value = null;
|
|
|
|
|
+};
|
|
|
|
|
+const onPickerChange = (e) => {
|
|
|
|
|
+ const selectedIndex = e.detail.value;
|
|
|
|
|
+ selectedValue.value = selectedIndex;
|
|
|
|
|
+
|
|
|
|
|
+ // 通过索引找到对应的 value
|
|
|
|
|
+ const selectedLabel = methodOptions.value[selectedIndex];
|
|
|
|
|
+ const selectedKey = Object.keys(methodOptionsMap).find(
|
|
|
|
|
+ (key) => methodOptionsMap[key] === selectedLabel,
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ repairMethodForm.value.maintainMethod = selectedKey; // 设置表单值为 key
|
|
|
|
|
+};
|
|
|
onShow(() => {
|
|
onShow(() => {
|
|
|
getCount();
|
|
getCount();
|
|
|
nextTick(() => {
|
|
nextTick(() => {
|
|
@@ -252,7 +415,77 @@ const onView = (item) => {
|
|
|
const navigatorBack = () => {
|
|
const navigatorBack = () => {
|
|
|
uni.navigateBack();
|
|
uni.navigateBack();
|
|
|
};
|
|
};
|
|
|
|
|
+
|
|
|
|
|
+const userInfo = ref({});
|
|
|
|
|
+const companyInfo = ref({});
|
|
|
|
|
+
|
|
|
|
|
+onMounted(async () => {
|
|
|
|
|
+ userInfo.value = (await getLoginUserInfo()).data;
|
|
|
|
|
+ companyInfo.value = await getDeptName(userInfo.value.dept.id);
|
|
|
|
|
+
|
|
|
|
|
+ useDataDictStore().loadDataDictList();
|
|
|
|
|
+});
|
|
|
</script>
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
|
@import "@/style/work-order.scss";
|
|
@import "@/style/work-order.scss";
|
|
|
|
|
+
|
|
|
|
|
+.popup-content {
|
|
|
|
|
+ width: 500rpx;
|
|
|
|
|
+ padding: 30rpx;
|
|
|
|
|
+ background-color: #fff;
|
|
|
|
|
+ border-radius: 16rpx;
|
|
|
|
|
+
|
|
|
|
|
+ .popup-title {
|
|
|
|
|
+ font-size: 36rpx;
|
|
|
|
|
+ margin-bottom: 30rpx;
|
|
|
|
|
+ text-align: center;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .form-item {
|
|
|
|
|
+ margin-bottom: 40rpx;
|
|
|
|
|
+
|
|
|
|
|
+ .label {
|
|
|
|
|
+ color: red;
|
|
|
|
|
+ font-size: 28rpx;
|
|
|
|
|
+ margin-right: 10rpx;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .label-text {
|
|
|
|
|
+ font-size: 28rpx;
|
|
|
|
|
+ color: #333;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .picker-view {
|
|
|
|
|
+ margin-top: 10rpx;
|
|
|
|
|
+ padding: 20rpx;
|
|
|
|
|
+ border: 1px solid #ccc;
|
|
|
|
|
+ border-radius: 8rpx;
|
|
|
|
|
+ font-size: 28rpx;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .textarea {
|
|
|
|
|
+ width: 95.5%;
|
|
|
|
|
+ height: 150rpx;
|
|
|
|
|
+ padding: 10rpx;
|
|
|
|
|
+ border: 1px solid #ccc;
|
|
|
|
|
+ border-radius: 8rpx;
|
|
|
|
|
+ font-size: 28rpx;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .popup-footer {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ justify-content: flex-end;
|
|
|
|
|
+ gap: 30rpx;
|
|
|
|
|
+
|
|
|
|
|
+ .btn-cancel {
|
|
|
|
|
+ color: #333;
|
|
|
|
|
+ border: none;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .btn-confirm {
|
|
|
|
|
+ color: #007aff;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
</style>
|
|
</style>
|