Browse Source

资产需求

ymh66 1 year ago
parent
commit
cac8b0a42e

+ 8 - 0
src/api/requirement.js

@@ -37,3 +37,11 @@ export function requirementGroupDelete(id) {
     method: 'delete'
   })
 }
+
+export function requirementList (id) {
+  return request({
+    url: `/requirement/${id}/asset`,
+    method: 'get'
+  })
+}
+

+ 49 - 40
src/config/router.config.js

@@ -157,6 +157,15 @@ export const asyncRouterMap = [
               keepAlive: true,
             },
           },
+          {
+            path: '/asset/Requirement',
+            name: 'AssetRequirement',
+            component: () => import('@/views/asset/requirement/Requirement'),
+            meta: {
+              title: 'Requirement',
+              keepAlive: true,
+            },
+          },
         ],
       },
       // forms
@@ -369,46 +378,46 @@ export const asyncRouterMap = [
       },
 
       // Exception
-      {
-        path: '/exception',
-        name: 'exception',
-        component: RouteView,
-        redirect: '/exception/403',
-        meta: {
-          title: 'menu.exception',
-          icon: 'warning',
-          permission: ['exception'],
-        },
-        children: [
-          {
-            path: '/exception/403',
-            name: 'Exception403',
-            component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/403'),
-            meta: {
-              title: 'menu.exception.not-permission',
-              permission: ['exception'],
-            },
-          },
-          {
-            path: '/exception/404',
-            name: 'Exception404',
-            component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404'),
-            meta: {
-              title: 'menu.exception.not-find',
-              permission: ['exception'],
-            },
-          },
-          {
-            path: '/exception/500',
-            name: 'Exception500',
-            component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/500'),
-            meta: {
-              title: 'menu.exception.server-error',
-              permission: ['exception'],
-            },
-          },
-        ],
-      },
+      // {
+      //   path: '/exception',
+      //   name: 'exception',
+      //   component: RouteView,
+      //   redirect: '/exception/403',
+      //   meta: {
+      //     title: 'menu.exception',
+      //     icon: 'warning',
+      //     permission: ['exception'],
+      //   },
+      //   children: [
+      //     {
+      //       path: '/exception/403',
+      //       name: 'Exception403',
+      //       component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/403'),
+      //       meta: {
+      //         title: 'menu.exception.not-permission',
+      //         permission: ['exception'],
+      //       },
+      //     },
+      //     {
+      //       path: '/exception/404',
+      //       name: 'Exception404',
+      //       component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404'),
+      //       meta: {
+      //         title: 'menu.exception.not-find',
+      //         permission: ['exception'],
+      //       },
+      //     },
+      //     {
+      //       path: '/exception/500',
+      //       name: 'Exception500',
+      //       component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/500'),
+      //       meta: {
+      //         title: 'menu.exception.server-error',
+      //         permission: ['exception'],
+      //       },
+      //     },
+      //   ],
+      // },
 
       // account
       {

+ 2 - 2
src/layouts/BasicLayout.vue

@@ -53,9 +53,9 @@
       <right-content :top-menu="settings.layout === 'topmenu'" :is-mobile="isMobile" :theme="settings.theme" />
     </template>
     <!-- custom footer / 自定义Footer -->
-    <template v-slot:footerRender>
+    <!-- <template v-slot:footerRender>
       <global-footer />
-    </template>
+    </template> -->
     <router-view />
   </pro-layout>
 </template>

+ 1 - 1
src/views/asset/plans/AssetPlans.vue

@@ -100,7 +100,7 @@ const columns = [
     dataIndex: 'description',
   },
   {
-    title: 'Begin Time',
+    title: 'Action',
     scopedSlots: { customRender: 'action' },
     width: 250,
   },

+ 192 - 0
src/views/asset/requirement/Requirement.vue

@@ -0,0 +1,192 @@
+<template>
+    <div>
+        <a-card :bordered="false" title="Asset Plans">
+            <div class="table-page-search-wrapper">
+                <a-form layout="inline">
+                    <a-row :gutter="24">
+                        <a-col :md="6" :sm="10">
+                            <a-form-item label="Assets Belonging">
+                                <a-select placeholder="please select" v-model="queryParam.assetId" @select="selectAsset">
+                                    <a-select-option v-for="item in groupsList" :key="item.id" :value="item.id">{{
+                                        item.name
+                                    }}</a-select-option>
+                                </a-select>
+                            </a-form-item>
+                        </a-col>
+                        <a-col :md="6" :sm="10">
+                            <span>
+                                <a-button type="primary" @click="getList">search</a-button>
+                                <a-button style="margin-left: 8px" @click="resetClick">reset</a-button>
+                            </span>
+                        </a-col>
+                    </a-row>
+                </a-form>
+            </div>
+            <div class="table-operator">
+                <a-button type="primary" icon="plus" @click="handleAdd(-1, 'add')">add</a-button>
+            </div>
+            <a-table ref="table" :columns="columns" :data-source="list" :loading="loading" :rowKey="(record) => record.id"
+                showPagination="auto">
+                <span slot="action" slot-scope="text, record">
+                    <a @click="projectClick(record.id)">Create Project</a>
+                    <a-divider type="vertical" />
+
+                    <a @click="lickClick(record.id)">Link Requirement</a>
+                    <a-divider v-if="record.parent_id == 0" type="vertical" />
+
+                    <a v-if="record.parent_id == 0" @click="childClick(record.id, 'child')">Child Plan</a>
+                    <a-divider type="vertical" />
+
+                    <a v-if="record.parent_id == 0" @click="editClick(record.id, 'edit')">Edit</a>
+                    <a v-else @click="editChildClick(record.id, 'edit')">Edit</a>
+                    <a-divider type="vertical" />
+
+                    <a @click="delClick(record.id)">Delete</a>
+                </span>
+            </a-table>
+        </a-card>
+    </div>
+</template>
+  
+<script>
+import { requirementList } from '@/api/requirement'
+const columns = [
+    {
+        title: 'ID',
+        dataIndex: 'id',
+    },
+    {
+        title: 'Priority',
+        dataIndex: 'priority',
+    },
+    {
+        title: 'Requirement Title',
+        dataIndex: 'title',
+    },
+    {
+        title: 'Plans',
+        dataIndex: 'plan',
+    },
+    {
+        title: 'Task',
+        dataIndex: 'task',
+    },
+    {
+        title: 'CreateBy',
+        dataIndex: 'createBy',
+    },
+    {
+        title: 'ReviewedBy',
+        dataIndex: 'reviewedBy',
+    },
+    {
+        title: 'Action',
+        scopedSlots: { customRender: 'action' },
+    },
+]
+
+export default {
+    name: 'Requirement',
+
+    data() {
+        return {
+            loading: false,
+            columns,
+            list: [],
+            queryParam: {
+                expired: undefined,
+                assetId: undefined,
+            },
+            groupsList: [],
+        }
+    },
+
+    created() {
+        this.getList()
+    },
+    methods: {
+        selectExpired(item) {
+            this.list = []
+            this.queryParam.expired = item
+            this.getList()
+        },
+        selectAsset(item) {
+            this.list = []
+            this.queryParam.assetId = item
+            this.getList()
+        },
+        getList() {
+            this.loading = true
+            requirementList(this.queryParam).then((res) => {
+                this.list = res.data
+                this.loading = false
+            })
+        },
+        handleAdd(id, type) {
+            // let asset_id = this.queryParam.assetId
+            // this.$router.push({
+            //     path: '/asset/PlansAddModify',
+            //     query: {
+            //         id,
+            //         type,
+            //         asset_id,
+            //     },
+            // })
+        },
+        editClick(id, type) {
+            // this.$router.push({
+            //     path: '/asset/PlansAddModify',
+            //     query: {
+            //         id,
+            //         type
+            //     },
+            // })
+        },
+        editChildClick(id, type) {
+            // this.$router.push({
+            //     path: '/asset/ChildPlansAddModify',
+            //     query: {
+            //         id,
+            //         type
+            //     },
+            // })
+        },
+        resetClick() {
+            // this.queryParam.expired = undefined
+            // this.queryParam.assetId = undefined
+            // this.getList()
+        },
+        projectClick() {
+            // this.$message.success('doing...')
+        },
+        lickClick() {
+            // this.$message.success('doing...')
+        },
+        childClick(id, type) {
+            // this.$router.push({
+            //     path: '/asset/ChildPlansAddModify',
+            //     query: {
+            //         id,
+            //         type
+            //     },
+            // })
+        },
+        delClick(id) {
+            // let that = this
+            // this.$confirm({
+            //     title: 'Are you sure delete?',
+            //     okText: 'Yes',
+            //     okType: 'danger',
+            //     cancelText: 'No',
+            //     onOk() {
+            //         assetPlansDelete(id).then(res => {
+            //             that.$message.success('Operation successful');
+            //             that.getList()
+            //         })
+            //     }
+            // });
+        },
+    },
+}
+</script>
+  

+ 1 - 5
src/views/asset/requirement/RequirementGroups.vue

@@ -44,9 +44,6 @@
                 <a-form-model-item label="Requirement Group Abbr_Name" prop="abbr_name">
                     <a-input v-model="form.abbr_name" placeholder="please input" />
                 </a-form-model-item>
-                <a-form-model-item :label="$t('global.Sequence')" prop="sequence">
-                    <a-input-number id="inputNumber" v-model="form.sequence" :min="0" />
-                </a-form-model-item>
             </a-form-model>
         </a-modal>
     </div>
@@ -91,7 +88,6 @@ export default {
                 asset_id: null,
                 name: null,
                 abbr_name: null,
-                sequence: 0,
             },
             rules: {
                 asset_id: [{ required: true, message: 'Please select Asset', trigger: 'change' }],
@@ -181,7 +177,6 @@ export default {
             this.title = 'Add Requirement Groups'
             this.form.name = null
             this.form.abbr_name = null
-            this.form.sequence = 0
             this.id = null
             this.visible = true
         },
@@ -198,6 +193,7 @@ export default {
         getDetails(id) {
             requirementGroupDetails(id).then((res) => {
                 this.form = res.data
+                this.form.asset_id = Number(res.data.asset_id)
             })
         },
         onSubmit() {