From 02bc3bfe47e3d5311a0bb041c94e70a34b1ca73c Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期二, 09 四月 2024 09:03:01 +0800
Subject: [PATCH] git ch

---
 company/src/components/business/OperaSolutionsWindow.vue |  437 ++++++++++++++++++++++++++++++-----------------------
 1 files changed, 246 insertions(+), 191 deletions(-)

diff --git a/company/src/components/business/OperaSolutionsWindow.vue b/company/src/components/business/OperaSolutionsWindow.vue
index 53aa76f..61d2a8d 100644
--- a/company/src/components/business/OperaSolutionsWindow.vue
+++ b/company/src/components/business/OperaSolutionsWindow.vue
@@ -1,6 +1,7 @@
 <template>
     <GlobalWindow
         :title="title"
+        width="100%"
         :visible.sync="visible"
         :confirm-working="isWorking"
         @confirm="confirm"
@@ -26,7 +27,7 @@
                 <div style="display: flex; align-items: center;">
                     <el-select v-model="form.minAge" style="flex: 1;" placeholder="璇烽�夋嫨">
                         <el-option
-                            v-for="item in 60"
+                            v-for="item in 80"
                             :key="item"
                             :label="item"
                             :value="item">
@@ -35,7 +36,7 @@
                     <span style="margin: 0 30px;">鑷�</span>
                     <el-select v-model="form.maxAge" style="flex: 1;" placeholder="璇烽�夋嫨">
                         <el-option
-                            v-for="item in 60"
+                            v-for="item in 80"
                             :key="item"
                             :label="item"
                             :value="item">
@@ -79,17 +80,30 @@
                 </div>
             </el-form-item>
             <el-form-item label="鎶曚繚绫诲瀷" prop="type">
-                <el-radio-group v-model="form.type">
-                    <el-radio :label="0">鐩翠繚</el-radio>
+                <el-radio-group v-model="form.type" :disabled="form.id!=null">
+                    <el-radio :label="0" >鐩翠繚</el-radio>
                     <el-radio :label="1">濮旀墭鎶曚繚</el-radio>
                 </el-radio-group>
             </el-form-item>
+          <el-form-item label="濮旀墭鍟嗘埛" prop="shopId" v-if="form.type =='1'" :rules="form.type===1?[{required:true,message:'璇烽�夋嫨鍟嗘埛'}]:[{required:false}]">
+            <el-select v-model="form.shopId"  placeholder="璇烽�夋嫨濮旀墭鍟嗘埛">
+              <el-option
+                  v-for="item in shops"
+                  :key="item.id"
+                  :label="item.name"
+                  :value="item.id">
+              </el-option>
+            </el-select>
+          </el-form-item>
+          <el-form-item label="涓婁紶鏂规纭涔︼細" prop="fanganFile" v-if="form.type =='1'" :rules="form.type===1?[{required:true,message:'璇蜂笂浼犳柟妗堢‘璁や功'}]:[{required:false}]">
+            <UploadFile  @remove="deleFile" :uploadData="{ folder: 'apply',fileType:'.pdf' }" :fileList="form.fileList1" @uploadSuccess="editFanganFile" />
+          </el-form-item>
             <el-form-item label="鎺ユ敹鏂囦欢閭" prop="email">
                 <el-input v-model="form.email" placeholder="璇疯緭鍏�" v-trim/>
             </el-form-item>
-            <el-form-item label="鎶曚繚鍗曠绔犲叧閿瓧" prop="signKeyword">
-                <el-input v-model="form.signKeyword" placeholder="澶氫釜鑻辨枃閫楀彿闅斿紑" v-trim/>
-            </el-form-item>
+<!--            <el-form-item label="鎶曚繚鍗曠绔犲叧閿瓧锛堝鏈夊涓叧閿瓧锛岃浣跨敤鑻辨枃鍒嗗彿 ; 闅斿紑锛�" prop="signKeyword">
+                <el-input v-model="form.signKeyword" placeholder="澶氫釜鑻辨枃鍒嗗彿 ; 闅斿紑" v-trim/>
+            </el-form-item>-->
             <el-button type="primary" @click="add">娣诲姞宸ョ</el-button>
             <el-table
                 :data="form.worktypeIdList"
@@ -140,189 +154,230 @@
 </template>
 
 <script>
