From 8932133e2ee2e5708e3506bee3d01d59bff5f1d2 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期日, 12 一月 2025 11:30:52 +0800
Subject: [PATCH] bug
---
company/src/components/business/OperaSolutionsBaseWindow.vue | 174 ++++++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 121 insertions(+), 53 deletions(-)
diff --git a/company/src/components/business/OperaSolutionsBaseWindow.vue b/company/src/components/business/OperaSolutionsBaseWindow.vue
index e7f597e..b305086 100644
--- a/company/src/components/business/OperaSolutionsBaseWindow.vue
+++ b/company/src/components/business/OperaSolutionsBaseWindow.vue
@@ -25,7 +25,7 @@
</el-form-item>
<el-form-item label="鎶曚繚骞撮緞" prop="minAge">
<div style="display: flex; align-items: center;">
- <el-select v-model="form.minAge" style="flex: 1;" placeholder="璇烽�夋嫨">
+ <el-select v-model="form.minAge" @change="changeMinAge" style="flex: 1;" placeholder="璇烽�夋嫨">
<el-option
v-for="item in 80"
:key="item"
@@ -34,7 +34,7 @@
</el-option>
</el-select>
<span style="margin: 0 30px;">鑷�</span>
- <el-select v-model="form.maxAge" style="flex: 1;" placeholder="璇烽�夋嫨">
+ <el-select v-model="form.maxAge" @change="changeMaxAge" style="flex: 1;" placeholder="璇烽�夋嫨">
<el-option
v-for="item in 80"
:key="item"
@@ -87,42 +87,45 @@
placeholder="璇烽�夋嫨鎵规敼鎻愰啋鏃堕棿">
</el-time-picker>
</el-form-item>
- <el-button type="primary" @click="add" style="margin-bottom: 10px;">娣诲姞宸ョ</el-button>
- <el-table
- :data="form.worktypeIdList"
- border
- style="width: 100%; margin-bottom: 20px;">
- <el-table-column
- label="搴忓彿"
- align="center"
- width="80">
- <template slot-scope="scope">
- <span>{{scope.$index + 1}}</span>
- </template>
- </el-table-column>
- <el-table-column
- align="center"
- label="鎵�灞炲伐绉�">
- <template slot-scope="{row}">
- <el-select filterable v-model="row.worktypeId" placeholder="璇烽�夋嫨">
- <el-option
- v-for="item in typeWork"
- :key="item.id"
- :label="item.name"
- :value="item.id">
- </el-option>
- </el-select>
- </template>
- </el-table-column>
- <el-table-column
- label="鎿嶄綔"
- align="center"
- width="100">
- <template slot-scope="scope">
- <el-button type="text" size="small" style="color: red;" @click="dele(scope.$index)">鍒犻櫎</el-button>
- </template>
- </el-table-column>
- </el-table>
+ <div style="width: 100%; padding: 10px; box-sizing: border-box; border: 1px solid #ececec;">
+ <div style="display: flex; align-items: center; margin-bottom: 10px;">
+ <el-select filterable multiple style="width: 800px;" v-model="worktypeId" placeholder="璇烽�夋嫨">
+ <el-option
+ v-for="item in typeWorkCopy"
+ :key="item.id"
+ :label="item.name"
+ :value="item.id">
+ </el-option>
+ </el-select>
+ <el-button type="primary" @click="add" :disabled="worktypeId.length === 0" style="margin-left: 10px;">娣诲姞宸ョ</el-button>
+ <el-button type="primary" @click="impor">瀵煎叆宸ョ</el-button>
+ <el-button type="text" @click="exprot">瀵煎叆妯$増xls</el-button>
+ </div>
+ <u-table
+ :data="form.worktypeIdList"
+ border
+ use-virtual
+ style="width: 100%; margin-bottom: 20px;">
+ <u-table-column
+ label="搴忓彿"
+ width="80">
+ <template slot-scope="scope">
+ <span>{{scope.$index + 1}}</span>
+ </template>
+ </u-table-column>
+ <u-table-column
+ prop="worktypeName"
+ label="鎵�灞炲伐绉�">
+ </u-table-column>
+ <u-table-column
+ label="鎿嶄綔"
+ width="100">
+ <template slot-scope="scope">
+ <el-button type="text" size="small" style="color: red;" @click="dele(scope.$index)">鍒犻櫎</el-button>
+ </template>
+ </u-table-column>
+ </u-table>
+ </div>
<el-form-item label="鐗瑰埆绾﹀畾" prop="specialAgreement">
<RichEditor :richData="form.specialAgreement" :styleEditor="'border: 1px solid #ccc;display: inline-block;'" @getWangedditor="getWangedditor" :readonly="false"/>
</el-form-item>
@@ -133,6 +136,8 @@
<RichEditor :richData="form.ortherInfo" :styleEditor="'border: 1px solid #ccc;display: inline-block;'" @getWangedditor="getWangedditor2" :readonly="false"/>
</el-form-item>
</el-form>
+ <!-- 涓婁紶宸ョ -->
+ <input type="file" @change="getFile" style="opacity: 0;" ref="upload" accept=".xlsx" />
</GlobalWindow>
</template>
@@ -140,16 +145,17 @@
import BaseOpera from '@/components/base/BaseOpera'
import GlobalWindow from '@/components/common/GlobalWindow'
import { all } from '@/api/business/insurance'
- import { all as allWorktype } from '@/api/business/worktype'
+ import { all as allWorktype, importExcelForSolution } from '@/api/business/worktype'
import { solutionsBaseId } from '@/api/business/solutionsBase'
import { pageAll as shopList } from '@/api/business/company'
import UploadFile from '@/components/common/UploadFile'
import { numRule } from '@/utils/form'
import RichEditor from '@/components/common/RichEditor'
+ import { UTable, UTableColumn } from 'umy-ui'
export default {
name: 'OperaSolutionsBaseWindow',
extends: BaseOpera,
- components: { GlobalWindow, UploadFile, RichEditor },
+ components: { GlobalWindow, UploadFile, RichEditor, UTable, UTableColumn },
data () {
var validType = (rule, value, callback) => {
if (this.form.validType === 0 && !value) {
@@ -186,8 +192,9 @@
delOnlyReplace: 0,
canAdd: 0,
correctWarnTime: '',
- worktypeIdList: [{ worktypeId: '' }]
+ worktypeIdList: []
},
+ worktypeId: [],
// 楠岃瘉瑙勫垯
rules: {
name: [
@@ -223,7 +230,8 @@
},
shops: [],
company: [],
- typeWork: []
+ typeWork: [],
+ typeWorkCopy: []
}
},
created () {
@@ -233,6 +241,36 @@
})
},
methods: {
+ // 瀵煎叆宸ョ妯℃澘
+ getFile(e) {
+ const formdate = new FormData()
+ formdate.append('file', e.target.files[0])
+ formdate.append('insuranceId', this.form.insuranceId)
+ importExcelForSolution(formdate)
+ .then(res => {
+ let arr = []
+ res.forEach(item => {
+ arr.push({ worktypeId: item.id, worktypeName: item.name })
+ })
+ this.form.worktypeIdList = [...arr, ...this.form.worktypeIdList]
+ let valData = this.form.worktypeIdList.map(item => item.worktypeName)
+ this.typeWorkCopy = this.typeWorkCopy.filter(item => !valData.includes(item.name))
+ })
+ .catch(err => {
+ this.$message.error(err.message)
+ })
+ .finally(() => {
+ this.$refs.upload.value = null
+ })
+ },
+ impor() {
+ if (!this.form.insuranceId) return this.$message.warning('璇峰厛閫夋嫨淇濋櫓鍏徃')
+ this.$refs.upload.click()
+ },
+ // 瀵煎嚭妯℃澘
+ exprot() {
+ window.open(process.env.VUE_APP_TYPEWORK_URL)
+ },
getWangedditor(val){
this.form.specialAgreement = val;
},
@@ -242,7 +280,18 @@
getWangedditor2(val){
this.form.ortherInfo = val;
},
-
+ changeMinAge(e) {
+ if (this.form.maxAge && this.form.maxAge >= 0 && e > this.form.maxAge) {
+ this.form.minAge = ''
+ this.$message.warning('璧峰骞撮緞涓嶈兘澶т簬鎴骞撮緞锛�')
+ }
+ },
+ changeMaxAge(e) {
+ if (this.form.minAge && this.form.minAge >= 0 && e < this.form.minAge) {
+ this.form.maxAge = ''
+ this.$message.warning('鎴骞撮緞涓嶈兘澶т簬璧峰骞撮緞锛�')
+ }
+ },
handNumberInput (value) {
const regex = /^[-+]?\d*$/
if (!regex.test(value)) {
@@ -254,7 +303,7 @@
},
// 鍒囨崲鍏徃
getAllWorktype1 () {
- this.form.worktypeIdList = [{ worktypeId: '' }]
+ this.form.worktypeIdList = []
this.getAllWorktype()
},
changeValidType(e) {
@@ -314,7 +363,9 @@
this.form.delOnlyReplace = 0
this.form.delValidDays = 0
this.form.canAdd = 0
- this.form.worktypeIdList = [{ worktypeId: '' }]
+ this.form.worktypeIdList = []
+ this.typeWork = []
+ this.typeWorkCopy = []
// this.$refs['$upload'].clearFiles()//鍒濆鍖栧鍏ョ粍浠�
this.allCompany()
this.allShops()
@@ -325,7 +376,7 @@
this.form.maxAge = ''
this.form.validTypeNum = ''
this.form.fanganFile = null
- this.form.worktypeIdList = [{ worktypeId: '' }]
+ this.form.worktypeIdList = []
this.form[this.configData['field.id']] = null
})
return
@@ -338,11 +389,11 @@
this.form[key] = res[key]
}
this.form.correctWarnTime = `${this.form.correctWarnTime}:00`
- console.log(this.form.correctWarnTime)
if (res.worktypeList) {
this.form.worktypeIdList = res.worktypeList.map(item => {
return {
- worktypeId: item.worktypeId
+ worktypeId: item.worktypeId,
+ worktypeName: item.worktypeName
}
})
}
@@ -353,9 +404,16 @@
// 鏌ヨ淇濋櫓鍏徃涓嬪叏閮ㄥ伐绉�
getAllWorktype () {
allWorktype({
- insuranceId: this.form.insuranceId
+ insuranceId: this.form.insuranceId,
+ dataType: 2
}).then(res => {
- this.typeWork = res
+ this.typeWork = res
+ if (!this.form.id) {
+ this.typeWorkCopy = res
+ } else {
+ let valData = this.form.worktypeIdList.map(item => item.worktypeName)
+ this.typeWorkCopy = res.filter(item => !valData.includes(item.name))
+ }
})
},
@@ -363,25 +421,35 @@
allCompany () {
all({ dataType: 2, status: 0 })
.then(res => {
- console.log(res)
this.company = res
})
},
allShops () {
shopList({ type: 1, status: 0 })
.then(res => {
- console.log(res)
this.shops = res
})
},
add () {
- this.form.worktypeIdList.push({ worktypeId: '' })
+ let arr = this.typeWorkCopy.filter(item => this.worktypeId.includes(item.id))
+ let dataVal = arr.map(item => {
+ return {
+ worktypeId: item.id,
+ worktypeName: item.name
+ }
+ })
+ this.form.worktypeIdList = [ ...dataVal, ...this.form.worktypeIdList ]
+ let valData = this.form.worktypeIdList.map(item => item.worktypeName)
+ this.typeWorkCopy = this.typeWorkCopy.filter(item => !valData.includes(item.name))
+ this.worktypeId = []
},
dele (index) {
if (this.form.worktypeIdList.length === 1) {
this.$message.warning('鑷冲皯瑕佷繚鐣欎竴椤�')
return
}
+ let row = this.typeWork.filter(item => item.name === this.form.worktypeIdList[index].worktypeName)
+ this.typeWorkCopy.unshift(row[0])
this.form.worktypeIdList.splice(index, 1)
}
}
--
Gitblit v1.9.3