index.vue 12.9 KB
Newer Older
1
<template>
2
  <div class="app-container basicsInfo">
3
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
4 5 6 7 8 9 10 11 12 13 14
      <!-- <el-form-item label="工单类型" prop="orderType">
        <el-select v-model="queryParams.orderType" placeholder="请选择工单类型" clearable size="small">
          <el-option
              v-for="dict in ordertypeOptions"
              :key="dict.dictValue"
              :label="dict.dictLabel"
              :value="dict.dictValue"
            ></el-option>
        </el-select>
      </el-form-item> -->
      <el-form-item label="工单编号" prop="orderId">
15 16
        <el-input
          v-model="queryParams.orderId"
17
          placeholder="请输入工单编号"
18 19 20 21 22
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
23 24 25 26 27 28 29 30 31
      <el-form-item label="工单状态" prop="orderStatus">
        <el-select v-model="queryParams.orderStatus" placeholder="请选择工单状态" clearable size="small">
          <el-option
            v-for="dict in typeOptions"
            :key="dict.dictValue"
            :label="dict.dictLabel"
            :value="dict.dictValue"
          ></el-option>
        </el-select>
32
      </el-form-item>
33 34 35 36 37 38 39 40
      <el-form-item label="创建时间" prop="startAllotTime">
        <el-date-picker
          clearable size="small"
          v-model="queryParams.startAllotTime"
          value-format="yyyy-MM-dd HH:mm:ss"
          type="datetime"
          placeholder="请选择开始时间"
          align="right">
41
        </el-date-picker>
42
        <font color="#C0C4CC"></font>
43
      </el-form-item>
44 45 46 47 48 49 50 51 52
      <el-form-item label="" prop="endAllotTime">
        <el-date-picker
          clearable size="small"
          v-model="queryParams.endAllotTime"
          value-format="yyyy-MM-dd HH:mm:ss"
          type="datetime"
          placeholder="请选择结束时间"
          align="right">
        </el-date-picker>
53 54 55 56 57 58 59
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
    <el-table v-loading="loading" :data="basicsInfoList" @selection-change="handleSelectionChange">
      <el-table-column label="工单编号" align="center" prop="orderId" />
      <el-table-column label="工单类型" align="center" prop="orderType" >
        <template slot-scope="scope">
          <span type="primary" v-if="scope.row.orderType == 1">巡检信息</span>
          <span type="primary" v-if="scope.row.orderType == 2">隐患信息</span>
          <span type="primary" v-if="scope.row.orderType == 3">报警信息</span>
        </template>
      </el-table-column>
      <el-table-column label="工单名称" align="center" prop="orderName" />
      <el-table-column label="工单状态" align="center" prop="orderStatus" >
        <template slot-scope="scope">
          <el-button type="info" v-if="scope.row.orderStatus == 0">未接收</el-button>
          <el-button type="warning" v-if="scope.row.orderStatus == 1">已接收</el-button>
          <el-button type="primary" v-if="scope.row.orderStatus == 2">已反馈</el-button>
          <el-button type="success" v-if="scope.row.orderStatus == 3">已归档</el-button>
        </template>
      </el-table-column>
      <el-table-column label="创建时间" align="center" prop="allotTime" width="180">
79
        <template slot-scope="scope">