-    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 { solutionsId } from '@/api/business/solutions'
-    export default {
-        name: 'OperaSolutionsWindow',
-        extends: BaseOpera,
-        components: { GlobalWindow },
-        data () {
-            var validType = (rule, value, callback) => {
-                if (this.form.validType === 0 && !value) {
-                    return callback(new Error('寤惰繜澶╂暟涓嶈兘涓虹┖'));
-                }
-                callback();
-            }
-            return {
-                // 琛ㄥ崟鏁版嵁
-                form: {
-                    id: null,
-                    name: '',
-                    companyName: '',
-                    insuranceId: '',
-                    validType: 0,
-                    type: 0,
-                    minAge: '',
-                    maxAge: '',
-                    price: '',
-                    timeUnit: '',
-                    insureCycle: '',
-                    insureCycleUnit: '',
-                    email: '',
-                    specialAgreement: '',
-                    specialInfo: '',
-                    ortherInfo: '',
-                    signKeyword: '',
-                    validTypeNum: '',
-                    worktypeIdList: [{ worktypeId: '' }]
-                },
-                // 楠岃瘉瑙勫垯
-                rules: {
-                    name: [
-                        { required: true, message: '璇疯緭鍏ユ柟妗堝悕绉�' }
-                    ],
-                    insuranceId: [
-                        { required: true, message: '璇烽�夋嫨淇濋櫓鍏徃' }
-                    ],
-                    companyName: [
-                        { required: true, message: '璇疯緭鍏ユ壙淇濆叕鍙�' }
-                    ],
-                    minAge: [
-                        { required: true, message: '璇烽�夋嫨鎶曚繚骞撮緞' }
-                    ],
-                    price: [
-                        { required: true, message: '璇疯緭鍏ヤ繚闄╄垂鐢�' }
-                    ],
-                    insureCycle: [
-                        { required: true, message: '璇疯緭鍏ユ姇淇濆懆鏈�' }
-                    ],
-                    validTypeNum: [
-                        { required: true, validator: validType }
-                    ],
-                    type: [
-                        { required: true, message: '璇烽�夋嫨鎶曚繚绫诲瀷' }
-                    ],
-                    signKeyword: [
-                        { required: true, message: '璇疯緭鍏ユ姇淇濆崟绛剧珷鍏抽敭瀛�' }
-                    ]
-                },
-                company: [],
-                typeWork: []
-            }
-        },
-        created () {
-            this.config({
-                api: '/business/solutions',
-                'field.id': 'id'
-            })
-        },
-        methods: {
-            // 鍒囨崲鍏徃
-            getAllWorktype1() {
-                this.form.worktypeIdList = [{ worktypeId: '' }]
-                this.getAllWorktype()
-            },
-            // 纭鏂板缓/淇敼
-            confirm () {
-                let data = JSON.parse(JSON.stringify(this.form))
-                data.worktypeIdList = data.worktypeIdList.map(item => item.worktypeId)
-                this.$refs.form.validate((valid) => {
-                    if (!valid) {
-                        return
-                    }
-                    // 璋冪敤鏂板缓鎺ュ彛
-                    this.isWorking = true
-                    if (data.id == null || data.id === '') {
-                        this.api.create(data)
-                            .then(() => {
-                                this.visible = false
-                                this.$tip.apiSuccess('鏂板缓鎴愬姛')
-                                this.$emit('success')
-                            })
-                            .catch(e => {
-                                this.$tip.apiFailed(e)
-                            })
-                            .finally(() => {
-                                this.isWorking = false
-                            })
-                    } else {
-                        this.api.updateById(data)
-                            .then(() => {
-                                this.visible = false
-                                this.$tip.apiSuccess('淇敼鎴愬姛')
-                                this.$emit('success')
-                            })
-                            .catch(e => {
-                                this.$tip.apiFailed(e)
-                            })
-                            .finally(() => {
-                                this.isWorking = false
-                            })
-                    }
-                })
-            },
-            open (title, target) {
-                this.title = title
-                this.form.maxAge = ''
-                this.form.timeUnit = ''
-                this.form.insureCycleUnit = ''
-                this.form.validTypeNum = ''
-                this.visible = true
-                this.form.worktypeIdList = [{ worktypeId: '' }]
-                this.allCompany()
-                // 鏂板缓
-                if (target == null) {
-                    this.$nextTick(() => {
-                        this.$refs.form.resetFields()
-                        this.form[this.configData['field.id']] = null
-                    })
-                    return
-                }
-                // 缂栬緫
-                this.$nextTick(() => {
-                    solutionsId(target.id)
-                        .then(res => {
-                            for (const key in this.form) {
-                                this.form[key] = res[key]
-                            }
-                            this.form.worktypeIdList = res.worktypeList.map(item => {
-                                return {
-                                    worktypeId: item.worktypeId
-                                }
-                            })
-                            this.getAllWorktype()
-                        })
-                })
-            },
-            // 鏌ヨ淇濋櫓鍏徃涓嬪叏閮ㄥ伐绉�
-            getAllWorktype() {
-                allWorktype({
-                    insuranceId: this.form.insuranceId
-                }).then(res => {
-                    this.typeWork = res
-                })
-            },
-            // 鏌ヨ鍏ㄩ儴淇濋櫓鍏徃
-            allCompany() {
-                all({ dataType: 2 })
-                    .then(res => {
-                        console.log(res)
-                        this.company = res
-                    })
-            },
-            add() {
-                this.form.worktypeIdList.push({ worktypeId: '' })
-            },
-            dele(index) {
-                if (this.form.worktypeIdList.length === 1) {
-                    this.$message.warning('鑷冲皯瑕佷繚鐣欎竴椤�')
-                    return
-                }
-                this.form.worktypeIdList.splice(index, 1)
-            }
-        }
+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 { solutionsId } from '@/api/business/solutions'
+import { pageAll as shopList } from '@/api/business/company'
+import UploadFile from "@/components/common/UploadFile";
+export default {
+  name: 'OperaSolutionsWindow',
+  extends: BaseOpera,
+  components: { GlobalWindow ,UploadFile},
+  data () {
+    var validType = (rule, value, callback) => {
+      if (this.form.validType === 0 && !value) {
+        return callback(new Error('寤惰繜澶╂暟涓嶈兘涓虹┖'))
+      } else if (this.form.validType === 0 && !/^[0-9]*[1-9][0-9]*$/.test(value)) {
+        return callback(new Error('寤惰繜澶╂暟鍙兘涓烘鏁存暟'))
+      }
+      callback()
     }
+    return {
+      // 琛ㄥ崟鏁版嵁
+      form: {
+        id: null,
+        name: '',
+        companyName: '',
+        insuranceId: '',
+        validType: 0,
+        type: 0,
+        minAge: '',
+        maxAge: '',
+        price: '',
+        timeUnit: '',
+        shopId: null,
+        insureCycle: '',
+        insureCycleUnit: '',
+        email: '',
+        specialAgreement: '',
+        specialInfo: '',
+        ortherInfo: '',
+        signKeyword: '',
+        validTypeNum: '',
+        fileList1:[],
+        fanganFile:null,
+        worktypeIdList: [{ worktypeId: '' }]
+      },
+      // 楠岃瘉瑙勫垯
+      rules: {
+        name: [
+          { required: true, message: '璇疯緭鍏ユ柟妗堝悕绉�' }
+        ],
+        insuranceId: [
+          { required: true, message: '璇烽�夋嫨淇濋櫓鍏徃' }
+        ],
+        companyName: [
+          { required: true, message: '璇疯緭鍏ユ壙淇濆叕鍙�' }
+        ],
+        minAge: [
+          { required: true, message: '璇烽�夋嫨鎶曚繚骞撮緞' }
+        ],
+        price: [
+          { required: true, message: '璇疯緭鍏ヤ繚闄╄垂鐢�' }
+        ],
+        insureCycle: [
+          { required: true, message: '璇疯緭鍏ユ姇淇濆懆鏈�' }
+        ],
+        validTypeNum: [
+          { required: true, validator: validType }
+        ],
+        type: [
+          { required: true, message: '璇烽�夋嫨鎶曚繚绫诲瀷' }
+        ]
+        // signKeyword: [
+        //     { required: false, message: '璇疯緭鍏ユ姇淇濆崟绛剧珷鍏抽敭瀛�' }
+        // ]
+      },
+      shops: [],
+      company: [],
+      typeWork: []
+    }
+  },
+  created () {
+    this.config({
+      api: '/business/solutions',
+      'field.id': 'id'
+    })
+  },
+  methods: {
+    editFanganFile(data){
+      this.form.fanganFile=data
+    },
+    // 鍒囨崲鍏徃
+    getAllWorktype1 () {
+      this.form.worktypeIdList = [{ worktypeId: '' }]
+      this.getAllWorktype()
+    },
+    // 纭鏂板缓/淇敼
+    confirm () {
+      const data = JSON.parse(JSON.stringify(this.form))
+      data.worktypeIdList = data.worktypeIdList.map(item => item.worktypeId)
+      this.$refs.form.validate((valid) => {
+        if (!valid) {
+          return
+        }
+        if(data.type===1 &&  (!data.fanganFile || !data.fanganFile.fileurl)){
+          this.$message.error('璇蜂笂浼犳柟妗堢‘璁や功锛�')
+          return;
+        }
+        // 璋冪敤鏂板缓鎺ュ彛
+        this.isWorking = true
+        if (data.id == null || data.id === '') {
+          this.api.create(data)
+            .then(() => {
+              this.visible = false
+              this.$tip.apiSuccess('鏂板缓鎴愬姛')
+              this.$emit('success')
+            })
+            .catch(e => {
+              this.$tip.apiFailed(e)
+            })
+            .finally(() => {
+              this.isWorking = false
+            })
+        } else {
+          this.api.updateById(data)
+            .then(() => {
+              this.visible = false
+              this.$tip.apiSuccess('淇敼鎴愬姛')
+              this.$emit('success')
+            })
+            .catch(e => {
+              this.$tip.apiFailed(e)
+            })
+            .finally(() => {
+              this.isWorking = false
+            })
+        }
+      })
+    },
+    deleFile(){
+      this.form.fanganFile={}
+    },
+    open (title, target) {
+      this.title = title
+      this.visible = true
+      this.form.maxAge = ''
+      this.form.timeUnit = ''
+      this.form.insureCycleUnit = ''
+      this.form.validTypeNum = ''
+      this.form.fanganFile=null
+      this.form.fileList1= new Array();
+      this.form.worktypeIdList = [{ worktypeId: '' }]
+      // this.$refs['$upload'].clearFiles()//鍒濆鍖栧鍏ョ粍浠�
+      this.allCompany()
+      this.allShops()
+      // 鏂板缓
+      if (target == null) {
+        this.$nextTick(() => {
+          this.$refs.form.resetFields()
+          this.form.maxAge = ''
+          this.form.timeUnit = ''
+          this.form.insureCycleUnit = ''
+          this.form.validTypeNum = ''
+          this.form.fanganFile=null
+          this.form.fileList1= new Array();
+          this.form.worktypeIdList = [{ worktypeId: '' }]
+          this.form[this.configData['field.id']] = null
+        })
+        return
+      }
+      // 缂栬緫
+      this.$nextTick(() => {
+        solutionsId(target.id)
+          .then(res => {
+            for (const key in this.form) {
+              this.form[key] = res[key]
+            }
+            if(this.form.fanganFile && this.form.fanganFile.fileurl){
+              this.form.fileList1= [{url: this.form.fanganFile.fileurlFull, name:this.form.fanganFile.name}];
+            }
+            console.log(this.form.fileList1)
+            this.form.worktypeIdList = res.worktypeList.map(item => {
+              return {
+                worktypeId: item.worktypeId
+              }
+            })
+            this.getAllWorktype()
+          })
+      })
+    },
+    // 鏌ヨ淇濋櫓鍏徃涓嬪叏閮ㄥ伐绉�
+    getAllWorktype () {
+      allWorktype({
+        insuranceId: this.form.insuranceId
+      }).then(res => {
+        this.typeWork = res
+      })
+    },
+
+    // 鏌ヨ鍏ㄩ儴淇濋櫓鍏徃
+    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: '' })
+    },
+    dele (index) {
+      if (this.form.worktypeIdList.length === 1) {
+        this.$message.warning('鑷冲皯瑕佷繚鐣欎竴椤�')
+        return
+      }
+      this.form.worktypeIdList.splice(index, 1)
+    }
+  }
+}
 </script>

--
Gitblit v1.9.3