sampleDetailcd copy.vue 37 KB

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