From 92ff846fb659c62037a32b1d8c15eae9df9d9b54 Mon Sep 17 00:00:00 2001
From: zenglf <18502938215@163.com>
Date: 星期一, 18 九月 2023 13:24:30 +0800
Subject: [PATCH] Merge branch 'develop' of http://117.34.109.166:18448/r/vue_mdc_430

---
 src/views/eam/modules/faultCause/FaultCause2List.vue |  454 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 454 insertions(+), 0 deletions(-)

diff --git a/src/views/eam/modules/faultCause/FaultCause2List.vue b/src/views/eam/modules/faultCause/FaultCause2List.vue
new file mode 100644
index 0000000..fa68cdb
--- /dev/null
+++ b/src/views/eam/modules/faultCause/FaultCause2List.vue
@@ -0,0 +1,454 @@
+<template>
+  <a-card
+    :bordered="false"
+    class="card-area"
+  >
+    <template slot="title">
+      <i
+        class="action-jeecg actionsite2"
+        style="font-size: 18px;"
+      />
+      鍘熷洜鏄庣粏
+    </template>
+    <!-- 鏌ヨ鍖哄煙 -->
+    <div class="table-page-search-wrapper">
+      <!-- 鎼滅储鍖哄煙 -->
+      <a-form
+        layout="inline"
+        @keyup.enter.native="searchQuery"
+      >
+        <a-row :gutter="24">
+          <a-col
+            :md="8"
+            :sm="8"
+          >
+            <a-form-item label="鏁呴殰鍘熷洜缂栧彿">
+              <a-input
+                placeholder="璇疯緭鍏ユ晠闅滃師鍥犵紪鍙锋煡璇�"
+                v-model="queryParam.num"
+              ></a-input>
+            </a-form-item>
+          </a-col>
+          <a-col
+            :md="8"
+            :sm="8"
+          >
+            <a-form-item label="鏁呴殰鍘熷洜鍚嶇О">
+              <a-input
+                placeholder="璇疯緭鍏ユ晠闅滃師鍥犲悕绉版煡璇�"
+                v-model="queryParam.name"
+              ></a-input>
+            </a-form-item>
+          </a-col>
+        </a-row>
+      </a-form>
+    </div>
+
+    <!-- 鎿嶄綔鎸夐挳鍖哄煙 -->
+    <div
+      class="table-operator"
+      style="margin-top: 5px"
+    >
+      <a-button
+        type="primary"
+        @click="searchQuery"
+        icon="search"
+      >鏌ヨ</a-button>
+      <a-button
+        @click="searchReset"
+        icon="reload"
+      >閲嶇疆</a-button>
+      <a-button
+        @click="handleAdd"
+        type="primary"
+        icon="plus"
+      >鏂板</a-button>
+      <a-button
+        type="primary"
+        icon="download"
+        @click="handleExportXls('鍘熷洜')"
+      >瀵煎嚭</a-button>
+      <a-dropdown v-if="selectedRowKeys.length > 0">
+        <a-button style="margin-left: 8px">
+          鎵归噺鎿嶄綔
+          <a-icon type="down" />
+        </a-button>
+        <a-menu slot="overlay">
+          <a-menu-item @click="batchDel">
+            <a-icon type="delete" />鍒犻櫎
+          </a-menu-item>
+        </a-menu>
+      </a-dropdown>
+    </div>
+
+    <a-table
+      ref="table"
+      bordered
+      size="middle"
+      rowKey="id"
+      :columns="columns"
+      :dataSource="dataSource"
+      :pagination="ipagination"
+      :loading="loading"
+      :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, getCheckboxProps:getCheckboxProps}"
+      @change="handleTableChange"
+      :scroll="{ x: true}"
+    >
+      <template slot="num" slot-scope="text" >
+        <a-tooltip placement="top" :title="text" trigger="hover">
+          <div>
+            <template slot="title"> </template>
+            <p style="cusor:pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; width: 130px;">{{ text }}</p>
+          </div>
+        </a-tooltip>
+      </template>
+      <template slot="name" slot-scope="text" >
+        <a-tooltip placement="top" :title="text" trigger="hover">
+          <div>
+            <template slot="title"> </template>
+            <p style="cusor:pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; width: 130px;">{{ text }}</p>
+          </div>
+        </a-tooltip>
+      </template>
+      <!--鐘舵�佹爮涓�у睍绀�-->
+      <!-- <span
+        slot="status"
+        slot-scope="text,record"
+      >
+        <a-badge
+          v-if="record.status==1"
+          status="success"
+        />
+        <span
+          v-if="record.status==1"
+          class="success"
+        >鍚敤</span>
+        <a-badge
+          v-if="record.status==0"
+          status="error"
+        />
+        <span
+          v-if="record.status==0"
+          class="error"
+        >绂佺敤</span>
+      </span> -->
+
+      <span
+        slot="action"
+        slot-scope="text, record"
+      >
+        <!-- class="table-operation" -->
+        <a
+          href="javascript:;"
+          @click="handleDetail(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 @click="handleEdit(record)">缂栬緫</a>
+            </a-menu-item>
+
+            <a-menu-item v-if="record.faultCauseDtlList.length==0">
+              <a-popconfirm
+                title="纭畾鍒犻櫎鍚�?"
+                @confirm="() => handleDelete(record.id)"
+              >
+                <a>鍒犻櫎</a>
+              </a-popconfirm>
+            </a-menu-item>
+            <a-menu-item v-else>
+              <a-popconfirm title="褰撳墠淇℃伅宸茶寮曠敤锛岃鍏堝垹闄ゅ叧鑱斾俊鎭悗鍐嶆墽琛屽垹闄ゆ搷浣�">
+                <a class="frozenRowClass">鍒犻櫎</a>
+              </a-popconfirm>
+            </a-menu-item>
+
+            <!-- <a-menu-item v-if="record.status==1">
+              <a-popconfirm
+                title="纭畾绂佺敤鍚�?"
+                @confirm="() => handleActive(record.id)"
+              >
+                <a>绂佺敤</a>
+              </a-popconfirm>
+            </a-menu-item> -->
+            <!-- <a-menu-item v-if="record.status==0">
+              <a-popconfirm
+                title="纭畾鍚敤鍚�?"
+                @confirm="() => handleActive(record.id)"
+              >
+                <a>鍚敤</a>
+              </a-popconfirm>
+            </a-menu-item> -->
+          </a-menu>
+        </a-dropdown>
+      </span>
+
+    </a-table>
+    <fault-cause-model
+      ref="modalForm"
+      @ok="modalFormOk"
+    ></fault-cause-model>
+  </a-card>
+</template>
+
+<script>
+import { requestPut, deleteAction } from '@/api/manage'
+import { JeecgListMixin } from '@/mixins/JeecgListMixin'
+import FaultCauseModel from './FaultCauseModel'
+import JInput from '@/components/jeecg/JInput'
+import JEllipsis from '@/components/jeecg/JEllipsis'
+
+export default {
+  name: 'FaultCause2List',
+  mixins: [JeecgListMixin],
+  components: {
+    FaultCauseModel,
+    JInput,
+    JEllipsis,
+  },
+  props: {
+    nodeSelected: {
+      type: Object,
+      default: {}
+    }
+  },
+  data() {
+    return {
+      // dataSource: [],
+      //榛樿鎺掑簭
+      isorter: {
+        column: 'num',
+        order: 'asc',
+      },
+
+      columns: [
+        {
+          title: '#',
+          dataIndex: '',
+          key: 'rowIndex',
+          align: 'center',
+          customRender: function (t, r, index) {
+            return parseInt(index) + 1
+          },
+          width: 50,
+        },
+        {
+          title: '鏁呴殰鍘熷洜缂栫爜',
+          align: "center",
+          dataIndex: 'num',
+          width: 100,
+          scopedSlots: {
+            customRender: 'num'
+          },
+          ellipsis: true,
+        },
+        {
+          title: '鏁呴殰鍘熷洜鍚嶇О',
+          width: 100,
+          align: "center",
+          dataIndex: 'name',
+          scopedSlots: {
+            customRender: 'name'
+          },
+          ellipsis: true,
+        },
+        {
+          title: '鏁呴殰鍘熷洜鍒嗙被',
+          align: "center",
+          dataIndex: 'parentName',
+        },
+        {
+          title: '鍒涘缓浜�',
+          align: "center",
+          dataIndex: 'createBy',
+        },
+        {
+          title: '鍒涘缓鏃堕棿',
+          align: "center",
+          dataIndex: 'createTime',
+        },
+        {
+          title: '淇敼浜�',
+          align: "center",
+          dataIndex: 'updateBy',
+        },
+        {
+          title: '淇敼鏃堕棿',
+          align: "center",
+          dataIndex: 'updateTime',
+        },
+
+        // {
+        //   title: '鐘舵��',
+        //   align: 'center',
+        //   dataIndex: 'status',
+        //   scopedSlots: {
+        //     customRender: 'status',
+        //   },
+        //   sorter: true,
+        //   width: 100,
+        // },
+        {
+          title: '鎿嶄綔',
+          align: "center",
+          dataIndex: 'action',
+          scopedSlots: {
+            customRender: 'action',
+          },
+          width: 150,
+          fixed: 'right',
+        },
+      ],
+      url: {
+        list: "/eam/faultCause/list",
+        delete: "/eam/faultCause/delete",
+        deleteBatch: "/eam/faultCause/deleteBatch",
+        active: "/eam/faultCause/active",
+        exportXlsUrl: '/eam/faultCause/exportXls',
+        // importExcelUrl: 'base/site/importExcel',
+      },
+      //鏂板銆佺紪杈戙�佸垹闄ゃ�佹壒閲忓垹闄ゆ搷浣滄敼鍙樻暟鎹悗鍒锋柊鍏宠仈鐨勭粍浠剁殑鐩戝惉灞炴��
+      alterFlag: "",
+      parentNum: "-1",
+      parentName: "鏁呴殰鍘熷洜",
+    };
+  },
+  methods: {
+
+    getCheckboxProps(record) {
+      return ({
+        props: {
+          disabled: !(record.faultCauseDtlList.length == 0),
+        }
+      })
+    },
+
+    //绂佺敤鐘舵�佹牱寮�
+    tableRowClass(record, index) {
+      if (record.status != "1") {
+        return "frozenRowClass";
+      }
+      return "";
+    },
+
+    handleActive(id) {
+      let that = this;
+      requestPut(that.url.active, {}, { id: id }).then((res) => {
+        if (res.success) {
+          that.$message.success(res.message);
+          that.loadData();
+        } else {
+          that.$message.warning(res.message);
+        }
+      });
+    },
+    handleAdd: function () {
+      this.$refs.modalForm.add({ parentNum: this.parentNum, parentName: this.parentName });
+      this.$refs.modalForm.title = "鏂板";
+      this.$refs.modalForm.disableSubmit = false;
+      this.$refs.modalForm.parentId = this.nodeSelected.key;
+    },
+    handleDelete: function (id) {
+      if (!this.url.delete) {
+        this.$message.error("璇疯缃畊rl.delete灞炴��!")
+        return
+      }
+      var that = this;
+      deleteAction(that.url.delete, { id: id }).then((res) => {
+        if (res.success) {
+          //閲嶆柊璁$畻鍒嗛〉闂
+          that.reCalculatePage(1)
+          that.$message.success(res.message);
+          that.loadData();
+          that.alterFlag = new Date();
+        } else {
+          that.$message.warning(res.message);
+        }
+      });
+    },
+
+    batchDel: function () {
+      if (!this.url.deleteBatch) {
+        this.$message.error("璇疯缃畊rl.deleteBatch灞炴��!")
+        return
+      }
+      if (this.selectedRowKeys.length <= 0) {
+        this.$message.warning('璇烽�夋嫨涓�鏉¤褰曪紒');
+        return;
+      } else {
+        var ids = "";
+        for (var a = 0; a < this.selectedRowKeys.length; a++) {
+          ids += this.selectedRowKeys[a] + ",";
+        }
+        var that = this;
+        this.$confirm({
+          title: "纭鍒犻櫎",
+          content: "鏄惁鍒犻櫎閫変腑鏁版嵁?",
+          onOk: function () {
+            that.loading = true;
+            deleteAction(that.url.deleteBatch, { ids: ids }).then((res) => {
+              if (res.success) {
+                //閲嶆柊璁$畻鍒嗛〉闂
+                that.reCalculatePage(that.selectedRowKeys.length)
+                that.$message.success(res.message);
+                that.loadData();
+                that.onClearSelected();
+                that.alterFlag = new Date();
+              } else {
+                that.$message.warning(res.message);
+              }
+            }).finally(() => {
+              that.loading = false;
+            });
+          }
+        });
+      }
+    },
+
+    searchReset() {
+      this.queryParam = {};
+      this.queryParam.id = this.nodeSelected.key;
+      this.loadData(1);
+    },
+  },
+  watch: {
+    alterFlag() {
+      this.$bus.$emit('queryTreeData');
+    },
+    nodeSelected() {
+      this.queryParam = {};
+      this.queryParam.id = this.nodeSelected.key;
+      this.parentNum = !this.nodeSelected.rfield1 ? '-1' : this.nodeSelected.rfield1;
+      this.parentName = !this.nodeSelected.rfield2 ? '鏁呴殰鍘熷洜' : this.nodeSelected.rfield2;
+      this.loadData(1);
+    },
+  },
+  created() {
+    this.queryParam = {};
+    this.queryParam.id = this.nodeSelected.key;
+    this.loadData(1);
+  }
+
+
+}
+</script>
+<style>
+@import '~@assets/less/common.less';
+
+.frozenRowClass {
+  color: #c9c9c9;
+}
+.success {
+  color: green;
+}
+.error {
+  color: red;
+}
+.fontweight {
+  font-weight: bold;
+}
+</style>
\ No newline at end of file

--
Gitblit v1.9.3