ソースを参照

Merge branch 'develop' of ssh://gogs.zfire.top:2222/zfire-front/zfire-newmall-admin into develop

linwenxin 1 年間 前
コミット
f400ebfe0c

+ 34 - 32
src/views/engineeringMaintenance/basicData/detail.vue

@@ -130,14 +130,14 @@
 						<el-table v-show="typeIndex == 1" :data="formData1.productList" element-loading-text="Loading" border fit highlight-current-row stripe>
 							<el-table-column label="品牌" align="center">
 								<template slot-scope="scope">
-									<el-form-item :prop="'productList.' + scope.$index + '.brand'" :rules="[{ required: true, message: `请选择品牌`, trigger: 'change' }]">
+									<el-form-item :prop="'productList.' + scope.$index + '.brand'" :rules="[{ required: true, message: `请选择品牌`, trigger: 'blur' }]">
 										<el-select v-model="scope.row.brand" @change="(e)=>{
 											scope.row.brandId = e.id
 											scope.row.brandName = e.brandName
 										}" value-key="id" :disabled="isEdit1 != scope.$index || formType == 2" placeholder="请选择" style="width: 100%;">
 										    <el-option
-										      v-for="item in brandList"
-										      :key="item.id"
+										      v-for="(item,ind) in brandList"
+										      :key="ind"
 										      :label="item.brandName"
 										      :value="item">
 										    </el-option>
@@ -147,7 +147,7 @@
 							</el-table-column>
 							<el-table-column label="产品大类" align="center">
 								<template slot-scope="scope">
-									<el-form-item :prop="'productList.' + scope.$index + '.main'" :rules="[{ required: true, message: `请选择产品大类`, trigger: 'change' }]">
+									<el-form-item :prop="'productList.' + scope.$index + '.main'" :rules="[{ required: true, message: `请选择产品大类`, trigger: 'blur' }]">
 										<el-select v-model="scope.row.main" value-key="categoryId" @change="(e)=>{
 											scope.row.mainId = e.categoryId
 											scope.row.mainName = e.name
@@ -164,8 +164,8 @@
 											scope.row.smallList = e.children?[...[{categoryId: '0', name: '不限'}],...e.children]:[]
 										}" :disabled="isEdit1 != scope.$index || formType == 2" placeholder="请选择" style="width: 100%;">
 										    <el-option
-										      v-for="item in mainList"
-										      :key="item.categoryId"
+										      v-for="(item,ind) in mainList"
+										      :key="ind"
 										      :label="item.name"
 										      :value="item">
 										    </el-option>
@@ -175,7 +175,7 @@
 							</el-table-column>
 							<el-table-column label="产品小类" align="center">
 								<template slot-scope="scope">
-									<el-form-item :prop="'productList.' + scope.$index + '.small'" :rules="[{ required: true, message: `请选择产品小类`, trigger: 'change' }]">
+									<el-form-item :prop="'productList.' + scope.$index + '.small'" :rules="[{ required: true, message: `请选择产品小类`, trigger: 'blur' }]">
 										<el-select v-model="scope.row.small" @focus="()=>{
 												if(!scope.row.main){return this.$message.warning('请先选择产品大类!');}
 											}" @change="(e)=>{
@@ -184,8 +184,8 @@
 												scope.row.smallImg = e.imgUrl
 											}" :disabled="isEdit1 != scope.$index || formType == 2" value-key="categoryId" placeholder="请选择" style="width: 100%;">
 										    <el-option
-										      v-for="item in scope.row.smallList"
-										      :key="item.categoryId"
+										      v-for="(item,ind) in scope.row.smallList"
+										      :key="ind"
 										      :label="item.name"
 										      :value="item">
 										    </el-option>
@@ -256,7 +256,7 @@
 							</el-table-column>
 							<el-table-column label="费用审批">
 								<template slot-scope="scope">
-									<el-form-item :prop="'byList.' + scope.$index + '.feeExamine'" :rules="[{ required: true, message: `请选择费用审批`, trigger: 'change' }]">
+									<el-form-item :prop="'byList.' + scope.$index + '.feeExamine'" :rules="[{ required: true, message: `请选择费用审批`, trigger: 'blur' }]">
 										<el-select v-model="scope.row.feeExamine" :disabled="isEdit2 != scope.$index || formType == 2" placeholder="请选择" style="width: 100%;">
 										    <el-option
 										      v-for="item in [{id: 'YES',name: '是'},{id: 'NO',name: '否'}]"
