From f09e05514d9a9e2623cfa73c4de1ffa98bb30bf8 Mon Sep 17 00:00:00 2001
From: xiejun <xiejun@vci-tech.com>
Date: 星期二, 23 一月 2024 10:09:07 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 Source/UBCS-WEB/src/views/modeling/Version.vue |  277 +++++++++++++++++++++++++++++++++---------------------
 1 files changed, 169 insertions(+), 108 deletions(-)

diff --git a/Source/UBCS-WEB/src/views/modeling/Version.vue b/Source/UBCS-WEB/src/views/modeling/Version.vue
index 929a250..74baaf3 100644
--- a/Source/UBCS-WEB/src/views/modeling/Version.vue
+++ b/Source/UBCS-WEB/src/views/modeling/Version.vue
@@ -5,148 +5,199 @@
                :data="data"
                :option="option"
                :page.sync="page"
+               :permission="permissionList"
                @on-load="getList"
                @row-update="rowUpdate"
                @row-save="rowSave"
                @row-del="rowDel"
                @refresh-change="refreshChange"
                @search-reset="searchChange"
-               @search-change="searchChange">
+               @search-change="searchChange"
+               @row-click="rowClick">
       <template slot="menuLeft">
-        <el-tooltip class="item" effect="dark" content="鏌ユ壘鐗堟湰瑙勫垯浣跨敤鑼冨洿" placement="top">
-          <el-button size="small"
-                     plain
-                     type="primary"
+        <el-tooltip class="item" content="鏌ユ壘鐗堟湰瑙勫垯浣跨敤鑼冨洿" effect="dark" placement="top">
+          <el-button v-if="permissionList.apply"
                      icon="el-icon-zoom-in"
-                     @click="handleSearch">鏌ョ湅浣跨敤鑼冨洿
+                     plain
+                     size="small"
+                     type="primary"
+                     @click="applyRangeSearch">鏌ョ湅浣跨敤鑼冨洿
           </el-button>
         </el-tooltip>
-      </template>>
+      </template>
+      <template slot="radio"
+                slot-scope="{row}">
+        <el-radio v-model="selectRow"
+                  :label="row.$index">&nbsp;
+        </el-radio>
+      </template>
     </avue-crud>
-    <el-dialog title="鏌ョ湅浣跨敤鑼冨洿"
-               append-to-body
-               :visible.sync="packageSearchBox"
-               width="1200px">
-      <versionpackage></versionpackage>
-    </el-dialog>
+    <versionpackage ref="applyRange" :rangeData="applyRangeData"></versionpackage>
   </basic-container>
 
 </template>
 
 <script>
