|
@@ -0,0 +1,386 @@
|
|
|
|
+/**
|
|
|
|
+@author:fugy
|
|
|
|
+@date:2018.10.24
|
|
|
|
+@info:项目sop配置列表
|
|
|
|
+ */
|
|
|
|
+<template>
|
|
|
|
+<div>
|
|
|
|
+ <!-- 搜索框 -->
|
|
|
|
+ <div>
|
|
|
|
+ <sg-selector type="project" @changed="projectedSelected"></sg-selector>
|
|
|
|
+ <el-input placeholder="输入问题名称、问题编号关键字进行查询" v-model.trim="searchValue" style="width:400px;" clearable></el-input>
|
|
|
|
+ <el-button type="primary" @click="getSearch">查询</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ <hr class="line" />
|
|
|
|
+ <!-- 条件框 -->
|
|
|
|
+ <div class="condition-box">
|
|
|
|
+ <p>
|
|
|
|
+ <span>优先级:</span>
|
|
|
|
+ <el-select v-model="priorityValue" size="medium" @change="priorityHandle">
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="item in priorityArr"
|
|
|
|
+ :key="item.value"
|
|
|
|
+ :label="item.label"
|
|
|
|
+ :value="item.value">
|
|
|
|
+ </el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </p>
|
|
|
|
+ <p>
|
|
|
|
+ <span>问题类型:</span>
|
|
|
|
+ <el-select v-model="problemValue" size="medium" @change="problemHandle">
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="item in problemArr"
|
|
|
|
+ :key="item.value"
|
|
|
|
+ :label="item.label"
|
|
|
|
+ :value="item.value">
|
|
|
|
+ </el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </p>
|
|
|
|
+ <p style="display:flex">
|
|
|
|
+ <span style="line-height: 40px;">对象类:</span>
|
|
|
|
+ <v-obj-type @change="objTypeChange"></v-obj-type>
|
|
|
|
+ <!-- <el-cascader
|
|
|
|
+ style="width: 300px;"
|
|
|
|
+ size="medium"
|
|
|
|
+ :options="objTypeOptions"
|
|
|
|
+ v-model="objTypeSelectArr"
|
|
|
|
+ @change="objTypeHandle">
|
|
|
|
+ </el-cascader> -->
|
|
|
|
+ </p>
|
|
|
|
+ <p class="check-box">
|
|
|
|
+ <el-checkbox v-model="checked" @change="isSopHandle">只看尚未配置项目SOP的</el-checkbox>
|
|
|
|
+ </p>
|
|
|
|
+ </div>
|
|
|
|
+ <!-- list表格 -->
|
|
|
|
+ <div class="table-box">
|
|
|
|
+ <template>
|
|
|
|
+ <el-table
|
|
|
|
+ :data="tableData"
|
|
|
|
+ style="width: 100%"
|
|
|
|
+ border>
|
|
|
|
+ <el-table-column
|
|
|
|
+ prop="serialId"
|
|
|
|
+ label="问题编号"
|
|
|
|
+ header-align="center"
|
|
|
|
+ width="150">
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column
|
|
|
|
+ prop="type"
|
|
|
|
+ label="问题类型"
|
|
|
|
+ header-align="center"
|
|
|
|
+ width="150">
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column
|
|
|
|
+ prop="objType"
|
|
|
|
+ header-align="center"
|
|
|
|
+ label="对象类"
|
|
|
|
+ width="200">
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column
|
|
|
|
+ prop="priority"
|
|
|
|
+ label="优先级"
|
|
|
|
+ header-align="center"
|
|
|
|
+ width="100">
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column
|
|
|
|
+ prop="name"
|
|
|
|
+ header-align="center"
|
|
|
|
+ label="问题名称">
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column
|
|
|
|
+ prop="sopLinkName"
|
|
|
|
+ label="关联的项目SOP"
|
|
|
|
+ header-align="center">
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column
|
|
|
|
+ header-align="center"
|
|
|
|
+ width="150"
|
|
|
|
+ label="操作">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <p style="text-align: center;">
|
|
|
|
+ <el-button type="text" v-if="scope.row.sopLinkName" size="small" @click="getLook(scope.row)">查看</el-button>
|
|
|
|
+ <el-button type="text" v-if="scope.row.sopLinkName" size="small" @click="edit(scope.row)">编辑</el-button>
|
|
|
|
+ <el-button type="text" v-if="scope.row.sopLinkName == ''" size="small" class="config-btn" @click="toConfig(scope.row)">去配置 ></el-button>
|
|
|
|
+ </p>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+ </template>
|
|
|
|
+ </div>
|
|
|
|
+ <!-- 分页 -->
|
|
|
|
+ <div class="page-box" v-if="total">
|
|
|
|
+ <el-pagination
|
|
|
|
+ @size-change="handleSizeChange"
|
|
|
|
+ @current-change="handleCurrentChange"
|
|
|
|
+ :current-page="currentPage"
|
|
|
|
+ :page-sizes="[10, 20, 30, 50]"
|
|
|
|
+ :page-size="100"
|
|
|
|
+ layout="total, sizes, prev, pager, next, jumper"
|
|
|
|
+ :total="total">
|
|
|
|
+ </el-pagination>
|
|
|
|
+ </div>
|
|
|
|
+ <!-- vue-component -->
|
|
|
|
+ <!-- item查看弹窗 -->
|
|
|
|
+ <v-look-item :lookVisibleFlag="lookVisibleFlag" :itemInfoData="itemInfoData" @look-to-edit="lookToEdit"></v-look-item>
|
|
|
|
+</div>
|
|
|
|
+</template>
|
|
|
|
+<script>
|
|
|
|
+// component
|
|
|
|
+import vLookItem from "./lookitem"; //查看item弹窗
|
|
|
|
+import vObjType from '@/components/alarm/common/ObjType' //对象类型
|
|
|
|
+// api
|
|
|
|
+import sopApi from "@/api/fm/sop"; //api
|
|
|
|
+import alarmApi from "@/api/alarm/alarm"; //sop通用api
|
|
|
|
+//tools
|
|
|
|
+import utils from '@/components/alarm/common/utils'
|
|
|
|
+//vuex
|
|
|
|
+import { mapGetters } from 'vuex'
|
|
|
|
+export default {
|
|
|
|
+ name: "group-sop-list",
|
|
|
|
+ data() {
|
|
|
|
+ return {
|
|
|
|
+ lookVisibleFlag: false, //查看弹窗的flag
|
|
|
|
+ itemInfoData: {}, //单条数据
|
|
|
|
+ projectValue: null, //项目绑定的value
|
|
|
|
+ searchValue: null, //搜索框中的value绑定值
|
|
|
|
+ searchLikeValue: null, //搜索框的模糊查询传值
|
|
|
|
+ priorityArr:[{ //优先级的下拉数组
|
|
|
|
+ label: "全部",
|
|
|
|
+ value: null
|
|
|
|
+ }],
|
|
|
|
+ priorityValue: null , //优先级的value值
|
|
|
|
+ problemArr: [{ //问题类型的下拉数组
|
|
|
|
+ label: "全部",
|
|
|
|
+ value: null
|
|
|
|
+ }],
|
|
|
|
+ problemValue: null, //问题类型的value值
|
|
|
|
+ endCascadeValue: null, //级联框的最后一级的标识code
|
|
|
|
+ startCascadeValue: null, //级联框的最后一级的标识code
|
|
|
|
+ checked: false, //是否尚未配置集团SOP
|
|
|
|
+ tableData: [],
|
|
|
|
+ currentPage: 1, //当前的页数
|
|
|
|
+ currentSize: 10, //当前的Size
|
|
|
|
+ total:0, //总页数
|
|
|
|
+ sopObj: {}, //缓存sop的数据 {sopid:{}}
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ computed: {
|
|
|
|
+ ...mapGetters('alarm', ['spaceCodeObj', 'spaceNameObj'])
|
|
|
|
+ },
|
|
|
|
+ components: {
|
|
|
|
+ vLookItem,
|
|
|
|
+ vObjType
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ // 查看
|
|
|
|
+ getLook(row) {
|
|
|
|
+ this.lookVisibleFlag = !this.lookVisibleFlag;
|
|
|
|
+ this.itemInfoData = row;
|
|
|
|
+ this.itemInfoData.projectId = this.projectValue;
|
|
|
|
+ },
|
|
|
|
+ // 编辑
|
|
|
|
+ edit(row) {
|
|
|
|
+ row.projectId = this.projectValue;
|
|
|
|
+ this.$emit("to-edit", row);
|
|
|
|
+ },
|
|
|
|
+ // 查看页面去编辑页面
|
|
|
|
+ lookToEdit(row) {
|
|
|
|
+ this.$emit("to-edit", row);
|
|
|
|
+ },
|
|
|
|
+ // 去配置
|
|
|
|
+ toConfig(row) {
|
|
|
|
+ row.projectId = this.projectValue;
|
|
|
|
+ this.$emit("to-edit", row);
|
|
|
|
+ },
|
|
|
|
+ // 项目切换
|
|
|
|
+ projectedSelected(val){
|
|
|
|
+ this.projectValue = val
|
|
|
|
+ if(val){
|
|
|
|
+ this.projectHandle()
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ projectHandle() {
|
|
|
|
+ this.currentPage = 1;
|
|
|
|
+ this.searchValue = null;
|
|
|
|
+ this.priorityValue = null;
|
|
|
|
+ this.problemValue = null;
|
|
|
|
+ this.objTypeSelectArr = [null];
|
|
|
|
+ this.endCascadeValue =null;
|
|
|
|
+ this.checked = false;
|
|
|
|
+ this.cacheSopData();
|
|
|
|
+ },
|
|
|
|
+ // 对象类切换
|
|
|
|
+ objTypeChange(val) {
|
|
|
|
+ let start = null;
|
|
|
|
+ let end = null;
|
|
|
|
+ if(val.length){
|
|
|
|
+ start = val[0];
|
|
|
|
+ if(val[0] == 'space' ){
|
|
|
|
+ if(val.length > 1) {
|
|
|
|
+ // end = val[val.length - 1 ]
|
|
|
|
+ let p = utils.spaceSonCode(val[val.length - 1 ], this.spaceCodeObj);
|
|
|
|
+ end = p;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(val[0] == 'system' || val[0] == 'facility') {
|
|
|
|
+ if(val.length > 1) {
|
|
|
|
+ end = [val[val.length - 1]]
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ this.startCascadeValue = start;
|
|
|
|
+ this.endCascadeValue = end;
|
|
|
|
+ this.getListData()
|
|
|
|
+ },
|
|
|
|
+ // 查询
|
|
|
|
+ getSearch() {
|
|
|
|
+ if(this.searchValue) {
|
|
|
|
+ this.searchLikeValue = {
|
|
|
|
+ $like: `%${this.searchValue}%`
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ this.searchLikeValue = null;
|
|
|
|
+ }
|
|
|
|
+ this.currentPage = 1;
|
|
|
|
+ this.getListData()
|
|
|
|
+ },
|
|
|
|
+ // 优先级下拉事件
|
|
|
|
+ priorityHandle() {
|
|
|
|
+ this.currentPage = 1;
|
|
|
|
+ this.getListData();
|
|
|
|
+ },
|
|
|
|
+ // 问题类型下拉事件
|
|
|
|
+ problemHandle() {
|
|
|
|
+ this.currentPage = 1;
|
|
|
|
+ this.getListData();
|
|
|
|
+ },
|
|
|
|
+ // 是否配置Sop事件
|
|
|
|
+ isSopHandle(val) {
|
|
|
|
+ this.currentPage = 1;
|
|
|
|
+ this.getListData();
|
|
|
|
+ },
|
|
|
|
+ // 分页Size处理函数
|
|
|
|
+ handleSizeChange(size) {
|
|
|
|
+ this.currentPage = 1;
|
|
|
|
+ this.currentSize = size;
|
|
|
|
+ this.getListData();
|
|
|
|
+ },
|
|
|
|
+ // 分页page处理函数
|
|
|
|
+ handleCurrentChange(page) {
|
|
|
|
+ this.currentPage = page;
|
|
|
|
+ this.getListData();
|
|
|
|
+ },
|
|
|
|
+ // 获取list的数据
|
|
|
|
+ async getListData() {
|
|
|
|
+ this.tableData = [];
|
|
|
|
+ let params = {
|
|
|
|
+ criteria: {
|
|
|
|
+ id: null, //选填,通用问题id
|
|
|
|
+ serialId: this.searchLikeValue, //选填,编号
|
|
|
|
+ name: this.searchLikeValue, //选填,问题名称
|
|
|
|
+ type: this.problemValue || null, //选填,问题类型[电器,建筑,家具,其他]
|
|
|
|
+ objType: this.startCascadeValue, //选填,对象类型
|
|
|
|
+ category: this.endCascadeValue ? {"$in":this.endCascadeValue } : null,
|
|
|
|
+ priority: this.priorityValue || null, //选填,优先级别[S,A,B,C,D]
|
|
|
|
+ hasRule: null, //选填,是否配置抢单规则,1已配置,0未配置
|
|
|
|
+ hasSop: this.checked ? 0 : null, //选填,是否已配置sop,1已配置,0未配置
|
|
|
|
+ projectId: this.projectValue //选填,项目id
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ page: this.currentPage, //页码,从1开始
|
|
|
|
+ size: this.currentSize
|
|
|
|
+ };
|
|
|
|
+ let {result, count, content} = await sopApi.getListData(params);
|
|
|
|
+ if(result === "success" && content && content.length) {
|
|
|
|
+ this.total = count;
|
|
|
|
+ let arr = content.map((ele, index) => {
|
|
|
|
+ let objTypeName = alarmApi.getObjTypeNameFromCode(ele.objType, ele.category, this.spaceNameObj);
|
|
|
|
+ let sopLinkName = "";
|
|
|
|
+
|
|
|
|
+ if(ele.sopList && ele.sopList.length) {
|
|
|
|
+ ele.sopList.forEach((sopItem, index) => {
|
|
|
|
+ if ( this.sopObj[sopItem.sopId] ) {
|
|
|
|
+ sopItem.sopName = this.sopObj[sopItem.sopId].sopName;
|
|
|
|
+ sopLinkName += sopItem.sopName + (ele.sopList.length-1 == index ? "" : "、");
|
|
|
|
+ } else {
|
|
|
|
+ sopLinkName = "不存在";
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ return {
|
|
|
|
+ id: ele.id,
|
|
|
|
+ serialId: ele.serialId,
|
|
|
|
+ type: ele.type,
|
|
|
|
+ objType: objTypeName.name,
|
|
|
|
+ priority: ele.priority,
|
|
|
|
+ name: ele.name,
|
|
|
|
+ remark: ele.remark,
|
|
|
|
+ sopLinkName: sopLinkName,
|
|
|
|
+ sopList: ele.sopList || [],
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ this.tableData = arr;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 缓存sop的数据
|
|
|
|
+ async cacheSopData() {
|
|
|
|
+ // 获取sop的数组,用于列表展示name【id 去请求 name】
|
|
|
|
+ let {result, content} = await api.getSopList({projectId:this.projectValue});
|
|
|
|
+ if(result === "success" && content && content.length) {
|
|
|
|
+ content.forEach((item, index) => {
|
|
|
|
+ this.sopObj[item.sopId] = item;
|
|
|
|
+ })
|
|
|
|
+ // 获取list数据
|
|
|
|
+ this.getListData();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 初始化数据
|
|
|
|
+ async initData() {
|
|
|
|
+ //获取优先级数组
|
|
|
|
+ let priorityArr = await sopApi.getPriorityArr();
|
|
|
|
+ this.priorityArr.push(...priorityArr);
|
|
|
|
+ // 获取问题类型
|
|
|
|
+ let problemArr = await sopApi.getProblemArr();
|
|
|
|
+ this.problemArr.push(...problemArr);
|
|
|
|
+ // // 获取对象类
|
|
|
|
+ let {devArr, sysArr} = await alarmApi.getObjectType();
|
|
|
|
+ this.cacheSopData();
|
|
|
|
+ } },
|
|
|
|
+ created() {
|
|
|
|
+ //判读是否存在
|
|
|
|
+ if(!this.spaceCodeObj || !this.spaceNameObj){
|
|
|
|
+ this.$store.commit("alarm/ADD_INDEX")
|
|
|
|
+ }
|
|
|
|
+ this.initData();
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+</script>
|
|
|
|
+<style lang='less' scoped>
|
|
|
|
+.line {
|
|
|
|
+ background-color: #ccc;
|
|
|
|
+ height: 1px;
|
|
|
|
+ border: none;
|
|
|
|
+ margin: 10px 0
|
|
|
|
+}
|
|
|
|
+.condition-box {
|
|
|
|
+ display: flex;
|
|
|
|
+ p {
|
|
|
|
+ font-size: 14px;
|
|
|
|
+ color: #5e6d82;
|
|
|
|
+ margin-right: 30px;
|
|
|
|
+ };
|
|
|
|
+ .check-box {
|
|
|
|
+ padding-top: 10px;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+.table-box {
|
|
|
|
+ margin-top: 10px;
|
|
|
|
+ .config-btn {
|
|
|
|
+ color: red
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+.page-box {
|
|
|
|
+ margin-top: 10px;
|
|
|
|
+ text-align: center
|
|
|
|
+}
|
|
|
|
+</style>
|