index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. <template>
  2. <d2-container>
  3. <template slot="header"
  4. style="padding: 5px;">
  5. <el-form size="mini"
  6. ref="form"
  7. :inline="true"
  8. class="sbutton_padding"
  9. style=" margin-top: -7px;text-align:right;">
  10. <el-form-item label="设备名称"
  11. class="sbutton_margin">
  12. <el-input style="width: 140px;"
  13. v-model="search.InstrumenName"
  14. placeholder="请输入设备名称"></el-input>
  15. </el-form-item>
  16. <!-- <el-form-item label="操作人">
  17. <el-input v-model="search.OperaUser"
  18. style="width: 165px;"
  19. placeholder="输入操作人"></el-input>
  20. </el-form-item> -->
  21. <el-col :span="6"></el-col>
  22. <el-form-item label="操作日期"
  23. class="sbutton_margin">
  24. <el-date-picker style="width:220px"
  25. v-model="OperaOn"
  26. type="daterange"
  27. range-separator="至"
  28. start-placeholder="开始日期"
  29. end-placeholder="结束日期"></el-date-picker>
  30. </el-form-item>
  31. <el-button size="mini"
  32. type="primary"
  33. style="margin-left:10px;"
  34. @click="searchdata()"
  35. class="sbutton_margin">查 询</el-button>
  36. <el-button size="mini"
  37. type="primary"
  38. @click="clearSearch"
  39. class="sbutton_margin">重 置</el-button>
  40. <el-button size="mini"
  41. type="primary"
  42. style="margin-right:6px;"
  43. @click="maintainlogadd()"
  44. class="sbutton_margin">添加</el-button>
  45. </el-form>
  46. </template>
  47. <el-table ref="multipleTable"
  48. :data="activities"
  49. border
  50. stripe
  51. tooltip-effect="dark"
  52. @sort-change="orderby"
  53. height="100%">
  54. <el-table-column label="操作"
  55. align="center"
  56. width="100px"
  57. fixed='right'>
  58. <template slot-scope="scope">
  59. <el-button size="mini"
  60. type="primary"
  61. title="编辑"
  62. @click="editmaintain(scope.row.Id)"
  63. icon="el-icon-edit"
  64. circle></el-button>
  65. <el-button size="mini"
  66. @click="deleteinstrument(scope.row)"
  67. type="danger"
  68. title="删除"
  69. style="margin-left:5px"
  70. icon="el-icon-delete"
  71. circle></el-button>
  72. </template>
  73. </el-table-column>
  74. <el-table-column prop="InstrumenCode"
  75. align="center"
  76. min-width="160px"
  77. label="设备编号"
  78. show-overflow-tooltip></el-table-column>
  79. <el-table-column prop="InstrumenName"
  80. align="center"
  81. min-width="120px"
  82. label="设备名称"
  83. show-overflow-tooltip></el-table-column>
  84. <el-table-column prop="OperaTpye"
  85. align="center"
  86. min-width="120px"
  87. label="操作类型"
  88. show-overflow-tooltip></el-table-column>
  89. <el-table-column prop="OperaOn"
  90. sortable
  91. label="操作日期"
  92. min-width="120px"
  93. align="center"
  94. show-overflow-tooltip
  95. width="180">
  96. <template slot-scope="scope">{{ jstimehandle(scope.row.OperaOn +'') }}</template>
  97. </el-table-column>
  98. <el-table-column prop="OperaUser"
  99. align="center"
  100. min-width="120px"
  101. label="操作人"
  102. show-overflow-tooltip></el-table-column>
  103. <el-table-column prop="OperaRemark"
  104. align="center"
  105. min-width="160px"
  106. label="维护说明"
  107. show-overflow-tooltip
  108. width="300"></el-table-column>
  109. </el-table>
  110. <!-- </el-card> -->
  111. <addmaintainlog ref="addmaintain"
  112. @closeAddDialog="handleCloseAdd"></addmaintainlog>
  113. <editmiantainlog ref="editmaintainlog"
  114. @closeAddDialog="handleCloseEdit"
  115. :maintainlogId="selectedMaintainLogId"></editmiantainlog>
  116. <!-- </div> -->
  117. <template slot="footer">
  118. <el-pagination style="margin: -10px;"
  119. @size-change="handleSizeChange"
  120. @current-change="handleCurrentChange"
  121. :current-page="currpage"
  122. :page-sizes="[10, 15, 20]"
  123. :page-size="size"
  124. layout="total, sizes, prev, pager, next, jumper"
  125. :total="totalsize">
  126. </el-pagination>
  127. </template>
  128. </d2-container>
  129. </template>
  130. <script>
  131. import {
  132. searchdatazl,
  133. OperaTpyelist,
  134. deleteinstrumentzl
  135. } from '@/api/instrumentroom'
  136. import addmaintainlog from './_opera/add'
  137. import editmiantainlog from './_opera/edit'
  138. export default {
  139. components: {
  140. addmaintainlog,
  141. editmiantainlog
  142. },
  143. name: 'instrument',
  144. data () {
  145. return {
  146. selectedMaintainLogId: 0,
  147. dialogvisible: false,
  148. name: '',
  149. totalsize: 0,
  150. currpage: 1,
  151. size: 10,
  152. OperaOn: [], // 录入时期
  153. activities: [],
  154. search: {
  155. InstrumenName: '',
  156. InstrumenCode: '',
  157. OperaTpye: '',
  158. OperaUser: ''
  159. },
  160. classificationlist: [],
  161. InstrumenName: '',
  162. InstrumenCode: '',
  163. addparam: '',
  164. paramid: '',
  165. OperaUser: '',
  166. // 列表排序
  167. Column: {
  168. Order: '',
  169. Prop: ''
  170. }
  171. }
  172. },
  173. mounted () {
  174. // if (this.$route.query.id) {
  175. // this.addparam = '?pid=' + this.$route.query.id
  176. // this.paramid = this.$route.query.id
  177. // this.search.InstrumenCode = ''
  178. // this.search.InstrumenName = ''
  179. // }
  180. this.searchdata()
  181. // this.getOperaTpyelist()
  182. },
  183. methods: {
  184. // 获取所有的维护保养记录
  185. getDataList () {
  186. },
  187. maintainlogadd () {
  188. this.$refs.addmaintain.dialogvisible = true
  189. },
  190. editmaintain (maintainlogId) {
  191. this.$refs.editmaintainlog.getDonorsInfoAttachment(maintainlogId)
  192. this.$refs.editmaintainlog.dialogvisible = true
  193. this.$refs.editmaintainlog.initData(maintainlogId)
  194. this.selectedMaintainLogId = maintainlogId
  195. },
  196. // 添加 返回当前页面
  197. handleCloseAdd () {
  198. this.$refs.addmaintain.dialogvisible = false
  199. this.searchdata()
  200. },
  201. // 编辑 返回当前页面
  202. handleCloseEdit () {
  203. this.$refs.editmaintainlog.dialogvisible = false
  204. this.searchdata()
  205. },
  206. // 初始化列表数据
  207. searchdata () {
  208. let _this = this
  209. let OperaOn = []
  210. // let paramid
  211. if (!_this.OperaOn) {
  212. _this.OperaOn = []
  213. }
  214. // 解析时间
  215. if (_this.OperaOn.length === 2) {
  216. _this.OperaOn[1].setHours(23)
  217. _this.OperaOn[1].setMinutes(59)
  218. _this.OperaOn[1].setSeconds(59)
  219. OperaOn.push(_this.formatDateTime(_this.OperaOn[0]))
  220. OperaOn.push(_this.formatDateTime(_this.OperaOn[1]))
  221. }
  222. let params = {
  223. _currentPage: this.currpage,
  224. _size: this.size,
  225. InstrumenCode: this.search.InstrumenCode,
  226. InstrumenName: this.search.InstrumenName,
  227. OperaTpye: this.search.OperaTpye,
  228. OperaUser: this.search.OperaUser,
  229. paramid: this.paramid,
  230. Order: this.Column.Order,
  231. Prop: this.Column.Prop,
  232. TypeCode: 2
  233. }
  234. searchdatazl(params)
  235. .then(function (response) {
  236. _this.activities = response.info.items
  237. _this.totalsize = response.info.currentItemCount
  238. })
  239. .catch(function (error) {
  240. console.log(error)
  241. })
  242. },
  243. // 清除查询条件
  244. handleSizeChange (val) {
  245. this.size = val
  246. this.currpage = 1
  247. this.searchdata()
  248. },
  249. handleCurrentChange (val) {
  250. this.currpage = val
  251. this.searchdata()
  252. },
  253. jstimehandle (val) {
  254. if (val === '') {
  255. return '----'
  256. } else if (val === '0001-01-01T08:00:00+08:00') {
  257. return '----'
  258. } else if (val === '5000-01-01T23:59:59+08:00') {
  259. return '永久'
  260. } else {
  261. if (val === '0001-01-01T00:00:00Z') {
  262. return '----'
  263. } else val = val.replace('T', ' ')
  264. return val.substring(0, 19)
  265. }
  266. },
  267. // 删除设备信息
  268. deleteinstrument (val) {
  269. let _this = this
  270. _this
  271. .$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
  272. confirmButtonText: '确定',
  273. cancelButtonText: '关闭',
  274. type: 'warning'
  275. })
  276. .then(() => {
  277. deleteinstrumentzl(val.Id)
  278. .then(function (response) {
  279. // response
  280. if (response.info.code === 0) {
  281. _this.$message({
  282. type: 'success',
  283. message: response.info.message
  284. })
  285. // 更新界面
  286. _this.searchdata()
  287. } else {
  288. _this.$message({
  289. type: 'warning',
  290. message: response.info.message
  291. })
  292. }
  293. })
  294. .catch(function (error) {
  295. console.log(error)
  296. })
  297. })
  298. .catch(() => { })
  299. },
  300. // getOperaTpyelist () {
  301. // // 获取样本单位
  302. // let _this = this
  303. // let params = {
  304. // code: 'OperaTpye'
  305. // }
  306. // OperaTpyelist(params)
  307. // .then(res => {
  308. // _this.classificationlist = res.info
  309. // })
  310. // },
  311. // 列表排序功能
  312. orderby (column) {
  313. if (column.order === 'ascending') {
  314. this.Column.Order = 'asc'
  315. } else if (column.order === 'descending') {
  316. this.Column.Order = 'desc'
  317. }
  318. this.Column.Prop = column.prop
  319. this.searchdata()
  320. },
  321. formatDateTime (date) {
  322. var y = date.getFullYear()
  323. var m = date.getMonth() + 1
  324. m = m < 10 ? '0' + m : m
  325. var d = date.getDate()
  326. d = d < 10 ? '0' + d : d
  327. // var h = date.getHours();
  328. // var minute = date.getMinutes();
  329. // minute = minute < 10 ? ('0' + minute) : minute;
  330. return y + '-' + m + '-' + d // + ' ' + h + ':' + minute;
  331. },
  332. clearSearch () {
  333. this.search.InstrumenCode = ''
  334. this.search.InstrumenName = ''
  335. this.search.OperaTpye = ''
  336. this.search.OperaUser = ''
  337. this.OperaOn = []
  338. this.searchdata()
  339. }
  340. }
  341. }
  342. </script>
  343. <style lang="scss">
  344. .el-pagination {
  345. margin: 1rem 0 2rem;
  346. text-align: right;
  347. }
  348. .plab {
  349. font-size: 13px;
  350. color: #999;
  351. }
  352. </style>