Browse Source

修改弹窗确认

shaun-sheep 5 years ago
parent
commit
e419777571
2 changed files with 60 additions and 57 deletions
  1. 6 6
      package.json
  2. 54 51
      src/views/relation/relationShip/index.vue

+ 6 - 6
package.json

@@ -19,21 +19,21 @@
     "publish": "node publish.js"
   },
   "dependencies": {
+    "@saga-web/base": "2.1.9",
+    "@saga-web/cad-engine": "2.0.537",
+    "@saga-web/draw": "2.1.75",
+    "@saga-web/graphy": "2.1.40",
     "axios": "^0.18.0",
     "echarts": "^4.1.0",
     "el-cascader-multi": "^1.1.8",
-    "element-ui": "^2.11.0",
+    "element-ui": "^2.11.1",
     "font-awesome": "^4.7.0",
     "handsontable-pro": "^3.0.0",
     "jquery": "^3.3.1",
     "vue": "^2.5.2",
     "vue-axios": "^2.1.4",
     "vue-router": "^3.0.1",
-    "vuex": "^3.1.0",
-    "@saga-web/base": "2.1.9",
-    "@saga-web/draw": "2.1.75",
-    "@saga-web/graphy": "2.1.40",
-    "@saga-web/cad-engine": "2.0.537"
+    "vuex": "^3.1.0"
   },
   "devDependencies": {
     "ajv": "^6.9.1",

+ 54 - 51
src/views/relation/relationShip/index.vue

@@ -100,7 +100,6 @@
       <el-table
         :data="tableData"
         :span-method="objectSpanMethod"
-
         :header-cell-style="{background:'#e1e4e5',color:'#2b2b2b', lineHeight: '30px'}"
         :cell-style="cellStyle"
         class="table"
@@ -191,30 +190,51 @@
           align="left"
         >
           <template slot-scope="scope">
-            <!--            <el-button-->
-            <!--              size="mini"-->
-            <!--              icon="el-icon-delete"-->
-            <!--              @click="deleteObject(scope.$index, scope.row)">-->
-            <!--            </el-button>-->
-            <el-popconfirm
-              title="确定删除吗?"
-              @onConfirm="deleteObject(scope.$index, scope.row)"
-            >
-              <el-button slot="reference" size="mini" icon="el-icon-delete"/>
-            </el-popconfirm>
+            <!--            <el-popconfirm-->
+            <!--              title="确定删除吗?"-->
+            <!--              @onConfirm="deleteObject(scope.$index, scope.row)"-->
+            <!--            >-->
+            <!--              <el-button slot="reference" size="mini" icon="el-icon-delete"/>-->
+            <!--            </el-popconfirm>-->
+            <!--          </template>-->
+
+            <!--            <el-popover-->
+            <!--              placement="button"-->
+            <!--              width="160"-->
+            <!--              v-model="visible">-->
+            <!--              <p>确定删除吗?</p>-->
+            <!--              <div style="text-align: right; margin: 0">-->
+            <!--                <el-button size="mini" type="text" @click="visible = false">取消</el-button>-->
+            <!--                <el-button type="primary" size="mini" @click="deleteObject(scope.$index, scope.row)">确定</el-button>-->
+            <!--              </div>-->
+            <!--              <el-button slot="reference" size="mini" icon="el-icon-delete"/>-->
+            <!--            </el-popover>-->
+            <el-button slot="reference" size="mini" icon="el-icon-delete"
+                       @click="deleteObject(scope.$index, scope.row)"/>
           </template>
         </el-table-column>
       </el-table>
     </section>
     <!-- 分页 -->
-<!--    <el-pagination-->
-<!--      @size-change="handleSizeChange"-->
-<!--      @current-change="handleCurrentChange"-->
-<!--      :current-page="currentPage"-->
-<!--      :page-sizes="pageSizes"-->
-<!--      :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total"-->
-<!--      style="float:right;margin-top:10px;padding:2px 5px;">-->
-<!--    </el-pagination>-->
+    <!--    <el-pagination-->
+    <!--      @size-change="handleSizeChange"-->
+    <!--      @current-change="handleCurrentChange"-->
+    <!--      :current-page="currentPage"-->
+    <!--      :page-sizes="pageSizes"-->
+    <!--      :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total"-->
+    <!--      style="float:right;margin-top:10px;padding:2px 5px;">-->
+    <!--    </el-pagination>-->
+    <el-dialog
+      title="提示"
+      :visible.sync="visible"
+      width="30%"
+    >
+      <span>确定删除吗?</span>
+      <span slot="footer" class="dialog-footer">
+    <el-button @click="visible = false">取 消</el-button>
+    <el-button type="primary" @click="confirmDelete">确 定</el-button>
+  </span>
+    </el-dialog>
     <exportExcel
       ref="export"
       :values="values"
@@ -236,12 +256,13 @@
   import exportExcel from "../../../components/relation/relationShip/Modal/exportExcel";
   import addRelationShip from "../../../components/relation/relationShip/Modal/addRelationShip";
   import editRelationShip from "../../../components/relation/relationShip/Modal/editRelationShip";
-  import {relAdd, relDelete, relQuery} from "../../../api/relation/api";
+  import {relDelete, relQuery} from "../../../api/relation/api";
 
   export default {
     name: "index",
     data() {
       return {
+        visible: false,
         MainObject: `(限制条件:对象类型的范围(包括:${localStorage.getItem('MainObject')}类型)`,
         FromObject: `(限制条件:对象类型的范围(包括:${localStorage.getItem('FromObject')}类型)`,
         pageSizes: [10, 20, 50, 100],
@@ -319,9 +340,9 @@
           }]
         }],
         tableData: [],
