setTaskcd.vue 32 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046
  1. <template>
  2. <div>
  3. <el-breadcrumb separator-class="el-icon-arrow-right">
  4. <el-breadcrumb-item>首页</el-breadcrumb-item>
  5. <el-breadcrumb-item>承担单位</el-breadcrumb-item>
  6. <el-breadcrumb-item :to="{ path: '/jc/routineMonitor' }">任务列表</el-breadcrumb-item>
  7. <el-breadcrumb-item>基本信息</el-breadcrumb-item>
  8. </el-breadcrumb>
  9. <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
  10. <el-tab-pane label="任务详情" name="first">
  11. <el-descriptions class="margin-top" title="例行监测任务" :column="2" :size="size" border>
  12. <el-descriptions-item>
  13. <template slot="label" prop="releaser">
  14. 发布单位
  15. </template>
  16. {{readForm.releaserInfo.rymc}}
  17. </el-descriptions-item>
  18. <el-descriptions-item>
  19. <template slot="label">
  20. 年度
  21. </template>
  22. {{readForm.taskInfo.year}}
  23. </el-descriptions-item>
  24. <el-descriptions-item>
  25. <template slot="label">
  26. 开始时间和结束时间
  27. </template>
  28. {{readForm.taskInfo.starttime}}-{{readForm.taskInfo.endtime}}
  29. </el-descriptions-item>
  30. <el-descriptions-item>
  31. <template slot="label">
  32. 抽样信息上报截止时间
  33. </template>
  34. {{readForm.taskInfo.endtime_cydsb}}
  35. </el-descriptions-item>
  36. <el-descriptions-item>
  37. <template slot="label">
  38. 监测类型
  39. </template>
  40. {{readForm.taskInfo.task_class}}
  41. </el-descriptions-item>
  42. <el-descriptions-item>
  43. <template slot="label">
  44. 行业
  45. </template>
  46. <!-- <div v-if="readForm.product!=[]"> -->
  47. <span>{{readForm.model_type}}</span>
  48. <!-- </div> -->
  49. <!-- <div v-else>暂无</div> -->
  50. </el-descriptions-item>
  51. <el-descriptions-item>
  52. <template slot="label">
  53. 抽检分离
  54. </template>
  55. <span v-if="readForm.taskInfo.is_divide==1">是</span>
  56. <span v-if="readForm.taskInfo.is_divide==0">否</span>
  57. </el-descriptions-item>
  58. <el-descriptions-item>
  59. <template slot="label">
  60. 附件
  61. </template>
  62. <div v-if="readForm.file_url==null">无</div>
  63. <el-link v-else type="primary" :href="readForm.taskInfo.file_url">下载附件</el-link>
  64. </el-descriptions-item>
  65. </el-descriptions>
  66. <el-descriptions class="margin-top" :size="size" border>
  67. <el-descriptions-item>
  68. <template slot="label">
  69. 备注
  70. </template>
  71. {{readForm.taskInfo.log}}
  72. </el-descriptions-item>
  73. </el-descriptions>
  74. <el-descriptions class="margin-top" :size="size" border>
  75. <el-descriptions-item>
  76. <template slot="label">
  77. 检测对象
  78. </template>
  79. {{productNameText}}
  80. <!-- <span v-for="item in readForm.product">{{item.product_name}}、</span> -->
  81. </el-descriptions-item>
  82. </el-descriptions>
  83. <el-descriptions class="margin-top" :size="size" border>
  84. <el-descriptions-item>
  85. <template slot="label">
  86. 检测项
  87. </template>
  88. {{pesticidesNameText}}
  89. <!-- <span v-for="item in readForm.pesticides">{{item.test_name}}、</span> -->
  90. </el-descriptions-item>
  91. </el-descriptions>
  92. <el-table :data="underTask" border stripe highlight-current-row style="width: 100%"
  93. :row-style="rowStyle" :cell-style="cellStyle">
  94. <el-table-column :key="table.label" v-for="table in tableHeader2" :label="table.label"
  95. :prop="table.prop" align="center" :width="table.width" :fixed="table.fixed" />
  96. </el-table>
  97. <div class="footer">
  98. <el-button type="success" size="mini" @click="input()">填报抽样单</el-button>
  99. <!-- <el-button type="success" size="mini" @click="next">导出总览</el-button> -->
  100. <!-- <el-button type="success" size="mini" @click="back">返回</el-button> -->
  101. </div>
  102. </el-tab-pane>
  103. <el-tab-pane label="抽样" name="second">
  104. <!-- <el-tab-pane v-if="sampleShow==true" label="抽样" name="second"> -->
  105. <!-- 头部搜索栏 -->
  106. <el-form style="display: flex; flex-direction: column;" ref="form2" :model="queryInfo">
  107. <el-row style="width: 75%;">
  108. <el-col :span="6">
  109. <el-form-item label="样品名称" class="select" size="small" prop="sample_name">
  110. <el-input v-model="queryInfo.sample_name"></el-input>
  111. </el-form-item>
  112. </el-col>
  113. <el-col :span="6">
  114. <el-form-item label="样品编码" class="select" size="small" prop="sample_id">
  115. <el-input v-model="queryInfo.sample_id"></el-input>
  116. </el-form-item>
  117. </el-col>
  118. <el-col :span="6">
  119. <el-form-item label="受检单位" class="select" size="small" prop="units_name">
  120. <el-input v-model="queryInfo.units_name"></el-input>
  121. </el-form-item>
  122. </el-col>
  123. </el-row>
  124. <el-row style="width: 75%;">
  125. <el-col :span="6">
  126. <el-form-item label="抽样单位" class="select" size="small" prop="sample_unit_name">
  127. <el-input v-model="queryInfo.sample_unit_name"></el-input>
  128. </el-form-item>
  129. </el-col>
  130. <el-col :span="6">
  131. <el-form-item label="抽样日期" class="select" size="small" prop="sample_data">
  132. <el-input v-model="queryInfo.sample_data"></el-input>
  133. </el-form-item>
  134. </el-col>
  135. <el-col :span="6">
  136. <el-form-item label="抽样场所" class="select" size="small" prop="sample_ground">
  137. <el-input v-model="queryInfo.sample_ground"></el-input>
  138. </el-form-item>
  139. </el-col>
  140. <el-col :span="4">
  141. <el-button style="height: 32px;margin-left: 10px;" size="mini" type="success"
  142. @click="searchData()">查询
  143. </el-button>
  144. <!-- 重置 -->
  145. <el-button style="height: 32px;margin-left: 5px;" size="mini" type="success" @click="resetForm('form2')">
  146. 重置
  147. </el-button>
  148. </el-col>
  149. </el-row>
  150. </el-form>
  151. <el-row style="margin-right: 0px;">
  152. <el-form style="display: flex; flex-direction: row;">
  153. <!-- <el-form-item label="产地" class="select">
  154. <el-select v-model="value" placeholder="请选择省份" size="small">
  155. <el-option v-for="item in options" :key="item.value" :label="item.label"
  156. :value="item.value">
  157. </el-option>
  158. </el-select>
  159. <el-select v-model="value" placeholder="请选择城市" size="small">
  160. <el-option v-for="item in options" :key="item.value" :label="item.label"
  161. :value="item.value">
  162. </el-option>
  163. </el-select>
  164. <el-select v-model="value" placeholder="请选择区/县" size="small">
  165. <el-option v-for="item in options" :key="item.value" :label="item.label"
  166. :value="item.value">
  167. </el-option>
  168. </el-select>
  169. </el-form-item> -->
  170. <!-- 查询 -->
  171. </el-form>
  172. <div style="display: flex;flex-direction: row;float: right;">
  173. <el-button type="primary" size="small" plain icon="el-icon-plus" @click="input()">填报抽样单
  174. </el-button>
  175. <el-button type="primary" size="small" plain icon="el-icon-edit-outline" @click="appear">上报抽样信息
  176. </el-button>
  177. <!-- <el-button type="primary" size="small" plain icon="el-icon-scissors" @click="repeal()">导出</el-button> -->
  178. <el-button type="primary" size="small" plain icon="el-icon-delete" @click="delAll">删除
  179. </el-button>
  180. <!-- <el-button type="primary" size="small" plain icon="el-icon-download">导出</el-button> -->
  181. </div>
  182. </el-row>
  183. <!-- 表格数据区域-->
  184. <el-table ref="multipleTable" :data="tableData" border stripe highlight-current-row
  185. @selection-change="handleSelectionChange" style="width: 100%" :row-style="rowStyle"
  186. :cell-style="cellStyle">
  187. <el-table-column type="selection" width="50"></el-table-column>
  188. <el-table-column label="序号" width="50px">
  189. <template slot-scope="scope">
  190. {{ scope.$index+1 }}
  191. </template>
  192. </el-table-column>
  193. <el-table-column :key="table.label" v-for="table in tableHeader" :label="table.label"
  194. :prop="table.prop" align="center" :width="table.width" :fixed="table.fixed" />
  195. <el-table-column label="操作" align="center" fixed="right">
  196. <template slot-scope="scope">
  197. <el-button type="success" size="small" plain @click="sampleDetail(scope.row.sample_id)">查看
  198. </el-button>
  199. </template>
  200. </el-table-column>
  201. </el-table>
  202. <!-- 分页器区域-->
  203. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
  204. :current-page="queryInfo.pageNum" :page-sizes="[1,10, 15, 20]" :page-size="queryInfo.pageSize"
  205. layout="total, sizes, prev, pager, next, jumper" :total="total" background />
  206. </el-tab-pane>
  207. <el-tab-pane label="检测" name="third">
  208. <!-- <el-tab-pane v-if="checkShow==true" label="检测" name="third"> -->
  209. <!-- 表格数据区域-->
  210. <el-table :data="tableData" border stripe highlight-current-row style="width: 100%"
  211. :row-style="rowStyle" :cell-style="cellStyle">
  212. <!-- <el-table-column type="selection" width="50"></el-table-column> -->
  213. <el-table-column label="序号" width="50px">
  214. <template slot-scope="scope">
  215. {{ scope.$index+1 }}
  216. </template>
  217. </el-table-column>
  218. <el-table-column :key="table.label" v-for="table in checkHeader" :label="table.label"
  219. :prop="table.prop" align="center" :width="table.width" :fixed="table.fixed" />
  220. <el-table-column label="操作" align="center" fixed="right" width="220px">
  221. <template slot-scope="scope">
  222. <el-button type="success" size="mini" v-if="scope.row.jc_value_id==null" plain
  223. @click="check(scope.row.sample_id,scope.row.sample_name)">检测</el-button>
  224. <el-button type="primary" v-else size="mini" plain @click="update(scope.row)">修改</el-button>
  225. <el-button type="primary" size="mini" plain @click="upcheck(scope.row.sample_id)">上报
  226. </el-button>
  227. <el-button type="primary" size="mini" plain @click="creatpdf(scope.row.sample_id)">生成检测报告
  228. </el-button>
  229. </template>
  230. </el-table-column>
  231. </el-table>
  232. <!-- 分页器区域-->
  233. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
  234. :current-page="queryInfo.pageNum" :page-sizes="[1,10, 15, 20]" :page-size="queryInfo.pageSize"
  235. layout="total, sizes, prev, pager, next, jumper" :total="total" background />
  236. </el-tab-pane>
  237. <el-dialog title="填写检测单" :visible.sync="inputCheckShow" width="70%" :close-on-click-modal="false"
  238. class="dialogItem">
  239. <span class="demonstration">样品编码:{{check_id}}</span>
  240. <span class="demonstration">样品名称:{{check_name}}</span>
  241. <el-button type="success" size="small" plain @click="onSubmit">保存</el-button>
  242. <span class="demonstration">注意:“不得检出”只能填为“ND”</span>
  243. <!-- 表格数据区域-->
  244. <el-table :data="testPesticides" border stripe highlight-current-row style="width: 100%"
  245. :row-style="rowStyle" :cell-style="cellStyle">
  246. <el-table-column :key="table.label" v-for="table in checkHeader2" :label="table.label"
  247. :prop="table.prop" align="center" :width="table.width" :fixed="table.fixed" />
  248. <el-table-column label="检测值">
  249. <template slot-scope="scope">
  250. <el-input v-model="scope.row.test_value" size="small" />
  251. </template>
  252. </el-table-column>
  253. <el-table-column label="限量值">
  254. <template slot-scope="scope">
  255. <el-input v-model="scope.row.state_value" size="small" />
  256. </template>
  257. </el-table-column>
  258. <el-table-column label="单位">
  259. <template slot-scope="scope">
  260. <span v-model="scope.row.unit" size="small">mg/kg</span>
  261. </template>
  262. </el-table-column>
  263. <el-table-column label="抽检结果">
  264. <template slot-scope="scope">
  265. <span v-if="parseFloat(scope.row.test_value)<=parseFloat(scope.row.state_value)&&scope.row.state_value!='ND'"
  266. size="small">合格</span>
  267. <span v-else-if="parseFloat(scope.row.test_value)>parseFloat(scope.row.state_value)" size="small">不合格</span>
  268. <span v-else-if="scope.row.test_value=='ND'&&scope.row.state_value=='ND'"
  269. size="small">合格</span>
  270. <span v-else-if="scope.row.test_value!='ND'&&scope.row.state_value=='ND'"
  271. size="small">不合格</span>
  272. </template>
  273. </el-table-column>
  274. <el-table-column label="LOD">
  275. <template slot-scope="scope">
  276. <el-input v-model="scope.row.LOD" size="small" />
  277. </template>
  278. </el-table-column>
  279. <el-table-column label="LOQ">
  280. <template slot-scope="scope">
  281. <el-input v-model="scope.row.LOQ" />
  282. </template>
  283. </el-table-column>
  284. </el-table>
  285. </el-dialog>
  286. <!-- ///////////////////////////////////////////检测报告生成-------难、、、、、、、、、、、、、、、、、、、、、、 -->
  287. <el-dialog title="生成监测报告" :visible.sync="dialogVisible2" width="50%">
  288. <div id="pdf">
  289. <el-form ref="formjc" :model="formjc" label-width="100px"
  290. style="margin-top: 20px;width: 100%;background-color: aliceblue;padding: 5px;">
  291. <el-row style="text-align: center; font-size: 23px; margin: 40px 0;">
  292. 安徽省农业农村厅农产品质量安全例行监测检测报告
  293. </el-row>
  294. <el-row>
  295. <el-col :span="12">
  296. <el-form-item label="样品名称" prop="sample_name" class="labelItem" size="mini">
  297. <el-input disabled v-model="formjc.sample_name"></el-input>
  298. </el-form-item>
  299. </el-col>
  300. <el-col :span="11">
  301. <el-form-item label="样品编码" prop="sample_id" class="labelItem" style="" size="mini">
  302. <el-input disabled v-model="formjc.sample_id"></el-input>
  303. </el-form-item>
  304. </el-col>
  305. </el-row>
  306. <el-row>
  307. <el-col :span="12">
  308. <el-form-item label="型号规格" prop="type" class="labelItem" size="mini">
  309. <el-input disabled v-model="formjc.type"></el-input>
  310. </el-form-item>
  311. </el-col>
  312. <el-col :span="11">
  313. <el-form-item label="执行标准" prop="standard" class="labelItem" style="" size="mini">
  314. <el-input disabled v-model="formjc.standard"></el-input>
  315. </el-form-item>
  316. </el-col>
  317. </el-row>
  318. <el-row>
  319. <el-col :span="12">
  320. <el-form-item label="生产日期或批号" prop="production_date" class="labelItem" size="mini">
  321. <el-input disabled v-model="formjc.production_date"></el-input>
  322. </el-form-item>
  323. </el-col>
  324. <el-col :span="11">
  325. <el-form-item label="产地" prop="place" class="labelItem" style="" size="mini">
  326. <el-input disabled v-model="formjc.place"></el-input>
  327. </el-form-item>
  328. </el-col>
  329. </el-row>
  330. <el-row>
  331. <el-col :span="12">
  332. <el-form-item label="产品认证情况" prop="certicfie" class="labelItem" size="mini">
  333. <el-input disabled v-model="formjc.certicfie"></el-input>
  334. </el-form-item>
  335. </el-col>
  336. <el-col :span="11">
  337. <el-form-item label="证书编号" prop="certifie_num" class="labelItem" style="" size="mini">
  338. <el-input disabled v-model="formjc.certifie_num"></el-input>
  339. </el-form-item>
  340. </el-col>
  341. </el-row>
  342. <el-row>
  343. <el-col :span="12">
  344. <el-row>
  345. <el-col :span="13">
  346. <el-form-item label="抽样数量" prop="sample_renum" class="labelItem" size="mini">
  347. <el-input disabled v-model="formjc.sample_renum"></el-input>
  348. </el-form-item>
  349. </el-col>
  350. <el-col :span="10">
  351. <el-form-item label="单位" prop="sample_num_unit" class="labelItem" size="mini"
  352. label-width="60px">
  353. <el-input disabled v-model="formjc.sample_num_unit"></el-input>
  354. </el-form-item>
  355. </el-col>
  356. </el-row>
  357. </el-col>
  358. <el-col :span="11">
  359. <el-row>
  360. <el-col :span="13">
  361. <el-form-item label="抽样基数" prop="sample_base" class="labelItem" size="mini">
  362. <el-input disabled v-model="formjc.sample_base"></el-input>
  363. </el-form-item>
  364. </el-col>
  365. <el-col :span="10">
  366. <el-form-item label="单位" prop="sample_base_unit" class="labelItem" size="mini"
  367. label-width="60px" clearable>
  368. <el-input disabled v-model="formjc.sample_base_unit"></el-input>
  369. </el-form-item>
  370. </el-col>
  371. </el-row>
  372. </el-col>
  373. </el-row>
  374. <el-row>
  375. <el-col>
  376. <el-form-item label="抽样场所" prop="sample_ground" class="labelItem" size="mini">
  377. <el-input disabled v-model="formjc.sample_ground"></el-input>
  378. </el-form-item>
  379. </el-col>
  380. </el-row>
  381. <el-row>
  382. <el-col :span="7"
  383. style="text-align: center;vertical-align: middle;line-height: 250px;font-size: 14px;">
  384. <div class="">
  385. 受检单位情况
  386. </div>
  387. </el-col>
  388. <el-col :span="15">
  389. <el-form-item label="单位名称" prop="units_name" class="labelItem" style="" size="mini">
  390. <el-input disabled v-model="formjc.units_name"></el-input>
  391. </el-form-item>
  392. <el-form-item label="通讯地址" prop="address" class="labelItem" style="" size="mini">
  393. <el-input disabled v-model="formjc.address"></el-input>
  394. </el-form-item>
  395. <el-form-item label="法定代表人" prop="corporation" class="labelItem" style="" size="mini">
  396. <el-input disabled v-model="formjc.corporation"></el-input>
  397. </el-form-item>
  398. <el-form-item label="受检人" prop="user_name" class="labelItem" style="" size="mini">
  399. <el-input disabled v-model="formjc.user_name"></el-input>
  400. </el-form-item>
  401. <el-form-item label="电话" prop="phone" class="labelItem" style="" size="mini">
  402. <el-input disabled v-model="formjc.phone"></el-input>
  403. </el-form-item>
  404. <el-form-item label="传真" prop="fax" class="labelItem" style="" size="mini">
  405. <el-input disabled v-model="formjc.fax"></el-input>
  406. </el-form-item>
  407. </el-col>
  408. </el-row>
  409. </el-form>
  410. <el-table :data="resultjc" border stripe highlight-current-row style="width: 100%"
  411. :row-style="rowStyle" :cell-style="cellStyle">
  412. <el-table-column :key="table.label" v-for="table in jcheader" :label="table.label"
  413. :prop="table.prop" align="center" :width="table.width" :fixed="table.fixed" />
  414. </el-table>
  415. </div>
  416. <div style="margin-top: 10px; text-align: center">
  417. <el-button @click="dialogVisible2 = false">取 消</el-button>
  418. <el-button type="primary" @click="download">生成检测报告pdf</el-button>
  419. </div>
  420. <!-- </span> -->
  421. </el-dialog>
  422. <el-tab-pane label="报告上传" name="five">
  423. <el-upload class="upload-demo" :file-list="fileList" drag :headers="myHeaders"
  424. action="http://syjcapi.aielab.net/api/v1/ossUpload" :on-success="uploadSuccess" :limit="1">
  425. <i class="el-icon-upload"></i>
  426. <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
  427. </el-upload>
  428. </el-tab-pane>
  429. </el-tabs>
  430. </div>
  431. </template>
  432. <script>
  433. import htmlToPdf from '../../assets/js/htmlToPdf.js'
  434. import inputCheck from './inputCheck'
  435. const token = window.sessionStorage.getItem('token')
  436. const name = window.sessionStorage.getItem('name')
  437. export default {
  438. name: 'setTask',
  439. data() {
  440. return {
  441. size: 'medium',
  442. myHeaders: {
  443. Authorization: 'bearer' + token
  444. },
  445. formjc: {},
  446. dialogVisible2: false,
  447. activeName: 'first',
  448. id: 0,
  449. productNameText: '',
  450. pesticidesNameText: '',
  451. readForm: {
  452. },
  453. underTask: [],
  454. underTasktotal: '0',
  455. queryInfo: {
  456. pageNum: 1,
  457. pageSize: 10,
  458. task_id: '',
  459. sample_id: '',
  460. units_name: '',
  461. sample_name: '',
  462. sample_data: '',
  463. sample_unit_name: '',
  464. sample_ground: '',
  465. },
  466. releaserInfo:{
  467. groupname: '',
  468. rymc:'',
  469. },
  470. taskInfo:{
  471. base_file_url: null,
  472. batch: '',
  473. creater: null,
  474. createtime: null,
  475. endtime: null,
  476. endtime_cydsb: null,
  477. file_name: null,
  478. file_url: null,
  479. filenum: null,
  480. id: null,
  481. industry: null,
  482. is_divide: null,
  483. ispublic:null,
  484. level:null,
  485. log: null,
  486. main_unit: null,
  487. releaser:null,
  488. starttime: null,
  489. status: null,
  490. task_class: null,
  491. task_name:null,
  492. test_model_id:null,
  493. year: null,
  494. },
  495. // 填报对话框弹出
  496. inputDialogShow: false,
  497. cellStyle: {
  498. padding: 2 + 'px'
  499. },
  500. rowStyle: {
  501. height: 35 + 'px'
  502. },
  503. tableHeader: [{
  504. label: '样品编码',
  505. prop: 'sample_id'
  506. // fixed: 'left'
  507. }, {
  508. label: '样品名称',
  509. prop: 'sample_name',
  510. // fixed: 'left'
  511. },
  512. {
  513. label: '受检单位',
  514. prop: 'units_name',
  515. width: 180
  516. },
  517. {
  518. label: '样品产地',
  519. prop: 'place',
  520. width: 180
  521. }, {
  522. label: '抽样日期',
  523. prop: 'sample_date',
  524. width: 180
  525. }, {
  526. label: '状态',
  527. prop: 'status',
  528. width: 180
  529. }
  530. ],
  531. checkHeader: [{
  532. label: '样品名称',
  533. prop: 'sample_name',
  534. // fixed: 'left'
  535. }, {
  536. label: '样品编码',
  537. prop: 'sample_id'
  538. // fixed: 'left'
  539. },
  540. {
  541. label: '受检单位',
  542. prop: 'production_name',
  543. width: 180
  544. },
  545. {
  546. label: '抽样单位',
  547. prop: 'sample_unit_name',
  548. width: 180
  549. }, {
  550. label: '检测单位',
  551. prop: 'units_name',
  552. width: 180
  553. }, {
  554. label: '判定结果',
  555. prop: 'test_result',
  556. width: 180
  557. }, {
  558. label: '状态',
  559. prop: 'test_status',
  560. width: 180
  561. }
  562. ],
  563. checkHeader2: [{
  564. label: '检测项目',
  565. prop: 'test_name',
  566. // fixed: 'left'
  567. }],
  568. // 数据表格数据
  569. tableData: [],
  570. options: [],
  571. task_id: '',
  572. multipleSelection: null,
  573. // 填报检测对话框
  574. inputCheckShow: false,
  575. check_name: '',
  576. check_id: '',
  577. testPesticides: [],
  578. resultjc: [],
  579. // 模型列表
  580. options: [],
  581. bindForm: {
  582. test_model_id: '',
  583. closingdate: ''
  584. },
  585. jcheader: [{
  586. label: '检测项目',
  587. prop: 'test_name',
  588. },
  589. {
  590. label: '检测值',
  591. prop: 'test_value',
  592. }, {
  593. label: '限量值',
  594. prop: 'state_value',
  595. }, {
  596. label: '单位',
  597. prop: 'unit',
  598. }, {
  599. label: '抽检结果',
  600. prop: 'test_result'
  601. }, {
  602. label: 'LOD',
  603. prop: 'LOD',
  604. }, {
  605. label: 'LOQ',
  606. prop: 'LOQ',
  607. }
  608. ],
  609. tableHeader2: [{
  610. label: '抽样机构',
  611. prop: 'bear_name',
  612. width: 180,
  613. }, {
  614. label: '检测机构',
  615. prop: 'check_name'
  616. },
  617. {
  618. label: '抽样地区',
  619. prop: 'address'
  620. }, {
  621. label: '抽样数量',
  622. prop: 'sample_number'
  623. },
  624. {
  625. label: '报告上传单位',
  626. prop: 'report_name'
  627. }, {
  628. label: '报告上传截止时间',
  629. prop: 'uploadtime'
  630. }
  631. ],
  632. fileList: [],
  633. total: 0,
  634. sampleShow: false, //是否展示抽样卡片
  635. checkShow: false //是否展示检测卡片
  636. };
  637. },
  638. components: {
  639. inputCheck
  640. },
  641. mounted() {},
  642. created() {
  643. this.task_id = this.$route.params.id
  644. this.getTaskDetail()
  645. this.getSampleList()
  646. // this.getmodelList()
  647. // this.getUnderTask()
  648. },
  649. methods: {
  650. // 获取机构地域表格
  651. async getUnderTask() {
  652. this.queryInfo['task_id'] = this.task_id
  653. const result = await this.$http.post('getUnderTask', this.queryInfo)
  654. // 判断业务逻辑
  655. if (result.data.code == 0) {
  656. this.underTask = result.data.data.rows
  657. // 抽检分离时判断用户是抽样机构还是检测机构
  658. for (let i = 0; i < this.underTask.length; i++) {
  659. if (this.underTask[i].bear_name == name) {
  660. this.sampleShow = true
  661. }
  662. if (this.underTask[i].check_name == name) {
  663. this.checkShow = true
  664. }
  665. }
  666. this.underTasktotal = result.data.data.total
  667. }
  668. },
  669. // 获取模型列表
  670. // async getmodelList() {
  671. // const {
  672. // data: res
  673. // } = await this.$http.post(
  674. // "getModelList", {
  675. // 'pageNum': 1,
  676. // 'pageSize': 100,
  677. // type_id: ""
  678. // }
  679. // );
  680. // this.options = res.data.rows
  681. // }, // 获取任务详情
  682. //查询
  683. async searchData() {
  684. console.log(this.queryInfo)
  685. this.queryInfo.pageNum = 1
  686. this.getSampleList()
  687. },
  688. //重置
  689. resetForm(formName) {
  690. // console.log(this.queryInfo)
  691. this.$refs[formName].resetFields();
  692. },
  693. //获取任务详情
  694. async getTaskDetail() {
  695. var that = this
  696. const {
  697. data: res
  698. } = await this.$http.post("getTaskDetail", {
  699. task_id: that.task_id,
  700. pageNum: that.queryInfo.pageNum,
  701. pageSize: that.queryInfo.pageSize
  702. });
  703. console.log(res.data.product)
  704. if (res.data.product.length > 0) {
  705. if (res.data.product[0].type_id == '1') {
  706. res.data.model_type = '种植业'
  707. } else if (res.data.product[0].type_id == '2') {
  708. res.data.model_type = '畜牧业'
  709. } else if (res.data.product[0].type_id == '3') {
  710. res.data.model_type = '渔业'
  711. } else {
  712. res.data.model_type = '其他'
  713. }
  714. }
  715. that.readForm = res.data
  716. that.productNameText = that.readForm.product.map(el => el.product_name).join('、 ')
  717. that.pesticidesNameText = that.readForm.pesticides.map(el => el.test_name).join('、 ')
  718. that.underTask = res.data.underTaskList.rows
  719. that.underTasktotal = res.data.underTaskList.total
  720. // 抽检不分离
  721. if (that.taskInfo.is_divide == 0) {
  722. this.sampleShow = true
  723. this.checkShow = true
  724. }
  725. },
  726. // 上传成功
  727. async uploadSuccess(res) {
  728. console.log(res.data)
  729. this.form.file_url = res.data.fileUrl
  730. this.form.file_name = res.data.fileName
  731. const result = await this.$http.post('saveTestFile', {
  732. sample_id: sample_id
  733. })
  734. if (result.data.code == 0) {
  735. that.formjc = result.data.data
  736. }
  737. },
  738. //下载检测报告
  739. download() {
  740. htmlToPdf.downloadPDF(document.querySelector('#pdf'), '检测报告')
  741. },
  742. //生成检测报告pdf
  743. async creatpdf(sample_id) {
  744. var that = this
  745. that.dialogVisible2 = true
  746. // async getSampleDetail() {
  747. const result = await this.$http.post('getSampleDetail', {
  748. sample_id: sample_id
  749. })
  750. if (result.data.code == 0) {
  751. that.formjc = result.data.data
  752. }
  753. console.log(that.formjc)
  754. const res = await this.$http.post('getTestValue', {
  755. sample_id: sample_id
  756. })
  757. if (res.data.code == 0) {
  758. that.resultjc = res.data.data.result_detail
  759. }
  760. console.log(that.resultjc)
  761. // },
  762. },
  763. async onSubmit() {
  764. console.log(this.testPesticides)
  765. for (let i = 0; i < this.testPesticides.length; i++) {
  766. this.testPesticides[i]['unit'] = 'mg/kg'
  767. console.log(this.testPesticides[i]['state_value'])
  768. if (this.testPesticides[i]['state_value'] === 'ND') {
  769. if (this.testPesticides[i]['test_value'] !== 'ND') {
  770. this.testPesticides[i]['test_result'] = '不合格'
  771. }
  772. } else {
  773. if (this.testPesticides[i]['test_value'] <= this.testPesticides[i]['state_value']) {
  774. this.testPesticides[i]['test_result'] = '合格'
  775. } else if (this.testPesticides[i]['test_value'] > this.testPesticides[i]['state_value']) {
  776. this.testPesticides[i]['test_result'] = '不合格'
  777. }
  778. }
  779. delete this.testPesticides[i]['test_model_id']
  780. }
  781. var that = this
  782. const result = await this.$http.post("saveSamplePesticides", {
  783. pesticides: that.testPesticides,
  784. sample_id: that.check_id
  785. });
  786. if (result.data.code == 0) {
  787. this.$message({
  788. type: 'success',
  789. message: '检测成功!'
  790. });
  791. that.inputCheckShow = false
  792. that.getSampleList()
  793. } else {
  794. this.$message({
  795. type: 'error',
  796. message: result.data.message
  797. });
  798. that.inputCheckShow = false
  799. }
  800. },
  801. async check(id, name) {
  802. this.inputCheckShow = true
  803. this.check_id = id,
  804. this.check_name = name
  805. var that = this
  806. const {
  807. data: res
  808. } = await this.$http.post("getTestPesticides", {
  809. sample_id: id
  810. });
  811. that.testPesticides = res.data
  812. },
  813. handleClick(tab, event) {
  814. console.log(tab, event);
  815. },
  816. // 获取抽样单列表
  817. async getSampleList() {
  818. for (var key in this.queryInfo) {
  819. if (this.queryInfo[key] == '') {
  820. delete this.queryInfo[key]
  821. }
  822. }
  823. this.queryInfo['task_id'] = this.task_id
  824. const {
  825. data: res
  826. } = await this.$http.post("getSampleList", this.queryInfo);
  827. // console.log(res)
  828. this.tableData = res.data.rows
  829. console.log(this.tableData)
  830. for (let i = 0; i < this.tableData.length; i++) {
  831. if (this.tableData[i].status == '0') {
  832. this.tableData[i].status = '未上报'
  833. } else {
  834. this.tableData[i].status = '已上报'
  835. }
  836. if (this.tableData[i].jc_value_id == null) {
  837. this.tableData[i].test_result = '暂未检测'
  838. } else {
  839. if (this.tableData[i].test_result == '0') {
  840. this.tableData[i].test_result = '不合格'
  841. } else if (this.tableData[i].test_result == '1') {
  842. this.tableData[i].test_result = '合格'
  843. }
  844. }
  845. if (this.tableData[i].test_status == '0') {
  846. this.tableData[i].test_status = '未上报'
  847. } else if (this.tableData[i].test_status == '1') {
  848. this.tableData[i].test_status = '已上报'
  849. }
  850. }
  851. this.total = res.data.total
  852. },
  853. // 跳转到填写抽样单
  854. inputSample() {
  855. this.activeName = 'second'
  856. },
  857. // 填报抽样单
  858. input() {
  859. this.$router.push({
  860. name: 'inputSample',
  861. params: {
  862. id: this.readForm.id
  863. }
  864. })
  865. },
  866. // 返回
  867. back() {
  868. var that = this
  869. this.$router.push({
  870. name: 'setTaskcd',
  871. params: {
  872. id: that.id
  873. }
  874. })
  875. },
  876. // 上传抽样信息
  877. async appear() {
  878. let that = this
  879. // that.orgs = that.multipleSelection
  880. console.log(that.multipleSelection)
  881. const result = await this.$http.post('setSampleStatus', that.multipleSelection)
  882. // 判断业务逻辑
  883. if (result.data.code == 0) {
  884. // 判断业务逻辑
  885. if (result.data.code == 0) {
  886. this.$message({
  887. type: 'success',
  888. message: '上报抽样信息成功'
  889. })
  890. this.getSampleList()
  891. }
  892. }
  893. },
  894. // 多选删除抽样信息
  895. async delAll() {
  896. let that = this
  897. // that.orgs = that.multipleSelection
  898. console.log(that.multipleSelection)
  899. const result = await this.$http.post('delSample', that.multipleSelection)
  900. // 判断业务逻辑
  901. if (result.data.code == 0) {
  902. this.$message({
  903. type: 'success',
  904. message: '删除成功'
  905. })
  906. this.getSampleList()
  907. }
  908. },
  909. /** 修复当用户在大于1的分页进行数据搜索没有返回值的问题 */
  910. setPageNum() {
  911. this.queryInfo.pageNum = 1
  912. this.getSampleList()()
  913. },
  914. setSelectedRow() {
  915. // 设置当前页已选项
  916. this.hander = true
  917. this.tableData.forEach(item => {
  918. if (this.list.includes(item[this.uniqueKey])) {
  919. this.$refs.multipleTable.toggleRowSelection(item, true)
  920. }
  921. })
  922. this.hander = false
  923. },
  924. /** 监听每页显示多少数据的改变 */
  925. handleSizeChange(newSize) {
  926. this.queryInfo.pageSize = newSize
  927. this.getSampleList()()
  928. },
  929. /** 监听页码的改变 */
  930. handleCurrentChange(newPage) {
  931. this.queryInfo.pageNum = newPage
  932. this.getSampleList()()
  933. },
  934. // 批量勾选
  935. handleSelectionChange(val) {
  936. this.multipleSelection = val
  937. console.log(this.multipleSelection)
  938. if (this.hander) return false
  939. // this.setSelectRows() // 处理选中的方法
  940. },
  941. // 跳转到查看抽样单详情
  942. sampleDetail(id) {
  943. this.$router.push({
  944. name: 'sampleDetail',
  945. params: {
  946. id: id
  947. }
  948. })
  949. }
  950. }
  951. }
  952. </script>
  953. <style lang="less" scoped>
  954. .el-breadcrumb {
  955. margin-bottom: 20px;
  956. }
  957. // .el-form-item {
  958. // margin-bottom: 0px;
  959. // }
  960. .el-select {
  961. width: 210px;
  962. height: 100%;
  963. }
  964. .select {
  965. display: flex;
  966. flex-direction: row;
  967. margin-left: 10px;
  968. }
  969. // .el-form {
  970. // margin-left: 35%;
  971. // }
  972. // .el-form-item {
  973. // // margin-bottom: 8px;
  974. // margin: 0 auto;
  975. // }
  976. // .labelItem /deep/ .el-form-item__label {
  977. // // width: 80px;
  978. // text-align: center;
  979. // vertical-align: middle;
  980. // float: left;
  981. // font-size: 14px;
  982. // color: #606266;
  983. // font-weight: bold;
  984. // // line-height: 40px;
  985. // padding: 0 20px 0 0;
  986. // -webkit-box-sizing: border-box;
  987. // box-sizing: border-box;
  988. // }
  989. .demonstration {
  990. margin: 20px;
  991. }
  992. // .el-form-item__content {
  993. // width: 200px;
  994. // }
  995. .footer {
  996. margin-top: 20px;
  997. margin-left: 45%;
  998. }
  999. .el-table{
  1000. margin-top: 20px;
  1001. }
  1002. .el-pagination {
  1003. margin-top: 25px;
  1004. }
  1005. </style>