ItdmGongdanShujuList2.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523
  1. <template>
  2. <div>
  3. <a-card :bordered="false">
  4. <!-- 查询区域 -->
  5. <div class="table-page-search-wrapper">
  6. <a-form layout="inline" @keyup.enter.native="searchQuery">
  7. <a-row :gutter="24">
  8. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  9. <a-form-item label="委托单位">
  10. <a-select
  11. v-model="queryParam2.weituoClient"
  12. placeholder="请选择委托单位"
  13. show-search
  14. allowClear
  15. :options="weituoClientOptions"
  16. @change="getWeituoClientOptions">
  17. </a-select>
  18. </a-form-item>
  19. </a-col>
  20. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  21. <a-form-item label="委托编号">
  22. <a-select
  23. v-model="queryParam2.weituoId"
  24. placeholder="请选择委托编号"
  25. show-search
  26. allowClear
  27. :options="weituoNoOptions"
  28. @change="getWeituoNoOptions">
  29. </a-select>
  30. </a-form-item>
  31. </a-col>
  32. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  33. <a-form-item label="日期">
  34. <a-select
  35. v-model="queryParam2.riqi"
  36. placeholder="请选择日期"
  37. show-search
  38. allowClear
  39. :options="weituoRqOptions"
  40. @change="getWeituoRqOptions">
  41. </a-select>
  42. </a-form-item>
  43. </a-col>
  44. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  45. <a-form-item label="工单号">
  46. <a-select
  47. v-model="queryParam.woId"
  48. placeholder="请选择工单号"
  49. show-search
  50. allowClear
  51. :options="weituoGdOptions"
  52. @change="getWoId">
  53. </a-select>
  54. </a-form-item>
  55. </a-col>
  56. <template v-if="toggleSearchStatus">
  57. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  58. <a-form-item label="试验类型">
  59. <!-- <j-dict-select-tag placeholder="请选择试验类型" v-model="queryParam.shiyanType" dictCode="shiiyan_type"/> -->
  60. <a-select
  61. v-model="queryParam2.shiyanType"
  62. placeholder="请选择试验类型"
  63. show-search
  64. allowClear
  65. :options="shiyanTypeOption"
  66. @change="getSb">
  67. </a-select>
  68. </a-form-item>
  69. </a-col>
  70. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  71. <a-form-item label="试验设备">
  72. <a-select
  73. v-model="queryParam2.shebeiId"
  74. placeholder="请选择试验设备"
  75. show-search
  76. allowClear
  77. :options="shiyanSbOption"
  78. @change="getSj">
  79. </a-select>
  80. </a-form-item>
  81. </a-col>
  82. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  83. <a-form-item label="试验开始时间">
  84. <a-time-picker
  85. style="width: 100%"
  86. format="HH:mm"
  87. :valueFormat="'HH:mm'"
  88. v-model="queryParam2.shiyanKaishitime"
  89. placeholder="请选择试验开始时间"
  90. />
  91. </a-form-item>
  92. </a-col>
  93. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  94. <a-form-item label="试验结束时间">
  95. <a-time-picker
  96. style="width: 100%"
  97. format="HH:mm"
  98. :valueFormat="'HH:mm'"
  99. v-model="queryParam2.shiyanJieshutime"
  100. placeholder="请选择结束时间"
  101. />
  102. </a-form-item>
  103. </a-col>
  104. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  105. <a-form-item label="频次">
  106. <a-input placeholder="请输入频次(分钟)" v-model="queryParam2.pinci"></a-input>
  107. </a-form-item>
  108. </a-col>
  109. </template>
  110. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  111. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  112. <a-button type="primary" @click="getList" icon="search">查询</a-button>
  113. <a-button type="primary" @click="listReset" icon="reload" style="margin-left: 8px">重置</a-button>
  114. <a-button type="primary" @click="submitSJ" icon="check" style="margin-left: 8px">提交</a-button>
  115. <a-button type="primary" @click="submitFJ" icon="to-top" style="margin-left: 8px">附件</a-button>
  116. <a-button type="primary" @click="create" icon="vertical-align-bottom" style="margin-left: 8px">生成</a-button>
  117. <a @click="handleToggleSearch" style="margin-left: 8px">
  118. {{ toggleSearchStatus ? '收起' : '展开' }}
  119. <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
  120. </a>
  121. </span>
  122. </a-col>
  123. </a-row>
  124. </a-form>
  125. </div>
  126. <vxe-toolbar>
  127. <template #buttons>
  128. <vxe-button icon="vxe-icon-square-plus" @click="insertEvent()">新增</vxe-button>
  129. <vxe-button @click="$refs.xTable.removeCheckboxRow()">删除选中</vxe-button>
  130. </template>
  131. </vxe-toolbar>
  132. <vxe-table
  133. border
  134. show-overflow
  135. ref="xTable"
  136. height="500"
  137. :data="dataSource"
  138. :mouse-config="{selected: true}"
  139. :checkbox-config="{range: true}"
  140. :menu-config="tableMenu"
  141. :loading="loading"
  142. :keyboard-config="{isArrow: true, isDel: true, isEnter: true, isTab: true, isEdit: true, isChecked: true}"
  143. :edit-config="{trigger: 'dblclick', mode: 'cell'}">
  144. <vxe-column type="checkbox" width="60"></vxe-column>
  145. <!-- <vxe-column field="shiyanType_dictText" title="试验类型" :edit-render="{autofocus: '.vxe-input--inner'}">
  146. <template #edit="{ row }">
  147. <input v-model="row.shiyanType" type="text" class="myinput" />
  148. </template>
  149. </vxe-column> -->
  150. <vxe-column field="shiyanType_dictText" title="试验类型" :edit-render="{}">
  151. <template #default="{ row }">
  152. <span>{{ formatShiyanType(row.shiyanType) }}</span>
  153. </template>
  154. <template #edit="{ row }">
  155. <vxe-select v-model="row.shiyanType" placeholder="请选择试验类型" transfer>
  156. <vxe-option v-for="(item, index) in shiyanTypeOption" :key="index" :value="item.value" :label="item.label"></vxe-option>
  157. </vxe-select>
  158. </template>
  159. </vxe-column>
  160. <vxe-column field="shiyanTime" title="生成时间" :edit-render="{autofocus: '.vxe-input--inner'}">
  161. <template #edit="{ row }">
  162. <vxe-input v-model="row.shiyanTime" type="text" placeholder="输入生成时间"></vxe-input>
  163. <!-- <vxe-input v-model="row.shiyanTime" type="time" placeholder="选择生成时间" clearable label-format="HH:mm" valueFormat="HH:mm"></vxe-input> -->
  164. </template>
  165. </vxe-column>
  166. <vxe-column field="shiyanWendu" title="温度" :edit-render="{autofocus: '.vxe-input--inner'}">
  167. <template #edit="{ row }">
  168. <vxe-input v-model="row.shiyanWendu" type="text"></vxe-input>
  169. </template>
  170. </vxe-column>
  171. <vxe-column field="shiyanShidu" title="湿度" :edit-render="{autofocus: '.vxe-input--inner'}">
  172. <template #edit="{ row }">
  173. <vxe-input v-model="row.shiyanShidu" type="text"></vxe-input>
  174. </template>
  175. </vxe-column>
  176. </vxe-table>
  177. <a-modal
  178. :visible="visible"
  179. @ok="handleOk"
  180. @cancel="handleCancel"
  181. cancelText="关闭">
  182. <j-image-upload text="上传" v-model="fileList" isMultiple></j-image-upload>
  183. </a-modal>
  184. <!-- <a-modal
  185. :visible="visible"
  186. @ok="handleOk"
  187. @cancel="handleCancel"
  188. cancelText="关闭">
  189. <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
  190. <a-row>
  191. <a-col :span="24">
  192. <a-form-model-item label="工单号" prop="woId">
  193. <a-select
  194. v-model="uploadParam.woId"
  195. placeholder="请选择工单号"
  196. show-search
  197. allowClear
  198. :options="weituoGdOptions"
  199. @change="getWoId">
  200. </a-select>
  201. </a-form-model-item>
  202. </a-col>
  203. <a-col :span="24">
  204. <a-form-model-item label="上传附件" prop="remark">
  205. <j-image-upload text="上传" v-model="fileList" isMultiple></j-image-upload>
  206. </a-form-model-item>
  207. </a-col>
  208. </a-row>
  209. </a-form-model>
  210. </a-modal> -->
  211. </a-card>
  212. </div>
  213. </template>
  214. <script>
  215. import { httpAction, getAction } from '@/api/manage'
  216. import { mixinDevice } from '@/utils/mixin'
  217. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  218. // import {initDictOptions, filterDictText} from '@/components/dict/JDictSelectUtil'
  219. import { getWeituoClientList, getWeituoInfoListByClient, getWeituoRq, getWeituoGdh, getWeiYi, getWeiSb, getWeiSj, listSj, saveSj, upload, getUpload } from '@/api/api'
  220. import VXETable from 'vxe-table'
  221. import JImageUpload from '@/components/jeecg/JImageUpload'
  222. export default {
  223. mixins: [JeecgListMixin, mixinDevice],
  224. components: {JImageUpload},
  225. data() {
  226. return {
  227. // 查询
  228. queryParam2: {},
  229. queryParam: {},
  230. loading: false,
  231. // 委托单位列表
  232. weituoClientOptions : [],
  233. // 委托编号列表
  234. weituoNoOptions:[],
  235. // 工单日期列表
  236. weituoRqOptions:[],
  237. // 工单号下拉列表
  238. weituoGdOptions: [],
  239. // 试验类型下拉列表
  240. shiyanTypeOption: [],
  241. // 试验设备下拉列表
  242. shiyanSbOption: [],
  243. // 新增默认的试验类型
  244. shiyanType: '',
  245. // url: {
  246. // list: '/itdmgomgongdanshuju/ItdmGongdanshuju/list',
  247. // },
  248. dataSource: [],
  249. tableMenu: {
  250. body: {
  251. options: [
  252. [
  253. { code: 'copy', name: '复制', prefixIcon: 'vxe-icon-copy', disabled: false },
  254. { code: 'remove', name: '删除', disabled: false },
  255. { code: 'save', name: '保存', prefixIcon: 'vxe-icon-save', disabled: false }
  256. ]
  257. ]
  258. }
  259. },
  260. // 上传附件
  261. visible: false,
  262. fileList: [],
  263. }
  264. },
  265. created() {
  266. this.getClientList();
  267. // this.initDictConfig()
  268. },
  269. methods: {
  270. // 获取委托单位下拉列表
  271. getClientList(){
  272. getWeituoClientList().then((res) =>{
  273. console.log(res)
  274. this.weituoClientOptions = res.result.map( res => {
  275. return{
  276. value: res,
  277. label: res
  278. }
  279. })
  280. })
  281. },
  282. // 监听委托单位获取
  283. getWeituoClientOptions(value){
  284. console.log(value);
  285. this.weituoNoOptions = []
  286. this.queryParam2.weituoId = ''
  287. getWeituoInfoListByClient(this.queryParam2).then((res) =>{
  288. this.weituoNoOptions = res.result.map( res => {
  289. return{
  290. value: res.id, //传的值
  291. label: res.weituoNo, //展示
  292. }
  293. })
  294. })
  295. },
  296. // 监听选中的委托编号,以此获取日期的下拉列表
  297. getWeituoNoOptions(value){
  298. this.weituoRqOptions = []
  299. this.queryParam2.riqi = ''
  300. getWeituoRq(this.queryParam2).then((res) =>{
  301. console.log(res)
  302. this.weituoRqOptions = res.result.map( res => {
  303. return{
  304. value: res, //传的值
  305. label: res, //展示
  306. }
  307. })
  308. })
  309. },
  310. // 监听选中的日期,以此获取工单号的下拉列表
  311. getWeituoRqOptions(value){
  312. this.weituoGdOptions = []
  313. this.queryParam.woId = ''
  314. console.log(this.queryParam)
  315. // const query ={}
  316. // query.weituoClient = this.queryParam2.weituoClient
  317. // query.weituoId = this.queryParam2.weituoId
  318. // query.riqi = this.queryParam.riqi
  319. // console.log(query,this.queryParam,this.queryParam2)
  320. getWeituoGdh(this.queryParam2).then((res) =>{
  321. console.log(res)
  322. this.weituoGdOptions = res.result.map( res => {
  323. return{
  324. value: res, //传的值
  325. label: res, //展示
  326. }
  327. })
  328. })
  329. },
  330. // // 获取字典数据-试验类型
  331. // initDictConfig() {
  332. // initDictOptions('shiiyan_type').then((res) => {
  333. // if (res.success) {
  334. // this.shiiyanTypeOptions = res.result;
  335. // }
  336. // });
  337. // },
  338. // 试验类型显示
  339. formatShiyanType (value) {
  340. var typeLabel
  341. var typeObj = this.shiyanTypeOption.find(res => res.value === value)
  342. if(typeObj){
  343. typeLabel = typeObj.label
  344. }
  345. return typeLabel
  346. },
  347. // 监听选中的工单,获取试验类型
  348. getWoId(value){
  349. // this.queryParam = {...this.queryParam}
  350. this.shiyanTypeOption = []
  351. this.queryParam2.shiyanType = ''
  352. const query ={}
  353. query.riqi = this.queryParam2.riqi
  354. query.woId = this.queryParam.woId
  355. console.log(query,this.queryParam,this.queryParam2)
  356. getWeiYi(query).then((res) => {
  357. console.log(res)
  358. this.shiyanTypeOption = res.result.map( res => {
  359. return{
  360. value: res.type, //传的值
  361. label: res.name, //展示
  362. }
  363. })
  364. })
  365. this.toggleSearchStatus = true;
  366. },
  367. getSb(){
  368. // this.queryParam2 = {...this.queryParam2}
  369. this.shiyanSbOption = []
  370. this.queryParam2.shebeiId = ''
  371. const query ={}
  372. query.riqi = this.queryParam2.riqi
  373. query.woId = this.queryParam.woId
  374. query.shiyanType = this.queryParam2.shiyanType
  375. console.log(query)
  376. getWeiSb(query).then((res) => {
  377. console.log(22222,res)
  378. this.shiyanSbOption = res.result.map( res => {
  379. return{
  380. value: res.type, //传的值
  381. label: res.name, //展示
  382. }
  383. })
  384. })
  385. },
  386. // 获取实绩开始时间结束时间
  387. getSj(){
  388. this.queryParam2 = {...this.queryParam2}
  389. // this.queryParam2.shiyanKaishitime = ''
  390. // this.queryParam2.shiyanJieshutime = ''
  391. const query ={}
  392. query.riqi = this.queryParam2.riqi
  393. query.woId = this.queryParam.woId
  394. query.shiyanType = this.queryParam2.shiyanType
  395. query.shebeiId = this.queryParam2.shebeiId
  396. console.log(query)
  397. getWeiSj(query).then((res) => {
  398. console.log(22222222,res)
  399. this.queryParam2.shiyanKaishitime = res.result.shiyanKaishitime
  400. this.queryParam2.shiyanJieshutime = res.result.shiyanJieshutime
  401. this.queryParam2 = {...this.queryParam2}
  402. })
  403. },
  404. // 获取已生成的数据列表
  405. getList(){
  406. this.loading = true
  407. console.log(2222,this.queryParam)
  408. listSj(this.queryParam).then((res) => {
  409. console.log(res)
  410. this.dataSource = res.result
  411. this.shiyanType = res.result[0].shiyanType
  412. this.loading = false
  413. })
  414. },
  415. listReset(){
  416. this.queryParam = {}
  417. this.queryParam2 = {}
  418. this.dataSource = []
  419. },
  420. // vex-table
  421. async insertEvent () {
  422. const $table = this.$refs.xTable
  423. const record = {
  424. // shiyanType: this.shiyanType,
  425. shiyanType: '',
  426. shiyanTime: '',
  427. shiyanWendu: '',
  428. shiyanShidu: ''
  429. }
  430. const { row: newRow } = await $table.insertAt(record)
  431. console.log(this.$refs.xTable)
  432. await $table.setActiveCell(newRow, 'shiyanType')
  433. },
  434. getInsertEvent () {
  435. const $table = this.$refs.xTable
  436. const insertRecords = $table.getInsertRecords()
  437. VXETable.modal.alert(insertRecords.length)
  438. },
  439. getSelectionEvent () {
  440. const $table = this.$refs.xTable
  441. const selectRecords = $table.getCheckboxRecords()
  442. VXETable.modal.alert(selectRecords.length)
  443. },
  444. // 提交
  445. submitSJ(){
  446. const querySubmit = {}
  447. querySubmit.woId = this.queryParam.woId
  448. querySubmit.shiyanDateTime = this.queryParam2.riqi
  449. querySubmit.list = this.$refs.xTable.afterFullData
  450. console.log(querySubmit)
  451. saveSj(querySubmit).then((res) => {
  452. if (res.success) {
  453. this.$message.success("提交成功")
  454. this.getList()
  455. }
  456. })
  457. // this.dataSource = this.$refs.xTable.afterFullData
  458. // console.log(this.dataSource)
  459. // saveSj(this.dataSource).then((res) => {
  460. // })
  461. },
  462. // 上传附件打开
  463. submitFJ(){
  464. getUpload({woId: this.queryParam.woId}).then(res => {
  465. console.log(res.result)
  466. this.fileList = res.result.split(',')
  467. console.log(this.fileList)
  468. this.visible = true;
  469. })
  470. },
  471. // 上传附件确定
  472. handleOk () {
  473. var query = {
  474. woId: this.queryParam.woId,
  475. images: this.fileList.toString()
  476. }
  477. upload(query).then(res => {
  478. this.fileList = []
  479. this.visible = false
  480. })
  481. },
  482. // 上传附件取消
  483. handleCancel(){
  484. this.visible = false
  485. this.fileList = []
  486. },
  487. create() {
  488. var select = this.queryParam
  489. select.riqi = this.queryParam2.riqi
  490. select.shiyanType = this.queryParam2.shiyanType
  491. select.shebeiId = this.queryParam2.shebeiId
  492. select.shiyanKaishitime = this.queryParam2.shiyanKaishitime
  493. select.shiyanJieshutime = this.queryParam2.shiyanJieshutime
  494. select.pinci = this.queryParam2.pinci
  495. httpAction('/itdmgomgongdanshuju/ItdmGongdanshuju/create',select, 'post').then((res) => {
  496. if (res.success) {
  497. console.log(res)
  498. this.$message.success(res.message)
  499. this.modalFormOk()
  500. } else {
  501. this.$message.warning(res.message)
  502. }
  503. this.searchReset()
  504. })
  505. },
  506. }
  507. }
  508. </script>
  509. <style scoped>
  510. @import '~@assets/less/common.less';
  511. </style>