123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617 |
- <template>
- <div class="app-container">
- <div v-if="isPercentage" class="percentage" style="width: 210px;height: 90px;background: #fff;position: fixed;bottom: 0;left: 0;z-index: 9999999999999;">
- <h4 style="padding-left: 10px;line-height: 0;">导出进度:</h4>
- <el-progress style="padding-left: 10px;" :text-inside="true" :stroke-width="26" :percentage="percentage" />
- </div>
- <div v-if="List1">
- <div class="filter-container">
- <el-select v-model="getdataListParm.parammaps.pastureName" placeholder="牧场" style="width:120px" class="filter-item">
- <el-option v-for="item in findAllPasture" :key="item.id" :label="item.name" :value="item.name" />
- </el-select>
- <el-date-picker ref="inputDatetime" v-model="getdataListParm.parammaps.inputDatetime" class="inputDatetime" type="datetimerange" style="width: 250px;top:-3px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" />
- <el-select ref="statue" v-model="judgetypeARR" style="width:300px" class="filter-item" clearable multiple >
- <el-option v-for="item in getAssessmentList" :key="item.statue" :label="item.statue" :value="item.statue" />
- </el-select>
- <el-input
- v-model="getdataListParm.parammaps.empName"
- placeholder="评估人"
- clearable
- style="width: 200px;"
- class="filter-item"
- />
- <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="form_search">搜索</el-button>
- <el-button class="filter-item" style="margin-left: 10px;" type="success" icon="el-icon-upload2" @click="handleDownload">导出</el-button>
- </div>
- <div class="app-btn">
- <el-button class="filter-item" type="primary" icon="el-icon-edit" @click="form_add">评估</el-button>
- <el-button class="filter-item" type="warning" @click="handleInspectionStandard">检查标准管理</el-button>
- </div>
- <el-table
- :key="tableKey"
- v-loading="listLoading"
- element-loading-text="给我一点时间"
- :data="list"
- border
- fit
- highlight-current-row
- style="width: 100%;"
- :row-style="rowStyle"
- :cell-style="cellStyle"
- class="elTable table-fixed"
- :max-height="myHeight"
- >
- <el-table-column label="序号" align="center" type="index" width="50px">
- <template slot-scope="scope">
- <span>{{ scope.$index + (pageNum-1) * pageSize + 1 }}</span>
- </template>
- </el-table-column>
- <el-table-column label="牧场" min-width="110px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.pastureName }}</span>
- </template>
- </el-table-column>
- <el-table-column label="评估时间" min-width="130px" align="center" sortable prop="batime" />
- <el-table-column label="评估人" min-width="100px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.empName }}</span>
- </template>
- </el-table-column>
- <el-table-column label="评估分数" min-width="120px" align="center" sortable prop="scores" />
- <el-table-column label="操作" align="center" width="300px" class-name="small-padding fixed-width" fixed="right">
- <template slot-scope="{row}">
- <el-button type="primary" size="mini" @click="form_see(row)">查看</el-button>
- <el-button type="success" size="mini" @click="form_edit(row)">编辑</el-button>
- <el-button type="danger" size="mini" @click="form_delete(row)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <pagination v-show="total>0" :total="total" :page.sync="getdataListParm.offset" :limit.sync="getdataListParm.pagecount" @pagination="get_table_data" />
- <!-- 评估/编辑 -->
- <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisibleAdd" :close-on-click-modal="false" width="80%">
- <div class="app-add">
- <el-form ref="createTemp" :rules="rules" :model="createTemp" label-position="right" label-width="110px" style="width:80%;margin:0 auto;">
- <el-row>
- <el-col :span="8">
- <el-form-item label="牧场:" prop="pastureId">
- <el-select v-model="createTemp.pastureId" style="width:100%" class="filter-item" :disabled="dialogStatus === 'update'">
- <el-option v-for="item in findAllPasture" :key="item.id" :label="item.name" :value="item.id" />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="评估人:" prop="empId">
- <el-select v-model="createTemp.empId" placeholder="录入人" class="filter-item" style="width:100%">
- <el-option v-for="item in findAllEmploye" :key="item.id" :label="item.name" :value="item.id" />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="评估日期:" prop="batime">
- <el-date-picker v-model="createTemp.batime" :clearable="false" type="date" placeholder="选择日期" style="top:-3px;width:100%" format="yyyy-MM-dd" value-format="yyyy-MM-dd" />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row v-if="dialogStatus==='assessment'">
- <el-col :span="8">
- <el-form-item label="检查类别:" prop="createTemp.statue">
- <el-select ref="statue" v-model="createTemp.statue" style="width:100%" class="filter-item" @change="changeStatue">
- <el-option v-for="item in list2" :key="item.id" :label="item.statue" :value="item.id" />
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <el-table
- :key="tableKeyAdd"
- v-loading="listLoadingAdd"
- element-loading-text="给我一点时间"
- :data="listAdd"
- border
- fit
- highlight-current-row
- style="width: 100%;"
- :row-style="rowStyle"
- :cell-style="cellStyle"
- class="elTable table-fixed"
- >
- <el-table-column label="序号" type="index" width="50" align="center" />
- <el-table-column label="检查类别" min-width="110px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.judgetype }}</span>
- </template>
- </el-table-column>
- <el-table-column label="检查标准" min-width="110px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.statue }}</span>
- </template>
- </el-table-column>
- <el-table-column label="检查结果" min-width="130px" align="center">
- <template slot-scope="scope">
- <el-select v-model="scope.row.score" filterable placeholder="检查结果">
- <el-option
- v-for="item in inspectionResultsList"
- :key="item.id"
- :label="item.name"
- :value="item.name"
- />
- </el-select>
- </template>
- </el-table-column>
- <el-table-column label="问题描述" min-width="100px" align="center">
- <template slot-scope="scope">
- <el-form :model="scope.row" :rules="rules">
- <el-form-item prop="note">
- <el-input v-model="scope.row.note" autosize type="textarea" style="width:90%;height:25px" />
- <!-- <el-input v-model="scope.row.note" style="width:100px;margin-top:25px;height:10px" /> -->
- </el-form-item>
- </el-form>
- </template>
- </el-table-column>
- <el-table-column label="问题照片" width="280px" align="center">
- <template slot-scope="{row}">
- <el-upload
- id="uploadPic"
- ref="upload"
- :limit="3"
- list-type="picture-card"
- :file-list="row.fileList"
- :headers="headers"
- :action="uploadImageUrl"
- :auto-upload="true"
- :on-preview="handlePicPreview"
- :before-remove="beforeRemove"
- :class="{hide:row.showUpload}"
- :on-change="(file,fileList)=>{ return handlePicChange(file, fileList,row) }"
- :on-success="(response,file, fileList)=>{ return handlePicSuccess(response,file, fileList,row) }"
- :on-remove="(file, fileList)=>{ return handlePicRemove(file, fileList,row) }"
- >
- <i class="el-icon-plus" />
- </el-upload>
- <el-dialog :visible.sync="dialogVisible" append-to-body :width="width">
- <img :src="dialogImageUrl" alt="" @load="onLoad">
- </el-dialog>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <div slot="footer" class="dialog-footer" style="bottom:5px">
- <!-- <el-button type="primary" :disabled="isokDisable" @click="dialogStatus==='assessment'?add_dialog_saveAdd():edit_dialog_save()">保存并关闭</el-button> -->
- <el-button v-if="dialogStatus==='assessment'" type="primary" :disabled="isokDisable" @click="add_dialog_saveAdd()">保存并关闭</el-button>
- <el-button v-if="dialogStatus==='update'" type="primary" :disabled="isokDisable" @click="edit_dialog_save()">保存并关闭</el-button>
- <el-button @click="dialogFormVisibleAdd = false;">取消并关闭</el-button>
- </div>
- </el-dialog>
- <!-- 查看 -->
- <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisibleSee" :close-on-click-modal="false" width="80%">
- <div class="app-see">
- <el-form ref="seeTemp" :rules="rules" :model="seeTemp" label-position="right" label-width="110px" style="width:80%;margin:0 auto;">
- <el-row>
- <el-col :span="8">
- <el-form-item label="牧场:" prop="pastureName">
- <el-input ref="pastureName" v-model="seeTemp.pastureName" />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="评估人:" prop="empName">
- <el-input ref="empName" v-model="seeTemp.empName" />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="评估日期:" prop="batime">
- <el-input ref="batime" v-model="seeTemp.batime" />
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <el-table
- :key="tableKeySee"
- v-loading="listLoadingSee"
- element-loading-text="给我一点时间"
- :data="listSee"
- border
- fit
- highlight-current-row
- style="width: 100%;"
- :row-style="rowStyle"
- :cell-style="cellStyle"
- class="elTable table-fixed"
- >
- <el-table-column label="序号" align="center" type="index" width="50px">
- <template slot-scope="scope">
- <span>{{ scope.$index + (pageNumSee-1) * pageSizeSee + 1 }}</span>
- </template>
- </el-table-column>
- <el-table-column label="检查类别" min-width="110px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.judgetype }}</span>
- </template>
- </el-table-column>
- <el-table-column label="检查标准" min-width="110px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.statue }}</span>
- </template>
- </el-table-column>
- <el-table-column label="检查结果" min-width="130px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.score }}</span>
- </template>
- </el-table-column>
- <el-table-column label="问题描述" min-width="100px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.note }}</span>
- </template>
- </el-table-column>
- <el-table-column label="问题照片" min-width="200px" align="center">
- <template slot-scope="{row}">
- <el-upload
- id="uploadPicSee"
- ref="upload"
- list-type="picture-card"
- :file-list="row.fileList"
- :action="uploadImageUrl"
- :on-preview="handlePicPreview"
- :class="{hide:row.showUpload}"
- >
- <i class="el-icon-plus" />
- </el-upload>
- <el-dialog :visible.sync="dialogVisible" append-to-body :width="width">
- <img :src="dialogImageUrl" alt="" @load="onLoad">
- </el-dialog>
- </template>
- </el-table-column>
- </el-table>
- <pagination v-show="totalSee>0" :total="totalSee" :page.sync="getdataListParmSee.offset" :limit.sync="getdataListParmSee.pagecount" @pagination="get_table_dataSee" />
- </div>
- <div slot="footer" class="dialog-footer" style="bottom:5px">
- <el-button class="filter-item" type="success" icon="el-icon-upload2" @click="handleDownloadSee">导出</el-button>
- <el-button @click="dialogFormVisibleSee = false;">关闭</el-button>
- </div>
- </el-dialog>
- </div>
- <!-- 检查标准管理 -->
- <div v-if="List2">
- <div class="title2">
- <b class="title2-l">检查标准管理</b>
- <a class="title2-l" style="margin-left: 20px;" @click="goBack"><返回</a>
- </div>
- <div class="app-btn">
- <el-button class="filter-item" type="primary" icon="el-icon-edit" @click="form_add2">新增</el-button>
- <el-button class="filter-item" type="info" icon="el-icon-tickets" @click="handleDownloadTemp2">模板</el-button>
- <el-upload style="display: inline-block;" :headers="headers2" :data="uploadData2" :action="uploadExcelUrl2" :show-file-list="false" :before-upload="beforeImportExcel2" :on-success="handleImportExcelSuccess2">
- <el-button v-waves class="filter-item" type="warning" icon="el-icon-download">导入</el-button>
- </el-upload>
- </div>
- <el-table
- :key="tableKey2"
- v-loading="listLoading2"
- element-loading-text="给我一点时间"
- :data="list2"
- border
- fit
- highlight-current-row
- style="width: 100%;"
- :row-style="rowStyle"
- :cell-style="cellStyle"
- class="elTable table-fixed"
- :max-height="myHeight"
- >
- <el-table-column label="序号" align="center" type="index" width="50px">
- <template slot-scope="scope">
- <span>{{ scope.$index + (pageNum2-1) * pageSize2 + 1 }}</span>
- </template>
- </el-table-column>
- <el-table-column label="检查类别" min-width="110px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.statue }}</span>
- </template>
- </el-table-column>
- <el-table-column label="操作" align="center" width="300px" class-name="small-padding fixed-width" fixed="right">
- <template slot-scope="{row}">
- <el-button type="success" size="mini" @click="form_see2(row)">查看</el-button>
- <el-button type="success" size="mini" @click="form_edit2(row)">编辑</el-button>
- <el-button type="danger" size="mini" @click="form_delete2(row)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <pagination v-show="total2>0" :total="total2" :page.sync="getdataListParm2.offset" :limit.sync="getdataListParm2.pagecount" @pagination="get_table_data2" />
- <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" :close-on-click-modal="false" width="80%">
- <div class="app-add">
- <el-form ref="createTemp" :rules="rules" :model="createTemp" label-position="right" label-width="110px" style="width:80%;margin:0 auto;">
- <el-row>
- <el-col :span="10">
- <el-form-item label="检查类别:" prop="statue">
- <el-input v-model="createTemp.statue" placeholder="请输入检查类别" :disabled="dialogStatus=='see'" />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col>
- <el-button v-if="dialogStatus==='update' || dialogStatus==='create'" class="filter-item" type="primary" @click="handleAddStandard">添加标准</el-button>
- </el-col>
- </el-row>
- </el-form>
- <el-table
- :key="tableKey3"
- v-loading="listLoading3"
- element-loading-text="给我一点时间"
- :data="list3"
- border
- fit
- highlight-current-row
- style="width: 90%;margin: 0 auto 50px;"
- :row-style="rowStyle"
- :cell-style="cellStyle"
- class="elTable table-fixed"
- >
- <el-table-column label="序号" align="center" type="index" width="50px" />
- <el-table-column label="检查标准" min-width="110px" align="center">
- <template slot-scope="scope">
- <el-form v-if="dialogStatus==='update' || dialogStatus==='create'" :model="scope.row">
- <el-form-item prop="statue">
- <el-input v-model="scope.row.statue" autosize type="textarea" style="width:90%;height:25px" :disabled="dialogStatus=='see'" />
- </el-form-item>
- </el-form>
- <span v-if="dialogStatus==='see'">{{ scope.row.statue }}</span>
- </template>
- </el-table-column>
- <el-table-column v-if="dialogStatus==='update' || dialogStatus==='create'" label="操作" align="center" width="300px" class-name="small-padding fixed-width" fixed="right">
- <template slot-scope="{row}">
- <el-button type="danger" size="mini" @click="form_delete3(row)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <div slot="footer" class="dialog-footer">
- <el-button v-if="dialogStatus==='update' || dialogStatus==='create'" type="primary" :disabled="isokDisable" @click="dialogStatus==='create'?add_dialog_save2():edit_dialog_save2()">保存并关闭</el-button>
- <el-button @click="dialogFormVisible = false;get_table_data2();">取消并关闭</el-button>
- </div>
- </div>
- </el-dialog>
- </div>
- </div>
- </template>
- <script>
- // import { getToken } from '@/utils/auth'
- import { GetDataByNames, GetDataByName, PostDataByName, failproccess, ExecDataByConfig, GetAccount } from '@/api/common'
- import waves from '@/directive/waves'
- import Cookies from 'js-cookie'
- import Pagination from '@/components/Pagination'
- import { MessageBox } from 'element-ui'
- import { parseTime, sortChange, json2excel } from '@/utils/index.js'
- import { getToken } from '@/utils/auth'
- import table2excel from 'js-table2excel'
- export default {
- name: 'Assessment',
- components: { Pagination },
- directives: { waves },
- data() {
- return {
- myHeight:document.documentElement.clientHeight - 85- 200,
- rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
- cellStyle: { padding: 0 + 'px' },
- findAllPasture: [],
- findAllEmploye: [],
- inspectionResultsList: [{ id: 1, name: 1 }, { id: 2, name: 2 }, { id: 3, name: 3 }, { id: 4, name: 4 }, { id: 5, name: 5 }],
- requestParams: [
- { name: 'findAllEmploye', offset: 0, pagecount: 0, parammaps: { 'pastureId': Cookies.get('pastureid') }},
- { name: 'findAllPasture', offset: 0, pagecount: 0, returntype: 'Map', parammaps: { 'id': Cookies.get('pastureid') }},
- { name: 'getAssessmentList', offset: 0, pagecount: 0, parammaps: { 'pastureId': Cookies.get('pastureid') }}
- ],
- isokDisable: false,
- List1: true,
- List2: false, // 评估检查管理
- getAssessmentList:[],
- rules: {
- statue: [{ required: true, message: '必填', trigger: 'blur' }]
- },
- dialogFormVisibleAdd: false,
- getdataListParm: {
- name: 'getbigjudgeList',
- page: 1,
- offset: 1,
- pagecount: 10,
- returntype: 'Map',
- parammaps: {
- pastureName: Cookies.get('pasturename'),
- judgetype: '',
- empName:'',
- startTime: '',
- stopTime: '',
- inputDatetime: ''
- }
- },
- judgetypeARR: [],
- list: [],
- tableKey: 0,
- total: 0,
- listLoading: true,
- dialogFormVisibleSee: false,
- getdataListParmSee: {
- name: 'getjudgeListBybig',
- page: 1,
- offset: 1,
- pagecount: 10,
- returntype: 'Map',
- parammaps: {}
- },
- getDownloadSeeParm: {
- name: 'getjudgeListBybig',
- returntype: 'Map',
- parammaps: {}
- },
- listSee: [],
- listSee2: [],
- tableKeySee: 0,
- totalSee: 0,
- listLoadingSee: true,
- seeTemp: {},
- listAdd: [],
- tableKeyAdd: 0,
- listLoadingAdd: false,
- dialogImageUrl: '',
- dialogVisible: false,
- fileList: [],
- headers: {
- optname: 'insertcustompic',
- id: 1,
- token: getToken() // 从cookie里获取token,并赋值token
- },
- uploadImageUrl: process.env.VUE_APP_BASE_API + 'authdata/uploaderimage',
- width: '',
- postDataPramas: {},
- getdataListParmUpdate: {
- name: 'getjudgeListBybig',
- returntype: 'Map',
- parammaps: {}
- },
- getdataListParm2: {
- name: 'getAssessmentList',
- page: 1,
- offset: 1,
- pagecount: 10,
- returntype: 'Map',
- parammaps: {}
- },
- getdataListParm3: {
- name: 'getAssessmentList',
- page: 1,
- offset: 1,
- pagecount: 10,
- returntype: 'Map',
- parammaps: {}
- },
- list2: [],
- tableKey2: 0,
- total2: 0,
- listLoading2: true,
- judgetype: '',
- dialogStatus: '',
- dialogFormVisible: false,
- textMap: {
- update: '编辑',
- create: '新增',
- see: '查看',
- assessment: '评估'
- },
- tableKey3: 0,
- listLoading3: false,
- list3: [],
- getdataListParmSee2: {
- name: 'getAssessmentListBybigid',
- returntype: 'Map',
- parammaps: {}
- },
- createTemp: {
- statue: '',
- pastureId: this.$store.state.user.pastureid,
- batime: parseTime(new Date(), '{y}-{m}-{d}'),
- empId: this.$store.state.user.employeid
- },
- postDataParam: {},
- isPercentage: false,
- percentage: 1
- }
- },
- computed: {
- headers2() {
- return {
- token: getToken()
- }
- },
- uploadData2() {
- return {
- name: 'uploadAssessment',
- importParams: '检查类别,检查标准',
- sheetname: 'SheetJS'
- }
- },
- // 设置上传地址
- uploadExcelUrl2() {
- return process.env.VUE_APP_BASE_API + 'authdata/ImportExcel'
- }
- },
- created() {
- this.get_select_list()
- this.get_table_data()
- console.log(this.uploadImageUrl)
- },
- methods: {
- get_select_list() {
- GetDataByNames(this.requestParams).then(response => {
- this.findAllPasture = response.data.findAllPasture.list
- this.findAllEmploye = response.data.findAllEmploye.list
- this.getAssessmentList = response.data.getAssessmentList.list
- })
- },
- get_table_data() {
- console.log(this.$refs['inputDatetime'], '------------------')
- if (this.$refs['inputDatetime'] !== undefined && this.$refs['inputDatetime'].value !== null) {
- this.getdataListParm.parammaps.startTime = this.$refs['inputDatetime'].value[0]
- this.getdataListParm.parammaps.stopTime = this.$refs['inputDatetime'].value[1]
- } else {
- this.getdataListParm.parammaps.startTime = ''
- this.getdataListParm.parammaps.stopTime = ''
- }
- this.listLoading = true
- console.log(this.getdataListParm.parammaps, '------------------')
- if(this.judgetypeARR.length !== 0){
- this.getdataListParm.parammaps.judgetype = this.judgetypeARR.join(",")
- }else{
- this.getdataListParm.parammaps.judgetype = ""
- }
- GetDataByName(this.getdataListParm).then(response => {
- this.list = response.data.list
- this.pageNum = response.data.pageNum
- this.pageSize = response.data.pageSize
- if (response.data.total) {
- this.total = response.data.total
- }
- setTimeout(() => {
- this.listLoading = false
- }, 300)
- })
- },
- form_search() {
- console.log('点击了搜索')
- this.listLoading = true
- if (this.getdataListParm.parammaps.inputDatetime === null) {
- this.getdataListParm.parammaps.inputDatetime = ''
- }
- this.getdataListParm.offset = 1
- this.get_table_data()
- },
- form_see(row) {
- console.log('查看')
- this.seeTemp = Object.assign(row, {})
- this.dialogStatus = 'see'
- this.dialogFormVisibleSee = true
- this.get_table_dataSee()
- },
- get_table_dataSee() {
- this.listLoadingSee = true
- this.getdataListParmSee.parammaps.id = this.seeTemp.id
- GetDataByName(this.getdataListParmSee).then(response => {
- this.listSee = response.data.list
- if (response.data.list !== null) {
- for (var i = 0; i < response.data.list.length; i++) {
- console.log(response.data.list[i])
- const urlArray = []
- const fileList = []
- if (response.data.list[i].picpath1 == undefined && response.data.list[i].picpath2 == undefined && response.data.list[i].picpath3 == undefined) {
- urlArray.push()
- } else if (response.data.list[i].picpath1 == undefined) {
- urlArray.push(process.env.VUE_APP_BASE_API + response.data.list[i].picpath2, process.env.VUE_APP_BASE_API + response.data.list[i].picpath3)
- } else if (response.data.list[i].picpath2 == undefined && response.data.list[i].picpath3 == undefined) {
- urlArray.push(process.env.VUE_APP_BASE_API + response.data.list[i].picpath1)
- } else if (response.data.list[i].picpath2 == undefined) {
- urlArray.push(process.env.VUE_APP_BASE_API + response.data.list[i].picpath1, process.env.VUE_APP_BASE_API + response.data.list[i].picpath3)
- } else if (response.data.list[i].picpath3 == undefined) {
- urlArray.push(process.env.VUE_APP_BASE_API + response.data.list[i].picpath1, process.env.VUE_APP_BASE_API + response.data.list[i].picpath2)
- } else {
- urlArray.push(process.env.VUE_APP_BASE_API + response.data.list[i].picpath1, process.env.VUE_APP_BASE_API + response.data.list[i].picpath2, process.env.VUE_APP_BASE_API + response.data.list[i].picpath3)
- }
- for (let i = 0; i < urlArray.length; i++) {
- const urlObj = {}
- this.$set(urlObj, 'url', urlArray[i])
- fileList.push(urlObj)
- }
- this.$set(this.listSee[i], 'fileList', fileList)
- console.log(this.listSee)
- this.listSee[i].showUpload = true
- }
- }
- this.pageNumSee = response.data.pageNum
- this.pageSizeSee = response.data.pageSize
- if (response.data.total) {
- this.totalSee = response.data.total
- }
- setTimeout(() => {
- this.listLoadingSee = false
- }, 300)
- })
- },
- handleDownloadSee() {
- this.listLoadingSee = true
- this.$alert('评估验证正在导出中,请勿刷新或离开本页面,若导出时间过长,建议缩小导出数据范围重新导出', {})
- this.isPercentage = true
- this.percentage = 1
- var timer = setInterval(() => {
- this.percentage += 5
- if (this.percentage > 95) {
- this.percentage = 99
- clearInterval(timer)
- }
- this.percentage = this.percentage
- }, 1000)
- this.getDownloadSeeParm.parammaps.id = this.seeTemp.id
- GetAccount(this.getDownloadSeeParm).then(response => {
- this.listSee = response.data.list
- if (response.data.list !== null) {
- this.percentage = 99
- setTimeout(() => {
- this.isPercentage = false
- }, 2000)
- for (var i = 0; i < response.data.list.length; i++) {
- const urlArray = []
- const fileList = []
- if (response.data.list[i].picpath1 == undefined && response.data.list[i].picpath2 == undefined && response.data.list[i].picpath3 == undefined) {
- urlArray.push()
- } else if (response.data.list[i].picpath1 == undefined) {
- urlArray.push(process.env.VUE_APP_BASE_API + response.data.list[i].picpath2, process.env.VUE_APP_BASE_API + response.data.list[i].picpath3)
- } else if (response.data.list[i].picpath2 == undefined && response.data.list[i].picpath3 == undefined) {
- urlArray.push(process.env.VUE_APP_BASE_API + response.data.list[i].picpath1)
- } else if (response.data.list[i].picpath2 == undefined) {
- urlArray.push(process.env.VUE_APP_BASE_API + response.data.list[i].picpath1, process.env.VUE_APP_BASE_API + response.data.list[i].picpath3)
- } else if (response.data.list[i].picpath3 == undefined) {
- urlArray.push(process.env.VUE_APP_BASE_API + response.data.list[i].picpath1, process.env.VUE_APP_BASE_API + response.data.list[i].picpath2)
- } else {
- urlArray.push(process.env.VUE_APP_BASE_API + response.data.list[i].picpath1, process.env.VUE_APP_BASE_API + response.data.list[i].picpath2, process.env.VUE_APP_BASE_API + response.data.list[i].picpath3)
- }
- for (let i = 0; i < urlArray.length; i++) {
- const urlObj = {}
- this.$set(urlObj, 'url', urlArray[i])
- fileList.push(urlObj)
- }
- this.$set(this.listSee[i], 'fileList', fileList)
- console.log(this.listSee)
- this.listSee[i].showUpload = true
- }
- console.log(this.listSee)
- var downloadseeArray = []
- for (let i = 0; i < this.listSee.length; i++) {
- var downloadseeObj = {}
- this.$set(downloadseeObj, 'pastureName', this.seeTemp.pastureName)
- this.$set(downloadseeObj, 'empName', this.seeTemp.empName)
- this.$set(downloadseeObj, 'batime', this.seeTemp.batime)
- this.$set(downloadseeObj, 'judgetype', this.listSee[i].judgetype)
- this.$set(downloadseeObj, 'statue', this.listSee[i].statue)
- this.$set(downloadseeObj, 'score', this.listSee[i].score)
- this.$set(downloadseeObj, 'note', this.listSee[i].note)
- this.$set(downloadseeObj, 'mypic1', process.env.VUE_APP_BASE_API + this.listSee[i].picpath1)
- this.$set(downloadseeObj, 'mypic2', process.env.VUE_APP_BASE_API + this.listSee[i].picpath2)
- this.$set(downloadseeObj, 'mypic3', process.env.VUE_APP_BASE_API + this.listSee[i].picpath3)
- downloadseeArray.push(downloadseeObj)
- }
- console.log('downloadseeArray', downloadseeArray)
- const column = [
- { title: '牧场', key: 'pastureName', type: 'text' },
- { title: '评估人', key: 'empName', type: 'text' },
- { title: '评估日期', key: 'batime', type: 'text' },
- { title: '检查类别', key: 'judgetype', type: 'text' },
- { title: '检查标准', key: 'statue', type: 'text' },
- { title: '检查结果', key: 'score', type: 'text' },
- { title: '问题描述', key: 'note', type: 'text' },
- { title: '问题图片', key: 'mypic1', type: 'image', width: 80, height: 60 },
- { title: '问题图片', key: 'mypic2', type: 'image', width: 80, height: 60 },
- { title: '问题图片', key: 'mypic3', type: 'image', width: 80, height: 60 }
- ]
- const data = downloadseeArray
- const excelName = '评估验证'
- table2excel(column, data, excelName)
- }
- setTimeout(() => {
- this.listLoadingSee = false
- }, 300)
- })
- },
- form_add() {
- console.log('点击了评估')
- this.createTemp.statue = ''
- this.createTemp.empId = this.$store.state.user.employeid
- this.createTemp.pastureId = this.$store.state.user.pastureid
- this.createTemp.batime = parseTime(new Date(), '{y}-{m}-{d}')
- this.dialogStatus = 'assessment'
- this.dialogFormVisibleAdd = true
- this.listAdd = []
- this.get_table_data2()
- },
- changeStatue(val) {
- // this.createTemp.statue = parseInt(val)
- // console.log(val)
- this.listAdd = []
- this.getdataListParmSee2.parammaps.id = val
- this.get_table_dataSee2()
- if (this.list2.find(obj => obj.id == val)) {
- console.log(this.list2.find(obj => obj.id == val).statue)
- this.judgetype = this.list2.find(obj => obj.id == val).statue
- }
- console.log(this.listAdd)
- },
- handlePicChange(file, fileList, row) {
- // console.log(response, '文件状态改变时的钩子response')
- console.log(file, '文件状态改变时的钩子file')
- console.log(fileList, '文件状态改变时的钩子fileList------------')
- console.log(row, '文件状态改变时的钩子row')
- console.log(row.showUpload, '文件状态改变时的钩子row')
- if (fileList.length > 2) {
- this.$nextTick(() => {
- this.$set(row, 'showUpload', true)
- })
- } else {
- this.$nextTick(() => {
- row.showUpload = false
- })
- }
- console.log(row)
- },
- handlePicSuccess(response, file, fileList, row) {
- // console.log(response, '文件上传成功时的钩子response')
- // console.log(file, '文件上传成功时的钩子file')
- // console.log(fileList, '文件上传成功时的钩子fileList')
- // console.log(row, '文件上传成功时的钩子row')
- // console.log(response.execresult.LastInsertId, '文件上传成功时的钩子response')
- // console.log(fileList.length, 'fileList.length')
- if (fileList.length > 2) {
- this.$nextTick(() => {
- row.showUpload = true
- })
- } else {
- this.$nextTick(() => {
- row.showUpload = false
- })
- }
- if (row.pic1 === undefined || row.pic1 == -1) {
- this.$set(row, 'pic1', response.execresult.LastInsertId)
- } else if (row.pic2 === undefined || row.pic2 == -1) {
- this.$set(row, 'pic2', response.execresult.LastInsertId)
- } else if (row.pic3 === undefined || row.pic3 == -1) {
- this.$set(row, 'pic3', response.execresult.LastInsertId)
- }
- console.log(row, '文件上传成功时的钩子row')
- },
- handlePicRemove(file, fileList, row) {
- console.log(file, '文件列表移除文件时的钩子file---')
- console.log(fileList, '文件列表移除文件时的钩子fileList--')
- console.log(row, '文件列表移除文件时的钩子row---')
- // console.log(this.dialogStatus)update
- if (this.dialogStatus === 'assessment') {
- if (fileList.length < 3) {
- this.$set(row, 'showUpload', false)
- // row.showUpload = false
- }
- for (const key in row) {
- if (row[key] === file.response.execresult.LastInsertId) {
- this.$delete(row, key)
- }
- }
- } else if (this.dialogStatus === 'update') {
- if (fileList.length < 3) {
- row.showUpload = false
- }
- const url = 'uploads' + file.url.split('uploads')[1]
- for (const key in row) {
- if (row[key] === url) {
- console.log(key)
- if (key === 'picpath1') {
- this.$delete(row, 'pic1')
- } else if (key === 'picpath2') {
- this.$delete(row, 'pic2')
- } else if (key === 'picpath3') {
- this.$delete(row, 'pic3')
- }
- }
- }
- }
- console.log(row, '文件列表移除文件时的钩子row')
- },
- handlePicPreview(file) {
- this.dialogImageUrl = file.url
- this.dialogVisible = true
- },
- onLoad(e) {
- const img = e.target
- let width = 0
- if (img.fileSize > 0 || (img.width > 1 && img.height > 1)) {
- width = img.width + 40
- }
- this.width = width + 'px'
- },
- add_dialog_saveAdd() {
- console.log('点击了保存')
- this.isokDisable = true
- setTimeout(() => {
- this.isokDisable = false
- }, 1000)
- this.$refs['createTemp'].validate(valid => {
- if (valid) {
- for (var i = 0; i < this.listAdd.length; i++) {
- if (this.listAdd[i].score == null) {
- this.$message({
- type: 'warning',
- message: '请检查检查结果是否为空',
- duration: 2000
- })
- return false
- }
- console.log(this.listAdd[i].pic1)
- if (this.listAdd[i].pic1 == undefined) {
- this.listAdd[i].pic1 = -1
- }
- if (this.listAdd[i].pic2 == undefined) {
- this.listAdd[i].pic2 = -1
- }
- if (this.listAdd[i].pic3 == undefined) {
- this.listAdd[i].pic3 = -1
- }
- }
- this.postDataPramas.common = { 'returnmap': '0' }
- this.postDataPramas.data = []
- this.postDataPramas.data[0] = { 'name': 'insertBigjudge', 'type': 'e', 'parammaps': {
- pastureId: this.createTemp.pastureId,
- batime: this.createTemp.batime,
- empId: this.createTemp.empId
- }}
- this.postDataPramas.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.listAdd }}
- this.postDataPramas.data[1].children = []
- this.postDataPramas.data[1].children[0] = { 'name': 'insertjudge', 'type': 'e', 'parammaps': {
- bigId: '@insertBigjudge.LastInsertId',
- judgetype: '@insertSpotList.judgetype',
- statue: '@insertSpotList.statue',
- score: '@insertSpotList.score',
- note: '@insertSpotList.note',
- pic1: '@insertSpotList.pic1',
- pic2: '@insertSpotList.pic2',
- pic3: '@insertSpotList.pic3'
- }}
- ExecDataByConfig(this.postDataPramas).then(response => {
- console.log('新增保存发送参数', this.postDataPramas)
- if (response.msg === 'fail') {
- this.$notify({
- title: '保存失败',
- message: response.data,
- type: 'warning',
- duration: 2000
- })
- } else {
- this.getdataListParm.parammaps.inputDatetime = ''
- this.get_table_data()
- this.dialogFormVisibleAdd = false
- this.createTemp.providerName = ''
- this.$notify({
- title: '',
- message: '保存成功',
- type: 'success',
- duration: 2000
- })
- }
- })
- }
- })
- },
- beforeRemove(file, fileList) {
- console.log(file.response, '删除文件之前的钩子,参数为上传的文件和文件列表')
- return this.$confirm('删除当前图片, 是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- })
- },
- form_edit(row) {
- console.log('编辑', row)
- this.dialogStatus = 'update'
- this.dialogFormVisibleAdd = true
- this.createTemp = Object.assign(row, {})
- this.get_table_dataUpdate()
- this.get_table_data2()
- },
- get_table_dataUpdate() {
- this.listLoadingAdd = true
- this.getdataListParmUpdate.parammaps.id = this.createTemp.id
- GetDataByName(this.getdataListParmUpdate).then(response => {
- this.listAdd = response.data.list
- console.log(this.listAdd, 'this,listAdd')
- if (response.data.list !== null) {
- for (let i = 0; i < response.data.list.length; i++) {
- // this.$set(this.listAdd[0].file.response.execresult.LastInsertId)
- console.log(response.data.list[i])
- const urlArray = []
- const fileList = []
- if (response.data.list[i].picpath1 == undefined && response.data.list[i].picpath2 == undefined && response.data.list[i].picpath3 == undefined) {
- urlArray.push()
- } else if (response.data.list[i].picpath1 == undefined) {
- urlArray.push(process.env.VUE_APP_BASE_API + response.data.list[i].picpath2, process.env.VUE_APP_BASE_API + response.data.list[i].picpath3)
- } else if (response.data.list[i].picpath2 == undefined && response.data.list[i].picpath3 == undefined) {
- urlArray.push(process.env.VUE_APP_BASE_API + response.data.list[i].picpath1)
- } else if (response.data.list[i].picpath2 == undefined) {
- urlArray.push(process.env.VUE_APP_BASE_API + response.data.list[i].picpath1, process.env.VUE_APP_BASE_API + response.data.list[i].picpath3)
- } else if (response.data.list[i].picpath3 == undefined) {
- urlArray.push(process.env.VUE_APP_BASE_API + response.data.list[i].picpath1, process.env.VUE_APP_BASE_API + response.data.list[i].picpath2)
- } else {
- urlArray.push(process.env.VUE_APP_BASE_API + response.data.list[i].picpath1, process.env.VUE_APP_BASE_API + response.data.list[i].picpath2, process.env.VUE_APP_BASE_API + response.data.list[i].picpath3)
- }
- for (let i = 0; i < urlArray.length; i++) {
- const urlObj = {}
- this.$set(urlObj, 'url', urlArray[i])
- fileList.push(urlObj)
- }
- this.$set(this.listAdd[i], 'fileList', fileList)
- console.log(this.listAdd)
- if (this.listAdd[i].fileList.length > 2) {
- this.listAdd[i].showUpload = true
- } else {
- this.listAdd[i].showUpload = false
- }
- // if (this.listAdd[i].fileList.length > 2) {
- // this.$nextTick(() => {
- // this.$set(this.listAdd[i], 'showUpload', false)
- // })
- // } else {
- // this.$nextTick(() => {
- // this.$set(this.listAdd[i], 'showUpload', false)
- // })
- // }
- }
- }
- // console.log(this.listAdd)
- setTimeout(() => {
- this.listLoadingAdd = false
- }, 300)
- })
- },
- edit_dialog_save() {
- console.log('点击了编辑保存', this.listAdd)
- console.log('点击了保存')
- this.isokDisable = true
- setTimeout(() => {
- this.isokDisable = false
- }, 1000)
- this.$refs['createTemp'].validate(valid => {
- if (valid) {
- for (var i = 0; i < this.listAdd.length; i++) {
- if (this.listAdd[i].score == null) {
- this.$message({
- type: 'warning',
- message: '请检查检查结果是否为空',
- duration: 2000
- })
- return false
- }
- console.log(this.listAdd[i].pic1)
- if (this.listAdd[i].pic1 == undefined) {
- this.listAdd[i].pic1 = -1
- }
- if (this.listAdd[i].pic2 == undefined) {
- this.listAdd[i].pic2 = -1
- }
- if (this.listAdd[i].pic3 == undefined) {
- this.listAdd[i].pic3 = -1
- }
- }
- this.postDataPramas.common = { 'returnmap': '0' }
- this.postDataPramas.data = []
- // this.postDataPramas.data[0] = { 'name': 'deletejudge', 'type': 'e', 'parammaps': {
- // bigId: this.createTemp.id
- // }}
- this.postDataPramas.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.listAdd }}
- this.postDataPramas.data[0].children = []
- this.postDataPramas.data[0].children[0] = { 'name': 'updatejudge', 'type': 'e', 'parammaps': {
- bigId: this.createTemp.id,
- judgetype: '@insertSpotList.judgetype',
- statue: '@insertSpotList.statue',
- score: '@insertSpotList.score',
- note: '@insertSpotList.note',
- pic1: '@insertSpotList.pic1',
- pic2: '@insertSpotList.pic2',
- pic3: '@insertSpotList.pic3',
- id: '@insertSpotList.id'
- }}
- ExecDataByConfig(this.postDataPramas).then(response => {
- console.log('新增保存发送参数', this.postDataPramas)
- if (response.msg === 'fail') {
- this.$notify({
- title: '保存失败',
- message: response.data,
- type: 'warning',
- duration: 2000
- })
- } else {
- this.getdataListParm.parammaps.inputDatetime = ''
- this.get_table_data()
- this.dialogFormVisibleAdd = false
- this.createTemp.providerName = ''
- this.$notify({
- title: '',
- message: '保存成功',
- type: 'success',
- duration: 2000
- })
- }
- })
- }
- })
- },
- form_delete(row) {
- console.log('删除')
- MessageBox.confirm('确认删除?', {
- confirmButtonText: '确认',
- cancelButtonText: '取消',
- type: 'warning'
- })
- .then(() => {
- this.postDataPramas.common = { 'returnmap': '0' }
- this.postDataPramas.data = []
- this.postDataPramas.data[0] = { 'name': 'deleteBigjudge', 'type': 'e', 'parammaps': {
- id: row.id
- }}
- this.postDataPramas.data[1] = { 'name': 'deletejudge', 'type': 'e', 'parammaps': {
- bigId: row.id
- }}
- ExecDataByConfig(this.postDataPramas).then(response => {
- console.log('删除发送参数', this.postDataPramas)
- if (response.msg === 'fail') {
- this.$notify({
- title: '删除失败',
- message: response.data,
- type: 'warning',
- duration: 2000
- })
- } else {
- this.getdataListParm.parammaps.inputDatetime = ''
- this.get_table_data()
- this.$notify({
- title: '',
- message: '删除成功',
- type: 'success',
- duration: 2000
- })
- }
- })
- })
- .catch(() => {
- this.$message({
- type: 'info',
- message: '已取消删除'
- })
- })
- },
- get_table_data2() {
- this.listLoading2 = true
- // this.listLoadingAdd = true
- GetDataByName(this.getdataListParm2).then(response => {
- if (response.data.list !== null) {
- this.list2 = response.data.list
- // this.listAdd = response.data.list
- // for (var i = 0; i < this.listAdd.length; i++) {
- // this.$set(this.listAdd[i], 'showUpload', false)
- // }
- } else {
- this.list2 = []
- // this.listAdd = []
- }
- this.pageNum2 = response.data.pageNum
- this.pageSize2 = response.data.pageSize
- if (response.data.total) {
- this.total2 = response.data.total
- }
- setTimeout(() => {
- this.listLoading2 = false
- // this.listLoadingAdd = false
- }, 300)
- })
- },
- handleDownload() {
- console.log('点击了导出')
- this.$alert('评估验证信息正在导出中,请勿刷新或离开本页面,若导出时间过长,建议缩小导出数据范围重新导出', {})
- this.isPercentage = true
- this.percentage = 1
- var timer = setInterval(() => {
- this.percentage += 5
- if (this.percentage > 95) {
- this.percentage = 99
- clearInterval(timer)
- }
- this.percentage = this.percentage
- }, 1000)
- var send_data = {
- name: 'getjudgeListByExcel', page: 1, offset: 1, pagecount: 0,
- returntype: 'Map',
- parammaps: {
- formType:'评估验证信息',
- pastureName: this.getdataListParm.parammaps.pastureName,
- judgetype:this.getdataListParm.parammaps.judgetype,
- startTime:this.getdataListParm.parammaps.startTime,
- stopTime: this.getdataListParm.parammaps.stopTime,
- empName: this.getdataListParm.parammaps.empName,
- }
- }
- GetAccount(send_data).then(response => {
- this.listSee2 = response.data.list
- if (response.data.list !== null) {
- this.percentage = 99
- setTimeout(() => {
- this.isPercentage = false
- }, 2000)
- for (var i = 0; i < response.data.list.length; i++) {
- const urlArray = []
- const fileList = []
- if (response.data.list[i].picpath1 == undefined && response.data.list[i].picpath2 == undefined && response.data.list[i].picpath3 == undefined) {
- urlArray.push()
- } else if (response.data.list[i].picpath1 == undefined) {
- urlArray.push(process.env.VUE_APP_BASE_API + response.data.list[i].picpath2, process.env.VUE_APP_BASE_API + response.data.list[i].picpath3)
- } else if (response.data.list[i].picpath2 == undefined && response.data.list[i].picpath3 == undefined) {
- urlArray.push(process.env.VUE_APP_BASE_API + response.data.list[i].picpath1)
- } else if (response.data.list[i].picpath2 == undefined) {
- urlArray.push(process.env.VUE_APP_BASE_API + response.data.list[i].picpath1, process.env.VUE_APP_BASE_API + response.data.list[i].picpath3)
- } else if (response.data.list[i].picpath3 == undefined) {
- urlArray.push(process.env.VUE_APP_BASE_API + response.data.list[i].picpath1, process.env.VUE_APP_BASE_API + response.data.list[i].picpath2)
- } else {
- urlArray.push(process.env.VUE_APP_BASE_API + response.data.list[i].picpath1, process.env.VUE_APP_BASE_API + response.data.list[i].picpath2, process.env.VUE_APP_BASE_API + response.data.list[i].picpath3)
- }
- for (let i = 0; i < urlArray.length; i++) {
- const urlObj = {}
- this.$set(urlObj, 'url', urlArray[i])
- fileList.push(urlObj)
- }
- this.$set(this.listSee2[i], 'fileList', fileList)
- console.log(this.listSee2)
- this.listSee2[i].showUpload = true
- }
- console.log(this.listSee2)
- var downloadseeArray = []
- for (let i = 0; i < this.listSee2.length; i++) {
- var downloadseeObj = {}
- this.$set(downloadseeObj, 'pastureName', this.listSee2[i].pastureName)
- this.$set(downloadseeObj, 'empName', this.listSee2[i].empName)
- this.$set(downloadseeObj, 'batime', this.listSee2[i].batime)
- this.$set(downloadseeObj, 'judgetype', this.listSee2[i].judgetype)
- this.$set(downloadseeObj, 'statue', this.listSee2[i].statue)
- this.$set(downloadseeObj, 'score', this.listSee2[i].score)
- this.$set(downloadseeObj, 'note', this.listSee2[i].note)
- this.$set(downloadseeObj, 'mypic1', process.env.VUE_APP_BASE_API + this.listSee2[i].picpath1)
- this.$set(downloadseeObj, 'mypic2', process.env.VUE_APP_BASE_API + this.listSee2[i].picpath2)
- this.$set(downloadseeObj, 'mypic3', process.env.VUE_APP_BASE_API + this.listSee2[i].picpath3)
- downloadseeArray.push(downloadseeObj)
- }
- console.log('downloadseeArray', downloadseeArray)
- const column = [
- { title: '牧场', key: 'pastureName', type: 'text' },
- { title: '评估人', key: 'empName', type: 'text' },
- { title: '评估日期', key: 'batime', type: 'text' },
- { title: '检查类别', key: 'judgetype', type: 'text' },
- { title: '检查标准', key: 'statue', type: 'text' },
- { title: '检查结果', key: 'score', type: 'text' },
- { title: '问题描述', key: 'note', type: 'text' },
- { title: '问题图片', key: 'mypic1', type: 'image', width: 80, height: 60 },
- { title: '问题图片', key: 'mypic2', type: 'image', width: 80, height: 60 },
- { title: '问题图片', key: 'mypic3', type: 'image', width: 80, height: 60 }
- ]
- const data = downloadseeArray
- const excelName = '评估验证'
- table2excel(column, data, excelName)
- }
- })
- },
- handleInspectionStandard() {
- console.log('点击了检查标准管理')
- // table1隐藏/table2显示
- this.List1 = false
- this.List2 = true
- this.get_table_data2()
- },
- goBack() {
- // table1显示/table2隐藏
- this.List1 = true
- this.List2 = false
- this.get_table_data()
- },
- form_add2() {
- console.log('点击了检查标准管理-新增')
- this.createTemp.statue = ''
- this.list3 = []
- this.dialogStatus = 'create'
- this.dialogFormVisible = true
- },
- handleDownloadTemp2() {
- console.log('点击了模板')
- import('@/vendor/Export2Excel').then(excel => {
- const list1 = []
- const tHeader = [
- '检查类别', '检查标准'
- ]
- const filterVal = [
- '检查类别', '检查标准'
- ]
- const data1 = this.formatJson(filterVal, list1)
- excel.export_json_to_excel({
- header: tHeader,
- data: data1,
- filename: '评估验证模板',
- autoWidth: true,
- bookType: 'xlsx'
- })
- })
- },
- beforeImportExcel2(file) {
- const isLt2M = file.size / 1024 / 1024 < 6
- if (!isLt2M) {
- this.$message.error('上传文件大小不能超过 6MB!')
- }
- return isLt2M
- },
- handleImportExcelSuccess2(res, file) {
- this.get_table_data2()
- if (res.msg === 'ok') {
- this.$message({
- title: '成功',
- message: '导入成功:' + res.data.success + '条!',
- type: 'success',
- duration: 2000
- })
- if (res.data.err_count > 0) {
- this.$notify({
- title: '失败',
- message: '导入失败:' + res.data.err_count + '条!',
- type: 'danger',
- duration: 2000
- })
- import('@/vendor/Export2Excel').then(excel => {
- const list1 = res.data.result
- const tHeader = [
- '检查类别', '检查标准', '报错信息'
- ]
- const filterVal = [
- '检查类别', '检查标准', 'error_msg'
- ]
- const data1 = this.formatJson(filterVal, list1)
- excel.export_json_to_excel({
- header: tHeader,
- data: data1,
- filename: '评估验证报错信息',
- autoWidth: true,
- bookType: 'xlsx'
- })
- })
- }
- } else {
- this.$notify({
- title: '失败',
- message: '上传失败',
- type: 'danger',
- duration: 2000
- })
- }
- },
- formatJson(filterVal, jsonData) {
- return jsonData.map(v =>
- filterVal.map(j => {
- if (j === 'timestamp') {
- return parseTime(v[j])
- } else {
- return v[j]
- }
- })
- )
- },
- // console.log('点击了检查标准管理-新增-添加标准')
- handleAddStandard() {
- console.log('点击了检查标准管理-新增-添加标准')
- this.list3.push({ 'myid': (new Date()).valueOf(), 'statue': '' })
- },
- form_delete3(row) {
- console.log(row)
- if (row.id !== undefined) {
- this.$set(row, 'myid', row.id)
- }
- MessageBox.confirm('确认删除?', {
- confirmButtonText: '确认',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- for (var i = 0; i < this.list3.length; i++) {
- console.log(this.list3[i])
- if (this.list3[i].myid == row.myid) {
- var list3Index = this.list3.indexOf(this.list3[i])
- }
- if (list3Index > -1) {
- this.list3.splice(list3Index, 1)
- return
- }
- }
- })
- },
- add_dialog_save2() {
- this.isokDisable = true
- setTimeout(() => {
- this.isokDisable = false
- }, 1000)
- this.$refs['createTemp'].validate(valid => {
- if (valid) {
- if (this.list3.length !== 0) {
- for (let i = 0; i < this.list3.length; i++) {
- if (this.list3[i].statue == '') {
- this.$message({
- type: 'warning',
- message: '请检查检查标准是否未填写',
- duration: 2000
- })
- return false
- } else {
- this.postDataParam.common = { 'returnmap': '0' }
- this.postDataParam.data = []
- this.postDataParam.data[0] = { 'name': 'inserBigAssessment', 'type': 'e', 'parammaps': {
- 'statue': this.createTemp.statue
- }}
- this.postDataParam.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.list3 }}
- this.postDataParam.data[1].children = []
- this.postDataParam.data[1].children[0] = { 'name': 'insertAssessment', 'type': 'e', 'parammaps': {
- statue: '@insertSpotList.statue',
- bigId: '@inserBigAssessment.LastInsertId'
- }}
- }
- }
- ExecDataByConfig(this.postDataParam).then(response => {
- console.log('保存发送参数', this.postDataParam)
- if (response.msg === 'fail') {
- this.$notify({
- title: '保存失败',
- message: response.data,
- type: 'warning',
- duration: 2000
- })
- } else {
- this.get_table_data2()
- this.dialogFormVisible = false
- this.$notify({
- title: '',
- message: '保存成功',
- type: 'success',
- duration: 2000
- })
- }
- })
- } else {
- this.$message({
- title: '',
- message: '请选择添加标准',
- type: 'warning',
- duration: 2000
- })
- return false
- }
- }
- })
- },
- form_see2(row) {
- this.list3 = []
- this.createTemp = Object.assign(row, {})
- this.dialogStatus = 'see'
- this.dialogFormVisible = true
- this.getdataListParmSee2.parammaps.id = row.id
- this.get_table_dataSee2()
- },
- get_table_dataSee2() {
- GetDataByName(this.getdataListParmSee2).then(response => {
- if (response.data.list !== null) {
- this.listAdd = response.data.list
- this.list3 = response.data.list
- for (var i = 0; i < this.listAdd.length; i++) {
- this.$set(this.listAdd[i], 'showUpload', false)
- this.$set(this.listAdd[i], 'judgetype', this.judgetype)
- }
- } else {
- this.list3 = []
- this.listAdd = []
- }
- setTimeout(() => {
- this.listLoading3 = false
- }, 300)
- })
- },
- form_edit2(row) {
- this.createTemp.statue = ''
- this.list3 = []
- this.createTemp = Object.assign(row, {})
- this.dialogStatus = 'update'
- this.dialogFormVisible = true
- this.getdataListParmSee2.parammaps.id = row.id
- this.get_table_dataSee2()
- },
- edit_dialog_save2() {
- this.isokDisable = true
- setTimeout(() => {
- this.isokDisable = false
- }, 1000)
- this.$refs['createTemp'].validate(valid => {
- if (valid) {
- if (this.list3.length !== 0) {
- for (let i = 0; i < this.list3.length; i++) {
- if (this.list3[i].statue == '') {
- this.$message({
- type: 'warning',
- message: '请检查检查标准是否未填写',
- duration: 2000
- })
- return false
- } else {
- this.postDataParam.common = { 'returnmap': '0' }
- this.postDataParam.data = []
- this.postDataParam.data[0] = { 'name': 'updateBigAssessment', 'type': 'e', 'parammaps': {
- 'id': this.createTemp.id,
- 'statue': this.createTemp.statue
- }}
- this.postDataParam.data[1] = { 'name': 'deleteAssessmentListBybigid', 'type': 'e', 'parammaps': {
- 'id': this.createTemp.id
- }}
- this.postDataParam.data[2] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.list3 }}
- this.postDataParam.data[2].children = []
- this.postDataParam.data[2].children[0] = { 'name': 'insertAssessment', 'type': 'e', 'parammaps': {
- statue: '@insertSpotList.statue',
- bigId: this.createTemp.id
- }}
- }
- }
- ExecDataByConfig(this.postDataParam).then(response => {
- console.log('保存发送参数', this.postDataParam)
- if (response.msg === 'fail') {
- this.$notify({
- title: '保存失败',
- message: response.data,
- type: 'warning',
- duration: 2000
- })
- } else {
- this.get_table_data2()
- this.dialogFormVisible = false
- this.$notify({
- title: '',
- message: '保存成功',
- type: 'success',
- duration: 2000
- })
- }
- })
- } else {
- this.$message({
- title: '',
- message: '请选择添加标准',
- type: 'warning',
- duration: 2000
- })
- return false
- }
- }
- })
- },
- form_delete2(row) {
- console.log('检查标准管理-删除')
- MessageBox.confirm('确认删除此信息?', {
- confirmButtonText: '确认',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- this.postDataParam.name = 'deleteAssessmentList'
- this.postDataParam.parammaps = {}
- this.postDataParam.parammaps.id = row.id
- PostDataByName(this.postDataParam).then(() => {
- this.get_table_data2()
- this.dialogFormVisible = false
- this.$notify({
- title: '成功',
- message: '删除成功',
- type: 'success',
- duration: 2000
- })
- })
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消删除'
- })
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .app-btn{
- margin-bottom: 10px;
- }
- .title2{
- height: 50px;
- line-height: 50px;
- font:700 18px/50px '';
- .title2-l{
- float: left;
- }
- .title2-r{
- float: right;
- }
- }
- </style>
- <style lang="scss">
- #uploadPic{
- height: 70px;
- }
- #uploadPic .el-upload-list--picture-card .el-upload-list__item{
- width: 70px;
- height: 70px;
- }
- #uploadPic .el-upload--picture-card{
- width: 70px;
- height: 70px;
- line-height: 70px;
- }
- #uploadPic .hide .el-upload--picture-card {
- display: none;
- }
- // 查看 隐藏删除
- #uploadPicSee{
- height: 70px;
- }
- #uploadPicSee .el-upload-list--picture-card .el-upload-list__item{
- width: 70px;
- height: 70px;
- }
- #uploadPicSee .el-upload--picture-card{
- width: 70px;
- height: 70px;
- line-height: 70px;
- }
- #uploadPicSee .el-upload-list--picture-card .el-upload-list__item-actions .el-upload-list__item-delete{
- display: none;
- }
- </style>
|