index.vue 64 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617
  1. <template>
  2. <div class="app-container">
  3. <div v-if="isPercentage" class="percentage" style="width: 210px;height: 90px;background: #fff;position: fixed;bottom: 0;left: 0;z-index: 9999999999999;">
  4. <h4 style="padding-left: 10px;line-height: 0;">导出进度:</h4>
  5. <el-progress style="padding-left: 10px;" :text-inside="true" :stroke-width="26" :percentage="percentage" />
  6. </div>
  7. <div v-if="List1">
  8. <div class="filter-container">
  9. <el-select v-model="getdataListParm.parammaps.pastureName" placeholder="牧场" style="width:120px" class="filter-item">
  10. <el-option v-for="item in findAllPasture" :key="item.id" :label="item.name" :value="item.name" />
  11. </el-select>
  12. <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="结束日期" />
  13. <el-select ref="statue" v-model="judgetypeARR" style="width:300px" class="filter-item" clearable multiple >
  14. <el-option v-for="item in getAssessmentList" :key="item.statue" :label="item.statue" :value="item.statue" />
  15. </el-select>
  16. <el-input
  17. v-model="getdataListParm.parammaps.empName"
  18. placeholder="评估人"
  19. clearable
  20. style="width: 200px;"
  21. class="filter-item"
  22. />
  23. <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="form_search">搜索</el-button>
  24. <el-button class="filter-item" style="margin-left: 10px;" type="success" icon="el-icon-upload2" @click="handleDownload">导出</el-button>
  25. </div>
  26. <div class="app-btn">
  27. <el-button class="filter-item" type="primary" icon="el-icon-edit" @click="form_add">评估</el-button>
  28. <el-button class="filter-item" type="warning" @click="handleInspectionStandard">检查标准管理</el-button>
  29. </div>
  30. <el-table
  31. :key="tableKey"
  32. v-loading="listLoading"
  33. element-loading-text="给我一点时间"
  34. :data="list"
  35. border
  36. fit
  37. highlight-current-row
  38. style="width: 100%;"
  39. :row-style="rowStyle"
  40. :cell-style="cellStyle"
  41. class="elTable table-fixed"
  42. :max-height="myHeight"
  43. >
  44. <el-table-column label="序号" align="center" type="index" width="50px">
  45. <template slot-scope="scope">
  46. <span>{{ scope.$index + (pageNum-1) * pageSize + 1 }}</span>
  47. </template>
  48. </el-table-column>
  49. <el-table-column label="牧场" min-width="110px" align="center">
  50. <template slot-scope="scope">
  51. <span>{{ scope.row.pastureName }}</span>
  52. </template>
  53. </el-table-column>
  54. <el-table-column label="评估时间" min-width="130px" align="center" sortable prop="batime" />
  55. <el-table-column label="评估人" min-width="100px" align="center">
  56. <template slot-scope="scope">
  57. <span>{{ scope.row.empName }}</span>
  58. </template>
  59. </el-table-column>
  60. <el-table-column label="评估分数" min-width="120px" align="center" sortable prop="scores" />
  61. <el-table-column label="操作" align="center" width="300px" class-name="small-padding fixed-width" fixed="right">
  62. <template slot-scope="{row}">
  63. <el-button type="primary" size="mini" @click="form_see(row)">查看</el-button>
  64. <el-button type="success" size="mini" @click="form_edit(row)">编辑</el-button>
  65. <el-button type="danger" size="mini" @click="form_delete(row)">删除</el-button>
  66. </template>
  67. </el-table-column>
  68. </el-table>
  69. <pagination v-show="total>0" :total="total" :page.sync="getdataListParm.offset" :limit.sync="getdataListParm.pagecount" @pagination="get_table_data" />
  70. <!-- 评估/编辑 -->
  71. <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisibleAdd" :close-on-click-modal="false" width="80%">
  72. <div class="app-add">
  73. <el-form ref="createTemp" :rules="rules" :model="createTemp" label-position="right" label-width="110px" style="width:80%;margin:0 auto;">
  74. <el-row>
  75. <el-col :span="8">
  76. <el-form-item label="牧场:" prop="pastureId">
  77. <el-select v-model="createTemp.pastureId" style="width:100%" class="filter-item" :disabled="dialogStatus === 'update'">
  78. <el-option v-for="item in findAllPasture" :key="item.id" :label="item.name" :value="item.id" />
  79. </el-select>
  80. </el-form-item>
  81. </el-col>
  82. <el-col :span="8">
  83. <el-form-item label="评估人:" prop="empId">
  84. <el-select v-model="createTemp.empId" placeholder="录入人" class="filter-item" style="width:100%">
  85. <el-option v-for="item in findAllEmploye" :key="item.id" :label="item.name" :value="item.id" />
  86. </el-select>
  87. </el-form-item>
  88. </el-col>
  89. <el-col :span="8">
  90. <el-form-item label="评估日期:" prop="batime">
  91. <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" />
  92. </el-form-item>
  93. </el-col>
  94. </el-row>
  95. <el-row v-if="dialogStatus==='assessment'">
  96. <el-col :span="8">
  97. <el-form-item label="检查类别:" prop="createTemp.statue">
  98. <el-select ref="statue" v-model="createTemp.statue" style="width:100%" class="filter-item" @change="changeStatue">
  99. <el-option v-for="item in list2" :key="item.id" :label="item.statue" :value="item.id" />
  100. </el-select>
  101. </el-form-item>
  102. </el-col>
  103. </el-row>
  104. </el-form>
  105. <el-table
  106. :key="tableKeyAdd"
  107. v-loading="listLoadingAdd"
  108. element-loading-text="给我一点时间"
  109. :data="listAdd"
  110. border
  111. fit
  112. highlight-current-row
  113. style="width: 100%;"
  114. :row-style="rowStyle"
  115. :cell-style="cellStyle"
  116. class="elTable table-fixed"
  117. >
  118. <el-table-column label="序号" type="index" width="50" align="center" />
  119. <el-table-column label="检查类别" min-width="110px" align="center">
  120. <template slot-scope="scope">
  121. <span>{{ scope.row.judgetype }}</span>
  122. </template>
  123. </el-table-column>
  124. <el-table-column label="检查标准" min-width="110px" align="center">
  125. <template slot-scope="scope">
  126. <span>{{ scope.row.statue }}</span>
  127. </template>
  128. </el-table-column>
  129. <el-table-column label="检查结果" min-width="130px" align="center">
  130. <template slot-scope="scope">
  131. <el-select v-model="scope.row.score" filterable placeholder="检查结果">
  132. <el-option
  133. v-for="item in inspectionResultsList"
  134. :key="item.id"
  135. :label="item.name"
  136. :value="item.name"
  137. />
  138. </el-select>
  139. </template>
  140. </el-table-column>
  141. <el-table-column label="问题描述" min-width="100px" align="center">
  142. <template slot-scope="scope">
  143. <el-form :model="scope.row" :rules="rules">
  144. <el-form-item prop="note">
  145. <el-input v-model="scope.row.note" autosize type="textarea" style="width:90%;height:25px" />
  146. <!-- <el-input v-model="scope.row.note" style="width:100px;margin-top:25px;height:10px" /> -->
  147. </el-form-item>
  148. </el-form>
  149. </template>
  150. </el-table-column>
  151. <el-table-column label="问题照片" width="280px" align="center">
  152. <template slot-scope="{row}">
  153. <el-upload
  154. id="uploadPic"
  155. ref="upload"
  156. :limit="3"
  157. list-type="picture-card"
  158. :file-list="row.fileList"
  159. :headers="headers"
  160. :action="uploadImageUrl"
  161. :auto-upload="true"
  162. :on-preview="handlePicPreview"
  163. :before-remove="beforeRemove"
  164. :class="{hide:row.showUpload}"
  165. :on-change="(file,fileList)=>{ return handlePicChange(file, fileList,row) }"
  166. :on-success="(response,file, fileList)=>{ return handlePicSuccess(response,file, fileList,row) }"
  167. :on-remove="(file, fileList)=>{ return handlePicRemove(file, fileList,row) }"
  168. >
  169. <i class="el-icon-plus" />
  170. </el-upload>
  171. <el-dialog :visible.sync="dialogVisible" append-to-body :width="width">
  172. <img :src="dialogImageUrl" alt="" @load="onLoad">
  173. </el-dialog>
  174. </template>
  175. </el-table-column>
  176. </el-table>
  177. </div>
  178. <div slot="footer" class="dialog-footer" style="bottom:5px">
  179. <!-- <el-button type="primary" :disabled="isokDisable" @click="dialogStatus==='assessment'?add_dialog_saveAdd():edit_dialog_save()">保存并关闭</el-button> -->
  180. <el-button v-if="dialogStatus==='assessment'" type="primary" :disabled="isokDisable" @click="add_dialog_saveAdd()">保存并关闭</el-button>
  181. <el-button v-if="dialogStatus==='update'" type="primary" :disabled="isokDisable" @click="edit_dialog_save()">保存并关闭</el-button>
  182. <el-button @click="dialogFormVisibleAdd = false;">取消并关闭</el-button>
  183. </div>
  184. </el-dialog>
  185. <!-- 查看 -->
  186. <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisibleSee" :close-on-click-modal="false" width="80%">
  187. <div class="app-see">
  188. <el-form ref="seeTemp" :rules="rules" :model="seeTemp" label-position="right" label-width="110px" style="width:80%;margin:0 auto;">
  189. <el-row>
  190. <el-col :span="8">
  191. <el-form-item label="牧场:" prop="pastureName">
  192. <el-input ref="pastureName" v-model="seeTemp.pastureName" />
  193. </el-form-item>
  194. </el-col>
  195. <el-col :span="8">
  196. <el-form-item label="评估人:" prop="empName">
  197. <el-input ref="empName" v-model="seeTemp.empName" />
  198. </el-form-item>
  199. </el-col>
  200. <el-col :span="8">
  201. <el-form-item label="评估日期:" prop="batime">
  202. <el-input ref="batime" v-model="seeTemp.batime" />
  203. </el-form-item>
  204. </el-col>
  205. </el-row>
  206. </el-form>
  207. <el-table
  208. :key="tableKeySee"
  209. v-loading="listLoadingSee"
  210. element-loading-text="给我一点时间"
  211. :data="listSee"
  212. border
  213. fit
  214. highlight-current-row
  215. style="width: 100%;"
  216. :row-style="rowStyle"
  217. :cell-style="cellStyle"
  218. class="elTable table-fixed"
  219. >
  220. <el-table-column label="序号" align="center" type="index" width="50px">
  221. <template slot-scope="scope">
  222. <span>{{ scope.$index + (pageNumSee-1) * pageSizeSee + 1 }}</span>
  223. </template>
  224. </el-table-column>
  225. <el-table-column label="检查类别" min-width="110px" align="center">
  226. <template slot-scope="scope">
  227. <span>{{ scope.row.judgetype }}</span>
  228. </template>
  229. </el-table-column>
  230. <el-table-column label="检查标准" min-width="110px" align="center">
  231. <template slot-scope="scope">
  232. <span>{{ scope.row.statue }}</span>
  233. </template>
  234. </el-table-column>
  235. <el-table-column label="检查结果" min-width="130px" align="center">
  236. <template slot-scope="scope">
  237. <span>{{ scope.row.score }}</span>
  238. </template>
  239. </el-table-column>
  240. <el-table-column label="问题描述" min-width="100px" align="center">
  241. <template slot-scope="scope">
  242. <span>{{ scope.row.note }}</span>
  243. </template>
  244. </el-table-column>
  245. <el-table-column label="问题照片" min-width="200px" align="center">
  246. <template slot-scope="{row}">
  247. <el-upload
  248. id="uploadPicSee"
  249. ref="upload"
  250. list-type="picture-card"
  251. :file-list="row.fileList"
  252. :action="uploadImageUrl"
  253. :on-preview="handlePicPreview"
  254. :class="{hide:row.showUpload}"
  255. >
  256. <i class="el-icon-plus" />
  257. </el-upload>
  258. <el-dialog :visible.sync="dialogVisible" append-to-body :width="width">
  259. <img :src="dialogImageUrl" alt="" @load="onLoad">
  260. </el-dialog>
  261. </template>
  262. </el-table-column>
  263. </el-table>
  264. <pagination v-show="totalSee>0" :total="totalSee" :page.sync="getdataListParmSee.offset" :limit.sync="getdataListParmSee.pagecount" @pagination="get_table_dataSee" />
  265. </div>
  266. <div slot="footer" class="dialog-footer" style="bottom:5px">
  267. <el-button class="filter-item" type="success" icon="el-icon-upload2" @click="handleDownloadSee">导出</el-button>
  268. <el-button @click="dialogFormVisibleSee = false;">关闭</el-button>
  269. </div>
  270. </el-dialog>
  271. </div>
  272. <!-- 检查标准管理 -->
  273. <div v-if="List2">
  274. <div class="title2">
  275. <b class="title2-l">检查标准管理</b>
  276. <a class="title2-l" style="margin-left: 20px;" @click="goBack">&lt;返回</a>
  277. </div>
  278. <div class="app-btn">
  279. <el-button class="filter-item" type="primary" icon="el-icon-edit" @click="form_add2">新增</el-button>
  280. <el-button class="filter-item" type="info" icon="el-icon-tickets" @click="handleDownloadTemp2">模板</el-button>
  281. <el-upload style="display: inline-block;" :headers="headers2" :data="uploadData2" :action="uploadExcelUrl2" :show-file-list="false" :before-upload="beforeImportExcel2" :on-success="handleImportExcelSuccess2">
  282. <el-button v-waves class="filter-item" type="warning" icon="el-icon-download">导入</el-button>
  283. </el-upload>
  284. </div>
  285. <el-table
  286. :key="tableKey2"
  287. v-loading="listLoading2"
  288. element-loading-text="给我一点时间"
  289. :data="list2"
  290. border
  291. fit
  292. highlight-current-row
  293. style="width: 100%;"
  294. :row-style="rowStyle"
  295. :cell-style="cellStyle"
  296. class="elTable table-fixed"
  297. :max-height="myHeight"
  298. >
  299. <el-table-column label="序号" align="center" type="index" width="50px">
  300. <template slot-scope="scope">
  301. <span>{{ scope.$index + (pageNum2-1) * pageSize2 + 1 }}</span>
  302. </template>
  303. </el-table-column>
  304. <el-table-column label="检查类别" min-width="110px" align="center">
  305. <template slot-scope="scope">
  306. <span>{{ scope.row.statue }}</span>
  307. </template>
  308. </el-table-column>
  309. <el-table-column label="操作" align="center" width="300px" class-name="small-padding fixed-width" fixed="right">
  310. <template slot-scope="{row}">
  311. <el-button type="success" size="mini" @click="form_see2(row)">查看</el-button>
  312. <el-button type="success" size="mini" @click="form_edit2(row)">编辑</el-button>
  313. <el-button type="danger" size="mini" @click="form_delete2(row)">删除</el-button>
  314. </template>
  315. </el-table-column>
  316. </el-table>
  317. <pagination v-show="total2>0" :total="total2" :page.sync="getdataListParm2.offset" :limit.sync="getdataListParm2.pagecount" @pagination="get_table_data2" />
  318. <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" :close-on-click-modal="false" width="80%">
  319. <div class="app-add">
  320. <el-form ref="createTemp" :rules="rules" :model="createTemp" label-position="right" label-width="110px" style="width:80%;margin:0 auto;">
  321. <el-row>
  322. <el-col :span="10">
  323. <el-form-item label="检查类别:" prop="statue">
  324. <el-input v-model="createTemp.statue" placeholder="请输入检查类别" :disabled="dialogStatus=='see'" />
  325. </el-form-item>
  326. </el-col>
  327. </el-row>
  328. <el-row>
  329. <el-col>
  330. <el-button v-if="dialogStatus==='update' || dialogStatus==='create'" class="filter-item" type="primary" @click="handleAddStandard">添加标准</el-button>
  331. </el-col>
  332. </el-row>
  333. </el-form>
  334. <el-table
  335. :key="tableKey3"
  336. v-loading="listLoading3"
  337. element-loading-text="给我一点时间"
  338. :data="list3"
  339. border
  340. fit
  341. highlight-current-row
  342. style="width: 90%;margin: 0 auto 50px;"
  343. :row-style="rowStyle"
  344. :cell-style="cellStyle"
  345. class="elTable table-fixed"
  346. >
  347. <el-table-column label="序号" align="center" type="index" width="50px" />
  348. <el-table-column label="检查标准" min-width="110px" align="center">
  349. <template slot-scope="scope">
  350. <el-form v-if="dialogStatus==='update' || dialogStatus==='create'" :model="scope.row">
  351. <el-form-item prop="statue">
  352. <el-input v-model="scope.row.statue" autosize type="textarea" style="width:90%;height:25px" :disabled="dialogStatus=='see'" />
  353. </el-form-item>
  354. </el-form>
  355. <span v-if="dialogStatus==='see'">{{ scope.row.statue }}</span>
  356. </template>
  357. </el-table-column>
  358. <el-table-column v-if="dialogStatus==='update' || dialogStatus==='create'" label="操作" align="center" width="300px" class-name="small-padding fixed-width" fixed="right">
  359. <template slot-scope="{row}">
  360. <el-button type="danger" size="mini" @click="form_delete3(row)">删除</el-button>
  361. </template>
  362. </el-table-column>
  363. </el-table>
  364. <div slot="footer" class="dialog-footer">
  365. <el-button v-if="dialogStatus==='update' || dialogStatus==='create'" type="primary" :disabled="isokDisable" @click="dialogStatus==='create'?add_dialog_save2():edit_dialog_save2()">保存并关闭</el-button>
  366. <el-button @click="dialogFormVisible = false;get_table_data2();">取消并关闭</el-button>
  367. </div>
  368. </div>
  369. </el-dialog>
  370. </div>
  371. </div>
  372. </template>
  373. <script>
  374. // import { getToken } from '@/utils/auth'
  375. import { GetDataByNames, GetDataByName, PostDataByName, failproccess, ExecDataByConfig, GetAccount } from '@/api/common'
  376. import waves from '@/directive/waves'
  377. import Cookies from 'js-cookie'
  378. import Pagination from '@/components/Pagination'
  379. import { MessageBox } from 'element-ui'
  380. import { parseTime, sortChange, json2excel } from '@/utils/index.js'
  381. import { getToken } from '@/utils/auth'
  382. import table2excel from 'js-table2excel'
  383. export default {
  384. name: 'Assessment',
  385. components: { Pagination },
  386. directives: { waves },
  387. data() {
  388. return {
  389. myHeight:document.documentElement.clientHeight - 85- 200,
  390. rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
  391. cellStyle: { padding: 0 + 'px' },
  392. findAllPasture: [],
  393. findAllEmploye: [],
  394. inspectionResultsList: [{ id: 1, name: 1 }, { id: 2, name: 2 }, { id: 3, name: 3 }, { id: 4, name: 4 }, { id: 5, name: 5 }],
  395. requestParams: [
  396. { name: 'findAllEmploye', offset: 0, pagecount: 0, parammaps: { 'pastureId': Cookies.get('pastureid') }},
  397. { name: 'findAllPasture', offset: 0, pagecount: 0, returntype: 'Map', parammaps: { 'id': Cookies.get('pastureid') }},
  398. { name: 'getAssessmentList', offset: 0, pagecount: 0, parammaps: { 'pastureId': Cookies.get('pastureid') }}
  399. ],
  400. isokDisable: false,
  401. List1: true,
  402. List2: false, // 评估检查管理
  403. getAssessmentList:[],
  404. rules: {
  405. statue: [{ required: true, message: '必填', trigger: 'blur' }]
  406. },
  407. dialogFormVisibleAdd: false,
  408. getdataListParm: {
  409. name: 'getbigjudgeList',
  410. page: 1,
  411. offset: 1,
  412. pagecount: 10,
  413. returntype: 'Map',
  414. parammaps: {
  415. pastureName: Cookies.get('pasturename'),
  416. judgetype: '',
  417. empName:'',
  418. startTime: '',
  419. stopTime: '',
  420. inputDatetime: ''
  421. }
  422. },
  423. judgetypeARR: [],
  424. list: [],
  425. tableKey: 0,
  426. total: 0,
  427. listLoading: true,
  428. dialogFormVisibleSee: false,
  429. getdataListParmSee: {
  430. name: 'getjudgeListBybig',
  431. page: 1,
  432. offset: 1,
  433. pagecount: 10,
  434. returntype: 'Map',
  435. parammaps: {}
  436. },
  437. getDownloadSeeParm: {
  438. name: 'getjudgeListBybig',
  439. returntype: 'Map',
  440. parammaps: {}
  441. },
  442. listSee: [],
  443. listSee2: [],
  444. tableKeySee: 0,
  445. totalSee: 0,
  446. listLoadingSee: true,
  447. seeTemp: {},
  448. listAdd: [],
  449. tableKeyAdd: 0,
  450. listLoadingAdd: false,
  451. dialogImageUrl: '',
  452. dialogVisible: false,
  453. fileList: [],
  454. headers: {
  455. optname: 'insertcustompic',
  456. id: 1,
  457. token: getToken() // 从cookie里获取token,并赋值token
  458. },
  459. uploadImageUrl: process.env.VUE_APP_BASE_API + 'authdata/uploaderimage',
  460. width: '',
  461. postDataPramas: {},
  462. getdataListParmUpdate: {
  463. name: 'getjudgeListBybig',
  464. returntype: 'Map',
  465. parammaps: {}
  466. },
  467. getdataListParm2: {
  468. name: 'getAssessmentList',
  469. page: 1,
  470. offset: 1,
  471. pagecount: 10,
  472. returntype: 'Map',
  473. parammaps: {}
  474. },
  475. getdataListParm3: {
  476. name: 'getAssessmentList',
  477. page: 1,
  478. offset: 1,
  479. pagecount: 10,
  480. returntype: 'Map',
  481. parammaps: {}
  482. },
  483. list2: [],
  484. tableKey2: 0,
  485. total2: 0,
  486. listLoading2: true,
  487. judgetype: '',
  488. dialogStatus: '',
  489. dialogFormVisible: false,
  490. textMap: {
  491. update: '编辑',
  492. create: '新增',
  493. see: '查看',
  494. assessment: '评估'
  495. },
  496. tableKey3: 0,
  497. listLoading3: false,
  498. list3: [],
  499. getdataListParmSee2: {
  500. name: 'getAssessmentListBybigid',
  501. returntype: 'Map',
  502. parammaps: {}
  503. },
  504. createTemp: {
  505. statue: '',
  506. pastureId: this.$store.state.user.pastureid,
  507. batime: parseTime(new Date(), '{y}-{m}-{d}'),
  508. empId: this.$store.state.user.employeid
  509. },
  510. postDataParam: {},
  511. isPercentage: false,
  512. percentage: 1
  513. }
  514. },
  515. computed: {
  516. headers2() {
  517. return {
  518. token: getToken()
  519. }
  520. },
  521. uploadData2() {
  522. return {
  523. name: 'uploadAssessment',
  524. importParams: '检查类别,检查标准',
  525. sheetname: 'SheetJS'
  526. }
  527. },
  528. // 设置上传地址
  529. uploadExcelUrl2() {
  530. return process.env.VUE_APP_BASE_API + 'authdata/ImportExcel'
  531. }
  532. },
  533. created() {
  534. this.get_select_list()
  535. this.get_table_data()
  536. console.log(this.uploadImageUrl)
  537. },
  538. methods: {
  539. get_select_list() {
  540. GetDataByNames(this.requestParams).then(response => {
  541. this.findAllPasture = response.data.findAllPasture.list
  542. this.findAllEmploye = response.data.findAllEmploye.list
  543. this.getAssessmentList = response.data.getAssessmentList.list
  544. })
  545. },
  546. get_table_data() {
  547. console.log(this.$refs['inputDatetime'], '------------------')
  548. if (this.$refs['inputDatetime'] !== undefined && this.$refs['inputDatetime'].value !== null) {
  549. this.getdataListParm.parammaps.startTime = this.$refs['inputDatetime'].value[0]
  550. this.getdataListParm.parammaps.stopTime = this.$refs['inputDatetime'].value[1]
  551. } else {
  552. this.getdataListParm.parammaps.startTime = ''
  553. this.getdataListParm.parammaps.stopTime = ''
  554. }
  555. this.listLoading = true
  556. console.log(this.getdataListParm.parammaps, '------------------')
  557. if(this.judgetypeARR.length !== 0){
  558. this.getdataListParm.parammaps.judgetype = this.judgetypeARR.join(",")
  559. }else{
  560. this.getdataListParm.parammaps.judgetype = ""
  561. }
  562. GetDataByName(this.getdataListParm).then(response => {
  563. this.list = response.data.list
  564. this.pageNum = response.data.pageNum
  565. this.pageSize = response.data.pageSize
  566. if (response.data.total) {
  567. this.total = response.data.total
  568. }
  569. setTimeout(() => {
  570. this.listLoading = false
  571. }, 300)
  572. })
  573. },
  574. form_search() {
  575. console.log('点击了搜索')
  576. this.listLoading = true
  577. if (this.getdataListParm.parammaps.inputDatetime === null) {
  578. this.getdataListParm.parammaps.inputDatetime = ''
  579. }
  580. this.getdataListParm.offset = 1
  581. this.get_table_data()
  582. },
  583. form_see(row) {
  584. console.log('查看')
  585. this.seeTemp = Object.assign(row, {})
  586. this.dialogStatus = 'see'
  587. this.dialogFormVisibleSee = true
  588. this.get_table_dataSee()
  589. },
  590. get_table_dataSee() {
  591. this.listLoadingSee = true
  592. this.getdataListParmSee.parammaps.id = this.seeTemp.id
  593. GetDataByName(this.getdataListParmSee).then(response => {
  594. this.listSee = response.data.list
  595. if (response.data.list !== null) {
  596. for (var i = 0; i < response.data.list.length; i++) {
  597. console.log(response.data.list[i])
  598. const urlArray = []
  599. const fileList = []
  600. if (response.data.list[i].picpath1 == undefined && response.data.list[i].picpath2 == undefined && response.data.list[i].picpath3 == undefined) {
  601. urlArray.push()
  602. } else if (response.data.list[i].picpath1 == undefined) {
  603. urlArray.push(process.env.VUE_APP_BASE_API + response.data.list[i].picpath2, process.env.VUE_APP_BASE_API + response.data.list[i].picpath3)
  604. } else if (response.data.list[i].picpath2 == undefined && response.data.list[i].picpath3 == undefined) {
  605. urlArray.push(process.env.VUE_APP_BASE_API + response.data.list[i].picpath1)
  606. } else if (response.data.list[i].picpath2 == undefined) {
  607. urlArray.push(process.env.VUE_APP_BASE_API + response.data.list[i].picpath1, process.env.VUE_APP_BASE_API + response.data.list[i].picpath3)
  608. } else if (response.data.list[i].picpath3 == undefined) {
  609. urlArray.push(process.env.VUE_APP_BASE_API + response.data.list[i].picpath1, process.env.VUE_APP_BASE_API + response.data.list[i].picpath2)
  610. } else {
  611. 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)
  612. }
  613. for (let i = 0; i < urlArray.length; i++) {
  614. const urlObj = {}
  615. this.$set(urlObj, 'url', urlArray[i])
  616. fileList.push(urlObj)
  617. }
  618. this.$set(this.listSee[i], 'fileList', fileList)
  619. console.log(this.listSee)
  620. this.listSee[i].showUpload = true
  621. }
  622. }
  623. this.pageNumSee = response.data.pageNum
  624. this.pageSizeSee = response.data.pageSize
  625. if (response.data.total) {
  626. this.totalSee = response.data.total
  627. }
  628. setTimeout(() => {
  629. this.listLoadingSee = false
  630. }, 300)
  631. })
  632. },
  633. handleDownloadSee() {
  634. this.listLoadingSee = true
  635. this.$alert('评估验证正在导出中,请勿刷新或离开本页面,若导出时间过长,建议缩小导出数据范围重新导出', {})
  636. this.isPercentage = true
  637. this.percentage = 1
  638. var timer = setInterval(() => {
  639. this.percentage += 5
  640. if (this.percentage > 95) {
  641. this.percentage = 99
  642. clearInterval(timer)
  643. }
  644. this.percentage = this.percentage
  645. }, 1000)
  646. this.getDownloadSeeParm.parammaps.id = this.seeTemp.id
  647. GetAccount(this.getDownloadSeeParm).then(response => {
  648. this.listSee = response.data.list
  649. if (response.data.list !== null) {
  650. this.percentage = 99
  651. setTimeout(() => {
  652. this.isPercentage = false
  653. }, 2000)
  654. for (var i = 0; i < response.data.list.length; i++) {
  655. const urlArray = []
  656. const fileList = []
  657. if (response.data.list[i].picpath1 == undefined && response.data.list[i].picpath2 == undefined && response.data.list[i].picpath3 == undefined) {
  658. urlArray.push()
  659. } else if (response.data.list[i].picpath1 == undefined) {
  660. urlArray.push(process.env.VUE_APP_BASE_API + response.data.list[i].picpath2, process.env.VUE_APP_BASE_API + response.data.list[i].picpath3)
  661. } else if (response.data.list[i].picpath2 == undefined && response.data.list[i].picpath3 == undefined) {
  662. urlArray.push(process.env.VUE_APP_BASE_API + response.data.list[i].picpath1)
  663. } else if (response.data.list[i].picpath2 == undefined) {
  664. urlArray.push(process.env.VUE_APP_BASE_API + response.data.list[i].picpath1, process.env.VUE_APP_BASE_API + response.data.list[i].picpath3)
  665. } else if (response.data.list[i].picpath3 == undefined) {
  666. urlArray.push(process.env.VUE_APP_BASE_API + response.data.list[i].picpath1, process.env.VUE_APP_BASE_API + response.data.list[i].picpath2)
  667. } else {
  668. 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)
  669. }
  670. for (let i = 0; i < urlArray.length; i++) {
  671. const urlObj = {}
  672. this.$set(urlObj, 'url', urlArray[i])
  673. fileList.push(urlObj)
  674. }
  675. this.$set(this.listSee[i], 'fileList', fileList)
  676. console.log(this.listSee)
  677. this.listSee[i].showUpload = true
  678. }
  679. console.log(this.listSee)
  680. var downloadseeArray = []
  681. for (let i = 0; i < this.listSee.length; i++) {
  682. var downloadseeObj = {}
  683. this.$set(downloadseeObj, 'pastureName', this.seeTemp.pastureName)
  684. this.$set(downloadseeObj, 'empName', this.seeTemp.empName)
  685. this.$set(downloadseeObj, 'batime', this.seeTemp.batime)
  686. this.$set(downloadseeObj, 'judgetype', this.listSee[i].judgetype)
  687. this.$set(downloadseeObj, 'statue', this.listSee[i].statue)
  688. this.$set(downloadseeObj, 'score', this.listSee[i].score)
  689. this.$set(downloadseeObj, 'note', this.listSee[i].note)
  690. this.$set(downloadseeObj, 'mypic1', process.env.VUE_APP_BASE_API + this.listSee[i].picpath1)
  691. this.$set(downloadseeObj, 'mypic2', process.env.VUE_APP_BASE_API + this.listSee[i].picpath2)
  692. this.$set(downloadseeObj, 'mypic3', process.env.VUE_APP_BASE_API + this.listSee[i].picpath3)
  693. downloadseeArray.push(downloadseeObj)
  694. }
  695. console.log('downloadseeArray', downloadseeArray)
  696. const column = [
  697. { title: '牧场', key: 'pastureName', type: 'text' },
  698. { title: '评估人', key: 'empName', type: 'text' },
  699. { title: '评估日期', key: 'batime', type: 'text' },
  700. { title: '检查类别', key: 'judgetype', type: 'text' },
  701. { title: '检查标准', key: 'statue', type: 'text' },
  702. { title: '检查结果', key: 'score', type: 'text' },
  703. { title: '问题描述', key: 'note', type: 'text' },
  704. { title: '问题图片', key: 'mypic1', type: 'image', width: 80, height: 60 },
  705. { title: '问题图片', key: 'mypic2', type: 'image', width: 80, height: 60 },
  706. { title: '问题图片', key: 'mypic3', type: 'image', width: 80, height: 60 }
  707. ]
  708. const data = downloadseeArray
  709. const excelName = '评估验证'
  710. table2excel(column, data, excelName)
  711. }
  712. setTimeout(() => {
  713. this.listLoadingSee = false
  714. }, 300)
  715. })
  716. },
  717. form_add() {
  718. console.log('点击了评估')
  719. this.createTemp.statue = ''
  720. this.createTemp.empId = this.$store.state.user.employeid
  721. this.createTemp.pastureId = this.$store.state.user.pastureid
  722. this.createTemp.batime = parseTime(new Date(), '{y}-{m}-{d}')
  723. this.dialogStatus = 'assessment'
  724. this.dialogFormVisibleAdd = true
  725. this.listAdd = []
  726. this.get_table_data2()
  727. },
  728. changeStatue(val) {
  729. // this.createTemp.statue = parseInt(val)
  730. // console.log(val)
  731. this.listAdd = []
  732. this.getdataListParmSee2.parammaps.id = val
  733. this.get_table_dataSee2()
  734. if (this.list2.find(obj => obj.id == val)) {
  735. console.log(this.list2.find(obj => obj.id == val).statue)
  736. this.judgetype = this.list2.find(obj => obj.id == val).statue
  737. }
  738. console.log(this.listAdd)
  739. },
  740. handlePicChange(file, fileList, row) {
  741. // console.log(response, '文件状态改变时的钩子response')
  742. console.log(file, '文件状态改变时的钩子file')
  743. console.log(fileList, '文件状态改变时的钩子fileList------------')
  744. console.log(row, '文件状态改变时的钩子row')
  745. console.log(row.showUpload, '文件状态改变时的钩子row')
  746. if (fileList.length > 2) {
  747. this.$nextTick(() => {
  748. this.$set(row, 'showUpload', true)
  749. })
  750. } else {
  751. this.$nextTick(() => {
  752. row.showUpload = false
  753. })
  754. }
  755. console.log(row)
  756. },
  757. handlePicSuccess(response, file, fileList, row) {
  758. // console.log(response, '文件上传成功时的钩子response')
  759. // console.log(file, '文件上传成功时的钩子file')
  760. // console.log(fileList, '文件上传成功时的钩子fileList')
  761. // console.log(row, '文件上传成功时的钩子row')
  762. // console.log(response.execresult.LastInsertId, '文件上传成功时的钩子response')
  763. // console.log(fileList.length, 'fileList.length')
  764. if (fileList.length > 2) {
  765. this.$nextTick(() => {
  766. row.showUpload = true
  767. })
  768. } else {
  769. this.$nextTick(() => {
  770. row.showUpload = false
  771. })
  772. }
  773. if (row.pic1 === undefined || row.pic1 == -1) {
  774. this.$set(row, 'pic1', response.execresult.LastInsertId)
  775. } else if (row.pic2 === undefined || row.pic2 == -1) {
  776. this.$set(row, 'pic2', response.execresult.LastInsertId)
  777. } else if (row.pic3 === undefined || row.pic3 == -1) {
  778. this.$set(row, 'pic3', response.execresult.LastInsertId)
  779. }
  780. console.log(row, '文件上传成功时的钩子row')
  781. },
  782. handlePicRemove(file, fileList, row) {
  783. console.log(file, '文件列表移除文件时的钩子file---')
  784. console.log(fileList, '文件列表移除文件时的钩子fileList--')
  785. console.log(row, '文件列表移除文件时的钩子row---')
  786. // console.log(this.dialogStatus)update
  787. if (this.dialogStatus === 'assessment') {
  788. if (fileList.length < 3) {
  789. this.$set(row, 'showUpload', false)
  790. // row.showUpload = false
  791. }
  792. for (const key in row) {
  793. if (row[key] === file.response.execresult.LastInsertId) {
  794. this.$delete(row, key)
  795. }
  796. }
  797. } else if (this.dialogStatus === 'update') {
  798. if (fileList.length < 3) {
  799. row.showUpload = false
  800. }
  801. const url = 'uploads' + file.url.split('uploads')[1]
  802. for (const key in row) {
  803. if (row[key] === url) {
  804. console.log(key)
  805. if (key === 'picpath1') {
  806. this.$delete(row, 'pic1')
  807. } else if (key === 'picpath2') {
  808. this.$delete(row, 'pic2')
  809. } else if (key === 'picpath3') {
  810. this.$delete(row, 'pic3')
  811. }
  812. }
  813. }
  814. }
  815. console.log(row, '文件列表移除文件时的钩子row')
  816. },
  817. handlePicPreview(file) {
  818. this.dialogImageUrl = file.url
  819. this.dialogVisible = true
  820. },
  821. onLoad(e) {
  822. const img = e.target
  823. let width = 0
  824. if (img.fileSize > 0 || (img.width > 1 && img.height > 1)) {
  825. width = img.width + 40
  826. }
  827. this.width = width + 'px'
  828. },
  829. add_dialog_saveAdd() {
  830. console.log('点击了保存')
  831. this.isokDisable = true
  832. setTimeout(() => {
  833. this.isokDisable = false
  834. }, 1000)
  835. this.$refs['createTemp'].validate(valid => {
  836. if (valid) {
  837. for (var i = 0; i < this.listAdd.length; i++) {
  838. if (this.listAdd[i].score == null) {
  839. this.$message({
  840. type: 'warning',
  841. message: '请检查检查结果是否为空',
  842. duration: 2000
  843. })
  844. return false
  845. }
  846. console.log(this.listAdd[i].pic1)
  847. if (this.listAdd[i].pic1 == undefined) {
  848. this.listAdd[i].pic1 = -1
  849. }
  850. if (this.listAdd[i].pic2 == undefined) {
  851. this.listAdd[i].pic2 = -1
  852. }
  853. if (this.listAdd[i].pic3 == undefined) {
  854. this.listAdd[i].pic3 = -1
  855. }
  856. }
  857. this.postDataPramas.common = { 'returnmap': '0' }
  858. this.postDataPramas.data = []
  859. this.postDataPramas.data[0] = { 'name': 'insertBigjudge', 'type': 'e', 'parammaps': {
  860. pastureId: this.createTemp.pastureId,
  861. batime: this.createTemp.batime,
  862. empId: this.createTemp.empId
  863. }}
  864. this.postDataPramas.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.listAdd }}
  865. this.postDataPramas.data[1].children = []
  866. this.postDataPramas.data[1].children[0] = { 'name': 'insertjudge', 'type': 'e', 'parammaps': {
  867. bigId: '@insertBigjudge.LastInsertId',
  868. judgetype: '@insertSpotList.judgetype',
  869. statue: '@insertSpotList.statue',
  870. score: '@insertSpotList.score',
  871. note: '@insertSpotList.note',
  872. pic1: '@insertSpotList.pic1',
  873. pic2: '@insertSpotList.pic2',
  874. pic3: '@insertSpotList.pic3'
  875. }}
  876. ExecDataByConfig(this.postDataPramas).then(response => {
  877. console.log('新增保存发送参数', this.postDataPramas)
  878. if (response.msg === 'fail') {
  879. this.$notify({
  880. title: '保存失败',
  881. message: response.data,
  882. type: 'warning',
  883. duration: 2000
  884. })
  885. } else {
  886. this.getdataListParm.parammaps.inputDatetime = ''
  887. this.get_table_data()
  888. this.dialogFormVisibleAdd = false
  889. this.createTemp.providerName = ''
  890. this.$notify({
  891. title: '',
  892. message: '保存成功',
  893. type: 'success',
  894. duration: 2000
  895. })
  896. }
  897. })
  898. }
  899. })
  900. },
  901. beforeRemove(file, fileList) {
  902. console.log(file.response, '删除文件之前的钩子,参数为上传的文件和文件列表')
  903. return this.$confirm('删除当前图片, 是否继续?', '提示', {
  904. confirmButtonText: '确定',
  905. cancelButtonText: '取消',
  906. type: 'warning'
  907. })
  908. },
  909. form_edit(row) {
  910. console.log('编辑', row)
  911. this.dialogStatus = 'update'
  912. this.dialogFormVisibleAdd = true
  913. this.createTemp = Object.assign(row, {})
  914. this.get_table_dataUpdate()
  915. this.get_table_data2()
  916. },
  917. get_table_dataUpdate() {
  918. this.listLoadingAdd = true
  919. this.getdataListParmUpdate.parammaps.id = this.createTemp.id
  920. GetDataByName(this.getdataListParmUpdate).then(response => {
  921. this.listAdd = response.data.list
  922. console.log(this.listAdd, 'this,listAdd')
  923. if (response.data.list !== null) {
  924. for (let i = 0; i < response.data.list.length; i++) {
  925. // this.$set(this.listAdd[0].file.response.execresult.LastInsertId)
  926. console.log(response.data.list[i])
  927. const urlArray = []
  928. const fileList = []
  929. if (response.data.list[i].picpath1 == undefined && response.data.list[i].picpath2 == undefined && response.data.list[i].picpath3 == undefined) {
  930. urlArray.push()
  931. } else if (response.data.list[i].picpath1 == undefined) {
  932. urlArray.push(process.env.VUE_APP_BASE_API + response.data.list[i].picpath2, process.env.VUE_APP_BASE_API + response.data.list[i].picpath3)
  933. } else if (response.data.list[i].picpath2 == undefined && response.data.list[i].picpath3 == undefined) {
  934. urlArray.push(process.env.VUE_APP_BASE_API + response.data.list[i].picpath1)
  935. } else if (response.data.list[i].picpath2 == undefined) {
  936. urlArray.push(process.env.VUE_APP_BASE_API + response.data.list[i].picpath1, process.env.VUE_APP_BASE_API + response.data.list[i].picpath3)
  937. } else if (response.data.list[i].picpath3 == undefined) {
  938. urlArray.push(process.env.VUE_APP_BASE_API + response.data.list[i].picpath1, process.env.VUE_APP_BASE_API + response.data.list[i].picpath2)
  939. } else {
  940. 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)
  941. }
  942. for (let i = 0; i < urlArray.length; i++) {
  943. const urlObj = {}
  944. this.$set(urlObj, 'url', urlArray[i])
  945. fileList.push(urlObj)
  946. }
  947. this.$set(this.listAdd[i], 'fileList', fileList)
  948. console.log(this.listAdd)
  949. if (this.listAdd[i].fileList.length > 2) {
  950. this.listAdd[i].showUpload = true
  951. } else {
  952. this.listAdd[i].showUpload = false
  953. }
  954. // if (this.listAdd[i].fileList.length > 2) {
  955. // this.$nextTick(() => {
  956. // this.$set(this.listAdd[i], 'showUpload', false)
  957. // })
  958. // } else {
  959. // this.$nextTick(() => {
  960. // this.$set(this.listAdd[i], 'showUpload', false)
  961. // })
  962. // }
  963. }
  964. }
  965. // console.log(this.listAdd)
  966. setTimeout(() => {
  967. this.listLoadingAdd = false
  968. }, 300)
  969. })
  970. },
  971. edit_dialog_save() {
  972. console.log('点击了编辑保存', this.listAdd)
  973. console.log('点击了保存')
  974. this.isokDisable = true
  975. setTimeout(() => {
  976. this.isokDisable = false
  977. }, 1000)
  978. this.$refs['createTemp'].validate(valid => {
  979. if (valid) {
  980. for (var i = 0; i < this.listAdd.length; i++) {
  981. if (this.listAdd[i].score == null) {
  982. this.$message({
  983. type: 'warning',
  984. message: '请检查检查结果是否为空',
  985. duration: 2000
  986. })
  987. return false
  988. }
  989. console.log(this.listAdd[i].pic1)
  990. if (this.listAdd[i].pic1 == undefined) {
  991. this.listAdd[i].pic1 = -1
  992. }
  993. if (this.listAdd[i].pic2 == undefined) {
  994. this.listAdd[i].pic2 = -1
  995. }
  996. if (this.listAdd[i].pic3 == undefined) {
  997. this.listAdd[i].pic3 = -1
  998. }
  999. }
  1000. this.postDataPramas.common = { 'returnmap': '0' }
  1001. this.postDataPramas.data = []
  1002. // this.postDataPramas.data[0] = { 'name': 'deletejudge', 'type': 'e', 'parammaps': {
  1003. // bigId: this.createTemp.id
  1004. // }}
  1005. this.postDataPramas.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.listAdd }}
  1006. this.postDataPramas.data[0].children = []
  1007. this.postDataPramas.data[0].children[0] = { 'name': 'updatejudge', 'type': 'e', 'parammaps': {
  1008. bigId: this.createTemp.id,
  1009. judgetype: '@insertSpotList.judgetype',
  1010. statue: '@insertSpotList.statue',
  1011. score: '@insertSpotList.score',
  1012. note: '@insertSpotList.note',
  1013. pic1: '@insertSpotList.pic1',
  1014. pic2: '@insertSpotList.pic2',
  1015. pic3: '@insertSpotList.pic3',
  1016. id: '@insertSpotList.id'
  1017. }}
  1018. ExecDataByConfig(this.postDataPramas).then(response => {
  1019. console.log('新增保存发送参数', this.postDataPramas)
  1020. if (response.msg === 'fail') {
  1021. this.$notify({
  1022. title: '保存失败',
  1023. message: response.data,
  1024. type: 'warning',
  1025. duration: 2000
  1026. })
  1027. } else {
  1028. this.getdataListParm.parammaps.inputDatetime = ''
  1029. this.get_table_data()
  1030. this.dialogFormVisibleAdd = false
  1031. this.createTemp.providerName = ''
  1032. this.$notify({
  1033. title: '',
  1034. message: '保存成功',
  1035. type: 'success',
  1036. duration: 2000
  1037. })
  1038. }
  1039. })
  1040. }
  1041. })
  1042. },
  1043. form_delete(row) {
  1044. console.log('删除')
  1045. MessageBox.confirm('确认删除?', {
  1046. confirmButtonText: '确认',
  1047. cancelButtonText: '取消',
  1048. type: 'warning'
  1049. })
  1050. .then(() => {
  1051. this.postDataPramas.common = { 'returnmap': '0' }
  1052. this.postDataPramas.data = []
  1053. this.postDataPramas.data[0] = { 'name': 'deleteBigjudge', 'type': 'e', 'parammaps': {
  1054. id: row.id
  1055. }}
  1056. this.postDataPramas.data[1] = { 'name': 'deletejudge', 'type': 'e', 'parammaps': {
  1057. bigId: row.id
  1058. }}
  1059. ExecDataByConfig(this.postDataPramas).then(response => {
  1060. console.log('删除发送参数', this.postDataPramas)
  1061. if (response.msg === 'fail') {
  1062. this.$notify({
  1063. title: '删除失败',
  1064. message: response.data,
  1065. type: 'warning',
  1066. duration: 2000
  1067. })
  1068. } else {
  1069. this.getdataListParm.parammaps.inputDatetime = ''
  1070. this.get_table_data()
  1071. this.$notify({
  1072. title: '',
  1073. message: '删除成功',
  1074. type: 'success',
  1075. duration: 2000
  1076. })
  1077. }
  1078. })
  1079. })
  1080. .catch(() => {
  1081. this.$message({
  1082. type: 'info',
  1083. message: '已取消删除'
  1084. })
  1085. })
  1086. },
  1087. get_table_data2() {
  1088. this.listLoading2 = true
  1089. // this.listLoadingAdd = true
  1090. GetDataByName(this.getdataListParm2).then(response => {
  1091. if (response.data.list !== null) {
  1092. this.list2 = response.data.list
  1093. // this.listAdd = response.data.list
  1094. // for (var i = 0; i < this.listAdd.length; i++) {
  1095. // this.$set(this.listAdd[i], 'showUpload', false)
  1096. // }
  1097. } else {
  1098. this.list2 = []
  1099. // this.listAdd = []
  1100. }
  1101. this.pageNum2 = response.data.pageNum
  1102. this.pageSize2 = response.data.pageSize
  1103. if (response.data.total) {
  1104. this.total2 = response.data.total
  1105. }
  1106. setTimeout(() => {
  1107. this.listLoading2 = false
  1108. // this.listLoadingAdd = false
  1109. }, 300)
  1110. })
  1111. },
  1112. handleDownload() {
  1113. console.log('点击了导出')
  1114. this.$alert('评估验证信息正在导出中,请勿刷新或离开本页面,若导出时间过长,建议缩小导出数据范围重新导出', {})
  1115. this.isPercentage = true
  1116. this.percentage = 1
  1117. var timer = setInterval(() => {
  1118. this.percentage += 5
  1119. if (this.percentage > 95) {
  1120. this.percentage = 99
  1121. clearInterval(timer)
  1122. }
  1123. this.percentage = this.percentage
  1124. }, 1000)
  1125. var send_data = {
  1126. name: 'getjudgeListByExcel', page: 1, offset: 1, pagecount: 0,
  1127. returntype: 'Map',
  1128. parammaps: {
  1129. formType:'评估验证信息',
  1130. pastureName: this.getdataListParm.parammaps.pastureName,
  1131. judgetype:this.getdataListParm.parammaps.judgetype,
  1132. startTime:this.getdataListParm.parammaps.startTime,
  1133. stopTime: this.getdataListParm.parammaps.stopTime,
  1134. empName: this.getdataListParm.parammaps.empName,
  1135. }
  1136. }
  1137. GetAccount(send_data).then(response => {
  1138. this.listSee2 = response.data.list
  1139. if (response.data.list !== null) {
  1140. this.percentage = 99
  1141. setTimeout(() => {
  1142. this.isPercentage = false
  1143. }, 2000)
  1144. for (var i = 0; i < response.data.list.length; i++) {
  1145. const urlArray = []
  1146. const fileList = []
  1147. if (response.data.list[i].picpath1 == undefined && response.data.list[i].picpath2 == undefined && response.data.list[i].picpath3 == undefined) {
  1148. urlArray.push()
  1149. } else if (response.data.list[i].picpath1 == undefined) {
  1150. urlArray.push(process.env.VUE_APP_BASE_API + response.data.list[i].picpath2, process.env.VUE_APP_BASE_API + response.data.list[i].picpath3)
  1151. } else if (response.data.list[i].picpath2 == undefined && response.data.list[i].picpath3 == undefined) {
  1152. urlArray.push(process.env.VUE_APP_BASE_API + response.data.list[i].picpath1)
  1153. } else if (response.data.list[i].picpath2 == undefined) {
  1154. urlArray.push(process.env.VUE_APP_BASE_API + response.data.list[i].picpath1, process.env.VUE_APP_BASE_API + response.data.list[i].picpath3)
  1155. } else if (response.data.list[i].picpath3 == undefined) {
  1156. urlArray.push(process.env.VUE_APP_BASE_API + response.data.list[i].picpath1, process.env.VUE_APP_BASE_API + response.data.list[i].picpath2)
  1157. } else {
  1158. 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)
  1159. }
  1160. for (let i = 0; i < urlArray.length; i++) {
  1161. const urlObj = {}
  1162. this.$set(urlObj, 'url', urlArray[i])
  1163. fileList.push(urlObj)
  1164. }
  1165. this.$set(this.listSee2[i], 'fileList', fileList)
  1166. console.log(this.listSee2)
  1167. this.listSee2[i].showUpload = true
  1168. }
  1169. console.log(this.listSee2)
  1170. var downloadseeArray = []
  1171. for (let i = 0; i < this.listSee2.length; i++) {
  1172. var downloadseeObj = {}
  1173. this.$set(downloadseeObj, 'pastureName', this.listSee2[i].pastureName)
  1174. this.$set(downloadseeObj, 'empName', this.listSee2[i].empName)
  1175. this.$set(downloadseeObj, 'batime', this.listSee2[i].batime)
  1176. this.$set(downloadseeObj, 'judgetype', this.listSee2[i].judgetype)
  1177. this.$set(downloadseeObj, 'statue', this.listSee2[i].statue)
  1178. this.$set(downloadseeObj, 'score', this.listSee2[i].score)
  1179. this.$set(downloadseeObj, 'note', this.listSee2[i].note)
  1180. this.$set(downloadseeObj, 'mypic1', process.env.VUE_APP_BASE_API + this.listSee2[i].picpath1)
  1181. this.$set(downloadseeObj, 'mypic2', process.env.VUE_APP_BASE_API + this.listSee2[i].picpath2)
  1182. this.$set(downloadseeObj, 'mypic3', process.env.VUE_APP_BASE_API + this.listSee2[i].picpath3)
  1183. downloadseeArray.push(downloadseeObj)
  1184. }
  1185. console.log('downloadseeArray', downloadseeArray)
  1186. const column = [
  1187. { title: '牧场', key: 'pastureName', type: 'text' },
  1188. { title: '评估人', key: 'empName', type: 'text' },
  1189. { title: '评估日期', key: 'batime', type: 'text' },
  1190. { title: '检查类别', key: 'judgetype', type: 'text' },
  1191. { title: '检查标准', key: 'statue', type: 'text' },
  1192. { title: '检查结果', key: 'score', type: 'text' },
  1193. { title: '问题描述', key: 'note', type: 'text' },
  1194. { title: '问题图片', key: 'mypic1', type: 'image', width: 80, height: 60 },
  1195. { title: '问题图片', key: 'mypic2', type: 'image', width: 80, height: 60 },
  1196. { title: '问题图片', key: 'mypic3', type: 'image', width: 80, height: 60 }
  1197. ]
  1198. const data = downloadseeArray
  1199. const excelName = '评估验证'
  1200. table2excel(column, data, excelName)
  1201. }
  1202. })
  1203. },
  1204. handleInspectionStandard() {
  1205. console.log('点击了检查标准管理')
  1206. // table1隐藏/table2显示
  1207. this.List1 = false
  1208. this.List2 = true
  1209. this.get_table_data2()
  1210. },
  1211. goBack() {
  1212. // table1显示/table2隐藏
  1213. this.List1 = true
  1214. this.List2 = false
  1215. this.get_table_data()
  1216. },
  1217. form_add2() {
  1218. console.log('点击了检查标准管理-新增')
  1219. this.createTemp.statue = ''
  1220. this.list3 = []
  1221. this.dialogStatus = 'create'
  1222. this.dialogFormVisible = true
  1223. },
  1224. handleDownloadTemp2() {
  1225. console.log('点击了模板')
  1226. import('@/vendor/Export2Excel').then(excel => {
  1227. const list1 = []
  1228. const tHeader = [
  1229. '检查类别', '检查标准'
  1230. ]
  1231. const filterVal = [
  1232. '检查类别', '检查标准'
  1233. ]
  1234. const data1 = this.formatJson(filterVal, list1)
  1235. excel.export_json_to_excel({
  1236. header: tHeader,
  1237. data: data1,
  1238. filename: '评估验证模板',
  1239. autoWidth: true,
  1240. bookType: 'xlsx'
  1241. })
  1242. })
  1243. },
  1244. beforeImportExcel2(file) {
  1245. const isLt2M = file.size / 1024 / 1024 < 6
  1246. if (!isLt2M) {
  1247. this.$message.error('上传文件大小不能超过 6MB!')
  1248. }
  1249. return isLt2M
  1250. },
  1251. handleImportExcelSuccess2(res, file) {
  1252. this.get_table_data2()
  1253. if (res.msg === 'ok') {
  1254. this.$message({
  1255. title: '成功',
  1256. message: '导入成功:' + res.data.success + '条!',
  1257. type: 'success',
  1258. duration: 2000
  1259. })
  1260. if (res.data.err_count > 0) {
  1261. this.$notify({
  1262. title: '失败',
  1263. message: '导入失败:' + res.data.err_count + '条!',
  1264. type: 'danger',
  1265. duration: 2000
  1266. })
  1267. import('@/vendor/Export2Excel').then(excel => {
  1268. const list1 = res.data.result
  1269. const tHeader = [
  1270. '检查类别', '检查标准', '报错信息'
  1271. ]
  1272. const filterVal = [
  1273. '检查类别', '检查标准', 'error_msg'
  1274. ]
  1275. const data1 = this.formatJson(filterVal, list1)
  1276. excel.export_json_to_excel({
  1277. header: tHeader,
  1278. data: data1,
  1279. filename: '评估验证报错信息',
  1280. autoWidth: true,
  1281. bookType: 'xlsx'
  1282. })
  1283. })
  1284. }
  1285. } else {
  1286. this.$notify({
  1287. title: '失败',
  1288. message: '上传失败',
  1289. type: 'danger',
  1290. duration: 2000
  1291. })
  1292. }
  1293. },
  1294. formatJson(filterVal, jsonData) {
  1295. return jsonData.map(v =>
  1296. filterVal.map(j => {
  1297. if (j === 'timestamp') {
  1298. return parseTime(v[j])
  1299. } else {
  1300. return v[j]
  1301. }
  1302. })
  1303. )
  1304. },
  1305. // console.log('点击了检查标准管理-新增-添加标准')
  1306. handleAddStandard() {
  1307. console.log('点击了检查标准管理-新增-添加标准')
  1308. this.list3.push({ 'myid': (new Date()).valueOf(), 'statue': '' })
  1309. },
  1310. form_delete3(row) {
  1311. console.log(row)
  1312. if (row.id !== undefined) {
  1313. this.$set(row, 'myid', row.id)
  1314. }
  1315. MessageBox.confirm('确认删除?', {
  1316. confirmButtonText: '确认',
  1317. cancelButtonText: '取消',
  1318. type: 'warning'
  1319. }).then(() => {
  1320. for (var i = 0; i < this.list3.length; i++) {
  1321. console.log(this.list3[i])
  1322. if (this.list3[i].myid == row.myid) {
  1323. var list3Index = this.list3.indexOf(this.list3[i])
  1324. }
  1325. if (list3Index > -1) {
  1326. this.list3.splice(list3Index, 1)
  1327. return
  1328. }
  1329. }
  1330. })
  1331. },
  1332. add_dialog_save2() {
  1333. this.isokDisable = true
  1334. setTimeout(() => {
  1335. this.isokDisable = false
  1336. }, 1000)
  1337. this.$refs['createTemp'].validate(valid => {
  1338. if (valid) {
  1339. if (this.list3.length !== 0) {
  1340. for (let i = 0; i < this.list3.length; i++) {
  1341. if (this.list3[i].statue == '') {
  1342. this.$message({
  1343. type: 'warning',
  1344. message: '请检查检查标准是否未填写',
  1345. duration: 2000
  1346. })
  1347. return false
  1348. } else {
  1349. this.postDataParam.common = { 'returnmap': '0' }
  1350. this.postDataParam.data = []
  1351. this.postDataParam.data[0] = { 'name': 'inserBigAssessment', 'type': 'e', 'parammaps': {
  1352. 'statue': this.createTemp.statue
  1353. }}
  1354. this.postDataParam.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.list3 }}
  1355. this.postDataParam.data[1].children = []
  1356. this.postDataParam.data[1].children[0] = { 'name': 'insertAssessment', 'type': 'e', 'parammaps': {
  1357. statue: '@insertSpotList.statue',
  1358. bigId: '@inserBigAssessment.LastInsertId'
  1359. }}
  1360. }
  1361. }
  1362. ExecDataByConfig(this.postDataParam).then(response => {
  1363. console.log('保存发送参数', this.postDataParam)
  1364. if (response.msg === 'fail') {
  1365. this.$notify({
  1366. title: '保存失败',
  1367. message: response.data,
  1368. type: 'warning',
  1369. duration: 2000
  1370. })
  1371. } else {
  1372. this.get_table_data2()
  1373. this.dialogFormVisible = false
  1374. this.$notify({
  1375. title: '',
  1376. message: '保存成功',
  1377. type: 'success',
  1378. duration: 2000
  1379. })
  1380. }
  1381. })
  1382. } else {
  1383. this.$message({
  1384. title: '',
  1385. message: '请选择添加标准',
  1386. type: 'warning',
  1387. duration: 2000
  1388. })
  1389. return false
  1390. }
  1391. }
  1392. })
  1393. },
  1394. form_see2(row) {
  1395. this.list3 = []
  1396. this.createTemp = Object.assign(row, {})
  1397. this.dialogStatus = 'see'
  1398. this.dialogFormVisible = true
  1399. this.getdataListParmSee2.parammaps.id = row.id
  1400. this.get_table_dataSee2()
  1401. },
  1402. get_table_dataSee2() {
  1403. GetDataByName(this.getdataListParmSee2).then(response => {
  1404. if (response.data.list !== null) {
  1405. this.listAdd = response.data.list
  1406. this.list3 = response.data.list
  1407. for (var i = 0; i < this.listAdd.length; i++) {
  1408. this.$set(this.listAdd[i], 'showUpload', false)
  1409. this.$set(this.listAdd[i], 'judgetype', this.judgetype)
  1410. }
  1411. } else {
  1412. this.list3 = []
  1413. this.listAdd = []
  1414. }
  1415. setTimeout(() => {
  1416. this.listLoading3 = false
  1417. }, 300)
  1418. })
  1419. },
  1420. form_edit2(row) {
  1421. this.createTemp.statue = ''
  1422. this.list3 = []
  1423. this.createTemp = Object.assign(row, {})
  1424. this.dialogStatus = 'update'
  1425. this.dialogFormVisible = true
  1426. this.getdataListParmSee2.parammaps.id = row.id
  1427. this.get_table_dataSee2()
  1428. },
  1429. edit_dialog_save2() {
  1430. this.isokDisable = true
  1431. setTimeout(() => {
  1432. this.isokDisable = false
  1433. }, 1000)
  1434. this.$refs['createTemp'].validate(valid => {
  1435. if (valid) {
  1436. if (this.list3.length !== 0) {
  1437. for (let i = 0; i < this.list3.length; i++) {
  1438. if (this.list3[i].statue == '') {
  1439. this.$message({
  1440. type: 'warning',
  1441. message: '请检查检查标准是否未填写',
  1442. duration: 2000
  1443. })
  1444. return false
  1445. } else {
  1446. this.postDataParam.common = { 'returnmap': '0' }
  1447. this.postDataParam.data = []
  1448. this.postDataParam.data[0] = { 'name': 'updateBigAssessment', 'type': 'e', 'parammaps': {
  1449. 'id': this.createTemp.id,
  1450. 'statue': this.createTemp.statue
  1451. }}
  1452. this.postDataParam.data[1] = { 'name': 'deleteAssessmentListBybigid', 'type': 'e', 'parammaps': {
  1453. 'id': this.createTemp.id
  1454. }}
  1455. this.postDataParam.data[2] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.list3 }}
  1456. this.postDataParam.data[2].children = []
  1457. this.postDataParam.data[2].children[0] = { 'name': 'insertAssessment', 'type': 'e', 'parammaps': {
  1458. statue: '@insertSpotList.statue',
  1459. bigId: this.createTemp.id
  1460. }}
  1461. }
  1462. }
  1463. ExecDataByConfig(this.postDataParam).then(response => {
  1464. console.log('保存发送参数', this.postDataParam)
  1465. if (response.msg === 'fail') {
  1466. this.$notify({
  1467. title: '保存失败',
  1468. message: response.data,
  1469. type: 'warning',
  1470. duration: 2000
  1471. })
  1472. } else {
  1473. this.get_table_data2()
  1474. this.dialogFormVisible = false
  1475. this.$notify({
  1476. title: '',
  1477. message: '保存成功',
  1478. type: 'success',
  1479. duration: 2000
  1480. })
  1481. }
  1482. })
  1483. } else {
  1484. this.$message({
  1485. title: '',
  1486. message: '请选择添加标准',
  1487. type: 'warning',
  1488. duration: 2000
  1489. })
  1490. return false
  1491. }
  1492. }
  1493. })
  1494. },
  1495. form_delete2(row) {
  1496. console.log('检查标准管理-删除')
  1497. MessageBox.confirm('确认删除此信息?', {
  1498. confirmButtonText: '确认',
  1499. cancelButtonText: '取消',
  1500. type: 'warning'
  1501. }).then(() => {
  1502. this.postDataParam.name = 'deleteAssessmentList'
  1503. this.postDataParam.parammaps = {}
  1504. this.postDataParam.parammaps.id = row.id
  1505. PostDataByName(this.postDataParam).then(() => {
  1506. this.get_table_data2()
  1507. this.dialogFormVisible = false
  1508. this.$notify({
  1509. title: '成功',
  1510. message: '删除成功',
  1511. type: 'success',
  1512. duration: 2000
  1513. })
  1514. })
  1515. }).catch(() => {
  1516. this.$message({
  1517. type: 'info',
  1518. message: '已取消删除'
  1519. })
  1520. })
  1521. }
  1522. }
  1523. }
  1524. </script>
  1525. <style lang="scss" scoped>
  1526. .app-btn{
  1527. margin-bottom: 10px;
  1528. }
  1529. .title2{
  1530. height: 50px;
  1531. line-height: 50px;
  1532. font:700 18px/50px '';
  1533. .title2-l{
  1534. float: left;
  1535. }
  1536. .title2-r{
  1537. float: right;
  1538. }
  1539. }
  1540. </style>
  1541. <style lang="scss">
  1542. #uploadPic{
  1543. height: 70px;
  1544. }
  1545. #uploadPic .el-upload-list--picture-card .el-upload-list__item{
  1546. width: 70px;
  1547. height: 70px;
  1548. }
  1549. #uploadPic .el-upload--picture-card{
  1550. width: 70px;
  1551. height: 70px;
  1552. line-height: 70px;
  1553. }
  1554. #uploadPic .hide .el-upload--picture-card {
  1555. display: none;
  1556. }
  1557. // 查看 隐藏删除
  1558. #uploadPicSee{
  1559. height: 70px;
  1560. }
  1561. #uploadPicSee .el-upload-list--picture-card .el-upload-list__item{
  1562. width: 70px;
  1563. height: 70px;
  1564. }
  1565. #uploadPicSee .el-upload--picture-card{
  1566. width: 70px;
  1567. height: 70px;
  1568. line-height: 70px;
  1569. }
  1570. #uploadPicSee .el-upload-list--picture-card .el-upload-list__item-actions .el-upload-list__item-delete{
  1571. display: none;
  1572. }
  1573. </style>