“linengliang”
2023-11-21 958233d0bb26417d5b51e68ecc1cfb9410fcdccc
ABC评分签审
已添加6个文件
1596 ■■■■■ 文件已修改
src/views/eam/ABC/ABCAssessmentList.vue 216 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/ABC/StreamList.vue 269 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/ABC/StreamOperationList.vue 171 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/ABC/modules/EquipmentSelectModel.vue 303 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/ABC/modules/StreamForm.vue 572 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/ABC/modules/StreamModal.vue 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/ABC/ABCAssessmentList.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,216 @@
<template>
  <a-card :bordered="false" :class="'cust-erp-sub-tab'">
    <!-- æŸ¥è¯¢åŒºåŸŸ -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
        </a-row>
      </a-form>
    </div>
    <!-- æŸ¥è¯¢åŒºåŸŸ-END -->
    <!-- æ“ä½œæŒ‰é’®åŒºåŸŸ -->
    <div class="table-operator" v-if="mainId">
      <a-dropdown v-if="selectedRowKeys.length > 0">
        <a-menu slot="overlay">
          <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
        </a-menu>
        <a-button style="margin-left: 8px"> æ‰¹é‡æ“ä½œ <a-icon type="down" /></a-button>
      </a-dropdown>
    </div>
    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> å·²é€‰æ‹© <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :scroll="{x:true}"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        @change="handleTableChange">
        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>
        <template slot="imgSlot" slot-scope="text,record">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
          <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
        </template>
        <template slot="fileSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
          <a-button
            v-else
            :ghost="true"
            type="primary"
            icon="download"
            size="small"
            @click="downloadFile(text)">
            ä¸‹è½½
          </a-button>
        </template>
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>
          <a-divider type="vertical" />
          <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
            <a>删除</a>
          </a-popconfirm>
        </span>
      </a-table>
    </div>
  </a-card>