-
+        delParam: {},
         loading: false,
-        needMergeArr: ['Name', 'LocalId', 'LocalName', 'CADID','btn'],
+        needMergeArr: ['Name', 'LocalId', 'LocalName', 'CADID', 'btn'],
         rowMergeArrs: {}
         // needMergeArr: ['name', 'id'], // 有合并项的列
         // rowMergeArrs: {}, // 包含需要一个或多个合并项信息的对象
@@ -431,31 +452,6 @@
           console.log(res, '==object==')
         })
       },
-  //     addShip(index) {
-  //       let that = this
-  //       relAdd(index).then(res => {
-  //         if (res.data.Result === "failure") {
-  //           if(res.data.ErrorType == 1) {
-  //             this.mainError = res.data.Message
-  //             debugger
-  //           } else if(res.data.ErrorType == 2) {
-  //
-  //           } else {
-  //             debugger
-  //             this.$message.error(res.data.Message);
-  //
-  //           }
-  //
-  //     } else if (res.data.Result === "success") {
-  //   this.$message.success(res.data.Message);
-  //   this.init()
-  //   that.$refs.addShipComponent.addShipDialog = false
-  //   that.$refs.addShipComponent.codeValue = ''
-  //   that.$refs.addShipComponent.ruleForm.codeList = [{value:''}]
-  //   that.$refs.addShipComponent.ruleForm.main = ''
-  // }
-  // })
-  //     },
       //分页更换size
       handleSizeChange(val) {
         this.currentPage = 1;
@@ -477,14 +473,21 @@
         // this.$refs.editShipComponent.editShipDialog = true
       },
       deleteObject(index, row) {
-
-        let param = {
+        this.visible = true
+        this.delParam = {
           "FromId": row.Id,
           "RelType": localStorage.getItem('RelManualType'),
           "ToId": row.cId
         }
-        relDelete(param, res => {
+        // relDelete(param, res => {
+        //   this.init()
+        // })
+      },
+      confirmDelete() {
+        relDelete(this.delParam, res => {
           this.init()
+          this.visible = false
+          this.$message.success('删除成功')
         })
       },
       cellStyle({row, column, rowIndex, columnIndex}) {