requirementOther.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. // 提出需求
  2. <template>
  3. <div class="inwardRequirement">
  4. <div class="sache">
  5. <el-input placeholder="请输入内容" v-model="inputText" clearable>
  6. </el-input>
  7. <el-button type="primary" class="btn">
  8. <i class="el-icon-search"></i>查询
  9. </el-button>
  10. <el-button
  11. type="primary"
  12. class="btn"
  13. @click="toInsert2"
  14. v-if="activeName == 'first'"
  15. >
  16. <i class="el-icon-plus"></i>新增
  17. </el-button>
  18. <el-button
  19. type="primary"
  20. class="btn"
  21. @click="Issue"
  22. v-if="activeName == 'first'"
  23. >
  24. <i class="el-icon-download"></i>下发
  25. </el-button>
  26. </div>
  27. <template>
  28. <div>
  29. <el-tabs v-model="activeName" @tab-click="handleClick">
  30. <el-tab-pane label="未下发" name="first">
  31. <dilTable v-bind.sync="first" @selection-change="selectionChange" ref="table1">
  32. <el-table-column fixed="right" label="操作" width="120">
  33. <template slot-scope="scope">
  34. <el-button
  35. type="text"
  36. size="mini"
  37. @click="deleteRequirement(scope)"
  38. >
  39. 删除
  40. </el-button>
  41. </template>
  42. </el-table-column>
  43. </dilTable>
  44. </el-tab-pane>
  45. <el-tab-pane label="已下发" name="second">
  46. <dilTable v-bind.sync="second" ref="table">
  47. <el-table-column fixed="right" label="操作" width="80">
  48. <template slot-scope="scope">
  49. <el-button type="text" size="mini" @click="getRequirementOrder(scope)">运单</el-button>
  50. </template>
  51. </el-table-column>
  52. </dilTable>
  53. </el-tab-pane>
  54. </el-tabs>
  55. </div>
  56. </template>
  57. </div>
  58. </template>
  59. <script>
  60. import { getCookie } from "@/utils/util.js";
  61. export default {
  62. data() {
  63. return {
  64. inputText: "",
  65. orgCode:"",
  66. first: {
  67. // first请求数据的地址
  68. requestUrl:
  69. "",
  70. selectionType: "select",
  71. mapList: [],
  72. },
  73. second: {
  74. // second请求数据的地址
  75. requestUrl:
  76. "",
  77. },
  78. //记录旧的row对象(未下发)
  79. oldRow: "",
  80. //记录上一个展开的点击次数,单数为展开状态,复数为闭合状态(未下发)
  81. oldRowCount: 1,
  82. //记录旧的row对象(已下发)
  83. oldRow1: "",
  84. //记录上一个展开的点击次数,单数为展开状态,复数为闭合状态(已下发)
  85. oldRowCount1: 1,
  86. tableHead: [
  87. {
  88. prop: "materialName",
  89. label: "物资名称",
  90. width: 150,
  91. },
  92. {
  93. prop:"loadName",
  94. label:"装货点",
  95. width:150
  96. },
  97. {
  98. prop:"unloadName",
  99. label:"卸货点",
  100. width:150
  101. },
  102. {
  103. prop: "materialWeight",
  104. label: "物资重量",
  105. width: 150,
  106. },
  107. {
  108. prop: "materialCount",
  109. label: "物资数量",
  110. width: 150,
  111. },
  112. ],
  113. tableData: [],
  114. tableData1: [
  115. {
  116. materialCount : 100
  117. }
  118. ],
  119. activeName: "first",
  120. };
  121. },
  122. created(){
  123. if(getCookie("orgCode") == "dagangadmin"||getCookie("orgCode") == "zidonghuabu"){
  124. this.first.requestUrl = "/api/v1/ams/getTruckRequirementList?apiId=207&requirementStatus=0"
  125. this.second.requestUrl = "/api/v1/ams/getTruckRequirementList?apiId=207&requirementStatus=1"
  126. }else{
  127. this.first.requestUrl = "/api/v1/ams/getTruckRequirementList?apiId=207&requirementStatus=0&orgCode=" + getCookie("orgCode")
  128. this.second.requestUrl = "/api/v1/ams/getTruckRequirementList?apiId=207&requirementStatus=1&orgCode=" + getCookie("orgCode")
  129. }
  130. },
  131. methods: {
  132. //查看需求下面的运单
  133. getRequirementOrder(scope){
  134. this.$router.push(
  135. "/getRequirementOrder/" + scope.row.requirementId
  136. );
  137. },
  138. handleClick(tab, event) {
  139. this.getRequestUrl()
  140. },
  141. getRequestUrl(){
  142. if(getCookie("orgCode") == "dagangadmin"||getCookie("orgCode") == "zidonghuabu"){
  143. this.first.requestUrl = "/api/v1/ams/getTruckRequirementList?apiId=207&requirementStatus=0&i=" + new Date()
  144. this.second.requestUrl = "/api/v1/ams/getTruckRequirementList?apiId=207&requirementStatus=1&i=" + new Date()
  145. }else{
  146. this.first.requestUrl = "/api/v1/ams/getTruckRequirementList?apiId=207&requirementStatus=0&orgCode=" + getCookie("orgCode") + "&i=" + new Date()
  147. this.second.requestUrl = "/api/v1/ams/getTruckRequirementList?apiId=207&requirementStatus=1&orgCode=" + getCookie("orgCode") + "&i=" + new Date()
  148. }
  149. },
  150. selectionChange(selection) {
  151. this.first.mapList = selection;
  152. },
  153. toInsert2() {
  154. this.$router.push("/addRequirement2");
  155. },
  156. updateRequirement(scope) {
  157. this.$router.push(
  158. "/updateRequirement/" + scope.row.requirementId
  159. );
  160. },
  161. deleteRequirement(scope) {
  162. this.$confirm("是否删除", "提示", {
  163. confirmButtonText: "确定",
  164. cancelButtonText: "取消",
  165. type: "warning",
  166. center: true,
  167. })
  168. .then(() => {
  169. this.axios
  170. .post(
  171. "/api/v1/ams/deleteTruckRequirement/" + scope.row.requirementId
  172. )
  173. .then((res) => {
  174. if (res.data.code == 200) {
  175. this.$message({
  176. type: "success",
  177. message: "删除成功!",
  178. });
  179. this.getRequestUrl()
  180. } else {
  181. this.$message({
  182. message: "删除失败",
  183. type: "warning",
  184. });
  185. }
  186. });
  187. })
  188. .catch(() => {
  189. this.$message({
  190. type: "info",
  191. message: "删除操作已取消!",
  192. });
  193. });
  194. },
  195. Issue() {
  196. console.log(this.first.mapList);
  197. if(this.first.mapList.length == 0){
  198. this.$message.warning("请选择需求")
  199. return
  200. }
  201. // 权限控制,判断用户是否属于炼铁厂下面的车间
  202. for(let i=0;i<this.first.mapList.length;i++){
  203. if((this.first.mapList[i].requirementType=="计时")&&(getCookie("orgCode")=="liantiechang-yuanliaochejian"||getCookie("orgCode")=="liantiechang-shaojiechejian"||getCookie("orgCode")=="liantiechang-dagaoluchejian"||getCookie("orgCode")=="liantiechang-xiaogaoluchejian"||getCookie("orgCode")=="liantiechang-rongjichejian"||getCookie("orgCode")=="liantiechang-weijianchejian")){
  204. this.$message.warning("请选择联系炼铁厂相关负责人完成计时作业下发")
  205. return
  206. }
  207. }
  208. this.$confirm("是否下发", "提示", {
  209. confirmButtonText: "确定",
  210. cancelButtonText: "取消",
  211. type: "warning",
  212. center: true,
  213. })
  214. .then(() => {
  215. this.axios
  216. .post("/api/v1/ams/downRequirement", this.first.mapList)
  217. .then((res) => {
  218. if (res.data.code == 200) {
  219. this.$message({
  220. type: "success",
  221. message: "下发成功!",
  222. });
  223. this.getRequestUrl()
  224. this.activeName = 'second'
  225. } else {
  226. this.$message({
  227. message: "下发失败",
  228. type: "warning",
  229. });
  230. }
  231. });
  232. })
  233. .catch(() => {
  234. this.$message({
  235. type: "info",
  236. message: "取消下发!",
  237. });
  238. });
  239. },
  240. },
  241. };
  242. </script>
  243. <style lang="scss" scoped>
  244. .inwardRequirement{
  245. margin-top: 20px;
  246. margin-left: 20px;
  247. .sache{
  248. margin-top: 30px;
  249. padding-bottom: 10px;
  250. .el-input {
  251. width: 20%;
  252. }
  253. }
  254. }
  255. </style>