fillSampleReport.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757
  1. <template>
  2. <div>
  3. <el-breadcrumb separator-class="el-icon-arrow-right">
  4. <el-breadcrumb-item :to="{ path: '/jc/workbench' }">首页</el-breadcrumb-item>
  5. <!-- <el-breadcrumb-item :to="{ path: '/jc/setTaskcd'}">例行检测</el-breadcrumb-item> -->
  6. <!-- <el-breadcrumb-item>承担单位</el-breadcrumb-item>
  7. <el-breadcrumb-item :to="{ path: '/jc/routineMonitor' }">例行检测</el-breadcrumb-item>
  8. <el-breadcrumb-item>执行任务</el-breadcrumb-item>
  9. :to="{ path: '/jc/setTaskcd' }"
  10. <el-breadcrumb-item>抽样</el-breadcrumb-item> -->
  11. <el-breadcrumb-item>填报抽样单</el-breadcrumb-item>
  12. </el-breadcrumb>
  13. <div id="sjinformation">
  14. <el-steps :active="active" finish-status="finish" style="width:70%; margin:auto;">
  15. <!-- <el-step title="步骤 1" description="填报抽样单编号"></el-step> -->
  16. <el-step title="步骤 1" description="填报受检单位信息"></el-step>
  17. <el-step title="步骤 2" description="填报样品信息"></el-step>
  18. <el-step title="步骤 3" description="填报抽样单信息"></el-step>
  19. </el-steps>
  20. </div>
  21. <!-- 受检单位信息 -->
  22. <div id="sjinformation" style="margin:40px auto; width:50%" v-show="active == 1">
  23. <el-form :rules="rules" :model="inspected_Unit">
  24. <el-form-item label="单位名称:" prop="inspected_name" class="labelItem">
  25. <el-input v-model="inspected_Unit.inspected_name" style="width:60%"></el-input>
  26. </el-form-item>
  27. <el-form-item label="单位地址:" prop="inspected_address" class="labelItem">
  28. <el-cascader placeholder="请选择地区" :options="options" v-model="selectedOptions" @change="handleChange" style="width:25%">
  29. </el-cascader>
  30. <el-input v-model="inspected_Unit.inspected_address2" placeholder="请输入详细地址" style="width:34.5%;margin-left:5px;"></el-input>
  31. </el-form-item>
  32. <!-- <el-form-item label="" prop="inspected_address2" class="labelItem">
  33. <el-input v-model="inspected_Unit.inspected_address" placeholder="请输入详细地址" style="width:42%"></el-input>
  34. </el-form-item> -->
  35. <el-form-item label="联系人:" prop="contact_name" class="labelItem">
  36. <el-input v-model="inspected_Unit.contact_name" style="width:60%"></el-input>
  37. </el-form-item>
  38. <el-form-item label="联系电话:" prop="contact_phone" class="labelItem">
  39. <el-input v-model="inspected_Unit.contact_phone" style="width:60%"></el-input>
  40. </el-form-item>
  41. <el-form-item label="Email:" prop="contact_email" class="labelItem">
  42. <el-input v-model="inspected_Unit.contact_email" style="width:60%"></el-input>
  43. </el-form-item>
  44. </el-form>
  45. <div class="footer">
  46. <el-button type="primary" style="margin-bottom:30px;" size="small" @click="next1()">下一步</el-button>
  47. </div>
  48. </div>
  49. <!-- 样品信息 -->
  50. <div style="width: 90%; margin:40px auto;" v-show="active == 2">
  51. <!-- 新增 -->
  52. <!-- <el-row :gutter="90" style="margin-right: 0px;"> -->
  53. <div style="display: flex;flex-direction: row;float: right; margin-bottom:20px;">
  54. <el-button type="primary" size="small" plain icon="el-icon-plus" @click="addSampleInforDialog = true;">新增</el-button>
  55. </div>
  56. <!-- </el-row> -->
  57. <!-- 表格数据区域-->
  58. <el-table ref="multipleTable" :data="tableData" border stripe highlight-current-row style="width: 100%; margin:auto;"
  59. :row-style="rowStyle" :cell-style="cellStyle">
  60. <el-table-column type="selection" width="50"></el-table-column>
  61. <el-table-column label="序号" width="50px">
  62. <template slot-scope="scope">
  63. {{ scope.$index+1 }}
  64. </template>
  65. </el-table-column>
  66. <el-table-column :key="table.label" v-for="table in tableHeader" :label="table.label" :prop="table.prop"
  67. align="center" :width="table.width" :fixed="table.fixed" />
  68. <el-table-column label="操作" align="center">
  69. <template slot-scope="scope">
  70. <el-col style="margin-bottom: 5px;">
  71. <el-button type="primary" size="mini" @click="deleteSample(scope.row.id)">删除</el-button>
  72. </el-col>
  73. </template>
  74. </el-table-column>
  75. </el-table>
  76. <el-pagination style="margin-top:20px;" @size-change="handleSizeChange" @current-change="handleCurrentChange"
  77. :current-page="queryInfo.currentPage" :page-sizes="[10, 20, 30, 40]" :page-size="queryInfo.pageSize"
  78. layout="total, sizes, prev, pager, next, jumper" :total="total">
  79. </el-pagination>
  80. <div class="footer">
  81. <el-button type="primary" style="margin-bottom:30px;" size="small" @click="next2()">下一步</el-button>
  82. </div>
  83. </div>
  84. <div id="sjinformation" style="margin:40px auto; width:40%" v-show="active == 3">
  85. <el-form :rules="rules2" :model="sample_unit">
  86. <el-form-item label="抽样单编号:" prop="cyd_code" class="labelItem">
  87. <el-input v-model="sample_unit.cyd_code" style="width:65%"></el-input>
  88. </el-form-item>
  89. <el-form-item label="抽样地点:" prop="sample_address" class="labelItem">
  90. <el-cascader placeholder="请选择地区" :options="options" v-model="selectedOptions1" @change="handleChange1" style="width:28%">
  91. </el-cascader>
  92. <el-input v-model="sample_unit.sample_address2" placeholder="请输入详细地址" style="width:36%;margin-left:5px;"></el-input>
  93. </el-form-item>
  94. <el-form-item label="抽样人员1:" prop="sample_person_one" class="labelItem">
  95. <el-input v-model="sample_unit.sample_person_one" style="width:65%"></el-input>
  96. </el-form-item>
  97. <el-form-item label="抽样人员2:" prop="sample_person_two" class="labelItem">
  98. <el-input v-model="sample_unit.sample_person_two" style="width:65%"></el-input>
  99. </el-form-item>
  100. <el-form-item label="抽样单日期:" prop="cyd_date" class="labelItem">
  101. <el-date-picker v-model="sample_unit.cyd_date" style="width:65%;" align="right" type="date" clearable />
  102. </el-form-item>
  103. <el-form-item label="备注:" prop="cyd_log" class="labelItem">
  104. <el-input v-model="sample_unit.cyd_log" style="width:65%"></el-input>
  105. </el-form-item>
  106. </el-form>
  107. <el-form>
  108. <el-form-item label="抽样单报告上传:" prop="sample_unit" class="labelItem">
  109. <el-upload
  110. class="upload-demo"
  111. :headers="myHeaders"
  112. action='http://syjcapi.aielab.net/api/v1/ossUpload'
  113. :on-preview="handlePreview"
  114. :on-remove="handleRemove"
  115. :before-remove="beforeRemove"
  116. :on-success="uploadSuccess"
  117. multiple
  118. :file-list="fileList">
  119. <el-button size="small" type="primary">点击上传</el-button>
  120. <div slot="tip" class="el-upload__tip">只能上传pdf文件,且不超过500kb</div>
  121. </el-upload>
  122. </el-form-item>
  123. </el-form>
  124. <div class="footer">
  125. <el-button type="primary" style="margin-bottom:30px;" size="small" @click="next3()">完成</el-button>
  126. </div>
  127. </div>
  128. <!-- <div class="footer">
  129. <el-button v-if="active > 1" type="success" style="margin:auto;" @click="pre">上一步</el-button>
  130. <el-button v-if="active < 3" type="success" style="margin-right:20px;" @click="next">下一步</el-button>
  131. </div> -->
  132. <!-- 新增样品信息弹框 -->
  133. <el-dialog title="新增样品信息" :visible.sync="addSampleInforDialog" width="40%" :close-on-click-modal="false" class="dialogItem" append-to-body>
  134. <el-form id="addSample" ref="form" :rules="rules1" :model="product_Unit">
  135. <el-form-item label="样品名称:" prop="sample_name" class="labelItem">
  136. <el-input v-model="product_Unit.sample_name" style="width:42%;"></el-input>
  137. </el-form-item>
  138. <!-- <el-form-item label="样品编号:" prop="releaser" class="labelItem" required>
  139. <el-input v-model="" style="width:42%"></el-input>
  140. </el-form-item> -->
  141. <!-- <el-form-item label="抽样地点:" prop="sample_name" class="labelItem">
  142. <el-input v-model="product_Unit.sample_name" style="width:42%"></el-input>
  143. </el-form-item> -->
  144. <el-form-item label="样品商标:" prop="sample_brand" class="labelItem">
  145. <el-input v-model="product_Unit.sample_brand" style="width:42%"></el-input>
  146. </el-form-item>
  147. <el-form-item label="规格型号:" prop="sample_type" class="labelItem">
  148. <el-input v-model="product_Unit.sample_type" style="width:42%"></el-input>
  149. </el-form-item>
  150. <el-form-item label="生产日期:" prop="sample_md_date" class="labelItem">
  151. <el-date-picker v-model="product_Unit.sample_md_date" style="width: 42%;" align="right" type="date"
  152. :picker-options="pickerOptions" clearable />
  153. </el-form-item>
  154. <el-form-item label="质量等级:" prop="sample_quality_grade" class="labelItem">
  155. <el-input v-model="product_Unit.sample_quality_grade" style="width:42%"></el-input>
  156. </el-form-item>
  157. <el-form-item label="标称生产者名称:" prop="sample_product_name" class="labelItem">
  158. <el-input v-model="product_Unit.sample_product_name" style="width:42%"></el-input>
  159. </el-form-item>
  160. <el-form-item label="标称生产者联系电话:" prop="sample_product_phone" class="labelItem">
  161. <el-input v-model="product_Unit.sample_product_phone" style="width:42%"></el-input>
  162. </el-form-item>
  163. <el-form-item label="样品来源:" prop="sample_source" class="labelItem">
  164. <el-input v-model="product_Unit.sample_source" style="width:42%"></el-input>
  165. </el-form-item>
  166. <el-form-item label="抽样数量:" prop="sample_count" class="labelItem">
  167. <el-input v-model="product_Unit.sample_count" style="width:42%"></el-input>
  168. </el-form-item>
  169. <el-form-item label="抽样基数:" prop="sample_base" class="labelItem">
  170. <el-input v-model="product_Unit.sample_base" style="width:42%"></el-input>
  171. </el-form-item>
  172. <el-form-item label="抽样时间:" prop="sample_ing_date" class="labelItem">
  173. <el-date-picker v-model="product_Unit.sample_ing_date" style="width: 42%;" align="right" type="date" clearable />
  174. </el-form-item>
  175. <el-form-item label="备注:" prop="sample_log" class="labelItem">
  176. <el-input v-model="product_Unit.sample_log" style="width:42%"></el-input>
  177. </el-form-item>
  178. </el-form>
  179. <div class="footer">
  180. <el-button type="primary" style="margin-bottom:30px;" size="small" @click="postSample('form')">确定</el-button>
  181. </div>
  182. </el-dialog>
  183. </div>
  184. <!-- 底部按钮 -->
  185. <!-- <el-form>
  186. <el-form-item class="btn">
  187. <el-button type="primary" @click="back()">返回任务详情</el-button>
  188. <el-button @click="resetForm()">重置</el-button>
  189. <el-button @click="onSubmit">保存,继续添加</el-button>
  190. </el-form-item>
  191. </el-form> -->
  192. <!-- <el-form ref="form1" :model="form" label-width="110px"
  193. style="margin-top: 20px;width: 48%;background-color: aliceblue;padding:10px 1px 1px 10px;">
  194. </el-form> -->
  195. <!-- </el-card> -->
  196. </template>
  197. <script>
  198. const token = window.sessionStorage.getItem('token')
  199. import {
  200. provinceAndCityData,
  201. regionData,
  202. provinceAndCityDataPlus,
  203. regionDataPlus,
  204. CodeToText,
  205. TextToCode
  206. } from 'element-china-area-data'
  207. export default {
  208. name: 'inputSample',
  209. data() {
  210. // 电话号码验证
  211. var checkNumber = (rule, value, callback) => {
  212. // const phoneReg = /^1[3|4|5|7|8][0-9]{9}$/
  213. // if (!value) {
  214. // return callback(new Error('电话号码不能为空'))
  215. // }
  216. setTimeout(() => {
  217. // Number.isInteger是es6验证数字是否为整数的方法,实际输入的数字总是识别成字符串
  218. // 所以在前面加了一个+实现隐式转换
  219. if (!Number.isInteger(+value)) {
  220. callback(new Error('请输入数字值'))
  221. }
  222. // else {
  223. // if (phoneReg.test(value)) {
  224. // callback()
  225. // } else {
  226. // callback(new Error('电话号码格式不正确'))
  227. // }
  228. // }
  229. }, 100)
  230. }
  231. // 邮箱验证
  232. var checkEmail = (rule, value, callback) => {
  233. const regEmail = /^\w+@\w+(\.\w+)+$/
  234. if (regEmail.test(value)) {
  235. // 合法邮箱
  236. return callback()
  237. }
  238. callback(new Error('请输入合法邮箱'))
  239. }
  240. return {
  241. active: 1,
  242. addSampleInforDialog: false,
  243. total: 0,
  244. cellStyle: {
  245. padding: 2 + 'px'
  246. },
  247. rowStyle: {
  248. height: 35 + 'px'
  249. },
  250. rules: {
  251.                 inspected_name: [{required: true, message: '请输入单位名称', trigger: 'blur'},],
  252. // inspected_address: [{required: true, message: '请输入单位地址', trigger: 'blur'},],
  253. contact_name: [{required: true, message: '请输入联系人', trigger: 'blur'},],
  254. contact_phone: [{required: true, message: '请输入联系电话', trigger: 'blur'},
  255. {validator: checkNumber, trigger: 'blur' }],
  256. contact_email:[{required: true, message: '请输入联系电话', trigger: 'blur'},
  257. {validator: checkEmail, trigger: 'blur' }]
  258. },
  259. rules1: {
  260.                 sample_name: [{required: true, message: '请输入样品名称', trigger: 'blur'},],
  261. sample_brand: [{required: true, message: '请输入样品商标', trigger: 'blur'},],
  262. sample_type: [{required: true, message: '请输入规格型号', trigger: 'blur'},],
  263. sample_md_date: [{required: true, message: '请输入生产日期', trigger: 'blur'},],
  264. sample_quality_grade: [{required: true, message: '请输入质量等级', trigger: 'blur'},],
  265. sample_product_name: [{required: true, message: '请输入标称生产者名称', trigger: 'blur'},],
  266. sample_product_phone: [{required: true, message: '请输入标称生产者联系电话', trigger: 'blur'},],
  267. sample_source: [{required: true, message: '请输入样品来源', trigger: 'blur'},],
  268. sample_count: [{required: true, message: '请输入抽样数量', trigger: 'blur'},
  269. {validator: checkNumber, trigger: 'blur' }],
  270. sample_base: [{required: true, message: '请输入抽样基数', trigger: 'blur'},
  271. {validator: checkNumber, trigger: 'blur' }],
  272. sample_ing_date: [{required: true, message: '请输入抽样时间', trigger: 'blur'},],
  273. },
  274. rules2: {
  275.                 cyd_code: [{required: true, message: '请输入抽样单编号', trigger: 'blur'},],
  276. sample_person_one: [{required: true, message: '请输入抽样人员姓名', trigger: 'blur'},],
  277. sample_person_two: [{required: true, message: '请输入抽样人员姓名', trigger: 'blur'},],
  278. cyd_date: [{required: true, message: '请输入抽样单日期', trigger: 'blur'},],
  279. },
  280. tableHeader: [{
  281. label: '样品名称',
  282. prop: 'sample_name'
  283. // fixed: 'left'
  284. },
  285. // {
  286. // label: '样品编号',
  287. // prop: 'year'
  288. // // fixed: 'left'
  289. // },
  290. {
  291. label: '样品来源',
  292. prop: 'sample_source',
  293. // fixed: 'left'
  294. },
  295. {
  296. label: '抽样数量',
  297. prop: 'sample_count'
  298. },
  299. {
  300. label: '抽样基数',
  301. prop: 'sample_base'
  302. },
  303. {
  304. label: '生产日期',
  305. prop: 'sample_md_date'
  306. },
  307. {
  308. label: '备注',
  309. prop: 'sample_log'
  310. }
  311. ],
  312. // 产地
  313. options: regionData,
  314. selectedOptions: [],
  315. //抽样地点
  316. selectedOptions1: [],
  317. // 数据表格数据
  318. tableData: [],
  319. // 批量删除选中数据
  320. multipleSelection: [],
  321. myHeaders: {
  322. Authorization: 'bearer' + token
  323. },
  324. queryInfo:{
  325. pageSize:10,
  326. pageNum:1,
  327. },
  328. fileList: [],
  329. form: {},
  330. // 抽样单id
  331. cyd_id: '',
  332. cyd_code: '',//抽验单编号
  333. cyd_data: {},//抽样单信息上部分
  334. inspected_Unit: {
  335. inspected_name: '',
  336. inspected_address: '',
  337. contact_name: '',
  338. contact_phone: '',
  339. contact_email: ''
  340. },//受检单位信息
  341. product_Unit: {
  342. sample_name: '',
  343. sample_brand: '',
  344. sample_type: '',
  345. sample_md_date: '',
  346. sample_quality_grade: '',
  347. sample_product_name: '',
  348. sample_product_phone: '',
  349. sample_source: '',
  350. sample_count: '',
  351. sample_base: '',
  352. sample_ing_date: '',
  353. sample_log: ''
  354. },//样品信息
  355. sample_unit: {
  356. cyd_code: '',
  357. sample_person_one: '',
  358. sample_person_two: '',
  359. cyd_date: '',
  360. cyd_log: '',
  361. file_url: '',
  362. file_name: ''
  363. },//填报抽样单最后一步
  364. units: [],
  365. production: [],
  366. // 样品下拉框
  367. sampleList: [],
  368. task_id: '',
  369. undertake_id: '',
  370. // 产地
  371. options: regionData[11].children,
  372. selectedOptions: [],
  373. // 日期选择器快捷选项
  374. pickerOptions: {
  375. disabledDate(time) {
  376. return time.getTime() > Date.now();
  377. },
  378. shortcuts: [{
  379. text: '今天',
  380. onClick(picker) {
  381. picker.$emit('pick', new Date());
  382. }
  383. }, {
  384. text: '昨天',
  385. onClick(picker) {
  386. const date = new Date();
  387. date.setTime(date.getTime() - 3600 * 1000 * 24);
  388. picker.$emit('pick', date);
  389. }
  390. }, {
  391. text: '一周前',
  392. onClick(picker) {
  393. const date = new Date();
  394. date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
  395. picker.$emit('pick', date);
  396. }
  397. }]
  398. },
  399. }
  400. },
  401. created() {
  402. this.task_id = this.$route.params.task_id
  403. this.task_profile_id = this.$route.params.under_id
  404. console.log(this.task_id)
  405. console.log(this.task_profile_id)
  406. this.getCydObj()
  407. console.log(regionData)
  408. console.log(regionData[11])
  409. },
  410. methods: {
  411. // // 步骤条下一步
  412. // next() {
  413. // if(this.active == 1){
  414. // this.getSamples()
  415. // }
  416. // if(this.active++ >2) this.active = 1
  417. // },
  418. // // 步骤条上一步
  419. // pre() {
  420. // if(this.active == 3){
  421. // this.getSamples()
  422. // }
  423. // if(this.active-- <2) this.active = 1
  424. // },
  425. //填报抽样单第一步页面中的下一步
  426. async next1(){
  427. this.$confirm('保存后不可修改, 是否继续?', '提示', {
  428. confirmButtonText: '确定',
  429. cancelButtonText: '取消',
  430. type: 'warning'
  431. }).then(() => {
  432. this.postInspectedUnit()
  433. this.$message({
  434. type: 'success',
  435. message: '受检单位信息保存成功!'
  436. });
  437. this.active = 2
  438. }).catch(() => {
  439. this.$message({
  440. type: 'info',
  441. message: '已取消保存'
  442. });
  443. });
  444. },
  445. async next2(){
  446. this.$confirm('保存后不可继续添加样品信息, 是否继续?', '提示', {
  447. confirmButtonText: '确定',
  448. cancelButtonText: '取消',
  449. type: 'warning'
  450. }).then(() => {
  451. this.$message({
  452. type: 'success',
  453. message: '样品信息保存成功!'
  454. });
  455. this.active = 3
  456. }).catch(() => {
  457. this.$message({
  458. type: 'info',
  459. message: '已取消保存'
  460. });
  461. });
  462. },
  463. async next3(){
  464. this.$confirm('是否确认完成抽样单填报?', '提示', {
  465. confirmButtonText: '确定',
  466. cancelButtonText: '取消',
  467. type: 'warning'
  468. }).then(() => {
  469. this.$message({
  470. type: 'success',
  471. message: '抽样单保存成功!'
  472. });
  473. this.postCydProfile()
  474. }).catch(() => {
  475. this.$message({
  476. type: 'info',
  477. message: '已取消保存'
  478. });
  479. });
  480. },
  481. // //新增样品信息弹框
  482. // async addData() {
  483. // this.addSampleInforDialog = true;
  484. // },
  485. //获取抽样单id
  486. async getCydObj() {
  487. const res = await this.$http.post('getCydObj',{
  488. task_id:this.task_id,
  489. task_profile_id:this.task_profile_id
  490. })
  491. console.log(res)
  492. this.cyd_id = res.data.data.cyd_id
  493. console.log(this.cyd_id)
  494. },
  495. //保存受检单位信息
  496. async postInspectedUnit() {
  497. var that = this
  498. that.inspected_Unit['cyd_id'] = that.cyd_id
  499. console.log()
  500. that.inspected_Unit.inspected_address = that.inspected_Unit.inspected_address1 + that.inspected_Unit.inspected_address2
  501. console.log(that.inspected_Unit.inspected_address)
  502. const res = await this.$http.post('postInspectedUnit',that.inspected_Unit)
  503. console.log(res)
  504. // 判断业务逻辑
  505. // if (result.data.code == 0) {
  506. // this.$message({
  507. // type: 'success',
  508. // message: '提交成功!'
  509. // });
  510. // this.$router.push('jcobj')
  511. // }
  512. },
  513. //保存样品信息
  514. async postSample(formName){
  515. var that = this
  516. that.product_Unit['cyd_id'] = that.cyd_id
  517. const res = await this.$http.post('postSample',that.product_Unit)
  518. console.log(res.data.message)
  519. console.log(res.data.code)
  520. if (res.data.code !== 0) {
  521. this.$message({
  522. type: 'error',
  523. message: res.data.message
  524. });
  525. } else {
  526. this.addSampleInforDialog = false
  527. this.$refs[formName].resetFields();
  528. console.log(that.product_Unit)
  529. this.getSamples()
  530. }
  531. },
  532. //保存最后一步上传报告备注
  533. async postCydProfile(){
  534. var that = this
  535. that.sample_unit['cyd_id'] = that.cyd_id
  536. that.sample_unit.sample_address = that.sample_unit.sample_address1 + that.sample_unit.sample_address2
  537. const res = await this.$http.post('postCydProfile',that.sample_unit)
  538. const result = await this.$http.post('postCyd',{
  539. cyd_id: that.cyd_id,
  540. cyd_code: that.sample_unit.cyd_code})
  541. console.log(result)
  542. console.log(res)
  543. this.$router.push({
  544. name: 'setTaskcd',
  545. params: {
  546. id: that.task_id,
  547. }
  548. });
  549. },
  550. //填报抽样单样品删除
  551. async deleteSample(id) {
  552. const res = await this.$http.post('deleteSample',{sample_id: id})
  553. this.getSamples()
  554. },
  555. //上传文件
  556. handleRemove(file, fileList) {
  557. console.log(file, fileList);
  558. },
  559. handlePreview(file) {
  560. console.log(file);
  561. },
  562. beforeRemove(file, fileList) {
  563. return this.$confirm(`确定移除 ${ file.name }?`);
  564. },
  565. // 上传成功
  566. uploadSuccess(res) {
  567. console.log(res.data)
  568. this.sample_unit.file_url = res.data.fileUrl
  569. this.sample_unit.file_name = res.data.fileName
  570. console.log(this.sample_unit.file_url)
  571. console.log(this.sample_unit.file_name)
  572. },
  573. //填报抽样单样品信息分页
  574. handleSizeChange(val) {
  575. this.queryInfo.pageSize = val;
  576. console.log(`每页 ${val} 条`);
  577. },
  578. //填报抽样单样品信息分页
  579. handleCurrentChange(val) {
  580. this.queryInfo.pageNum = val;
  581. console.log(`当前页: ${val}`);
  582. this.gettaskList()
  583. },
  584. //获取抽样单样品信息列表
  585. async getSamples(){
  586. var that = this
  587. that.queryInfo['cyd_id'] = that.cyd_id
  588. const res = await this.$http.post('getSamples',that.queryInfo)
  589. console.log(res.data.data.rows)
  590. that.tableData = res.data.data.rows
  591. that.total = res.data.data.total
  592. },
  593. // 获取样本列表
  594. // 生成样品编码
  595. // 获取受检单位地址
  596. handleChange() {
  597. var that = this
  598. var loc = "";
  599. console.log(this.selectedOptions)
  600. for (let i = 0; i < this.selectedOptions.length; i++) {
  601. loc += CodeToText[this.selectedOptions[i]];
  602. }
  603. console.log(loc)
  604. that.inspected_Unit.inspected_address1 = loc
  605. console.log(that.inspected_Unit.inspected_address1)
  606. },
  607. // 获取抽样地址
  608. handleChange1() {
  609. var that = this
  610. var loc = "";
  611. console.log(this.selectedOptions1)
  612. for (let i = 0; i < this.selectedOptions1.length; i++) {
  613. loc += CodeToText[this.selectedOptions1[i]];
  614. }
  615. console.log(loc)
  616. that.sample_unit.sample_address1 = loc
  617. console.log(that.sample_unit.sample_address1)
  618. },
  619. // 上传成功(要确认数据)
  620. // uploadSuccess(res) {
  621. // console.log(res.data)
  622. // this.cyd_data.file_url = res.data.fileUrl
  623. // this.cyd_data.file_name = res.data.fileName
  624. // },
  625. // async onSubmit() {
  626. // console.log(this.cyd_data.sample_name)
  627. // var that = this
  628. // console.log(that.cyd_data)
  629. // that.cyd_data.task_id = that.task_id
  630. // that.cyd_data.undertake_id = that.undertake_id
  631. // that.form.cyd_data = that.cyd_data
  632. // that.form.unit_test = that.unit_test
  633. // that.form.unit_production = that.unit_production
  634. // that.form.unit_sample = that.unit_sample
  635. // console.log(that.form)
  636. // const result = await this.$http.post('saveSample', this.form)
  637. // if (result.data.code == 0) {
  638. // // that.form.sample_id = result.data.data.id
  639. // this.$message({
  640. // type: 'success',
  641. // message: '提交抽样单成功!'
  642. // });
  643. // }
  644. // },
  645. // 重置表单
  646. // resetForm() {
  647. // console.log(this.form)
  648. // this.cyd_data = '';
  649. // this.unit_test = '';
  650. // this.unit_production = '';
  651. // this.unit_sample = '';
  652. // this.selectedOptions = '';
  653. // },
  654. // 返回
  655. // back() {
  656. // var that = this
  657. // console.log(that.task_id)
  658. // this.$router.push({
  659. // name: 'setTaskcd',
  660. // params: {
  661. // id: that.task_id
  662. // }
  663. // })
  664. // }
  665. },
  666. }
  667. </script>
  668. <style lang="less" scoped>
  669. .form {
  670. display: flex;
  671. flex-direction: row;
  672. justify-content: center;
  673. align-content: flex-start;
  674. }
  675. .el-descriptions {
  676. width: 80%;
  677. margin: auto;
  678. }
  679. /deep/ .el-descriptions__title {
  680. margin: auto;
  681. font-size: 1.25rem;
  682. // font-weight: 31.25rem !important;
  683. }
  684. .btn{
  685. margin-top:20px ;
  686. // float: right;
  687. text-align: center;
  688. }
  689. .dialogItem /deep/ .el-dialog__body {
  690. padding: 15px 12px 0;
  691. color: #606266;
  692. font-size: 14px;
  693. word-break: break-all;
  694. }
  695. /deep/ #sampleReport{
  696. .el-descriptions-item__label.is-bordered-label{
  697. width: 15rem;}
  698. }
  699. /deep/ #sjinformation{
  700. .el-form-item__label{
  701. width: 14%;
  702. }
  703. .el-form-item__error{
  704. left:9.0625rem;
  705. }
  706. .el-upload__tip{
  707. margin-left: 7.5rem;
  708. }
  709. .el-upload-list__item-name{
  710. margin-left: 7.8125rem
  711. }
  712. .labelItem{
  713. width: 130%;
  714. }
  715. }
  716. .footer {
  717. margin-left: 45%;
  718. margin-top: 20px;
  719. }
  720. /deep/ #addSample{
  721. width: 80%;
  722. margin: auto;
  723. .el-form-item__label{
  724. width: 17%;
  725. }
  726. .el-form-item__error{
  727. left:155px;
  728. }
  729. .labelItem{
  730. width: 160%;
  731. }
  732. }
  733. </style>