|
@@ -486,7 +486,7 @@
|
|
|
</div>
|
|
|
<div>
|
|
|
<div v-for="(item, index) in proStation" :key="index" class="mt-1">
|
|
|
- <el-input v-model="item.name" style="width: 340px" placeholder="阶段名称" />
|
|
|
+ <el-input v-model="item.dictValue" style="width: 340px" placeholder="阶段名称" />
|
|
|
<el-link :underline="false" type="primary">
|
|
|
<hc-icon name="add" style="font-size: 20px;" class="font-bold" @click="addClick(item, index)" />
|
|
|
</el-link>
|
|
@@ -498,7 +498,7 @@
|
|
|
|
|
|
|
|
|
<div class="mt-3">
|
|
|
- <el-button color="#20C98B" type="primary" class="ml-28">
|
|
|
+ <el-button color="#20C98B" type="primary" class="ml-28" :loading="saveProStationLoad" @click="saveProStation">
|
|
|
<hc-icon name="save" class="text-white" />
|
|
|
<span class="text-white">保存</span>
|
|
|
</el-button>
|
|
@@ -513,7 +513,7 @@
|
|
|
</div>
|
|
|
<div>
|
|
|
<div v-for="(item, index) in proType" :key="index" class="mt-1">
|
|
|
- <el-input v-model="item.name" style="width: 340px" placeholder="类型名称" />
|
|
|
+ <el-input v-model="item.dictValue" style="width: 340px" placeholder="类型名称" />
|
|
|
<el-link :underline="false" type="primary">
|
|
|
<hc-icon name="add" style="font-size: 20px;" class="font-bold" @click="addClickType(item, index)" />
|
|
|
</el-link>
|
|
@@ -525,7 +525,7 @@
|
|
|
|
|
|
|
|
|
<div class="mt-3">
|
|
|
- <el-button color="#20C98B" type="primary" class="ml-28">
|
|
|
+ <el-button color="#20C98B" type="primary" class="ml-28" :loading="saveProTypenLoad" @click="saveProType">
|
|
|
<hc-icon name="save" class="text-white" />
|
|
|
<span class="text-white">保存</span>
|
|
|
</el-button>
|
|
@@ -545,7 +545,7 @@
|
|
|
</div>
|
|
|
<div>
|
|
|
<div v-for="(item, index) in proStationTip" :key="index" class="mt-1">
|
|
|
- <el-input v-model="item.name" style="width: 340px" placeholder="阶段名称" />
|
|
|
+ <el-input v-model="item.dictValue" style="width: 340px" placeholder="阶段名称" />
|
|
|
<el-link :underline="false" type="primary">
|
|
|
<hc-icon name="add" style="font-size: 20px;" class="font-bold" @click="addClickTip(item, index)" />
|
|
|
</el-link>
|
|
@@ -555,7 +555,7 @@
|
|
|
</div>
|
|
|
|
|
|
<div class="mt-3">
|
|
|
- <el-button color="#20C98B" type="primary" class="ml-28">
|
|
|
+ <el-button color="#20C98B" type="primary" class="ml-28" :loading="savProStationTipLoad" @click="saveProStationTip">
|
|
|
<hc-icon name="save" class="text-white" />
|
|
|
<span class="text-white">保存</span>
|
|
|
</el-button>
|
|
@@ -574,7 +574,14 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
- import { ref, watch } from 'vue'
|
|
|
+ import { onMounted, ref, watch } from 'vue'
|
|
|
+ import { getDictionary, saveDict } from '~api/dictbiz'
|
|
|
+ import { arrToKey, formValidate, getArrValue, getObjValue, isArrItem } from 'js-fast-way'
|
|
|
+ onMounted(()=>{
|
|
|
+ getProStation()
|
|
|
+ getProType()
|
|
|
+ getProStationTip()
|
|
|
+ })
|
|
|
const inputVal = ref(75)
|
|
|
const inputVal2 = ref('')
|
|
|
const activeNames = ref(['1'])
|
|
@@ -602,43 +609,144 @@
|
|
|
}
|
|
|
}
|
|
|
const proStation = ref([
|
|
|
- { name:'新开项目' },
|
|
|
- { name:'建成项目' },
|
|
|
- { name:'在建项目' },
|
|
|
- { name:'加快前期工作项目' },
|
|
|
+ { dictValue:'' },
|
|
|
])
|
|
|
+
|
|
|
+ const getProStation = async () => {
|
|
|
+ const { error, code, data } = await getDictionary({ code:'projectStage' })
|
|
|
+ if (!error && code === 200) {
|
|
|
+ proStation.value = getArrValue(data)
|
|
|
+ if ( proStation.value.length === 0) {
|
|
|
+ proStation.value = [
|
|
|
+ { dictValue:'' },
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ proStation.value = []
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
const addClick = (item, index)=>{
|
|
|
|
|
|
- proStation.value.splice(index, 0, { name:'' })
|
|
|
+ proStation.value.splice(index, 0, { dictValue:'' })
|
|
|
}
|
|
|
const delClick = (item, index)=>{
|
|
|
+ if ( proStation.value.length === 1) {
|
|
|
+ window.$message.warning('请至少保留一条数据')
|
|
|
+ return
|
|
|
+ }
|
|
|
proStation.value.splice(index, 1)
|
|
|
}
|
|
|
+ const saveProStationLoad = ref(false)
|
|
|
+ const saveProStation = async ()=>{
|
|
|
+ const list = arrToKey(proStation.value, 'dictValue', ',') .split(',')
|
|
|
+ const isIn = isArrItem(list, '') // true
|
|
|
+ if (isIn) {
|
|
|
+ window.$message.warning('请输入阶段名称')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ saveProStationLoad.value = true
|
|
|
+ const { error, code, msg } = await saveDict({ type:1, list })
|
|
|
+ saveProStationLoad.value = false
|
|
|
+ if (!error && code === 200) {
|
|
|
+ window?.$message?.success(msg)
|
|
|
+ getProStation()
|
|
|
+ } else {
|
|
|
+ window.$message.error(msg ?? '操作失败')
|
|
|
+ }
|
|
|
+ }
|
|
|
const proType = ref([
|
|
|
{ name:'铁路' },
|
|
|
{ name:'建成项目' },
|
|
|
|
|
|
])
|
|
|
+ const getProType = async () => {
|
|
|
+ const { error, code, data } = await getDictionary({ code:'projectType' })
|
|
|
+ if (!error && code === 200) {
|
|
|
+ proType.value = getArrValue(data)
|
|
|
+ if ( proType.value.length === 0) {
|
|
|
+ proType.value = [
|
|
|
+ { dictValue:'' },
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ proType.value = []
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
const addClickType = (item, index)=>{
|
|
|
|
|
|
- proType.value.splice(index, 0, { name:'' })
|
|
|
+ proType.value.splice(index, 0, { dictValue:'' })
|
|
|
}
|
|
|
const delClickType = (item, index)=>{
|
|
|
+ if ( proType.value.length === 1) {
|
|
|
+ window.$message.warning('请至少保留一条数据')
|
|
|
+ return
|
|
|
+ }
|
|
|
proType.value.splice(index, 1)
|
|
|
}
|
|
|
+ const saveProTypenLoad = ref(false)
|
|
|
+ const saveProType = async ()=>{
|
|
|
+ const list = arrToKey(proType.value, 'dictValue', ',') .split(',')
|
|
|
+ const isIn = isArrItem(list, '') // true
|
|
|
+ if (isIn) {
|
|
|
+ window.$message.warning('请输入类型名称')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ saveProTypenLoad.value = true
|
|
|
+ const { error, code, msg } = await saveDict({ type:2, list })
|
|
|
+ saveProTypenLoad.value = false
|
|
|
+ if (!error && code === 200) {
|
|
|
+ window?.$message?.success(msg)
|
|
|
+ getProType()
|
|
|
+ } else {
|
|
|
+ window.$message.error(msg ?? '操作失败')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const proStationTip = ref([ ])
|
|
|
+const getProStationTip = async () => {
|
|
|
+const { error, code, data } = await getDictionary({ code:'workFocusStage' })
|
|
|
+ if (!error && code === 200) {
|
|
|
+ proStationTip.value = getArrValue(data)
|
|
|
+ if ( proStationTip.value.length === 0) {
|
|
|
+ proStationTip.value = [
|
|
|
+ { dictValue:'' },
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ proStationTip.value = []
|
|
|
+ }
|
|
|
|
|
|
- const proStationTip = ref([
|
|
|
- { name:'紧盯重大项目,推动交通投资稳进增效' },
|
|
|
- { name:'深化战略研究,优化完善交通规划体系' },
|
|
|
-
|
|
|
- ])
|
|
|
+}
|
|
|
const addClickTip = (item, index)=>{
|
|
|
|
|
|
- proStationTip.value.splice(index, 0, { name:'' })
|
|
|
+ proStationTip.value.splice(index, 0, { dictValue:'' })
|
|
|
}
|
|
|
const delClickTip = (item, index)=>{
|
|
|
+ if ( proStationTip.value.length === 1) {
|
|
|
+ window.$message.warning('请至少保留一条数据')
|
|
|
+ return
|
|
|
+ }
|
|
|
proStationTip.value.splice(index, 1)
|
|
|
}
|
|
|
+ const savProStationTipLoad = ref(false)
|
|
|
+ const saveProStationTip = async ()=>{
|
|
|
+ const list = arrToKey(proType.value, 'dictValue', ',') .split(',')
|
|
|
+ const isIn = isArrItem(list, '') // true
|
|
|
+ if (isIn) {
|
|
|
+ window.$message.warning('请输入阶段名称')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ savProStationTipLoad.value = true
|
|
|
+ const { error, code, msg } = await saveDict({ type:2, list })
|
|
|
+ savProStationTipLoad.value = false
|
|
|
+ if (!error && code === 200) {
|
|
|
+ window?.$message?.success(msg)
|
|
|
+ getProStationTip()
|
|
|
+ } else {
|
|
|
+ window.$message.error(msg ?? '操作失败')
|
|
|
+ }
|
|
|
+ }
|
|
|
</script>
|
|
|
|
|
|
<style lang='scss' scoped>
|