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

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

126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143

    <!-- 归档或修改工单基础信息对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="100px">
        <div v-if="this.title == '工单信息修改'">
          <el-form-item label="工单名称" prop="orderName">
            <el-input v-model="form.orderName" placeholder="请输入工单名称" />
          </el-form-item>
          <el-form-item label="指定执行人员" prop="appointInspector">
            <el-select v-model="form.appointInspectorName" placeholder="请选择执行人员" clearable size="small" @change="setUserId">
              <el-option
                v-for="item in inspector"
                :key="item.userId"
                :label="item.nickName"
                :value="item.userId"
              ></el-option>
            </el-select>
          </el-form-item>
王晓倩's avatar
王晓倩 committed
144 145 146
          <el-form-item label="工单描述" prop="remarks">
            <el-input v-model="form.remarks" type="textarea" placeholder="请输入工单描述" />
          </el-form-item>
147 148
        </div>
        <div v-if="this.title == '工单信息归档'">
王晓倩's avatar
王晓倩 committed
149 150 151 152 153 154 155 156 157 158 159 160 161
          <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>
          <el-form-item label="归档信息" prop="archiving">
            <el-input v-model="form.archiving" type="textarea" placeholder="请输入归档信息" />
162 163
          </el-form-item>
        </div>
164 165 166 167 168 169 170 171 172 173
      </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>
174 175
import { listBasicsInfo, getBasicsInfo, delBasicsInfo, updateOrderStatus, updateBasicsInfo, exportBasicsInfo } from "@/api/workOrder/basicsInfo";
import { inspectorList } from "@/api/system/user";
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202

export default {
  name: "BasicsInfo",
  components: {
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 工单基础信息表格数据
      basicsInfoList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
yaqizhang's avatar
yaqizhang committed
203 204
      // 工单状态字典
      typeOptions: [],
205 206 207 208
      // 巡检员列表
      inspector: [],
      // 时间搜索
      pickerOptions: [],
yaqizhang's avatar
yaqizhang committed
209 210
      // 工单类型字典
      ordertypeOptions: [],
211 212 213 214
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
215
        orderId: null,
216 217 218 219
        orderType: null,
        orderName: null,
        orderStatus: null,
        appointInspector: null,
220 221
        startAllotTime: null,
        endAllotTime: null,
222 223 224 225 226 227 228 229 230 231 232
        remarks: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    };
  },
  created() {
    this.getList();
yaqizhang's avatar
yaqizhang committed
233 234 235 236 237 238
    this.getDicts("t_order_status").then(response => {
      this.typeOptions = response.data;
    });
    this.getDicts("t_order_type").then(response => {
      this.ordertypeOptions = response.data;
    });
239 240 241 242 243 244 245 246 247 248 249
  },
  methods: {
    /** 查询工单基础信息列表 */
    getList() {
      this.loading = true;
      listBasicsInfo(this.queryParams).then(response => {
        this.basicsInfoList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
250 251 252 253 254 255 256 257 258 259
    getInspectorList(){
      this.loading = true;
      inspectorList().then(response => {
        this.inspector = response.data;
        this.loading = false;
      });
    },
    setUserId(val){
      this.form.appointInspector = val;
    },
260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        orderId: null,
        orderType: null,
        orderName: null,
        orderStatus: "0",
        createTime: null,
        appointInspector: null,
        allotTime: null,
        actualInspector: null,
        actualTime: null,
        remarks: 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
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加工单基础信息";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
305 306 307 308 309 310 311 312 313 314 315
      this.reset();
      this.getInspectorList();
      const orderId = row.orderId || this.ids
      getBasicsInfo(orderId).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "工单信息修改";
      });
    },
    /** 归档按钮操作 */
    handleFinish(row) {
316 317 318 319 320
      this.reset();
      const orderId = row.orderId || this.ids
      getBasicsInfo(orderId).then(response => {
        this.form = response.data;
        this.open = true;
321
        this.title = "工单信息归档";
322 323
      });
    },
yaqizhang's avatar
yaqizhang committed
324 325
    /** 详细信息跳转 */
    showDetail(row) {
326 327
      this.$router.push({
         path: '/basicsInfo/detail',
yaqizhang's avatar
yaqizhang committed
328 329 330
         query:{
           orderId : row.orderId
         }
331
      }) //带参跳转
yaqizhang's avatar
yaqizhang committed
332
    },
333 334 335 336
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
337
          if (this.form.orderStatus == '0') {
338 339 340 341 342
            updateBasicsInfo(this.form).then(response => {
              this.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
343 344 345
          } else if(this.form.orderStatus == '2'){
            updateOrderStatus(this.form).then(response => {
              this.msgSuccess("操作成功");
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const orderIds = row.orderId || this.ids;
      this.$confirm('是否确认删除工单基础信息编号为"' + orderIds + '"的数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return delBasicsInfo(orderIds);
        }).then(() => {
          this.getList();
          this.msgSuccess("删除成功");
        }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams;
      this.$confirm('是否确认导出所有工单基础信息数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(() => {
          this.exportLoading = true;
          return exportBasicsInfo(queryParams);
        }).then(response => {
          this.download(response.msg);
          this.exportLoading = false;
        }).catch(() => {});
    }
  }
};
</script>
yaqizhang's avatar
yaqizhang committed
385
<style>
386
</style>