index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <template>
  2. <!-- 平安 新增仓库信息 -->
  3. <a-modal v-if="isOemByEnum(OemType.pingan)"
  4. class="add-warehouse commonModal"
  5. title="新增仓库信息"
  6. v-model:visible="visible"
  7. centered
  8. :maskClosable="false"
  9. @cancel="cancel"
  10. width="890px">
  11. <template #footer>
  12. <a-button key="submit"
  13. type="primary"
  14. :loading="loading"
  15. @click="cancel">取消</a-button>
  16. <a-button key="submit"
  17. type="primary"
  18. :loading="loading"
  19. @click="submit">完成</a-button>
  20. </template>
  21. <a-form class="inlineForm"
  22. ref="formRef"
  23. :model="formState"
  24. :rules="rules">
  25. <a-row :gutter="24">
  26. <a-col :span="12">
  27. <a-form-item label="仓库类型"
  28. name="warehousetype">
  29. <a-select class="typeSelect"
  30. style="width: 200px"
  31. v-model:value="formState.warehousetype"
  32. placeholder="请选择仓库类型">
  33. <a-select-option v-for="item in warehouseType"
  34. :key="item.enumitemname"
  35. :value="item.enumitemname">{{item.enumdicname}}</a-select-option>
  36. </a-select>
  37. </a-form-item>
  38. </a-col>
  39. <a-col :span="12">
  40. <a-form-item label="仓库名称"
  41. name="warehousename">
  42. <a-input class="dialogInput"
  43. style="width: 200px"
  44. v-model:value="formState.warehousename"
  45. placeholder="请输入仓库名称" />
  46. </a-form-item>
  47. </a-col>
  48. </a-row>
  49. <a-row :gutter="24">
  50. <a-col :span="12">
  51. <a-form-item label="仓库简称"
  52. name="warehousecode">
  53. <a-input class="dialogInput"
  54. style="width: 200px"
  55. v-model:value="formState.warehousecode"
  56. placeholder="请输入仓库简称" />
  57. </a-form-item>
  58. </a-col>
  59. </a-row>
  60. </a-form>
  61. </a-modal>
  62. <!-- 其他项目 新增仓库信息 -->
  63. <a-modal v-else
  64. class="add-warehouse commonModal"
  65. title="新增仓库信息"
  66. v-model:visible="visible"
  67. centered
  68. :maskClosable="false"
  69. @cancel="cancel"
  70. width="890px">
  71. <template #footer>
  72. <a-button key="submit"
  73. type="primary"
  74. :loading="loading"
  75. @click="cancel">取消</a-button>
  76. <a-button key="submit"
  77. type="primary"
  78. :loading="loading"
  79. @click="submit">完成</a-button>
  80. </template>
  81. <a-form class="inlineForm"
  82. ref="formRef"
  83. :model="formState"
  84. :rules="rules">
  85. <a-row :gutter="24">
  86. <a-col :span="12">
  87. <a-form-item label="仓库类型"
  88. name="warehousetype">
  89. <a-select class="typeSelect"
  90. style="width: 200px"
  91. v-model:value="formState.warehousetype"
  92. placeholder="请选择仓库类型">
  93. <a-select-option v-for="item in warehouseType"
  94. :key="item.enumitemname"
  95. :value="item.enumitemname">{{item.enumdicname}}</a-select-option>
  96. </a-select>
  97. </a-form-item>
  98. </a-col>
  99. <a-col :span="12">
  100. <a-form-item label="仓库名称"
  101. name="warehousename">
  102. <a-input class="dialogInput"
  103. style="width: 200px"
  104. v-model:value="formState.warehousename"
  105. placeholder="请输入仓库名称" />
  106. </a-form-item>
  107. </a-col>
  108. </a-row>
  109. <a-row :gutter="24">
  110. <a-col :span="12">
  111. <a-form-item label="仓库简称"
  112. name="warehousecode">
  113. <a-input class="dialogInput"
  114. style="width: 200px"
  115. v-model:value="formState.warehousecode"
  116. placeholder="请输入仓库简称" />
  117. </a-form-item>
  118. </a-col>
  119. <a-col :span="12">
  120. <a-form-item label="联系人"
  121. name="contactname">
  122. <a-input class="dialogInput"
  123. style="width: 200px"
  124. v-model:value="formState.contactname"
  125. placeholder="请输入联系人" />
  126. </a-form-item>
  127. </a-col>
  128. </a-row>
  129. <a-row :gutter="24">
  130. <a-col :span="24">
  131. <a-form-item label="联系电话"
  132. name="contactnum">
  133. <a-input class="dialogInput"
  134. style="width: 200px"
  135. v-model:value="formState.contactnum"
  136. placeholder="请输入联系电话" />
  137. </a-form-item>
  138. </a-col>
  139. </a-row>
  140. <a-row :gutter="24">
  141. <a-col :span="24">
  142. <a-form-item label="所在地区">
  143. <a-select class="inlineFormSelect"
  144. style="width: 205px"
  145. v-model:value="formState.provinceid"
  146. @change="getCityList"
  147. placeholder="请选择省">
  148. <a-select-option v-for="item in provinceList"
  149. :key="item.autoid"
  150. :value="item.autoid">{{item.divisionname}}</a-select-option>
  151. </a-select>
  152. <a-select class="inlineFormSelect ml9"
  153. style="width: 205px"
  154. v-model:value="formState.cityid"
  155. @change="getDistrictList"
  156. placeholder="请选择市">
  157. <a-select-option v-for="item in cityList"
  158. :key="item.autoid"
  159. :value="item.autoid">{{item.divisionname}}</a-select-option>
  160. </a-select>
  161. <a-select class="inlineFormSelect ml9"
  162. v-model:value="formState.districtid"
  163. style="width: 205px"
  164. placeholder="请选择县(区)">
  165. <a-select-option v-for="item in districtList"
  166. :key="item.autoid"
  167. :value="item.autoid">{{item.divisionname}}</a-select-option>
  168. </a-select>
  169. </a-form-item>
  170. </a-col>
  171. </a-row>
  172. <a-row :gutter="24">
  173. <a-col :span="24">
  174. <a-form-item label="详细地址"
  175. name="address">
  176. <a-input class="dialogInput"
  177. v-model:value="formState.address"
  178. style="width: 635px"
  179. placeholder="请输入详细地址" />
  180. </a-form-item>
  181. </a-col>
  182. </a-row>
  183. </a-form>
  184. </a-modal>
  185. </template>
  186. <script lang="ts">
  187. import { defineComponent, PropType, ref, toRaw } from 'vue';
  188. import { closeModal } from '@/common/setup/modal/index';
  189. import { getAddress } from '@/services/go/adress';
  190. import { handleForm, FormState } from '../setup';
  191. import { ValidateErrorEntity } from 'ant-design-vue/lib/form/interface';
  192. import { AllEnums } from '@/services/go/commonService/interface';
  193. import { WarehouseApplyReq } from '@/services/proto/warehouse/interface';
  194. import { ErmcpWareHouseInfo } from '@/services/go/ermcp/warehouse-info/interface';
  195. import { getWarehouseTypeEnumList } from '@/common/constants/enumsList';
  196. import { addWarehouseApply } from '@/services/proto/warehouse';
  197. import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
  198. import { validateAction } from '@/common/setup/form';
  199. import { isOemByEnum, OemType } from '@/common/config/projectName';
  200. export default defineComponent({
  201. name: 'warehouse_info_btn_add',
  202. components: {},
  203. props: {
  204. selectedRow: {
  205. type: Object as PropType<ErmcpWareHouseInfo>,
  206. default: {},
  207. },
  208. },
  209. setup(props, context) {
  210. const { visible, cancel } = closeModal('warehouse_info_btn_add');
  211. const loading = ref<boolean>(false);
  212. const { cityList, districtList, provinceList, getCityList, getDistrictList } = getAddress();
  213. const warehouseType = ref<AllEnums[]>(getWarehouseTypeEnumList());
  214. const { formRef, formState, rules } = handleForm();
  215. function submit() {
  216. validateAction<FormState>(formRef, formState).then((param) => {
  217. const reqParam: WarehouseApplyReq = {
  218. type: 1, // int32 类型 1 新增 2 修改
  219. warehouseid: param.warehouseid, // uint64 仓库ID
  220. warehousecode: param.warehousecode, // string 仓库代码
  221. warehousename: param.warehousename, // string 仓库名称
  222. warehousetype: undefined === param.warehousetype ? 0 : (param.warehousetype as number), // int32 仓库类型 - 1 厂库 2 自有库 3 合作库
  223. provinceid: undefined === param.provinceid ? 0 : (param.provinceid as number), // uint64 省
  224. cityid: undefined === param.cityid ? 0 : (param.cityid as number), // uint64 市
  225. districtid: undefined === param.districtid ? 0 : (param.districtid as number), // int32 区
  226. address: param.address, // string 详细地址
  227. contactname: param.contactname, // string 联系人
  228. contactnum: param.contactnum, // string 联系电话
  229. };
  230. requestResultLoadingAndInfo(addWarehouseApply, reqParam, loading, ['新建仓库成功', '新建仓库失败']).then(() => {
  231. cancel();
  232. context.emit('refresh');
  233. });
  234. });
  235. }
  236. return {
  237. visible,
  238. cancel,
  239. submit,
  240. loading,
  241. maskClosableFlag: false,
  242. cityList,
  243. districtList,
  244. provinceList,
  245. getCityList,
  246. getDistrictList,
  247. formRef,
  248. formState,
  249. rules,
  250. warehouseType,
  251. isOemByEnum,
  252. OemType,
  253. };
  254. },
  255. });
  256. </script>
  257. <style lang="less">
  258. .add-warehouse {
  259. }
  260. .upload {
  261. display: inline-flex;
  262. .ant-btn.uploadBtn {
  263. width: 60px;
  264. height: 30px;
  265. background: @m-blue0;
  266. border: 0;
  267. padding: 0;
  268. text-align: center;
  269. font-size: 14px;
  270. color: @m-white0;
  271. .rounded-corners(3px);
  272. &:hover {
  273. background: @m-blue0-hover;
  274. color: @m-white0-hover;
  275. }
  276. }
  277. .look {
  278. color: @m-blue0;
  279. font-size: 14px;
  280. margin-left: 10px;
  281. cursor: pointer;
  282. }
  283. }
  284. </style
  285. >;