setTaskcd.vue 39 KB

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