index.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905
  1. <template>
  2. <view id="unitInfoCollection" v-if="!successBool">
  3. <view>
  4. <u-notice-bar :text="noticeBarText" :duration="7000" color="#FF0000" bgColor="#FFFFFF"></u-notice-bar>
  5. </view>
  6. <view class="centerOne" v-if="pagingBool">
  7. <view class="title"> 单位基本信息(1/2) </view>
  8. <u--form :model="form" ref="uForm" :rules="rules" labelWidth="130">
  9. <view style="padding: 10px 0">
  10. <view style="padding: 10px 10px 20px 10px; background: #ffffff">
  11. <view style="padding-left: 9px">
  12. <u-form-item label="单位名称" prop="companyName" required :borderBottom="true">
  13. <u-input v-model="form.companyName" placeholder="请输入单位名称" border="none">
  14. <template #suffix>
  15. <u-icon name="search" color="#999999" size="22" @click="companySubmit(form.companyName)"></u-icon>
  16. </template>
  17. </u-input>
  18. </u-form-item>
  19. <u-form-item label="统一社会信用代码" prop="organization" required :borderBottom="true">
  20. <u-input v-model="form.organization" placeholder="请输入统一社会信用代码" border="none" maxlength="18" />
  21. </u-form-item>
  22. <u-form-item label="法人代表" prop="delegateName" required :borderBottom="true">
  23. <u-input v-model="form.delegateName" placeholder="请输入法人代表" border="none" />
  24. </u-form-item>
  25. <u-form-item label="所属街镇" prop="streetTown" required :borderBottom="true" @click="handleAction('所属街镇')">
  26. <u-input v-model="form.streetTown" placeholder="请选择所属街镇" suffixIcon="arrow-right" suffixIconStyle="color: #909399" border="none" />
  27. </u-form-item>
  28. <u-form-item label="单位地址" prop="address" required :borderBottom="true">
  29. <u-input v-model="form.address" placeholder="请输入单位地址" border="none" />
  30. </u-form-item>
  31. <u-form-item label="消防管理人电话" prop="fireManagePhone" required :borderBottom="true">
  32. <u-input v-model="form.fireManagePhone" placeholder="请输入消防管理人电话" border="none" maxlength="11" />
  33. </u-form-item>
  34. <u-form-item label="成立时间" prop="foundTime" required :borderBottom="true" @click="handleDateTime('成立时间', 0, form.foundTime)">
  35. <u-input v-model="form.foundTime" placeholder="请选择成立时间" border="none" suffixIcon="calendar" suffixIconStyle="color: #909399;font-size:22px" />
  36. </u-form-item>
  37. <u-form-item label="消防安全责任人" prop="fireDutyName" :borderBottom="true">
  38. <u-input v-model="form.fireDutyName" placeholder="请输入消防安全责任人" border="none" />
  39. </u-form-item>
  40. <u-form-item label="消防安全管理人" prop="fireManageName" :borderBottom="true">
  41. <u-input v-model="form.fireManageName" placeholder="请输入消防安全管理人" border="none" />
  42. </u-form-item>
  43. <u-form-item label="职工人数" prop="employeeNum" :borderBottom="true">
  44. <u-input type="digit" v-model="form.employeeNum" placeholder="请输入职工人数" suffixIcon="人" suffixIconStyle="color:#999999;font-size:15px" border="none" />
  45. </u-form-item>
  46. <u-form-item label="固定资产(万元)" prop="fixedAssets" :borderBottom="true">
  47. <u-input type="number" v-model="form.fixedAssets" placeholder="请输入固定资产(万元)" suffixIcon="万元" suffixIconStyle="color:#999999;font-size:15px" border="none" />
  48. </u-form-item>
  49. <u-form-item label="单位性质" prop="companyNature" :borderBottom="true" @click="handleAction('单位性质')">
  50. <u-input v-model="form.companyNature" placeholder="请选择单位性质" suffixIcon="arrow-right" suffixIconStyle="color: #909399" border="none" />
  51. </u-form-item>
  52. <u-form-item label="单位建筑面积" prop="buildArea" :borderBottom="true">
  53. <u-input type="number" v-model="form.buildArea" placeholder="请输入单位建筑面积" suffixIcon="平方米" suffixIconStyle="color:#999999;font-size:15px" border="none" />
  54. </u-form-item>
  55. </view>
  56. </view>
  57. </view>
  58. </u--form>
  59. <view style="padding-bottom: 70px"> </view>
  60. <view style="position: fixed; left: 0; right: 0; bottom: 0; padding: 15px">
  61. <view>
  62. <u-button type="primary" style="width: 100%; height: 40px; font-size: 14px" @click="handleSubmit('下一步')" shape="circle"> 下一步 </u-button>
  63. </view>
  64. </view>
  65. </view>
  66. <view class="centerTwo" v-else>
  67. <view class="title"> 所在建筑信息(2/2) </view>
  68. <u--form ref="uForm1" :model="form" :rules="rules" labelWidth="130">
  69. <view style="padding: 10px 0" v-for="(li, index) in form.baseBuildList" :key="index">
  70. <view class="" style="padding: 10px 10px 20px 10px; background: #ffffff">
  71. <view style="display: flex; overflow: hidden">
  72. <image style="width: 15px; height: 15px; margin: auto 10px auto 0" src="@/static/images/unitInfoCollection/icon1.png" />
  73. <view style="margin: auto auto auto 0">建筑{{ index + 1 }}</view>
  74. <u-icon v-if="form.baseBuildList.length > 1" name="trash" color="#FF0000" size="20" style="float: right" @click="deleteSubmit(index)"></u-icon>
  75. </view>
  76. <view style="padding-left: 9px">
  77. <u-form-item label="建筑名称" :prop="`baseBuildList.${index}.buildName`" required :borderBottom="true">
  78. <u-input v-model="li.buildName" placeholder="请输入建筑名称" border="none" />
  79. </u-form-item>
  80. <u-form-item label="建筑地址" :prop="`baseBuildList.${index}.address`" required :borderBottom="true">
  81. <u-input v-model="li.address" placeholder="请输入建筑地址" border="none" />
  82. </u-form-item>
  83. <u-form-item label="建筑结构" prop="li.buildStructure" required :borderBottom="true" @click="handleAction('建筑结构', index)">
  84. <u-input v-model="li.buildStructure" placeholder="请选择建筑结构" border="none" suffixIcon="arrow-right" suffixIconStyle="color: #909399" />
  85. </u-form-item>
  86. <u-form-item label="地上层数" prop="li.aboveFloor" required :borderBottom="true">
  87. <u-input v-model="li.aboveFloor" placeholder="请输入地上层数" border="none" />
  88. </u-form-item>
  89. <u-form-item label="地下层数" prop="li.underFloor" :borderBottom="true">
  90. <u-input v-model="li.underFloor" placeholder="请输入地下层数" border="none" />
  91. </u-form-item>
  92. <u-form-item label="建筑面积" prop="li.buildArea" required :borderBottom="true">
  93. <u-input v-model="li.buildArea" placeholder="请输入建筑面积" suffixIcon="平方米" suffixIconStyle="color:#999999;font-size:15px" border="none" />
  94. </u-form-item>
  95. <u-form-item label="地下空间" prop="li.underSpace" :borderBottom="true">
  96. <u-input v-model="li.underSpace" placeholder="请输入地下空间面积" suffixIcon="平方米" suffixIconStyle="color:#999999;font-size:15px" border="none" />
  97. </u-form-item>
  98. <u-form-item label="使用性质" prop="li.useCharacter" required :borderBottom="true" @click="handleAction('使用性质', index)">
  99. <u-input v-model="li.useCharacter" placeholder="请选择使用性质" suffixIcon="arrow-right" suffixIconStyle="color: #909399" border="none" />
  100. </u-form-item>
  101. <u-form-item label="建成年份" prop="li.completeYear" required :borderBottom="true" @click="handleDateTime('建成年份', index, li.completeYear)">
  102. <u-input v-model="li.completeYear" placeholder="请选择建成年份" suffixIcon="calendar" suffixIconStyle="color: #909399;font-size:22px" border="none" />
  103. </u-form-item>
  104. <u-form-item label="建筑高度" prop="li.buildHigh" required :borderBottom="true">
  105. <u-input v-model="li.buildHigh" placeholder="请输入建筑高度" suffixIcon="米" suffixIconStyle="color: #909399;font-size:15px" border="none" />
  106. </u-form-item>
  107. </view>
  108. </view>
  109. </view>
  110. </u--form>
  111. <view style="padding-bottom: 70px">
  112. <u-button type="primary" style="width: 25%; height: 25px; margin-top: 10px" @click="addSubmit" shape="circle" icon="plus" size="mini"> 添加建筑 </u-button>
  113. </view>
  114. <view style="position: fixed; left: 0; right: 0; bottom: 0; padding: 15px; background-color: transparent">
  115. <view style="display: flex">
  116. <u-button style="width: 50%; height: 40px; font-size: 14px; margin-right: 15px" @click="handleSubmit('上一步')" shape="circle" customStyle="border-color:#3c9cff;color:#3c9cff">
  117. 上一步
  118. </u-button>
  119. <u-button type="primary" style="width: 50%; height: 40px; font-size: 14px" @click="handleSubmit('提交')" shape="circle"> 提交 </u-button>
  120. </view>
  121. </view>
  122. </view>
  123. <u-picker
  124. :show="actionShow"
  125. :columns="actionsList"
  126. :title="'请选择' + actionTitle"
  127. keyName="name"
  128. visibleItemCount="6"
  129. :defaultIndex="[actionIndex]"
  130. :closeOnClickOverlay="true"
  131. @close="actionShow = false"
  132. @cancel="actionShow = false"
  133. @confirm="selectAction"
  134. ></u-picker>
  135. <u-datetime-picker
  136. :show="showTime"
  137. v-model="timeValue"
  138. mode="date"
  139. @close="showTime = false"
  140. @cancel="showTime = false"
  141. @confirm="timeSubmit"
  142. :closeOnClickOverlay="true"
  143. :minDate="Number(new Date('1900'))"
  144. :maxDate="Number(new Date())"
  145. ></u-datetime-picker>
  146. <u-modal
  147. :show="modalShow"
  148. title="系统提示"
  149. confirmText="修改"
  150. cancelText="新增"
  151. :showCancelButton="true"
  152. cancelColor="#2979ff"
  153. @confirm="handleSubmitApi('是')"
  154. @cancel="handleSubmitApi('否')"
  155. :closeOnClickOverlay="true"
  156. @close="modalShow = false"
  157. >
  158. <view class="slot-content">
  159. <view style="text-align: center; margin-bottom: 10px">是否修改单位名称为“{{ newCompanyName }}”的信息?</view>
  160. <view style="text-align: center; font-size: 13px; color: #ff0000">注:“修改”则点击修改,“新增”将提交一条新的记录,如需“取消”操作可点击空白区域</view>
  161. </view>
  162. </u-modal>
  163. </view>
  164. <view v-else>
  165. <view style="display: flex">
  166. <image style="width: 120px; height: 120px; margin: 50px auto 20px auto" src="@/static/images/unitInfoCollection/success.png" />
  167. </view>
  168. <view style="text-align: center; font-weight: 600">提交成功</view>
  169. </view>
  170. </template>
  171. <script setup>
  172. import { onLoad, onShow, onHide, onLaunch, onReady } from "@dcloudio/uni-app";
  173. import { ref, onMounted, inject, shallowRef, reactive, toRefs, getCurrentInstance } from "vue";
  174. import { getToken } from "@/utils/auth";
  175. import publicStore from "@/store/modules/public.js";
  176. import { companyByNameSelect, addBaseCompany, delBaseBuild } from "@/api/business/mhxf/unitInfoCollection";
  177. const { proxy } = getCurrentInstance();
  178. const newPublicStore = publicStore();
  179. const dataList = reactive({
  180. form: {
  181. companyName: "", //单位名称
  182. organization: "", //信用代码
  183. delegateName: "", //法人代表姓名
  184. streetTown: "", //所属街镇
  185. streetTownValue: 0, //所属街镇
  186. address: "", //详细地址
  187. fireManagePhone: "", //消防安全管理人电话
  188. foundTime: "", //单位成立时间
  189. fireDutyName: "", //消防安全责任人姓名
  190. fireManageName: "", //消防安全管理人姓名
  191. employeeNum: "", //职工人数
  192. fixedAssets: "", //固定资产(单位:万元)
  193. companyNature: "", //单位性质
  194. companyNatureValue: 0, //单位性质
  195. buildArea: "", //建筑面积
  196. baseBuildList: [],
  197. },
  198. baseBuildListForm: {
  199. buildName: "", //建筑名称
  200. address: "", //详细地址
  201. buildStructure: "", //建筑结构
  202. buildStructureValue: 0, //建筑结构
  203. aboveFloor: "", //地上楼层
  204. underFloor: "", //地下楼层
  205. buildArea: "", //建筑面积
  206. underSpace: "", //地下空间
  207. useCharacter: "", //使用性质
  208. useCharacterValue: 0,
  209. completeYear: "", //竣工年份
  210. buildHigh: "", //建筑高度
  211. },
  212. rules: {
  213. companyName: [
  214. {
  215. required: true,
  216. message: "请输入单位名称",
  217. trigger: ["blur", "change"],
  218. },
  219. ],
  220. organization: [
  221. {
  222. required: true,
  223. message: "请输入统一社会信用代码",
  224. trigger: ["blur", "change"],
  225. },
  226. {
  227. type: "string",
  228. min: 18,
  229. required: true,
  230. message: "请输入18位统一社会信用代码",
  231. trigger: ["change"],
  232. },
  233. ],
  234. delegateName: [
  235. {
  236. required: true,
  237. message: "请输入法人代表",
  238. trigger: ["blur", "change"],
  239. },
  240. ],
  241. streetTown: [
  242. {
  243. required: true,
  244. message: "请选择所属街镇",
  245. trigger: ["blur", "change"],
  246. },
  247. ],
  248. address: [
  249. {
  250. required: true,
  251. message: "请输入单位地址",
  252. trigger: ["blur", "change"],
  253. },
  254. ],
  255. fireManagePhone: [
  256. {
  257. required: true,
  258. message: "请输入消防管理人电话",
  259. trigger: ["blur", "change"],
  260. },
  261. {
  262. type: "string",
  263. min: 11,
  264. required: true,
  265. message: "请输入正确11位消防管理人电话",
  266. pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
  267. trigger: ["blur", "change"],
  268. },
  269. ],
  270. foundTime: [
  271. {
  272. required: true,
  273. message: "请选择成立时间",
  274. trigger: ["blur", "change"],
  275. },
  276. ],
  277. baseBuildList: [],
  278. },
  279. baseBuildListRules: {
  280. buildName: [
  281. {
  282. required: true,
  283. message: "请输入建筑名称",
  284. trigger: ["blur", "change"],
  285. },
  286. ],
  287. address: [
  288. {
  289. required: true,
  290. message: "请输入建筑地址",
  291. trigger: ["blur", "change"],
  292. },
  293. ],
  294. },
  295. noticeBarText: "注:信息提交后不可修改,提交前请核对填写是否有误",
  296. pagingBool: true,
  297. actionIndex: 0,
  298. actionTitle: "",
  299. actionShow: false,
  300. actionsList: [[]],
  301. showTime: false,
  302. timeValue: Number(new Date()),
  303. timeTitle: "",
  304. timeIndex: 0,
  305. modalShow: false,
  306. });
  307. const { form, baseBuildListForm, rules, baseBuildListRules, noticeBarText, pagingBool, actionTitle, actionIndex, actionsList, actionShow, showTime, timeValue, timeTitle, timeIndex, modalShow } =
  308. toRefs(dataList);
  309. const uForm = ref(null);
  310. const uForm1 = ref(null);
  311. const newCompanyName = ref("");
  312. const successBool = ref(false);
  313. /**
  314. * @单位名称
  315. * @icon图标按钮点击事件
  316. */
  317. function companySubmit(e) {
  318. actionsList.value = [[]];
  319. companyByNameSelect({
  320. companyName: e,
  321. }).then((res) => {
  322. if (res.status == "SUCCESS") {
  323. if (res.data.length > 0) {
  324. actionShow.value = true;
  325. res.data.forEach((el) => {
  326. el.name = el.companyName;
  327. actionsList.value[0].push(el);
  328. });
  329. actionTitle.value = "单位名称";
  330. } else {
  331. proxy.$modal.msg("未匹配到您所输入的单位!");
  332. }
  333. }
  334. });
  335. }
  336. /**
  337. * @上一步
  338. * @下一步
  339. * @提交
  340. * @按钮点击事件
  341. */
  342. function handleSubmit(value) {
  343. if (value === "上一步") {
  344. pagingBool.value = true;
  345. } else if (value === "下一步") {
  346. uForm.value
  347. .validate()
  348. .then((res) => {
  349. uni.$u.toast("校验通过");
  350. pagingBool.value = false;
  351. })
  352. .catch((errors) => {
  353. uni.$u.toast("校验失败");
  354. });
  355. } else if (value === "提交") {
  356. if (newCompanyName.value == "") {
  357. handleSubmitApi("否");
  358. } else {
  359. modalShow.value = true;
  360. }
  361. }
  362. }
  363. /**
  364. * @api提交
  365. */
  366. function handleSubmitApi(value) {
  367. console.log(form.value);
  368. let param = {};
  369. uForm1.value
  370. .validate()
  371. .then((res) => {
  372. uni.$u.toast("校验通过");
  373. param = {
  374. baseCompany: {
  375. companyName: form.value.companyName, //单位名称
  376. organization: form.value.organization, //组织机构代码
  377. address: form.value.address, //单位地址
  378. foundTime: form.value.foundTime + "T00:00:00", //成立时间
  379. companyNature: form.value.companyNature, //单位性质
  380. },
  381. baseCompanyAttach1: {
  382. employeeNum: form.value.employeeNum, //职工人数
  383. buildArea: form.value.buildArea, //建筑面积
  384. fixedAssets: form.value.fixedAssets, //固定资产
  385. },
  386. baseCompanyPerson: {
  387. delegateName: form.value.delegateName, //法人代表姓名
  388. fireDutyName: form.value.fireDutyName, //消防安全责任人姓名
  389. fireManageName: form.value.fireManageName, //消防安全管理人姓名
  390. fireManagePhone: form.value.fireManagePhone, //消防安全管理人电话
  391. },
  392. baseBuildList: [],
  393. };
  394. if (value === "是") {
  395. param.baseCompany.id = "id" in form.value ? form.value.id : undefined; //主键ID
  396. param.baseCompany.companyId = "companyId" in form.value ? form.value.companyId : undefined; //单位ID
  397. param.baseCompanyAttach1.id = "id1" in form.value ? form.value.id1 : undefined; //附表ID(id1)
  398. param.baseCompanyPerson.id = "id2" in form.value ? form.value.id2 : undefined; //单位关联人员表ID(id2)
  399. }
  400. form.value.baseBuildList.forEach((el, ind) => {
  401. param.baseBuildList.push({
  402. buildName: el.buildName, //建筑名称
  403. address: el.address, //详细地址
  404. buildStructure: el.buildStructureValue, //建筑结构
  405. aboveFloor: el.aboveFloor, //地上楼层
  406. underFloor: el.underFloor, //地下楼层
  407. buildArea: el.buildArea, //建筑面积
  408. underSpace: el.underSpace, //地下空间
  409. useCharacter: el.useCharacterValue, //使用性质
  410. completeYear: el.completeYear, //竣工年份
  411. buildHigh: el.buildHigh, //建筑高度
  412. });
  413. if (value === "是") {
  414. if ("id" in el) {
  415. param.baseBuildList[ind].id = el.id;
  416. }
  417. }
  418. });
  419. addBaseCompany(param).then((res) => {
  420. if (res.status == "SUCCESS") {
  421. if (getToken()) {
  422. uni.showToast({
  423. title: "提交成功",
  424. });
  425. setTimeout(() => {
  426. proxy.$tab.reLaunch("/pages/index");
  427. }, 2000);
  428. } else {
  429. successBool.value = true;
  430. }
  431. }
  432. });
  433. })
  434. .catch((errors) => {
  435. uni.$u.toast("校验失败");
  436. });
  437. }
  438. /**
  439. * @action弹出框点击事件
  440. */
  441. function handleAction(value, index) {
  442. actionShow.value = true;
  443. if (value == "建筑结构") {
  444. actionsList.value = [
  445. [
  446. {
  447. value: 2,
  448. name: "钢筋混凝土",
  449. },
  450. {
  451. value: 1,
  452. name: "砖混结构",
  453. },
  454. {
  455. value: 3,
  456. name: "钢结构",
  457. },
  458. {
  459. value: 4,
  460. name: "大型钢筋混凝土",
  461. },
  462. {
  463. value: 5,
  464. name: "木质结构",
  465. },
  466. {
  467. value: 6,
  468. name: "砖木结构",
  469. },
  470. ],
  471. ];
  472. actionTitle.value = "建筑结构";
  473. actionIndex.value = index;
  474. }
  475. if (value == "使用性质") {
  476. actionsList.value = [
  477. [
  478. {
  479. value: 1,
  480. name: "饭店、旅馆",
  481. },
  482. {
  483. value: 2,
  484. name: "公寓、住宅",
  485. },
  486. {
  487. value: 3,
  488. name: "体育场馆",
  489. },
  490. {
  491. value: 4,
  492. name: "俱乐部、夜总会、歌舞厅电影院、剧院、礼堂办公、商务科研 (包括实验室等)",
  493. },
  494. {
  495. value: 5,
  496. name: "医院",
  497. },
  498. {
  499. value: 6,
  500. name: "教学",
  501. },
  502. {
  503. value: 7,
  504. name: "商业 (包括商店、商场、集贸市场等)",
  505. },
  506. {
  507. value: 8,
  508. name: "金融",
  509. },
  510. {
  511. value: 9,
  512. name: "交通",
  513. },
  514. {
  515. value: 10,
  516. name: "文博馆(包括展览馆、博物馆、图书馆、档案馆、文化馆等)",
  517. },
  518. {
  519. value: 11,
  520. name: "通信枢纽、电视广播发射、中转",
  521. },
  522. {
  523. value: 12,
  524. name: "厂房",
  525. },
  526. {
  527. value: 13,
  528. name: "库房",
  529. },
  530. {
  531. value: 14,
  532. name: "油气罐站、管线",
  533. },
  534. {
  535. value: 15,
  536. name: "综台建筑",
  537. },
  538. {
  539. value: 16,
  540. name: "其他",
  541. },
  542. ],
  543. ];
  544. actionTitle.value = "使用性质";
  545. actionIndex.value = index;
  546. }
  547. if (value == "单位性质") {
  548. actionsList.value = [
  549. [
  550. {
  551. value: 1,
  552. name: "机关",
  553. },
  554. {
  555. value: 2,
  556. name: "团体",
  557. },
  558. {
  559. value: 3,
  560. name: "企业",
  561. },
  562. {
  563. value: 4,
  564. name: "事业",
  565. },
  566. {
  567. value: 5,
  568. name: "其他",
  569. },
  570. ],
  571. ];
  572. actionTitle.value = "单位性质";
  573. }
  574. if (value == "所属街镇") {
  575. actionsList.value = [
  576. [
  577. {
  578. name: "江川路街道",
  579. value: 1201,
  580. x: 121.399126538181,
  581. y: 31.0099719391863,
  582. },
  583. {
  584. name: "新虹街道",
  585. value: 1217,
  586. x: 121.319329296294,
  587. y: 31.1983901916889,
  588. },
  589. {
  590. name: "古美路街道",
  591. value: 1206,
  592. x: 121.388451866936,
  593. y: 31.1478233480159,
  594. },
  595. {
  596. name: "浦锦街道",
  597. value: 1218,
  598. x: 121.483929120352,
  599. y: 31.089967318558,
  600. },
  601. {
  602. name: "浦江镇",
  603. value: 1215,
  604. x: 121.524058543447,
  605. y: 31.0540039472667,
  606. },
  607. {
  608. name: "吴泾镇",
  609. value: 1213,
  610. x: 121.454076463728,
  611. y: 31.04860402113,
  612. },
  613. {
  614. name: "马桥镇",
  615. value: 1214,
  616. x: 121.352680027718,
  617. y: 31.0213512298508,
  618. },
  619. {
  620. name: "颛桥镇",
  621. value: 1209,
  622. x: 121.40607138504,
  623. y: 31.0612972443508,
  624. },
  625. {
  626. name: "莘庄镇",
  627. value: 1207,
  628. x: 121.37064864047,
  629. y: 31.1154549548722,
  630. },
  631. {
  632. name: "梅陇镇",
  633. value: 1212,
  634. x: 121.421346814491,
  635. y: 31.1069718313722,
  636. },
  637. {
  638. name: "七宝镇",
  639. value: 1208,
  640. x: 121.350366186317,
  641. y: 31.1553292680362,
  642. },
  643. {
  644. name: "虹桥镇",
  645. value: 1211,
  646. x: 121.37956256207,
  647. y: 31.1806219953212,
  648. },
  649. {
  650. name: "华漕镇",
  651. value: 1210,
  652. x: 121.277541517147,
  653. y: 31.2289121171624,
  654. },
  655. {
  656. name: "莘庄工业区",
  657. value: 1216,
  658. x: 121.376508452784,
  659. y: 31.0678185611843,
  660. },
  661. ],
  662. ];
  663. actionTitle.value = "所属街镇";
  664. }
  665. }
  666. /**
  667. * @action弹出框选择事件
  668. */
  669. function selectAction(e) {
  670. if (actionTitle.value == "建筑结构") {
  671. form.value.baseBuildList[actionIndex.value].buildStructure = e.value[0].name;
  672. form.value.baseBuildList[actionIndex.value].buildStructureValue = e.value[0].value;
  673. }
  674. if (actionTitle.value == "使用性质") {
  675. form.value.baseBuildList[actionIndex.value].useCharacter = e.value[0].name;
  676. form.value.baseBuildList[actionIndex.value].useCharacterValue = e.value[0].value;
  677. }
  678. if (actionTitle.value == "单位性质") {
  679. form.value.companyNature = e.value[0].name;
  680. form.value.companyNatureValue = e.value[0].value;
  681. }
  682. if (actionTitle.value == "所属街镇") {
  683. form.value.streetTown = e.value[0].name;
  684. form.value.streetTownValue = e.value[0].value;
  685. }
  686. if (actionTitle.value == "单位名称") {
  687. form.value.baseBuildList = [];
  688. newCompanyName.value = e.value[0].companyName;
  689. // form.value = e.value[0];
  690. form.value.id = e.value[0].id;
  691. form.value.id1 = e.value[0].id1;
  692. form.value.id2 = e.value[0].id2;
  693. form.value.companyId = e.value[0].companyId;
  694. form.value.companyName = e.value[0].companyName;
  695. form.value.organization = e.value[0].organization;
  696. form.value.delegateName = e.value[0].delegateName;
  697. form.value.address = e.value[0].address;
  698. form.value.foundTime = e.value[0].foundTime.split("T")[0];
  699. if (e.value[0].baseBuildList != null) {
  700. form.value.baseBuildList = e.value[0].baseBuildList;
  701. } else {
  702. form.value.baseBuildList.push(baseBuildListForm.value);
  703. }
  704. form.value.baseBuildList.forEach((el) => {
  705. el.buildStructureValue = el.buildStructure;
  706. el.buildStructure =
  707. el.buildStructure == 1
  708. ? "砖混结构"
  709. : el.buildStructure == 2
  710. ? "钢筋混凝土"
  711. : el.buildStructure == 3
  712. ? "钢结构"
  713. : el.buildStructure == 4
  714. ? "大型钢筋混凝土"
  715. : el.buildStructure == 5
  716. ? "木质结构"
  717. : el.buildStructure == 6
  718. ? "砖木结构"
  719. : "未知";
  720. el.useCharacterValue = el.useCharacter;
  721. el.useCharacter =
  722. el.useCharacter == 1
  723. ? "饭店、旅馆"
  724. : el.useCharacter == 2
  725. ? "公寓、住宅"
  726. : el.useCharacter == 3
  727. ? "体育场馆"
  728. : el.useCharacter == 4
  729. ? "俱乐部、夜总会、歌舞厅电影院、剧院、礼堂办公、商务科研 (包括实验室等)"
  730. : el.useCharacter == 5
  731. ? "医院"
  732. : el.useCharacter == 6
  733. ? "教学"
  734. : el.useCharacter == 7
  735. ? "商业 (包括商店、商场、集贸市场等)"
  736. : el.useCharacter == 8
  737. ? "金融"
  738. : el.useCharacter == 9
  739. ? "交通"
  740. : el.useCharacter == 10
  741. ? "文博馆(包括展览馆、博物馆、图书馆、档案馆、文化馆等)"
  742. : el.useCharacter == 11
  743. ? "通信枢纽、电视广播发射、中转"
  744. : el.useCharacter == 12
  745. ? "厂房"
  746. : el.useCharacter == 13
  747. ? "库房"
  748. : el.useCharacter == 14
  749. ? "油气罐站、管线"
  750. : el.useCharacter == 15
  751. ? "综台建筑"
  752. : el.useCharacter == 16
  753. ? "其他"
  754. : "未知";
  755. });
  756. }
  757. actionShow.value = false;
  758. }
  759. /**
  760. * @时间弹出框点击事件
  761. */
  762. function handleDateTime(value, index, time) {
  763. showTime.value = true;
  764. if (value == "成立时间") {
  765. timeValue.value = time ? Number(new Date(time)) : Number(new Date());
  766. timeIndex.value = index;
  767. timeTitle.value = "成立时间";
  768. } else if (value == "建成年份") {
  769. timeValue.value = time ? Number(new Date(time)) : Number(new Date());
  770. timeIndex.value = index;
  771. timeTitle.value = "建成年份";
  772. }
  773. }
  774. /**
  775. * @时间选择器
  776. * @确定按钮事件
  777. */
  778. function timeSubmit(data) {
  779. let time = newPublicStore.formatterDate(data.value);
  780. let timeData = time.split(" ")[0];
  781. if (timeTitle.value == "成立时间") {
  782. form.value.foundTime = timeData;
  783. } else if (timeTitle.value == "建成年份") {
  784. form.value.baseBuildList[timeIndex.value].completeYear = timeData;
  785. }
  786. showTime.value = false;
  787. }
  788. /**
  789. * @添加建筑
  790. * @按钮点击事件
  791. */
  792. function addSubmit() {
  793. form.value.baseBuildList.push(baseBuildListForm.value);
  794. rules.value.baseBuildList.push(baseBuildListRules.value);
  795. }
  796. /**
  797. * @删除建筑
  798. * @按钮点击事件
  799. */
  800. function deleteSubmit(index) {
  801. if ("id" in form.value.baseBuildList[index]) {
  802. delBaseBuild(form.value.baseBuildList[index].id).then((res) => {
  803. if (res.status == "SUCCESS") {
  804. form.value.baseBuildList.splice(index, 1);
  805. }
  806. });
  807. } else {
  808. form.value.baseBuildList.splice(index, 1);
  809. }
  810. rules.value.baseBuildList.splice(index, 1);
  811. }
  812. onLoad((options) => {
  813. form.value.baseBuildList = [];
  814. rules.value.baseBuildList = [];
  815. form.value.baseBuildList.push(baseBuildListForm.value);
  816. rules.value.baseBuildList.push(baseBuildListRules.value);
  817. if (!getToken()) {
  818. document.getElementsByClassName("uni-page-head-hd")[0].style.cssText = "display: none;";
  819. }
  820. });
  821. </script>
  822. <style lang="scss">
  823. #unitInfoCollection {
  824. .centerOne,
  825. .centerTwo {
  826. .title {
  827. color: #333333;
  828. text-align: center;
  829. margin-top: 10px;
  830. }
  831. }
  832. }
  833. </style>