editGatepost.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. <template>
  2. <!-- 门岗规则信息页面 -->
  3. <div class="homeworkPath">
  4. <page-title>门岗规则信息</page-title>
  5. <div>
  6. <el-form>
  7. <el-form-item>
  8. <div class="form1">
  9. <label class="el-form-item__label" style="width: 100px">门岗名称</label>
  10. <el-input
  11. placeholder=""
  12. v-model="gatepostName"
  13. :disabled="true">
  14. </el-input>
  15. </div>
  16. </el-form-item>
  17. </el-form>
  18. </div>
  19. <div class="form-box">
  20. <dil-form :formId="358" v-model="form"></dil-form>
  21. </div>
  22. <!-- 时间点 -->
  23. <div class="timeBox" >
  24. 门岗开门时间
  25. <el-time-select
  26. v-model="rulesGatepostStartTime"
  27. :picker-options="{
  28. start: '06:00',
  29. step: '01:00',
  30. end: '20:00'
  31. }"
  32. placeholder="选择时间"
  33. >
  34. </el-time-select>
  35. </div>
  36. <div class="timeBox">
  37. 门岗关门时间
  38. <el-time-select
  39. v-model="rulesGatepostEndTime"
  40. :picker-options="{
  41. start: '06:00',
  42. step: '01:00',
  43. end: '20:00'
  44. }"
  45. placeholder="选择门岗关门时间">
  46. </el-time-select>
  47. </div>
  48. <!-- 原料模态窗口显示 -->
  49. <div class="drawerBox">
  50. <el-form :inline="true" class="demo-form-inline">
  51. <el-form-item>
  52. <el-button type="primary" @click="drawer = true">增加物资</el-button>
  53. </el-form-item>
  54. </el-form>
  55. </div>
  56. <el-drawer
  57. :visible.sync="drawer"
  58. :direction="direction"
  59. >
  60. <el-input
  61. placeholder="请输入内容"
  62. v-model="inputText"
  63. clearable>
  64. </el-input>
  65. <el-button type="primary" class="btn" @click="onclick">
  66. <i class="el-icon-search"></i>查询
  67. </el-button>
  68. <div><dilTable v-bind.sync="options2" @selection-change="currentRadioChange" ></dilTable></div>
  69. </el-drawer>
  70. <div class="btn2">
  71. <el-button type="primary" @click="makeSure">新增规则</el-button>
  72. </div>
  73. <dilTable v-bind.sync="option">
  74. <el-table-column fixed="right" label="操作" align="center" width="150">
  75. <template slot-scope="scope">
  76. <el-button
  77. type="text"
  78. size="mini"
  79. @click="deleteclick(scope)"
  80. >删除</el-button
  81. >
  82. </template>
  83. </el-table-column>
  84. </dilTable>
  85. </div>
  86. </template>
  87. <script>
  88. import PageTitle from "@/components/Page/Title";
  89. export default {
  90. components: { PageTitle },
  91. data() {
  92. return {
  93. drawer:false,
  94. form: {},
  95. rulesGatepostStartTime:"",
  96. rulesGatepostEndTime:"",
  97. rulesGatepostEntityOutTypeList:{},
  98. materialNameList:{},
  99. direction: 'rtl',
  100. inputText:"",
  101. gatepostName:"",
  102. option: {
  103. // 表格请求数据的地址
  104. requestUrl:
  105. "/api/v1/rms/getGatepostRulesById/"+this.$route.params.gatepostId+"?apiId=349",
  106. },
  107. options2:{
  108. // 获取原料
  109. requestUrl: "/api/v1/rms/getMaterialList?apiId=351",
  110. selectionType:"select",
  111. materialList:[]
  112. }
  113. };
  114. },
  115. mounted() {
  116. console.log(this.$route)
  117. this.information();
  118. },
  119. methods: {
  120. currentRadioChange(selection){
  121. this.materialNameList=selection
  122. console.log("materialNameList",this.materialNameList);
  123. // materialName=this.materialNameList.materialName
  124. },
  125. // 触发事件,渲染页面
  126. information(){
  127. //编辑
  128. this.axios
  129. .post(
  130. "/api/v1/rms/getGatepostName/" +
  131. this.$route.params.gatepostId
  132. )
  133. .then((res) => {
  134. this.gatepostName=res.data.data.gatepostName
  135. });
  136. },
  137. onclick(){
  138. this.option2.requestUrl="/api/v1/rms/getMaterialList?apiId=351&con=" +this.inputText;
  139. },
  140. // 新增
  141. makeSure() {
  142. let rmsGatepostRules = {
  143. gatepostId:this.$route.params.gatepostId,
  144. rulesGatepostStartTime:this.rulesGatepostStartTime,
  145. rulesGatepostEndTime:this.rulesGatepostEndTime,
  146. vehicleTypeId:this.form.vehicleTypeId,
  147. };
  148. var materialIds=[];
  149. this.materialNameList.forEach((item,index) => {
  150. var materialId=item.materialId;
  151. materialIds.push(materialId);
  152. });
  153. let rulesGatepostEntityOutTypeList={
  154. rulesGatepostEntityOutTypeStr:this.form.rulesGatepostEntityOutTypeStr
  155. }
  156. // = this.materialNameList;
  157. // console.log("materialIds",materialIds);
  158. let mapValue={
  159. rmsGatepostRules:rmsGatepostRules,
  160. materialIds:materialIds,
  161. rulesGatepostEntityOutTypeList:rulesGatepostEntityOutTypeList
  162. }
  163. if (
  164. rmsGatepostRules.rulesGatepostStartTime == null ||
  165. rmsGatepostRules.rulesGatepostEndTime == null ||
  166. rmsGatepostRules.vehicleTypeId == null ||
  167. rulesGatepostEntityOutTypeList.rulesGatepostEntityOutTypeStr == null ||
  168. materialIds[0] == null
  169. )
  170. this.$message.error("存在空值!");
  171. else
  172. this.axios
  173. .post(
  174. "/api/v1/rms/insertGatepostRule",
  175. mapValue
  176. )
  177. .then((res) => {
  178. if (res.data.code == 200) {
  179. this.$message({
  180. type: "success",
  181. message: "新增成功!",
  182. });
  183. // this.$refs.table.refreshData();
  184. this.$router.go(0);
  185. } else {
  186. this.$message.error("新增失败!");
  187. }
  188. this.$refs["table"].resetField();
  189. });
  190. },
  191. deleteclick(scope) {
  192. this.$confirm("是否删除", "提示", {
  193. confirmButtonText: "确定",
  194. cancelButtonText: "取消",
  195. type: "warning",
  196. center: true,
  197. })
  198. .then(() => {
  199. this.axios
  200. .post("/api/v1/rms/deleteGatepostRules/"+scope.row.rulesId)
  201. .then(() => {
  202. this.$message({
  203. type: "success",
  204. message: "删除成功!",
  205. });
  206. this.$router.go(0);
  207. });
  208. })
  209. .catch(() => {
  210. this.$message({
  211. type: "info",
  212. message: "取消删除!",
  213. });
  214. });
  215. },
  216. },
  217. };
  218. </script>
  219. <style lang='scss'>
  220. .homeworkPath {
  221. .shipName{
  222. display: flex;
  223. justify-content: center;
  224. align-items: center;
  225. margin-top: 1.25rem;
  226. .text{
  227. width: 6.25rem;
  228. text-align: right;
  229. padding-right: 0.9375rem;
  230. font-size: 0.9375rem;
  231. font-weight: 600;
  232. color: #606266;
  233. }
  234. }
  235. .form1{
  236. display: flex;
  237. text-align: center;
  238. align-items: center;
  239. justify-content: center;
  240. margin-left: 34rem;
  241. width: 300px;
  242. }
  243. .form {
  244. display: flex;
  245. text-align: center;
  246. align-items: center;
  247. justify-content: center;
  248. margin-top: 4rem;
  249. margin-left: 35rem;
  250. width: 300px;
  251. }
  252. }
  253. .form-box{
  254. display: flex;
  255. justify-content: center;
  256. margin-top: 1rem;
  257. margin-left: -4rem;
  258. .el-form-item{
  259. display: flex;
  260. justify-content: center;
  261. .el-form-item__label{
  262. display: flex;
  263. align-items: center;
  264. }
  265. .el-form-item__content{
  266. .el-input{
  267. .el-input__inner{
  268. width: 250px;
  269. }
  270. }
  271. }
  272. }
  273. }
  274. .timeBox{
  275. display: flex;
  276. text-align: center;
  277. align-items: center;
  278. justify-content: center;
  279. margin-top: 1rem;
  280. margin-left: -4rem;
  281. }
  282. .drawerBox{
  283. margin-top: 2.5rem;
  284. margin-left: 40rem;
  285. }
  286. .btn2{
  287. margin-top: 2.5rem;
  288. margin-left: 40rem;
  289. }
  290. </style>