crafts-management.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <!-- 工艺管理 -->
  2. <template>
  3. <div class="order">
  4. <el-form :inline="true" :model="dataForm" @keyup.enter.native="queryData()">
  5. <el-form-item label="工艺名称">
  6. <el-input v-model="dataForm.techName" clearable/>
  7. </el-form-item>
  8. <el-form-item label="产品名称">
  9. <el-input v-model="dataForm.productName" clearable/>
  10. </el-form-item>
  11. <el-form-item label="状态">
  12. <el-select
  13. v-model="dataForm.state"
  14. placeholder="请选择">
  15. <el-option
  16. v-for="item in optionsState"
  17. :key="item.code"
  18. :label="item.value"
  19. :value="item.code">
  20. </el-option>
  21. </el-select>
  22. </el-form-item>
  23. <el-form-item label="创建日期">
  24. <el-date-picker
  25. v-model="dataForm.createTime"
  26. value-format="yyyy-MM-dd"
  27. type="date">
  28. </el-date-picker>
  29. </el-form-item>
  30. <el-form-item>
  31. <el-button @click="queryData()">查询</el-button>
  32. <el-button v-if="isAuth('pro:technology:save')" type="primary" @click="addOrUpdateHandle(0, false)">新建工艺</el-button>
  33. </el-form-item>
  34. </el-form>
  35. <el-table
  36. :data="dataList"
  37. border
  38. v-loading="dataListLoading"
  39. @selection-change="selectionChangeHandle"
  40. style="width: 100%;">
  41. <el-table-column
  42. label="序号"
  43. type="index"
  44. width="50"
  45. align="center">
  46. </el-table-column>
  47. <el-table-column
  48. prop="techCode"
  49. header-align="center"
  50. align="center"
  51. min-width="180"
  52. label="工艺编码">
  53. </el-table-column>
  54. <el-table-column
  55. prop="techName"
  56. header-align="center"
  57. align="center"
  58. min-width="180"
  59. :show-overflow-tooltip="true"
  60. label="工艺名称">
  61. </el-table-column>
  62. <el-table-column
  63. prop="techVersion"
  64. header-align="center"
  65. align="center"
  66. min-width="120"
  67. label="工艺版本">
  68. </el-table-column>
  69. <el-table-column
  70. prop="productName"
  71. header-align="center"
  72. align="center"
  73. min-width="120"
  74. label="产品名称">
  75. </el-table-column>
  76. <el-table-column
  77. prop="createTime"
  78. header-align="center"
  79. align="center"
  80. min-width="160"
  81. label="创建时间">
  82. </el-table-column>
  83. <el-table-column
  84. prop="updateTime"
  85. header-align="center"
  86. align="center"
  87. min-width="160"
  88. label="上次修改时间">
  89. </el-table-column>
  90. <el-table-column
  91. prop="creatorName"
  92. header-align="center"
  93. align="center"
  94. min-width="160"
  95. label="创建人">
  96. </el-table-column>
  97. <el-table-column
  98. prop="notes"
  99. header-align="center"
  100. align="center"
  101. min-width="160"
  102. label="备注">
  103. </el-table-column>
  104. <el-table-column
  105. prop="state"
  106. header-align="center"
  107. align="center"
  108. min-width="100"
  109. label="当前状态">
  110. <template slot-scope="scope">
  111. <span>{{ scope.row.techState === -1 ? '停用' : '启用' }}</span>
  112. </template>
  113. </el-table-column>
  114. <el-table-column
  115. header-align="center"
  116. fixed="right"
  117. align="center"
  118. width="100"
  119. label="操作">
  120. <template slot-scope="scope">
  121. <el-button v-if="isAuth('pro:technology:update') && scope.row.techState === -1" type="text" size="small" @click="addOrUpdateHandle1(scope.row.techId, 0)">启用</el-button>
  122. <el-button v-if="isAuth('pro:technology:update') && scope.row.techState === 0" type="text" size="small" @click="addOrUpdateHandle1(scope.row.techId, -1)">停用</el-button>
  123. <el-button v-if="isAuth('pro:technology:info')" type="text" size="small" @click="detailHandle(scope.row.techId)">查看</el-button>
  124. </template>
  125. </el-table-column>
  126. </el-table>
  127. <el-pagination
  128. @size-change="sizeChangeHandle"
  129. @current-change="currentChangeHandle"
  130. :current-page="pageIndex"
  131. :page-sizes="[10, 20, 50, 100]"
  132. :page-size="pageSize"
  133. :total="totalPage"
  134. layout="total, sizes, prev, pager, next, jumper">
  135. </el-pagination>
  136. <!-- 弹窗, 新增 / 修改 -->
  137. <ctafts-add-or-detail v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getTechnology" />
  138. <detail v-if="detailVisible" ref="detail"/>
  139. </div>
  140. </template>
  141. <script>
  142. import { getTechnology, update } from '@/api/crafts'
  143. import ctaftsAddOrDetail from './ctafts-add-or-detail'
  144. import Detail from './crafts-detail'
  145. export default {
  146. name: 'order',
  147. components: {
  148. ctaftsAddOrDetail, Detail
  149. },
  150. created () {
  151. this.queryData()
  152. },
  153. data () {
  154. return {
  155. addOrUpdateVisible: false,
  156. addOrUpdateVisible1: false,
  157. detailVisible: false,
  158. dataForm: {},
  159. dataList: [],
  160. pageIndex: 1,
  161. pageSize: 10,
  162. totalPage: 0,
  163. dataListLoading: false,
  164. dataListSelections: [],
  165. optionsState: [
  166. {
  167. code: null, value: '全部'
  168. },
  169. {
  170. code: '0', value: '正常'
  171. },
  172. {
  173. code: '-1', value: '停用'
  174. }
  175. ],
  176. optionsCustomer: []
  177. }
  178. },
  179. methods: {
  180. // 查询
  181. queryData () {
  182. this.pageIndex = 1
  183. this.getTechnology()
  184. },
  185. // 获取数据列表
  186. getTechnology () {
  187. this.dataListLoading = true
  188. let params = {
  189. 'current': this.pageIndex,
  190. 'size': this.pageSize,
  191. 'createTimeS': this.dataForm.createTime ? this.dataForm.createTime : null,
  192. 'techState': this.dataForm.state ? this.dataForm.state : null,
  193. 'techName': this.dataForm.techName ? this.dataForm.techName : null,
  194. 'productName': this.dataForm.productName ? this.dataForm.productName : null
  195. }
  196. getTechnology(params).then(({data}) => {
  197. if (data && data.code === '200') {
  198. this.dataList = data.data.records
  199. this.totalPage = Number(data.data.total)
  200. } else {
  201. this.dataList = []
  202. this.totalPage = 0
  203. }
  204. this.dataListLoading = false
  205. })
  206. },
  207. // 每页数
  208. sizeChangeHandle (val) {
  209. this.pageSize = val
  210. this.pageIndex = 1
  211. this.getTechnology()
  212. },
  213. // 当前页
  214. currentChangeHandle (val) {
  215. this.pageIndex = val
  216. this.getTechnology()
  217. },
  218. // 多选
  219. selectionChangeHandle (val) {
  220. this.dataListSelections = val
  221. },
  222. // 新增 / 修改
  223. addOrUpdateHandle (id, display) {
  224. this.addOrUpdateVisible = true
  225. this.$nextTick(() => {
  226. this.$refs.addOrUpdate.init(id, display)
  227. })
  228. },
  229. addOrUpdateHandle1 (id, type) {
  230. update({ techId: id, techState: type }).then(({data}) => {
  231. if (data && data.code === '200') {
  232. this.getTechnology()
  233. }
  234. })
  235. },
  236. // 详情
  237. detailHandle (id) {
  238. this.detailVisible = true
  239. this.$nextTick(() => {
  240. this.$refs.detail.init(id)
  241. })
  242. }
  243. }
  244. }
  245. </script>
  246. <style scoped>
  247. </style>