program.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <!-- 数控程序管理 -->
  2. <template>
  3. <div>
  4. <template v-if="!addOrUpdateVisible && !detailVisible && !assignVisible && !noteChangeVisible">
  5. <el-form :inline="true" :model="dataForm" label-width="80px" @keyup.enter.native="queryData()">
  6. <el-form-item label="项目名称">
  7. <el-input v-model="dataForm.projectName" placeholder="请输入项目名称" clearable />
  8. </el-form-item>
  9. <el-form-item label="任务号">
  10. <el-input v-model="dataForm.orderCode" placeholder="请输入任务号" clearable />
  11. </el-form-item>
  12. <el-form-item label="责任人">
  13. <user-component v-model="dataForm.responsibilityPerson" />
  14. </el-form-item>
  15. <el-form-item label="状态">
  16. <el-select v-model="dataForm.state" placeholder="请选择状态" clearable>
  17. <el-option v-for="item in optionsState" :key="item.value" :label="item.label" :value="item.value" />
  18. </el-select>
  19. </el-form-item>
  20. <el-form-item label="物料名称">
  21. <el-input v-model="dataForm.productName" placeholder="请输入物料名称" clearable />
  22. </el-form-item>
  23. <el-form-item>
  24. <el-button @click="queryData()">查询</el-button>
  25. <el-button v-if="isAuth('pro:program:save')" type="primary" @click="addOrUpdateHandle(0)">新建</el-button>
  26. <el-button v-if="isAuth('pro:program:noteChangeConfig')" type="primary"
  27. @click="noteChange()">变更通知人设置</el-button>
  28. </el-form-item>
  29. </el-form>
  30. <el-table :data="dataList" border v-loading="dataListLoading" style="width: 100%">
  31. <el-table-column label="序号" type="index" width="50" align="center"></el-table-column>
  32. <el-table-column prop="programCode" header-align="center" align="center" min-width="140"
  33. :show-tooltip-when-overflow="true" label="编码">
  34. </el-table-column>
  35. <el-table-column prop="projectName" header-align="center" align="center" min-width="140"
  36. :show-tooltip-when-overflow="true" label="项目名称">
  37. </el-table-column>
  38. <el-table-column prop="orderCode" header-align="center" align="center" min-width="140"
  39. :show-tooltip-when-overflow="true" label="任务号">
  40. </el-table-column>
  41. <el-table-column prop="mapNumber" header-align="center" align="center" min-width="140"
  42. :show-tooltip-when-overflow="true" label="图号">
  43. </el-table-column>
  44. <el-table-column prop="productName" header-align="center" align="center" min-width="140"
  45. :show-tooltip-when-overflow="true" label="物料名称">
  46. </el-table-column>
  47. <el-table-column prop="planCnt" header-align="center" align="center" min-width="80"
  48. :show-tooltip-when-overflow="true" label="数量">
  49. </el-table-column>
  50. <el-table-column prop="state" header-align="center" align="center" min-width="80" fixed="right" label="状态">
  51. <template slot-scope="scope">
  52. <span>{{
  53. optionsState.find(t => t.value === scope.row.state.toString())
  54. .label
  55. }}</span>
  56. </template>
  57. </el-table-column>
  58. <el-table-column prop="attachList1" header-align="center" align="center" min-width="100" label="技术协议">
  59. <template slot-scope="scope">
  60. <el-button :disabled="!scope.row.attachList1 || scope.row.attachList1.length === 0
  61. " type="text" size="small" @click="attachDetails(scope.row.attachList1)">查看</el-button>
  62. </template>
  63. </el-table-column>
  64. <el-table-column prop="attachList2" header-align="center" align="center" min-width="100" label="技术文件">
  65. <template slot-scope="scope">
  66. <el-button :disabled="!scope.row.attachList2 || scope.row.attachList2.length === 0
  67. " type="text" size="small" @click="attachDetails(scope.row.attachList2)">查看</el-button>
  68. </template>
  69. </el-table-column>
  70. <el-table-column prop="deliveryDate" header-align="center" align="center" min-width="160"
  71. :show-tooltip-when-overflow="true" label="合同交期">
  72. </el-table-column>
  73. <el-table-column prop="responsibilityPerson" header-align="center" align="center" min-width="100"
  74. :show-tooltip-when-overflow="true" label="责任人">
  75. </el-table-column>
  76. <el-table-column fixed="right" header-align="center" align="center" width="135" label="操作">
  77. <template slot-scope="scope">
  78. <el-button type="text" size="small" @click="showDetail(scope.row.programId)">查看</el-button>
  79. <el-button v-if="isAuth('pro:program:assign') && Number(scope.row.state) === 1" type="text" size="small"
  80. @click="showAssign(scope.row)">分派</el-button>
  81. <el-button v-if="isAuth('pro:program:updateProcessing') && Number(scope.row.state) === 1" type="text"
  82. size="small" @click="addOrUpdateHandle(scope.row.programId, 1)">处理</el-button>
  83. <el-button v-if="isAuth('pro:program:update') && Number(scope.row.state) === 2" type="text" size="small"
  84. @click="addOrUpdateHandle(scope.row.programId, 2)">编辑</el-button>
  85. </template>
  86. </el-table-column>
  87. </el-table>
  88. <el-pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" :current-page="pageIndex"
  89. :page-sizes="[10, 20, 50, 100]" :page-size="pageSize" :total="totalPage"
  90. layout="total, sizes, prev, pager, next, jumper">
  91. </el-pagination>
  92. </template>
  93. <attach-detail-dialog ref="attachDetail" />
  94. <program-add-or-update ref="addOrUpdate" v-if="addOrUpdateVisible" @onChose="onChose"
  95. @refreshDataList="getDataList"></program-add-or-update>
  96. <program-detail ref="detail" v-if="detailVisible" @onChose="onChose"></program-detail>
  97. <program-assign ref="assign" v-if="assignVisible" :programId="assignId" @close="onAssignClose"></program-assign>
  98. <note-change ref="noteChange" v-if="noteChangeVisible" @onChose="onChose"></note-change>
  99. </div>
  100. </template>
  101. <script>
  102. import { getProductList } from '@/api/product'
  103. import { getList } from '@/api/program'
  104. import AttachDetailDialog from '../common/attach-detail-dialog'
  105. import ProgramAddOrUpdate from './program-add-or-update'
  106. import ProgramDetail from './program-detail'
  107. import ProgramAssign from './program-assign'
  108. import { isAuth } from '@/utils'
  109. import UserComponent from '@/views/modules/common/user-component.vue'
  110. import NoteChange from './program-note-change'
  111. export default {
  112. name: 'program',
  113. components: {
  114. UserComponent,
  115. AttachDetailDialog,
  116. ProgramAddOrUpdate,
  117. ProgramDetail,
  118. ProgramAssign,
  119. NoteChange
  120. },
  121. data() {
  122. return {
  123. addOrUpdateVisible: false,
  124. detailVisible: false,
  125. noteChangeVisible: false,
  126. dataForm: {},
  127. dataList: [],
  128. pageIndex: 1,
  129. pageSize: 10,
  130. totalPage: 0,
  131. dataListLoading: false,
  132. // 状态列表数据
  133. optionsState: [
  134. { value: '1', label: '待处理' },
  135. { value: '2', label: '已处理' }
  136. ],
  137. assignVisible: false,
  138. assignId: null
  139. }
  140. },
  141. created() {
  142. this.queryData()
  143. this.getProductList()
  144. },
  145. methods: {
  146. isAuth,
  147. onChose() {
  148. this.addOrUpdateVisible = false
  149. this.detailVisible = false
  150. this.assignVisible = false
  151. this.noteChangeVisible = false
  152. },
  153. getProductList() {
  154. let params = {
  155. current: 1,
  156. size: 100
  157. }
  158. getProductList(params).then(({ data }) => {
  159. if (data && data.code === '200') {
  160. this.materialList = data.data.records
  161. }
  162. })
  163. },
  164. // 查询
  165. queryData() {
  166. this.pageIndex = 1
  167. this.getDataList()
  168. },
  169. getDataList() {
  170. let param = {
  171. current: this.pageIndex,
  172. size: this.pageSize,
  173. ...this.dataForm
  174. }
  175. getList(param).then(({ data }) => {
  176. if (data && data.code === '200') {
  177. this.dataList = data.data.records
  178. }
  179. })
  180. },
  181. addOrUpdateHandle(id, type) {
  182. this.addOrUpdateVisible = true
  183. this.$nextTick(() => {
  184. this.$refs.addOrUpdate.init(id, type)
  185. })
  186. },
  187. showDetail(id) {
  188. this.detailVisible = true
  189. this.$nextTick(() => {
  190. this.$refs.detail.init(id)
  191. })
  192. },
  193. attachDetails(attachList) {
  194. this.$refs.attachDetail.init(attachList)
  195. },
  196. showAssign(row) {
  197. this.assignVisible = true
  198. this.$nextTick(() => {
  199. this.$refs.assign.init(row)
  200. })
  201. },
  202. onAssignClose() {
  203. this.assignVisible = false
  204. this.assignId = null
  205. this.getDataList()
  206. },
  207. noteChange() {
  208. this.noteChangeVisible = true
  209. this.$nextTick(() => {
  210. this.$refs.noteChange.init()
  211. })
  212. },
  213. // 每页数
  214. sizeChangeHandle(val) {
  215. this.pageSize = val
  216. this.pageIndex = 1
  217. this.getDataList()
  218. },
  219. // 当前页
  220. currentChangeHandle(val) {
  221. this.pageIndex = val
  222. this.getDataList()
  223. }
  224. }
  225. }
  226. </script>
  227. <style scoped></style>