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 :to="{ path: '/jc/routineMonitor' }">任务列表</el-breadcrumb-item>
  6. <el-breadcrumb-item>基本信息</el-breadcrumb-item>
  7. </el-breadcrumb>
  8. <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
  9. <el-tab-pane label="任务详情" name="first">
  10. <el-descriptions class="margin-top" title="例行监测任务" :column="2" :size="size" border>
  11. <el-descriptions-item>
  12. <template slot="label">
  13. 发布单位
  14. </template>
  15. {{readForm.releaser}}
  16. </el-descriptions-item>
  17. <el-descriptions-item>
  18. <template slot="label">
  19. 年度
  20. </template>
  21. {{readForm.year}}
  22. </el-descriptions-item>
  23. <el-descriptions-item>
  24. <template slot="label">
  25. 开始时间和结束时间
  26. </template>
  27. {{readForm.starttime}}-{{readForm.endtime}}
  28. </el-descriptions-item>
  29. <el-descriptions-item>
  30. <template slot="label">
  31. 抽样信息上报截止时间
  32. </template>
  33. {{readForm.endtime_cydsb}}
  34. </el-descriptions-item>
  35. <el-descriptions-item>
  36. <template slot="label">
  37. 监测类型
  38. </template>
  39. {{readForm.task_class}}
  40. </el-descriptions-item>
  41. <el-descriptions-item>
  42. <template slot="label">
  43. 行业
  44. </template>
  45. <!-- <div v-if="readForm.product!=[]"> -->
  46. <span>{{readForm.model_type}}</span>
  47. <!-- </div> -->
  48. <!-- <div v-else>暂无</div> -->
  49. </el-descriptions-item>
  50. <el-descriptions-item>
  51. <template slot="label">
  52. 抽检分离
  53. </template>
  54. <span v-if="readForm.is_divide==1">是</span>
  55. <span v-if="readForm.is_divide==0">否</span>
  56. </el-descriptions-item>
  57. <el-descriptions-item>
  58. <template slot="label">
  59. 附件
  60. </template>
  61. <div v-if="readForm.file_url==null">无</div>
  62. <el-link v-else type="primary" :href="readForm.file_url">下载附件</el-link>
  63. </el-descriptions-item>
  64. </el-descriptions>
  65. <el-descriptions class="margin-top" :size="size" border>
  66. <el-descriptions-item>
  67. <template slot="label">
  68. 备注
  69. </template>
  70. {{readForm.log}}
  71. </el-descriptions-item>
  72. </el-descriptions>
  73. <el-descriptions class="margin-top" :size="size" border>
  74. <el-descriptions-item>
  75. <template slot="label">
  76. 检测对象
  77. </template>
  78. <span v-for="item in readForm.product">{{item.product_name}}、</span>
  79. </el-descriptions-item>
  80. </el-descriptions>
  81. <el-descriptions class="margin-top" :size="size" border>
  82. <el-descriptions-item>
  83. <template slot="label">
  84. 检测项
  85. </template>
  86. <span v-for="item in readForm.pesticides">{{item.test_name}}、</span>
  87. </el-descriptions-item>
  88. </el-descriptions>
  89. <el-table :data="underTask" border stripe highlight-current-row style="width: 100%"
  90. :row-style="rowStyle" :cell-style="cellStyle">
  91. <el-table-column :key="table.label" v-for="table in tableHeader2" :label="table.label"
  92. :prop="table.prop" align="center" :width="table.width" :fixed="table.fixed" />
  93. </el-table>
  94. <div class="footer">
  95. <el-button type="success" size="mini" @click="input()">填报抽样单</el-button>
  96. <!-- <el-button type="success" size="mini" @click="next">导出总览</el-button> -->
  97. <el-button type="success" size="mini">返回</el-button>
  98. </div>
  99. </el-tab-pane>
  100. <el-tab-pane v-if="sampleShow==true" label="抽样" name="second">
  101. <!-- 头部搜索栏 -->
  102. <el-row style="margin-right: 0px;">
  103. <el-form style="display: flex; flex-direction: row;">
  104. <el-form-item label="产品编码" class="select" size="small">
  105. <el-input v-model="queryInfo.task_name"></el-input>
  106. </el-form-item>
  107. <el-form-item label="受检单位" class="select" size="small">
  108. <el-input v-model="queryInfo.task_name"></el-input>
  109. </el-form-item>
  110. <el-form-item label="抽样编码" class="select" size="small">
  111. <el-input v-model="queryInfo.task_name"></el-input>
  112. </el-form-item>
  113. <el-form-item label="样品名称" class="select" size="small">
  114. <el-input v-model="queryInfo.task_name"></el-input>
  115. </el-form-item>
  116. </el-form>
  117. </el-row>
  118. <el-row style="margin-right: 0px;">
  119. <el-form style="display: flex; flex-direction: row;">
  120. <el-form-item label="抽样场所" class="select" size="small">
  121. <el-input v-model="queryInfo.task_name"></el-input>
  122. </el-form-item>
  123. <el-form-item label="抽样日期" class="select" size="small">
  124. <el-input v-model="queryInfo.task_name"></el-input>
  125. </el-form-item>
  126. <el-form-item label="抽样单位" class="select" size="small">
  127. <el-input v-model="queryInfo.task_name"></el-input>
  128. </el-form-item>
  129. <el-form-item label="抽样机构" class="select" size="small">
  130. <el-input v-model="queryInfo.task_name"></el-input>
  131. </el-form-item>
  132. <el-button style="height: 30px;margin-left: 10px;" size="mini" type="success"
  133. @click="searchData()">查询
  134. </el-button>
  135. <!-- 重置 -->
  136. <el-button style="height: 30px;margin-left: 5px;" size="mini" type="success" @click="reset()">
  137. 重置
  138. </el-button>
  139. </el-form>
  140. </el-row>
  141. <el-row style="margin-right: 0px;">
  142. <el-form style="display: flex; flex-direction: row;">
  143. <!-- <el-form-item label="产地" class="select">
  144. <el-select v-model="value" placeholder="请选择省份" size="small">
  145. <el-option v-for="item in options" :key="item.value" :label="item.label"
  146. :value="item.value">
  147. </el-option>
  148. </el-select>
  149. <el-select v-model="value" placeholder="请选择城市" size="small">
  150. <el-option v-for="item in options" :key="item.value" :label="item.label"
  151. :value="item.value">
  152. </el-option>
  153. </el-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-form-item> -->
  160. <!-- 查询 -->
  161. </el-form>
  162. <div style="display: flex;flex-direction: row;float: right;">
  163. <el-button type="primary" size="small" plain icon="el-icon-plus" @click="input()">填报抽样单
  164. </el-button>
  165. <el-button type="primary" size="small" plain icon="el-icon-edit-outline" @click="appear">上报抽样信息
  166. </el-button>
  167. <!-- <el-button type="primary" size="small" plain icon="el-icon-scissors" @click="repeal()">导出</el-button> -->
  168. <el-button type="primary" size="small" plain icon="el-icon-delete" @click="delAll">删除
  169. </el-button>
  170. <!-- <el-button type="primary" size="small" plain icon="el-icon-download">导出</el-button> -->
  171. </div>
  172. </el-row>
  173. <!-- 表格数据区域-->
  174. <el-table ref="multipleTable" :data="tableData" border stripe highlight-current-row
  175. @selection-change="handleSelectionChange" style="width: 100%" :row-style="rowStyle"
  176. :cell-style="cellStyle">
  177. <el-table-column type="selection" width="50"></el-table-column>
  178. <el-table-column label="序号" width="50px">
  179. <template slot-scope="scope">
  180. {{ scope.$index+1 }}
  181. </template>
  182. </el-table-column>
  183. <el-table-column :key="table.label" v-for="table in tableHeader" :label="table.label"
  184. :prop="table.prop" align="center" :width="table.width" :fixed="table.fixed" />
  185. <el-table-column label="操作" align="center" fixed="right">
  186. <template slot-scope="scope">
  187. <el-button type="success" size="small" plain @click="sampleDetail(scope.row.sample_id)">查看
  188. </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 v-if="checkShow==true" 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">
  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" fixed="right" 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="parseFloat(scope.row.test_value)<=parseFloat(scope.row.state_value)&&scope.row.state_value!='ND'"
  255. size="small">合格</span>
  256. <span v-else-if="parseFloat(scope.row.test_value)>parseFloat(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. const name = window.sessionStorage.getItem('name')
  424. export default {
  425. name: 'setTask',
  426. data() {
  427. return {
  428. size: 'medium',
  429. myHeaders: {
  430. Authorization: 'bearer' + token
  431. },
  432. formjc: {},
  433. dialogVisible2: false,
  434. activeName: 'first',
  435. id: 0,
  436. readForm: {},
  437. underTask: [],
  438. underTasktotal: '0',
  439. queryInfo: {
  440. pageNum: 1,
  441. pageSize: 10,
  442. task_id: ''
  443. },
  444. // 填报对话框弹出
  445. inputDialogShow: false,
  446. cellStyle: {
  447. padding: 2 + 'px'
  448. },
  449. rowStyle: {
  450. height: 35 + 'px'
  451. },
  452. tableHeader: [{
  453. label: '样品编码',
  454. prop: 'sample_id'
  455. // fixed: 'left'
  456. }, {
  457. label: '样品名称',
  458. prop: 'sample_name',
  459. // fixed: 'left'
  460. },
  461. {
  462. label: '受检单位',
  463. prop: 'units_name',
  464. width: 180
  465. },
  466. {
  467. label: '样品产地',
  468. prop: 'place',
  469. width: 180
  470. }, {
  471. label: '抽样日期',
  472. prop: 'sample_date',
  473. width: 180
  474. }, {
  475. label: '状态',
  476. prop: 'status',
  477. width: 180
  478. }
  479. ],
  480. checkHeader: [{
  481. label: '样品名称',
  482. prop: 'sample_name',
  483. // fixed: 'left'
  484. }, {
  485. label: '样品编码',
  486. prop: 'sample_id'
  487. // fixed: 'left'
  488. },
  489. {
  490. label: '受检单位',
  491. prop: 'production_name',
  492. width: 180
  493. },
  494. {
  495. label: '抽样单位',
  496. prop: 'sample_unit_name',
  497. width: 180
  498. }, {
  499. label: '检测单位',
  500. prop: 'units_name',
  501. width: 180
  502. }, {
  503. label: '判定结果',
  504. prop: 'test_result',
  505. width: 180
  506. }, {
  507. label: '状态',
  508. prop: 'test_status',
  509. width: 180
  510. }
  511. ],
  512. checkHeader2: [{
  513. label: '检测项目',
  514. prop: 'test_name',
  515. // fixed: 'left'
  516. }],
  517. // 数据表格数据
  518. tableData: [],
  519. options: [],
  520. task_id: '',
  521. multipleSelection: null,
  522. // 填报检测对话框
  523. inputCheckShow: false,
  524. check_name: '',
  525. check_id: '',
  526. testPesticides: [],
  527. resultjc: [],
  528. // 模型列表
  529. options: [],
  530. bindForm: {
  531. test_model_id: '',
  532. closingdate: ''
  533. },
  534. jcheader: [{
  535. label: '检测项目',
  536. prop: 'test_name',
  537. },
  538. {
  539. label: '检测值',
  540. prop: 'test_value',
  541. }, {
  542. label: '限量值',
  543. prop: 'state_value',
  544. }, {
  545. label: '单位',
  546. prop: 'unit',
  547. }, {
  548. label: '抽检结果',
  549. prop: 'test_result'
  550. }, {
  551. label: 'LOD',
  552. prop: 'LOD',
  553. }, {
  554. label: 'LOQ',
  555. prop: 'LOQ',
  556. }
  557. ],
  558. tableHeader2: [{
  559. label: '抽样机构',
  560. prop: 'bear_name',
  561. width: 180,
  562. }, {
  563. label: '检测机构',
  564. prop: 'check_name'
  565. },
  566. {
  567. label: '抽样地区',
  568. prop: 'address'
  569. }, {
  570. label: '抽样数量',
  571. prop: 'sample_number'
  572. },
  573. {
  574. label: '报告上传单位',
  575. prop: 'report_name'
  576. }, {
  577. label: '报告上传截止时间',
  578. prop: 'uploadtime'
  579. }
  580. ],
  581. fileList: [],
  582. total: 0,
  583. sampleShow: false, //是否展示抽样卡片
  584. checkShow: false //是否展示检测卡片
  585. };
  586. },
  587. components: {
  588. inputCheck
  589. },
  590. mounted() {},
  591. created() {
  592. this.task_id = this.$route.params.id
  593. this.getTaskDetail()
  594. this.getSampleList()
  595. // this.getmodelList()
  596. this.getUnderTask()
  597. },
  598. methods: {
  599. // 获取机构地域表格
  600. async getUnderTask() {
  601. this.queryInfo['task_id'] = this.task_id
  602. const result = await this.$http.post('getUnderTask', this.queryInfo)
  603. // 判断业务逻辑
  604. if (result.data.code == 0) {
  605. this.underTask = result.data.data.rows
  606. // 抽检分离时判断用户是抽样机构还是检测机构
  607. for (let i = 0; i < this.underTask.length; i++) {
  608. if (this.underTask[i].bear_name == name) {
  609. this.sampleShow = true
  610. }
  611. if (this.underTask[i].check_name == name) {
  612. this.checkShow = true
  613. }
  614. }
  615. this.underTasktotal = result.data.data.total
  616. }
  617. },
  618. // 获取模型列表
  619. // async getmodelList() {
  620. // const {
  621. // data: res
  622. // } = await this.$http.post(
  623. // "getModelList", {
  624. // 'pageNum': 1,
  625. // 'pageSize': 100,
  626. // type_id: ""
  627. // }
  628. // );
  629. // this.options = res.data.rows
  630. // }, // 获取任务详情
  631. async getTaskDetail() {
  632. var that = this
  633. const {
  634. data: res
  635. } = await this.$http.post("getTaskDetail", {
  636. task_id: that.task_id
  637. });
  638. console.log(res.data.product)
  639. if (res.data.product.length > 0) {
  640. if (res.data.product[0].type_id == '1') {
  641. res.data.model_type = '种植业'
  642. } else if (res.data.product[0].type_id == '2') {
  643. res.data.model_type = '畜牧业'
  644. } else if (res.data.product[0].type_id == '3') {
  645. res.data.model_type = '渔业'
  646. } else {
  647. res.data.model_type = '其他'
  648. }
  649. }
  650. that.readForm = res.data
  651. // 抽检不分离
  652. if (that.readForm.is_divide == 0) {
  653. this.sampleShow = true
  654. this.checkShow = true
  655. }
  656. },
  657. // 上传成功
  658. async uploadSuccess(res) {
  659. console.log(res.data)
  660. this.form.file_url = res.data.fileUrl
  661. this.form.file_name = res.data.fileName
  662. const result = await this.$http.post('saveTestFile', {
  663. sample_id: sample_id
  664. })
  665. if (result.data.code == 0) {
  666. that.formjc = result.data.data
  667. }
  668. },
  669. download() {
  670. htmlToPdf.downloadPDF(document.querySelector('#pdf'), '检测报告')
  671. },
  672. async creatpdf(sample_id) {
  673. var that = this
  674. that.dialogVisible2 = true
  675. // async getSampleDetail() {
  676. const result = await this.$http.post('getSampleDetail', {
  677. sample_id: sample_id
  678. })
  679. if (result.data.code == 0) {
  680. that.formjc = result.data.data
  681. }
  682. const res = await this.$http.post('getTestValue', {
  683. sample_id: sample_id
  684. })
  685. if (res.data.code == 0) {
  686. that.resultjc = res.data.data.result_detail
  687. }
  688. // },
  689. },
  690. async onSubmit() {
  691. console.log(this.testPesticides)
  692. for (let i = 0; i < this.testPesticides.length; i++) {
  693. this.testPesticides[i]['unit'] = 'mg/kg'
  694. console.log(this.testPesticides[i]['state_value'])
  695. if (this.testPesticides[i]['state_value'] === 'ND') {
  696. if (this.testPesticides[i]['test_value'] !== 'ND') {
  697. this.testPesticides[i]['test_result'] = '不合格'
  698. }
  699. } else {
  700. if (this.testPesticides[i]['test_value'] <= this.testPesticides[i]['state_value']) {
  701. this.testPesticides[i]['test_result'] = '合格'
  702. } else if (this.testPesticides[i]['test_value'] > this.testPesticides[i]['state_value']) {
  703. this.testPesticides[i]['test_result'] = '不合格'
  704. }
  705. }
  706. delete this.testPesticides[i]['test_model_id']
  707. }
  708. var that = this
  709. const result = await this.$http.post("saveSamplePesticides", {
  710. pesticides: that.testPesticides,
  711. sample_id: that.check_id
  712. });
  713. if (result.data.code == 0) {
  714. this.$message({
  715. type: 'success',
  716. message: '检测成功!'
  717. });
  718. that.inputCheckShow = false
  719. that.getSampleList()
  720. } else {
  721. this.$message({
  722. type: 'error',
  723. message: result.data.message
  724. });
  725. that.inputCheckShow = false
  726. }
  727. },
  728. async check(id, name) {
  729. this.inputCheckShow = true
  730. this.check_id = id,
  731. this.check_name = name
  732. var that = this
  733. const {
  734. data: res
  735. } = await this.$http.post("getTestPesticides", {
  736. sample_id: id
  737. });
  738. that.testPesticides = res.data
  739. },
  740. handleClick(tab, event) {
  741. console.log(tab, event);
  742. },
  743. // 获取抽样单列表
  744. async getSampleList() {
  745. this.queryInfo['task_id'] = this.task_id
  746. const {
  747. data: res
  748. } = await this.$http.post("getSampleList", this.queryInfo);
  749. // console.log(res)
  750. this.tableData = res.data.rows
  751. for (let i = 0; i < this.tableData.length; i++) {
  752. if (this.tableData[i].status == '0') {
  753. this.tableData[i].status = '未上报'
  754. } else {
  755. this.tableData[i].status = '已上报'
  756. }
  757. if (this.tableData[i].jc_value_id == null) {
  758. this.tableData[i].test_result = '暂未检测'
  759. } else {
  760. if (this.tableData[i].test_result == '0') {
  761. this.tableData[i].test_result = '不合格'
  762. } else if (this.tableData[i].test_result == '1') {
  763. this.tableData[i].test_result = '合格'
  764. }
  765. }
  766. if (this.tableData[i].test_status == '0') {
  767. this.tableData[i].test_status = '未上报'
  768. } else if (this.tableData[i].test_status == '1') {
  769. this.tableData[i].test_status = '已上报'
  770. }
  771. }
  772. this.total = res.data.total
  773. },
  774. // 跳转到填写抽样单
  775. inputSample() {
  776. this.activeName = 'second'
  777. },
  778. // 填报抽样单
  779. input() {
  780. this.$router.push({
  781. name: 'inputSample',
  782. params: {
  783. id: this.readForm.id
  784. }
  785. })
  786. },
  787. // 上传抽样信息
  788. async appear() {
  789. let that = this
  790. // that.orgs = that.multipleSelection
  791. console.log(that.multipleSelection)
  792. const result = await this.$http.post('setSampleStatus', that.multipleSelection)
  793. // 判断业务逻辑
  794. if (result.data.code == 0) {
  795. // 判断业务逻辑
  796. if (result.data.code == 0) {
  797. this.$message({
  798. type: 'success',
  799. message: '上报抽样信息成功'
  800. })
  801. this.getSampleList()
  802. }
  803. }
  804. },
  805. // 多选删除抽样信息
  806. async delAll() {
  807. let that = this
  808. // that.orgs = that.multipleSelection
  809. console.log(that.multipleSelection)
  810. const result = await this.$http.post('delSample', that.multipleSelection)
  811. // 判断业务逻辑
  812. if (result.data.code == 0) {
  813. this.$message({
  814. type: 'success',
  815. message: '删除成功'
  816. })
  817. this.getSampleList()
  818. }
  819. },
  820. /** 修复当用户在大于1的分页进行数据搜索没有返回值的问题 */
  821. setPageNum() {
  822. this.queryInfo.pageNum = 1
  823. this.getSampleList()()
  824. },
  825. setSelectedRow() {
  826. // 设置当前页已选项
  827. this.hander = true
  828. this.tableData.forEach(item => {
  829. if (this.list.includes(item[this.uniqueKey])) {
  830. this.$refs.multipleTable.toggleRowSelection(item, true)
  831. }
  832. })
  833. this.hander = false
  834. },
  835. /** 监听每页显示多少数据的改变 */
  836. handleSizeChange(newSize) {
  837. this.queryInfo.pageSize = newSize
  838. this.getSampleList()()
  839. },
  840. /** 监听页码的改变 */
  841. handleCurrentChange(newPage) {
  842. this.queryInfo.pageNum = newPage
  843. this.getSampleList()()
  844. },
  845. // 批量勾选
  846. handleSelectionChange(val) {
  847. this.multipleSelection = val
  848. console.log(this.multipleSelection)
  849. if (this.hander) return false
  850. // this.setSelectRows() // 处理选中的方法
  851. },
  852. // 跳转到查看抽样单详情
  853. sampleDetail(id) {
  854. this.$router.push({
  855. name: 'sampleDetail',
  856. params: {
  857. id: id
  858. }
  859. })
  860. }
  861. }
  862. }
  863. </script>
  864. <style lang="less" scoped>
  865. .el-breadcrumb {
  866. margin-bottom: 20px;
  867. }
  868. // .el-form-item {
  869. // margin-bottom: 0px;
  870. // }
  871. .el-select {
  872. width: 210px;
  873. height: 100%;
  874. }
  875. .select {
  876. display: flex;
  877. flex-direction: row;
  878. margin-left: 10px;
  879. }
  880. // .el-form {
  881. // margin-left: 35%;
  882. // }
  883. // .el-form-item {
  884. // // margin-bottom: 8px;
  885. // margin: 0 auto;
  886. // }
  887. // .labelItem /deep/ .el-form-item__label {
  888. // // width: 80px;
  889. // text-align: center;
  890. // vertical-align: middle;
  891. // float: left;
  892. // font-size: 14px;
  893. // color: #606266;
  894. // font-weight: bold;
  895. // // line-height: 40px;
  896. // padding: 0 20px 0 0;
  897. // -webkit-box-sizing: border-box;
  898. // box-sizing: border-box;
  899. // }
  900. .demonstration {
  901. margin: 20px;
  902. }
  903. // .el-form-item__content {
  904. // width: 200px;
  905. // }
  906. .footer {
  907. margin-top: 20px;
  908. margin-left: 45%;
  909. }
  910. .el-table{
  911. margin-top: 20px;
  912. }
  913. .el-pagination {
  914. margin-top: 25px;
  915. }
  916. </style>