setTaskcd.vue 30 KB

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