赫艾前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

338 lines
10 KiB

4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
  1. <template>
  2. <div class="mod-config">
  3. <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: -20px;">
  4. <el-form-item :label="'工厂编码:'">
  5. <el-input v-model="searchData.site" style="width: 120px"></el-input>
  6. </el-form-item>
  7. <el-form-item :label="'操作员编号:'">
  8. <el-input v-model="searchData.operatorID" style="width: 120px"></el-input>
  9. </el-form-item>
  10. <el-form-item :label="'操作员名称:'">
  11. <el-input v-model="searchData.operatorName" style="width: 120px"></el-input>
  12. </el-form-item>
  13. <el-form-item label="是否在用:" >
  14. <el-select v-model="searchData.active" style="width: 120px">
  15. <el-option label="全部" value=""></el-option>
  16. <el-option label="在用" value="Y"></el-option>
  17. <el-option label="不在用" value="N"></el-option>
  18. </el-select>
  19. </el-form-item>
  20. <el-form-item label=" " >
  21. <el-button @click="search()" style="margin-left: 0px;margin-top: 0px" type="primary">查询</el-button>
  22. <download-excel
  23. :fields="exportDataStandard"
  24. :data="tableData"
  25. type="xlsx"
  26. :name="exportName"
  27. :header="exportHeader"
  28. :footer="exportFooter"
  29. :defaultValue="exportDefaultValue"
  30. :fetch="createExportData"
  31. :before-generate="startDownload"
  32. :before-finish="finishDownload"
  33. worksheet="导出信息"
  34. class="el-button el-button--primary el-button--medium">
  35. {{'导出'}}
  36. </download-excel>
  37. </el-form-item>
  38. </el-form>
  39. <el-table
  40. :height="height"
  41. :data="tableData"
  42. border
  43. style="width: 100%">
  44. <el-table-column
  45. prop="site"
  46. header-align="center"
  47. align="left"
  48. min-width="80"
  49. label="工厂编码">
  50. </el-table-column>
  51. <el-table-column
  52. prop="operatorID"
  53. header-align="center"
  54. align="left"
  55. min-width="70"
  56. label="操作员编码">
  57. </el-table-column>
  58. <el-table-column
  59. prop="operatorName"
  60. header-align="center"
  61. align="left"
  62. min-width="90"
  63. label="操作员姓名">
  64. </el-table-column>
  65. <el-table-column
  66. prop="active"
  67. header-align="center"
  68. align="left"
  69. min-width="70"
  70. label="是否在用">
  71. </el-table-column>
  72. <el-table-column
  73. prop="department"
  74. header-align="center"
  75. align="left"
  76. min-width="100"
  77. label="部门">
  78. </el-table-column>
  79. <el-table-column
  80. prop="createdDate"
  81. header-align="center"
  82. align="left"
  83. min-width="130"
  84. label="录入时间">
  85. </el-table-column>
  86. <el-table-column
  87. fixed="right"
  88. header-align="center"
  89. align="center"
  90. width="100"
  91. label="操作">
  92. <template slot-scope="scope">
  93. <a type="text" size="small" @click="skillMatrix(scope.row)">技能矩阵</a>
  94. </template>
  95. </el-table-column>
  96. </el-table>
  97. <el-dialog title="技能矩阵" :close-on-click-modal="false" v-drag :visible.sync="skillFlag" width="800px">
  98. <div style="font-size: 12px">
  99. 操作员编码<el-input v-model="operatorData.operatorID" style="width: 120px"></el-input>
  100. 操作员姓名<el-input v-model="operatorData.operatorName" style="width: 120px"></el-input>
  101. </div>
  102. <el-container style="margin-top: -12px;">
  103. <el-main style="width: 300px">
  104. <span style="font-size: 12px" >可选技能</span>
  105. <el-table
  106. height="300px"
  107. :data="skillList1"
  108. border
  109. @row-click="clickSkill1"
  110. highlight-current-row
  111. v-loading="dataListLoading"
  112. style="width: 100%">
  113. <el-table-column
  114. prop="workCenterNo"
  115. header-align="center"
  116. align="left"
  117. min-width="110"
  118. label="加工中心编码">
  119. </el-table-column>
  120. <el-table-column
  121. prop="workCenterDesc"
  122. header-align="center"
  123. align="left"
  124. min-width="170"
  125. label="加工中心名称">
  126. </el-table-column>
  127. </el-table>
  128. </el-main>
  129. <el-main style="width: 100px">
  130. <div style="margin-top: 100px">
  131. <el-button type="primary" @click="addSkill()">添加>></el-button>
  132. </div>
  133. <div style="margin-top: 20px">
  134. <el-button type="primary" @click="deleteSkill()">删除<<</el-button>
  135. </div>
  136. </el-main>
  137. <el-main style="width: 300px">
  138. <span style="font-size: 12px" >已选技能</span>
  139. <el-table
  140. height="300px"
  141. :data="skillList2"
  142. border
  143. @row-click="clickSkill2"
  144. highlight-current-row
  145. v-loading="dataListLoading"
  146. style="width: 100%">
  147. <el-table-column
  148. prop="workCenterNo"
  149. header-align="center"
  150. align="left"
  151. min-width="110"
  152. label="加工中心编码">
  153. </el-table-column>
  154. <el-table-column
  155. prop="workCenterDesc"
  156. header-align="center"
  157. align="left"
  158. min-width="170"
  159. label="加工中心名称">
  160. </el-table-column>
  161. </el-table>
  162. </el-main>
  163. </el-container>
  164. <!-- <el-footer style="height:40px;margin-top: 20px;text-align:center">-->
  165. <!-- <el-button type="primary" @click="routingModelFlag = false">关闭</el-button>-->
  166. <!-- </el-footer>-->
  167. </el-dialog>
  168. </div>
  169. </template>
  170. <script>
  171. import {
  172. getOperatorData,
  173. getWorkCenterData,
  174. getWorkCenterOperatorData,
  175. addSkill,
  176. deleteSkill
  177. } from "@/api/production.js"
  178. export default {
  179. name: 'searchDailyPlan',
  180. data () {
  181. return {
  182. // 导出 start
  183. exportData: [],
  184. exportDataStandard: {
  185. "工厂编码": "site",
  186. "操作员编码": "operatorID",
  187. "操作员姓名": "operatorName",
  188. "是否在用": "active",
  189. "部门": "department",
  190. "录入时间": "createdDate",
  191. },
  192. exportName: "操作员列表"+this.getStrDate(),
  193. exportHeader: ["操作员列表"],
  194. exportFooter: [],
  195. exportDefaultValue: "这一行这一列没有数据",
  196. dataListLoading:false,
  197. // 导出 end
  198. height:200,
  199. tableData:[],
  200. date1:'',
  201. searchData:{
  202. operatorID:'',
  203. operatorName:'',
  204. status:'all',
  205. site:this.$store.state.user.site,
  206. },
  207. operatorData:{
  208. operatorID:'',
  209. operatorName:'',
  210. site:'',
  211. },
  212. skillFlag:false,
  213. skillList1:[],
  214. skillList2:[],
  215. skillRow1:null,
  216. skillRow2:null,
  217. }
  218. },
  219. mounted() {
  220. this.$nextTick(()=>{
  221. this.height = window.innerHeight - 210;
  222. })
  223. },
  224. methods: {
  225. search(){
  226. getOperatorData(this.searchData).then(({data}) => {
  227. this.tableData = data.rows;
  228. })
  229. },
  230. createExportData() {
  231. return this.tableData;
  232. },
  233. startDownload() {
  234. // this.exportData = this.dataList
  235. },
  236. finishDownload() {
  237. },
  238. getStrDate() {
  239. let dd = new Date();
  240. let Y = dd.getFullYear();
  241. let M = (dd.getMonth() + 1) < 10 ? "0" + (dd.getMonth() + 1) : (dd.getMonth() + 1);//获取当前月份的日期,不足10补0
  242. let D = dd.getDate() < 10 ? "0" + dd.getDate() : dd.getDate();//获取当前几号,不足10补0
  243. let H = dd.getHours() < 10 ? "0" + dd.getHours() : dd.getHours();
  244. let MM = dd.getMinutes() < 10 ? "0" + dd.getMinutes() : dd.getMinutes();
  245. let S = dd.getSeconds() < 10 ? "0" + dd.getSeconds() : dd.getSeconds();
  246. return Y + M + D + H + MM + S;
  247. },
  248. clickSkill1(row){
  249. this.skillRow1 = JSON.parse(JSON.stringify(row));
  250. },
  251. clickSkill2(row){
  252. this.skillRow2 = JSON.parse(JSON.stringify(row));
  253. },
  254. skillMatrix(row){
  255. let inData={
  256. site:row.site,
  257. operatorID:row.operatorID,
  258. }
  259. this.operatorData.site=row.site;
  260. this.operatorData.operatorID=row.operatorID;
  261. this.operatorData.operatorName=row.operatorName;
  262. getWorkCenterData(inData).then(({data}) => {
  263. this.skillList1 = data.rows;
  264. })
  265. getWorkCenterOperatorData(inData).then(({data}) => {
  266. this.skillList2 = data.rows;
  267. })
  268. this.skillFlag=true;
  269. },
  270. addSkill(){
  271. if(this.skillRow1==null){
  272. this.$alert("请选择可选加工中心技能!", '错误', {
  273. confirmButtonText: '确定'
  274. })
  275. return false;
  276. }
  277. let inSkillData={
  278. site:this.operatorData.site,
  279. operatorID:this.operatorData.operatorID,
  280. workCenterNo:this.skillRow1.workCenterNo,
  281. user:this.$store.state.user.name,
  282. }
  283. addSkill(inSkillData).then(({data}) => {
  284. let inData={
  285. site:this.operatorData.site,
  286. operatorID:this.operatorData.operatorID,
  287. }
  288. getWorkCenterData(inData).then(({data}) => {
  289. this.skillList1 = data.rows;
  290. })
  291. getWorkCenterOperatorData(inData).then(({data}) => {
  292. this.skillList2 = data.rows;
  293. })
  294. this.skillRow1=null;
  295. })
  296. },
  297. deleteSkill(){
  298. if(this.skillRow2==null){
  299. this.$alert("请选择已选加工中心技能!", '错误', {
  300. confirmButtonText: '确定'
  301. })
  302. return false;
  303. }
  304. let inSkillData={
  305. site:this.operatorData.site,
  306. operatorID:this.operatorData.operatorID,
  307. workCenterNo:this.skillRow2.workCenterNo,
  308. }
  309. deleteSkill(inSkillData).then(({data}) => {
  310. let inData={
  311. site:this.operatorData.site,
  312. operatorID:this.operatorData.operatorID,
  313. }
  314. getWorkCenterData(inData).then(({data}) => {
  315. this.skillList1 = data.rows;
  316. })
  317. getWorkCenterOperatorData(inData).then(({data}) => {
  318. this.skillList2 = data.rows;
  319. })
  320. this.skillRow2=null;
  321. })
  322. },
  323. },
  324. created() {
  325. }
  326. }
  327. </script>
  328. <style scoped>
  329. </style>