@@ -281,7 +281,7 @@
 						<el-table :data="formData3.websitList" element-loading-text="Loading" border fit highlight-current-row stripe>
 							<el-table-column align="center" label="网点名称">
 								<template slot-scope="scope">
-									<el-form-item :prop="'websitList.' + scope.$index + '.websit'" :rules="[{ required: true, message: `请选择网点名称`, trigger: 'change' }]" :required="true">
+									<el-form-item :prop="'websitList.' + scope.$index + '.websit'" :rules="[{ required: true, message: `请选择网点名称`, trigger: 'blur' }]">
 										<el-select v-model="scope.row.websit" @change="(e)=>{
 											scope.row.websitId = e.websitId
 											scope.row.websitName = e.name
@@ -455,13 +455,23 @@
 			};
 		},
 		computed: {
-			
+			filterChildren(){
+				return function(id){
+					let data = []
+					this.mainList.forEach(item=>{
+						if(item.categoryId == id){
+							data = item.children?[...[{categoryId: '0', name: '不限'}],...item.children]:[]
+						}
+					})
+					return data
+				}
+			},
 		},
 		created() {
+			this.initData()
 			if(this.id){
 				this.getDetail()
 			}
-			this.initData()
 		},
 		methods: {
 			// 返回
@@ -473,17 +483,18 @@
 				this.formData.checkTypeList = []
 				getDetail({id: this.id}).then( async res => {
 					Object.assign(this.formData, res.data, {
-						websit: {websitId: res.data.websitId,name: res.data.websitName},
-						
+
 					})
 					this.historyList = res.data.operatorLogList
 					this.formData.dateList = [res.data.startTime,res.data.endTime]
-					for(var item of res.data.productList){
-						item.smallList = await this.filterChildren(item.mainId)
-						item.brand = {id: item.brandId,brandName: item.brandName}
-						item.main = {categoryId: item.mainId,name: item.mainName}
-						item.small = {categoryId: item.smallId,name: item.smallName}
-					}
+					this.formData1.productList = res.data.productList.map(item=>{
+						return Object.assign(item, {
+							smallList: this.filterChildren(item.mainId),
+							brand: {id: item.brandId,brandName: item.brandName},
+							main: {categoryId: item.mainId,name: item.mainName},
+							small: {categoryId: item.smallId,name: item.smallName}
+						})
+					})
 
 					res.data.websitList.map(item=>{
 						item.websit = {websitId: item.websitId,name: item.websitName}
@@ -492,20 +503,11 @@
 						this.formData.checkTypeList.push(item.id)
 					})
 					this.formData2.byList = res.data.byList
-					this.formData1.productList = res.data.productList
 					this.formData3.websitList = res.data.websitList
 					
-					console.log(this.formData.checkTypeList,'123123123')
-				})
-			},
-			async filterChildren(id){
-				let data = []
-				this.mainList.forEach(item=>{
-					if(item.categoryId == id){
-						data = item.children?[...[{categoryId: '0', name: '不限'}],...item.children]:[]
-					}
+					
+					console.log(this.formData1.productList,'123123123')
 				})
-				return data
 			},
 			initData(){
 				this.getOrderType()

+ 19 - 1
src/views/engineeringMaintenance/basicData/index.vue

@@ -89,7 +89,25 @@ export default {
 		            </div>
 		          )
 		        }
-		      }
+		 }
+		if (item.jname === 'startTime') {
+		        defaultData.render = (h, { row, index, column }) => {
+		          return (
+		            <div style="cursor: pointer;display: flex">
+		              {row.startTime.substring(0,10)}
+		            </div>
+		          )
+		        }
+		 }
+		if (item.jname === 'endTime') {
+		        defaultData.render = (h, { row, index, column }) => {
+		          return (
+		            <div style="cursor: pointer;display: flex">
+		              {row.endTime.substring(0,10)}
+		            </div>
+		          )
+		        }
+		 }
       return defaultData
     },
     // 监听勾选变化