+import {getPage, add, update, remove, getAppayRange} from '../../api/omd/revisionRule';
+import {mapGetters} from "vuex";
+
 export default {
   name: "Version",
-  data(){
+  data() {
     return {
       //鏌ョ湅浣跨敤鑼冨洿
-      packageSearchBox:false,
+      packageSearchBox: false,
+      // 鐐瑰嚮鏁版嵁
+      selectRow: '',
+      selectRowData: {},
       //鍒嗛〉鏁版嵁
       page: {
         pageSize: 10,
         currentPage: 1,
         total: 100
       },
-      data:[
-        {
-          name:"娴嬭瘯1",
-          tag:"娴嬭瘯",
-          char:"娴嬭瘯",
-          Initial:"娴嬭瘯",
-          Step:"娴嬭瘯",
-          prefix:"娴嬭瘯",
-          suffix:"娴嬭瘯",
-          desc:"娴嬭瘯"
-        },
-        {
-          name:"娴嬭瘯2",
-          tag:"娴嬭瘯",
-          char:"娴嬭瘯",
-          Initial:"娴嬭瘯",
-          Step:"娴嬭瘯",
-          prefix:"娴嬭瘯",
-          suffix:"娴嬭瘯",
-          desc:"娴嬭瘯"
-        },
-        {
-          name:"娴嬭瘯3",
-          tag:"娴嬭瘯",
-          char:"娴嬭瘯",
-          Initial:"娴嬭瘯",
-          Step:"娴嬭瘯",
-          prefix:"娴嬭瘯",
-          suffix:"娴嬭瘯",
-          desc:"娴嬭瘯"
-        }
-      ],
-      form:{},
-      option:{
-        headerAlign:'center',
+      data: [],
+      form: {},
+      option: {
+        height: 'auto',
+        calcHeight: 20,
+        headerAlign: 'center',
         align: 'center',
         border: true,
         index: true,
-        searchMenuSpan:5,
-        column:[
+        searchMenuSpan: 5,
+        highlightCurrentRow: true,
+        stripe: true,
+        viewBtn: false,
+        columnBtn: false,
+        column: [
           {
-            label:"鍚嶇О",
-            prop:"name",
-            search:true,
+            label: '閫夋嫨',
+            prop: 'radio',
+            width: 120,
+            display: false
           },
           {
-            label: "鏍囩",
-            prop:"tag"
+            label: '鑻辨枃鍚嶇О',
+            prop: 'id',
+            editDisabled: true,
+            rules: [
+              {
+                required: true,
+                message: '鑻辨枃鍚嶇О涓嶈兘涓虹┖',
+                trigger: 'blur'
+              }
+            ]
           },
           {
-            label:"璺宠穬瀛楃",
-            prop:"char"
+            label: "涓枃鍚嶇О",
+            prop: "name",
+            search: true,
+            required: true,
+            rules: [
+              {
+                required: true,
+                message: '涓枃鍚嶇О涓嶈兘涓虹┖',
+                trigger: 'blur'
+              }
+            ]
           },
+          // {
+          //   label:"璺宠穬瀛楃",
+          //   prop: "skipCode"
+          // },
           {
             label: "鍒濆鍊�",
-            prop:"Initial"
+            prop: "startCode",
+            type: 'number',
+            min: 1,
+            max: 99999,
+            rules: [
+              {
+                required: true,
+                message: '鍒濆鍊间笉鑳戒负绌�',
+                trigger: 'blur'
+              }
+            ]
           },
           {
-            label:"姝ラ暱",
-            prop:"Step"
+            label: "姝ラ暱",
+            prop: "serialStep",
+            type: 'number',
+            min: 1,
+            max: 99999,
+            rules: [
+              {
+                required: true,
+                message: '姝ラ暱涓嶈兘涓虹┖',
+                trigger: 'blur'
+              }
+            ]
           },
-          {
-            label: "鍓嶇紑",
-            prop:"prefix"
-          },
-          {
-            label: "鍚庣紑",
-            prop: "suffix"
-          },
+          // {
+          //   label: "鍓嶇紑",
+          //   prop:"prefixCode"
+          // },
+          // {
+          //   label: "鍚庣紑",
+          //   prop: "suffixCode"
+          // },
           {
             label: "鎻忚堪",
-            prop:"desc",
-            type:"textarea"
+            prop: "description",
+            type: "textarea"
           }
         ]
+      },
+      applyRangeData: []
+    }
+  },
+  computed: {
+    ...mapGetters(["permission"]),
+    permissionList() {
+      return {
+        addBtn: this.vaildData(this.permission.modeling_Version.version_add, false),
+        apply: this.vaildData(this.permission.modeling_Version.version_applyopen, false),
+        delBtn: this.vaildData(this.permission.modeling_Version.version_delete, false),
+        editBtn: this.vaildData(this.permission.modeling_Version.version_edit, false),
       }
     }
   },
-  methods:{
-    handleSearch(){
-      this.packageSearchBox=true
+  methods: {
+    // 琛岀偣鍑�
+    rowClick(row) {
+      this.selectRow = row.$index;
+      this.selectRowData = row;
     },
-    // getList() {
-    //   this.loading = true;
-    //   const data = Object.assign({
-    //     pageNum: this.page.currentPage,
-    //     pageSize: this.page.pageSize,
-    //   }, this.params)
-    //   this.data = [];
-    //   getList(data).then(res => {
-    //     const data = res.data.data
-    //     this.loading = false;
-    //     this.page.total = data.total;
-    //     const result = data.list;
-    //     this.data = result;
-    //   })
-    // },
+    // 鏌ョ湅搴旂敤鑼冨洿
+    applyRangeSearch() {
+      if (this.selectRow === '') {
+        this.$message({
+          type: "warning",
+          message: "璇峰厛閫夋嫨灞炴��"
+        })
+        return
+      }
+        getAppayRange(this.selectRowData.id).then(res => {
+          this.applyRangeData = res.data.data;
+          this.$refs.applyRange.rangeData = this.applyRangeData;
+          this.$refs.applyRange.showDialog = true;
+        })
+
+
+      // this.packageSearchBox=true
+    },
+    getList() {
+      this.loading = true;
+      getPage(this.page.currentPage, this.page.pageSize, this.params).then(res => {
+        const data = res.data.data
+        this.loading = false;
+        this.page.total = data.total;
+        this.data = data.records;
+      })
+    },
     rowSave(row, done, loading) {
-      add(Object.assign({
-        createUser: this.userInfo.name
-      }, row)).then(() => {
+      add(row).then(() => {
         this.$message.success('鏂板鎴愬姛')
         done();
         this.getList();
@@ -155,15 +206,19 @@
       })
     },
     rowUpdate(row, index, done, loading) {
-      update(Object.assign({
-        updateUser: this.userInfo.name
-      }, row)).then(() => {
-        this.$message.success('淇敼鎴愬姛')
-        done()
-        this.getList();
-      }).catch(() => {
-        loading()
-      })
+      console.log(row);
+      const date = new Date(row.ts);
+      const formattedDate = `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')} ${date.getHours().toString().padStart(2, '0')}:${date.getMinutes().toString().padStart(2, '0')}:${date.getSeconds().toString().padStart(2, '0')}.${date.getMilliseconds().toString().padStart(3, '0')}`;
+      row.ts = formattedDate;
+      update(row)
+        .then(() => {
+          this.$message.success('淇敼鎴愬姛');
+          done();
+          this.getList();
+        })
+        .catch(() => {
+          loading();
+        });
     },
     rowDel(row) {
       this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎, 鏄惁缁х画?', '鎻愮ず', {
@@ -171,18 +226,24 @@
         cancelButtonText: '鍙栨秷',
         type: 'warning'
       }).then(() => {
-        return del(row.id)
+        console.log(row);
+        return remove({oid: row.oid})
       }).then(() => {
         this.$message.success('鍒犻櫎鎴愬姛')
         this.getList();
       })
     },
     searchChange(params, done) {
-      if (done) done();
-      this.params = params;
-      this.page.currentPage = 1;
-      this.getList();
-      this.$message.success('鎼滅储鎴愬姛')
+      var p = {"name_like": params.name}
+      getPage(this.page.currentPage, this.page.pageSize, p).then(res => {
+        const data = res.data.data
+        this.loading = false;
+        this.page.total = data.total;
+        this.data = data.records;
+      });
+      if (done) {
+        done();
+      }
     },
     refreshChange() {
       this.getList();

--
Gitblit v1.9.3