瀏覽代碼

Signed-off-by: 1004749546@qq.com <1004749546@qq.com>
接口 对接

1004749546@qq.com 4 年之前
父節點
當前提交
06be42e061

+ 1 - 1
src/api/evaluationItem.js

@@ -16,7 +16,7 @@ export const getItemList = (params) => {
   const url = `/assess/item/queryList`
   return axios({
     url: url,
-    data: params,
+    data: {},
     method: 'post'
   })
 }

+ 3 - 0
src/api/evaluationPlan.js

@@ -52,6 +52,9 @@ export const planDetail = (params) => {
     method: 'get'
   })
 }
+/**
+ * 为考评方案选择项目
+ */
 // 考评方案包含项目查询
 export const planItemQuery = (params) => {
   return axios({

+ 1 - 1
src/permission.js

@@ -10,7 +10,7 @@ import { ACCESS_TOKEN } from '@/store/mutation-types'
 
 NProgress.configure({ showSpinner: false }) // NProgress Configuration
 
-const whiteList = ['login', 'register', 'registerResult', 'EvaluationPlan'] // no redirect whitelist
+const whiteList = ['login', 'register', 'registerResult', 'EvaluationPlan', 'EvaluationItem'] // no redirect whitelist
 const defaultRoutePath = '/home'
 
 router.beforeEach((to, from, next) => {

+ 25 - 6
src/views/evaluation/evaluationItem/AddEvaItemModal.vue

@@ -24,7 +24,7 @@
             <a-form-item label="考评项目说明:" :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }">
               <a-textarea
                 allowClear
-                :maxLength="512"
+                :maxLength="500"
                 Input.TextArea
                 :autoSize="{minRows:5}"
                 v-decorator="[
@@ -55,6 +55,7 @@ import {
   VSelect
 } from '@/components'
 import {
+  itemDetail,
   itemSave
 } from '@/api/evaluationItem.js'
 export default {
@@ -80,7 +81,11 @@ export default {
     },
     isshow (newValue, oldValue) {
       if (newValue) {
-
+        this.form.resetFields()
+        // 编辑查详情
+        if (this.itemId) {
+          this.getFormData(this.itemId)
+        }
       } else {
         this.cancel()
       }
@@ -108,21 +113,36 @@ export default {
   methods: {
     // 点击弹框x号触发事件
     cancel (e) {
-      this.clear()
+      this.formData.name = ''
+      this.formData.desc = ''
       this.$emit('close')
     },
+    // 查详情
+    getFormData (id) {
+      itemDetail({
+        id: id
+      }).then(res => {
+        if (res.status == 200) {
+          console.log(res, 'rrrrrrrrrr')
+          this.formData = Object.assign(this.formData, res.data)
+          console.log(this.formData, 'this.formData')
+        }
+      })
+    },
     // 保存提交
     handleSubmit () {
       this.form.validateFields((err, values) => {
         if (!err) {
-		  const params = this.itemId ? Object.assign({id: this.itemId }, values.formData) : values.formData
+          const params = this.itemId ? Object.assign({
+            id: this.itemId
+          }, values.formData) : values.formData
           console.log(params, 'ppppppppppppp')
           itemSave(params).then(res => {
             console.log(res, 'res--save')
             if (res.status + '' === '200') {
               this.$message.success(res.message ? res.message : '保存成功')
               this.$emit('refresh')
-              setTimeout( () => {
+              setTimeout(() => {
                 this.cancel()
               }, 300)
             } else {
@@ -141,7 +161,6 @@ export default {
         okText: '确定',
         cancelText: '取消',
         onOk () {
-          _this.clear()
           _this.cancel()
         }
       })

+ 1 - 2
src/views/evaluation/evaluationItem/EvaluationItem.vue

@@ -191,7 +191,6 @@ export default {
       this.openSetting = true
 	  this.itemId = row.id
 	  this.itemName = row.name
-	  console.log(this.openSetting)
     },
     // 重置
     reset () {
@@ -199,7 +198,7 @@ export default {
         name: '',
         status: '' // 状态
       }
-      this.$refs.table.refresh()
+      this.$refs.table.refresh(true)
     }
   }
 }

+ 38 - 36
src/views/evaluation/evaluationPlan/AddEvaModal.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
     <a-modal class="modalBox" :title="titleText" v-model="isshow" @cancle="cancel" :width="600">
-      <a-form :form="form" ref="form" @submit="handleSubmit">
+      <a-form :form="form" :model="formData" ref="form" @submit="handleSubmit">
         <a-row :gutter="24">
           <a-col :span="20">
             <!-- 考评方案名称 -->
@@ -36,15 +36,14 @@
                 code="STORE_AUTH_TYPE"></v-select> -->
               <a-select
                 mode="multiple"
-                style="width: 100%"
+                allowClear
                 placeholder="请选择适用模式"
                 @change="scopeTypeChange"
                 v-decorator="[
                   'formData.scopeType',
                   { initialValue: formData.scopeType,
                     rules: [{ required: true, message: '请选择适用模式!' }] },
-                ]"
-              >
+                ]">
                 <a-select-option v-for="item in options" :key="item.code" :value="item.code">
                   {{ item.dispName }}
                 </a-select-option>
@@ -58,7 +57,7 @@
             <a-form-item label="考评方案说明:" :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }">
               <a-textarea
                 allowClear
-                :maxLength="512"
+                :maxLength="500"
                 Input.TextArea
                 :autoSize="{minRows:5}"
                 v-decorator="[
@@ -113,7 +112,8 @@ export default {
     },
     isshow (newValue, oldValue) {
       if (newValue) {
-		  // 编辑查详情
+        this.form.resetFields()
+        // 编辑查详情
         if (this.itemId) {
           this.getFormData(this.itemId)
         }
@@ -133,23 +133,22 @@ export default {
         scopeType: [], // 适用类型
         desc: '' // 方案说明
       },
-	  options: [
-		  {
-			  code: 'VIDEO_INSPECTION',
-			  dispName: '视频巡店',
-			  id: 1
-		  },
-		  {
-			  code: 'SPOT_INSPECTION',
-			  dispName: '现场巡店',
-			  id: 12
-		  },
-		  {
-			  code: 'POINT_INSPECTION',
-			  dispName: '点检',
-			  id: 13
-		  }
-	  ]
+      options: [{
+        code: 'VIDEO_INSPECTION',
+        dispName: '视频巡店',
+        id: 1
+      },
+      {
+        code: 'SPOT_INSPECTION',
+        dispName: '现场巡店',
+        id: 12
+      },
+      {
+        code: 'POINT_INSPECTION',
+        dispName: '点检',
+        id: 13
+      }
+      ]
     }
   },
   computed: {
@@ -161,16 +160,22 @@ export default {
   methods: {
     // 点击弹框x号触发事件
     cancel (e) {
-      this.clear()
+      this.formData = {
+        name: '', // 方案名称
+        scopeType: [], // 适用类型
+        desc: '' // 方案说明
+      }
       this.$emit('close')
     },
     // 查详情
     getFormData (id) {
-      planDetail({ id: id }).then(res => {
+      planDetail({
+        id: id
+      }).then(res => {
         if (res.status == 200) {
-          console.log(res, 'rrrrrrrrrr')
-		  this.formData = Object.assign(this.formData, res.data)
-		  this.formData.scopeType = this.formData.scopeType.split(',')
+          // console.log(res, 'rrrrrrrrrr')
+          this.formData = Object.assign(this.formData, res.data)
+          this.formData.scopeType = this.formData.scopeType.split(',')
         }
       })
     },
@@ -183,9 +188,11 @@ export default {
       const _this = this
       this.form.validateFields((err, values) => {
         if (!err) {
-          const params = this.itemId ? Object.assign({ id: this.itemId }, values.formData) : values.formData
-		  params.scopeType = params.scopeType.join(',')
-		  console.log(params, 'ppppppppppppp')
+          const params = this.itemId ? Object.assign({
+            id: this.itemId
+          }, values.formData) : values.formData
+          params.scopeType = params.scopeType.join(',')
+          // console.log(params, 'ppppppppppppp')
           planSave(params).then(res => {
             console.log(res, 'res--save')
             if (res.status + '' === '200') {
@@ -210,15 +217,10 @@ export default {
         okText: '确定',
         cancelText: '取消',
         onOk () {
-          _this.clear()
           _this.cancel()
         }
       })
-    },
-    clear () {
-      this.form.resetFields()
     }
-
   },
   beforeCreate () {
     this.form = this.$form.createForm(this, {

+ 5 - 2
src/views/evaluation/evaluationPlan/EvaluationPlan.vue

@@ -49,7 +49,7 @@
     <!-- 新增/编辑 弹窗 -->
     <add-evaModal :itemId="itemId" :visible="openAddModal" @refresh="$refs.table.refresh()" @close="openAddModal=false"></add-evaModal>
     <!-- 选择考评项弹窗 -->
-    <set-evaModal :itemId="itemId" :visible="openSetting" @close="openSetting=false"></set-evaModal>
+    <set-evaModal :itemId="itemId" :itemName="itemName" :visible="openSetting" @close="openSetting=false"></set-evaModal>
     <!-- 设置默认方案弹窗 -->
     <set-evaDefaultModal :itemId="itemId" :visible="openDefaultSetting" @close="openDefaultSetting=false"></set-evaDefaultModal>
   </a-card>
@@ -88,6 +88,7 @@ export default {
 	  openSetting: false, // 打开选择考评项弹窗
 	  openDefaultSetting: false, // 打开设置默认方案弹窗
       itemId: '', // 要编辑的方案id
+	  itemName: '', // 方案名称
       // 查询参数
       queryParam: {
         name: '',
@@ -204,6 +205,8 @@ export default {
     },
     // 打开设置弹框
     handleSet (row) {
+      this.itemId = row.id
+      this.itemName = row.name
       this.openSetting = true
 	  console.log(this.openSetting)
     },
@@ -213,7 +216,7 @@ export default {
         name: '',
         status: '' // 状态
       }
-      this.$refs.table.refresh()
+      this.$refs.table.refresh(true)
     }
   }
 }

+ 41 - 35
src/views/evaluation/evaluationPlan/SetEvaDefaultModal.vue

@@ -3,43 +3,46 @@
     <a-modal class="modalBox" title="默认方案设置" v-model="isshow" @cancle="cancel" :width="600">
       <a-form :form="form" ref="form" @submit="handleSubmit">
         <a-row :gutter="24">
-          <a-col :span="20">
+          <a-col :span="24">
             <!-- 视频巡店默认方案 -->
-            <a-form-item label="视频巡店默认方案:" :label-col="{ span: 7 }" :wrapper-col="{ span: 16 }">
+            <a-form-item label="视频巡店默认方案:" :label-col="{ span: 6 }" :wrapper-col="{ span: 16 }">
               <a-select
-                style="width: 100%"
                 placeholder="请选择考评方案方案(单选)"
-                @change="videoTypeChange()"
+                @change="videoTypeChange"
                 v-decorator="[
                   'formData.videoType',
                   { initialValue: formData.videoType,
                     rules: [{ required: true, message: '请选择考评方案方案(单选)!' }] },
-                ]"
-              >
-                <a-select-option v-for="item in planList" :key="item.assessId" :value="item.assessId">
+                ]">
+                <a-select-option v-for="item in planList" :key="item.id" :value="item.id">
                   {{ item.name }}
                 </a-select-option>
-              </a-select></a-form-item>
+              </a-select>
+            </a-form-item>
           </a-col>
         </a-row>
         <a-row :gutter="24">
-          <a-col :span="20">
+          <a-col :span="24">
             <!-- 现场巡店默认方案 -->
-            <a-form-item label="现场巡店默认方案:" :label-col="{ span: 7 }" :wrapper-col="{ span: 16 }">
+            <a-form-item label="现场巡店默认方案:" :label-col="{ span: 6 }" :wrapper-col="{ span: 16 }">
               <a-select
-                style="width: 100%"
                 placeholder="请选择考评方案方案(单选)"
-                @change="spotTypeChange()"
+                @change="spotTypeChange"
                 v-decorator="[
                   'formData.spotType',
                   { initialValue: formData.spotType,
                     rules: [{ required: true, message: '请选择考评方案方案(单选)!' }] },
-                ]"
-              >
-                <a-select-option v-for="item in planList" :key="item.assessId" :value="item.assessId">
+                ]">
+                <a-select-option v-for="item in planList" :key="item.id" :value="item.id">
                   {{ item.name }}
                 </a-select-option>
-              </a-select></a-form-item>
+              </a-select>
+            </a-form-item>
+          </a-col>
+        </a-row>
+        <a-row>
+          <a-col :span="22">
+            说明:如果默认方案被删除,系统将自动获取对应类别下最新一条启用的模板作为默认方案模板
           </a-col>
         </a-row>
         <a-form-item :wrapper-col="{ span: 24, offset: 10 }">
@@ -89,6 +92,7 @@ export default {
     },
     isshow (newValue, oldValue) {
       if (newValue) {
+        this.form.resetFields()
         // 默认方案查询
         this.getDefaultPlan()
       } else {
@@ -106,14 +110,13 @@ export default {
         videoType: '', // 视频巡店默认方案
         spotType: '' // 现场巡店默认方案
       },
-	  planList: [] // 考评方案列表
+      planList: [] // 考评方案列表
     }
   },
-  computed: {
-  },
+  computed: {},
   mounted () {
     // 获取方案列表数据
-  	this.getPlanList()
+    this.getPlanList()
   },
   methods: {
     // 点击弹框x号触发事件
@@ -134,16 +137,14 @@ export default {
     // 默认方案查询
     getDefaultPlan () {
       planDefaultQuery().then(res => {
-		  console.log(res, 'rrrrrrrr')
-		  if (res.status == 200) {
-			  // this.form.setFieldsValue({ 'formData.videoType': res.data.find(item => item.scopeType == 'VIDEO_INSPECTION').assessId })
-			  // this.form.setFieldsValue({ 'formData.spotType': res.data.find(item => item.scopeType == 'SPOT_INSPECTION').assessId })
-			  // this.formData.videoType = res.data.find(item => item.scopeType == 'VIDEO_INSPECTION').assessId
-			  // this.formData.spotType = res.data.find(item => item.scopeType == 'SPOT_INSPECTION').assessId
-		  } else {
-			  this.formData.videoType = ''
-			  this.formData.spotType = ''
-		  }
+        // console.log(res, 'rrrrrrrr')
+        if (res.status == 200) {
+          this.formData.videoType = res.data.find(item => item.scopeType == 'VIDEO_INSPECTION').assessId
+          this.formData.spotType = res.data.find(item => item.scopeType == 'SPOT_INSPECTION').assessId
+        } else {
+          this.formData.videoType = ''
+          this.formData.spotType = ''
+        }
       })
     },
     // 视频巡店默认方案改变
@@ -152,17 +153,22 @@ export default {
     },
     // 现场巡店默认方案改变
     spotTypeChange (v) {
-	  this.formData.spotType = v
+      this.formData.spotType = v
     },
     // 保存提交
     handleSubmit () {
       const _this = this
       this.form.validateFields((err, values) => {
         if (!err) {
-          const params = [
-			  { assessId: values.formData.videoType, scopeType: 'VIDEO_INSPECTION' },
-			  { assessId: values.formData.spotType, scopeType: 'SPOT_INSPECTION' }
-		  ]
+          const params = [{
+            assessId: values.formData.videoType,
+            scopeType: 'VIDEO_INSPECTION'
+          },
+          {
+            assessId: values.formData.spotType,
+            scopeType: 'SPOT_INSPECTION'
+          }
+          ]
           planDefaultSave(params).then(res => {
             console.log(res, 'res--save')
             if (res.status + '' === '200') {

+ 81 - 85
src/views/evaluation/evaluationPlan/SetEvaModal.vue

@@ -4,12 +4,12 @@
       <a-row :gutter="24">
         <a-col class="title" :span="20">
           <!-- 考评方案名称 -->
-          <span>考评方案名称:</span>
+          <span>考评方案名称: {{ itemName }}</span>
         </a-col>
       </a-row>
       <a-row :gutter="24">
         <a-form :form="form" ref="form" @submit="handleSubmit">
-          <a-card>
+          <a-card class="card-content">
             <a-col :span="15">
               <p>已选考评项目:</p>
               <!-- 已选考评项列表 -->
@@ -68,6 +68,7 @@
               <s-table
                 ref="tableItem"
                 size="default"
+                :showPagination="false"
                 :row-selection="rowSelection"
                 :rowKey="(record) => record.id"
                 :columns="itemColumns"
@@ -101,9 +102,10 @@ import {
   VSelect
 } from '@/components'
 import {
-  saveAuth,
-  getTenantsList
-} from '@/api/tenants.js'
+  planItemQuery,
+  planItemSave
+} from '@/api/evaluationPlan.js'
+import { getItemList } from '@/api/evaluationItem.js'
 export default {
   name: 'AddEvaModal',
   components: {
@@ -119,6 +121,11 @@ export default {
     itemId: {
       type: [String, Number],
       default: ''
+    },
+    // 要编辑的方案名字
+    itemName: {
+	  type: String,
+	  default: ''
     }
   },
   watch: {
@@ -129,63 +136,17 @@ export default {
       if (newValue) {
         // 获取已选列表数据
         this.getCheckedList()
-        // 刷新考评项列表数据
-        this.$refs.tableItem.refresh()
       } else {
         this.cancel()
       }
     }
   },
-  computed: {
-    // 已选择的复选框
-    selectedRowKeys () {
-      const arr = []
-      this.checkedList.map(item => {
-        arr.push(item.id)
-      })
-      return arr
-    },
-    // 列表项是否可选择的配置
-    rowSelection () {
-      return {
-        columnTitle: '选择', // 选择框标题
-        columnWidth: 80, // 选择框宽度
-        selectedRowKeys: this.selectedRowKeys, // 指定选中项的 key 数组
-        // 选中项发生变化时的回调 selectedRowKeys:指定选中项的 key 数组 selectedRows:已选中的数组数据
-        onChange: (selectedRowKeys, selectedRows) => {
-          const arr = []
-          let index = 0
-		  // 根据选择项的顺序展示已选列表
-          selectedRowKeys.map(item => {
-            index++
-            const p = selectedRows.find(row => row.id == item)
-            if (p) {
-              p.no = index
-              arr.push(p)
-            }
-          })
-          this.checkedList = arr
-          // console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows)
-        },
-        getCheckboxProps: record => ({
-          props: {
-            disabled: record.status == '0' // 禁用状态不可选
-          }
-        })
-      }
-    }
-  },
   data () {
     return {
       isshow: this.visible, // 弹框显示隐藏
       form: this.$form.createForm(this, {
         name: 'SetEvaModal'
       }),
-      formData: {
-        name: '', // 方案名称
-        scopeType: [], // 适用类型
-        remarks: '' // 方案说明
-      },
       // 已选考评项数据
       checkedList: [], // 已选考评项列表
       // 表头
@@ -197,7 +158,7 @@ export default {
       },
       {
         title: '考评项目名称',
-        dataIndex: 'name',
+        dataIndex: 'assessItemName',
         align: 'center'
       },
       {
@@ -227,31 +188,66 @@ export default {
       ],
       // 加载数据方法 必须为 Promise 对象
       loadItemData: parameter => {
-        return getTenantsList(Object.assign(parameter, this.itemId)).then(res => {
+        return getItemList().then(res => {
           if (res.status == 200) {
-            const no = (res.data.pageNo - 1) * res.data.pageSize
-            for (let i = 0; i < res.data.list.length; i++) {
-              const _item = res.data.list[i]
-              _item.no = no + i + 1
-              _item.status = _item.status + '' === '1'
-            }
+            //       res.data.map((item, index) => {
+			   // res.data.no = index + 1
+            //       })
             return res.data
           }
         })
       }
     }
   },
+  computed: {
+    // 已选择的复选框
+    selectedRowKeys () {
+      const arr = []
+      this.checkedList.map(item => {
+        arr.push(item.assessItemId)
+      })
+      return arr
+    },
+    // 列表项是否可选择的配置
+    rowSelection () {
+      return {
+        columnTitle: '选择', // 选择框标题
+        columnWidth: 80, // 选择框宽度
+        selectedRowKeys: this.selectedRowKeys, // 指定选中项的 key 数组
+        // 选中项发生变化时的回调 selectedRowKeys:指定选中项的 key 数组 selectedRows:已选中的数组数据
+        onChange: (selectedRowKeys, selectedRows) => {
+          const arr = []
+          let index = 0
+  		  // 根据选择项的顺序展示已选列表
+          selectedRowKeys.map(item => {
+            index++
+            const p = selectedRows.find(row => row.id == item)
+            const row = {}
+            if (p) {
+              row.no = index
+			  row.assessItemId = p.id
+			  row.assessItemName = p.name
+			  row.assessSchemeId = this.itemId
+              arr.push(row)
+            }
+          })
+          this.checkedList = arr
+          // console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows)
+        },
+        getCheckboxProps: record => ({
+          props: {
+            disabled: record.status == '0' // 禁用状态不可选
+          }
+        })
+      }
+    }
+  },
   methods: {
     // 获取已选列表数据
     getCheckedList () {
-      console.log(111111)
-      const params = {
-        pageNo: 1,
-        pageSize: 10
-      }
-      getTenantsList(params).then(res => {
+      planItemQuery({ assessSchemeId: this.itemId }).then(res => {
         if (res.status == 200) {
-          this.checkedList = res.data.list
+          this.checkedList = res.data
           this.checkedList.map((item, index) => {
             item.no = index + 1
           })
@@ -310,24 +306,21 @@ export default {
       const _this = this
       this.form.validateFields((err, values) => {
         if (!err) {
-          console.log(values.formData, ' formData.type222222222')
-          // const params = Object.assign({
-          //   id: this.itemData.id
-          // }, values.formData)
-          // params.expireDate = moment(params.expireDate).format('YYYY-MM-DD')
-          // console.log(params, 'ppppppppppppp')
-          // saveAuth(params).then(res => {
-          //   console.log(res, 'res--save')
-          //   if (res.status + '' === '200') {
-          //     this.$message.success(res.message ? res.message : '保存成功')
-          //     this.$emit('refresh')
-          //     setTimeout(function () {
-          //       _this.cancel()
-          //     }, 300)
-          //   } else {
-          //     // this.$message.warning(res.message)
-          //   }
-          // })
+          if (!this.checkedList.length) {
+            return this.$message.warning('请先选择考评项目')
+          }
+          planItemSave(this.checkedList).then(res => {
+            console.log(res, 'res--save')
+            if (res.status + '' === '200') {
+              this.$message.success(res.message ? res.message : '保存成功')
+              this.$emit('refresh')
+              setTimeout(function () {
+                _this.cancel()
+              }, 300)
+            } else {
+              // this.$message.warning(res.message)
+            }
+          })
         }
       })
     },
@@ -365,7 +358,10 @@ export default {
 		color: black;
 		padding-bottom: 30px;
 	}
-
+	.card-content {
+		max-height: 650px;
+		overflow-y: scroll;
+	}
 	.actionBtn {
 		font-size: 12px;
 		margin: 0 5px;

+ 1 - 1
src/views/user/Login.vue

@@ -184,7 +184,7 @@ export default {
     },
     handleSubmit (e) {
       e.preventDefault()
-      this.$router.push({ name: 'EvaluationPlan' }, () => {
+      this.$router.push({ name: 'EvaluationItem' }, () => {
 			  console.log('onComplete')
 			  this.$notification.success({
 			    message: '欢迎',