80 81 82 83 84 85
          <span>{{ parseTime(scope.row.allotTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="更新时间" align="center" prop="actualTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.actualTime) }}</span>
86 87
        </template>
      </el-table-column>
王晓倩's avatar
王晓倩 committed
88
      <el-table-column label="工单描述" align="center" prop="remarks" />
89 90 91
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
92
            size="normal"
93 94
            type="text"
            icon="el-icon-edit"
95 96 97 98
            @click="handleReceive(scope.row)"
            v-hasPermi="['workOrder:basicsInfo:edit']"
            v-if="scope.row.orderStatus == 0"
          >接单</el-button>
99
          <el-button
100
            size="normal"
101
            type="text"
102 103 104 105 106 107 108 109 110 111 112
            icon="el-icon-edit"
            @click="handleFeedback(scope.row)"
            v-hasPermi="['workOrder:basicsInfo:editStatus']"
            v-if="scope.row.orderStatus == 1 || scope.row.orderStatus == 2"
          >反馈</el-button>
          <el-button
            size="normal"
            type="text"
            icon="el-icon-edit"
            @click="showDetail(scope.row)"
          >详情</el-button>
113 114 115 116 117 118 119 120 121 122 123
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

124
    <!-- 工单反馈对话框 -->
125
    <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body @close="cancel">
126
      <el-form ref="form" :model="form" :rules="rules" label-width="100px">
王晓倩's avatar
王晓倩 committed
127 128 129 130 131 132 133 134 135 136 137
        <el-form-item label="工单名称" prop="orderName">
          <font>{{form.orderName}}</font>
        </el-form-item>
        <el-form-item label="工单类型" prop="orderType">
          <span type="primary" v-if="form.orderType == 1">巡检信息</span>
          <span type="primary" v-if="form.orderType == 2">隐患信息</span>
          <span type="primary" v-if="form.orderType == 3">报警信息</span>
        </el-form-item>
        <el-form-item label="工单编号" prop="orderId">
          <font>{{form.orderId}}</font>
        </el-form-item>
138
        <el-form-item label="设备列表" prop="deviceCode" v-if="form.orderType == '1'">
139
          <el-select v-model="form.deviceId" placeholder="请选择设备" clearable size="small" filterable >
140 141
            <el-option
              v-for="device in form.deviceInfoList"
142
              :key="device.deviceId"
143
              :label="device.deviceName"
144
              :value="device.deviceId"
145 146
            ></el-option>
          </el-select>
147
        </el-form-item>
148 149 150 151 152 153 154
        <el-form-item label="反馈图片" prop="pictureUrl1">
          <FileUpload
            listType="picture-card"
            @resFun="getFileInfo"
            @remove="listRemove"
            :fileArr="fileList"
          />
155 156
        </el-form-item>
        <el-form-item label="是否存在隐患" prop="isHiddenDanger">
157
          <el-switch
王晓倩's avatar
王晓倩 committed
158 159 160
            v-model="isHiddenDanger"
            active-text="是"
            inactive-text="否">
161
          </el-switch>
162
        </el-form-item>
163
        <el-form-item label="处理结果" prop="dealStatus" v-if="isHiddenDanger == true">
164
          <el-radio-group v-model="form.dealStatus">
165 166 167
            <el-radio :label="2">已处理完成</el-radio>
            <el-radio :label="3">未处理完成</el-radio>
            <el-radio :label="1">不需处理</el-radio>
168 169
          </el-radio-group>
        </el-form-item>
170 171
        <el-form-item label="反馈信息" prop="contents">
          <el-input v-model="form.contents" type="textarea" placeholder="请输入反馈信息" />
172 173 174 175 176 177 178 179 180 181 182
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
183 184 185 186
  import { listBasicsInfo, getBasicsInfo, updateOrderStatus } from "@/api/workOrder/basicsInfo";
  import { addFeedback } from "@/api/workOrder/feedback";
  import FileUpload from '@/components/FileUpload';
  import Cookie from 'js-cookie';
187

188 189 190 191
  export default {
    name: "Feedback",
    components: {
      FileUpload,
192
    },
193 194
    data() {
      return {
王晓倩's avatar
王晓倩 committed
195
        isHiddenDanger: false,
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244
        // 遮罩层
        loading: true,
        // 导出遮罩层
        exportLoading: false,
        // 选中数组
        ids: [],
        // 非单个禁用
        single: true,
        // 非多个禁用
        multiple: true,
        // 显示搜索条件
        showSearch: true,
        // 总条数
        total: 0,
        // 工单基础信息表格数据
        basicsInfoList: [],
        // 弹出层标题
        title: "",
        // 是否显示弹出层
        open: false,
        // 工单状态字典
        typeOptions: [],
        // 巡检员列表
        inspector: [],
        // 时间搜索
        pickerOptions: [],
        // 工单类型字典
        ordertypeOptions: [],
        // 上传文件列表
        fileList: [],
        fileIndex: 0,
        // 查询参数
        queryParams: {
          pageNum: 1,
          pageSize: 10,
          orderId: null,
          orderType: null,
          orderName: null,
          orderStatus: null,
          appointInspector: null,
          startAllotTime: null,
          endAllotTime: null,
          remarks: null
        },
        // 表单参数
        form: {},
        // 表单校验
        rules: {
        }
245 246
      };
    },
247
    created() {
248
      this.getList();
249 250
      this.getDicts("t_order_status").then(response => {
        this.typeOptions = response.data;
251
      });
252 253
      this.getDicts("t_order_type").then(response => {
        this.ordertypeOptions = response.data;
254 255
      });
    },
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283
    methods: {
      /** 查询工单基础信息列表 */
      getList() {
        this.loading = true;
        this.queryParams.userName = Cookie.get('username');
        listBasicsInfo(this.queryParams).then(response => {
          this.basicsInfoList = response.rows;
          this.total = response.total;
          this.loading = false;
        });
      },
      getFileInfo(res){
        this.fileIndex++;
        console.log(this.fileIndex,"index");
        console.log(res,"res.url");
        if(this.fileIndex == 1){
          this.form.pictureUrl1 = res.url;
        } else if(this.fileIndex == 2){
          this.form.pictureUrl2 = res.url;
        } else if(this.fileIndex == 3){
          this.form.pictureUrl3 = res.url;
        }
      },
      listRemove(e) {
        this.form.pictureUrl1 = "";
        this.form.pictureUrl2 = "";
        this.form.pictureUrl3 = "";
        this.fileList = [];
王晓倩's avatar
王晓倩 committed
284
        this.fileIndex = 0;
285 286 287 288 289 290
      },
      // 取消按钮
      cancel() {
        this.open = false;
        this.reset();
        this.fileList = [];
王晓倩's avatar
王晓倩 committed
291
        this.fileIndex = 0;
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324
      },
      // 表单重置
      reset() {
        this.form = {
          deviceCode: null,
          pictureUrl1: null,
          pictureUrl2: null,
          pictureUrl3: null,
          isHiddenDanger: null,
          dealStatus: null,
          contents: null
        };
        this.resetForm("form");
      },
      /** 搜索按钮操作 */
      handleQuery() {
        this.queryParams.pageNum = 1;
        this.getList();
      },
      /** 重置按钮操作 */
      resetQuery() {
        this.resetForm("queryForm");
        this.handleQuery();
      },
      // 多选框选中数据
      handleSelectionChange(selection) {
        this.ids = selection.map(item => item.orderId)
        this.single = selection.length!==1
        this.multiple = !selection.length
      },
      /** 接单按钮操作 */
      handleReceive(row) {
        if (row.orderStatus == '0') {
王晓倩's avatar
王晓倩 committed
325 326 327
          const orderIds = row.orderId,
            orderName = roe.orderName;
          this.$confirm('是否确认接收工单(' + orderName + orderIds + ")", "操作提示", {
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning"
          }).then(function() {
            return updateOrderStatus(row);
          }).then(() => {
            this.getList();
            this.msgSuccess("操作成功");
          }).catch(() => {});
        }
      },
      /** 反馈按钮操作 */
      handleFeedback(row) {
        this.open = true;
        const orderId = row.orderId || this.ids
        getBasicsInfo(orderId).then(response => {
          this.form = response.data;
          this.open = true;
          this.title = "工单反馈";
        });
      },
      /** 详细信息跳转 */
      showDetail(row) {
        this.$router.push({
yaqizhang's avatar
yaqizhang committed
352
          path: '/workOrder/feedbackdetail',
353 354 355 356 357 358 359
          query:{
            orderId : row.orderId
          }
        }) //带参跳转
      },
      /** 提交按钮 */
      submitForm() {
360 361 362 363 364
        if(this.isHiddenDanger == false){
          this.form.isHiddenDanger = "2";
        } else {
          this.form.isHiddenDanger = "1";
        }
365 366 367 368 369 370 371 372 373 374 375 376
        this.$refs["form"].validate(valid => {
          if (valid) {
            if(this.form.orderStatus == '1' || this.form.orderStatus == '2'){
              addFeedback(this.form).then(response => {
                this.msgSuccess("反馈成功");
                this.open = false;
                this.getList();
              });
            }
          }
        });
      },
377
    }
378
  };
379
</script>
380 381
<style>
</style>