</template>
<script>
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  export default {
    name: "ABCAssessmentList",
    mixins:[JeecgListMixin],
    components: { },
    props:{
      mainId:{
        type:String,
        default:'',
        required:false
      }
    },
    watch:{
      mainId:{
        immediate: true,
        handler(val) {
          if(!this.mainId){
            this.clearList()
          }else{
            this.queryParam['streamId'] = val
            this.loadData(1);
          }
        }
      }
    },
    data () {
      return {
        description: '设备ABC评价管理页面',
        disableMixinCreated:true,
        // è¡¨å¤´
        columns: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },
          {
            title:'统一编号',
            align:"center",
            dataIndex: 'num',
            width:200
          },
          {
            title:'设备名称',
            align:"center",
            dataIndex: 'name',
            width:200
          },
          {
            title:'设备型号',
            align:"center",
            dataIndex: 'model',
            width:200
          },
          {
            title:'平均使用率',
            align:"center",
            dataIndex: 'standardA_dictText',
            width:200
          },
          {
            title:'可替换性',
            align:"center",
            dataIndex: 'standardB_dictText',
            width:200
          },
          {
            title:'故障影响度',
            align:"center",
            dataIndex: 'standardC_dictText',
            width:200
          },
          {
            title:'生产超差度',
            align:"center",
            dataIndex: 'standardD_dictText',
            width:200
          },
          {
            title:'故障频率',
            align:"center",
            dataIndex: 'standardE_dictText',
            width:200
          },
          {
            title:'设备价值',
            align:"center",
            dataIndex: 'standardF_dictText',
            width:200
          },
          {
            title:'旧标识',
            align:"center",
            dataIndex: 'equipmentImportanceId_dictText',
            width:200
          },
          {
            title:'新标识',
            align:"center",
            dataIndex: 'finalStandard_dictText',
            width:200
          },
        ],
        url: {
          list: "/eam/stream/listABCAssessmentByMainId",
          delete: "/eam/stream/deleteABCAssessment",
          deleteBatch: "/eam/stream/deleteBatchABCAssessment",
          exportXlsUrl: "/eam/stream/exportABCAssessment",
          importUrl: "/eam/stream/importABCAssessment",
        },
        dictOptions:{
        }
      }
    },
    created() {
    },
    computed: {
      importExcelUrl(){
        return `${window._CONFIG['domianURL']}/${this.url.importUrl}/${this.mainId}`;
      }
    },
    methods: {
      clearList(){
        this.dataSource=[]
        this.selectedRowKeys=[]
        this.ipagination.current = 1
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less'
</style>
src/views/eam/ABC/StreamList.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,269 @@
<template>
  <a-card :bordered="false">
    <!-- æŸ¥è¯¢åŒºåŸŸ -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
        </a-row>
      </a-form>
    </div>
    <!-- æŸ¥è¯¢åŒºåŸŸ-END -->
    <!-- æ“ä½œæŒ‰é’®åŒºåŸŸ -->
    <div class="table-operator">
      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
      <!-- <a-button type="primary" icon="download" @click="handleExportXls('设备ABC评价')">导出</a-button>
      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
        <a-button type="primary" icon="import">导入</a-button>
      </a-upload> -->
      <!-- é«˜çº§æŸ¥è¯¢åŒºåŸŸ -->
      <!-- <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query> -->
    </div>
    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> å·²é€‰æ‹© <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        class="j-table-force-nowrap"
        :scroll="{x:true}"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type:'radio'}"
        :customRow="clickThenSelect"
        @change="handleTableChange">
        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>
        <template slot="imgSlot" slot-scope="text,record">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
          <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
        </template>
        <template slot="fileSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
          <a-button
            v-else
            :ghost="true"
            type="primary"
            icon="download"
            size="small"
            @click="downloadFile(text)">
            ä¸‹è½½
          </a-button>
        </template>
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>
          <a-divider type="vertical" />
          <a-dropdown>
            <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
            <a-menu slot="overlay">
              <a-menu-item>
                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>
      </a-table>
    </div>
    <a-tabs defaultActiveKey="1">
      <a-tab-pane tab="操作记录" key="1" >
        <StreamOperationList :mainId="streamOperationMainId" />
      </a-tab-pane>
      <a-tab-pane tab="ABC评分" key="2" forceRender>
        <ABCAssessmentList :mainId="aBCAssessmentMainId" />
      </a-tab-pane>
    </a-tabs>
    <stream-modal ref="modalForm" @ok="modalFormOk"></stream-modal>
  </a-card>
</template>
<script>
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import StreamModal from './modules/StreamModal'
  import { getAction } from '@/api/manage'
  import StreamOperationList from './StreamOperationList'
  import ABCAssessmentList from './ABCAssessmentList'
  import '@/assets/less/TableExpand.less'
  export default {
    name: "StreamList",
    mixins:[JeecgListMixin],
    components: {
      StreamOperationList,
      ABCAssessmentList,
      StreamModal
    },
    data () {
      return {
        description: '设备ABC评价管理页面',
        // è¡¨å¤´
        columns: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },
          {
            title:'单据号',
            align:"center",
            dataIndex: 'num',
            width:400
          },
          {
            title:'当前节点',
            align:"center",
            dataIndex: 'status',
            width:300
          },
          {
            title:'单据类型',
            align:"center",
            dataIndex: 'type',
            width:300
          },
          {
            title:'发起时间',
            align:"center",
            dataIndex: 'createTime',
            width:300
          },
          {
            title:'发起人',
            align:"center",
            dataIndex: 'createBy_dictText'
          },
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            fixed:"right",
            width:200,
            scopedSlots: { customRender: 'action' },
          }
        ],
        url: {
          list: "/eam/stream/list",
          delete: "/eam/stream/delete",
          deleteBatch: "/eam/stream/deleteBatch",
          exportXlsUrl: "/eam/stream/exportXls",
          importExcelUrl: "eam/stream/importExcel",
        },
        dictOptions:{
        },
        /* åˆ†é¡µå‚æ•° */
        ipagination:{
          current: 1,
          pageSize: 5,
          pageSizeOptions: ['5', '10', '50'],
          showTotal: (total, range) => {
            return range[0] + "-" + range[1] + " å…±" + total + "条"
          },
          showQuickJumper: true,
          showSizeChanger: true,
          total: 0
        },
        selectedMainId:'',
        superFieldList:[],
        streamOperationMainId: '',
        aBCAssessmentMainId: '',
      }
    },
    created() {
      this.getSuperFieldList();
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      }
    },
    methods: {
      initDictConfig(){
      },
      clickThenSelect(record) {
        return {
          on: {
            click: () => {
              this.onSelectChange(record.id.split(","), [record]);
            }
          }
        }
      },
      onClearSelected() {
        this.selectedRowKeys = [];
        this.selectionRows = [];
        this.selectedMainId=''
      },
      onSelectChange(selectedRowKeys, selectionRows) {
        if(selectedRowKeys.length===1){
          this.selectedMainId=selectedRowKeys[0]
          this.streamOperationMainId = selectionRows[0]['id']
          this.aBCAssessmentMainId = selectionRows[0]['id']
        }else{
          this.selectedMainId=''
          this.streamOperationMainId = ''
          this.aBCAssessmentMainId = ''
        }
        this.selectedRowKeys = selectedRowKeys;
        this.selectionRows = selectionRows;
      },
      loadData(arg) {
        if(!this.url.list){
          this.$message.error("请设置url.list属性!")
          return
        }
        //加载数据 è‹¥ä¼ å…¥å‚æ•°1则加载第一页的内容
        if (arg === 1) {
          this.ipagination.current = 1;
        }
        this.onClearSelected()
        var params = this.getQueryParams();//查询条件
        this.loading = true;
        getAction(this.url.list, params).then((res) => {
          if (res.success) {
            this.dataSource = res.result.records;
            this.ipagination.total = res.result.total;
          }
          if(res.code===510){
            this.$message.warning(res.message)
          }
          this.loading = false;
        })
      },
      getSuperFieldList(){
        let fieldList=[];
        fieldList.push({type:'string',value:'num',text:'num',dictCode:''})
        fieldList.push({type:'string',value:'status',text:'status',dictCode:''})
        fieldList.push({type:'string',value:'type',text:'单据类型',dictCode:''})
        this.superFieldList = fieldList
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less'
</style>
src/views/eam/ABC/StreamOperationList.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,171 @@
<template>
  <a-card :bordered="false" :class="'cust-erp-sub-tab'">
    <!-- æŸ¥è¯¢åŒºåŸŸ -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
        </a-row>
      </a-form>
    </div>
    <!-- æŸ¥è¯¢åŒºåŸŸ-END -->
    <!-- æ“ä½œæŒ‰é’®åŒºåŸŸ -->
    <div class="table-operator" v-if="mainId">
      <a-dropdown v-if="selectedRowKeys.length > 0">
        <a-menu slot="overlay">
          <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
        </a-menu>
        <a-button style="margin-left: 8px"> æ‰¹é‡æ“ä½œ <a-icon type="down" /></a-button>
      </a-dropdown>
    </div>
    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> å·²é€‰æ‹© <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :scroll="{x:true}"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        @change="handleTableChange">
        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>
        <template slot="imgSlot" slot-scope="text,record">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
          <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
        </template>
        <template slot="fileSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
          <a-button
            v-else
            :ghost="true"
            type="primary"
            icon="download"
            size="small"
            @click="downloadFile(text)">
            ä¸‹è½½
          </a-button>
        </template>
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>
          <a-divider type="vertical" />
          <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
            <a>删除</a>
          </a-popconfirm>
        </span>
      </a-table>
    </div>
  </a-card>
</template>
<script>
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  export default {
    name: "StreamOperationList",
    mixins:[JeecgListMixin],
    components: { },
    props:{
      mainId:{
        type:String,
        default:'',
        required:false
      }
    },
    watch:{
      mainId:{
        immediate: true,
        handler(val) {
          if(!this.mainId){
            this.clearList()
          }else{
            this.queryParam['streamId'] = val
            this.loadData(1);
          }
        }
      }
    },
    data () {
      return {
        description: '设备ABC评价管理页面',
        disableMixinCreated:true,
        // è¡¨å¤´
        columns: [
          {
            title:'排序',
            align:"center",
            dataIndex: 'sort',
            width:60
          },
          {
            title:'操作',
            align:"center",
            dataIndex: 'operation',
            width:400
          },
          {
            title:'操作节点',
            align:"center",
            dataIndex: 'streamId',
            width:400
          },
          {
            title:'操作人',
            align:"center",
            dataIndex: 'userId_dictText',
            width:400
          },
          {
            title:'操作人意见',
            align:"center",
            dataIndex: 'remark',
            width:500
          },
        ],
        url: {
          list: "/eam/stream/listStreamOperationByMainId",
          delete: "/eam/stream/deleteStreamOperation",
          deleteBatch: "/eam/stream/deleteBatchStreamOperation",
          exportXlsUrl: "/eam/stream/exportStreamOperation",
          importUrl: "/eam/stream/importStreamOperation",
        },
        dictOptions:{
        }
      }
    },
    created() {
    },
    computed: {
      importExcelUrl(){
        return `${window._CONFIG['domianURL']}/${this.url.importUrl}/${this.mainId}`;
      }
    },
    methods: {
      clearList(){
        this.dataSource=[]
        this.selectedRowKeys=[]
        this.ipagination.current = 1
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less'
</style>
src/views/eam/ABC/modules/EquipmentSelectModel.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,303 @@
<template>
  <!--支持全屏缩放-->
  <a-modal
    :visible="visible"
    :title="title"
    switchFullscreen
    @ok="handleSubmit"
    @cancel="close"
    style="top:50px"
    cancelText="关闭"
    :width="1400"
  >
    <a-card :bordered="false">
      <div class="table-page-search-wrapper">
        <a-form
          layout="inline"
          @keyup.enter.native="searchQuery"
        >
          <a-row :gutter="24">
            <a-col
              :md="8"
              :sm="6"
            >
              <a-form-item label="统一编码">
                <a-input
                  placeholder="请输入统一编码"
                  v-model="queryParam.num"
                />
              </a-form-item>
            </a-col>
            <a-col
              :md="8"
              :sm="6"
            >
              <a-form-item label="设备名称">
                <a-input
                  placeholder="设备名称"
                  v-model="queryParam.name"
                />
              </a-form-item>
            </a-col>
            <a-col :md="3">
              <span
                style="float: left;overflow: hidden;"
                class="table-page-search-submitButtons"
              >
                <a-button
                  type="primary"
                  @click="searchQuery"
                  icon="search"
                >查询</a-button>
                <a-button
                  @click="searchReset"
                  icon="reload"
                  style="margin-left: 10px"
                >重置</a-button>
              </span>
            </a-col>
          </a-row>
        </a-form>
      </div>
      <a-table
        ref="table"
        :scroll="scrollTrigger"
        size="middle"
        rowKey="id"
        bordered
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :rowSelection="rowSelection"
        :loading="loading"
        @change="handleTableChange"
      >
       <template slot="equipmentPhoto" slot-scope="text,record">
         <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
         <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
       </template>
      </a-table>
    </a-card>
  </a-modal>
</template>
<script>
import { filterObj } from '@/utils/util'
import { getAction } from '@/api/manage'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
export default {
  name: 'EquipmentSelectModel',
  mixins: [JeecgListMixin],
  components: {},
  props: {},
  data() {
    return {
      queryParam: {},
      columns: [
        {
          title: '#',
          dataIndex: 'id',
          key: 'rowIndex',
          width: 50,
          align: 'center',
          customRender: function(t, r, index) {
            return parseInt(index) + 1
          }
        },
        {
          title: '统一编码',
          align: 'center',
          dataIndex: 'num',
          width:200
        },
        {
          title: '设备名称',
          align: 'center',
          dataIndex: 'name',
          width:200
        },
        {
          title: '设备型号',
          align: 'center',
          dataIndex: 'model',
          width:200
        },
        {
          title: '设备规格',
          align: 'center',
          dataIndex: 'specification',
          width:200
        },
        {
          title: 'ABC标识',
          align: "center",
          dataIndex: 'equipmentImportanceId',
          width:100
        },
        {
          title: '关键设备标识',
          align: "center",
          dataIndex: 'specificEquipment_dictText',
          width:100
        },
        {
          title: '设备状态',
          align: 'center',
          dataIndex: 'equipmentStatus_dictText',
          width:100
        },
        {
          title: '技术状态',
          align: 'center',
          dataIndex: 'technologyStatus_dictText',
          width:100
        },
      ],
      selectedRowKeys: [],
      oldSelectRows: [],
      scrollTrigger: {},
      dataSource: [],
      selectionRows: [],
      title: '选择设备',
      ipagination: {
        current: 1,
        pageSize: 10,
        pageSizeOptions: ['5', '10', '30', '50', '100'],
        showTotal: (total, range) => {
          return range[0] + '-' + range[1] + ' å…±' + total + '条'
        },
        showQuickJumper: true,
        showSizeChanger: true,
        total: 0
      },
      isorter: {
        column: 'num',
        order: 'desc'
      },
      visible: false,
      loading: false,
      url: {
        list: '/eam/equipment/list'
      }
    }
  },
  computed: {
    rowSelection() {
      return {
        type: 'checkbox',
        onChange: (selectedRowKeys, selectedRows) => {
          this.selectedRowKeys = selectedRowKeys
          this.onSelectChange(selectedRows)
        },
        getCheckboxProps: record => ({
          props: {
            disabled: record.distable
          }
        }),
        selectedRowKeys: this.selectedRowKeys
      }
    }
  },
  methods: {
    async loadData(arg) {
      if (arg === 1) {
        this.ipagination.current = 1
      }
      let that = this
      this.loading = true
      let params = this.getQueryParams()//查询条件
      // params.equipmentStatus = '1'
      await getAction(this.url.list, params).then((res) => {
        if (res.success) {
          for (let i = 0; i < res.result.records.length; i++) {
            if (that.oldSelectRows.indexOf(res.result.records[i].id) > -1) {
              res.result.records[i].distable = true
            } else {
              res.result.records[i].distable = false
            }
          }
          this.dataSource = res.result.records
          this.ipagination.total = res.result.total
        }
        if (res.code === 510) {
          this.$message.warning(res.message)
        }
        this.loading = false
      })
    },
    showModals(oldSelectRows) {
      this.oldSelectRows = oldSelectRows
      this.visible = true
      this.loadData(1)
    },
    getQueryParams() {
      let param = Object.assign({}, this.queryParam, this.isorter)
      param.field = this.getQueryField()
      param.pageNo = this.ipagination.current
      param.pageSize = this.ipagination.pageSize
      return filterObj(param)
    },
    //查询条件处理
    getQueryField() {
      let str = 'id,'
      for (let a = 0; a < this.columns.length; a++) {
        str += ',' + this.columns[a].dataIndex
      }
      return str
    },
    searchReset(num) {
      let that = this
      this.queryParam = []
      if (num !== 0) {
        that.loadData(1)
      }
      that.selectborrowIds = []
    },
    close() {
      this.searchReset(0)
      this.selectedRowKeys = []
      this.visible = false
    },
    handleTableChange(pagination, filters, sorter) {
      //TODO ç­›é€‰
      if (Object.keys(sorter).length > 0) {
        this.isorter.column = sorter.field
        this.isorter.order = 'ascend' === sorter.order ? 'asc' : 'desc'
      }
      this.ipagination = pagination
      this.loadData()
    },
    handleSubmit() {
      this.$emit('selectionRows', this.selectionRows)
      this.searchReset(0)
      this.close()
    },
    onSelectChange(selectionRows) {
      this.selectionRows = selectionRows
    },
    searchQuery() {
      this.loadData(1)
    }
  }
}
</script>
<style scoped>
.ant-table-tbody .ant-table-row td {
  padding-top: 10px;
  padding-bottom: 10px;
}
#components-layout-demo-custom-trigger .trigger {
  font-size: 18px;
  line-height: 64px;
  padding: 0 24px;
  cursor: pointer;
  transition: color 0.3s;
}
</style>
src/views/eam/ABC/modules/StreamForm.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,572 @@
<template>
  <a-spin :spinning="confirmLoading">
    <j-form-container :disabled="formDisabled">
      <!-- ä¸»è¡¨å•区域 -->
      <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
        <a-row :gutter="24">
          <a-col :span="12" >
            <a-form-model-item label="单据号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="num">
              <a-input v-model="model.num" placeholder="系统自动生成" :disabled="true" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item
              label="新ABC标识"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              prop="finalStandard"
              :disabled="true"
            >
              <j-dict-select-tag
                allow-clear
                :disabled="true"
                placeholder="请选择ABC标识"
                :triggerChange="true"
                dictCode="ABC-standard-result"
                v-model="model.finalStandard"
              />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-model-item
              label="平均使用率"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              prop="standardA"
            >
              <j-dict-select-tag
                allow-clear
                placeholder="请选择平均使用率"
                :disabled="formDisabled"
                :triggerChange="true"
                dictCode="ABC-standardA"
                v-model="model.standardA"
                @change="(e) =>standardResultCompute(e,'A')"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item
              label="可替换性"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              prop="standardB"
            >
              <j-dict-select-tag
                allow-clear
                placeholder="请选择可替换性"
                :disabled="formDisabled"
                :triggerChange="true"
                dictCode="ABC-standardB"
                v-model="model.standardB"
                @change="(e) =>standardResultCompute(e,'B')"
              />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-model-item
              label="故障影响度"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              prop="standardC"
            >
              <j-dict-select-tag
                allow-clear
                placeholder="请选择故障影响度"
                :disabled="formDisabled"
                :triggerChange="true"
                dictCode="ABC-standardC"
                v-model="model.standardC"
                @change="(e) =>standardResultCompute(e,'C')"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item
              label="生产超差度"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              prop="standardD"
            >
              <j-dict-select-tag
                allow-clear
                placeholder="请选择生产超差度"
                :disabled="formDisabled"
                :triggerChange="true"
                dictCode="ABC-standardD"
                v-model="model.standardD"
                @change="(e) =>standardResultCompute(e,'D')"
              />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-model-item
              label="故障频率"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              prop="standardE"
            >
              <j-dict-select-tag
                allow-clear
                placeholder="请选择故障频率"
                :disabled="formDisabled"
                :triggerChange="true"
                dictCode="ABC-standardE"
                v-model="model.standardE"
                @change="(e) =>standardResultCompute(e,'E')"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item
              label="设备价值"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              prop="standardF"
            >
              <j-dict-select-tag
                allow-clear
                placeholder="请选择设备价值"
                :disabled="formDisabled"
                :triggerChange="true"
                dictCode="ABC-standardF"
                v-model="model.standardF"
                @change="(e) =>standardResultCompute(e,'F')"
              />
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-form-model>
    </j-form-container>
      <!-- å­è¡¨å•区域 -->
    <a-tabs v-model="activeKey" @change="handleChangeTabs">
      <a-tab-pane tab="ABC评价" :key="refKeys[0]" :forceRender="true">
        <j-vxe-table
          keep-source
          :ref="refKeys[0]"
          :loading="aBCAssessmentTable.loading"
          :columns="aBCAssessmentTable.columns"
          :dataSource="aBCAssessmentTable.dataSource"
          :maxHeight="300"
          :disabled="formDisabled"
          :rowNumber="true"
          :rowSelection="true"
          :toolbar="true"
          :alwaysEdit="true"
          @valueChange="changeDate"
          :toolbarConfig="toolbarConfig"
          >
              <template slot="toolbarPrefix">
                <a-button type="primary" @click="selectEquipmentList" :disabled="formDisabled">选择设备
                </a-button>
              </template>
        </j-vxe-table>
      </a-tab-pane>
    </a-tabs>
    <equipment-select-model ref="EquipmentSelectModal" @selectionRows="addSelectedEquipments"></equipment-select-model>
  </a-spin>
</template>
<script>
  import { getAction } from '@/api/manage'
  import { JVxeTableModelMixin } from '@/mixins/JVxeTableModelMixin.js'
  import { JVXETypes } from '@/components/jeecg/JVxeTable'
  import { getRefPromise,VALIDATE_FAILED} from '@/components/jeecg/JVxeTable/utils/vxeUtils.js'
  import { validateDuplicateValue } from '@/utils/util'
  import JFormContainer from '@/components/jeecg/JFormContainer'
  import EquipmentSelectModel from './EquipmentSelectModel'
  export default {
    name: 'StreamForm',
    mixins: [JVxeTableModelMixin],
    components: {
      JFormContainer,
      EquipmentSelectModel
    },
    data() {
      return {
        toolbarConfig: {
        // prefix å‰ç¼€ï¼›suffix åŽç¼€
        slot: ['prefix', 'suffix'],
        // add æ–°å¢žæŒ‰é’®ï¼›remove åˆ é™¤æŒ‰é’®ï¼›clearSelection æ¸…空选择按钮
        btn: ['remove', 'clearSelection']
        },
        labelCol: {
          xs: { span: 24 },
          sm: { span: 5 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 },
        },
        model:{
         },
        // æ–°å¢žæ—¶å­è¡¨é»˜è®¤æ·»åŠ å‡ è¡Œç©ºæ•°æ®
        addDefaultRowNum: 0,
        validatorRules: {
        },
        refKeys: ['aBCAssessment' ],
        tableKeys:[ 'aBCAssessment' ],
        activeKey: 'streamOperation',
        // ABC评价
        aBCAssessmentTable: {
          loading: false,
          dataSource: [],
          columns: [
             {
              title: '统一编码',
              key: 'num',
               type: JVXETypes.normal,
              width:"250px",
              placeholder: '请输入${title}',
              disabled:true,
              align:'center',
              defaultValue:'',
            },
            {
              title: '设备名称',
              key: 'name',
               type: JVXETypes.normal,
              width:"250px",
              placeholder: '请输入${title}',
              disabled:true,
              align:'center',
              defaultValue:'',
            },
            {
              title: '设备型号',
              key: 'model',
               type: JVXETypes.normal,
              width:"250px",
              placeholder: '请输入${title}',
              disabled:true,
              align:'center',
              defaultValue:'',
            },
            {
              title: '设备ID',
              key: 'equipmentId',
               type: JVXETypes.hidden,
              width:"250px",
              placeholder: '请输入${title}',
              defaultValue:'',
              align:'center',
            },
            {
              title: '平均使用率',
              key: 'standardA',
              type: JVXETypes.select,
              width:"250px",
              placeholder: '请输入${title}',
              defaultValue:'',
              dictCode:'ABC-standardA',
              options:[],
              align:'center',
              validateRules: [
                  {
                    required: true, // å¿…å¡«
                    message: '请输入${title}' // æ˜¾ç¤ºçš„æ–‡æœ¬
                  },
              ]
            },
            {
              title: '可替换性',
              key: 'standardB',
              type: JVXETypes.select,
              width:"250px",
              placeholder: '请输入${title}',
              defaultValue:'',
              dictCode:'ABC-standardB',
              options:[],
              align:'center',
              validateRules: [
                  {
                    required: true, // å¿…å¡«
                    message: '请输入${title}' // æ˜¾ç¤ºçš„æ–‡æœ¬
                  },
              ]
            },
            {
              title: '故障影响度',
              key: 'standardC',
              type: JVXETypes.select,
              width:"250px",
              placeholder: '请输入${title}',
              defaultValue:'',
              dictCode:'ABC-standardC',
              options:[],
              align:'center',
              validateRules: [
                  {
                    required: true, // å¿…å¡«
                    message: '请输入${title}' // æ˜¾ç¤ºçš„æ–‡æœ¬
                  },
              ]
            },
            {
              title: '生产超差度',
              key: 'standardD',
              type: JVXETypes.select,
              width:"250px",
              placeholder: '请输入${title}',
              defaultValue:'',
              dictCode:'ABC-standardD',
              options:[],
              align:'center',
              validateRules: [
                  {
                    required: true, // å¿…å¡«
                    message: '请输入${title}' // æ˜¾ç¤ºçš„æ–‡æœ¬
                  },
              ]
            },
            {
              title: '故障频率',
              key: 'standardE',
              type: JVXETypes.select,
              width:"250px",
              placeholder: '请输入${title}',
              defaultValue:'',
              dictCode:'ABC-standardE',
              options:[],
              align:'center',
              validateRules: [
                  {
                    required: true, // å¿…å¡«
                    message: '请输入${title}' // æ˜¾ç¤ºçš„æ–‡æœ¬
                  },
              ]
            },
            {
              title: '设备价值',
              key: 'standardF',
              type: JVXETypes.select,
              width:"250px",
              placeholder: '请输入${title}',
              defaultValue:'',
              dictCode:'ABC-standardF',
              options:[],
              align:'center',
              validateRules: [
                  {
                    required: true, // å¿…å¡«
                    message: '请输入${title}' // æ˜¾ç¤ºçš„æ–‡æœ¬
                  },
              ]
            },
            {
              title: '旧标识',
              key: 'equipmentImportanceId',
              type: JVXETypes.select,
              width:"250px",
              disabled:true,
              placeholder: '请输入${title}',
              defaultValue:'',
              dictCode:'ABC-standard-result',
              options:[],
              align:'center',
            },
            {
              title: '新标识',
              key: 'finalStandard',
              type: JVXETypes.select,
              width:"250px",
              placeholder: '请输入${title}',
              defaultValue:'',
              dictCode:'ABC-standard-result',
              options:[],
              align:'center',
              validateRules: [
                  {
                    required: true, // å¿…å¡«
                    message: '请输入${title}' // æ˜¾ç¤ºçš„æ–‡æœ¬
                  },
              ]
            },
          ]
        },
        url: {
          add: "/eam/stream/add",
          edit: "/eam/stream/edit",
          queryById: "/eam/stream/queryById",
          getNum:'/eam/sysIdentity/getNumNew',
          aBCAssessment: {
            list: '/eam/stream/queryABCAssessmentByMainId'
          },
        }
      }
    },
    props: {
      //表单禁用
      disabled: {
        type: Boolean,
        default: false,
        required: false
      }
    },
    computed: {
      formDisabled(){
        return this.disabled
      },
    },
    created () {
    },
    methods: {
      addBefore(){
          let that = this;
          let param = {
              type: 'ABCAssement',
              length: 4
          };
          getAction(this.url.getNum,param).then(res=>{
              if(res.success){
                that.model.num = res.result;
              }
          })
          this.aBCAssessmentTable.dataSource=[]
      },
      getAllTable() {
        let values = this.tableKeys.map(key => getRefPromise(this, key))
        return Promise.all(values)
      },
      /** è°ƒç”¨å®Œedit()方法之后会自动调用此方法 */
      editAfter() {
        this.$nextTick(() => {
        })
        // åŠ è½½å­è¡¨æ•°æ®
        if (this.model.id) {
          let params = { id: this.model.id }
          this.requestSubTableData(this.url.aBCAssessment.list, params, this.aBCAssessmentTable)
        }
      },
      //校验所有一对一子表表单
        validateSubForm(allValues){
            return new Promise((resolve,reject)=>{
              Promise.all([
              ]).then(() => {
                resolve(allValues)
              }).catch(e => {
                if (e.error === VALIDATE_FAILED) {
                  // å¦‚果有未通过表单验证的子表,就自动跳转到它所在的tab
                  this.activeKey = e.index == null ? this.activeKey : this.refKeys[e.index]
                } else {
                  console.error(e)
                }
              })
            })
        },
      /** æ•´ç†æˆformData */
      classifyIntoFormData(allValues) {
        let main = Object.assign(this.model, allValues.formValue)
        return {
          ...main, // å±•å¼€
          assessmentList: allValues.tablesValue[0].tableData
        }
      },
      validateError(msg){
        this.$message.error(msg)
      },
      standardResultCompute(e,index) {
      let keyIndex = 'standard'+index;
      let tableData =this.$refs.aBCAssessment.getTableData();
      for(var i = 0;i<tableData.length;i++){
            let row = this.$refs.aBCAssessment.getRowById(tableData[i].equipmentId);
            row[keyIndex]=e
            this.changeDateByRow(row);
      }
      var standardA = this.model.standardA == null || this.model.standardA == undefined || this.model.standardA == '' ? 0 : parseInt(this.model.standardA);
      var standardB = this.model.standardB == null || this.model.standardB == undefined || this.model.standardB == '' ? 0 : parseInt(this.model.standardB);
      var standardC = this.model.standardA == null || this.model.standardC == undefined || this.model.standardC == '' ? 0 : parseInt(this.model.standardC);
      var standardD = this.model.standardD == null || this.model.standardD == undefined || this.model.standardD == '' ? 0 : parseInt(this.model.standardD);
      var standardE = this.model.standardE == null || this.model.standardE == undefined || this.model.standardE == '' ? 0 : parseInt(this.model.standardE);
      var standardF = this.model.standardF == null || this.model.standardF == undefined || this.model.standardF == '' ? 0 : parseInt(this.model.standardF);
      var sum = standardA + standardB + standardC + standardD + standardE + standardF;
      console.log(sum)
      if (sum >= 18) {
        this.model.finalStandard = 'A'
      } else if (sum >= 10 && sum <= 17) {
        this.model.finalStandard = 'B'
      } else {
        this.model.finalStandard = 'C'
      }
      this.model = Object.assign({}, this.model);
      },
        //选择设备
        selectEquipmentList() {
        let ids = []
        let tableData = this.$refs.aBCAssessment.getTableData()
        let deleteData = this.$refs.aBCAssessment.getDeleteData()
        for (let i = 0; i < tableData.length; i++) {
          ids.push(tableData[i].equipmentId)
        }
        this.$refs.EquipmentSelectModal.showModals(ids)
        this.$refs.EquipmentSelectModal.title = '选择设备'
        this.$refs.EquipmentSelectModal.disableSubmit = false
      },
      addSelectedEquipments(data) {
        let tableData = this.$refs.aBCAssessment.getTableData()
        // const seletedEquipmentIds = tableData.
        var tableStr = JSON.stringify(tableData)
        const addRows = []
        for (let i = 0; i < data.length; i++) {
          var equipment = {}
          if (tableStr.indexOf(data[i].id)==-1) {
            equipment = {
              id:data[i].id,
              equipmentId: data[i].id,
              num: data[i].num,
              name: data[i].name,
              model:data[i].model,
              equipmentImportanceId:data[i].equipmentImportanceId,
            }
          }
          addRows.push(equipment)
        }
        this.$refs.aBCAssessment.pushRows(addRows)
      },
      changeDate(target){
            var standardA = target.row.standardA == null || target.row.standardA == undefined || target.row.standardA == '' ? 0 : parseInt(target.row.standardA);
            var standardB = target.row.standardB == null || target.row.standardB == undefined || target.row.standardB == '' ? 0 : parseInt(target.row.standardB);
            var standardC = target.row.standardA == null || target.row.standardC == undefined || target.row.standardC == '' ? 0 : parseInt(target.row.standardC);
            var standardD = target.row.standardD == null || target.row.standardD == undefined || target.row.standardD == '' ? 0 : parseInt(target.row.standardD);
            var standardE = target.row.standardE == null || target.row.standardE == undefined || target.row.standardE == '' ? 0 : parseInt(target.row.standardE);
            var standardF = target.row.standardF == null || target.row.standardF == undefined || target.row.standardF == '' ? 0 : parseInt(target.row.standardF);
            var sum = standardA + standardB + standardC + standardD + standardE + standardF;
            console.log(sum)
            if (sum >= 18) {
              target.row.finalStandard = 'A'
            } else if (sum >= 10 && sum <= 17) {
              target.row.finalStandard = 'B'
            } else {
              target.row.finalStandard = 'C'
            }
        },
        changeDateByRow(row){
            var standardA = row.standardA == null || row.standardA == undefined || row.standardA == '' ? 0 : parseInt(row.standardA);
            var standardB = row.standardB == null || row.standardB == undefined || row.standardB == '' ? 0 : parseInt(row.standardB);
            var standardC = row.standardA == null || row.standardC == undefined || row.standardC == '' ? 0 : parseInt(row.standardC);
            var standardD = row.standardD == null || row.standardD == undefined || row.standardD == '' ? 0 : parseInt(row.standardD);
            var standardE = row.standardE == null || row.standardE == undefined || row.standardE == '' ? 0 : parseInt(row.standardE);
            var standardF = row.standardF == null || row.standardF == undefined || row.standardF == '' ? 0 : parseInt(row.standardF);
            var sum = standardA + standardB + standardC + standardD + standardE + standardF;
            if (sum >= 18) {
              row.finalStandard = 'A'
            } else if (sum >= 10 && sum <= 17) {
              row.finalStandard = 'B'
            } else {
              row.finalStandard = 'C'
            }
        },
    }
  }
</script>
<style scoped>
</style>
src/views/eam/ABC/modules/StreamModal.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,65 @@
<template>
  <j-modal
    :title="title"
    :width="1200"
    :visible="visible"
    :maskClosable="false"
    switchFullscreen
    :fullscreen="true"
    @ok="handleOk"
    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
    @cancel="handleCancel">
    <stream-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"/>
  </j-modal>
</template>
<script>
  import StreamForm from './StreamForm'
  export default {
    name: 'StreamModal',
    components: {
      StreamForm
    },
    data() {
      return {
        title:'',
        width:800,
        visible: false,
        disableSubmit: false
      }
    },
    methods:{
      add () {
        this.visible=true
        this.$nextTick(()=>{
          this.$refs.realForm.add();
        })
      },
      edit (record) {
        this.visible=true
        this.$nextTick(()=>{
          this.$refs.realForm.edit(record);
        })
      },
      close () {
        this.$emit('close');
        this.visible = false;
      },
      handleOk () {
        this.$refs.realForm.handleOk();
      },
      submitCallback(){
        this.$emit('ok');
        this.visible = false;
      },
      handleCancel () {
        this.close()
      }
    }
  }
</script>
<style scoped>
</style>