123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375 |
- <template>
- <van-nav-bar :title="title" safe-area-inset-top>
- <template #left>
- <van-icon
- :name="require('@/assets/arrow-left.svg')"
- size="24"
- @click="backPath"
- />
- </template>
- </van-nav-bar>
- <div class="page_info">
- <div class="info_list">
- <van-cell-group class="cell_title_icon">
- <van-cell
- title="报修信息"
- :icon="require('@/assets/line.svg')"
- v-if="
- role == 'admin' && (dataForm.status == 2 || dataForm.status == 3)
- "
- />
- <van-cell title="报修时间" :value="dataForm.createDate" />
- <van-cell title="报修位置" :value="dataForm.repairPosition" />
- <van-cell
- title="报修区域"
- :value="`${repairRegion_filter(dataForm.repairRegion)}`"
- />
- <van-cell
- title="报修类型"
- :value="`${repairType_filter(dataForm.repairType)}`"
- />
- <van-cell title="联系人" :value="dataForm.contactPerson" />
- <van-cell title="联系电话" :value="dataForm.contactPhone" />
- <van-cell title="故障描述" :value="dataForm.faultDes" />
- <van-cell title="故障照片" :border="false" class="upload_cell">
- <template #value>
- <van-image
- width="80"
- height="80"
- :src="item"
- v-for="(item, index) in imagesList"
- :key="item + '_' + index"
- />
- </template>
- </van-cell>
- </van-cell-group>
- <van-cell-group
- class="cell_title_icon"
- v-if="role == 'admin' && (dataForm.status == 2 || dataForm.status == 3)"
- >
- <van-cell title="维修信息" :icon="require('@/assets/line.svg')" />
- <van-cell
- title="紧急程度"
- :value="`${urgency_filter(dataForm.urgency)}`"
- />
- <van-cell title="维修人员" :value="dataForm.repairPersonName" />
- <van-cell title="联系电话" :value="dataForm.repairPersonId" />
- <van-cell
- title="维修完成时间"
- :value="dataForm.repairFinishTime"
- v-if="dataForm.status == 3"
- />
- </van-cell-group>
- </div>
- </div>
- <div class="save_btn">
- <template v-if="role == 3">
- <van-button
- block
- type="primary"
- loading-type="spinner"
- :loading="loading"
- loading-text="维修完成"
- @click="handleClick('finish')"
- >
- 维修完成
- </van-button>
- </template>
- <template v-if="role == 'admin' && dataForm.status == 1">
- <van-button
- block
- type="primary"
- loading-type="spinner"
- @click="handleClick('dispatch')"
- >
- 指派维修人员
- </van-button>
- </template>
- </div>
- <van-popup
- v-model:show="showPopup"
- position="bottom"
- :style="{ height: '30%' }"
- class="popup_info"
- >
- <van-row class="popup_title">
- <van-col :span="24">{{ popupTitle }}</van-col>
- </van-row>
- <van-divider style="margin: 0" />
- <van-form
- ref="dataForm"
- input-align="right"
- error-message-align="right"
- @submit="onSubmit"
- >
- <van-cell-group :border="false">
- <van-field
- v-model="dataForm.repairPersonName"
- label="维修人员"
- required
- is-link
- placeholder="请选择维修人员"
- clearable
- :rules="[{ required: true, message: '请选择维修人员' }]"
- @click="showRepairPersonPicker = true"
- />
- <van-popup
- v-model:show="showRepairPersonPicker"
- round
- position="bottom"
- >
- <van-picker
- :columns="repairPersonList"
- @cancel="showRepairPersonPicker = false"
- @confirm="
- (value) => {
- dataForm.repairPersonId = value.value;
- dataForm.repairPersonName = value.text;
- showRepairPersonPicker = false;
- }
- "
- />
- </van-popup>
- <van-field
- v-model="dataForm.urgencyName"
- label="紧急程度"
- required
- is-link
- placeholder="请选择紧急程度"
- clearable
- :rules="[{ required: true, message: '请选择紧急程度' }]"
- @click="showUrgencyPicker = true"
- />
- <van-popup v-model:show="showUrgencyPicker" round position="bottom">
- <van-picker
- :columns="repairUrgencyList"
- @cancel="showUrgencyPicker = false"
- @confirm="
- (value) => {
- dataForm.urgency = value.value;
- dataForm.urgencyName = value.text;
- showUrgencyPicker = false;
- }
- "
- />
- </van-popup>
- </van-cell-group>
- <div class="save_btn">
- <van-button
- block
- type="primary"
- :loading="loading"
- loading-type="spinner"
- loading-text="提交"
- native-type="submit"
- >
- 提交
- </van-button>
- </div>
- </van-form>
- </van-popup>
- </template>
- <script>
- import Api from "../utils/api";
- import { isEmpty } from "@/utils/index.js";
- import VCountUp from "./CountUp";
- export default {
- components: {
- "v-count-up": VCountUp,
- },
- data() {
- return {
- role: "",
- loading: false,
- title: "",
- showImgPreview: false,
- imagesList: [],
- showPopup: false,
- popupTitle: "工单指派",
- showRepairPersonPicker: false,
- showUrgencyPicker: false,
- repairPersonList: [],
- repairUrgencyList: [
- { text: "非常紧急", value: 1 },
- { text: "紧急", value: 2 },
- { text: "普通", value: 3 },
- ],
- dataForm: {
- id: "",
- repairPersonId: "",
- repairPersonName: "",
- urgency: "",
- urgencyName: "",
- repairTime: "",
- repairFinishTime: "",
- repairPositionName: "",
- repairRegion: "",
- status: "",
- repairType: "",
- contactPerson: "",
- contactPhone: "",
- faultDes: "",
- faultPics: "",
- },
- };
- },
- created() {
- this.role = localStorage.getItem("role");
- this.getDataDetail();
- this.getUserList();
- },
- methods: {
- repairType_filter(val) {
- if (isEmpty(val)) {
- return "";
- }
- if (val == 1) {
- return "水";
- }
- if (val == 2) {
- return "电";
- }
- if (val == 3) {
- return "其他";
- }
- },
- repairRegion_filter(val) {
- if (isEmpty(val)) {
- return "";
- }
- if (val == 1) {
- return "公共区域";
- }
- if (val == 2) {
- return "室内";
- }
- },
- urgency_filter(val) {
- if (isEmpty(val)) {
- return "";
- }
- if (val == 1) {
- return "非常紧急";
- }
- if (val == 2) {
- return "紧急";
- }
- if (val == 3) {
- return "普通";
- }
- },
- //获取维修人员
- getUserList() {
- Api.repairInfoUser({
- page: 1,
- limit: 100,
- }).then((res) => {
- if (res.code == 0) {
- this.repairPersonList = res.data.list;
- }
- });
- },
- getDataDetail() {
- Api.repairInfoDetail(this.$route.query.id).then((res) => {
- if (res.code == 0) {
- this.dataForm = res.data;
- this.imagesList = this.dataForm.faultPics.split(",");
- if (this.dataForm.status == 2 || this.dataForm.status == 3) {
- this.title = "报修详情";
- } else {
- this.title = "工单详情";
- }
- } else {
- }
- });
- },
- handleClick(type) {
- if (type == "finish") {
- this.$dialog
- .confirm({
- message: "请确认是否维修完成",
- })
- .then(() => {
- this.loading = true;
- setTimeout(() => {
- this.loading = false;
- }, 2000);
- // on confirm
- })
- .catch(() => {
- // on cancel
- });
- }
- if (type == "dispatch") {
- this.showPopup = !this.showPopup;
- this.$nextTick(() => {
- this.$refs.dataForm.resetValidation();
- });
- }
- },
- onSubmit() {
- this.$toast.loading({
- message: "保存中...",
- forbidClick: true,
- });
- Api.repairInfoDispatch({
- id: this.dataForm.id,
- repairPersonId: this.dataForm.repairPersonId,
- urgency: this.dataForm.urgency,
- }).then((res) => {
- if (res.code == 0) {
- this.$toast.success("保存成功");
- this.showPopup = false;
- this.getDataDetail();
- } else {
- this.$toast.fail("保存失败");
- }
- });
- },
- backPath() {
- this.$router.back();
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .page_info {
- .info_list {
- /deep/ {
- .upload_cell {
- .van-cell__title {
- flex: unset;
- }
- .van-image {
- margin-left: 8px;
- margin-bottom: 8px;
- }
- }
- .cell_title_icon {
- .van-icon {
- display: flex;
- align-items: center;
- }
- }
- }
- }
- }
- </style>
- <style lang="scss">
- .popup_info {
- box-shadow: 0px -10px 20px 0px rgba(27, 32, 38, 0.1);
- border-radius: 20px 20px 0px 0px;
- /deep/ {
- .popup_title {
- padding: 14px 0;
- font-weight: 600;
- font-size: 16px;
- color: #333333;
- text-shadow: 0px -10px 20px rgba(27, 32, 38, 0.1);
- }
- }
- .van-field__label {
- color: #666666;
- }
- }
- </style>
|